ideaconsult / Toxtree.js

http://ideaconsult.github.io/Toxtree.js/
2 stars 3 forks source link

Assessment identifiers tab: access rights specification #108

Closed vedina closed 9 years ago

vedina commented 9 years ago

Add two more fields:

  1. “Users with write access”, in this field, multiple Ambit users should be specified by the owner of the assessment
  2. “Users with read access” in this field, multiple Ambit users should be specified by the owner of the assessment. These specified users can read the assessment and use it as template to create a own assessment. If all Ambit users are allowed to read, it should be possible to specify “all users” instead of listing each user by his/her name.

Implementation

gonzomir commented 9 years ago

I added the rows in the Identifiers section and added a UI component that turns a select dropdown with multiple attribute into an autocomplete list of items. For demonstration the lists are populated with the Nobel laureates in Chemistry from 2000 to 2014. Since the underlying select field can have user ids for the options' value attribute and user names displayed, it's perfect for the situation.

The component can also work with AJAX.

vedina commented 9 years ago

Requires jquery.tokenize.js and .css otherwise

$('.jtox-users-select', root).tokenize(); in ui_matrix.js:111 gives

TypeError: undefined is not a function {stack: (...), message: "undefined is not a function"}
vedina commented 9 years ago

The UI works fine. Will create a new ticket to enable dynamic retrieval of user names.

vedina commented 9 years ago

@gonzomir - Is there a way to provide JSON source for the user list? And what format ?

gonzomir commented 9 years ago

Yes, the users can be populated with a JSON. The format is something like this (exact field names can be configured):

[
  { "value": "1", "text": "Alan J. Heeger (United States)" },
  { "value": "2", "text":  "Alan G. MacDiarmid (United States, New Zealand)" }
]

We can also populate the select elements only once before initializing the widget, in which case the JSON can be any format.

vedina commented 9 years ago

Let's move the discussion to #115