I am new to Dataform - I have 3 questions on usability

I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Number of replies: 18
Picture of Plugin developers

Hi Itamar 

This is first time implementing the amazing Dataform in a real-life scenario at my office. In short, I am interested in using Moodle as a Document Management System (DMS) and a file repository. And I believe that your Dataform module will help me achieve this goal.

But I'm a newbie. So, straight off the bat, I have three questions to ask:


Q1. 

Let's say I have added a field, category, which a Text Field, to the record. Then later, I change my mind and decide that category should actually be a Selection Type. 


Is there any way I can reassign category field to be of Selection Type without have to delete the field and re-adding it?


Q2. 
My Moodle site has two kind of users. Franchisees and others. So after adding the below three records, if a Moodle user is a Franchisee, I want him to only see the third row (ab02-doc3.docx) data when browsing. This is because the value of pointofuse is "franchise". 

Likewise, if a user is NOT a franchisee, then I want him to be able to see the first two rows. This is because in both rows1 and 2, the values of pointofuse do not contain the word "franchise". 


In other words, I want to automatically filter the records based on the type (group?) of Moodle user that is currently logged into the course.  So in this way some security of data confidential is ensured. For example, I don't want a franchisee to have access to a document is set as a non-franchisee document. Likewise, if the document is set as "franchisee" in the pointofuse field, then the franchisee can view the record in the Browse mode.

SO, Is there any setting or view manipulation that I can do that will achieve this? Or must I modify the core code?


Q3. 
The field dept is a Text Type field. The three possible values for the dept field are "operations", "purchasing", "finance" and "MIS" . I know that you can make
dept as Selection Type of field (with a set of pre-set values), but if I choose the Text Field type instead, is there any way in Dataform for the history of the past entries in this field to show up (drop down) in the edit box?

I am asking this because when I do the data entry, I may misspell the word "purchasing" and then I end up with two records, one with dept "purchasing", and the other with dept "purchase" for example. Another reason why the dept field is NOT a Selection Type is because the field is supposed to be open-ended (no preset values) as new departments may be created anytime within the company. 



Thanks for reading this. I hope to hear from you soon.

Cheers,
Frankie Kam


Average of ratings: -
In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -
Q1.

Currently there is no easy way to change the type of an existing field. In some cases (e.g. text to select) it requires content migration b/c the content is of a different type. This could be added as a dataformtool sub-plugin.

Q2.

a) One way to go about this is separate groups mode. You add your users to the proper groups, set the activity to Separate groups mode and you create the entries for their designated groups. The pattern [[EGR:edit] ] allows you, the manager/admin, to select the group when adding the entry.

b) You can also use filters. If you create a filter and assign it to a view (in the views index or configuration form) the filter is forced in that view and the (student) user can access in that view only the entries allowed by that filter. This method would require a a filtered view for each group of users. But with your usecase you need to assign users to groups anyway so the separate groups mode approach is likely to be easier.

c) If you use roles to identify your different user types, you can use access rules. For example, for each user type you can create a filtered view as in (b) and a view access rule in which you allow only the respective role to access its designated view.

d) Like (c) but with entry access rules so for each type you don't need to create a designated filtered view, but rather only an entry access rule which allow the respective role access to entries of that type.

e) And there are other possible approaches.

Q3.

With the select field you can use the [[<fieldname>:addnew] ] pattern to allow the user to add a new option while adding an entry. The option will be selected for the entry but also added to the field configured option and become available for selection in subsequent entries. It currently requires the managetemplates capability so is available only for teacher role and higher. The condition could probably be made more flexible but that requires a tracker issue and some discussion.

In any case you can always create a designated administrative view to display specific content. So, for instance, you can create a view which displays for each entry, only this field. The you can use bulk editing to adjust values as required. To allow only teachers or higher to access this view, set its visibility to disabled.

hth smile

Average of ratings: Useful (1)
In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

Hi Itamar

Thank you for the speedy reply!

