2007-09-15 03:05:16 +02:00
|
|
|
/**
|
|
|
|
* UI behaviour for the "Access" tab
|
|
|
|
*/
|
|
|
|
|
2010-02-22 06:27:17 +01:00
|
|
|
var siteTreeAccessHandler = function(canField, groupsField) {
|
|
|
|
var output = {}
|
|
|
|
output['#Form_EditForm_' + canField + ' input'] = {
|
2007-09-15 03:05:16 +02:00
|
|
|
initialize: function() {
|
2010-02-22 06:27:17 +01:00
|
|
|
if(this.checked) this.click();
|
2007-09-15 03:05:16 +02:00
|
|
|
},
|
2010-02-22 06:27:17 +01:00
|
|
|
onclick: function() {
|
|
|
|
$(groupsField).style.display = (this.value == 'OnlyTheseUsers') ? 'block' : 'none';
|
2010-11-23 05:19:03 +01:00
|
|
|
$(groupsField).style.visibility = (this.value == 'OnlyTheseUsers') ? 'visible' : 'hidden';
|
2007-09-15 03:05:16 +02:00
|
|
|
}
|
|
|
|
}
|
2010-02-22 06:27:17 +01:00
|
|
|
return output;
|
|
|
|
};
|
|
|
|
|
|
|
|
Behaviour.register(siteTreeAccessHandler('CanViewType', 'ViewerGroups'));
|
|
|
|
Behaviour.register(siteTreeAccessHandler('CanEditType', 'EditorGroups'));
|