ENHANCEMENT Removed SitetreeAccess javascript functionality, replaced with tighter logic in CMSMain.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92646 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:38:10 +00:00
parent f297ec9ac2
commit dffaa08686
2 changed files with 24 additions and 63 deletions

View File

@ -167,6 +167,30 @@ var ss_MainLayout;
}
}});
/**
* @class Toggle display of group dropdown in "access" tab,
* based on selection of radiobuttons.
* @name ss.Form_EditForm.Access
*/
$('#Form_EditForm #CanViewType, #Form_EditForm #CanEditType').concrete('ss', function($){
return/** @lends ss.Form_EditForm.Access */{
onmatch: function() {
// TODO Decouple
var dropdown;
if(this.attr('id') == 'CanViewType') dropdown = $('#ViewerGroups');
else if(this.attr('id') == 'CanEditType') dropdown = $('#EditorGroups');
this.find('.optionset :input').bind('change', function(e) {
dropdown.toggle(e.target.value == 'OnlyTheseUsers');
});
// initial state
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
dropdown.toggle(currentVal == 'OnlyTheseUsers');
}
}
});
/**
* @class Email containing the link to the archived version of the page.
* Visible on readonly older versions of a specific page at the moment.

View File

@ -1,63 +0,0 @@
/**
* UI behaviour for the "Access" tab
*
* Adapted from the forum module "ForumAccess.js" file.
*
* @author Markus Lanthaler <markus@silverstripe.com>
*/
ViewersGroupHide = function() {
$('ViewerGroups').style.display = "none";
}
EditorsGroupHide = function() {
$('EditorGroups').style.display = "none";
}
Behaviour.register({
'#Form_EditForm_CanViewType_OnlyTheseUsers': {
onclick: function() {
$('ViewerGroups').style.display = "block";
},
initialize: function() {
if($('Form_EditForm_CanViewType_OnlyTheseUsers')) {
if($('Form_EditForm_CanViewType_OnlyTheseUsers').checked)
$('ViewerGroups').style.display = "block";
else
$('ViewerGroups').style.display = "none";
}
}
},
'#Form_EditForm_CanViewType_Anyone': {
onclick: ViewersGroupHide
},
'#Form_EditForm_CanViewType_LoggedInUsers': {
onclick: ViewersGroupHide
},
'#Form_EditForm_CanViewType_Inherit': {
onclick: ViewersGroupHide
},
'#Form_EditForm_CanEditType_OnlyTheseUsers': {
onclick: function() {
$('EditorGroups').style.display = "block";
},
initialize: function() {
if($('Form_EditForm_CanEditType_OnlyTheseUsers')) {
if($('Form_EditForm_CanEditType_OnlyTheseUsers').checked)
$('EditorGroups').style.display = "block";
else
$('EditorGroups').style.display = "none";
}
}
},
'#Form_EditForm_CanEditType_LoggedInUsers': {
onclick: EditorsGroupHide
},
'#Form_EditForm_CanEditType_Inherit': {
onclick: EditorsGroupHide
}
});