>Currently there is no easy way to change the type of an existing field. In some cases (e.g. text to select) it requires content migration b/c the content is of a different type. This could be added as a dataformtool sub-plugin.
>
Noted. Yes, I couldn't find a way to do this. An "easy way to change the type of an existing field " helps when I am prototyping a dataform and do not have all the specs/analysis done clearly. That way I can change the datatype on the fly - assuming no data has been entered yet. I guess in the absence of an existing "dataformtool sub-plugin", I will have to settle for this: I need to be more disciplined in the table/record/field design part.

>a) One way to go about this is separate groups mode. You add your users to the proper groups, 

>set the activity to Separate groups mode and you create the entries for their designated groups.
>The pattern [[EGR:edit] ] allows you, the manager/admin, to select the group when adding
>the 
entry.
>

I have two groups. HQ group and Franchisee group. AFAIK, if I choose the HQ group and add documents, a HQ user only sees the documents that I added to the dataform when I am under the HQ group mode. Same goes for the Franchisee user who belongs to the Franchisee group. That user who belongs to the Franchisee group only sees the documents that I added when I choose the group "Franchisee".

However, in actual fact, the HQ group should be able to see its own documents as well as the Franchisee group documents. The Franchisee group only sees its own documents, meaning that HQ documents are hidden from it.

In summary:

A user belonging to the HQ group sees HQ-group and Franchisee-group documents 
A user belonging to the Franchisee group sees ONLY Franchisee-group documents 
So, how do I organise my HQ group so that this is possible? 


With the select field you can use the [[<fieldname>:addnew] ] pattern to allow the user to add a new option while adding an entry. 
>

This [[<fieldname>:addnew] ]  pattern is a live-saver for me! Thanks for this.

Cheers
Frankie Kam


In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -
Your distinction between HQ and Franchisee looks more like a role distinction then group distinction. You can use entry access rules to control access to entries by role. In this case you would prevent the Franchisee role access to non-Franchisee entries. smile
In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

Hi Itamar

>  the [[<fieldname>:addnew] ] pattern to allow the user to add a new option while adding an entry. 
>

No can do. Here's my settings:


but the result is this:


A drop-down box appears, but I cannot enter any new value. A 'red no-entry sign' shows up on when I do a mouse hover over the edit box. I want to be able to select a value from the select selection box, and I want to be able to type in a new value and after I save the record, that new value will be appended as a fresh value inside the drop-down list. What am I doing wrong?

Cheers,
Frankie Kam

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -

You either select a value or add a new one. This value would be selected for the entry content, so you cannot do both. If you want to add a new value you need to unselect the value in the dropdown (that is, set it to 'choose'). Note that this way you effectively add entry content. If you just want to add options to the field you should use the field configuration form. smile

In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

Hi Itamar

Thanks for your replies.

field configuration form (FCF)
>

Where is this FCF?

My settings:


Strange. it works once. I managed to type "wow" inside the "New value" edit box. The value "wow" I can see it is inside the select dropdown box. But when I try to add another entry, this time the text field is disabled. 


I chose "...Choose" and when I mousehover over the "New value" edit box., a red NO ENTRY sign appears.


So it only works for the first entry for me....kindly advise?

Cheers, Frankie Kam

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

Hi Itamar

>Strange. it works once. I managed to type "wow" inside the "New value" edit box. The value "wow" I can
>see it is inside the select dropdown box. But when I try to add another entry, this time the text field is
>disabled. 

I've tried the Entry pattern of ?:addnew on by a Selection as well as a Selection(Multiple). Neither work more than the first time of data input.

Is this a bug (I'm using Moodle 2.8) in the system, or am  I missing something? Please help as I am struggling with the dataform at this point due to two major obstacles towards adopting the dataform acivity as a Document Management System (DMS) in my work:

(1) In my Selection object, I can't input values other than the first time with the code:-  ?:addnew 

(2) Can't (yet) figure out how to filter a View by roles

If I can crack these two then my day is made.

Regards
Frankie Kam 

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -

1) Yes, there is a bug there. It is a fairly old feature which I never actually used. It would have to be refactored. You can open a tracker issue for it in the Set: Dataform tracker.

