Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT Removed unused LeftAndMain->DeleteItemsForm

ENHANCEMENT Moved LeftAndMain->deleteitems() into SecurityAdmin, its the only place where its not replaced by CMSBatchAction yet

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92743 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit 64e042a2a3b3b4537006bf7e5101a314888924c3 1 parent 420d0a5
@chillu chillu authored
Showing with 24 additions and 48 deletions.
  1. +0 −22 code/CMSMain.php
  2. +1 −25 code/LeftAndMain.php
  3. +23 −1 code/SecurityAdmin.php
View
22 code/CMSMain.php
@@ -34,8 +34,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'createtranslation',
'delete',
'deletefromlive',
- 'deleteitems',
- 'DeleteItemsForm',
'duplicate',
'duplicatewithchildren',
'getpagecount',
@@ -978,26 +976,6 @@ function compareversions() {
function batchactions() {
return new CMSBatchActionHandler($this, 'batchactions');
}
- /**
- * @return Form
- */
- function DeleteItemsForm() {
- $form = new Form(
- $this,
- 'DeleteItemsForm',
- new FieldSet(
- new LiteralField('SelectedPagesNote',
- sprintf('<p>%s</p>', _t('CMSMain_left.ss.SELECTPAGESACTIONS','Select the pages that you want to change &amp; then click an action:'))
- ),
- new HiddenField('csvIDs')
- ),
- new FieldSet(
- new FormAction('deleteitems', _t('CMSMain_left.ss.DELETECONFIRM','Delete the selected pages'))
- )
- );
- $form->addExtraClass('actionparams');
- return $form;
- }
function buildbrokenlinks() {
if($this->urlParams['ID']) {
View
26 code/LeftAndMain.php
@@ -39,7 +39,6 @@ class LeftAndMain extends Controller {
'ajaxupdateparent',
'ajaxupdatesort',
'callPageMethod',
- 'deleteitems',
'getitem',
'getsubtree',
'myprofile',
@@ -785,33 +784,10 @@ public function ajaxupdatesort($request) {
return Convert::raw2json($statusUpdates);
}
-
+
public function CanOrganiseSitetree() {
return !Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN') ? false : true;
}
-
- /**
- * Delete a number of items
- */
- public function deleteitems() {
- $ids = split(' *, *', $_REQUEST['csvIDs']);
-
- $script = "st = \$('sitetree'); \n";
- foreach($ids as $id) {
- if(is_numeric($id)) {
- $record = DataObject::get_by_id($this->stat('tree_class'), $id);
- if($record && !$record->canDelete()) return Security::permissionFailure($this);
-
- DataObject::delete_by_id($this->stat('tree_class'), $id);
- $script .= "node = st.getTreeNodeByIdx($id); if(node) node.parentTreeNode.removeTreeNode(node); $('Form_EditForm').closeIfSetTo($id); \n";
-
- if ($id == $this->currentPageID()) FormResponse::add('CurrentPage.isDeleted = 1;');
- }
- }
- FormResponse::add($script);
-
- return FormResponse::respond();
- }
/**
* Uses {@link getEditForm()} to retrieve an edit form
View
24 code/SecurityAdmin.php
@@ -24,7 +24,8 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
'savemember',
'AddRecordForm',
'MemberForm',
- 'EditForm'
+ 'EditForm',
+ 'deleteitems',
);
public function init() {
@@ -216,6 +217,27 @@ public function removememberfromgroup() {
return FormResponse::respond();
}
+
+ /**
+ * Delete a number of items
+ */
+ public function deleteitems() {
+ $ids = split(' *, *', $_REQUEST['csvIDs']);
+
+ $script = "st = \$('sitetree'); \n";
+ foreach($ids as $id) {
+ if(is_numeric($id)) {
+ $record = DataObject::get_by_id($this->stat('tree_class'), $id);
+ if($record && !$record->canDelete()) return Security::permissionFailure($this);
+
+ DataObject::delete_by_id($this->stat('tree_class'), $id);
+ $script .= "node = st.getTreeNodeByIdx($id); if(node) node.parentTreeNode.removeTreeNode(node); $('Form_EditForm').closeIfSetTo($id); \n";
+ }
+ }
+ FormResponse::add($script);
+
+ return FormResponse::respond();
+ }
/**
* Return the entire site tree as a nested set of ULs.
Please sign in to comment.
Something went wrong with that request. Please try again.