ENHANCEMENT added new permission, SITETREE_REORGANISE

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@84073 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-08-09 22:29:45 +00:00
parent 2d97200a23
commit 96d438f21e
2 changed files with 16 additions and 1 deletions

View File

@ -892,6 +892,11 @@ JS;
$_REQUEST['ajax'] = 1;
$cleanupJS = '';
if (!Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN')) {
FormResponse::status_message(_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to rearange the site tree. Your change was not saved."),"bad");
return FormResponse::respond();
}
if(is_numeric($id) && is_numeric($parentID) && $id != $parentID) {
$node = DataObject::get_by_id($this->stat('tree_class'), $id);
if($node){
@ -933,6 +938,11 @@ JS;
$js = '';
$_REQUEST['ajax'] = 1;
if (!Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN')) {
FormResponse::status_message(_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to rearange the site tree. Your change was not saved."),"bad");
return FormResponse::respond();
}
if(is_array($_REQUEST['ID'])) {
if($_REQUEST['MovedNodeID']==0){ //Sorting root
$movedNode = DataObject::get($className, "\"ParentID\"=0");
@ -971,6 +981,10 @@ JS;
return FormResponse::respond();
}
public function CanOrganiseSitetree() {
return !Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN') ? false : true;
}
/**
* Delete a number of items
*/

View File

@ -88,6 +88,7 @@
<% end_control %>
</select> <img id="siteTreeFilterActionIndicator" style="display:none" src="cms/images/network-save.gif">
</div>
<% if CanOrganiseSitetree %>
<div class="checkboxAboveTree">
<img id="checkboxActionIndicator" src="cms/images/network-save.gif">
<div>
@ -95,7 +96,7 @@
<label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %></label>
</div>
</div>
<% end_if %>
<% if IsTranslatableEnabled %>
<div id="LangSelector_holder">
Language: $LangSelector