2) See Hartmut explanation how to add and apply Entry Access rule to a view at https://moodle.org/mod/forum/discuss.php?d=315932#p1266207. For your purpose you could start with preventing the Franchisee role access to all entries, then use the entry access rule to allow that role access to the designated subset of entries. You would have to add in the rule the proper search criterion which would return that subset of entries.

smile

In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

Hi Itamar

Two more questions:

You said: "b) You can also use filters. If you create a filter and assign it to a view (in the views index or configuration form) the filter is forced in that view and the (student) user can access in that view only the entries allowed by that filter. This method would require a a filtered view for each group of users. But with your usecase you need to assign users to groups anyway so the separate groups mode approach is likely to be easier."

So I am trying to implement what you advised, but I still can't get it right....

(1) I can assign a Filter to a View (in the case below, it is the Tabular view), BUT HOW do I force the Tabular view below to be the default view of all users of role "Student"? I can see the key icon but I can't click on it to assign permissions.



2) What does the search box below do with a value that is typed inside it? It is not clear to me how it is related to the boolean conditions below.


I still haven't got a full understanding but I'm getting closer....


Regards
Frankie Kam 

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -

1) The key is not clickable (yet), just an indicator that there are access rules which apply to the view.

It is not possible (yet) to set default view per role. What you can do is make the default view an intro view which doesn't necessarilly display any entries but rather displays  links or content from other views, via patterns such as ##viewlink:<viewname>## and ##viewcontent:<viewname>##. These patterns observe the access rules and so the intro view can be effectively different for different roles.

2)  The search box is for searching a string (by partial match) in all fields (which support it). At this point it's either this search or the search criteria but not both.

smile

In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers
These patterns observe the access rules
>

How do I get them to observe the access rules? Which access rules (Entry, Field or View Access rules)?

Regards
Frankie Kam

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -

These are view patterns so they observe view access rules which apply to the specified <viewname>. The ##viewcontent:<viewname>## pattern is also affected by any entry and field access rules which are applicable to the specified view content. smile

In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers
In reply to Itamar Tzadok

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

 The pattern EGR:edit] ] allows you, the manager/admin, to select the group when adding the entry.
>

This code allows me to link a record to just one group. Is there a way (via [[ ??
code) I can link a record to
more than one group? What about Groupings? Can I link a record to a Grouping? Or is it possible for the EGR:edit code to allow multiple selection instead of just single selection?

Also, how I can know what other codes exist. I mean I can see via the Entry Template of the New Tabular View, codes like:
EAC:bulkedit
EAC:bulkdelete
EAC:selectallnone
EAU:picture
EAU:name
EAC:edit
EAC:delete
EAC:select

I would like to learn more about these code - for example, what does EGR stand for? What other codes exist, and what do they do/mean, etc.

Regards
Frankie Kam 

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Frankie Kam -
Picture of Plugin developers

Haha! Now I know why you always leave a blank space between the last two ]'s (right square brackets).

>Also, how I can know what other codes exist. I mean I can see via the Entry Template of the New Tabular View, codes like:
>[[EAC:bulkedit] ]
>

Found it.

So now I can see a FULL SET of these Entry Patterns. But what do each MEAN???

Question: Is there any documentation that explains each Entry Pattern?

Regards
Frankie Kam


 

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -

The dropdown actually shows only a SUBSET of the available patterns. Some of the patterns are documented in the Dataform plugins pages (e.g. Dataformfield_entryactions) in the  Dataform module docs. But it's probably incomplete and not up to date. I'm considerting possible ways to expose the full range of patterns and their function. It's going to require some work. smile

In reply to Frankie Kam

Re: I am new to Dataform - I have 3 questions on usability

by Itamar Tzadok -

Each entry is paired with one (moodle) user and one (moodle) group.

You can implement multi-pairing by entry content and filters. In fact, I've written a field type which allows you to select multiple groups and then you can filter the entries by the current user's membership in the selected groups. But this field has not been released yet.

smile