Skip to content
Browse files

MINOR Moved batch actions code from AssetAdmin/CMSMain to a common Le…

…ftAndMain parent (which is now reused by SecurityAdmin as well)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92832 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent e56852d commit 98ce1b1f072fbf84843546ef338829ada284e7ad @chillu chillu committed Nov 21, 2009
Showing with 51 additions and 99 deletions.
  1. +0 −49 code/AssetAdmin.php
  2. +0 −47 code/CMSMain.php
  3. +48 −0 code/LeftAndMain.php
  4. +3 −3 javascript/LeftAndMain.BatchActions.js
View
49 code/AssetAdmin.php
@@ -77,9 +77,6 @@ function init() {
// needed for MemberTableField (Requirements not determined before Ajax-Call)
Requirements::css(SAPPHIRE_DIR . "/css/ComplexTableField.css");
- Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain.BatchActions.js');
-
- Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.DragDrop.js");
Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
Requirements::javascript(CMS_DIR . "/javascript/CMSMain_upload.js");
@@ -434,52 +431,6 @@ public function doAdd($data, $form) {
}
}
-
- /**
- * Batch Actions Handler
- */
- function batchactions() {
- return new CMSBatchActionHandler($this, 'batchactions', 'Folder');
- }
-
- /**
- * @return Form
- */
- function BatchActionsForm() {
- $actions = $this->batchactions()->batchActionList();
- $actionsMap = array();
- foreach($actions as $action) $actionsMap[$action->Link] = $action->Title;
-
- $form = new Form(
- $this,
- 'BatchActionsForm',
- new FieldSet(
- new LiteralField(
- 'Intro',
- sprintf('<p><small>%s</small></p>',
- _t(
- 'CMSMain_left.ss.SELECTPAGESACTIONS',
- 'Select the pages that you want to change &amp; then click an action:'
- )
- )
- ),
- new HiddenField('csvIDs'),
- new DropdownField(
- 'Action',
- false,
- $actionsMap
- )
- ),
- new FieldSet(
- // TODO i18n
- new FormAction('submit', "Go")
- )
- );
- $form->addExtraClass('actionparams');
- $form->unsetValidator();
-
- return $form;
- }
/**
* @return Form
View
47 code/CMSMain.php
@@ -50,7 +50,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'SiteTreeAsUL',
'getshowdeletedsubtree',
'getfilteredsubtree',
- 'batchactions',
'SearchTreeForm',
'ReportForm',
'LangForm',
@@ -979,13 +978,6 @@ function compareversions() {
}
}
}
-
- /**
- * Batch Actions Handler
- */
- function batchactions() {
- return new CMSBatchActionHandler($this, 'batchactions');
- }
function buildbrokenlinks() {
if($this->urlParams['ID']) {
@@ -1111,45 +1103,6 @@ function SearchTreeForm() {
return $form;
}
-
- /**
- * @return Form
- */
- function BatchActionsForm() {
- $actions = $this->batchactions()->batchActionList();
- $actionsMap = array();
- foreach($actions as $action) $actionsMap[$action->Link] = $action->Title;
-
- $form = new Form(
- $this,
- 'BatchActionsForm',
- new FieldSet(
- new LiteralField(
- 'Intro',
- sprintf('<p><small>%s</small></p>',
- _t(
- 'CMSMain_left.ss.SELECTPAGESACTIONS',
- 'Select the pages that you want to change &amp; then click an action:'
- )
- )
- ),
- new HiddenField('csvIDs'),
- new DropdownField(
- 'Action',
- false,
- $actionsMap
- )
- ),
- new FieldSet(
- // TODO i18n
- new FormAction('submit', "Go")
- )
- );
- $form->addExtraClass('actionparams');
- $form->unsetValidator();
-
- return $form;
- }
function publishall() {
ini_set("memory_limit", -1);
View
48 code/LeftAndMain.php
@@ -45,6 +45,8 @@ class LeftAndMain extends Controller {
'Member_ProfileForm',
'EditorToolbar',
'EditForm',
+ 'BatchActionsForm',
+ 'batchactions',
);
/**
@@ -823,6 +825,52 @@ function EmptyForm() {
return $form;
}
+ /**
+ * Batch Actions Handler
+ */
+ function batchactions() {
+ return new CMSBatchActionHandler($this, 'batchactions', $this->stat('tree_class'));
+ }
+
+ /**
+ * @return Form
+ */
+ function BatchActionsForm() {
+ $actions = $this->batchactions()->batchActionList();
+ $actionsMap = array();
+ foreach($actions as $action) $actionsMap[$action->Link] = $action->Title;
+
+ $form = new Form(
+ $this,
+ 'BatchActionsForm',
+ new FieldSet(
+ new LiteralField(
+ 'Intro',
+ sprintf('<p><small>%s</small></p>',
+ _t(
+ 'CMSMain_left.ss.SELECTPAGESACTIONS',
+ 'Select the pages that you want to change &amp; then click an action:'
+ )
+ )
+ ),
+ new HiddenField('csvIDs'),
+ new DropdownField(
+ 'Action',
+ false,
+ $actionsMap
+ )
+ ),
+ new FieldSet(
+ // TODO i18n
+ new FormAction('submit', "Go")
+ )
+ );
+ $form->addExtraClass('actionparams');
+ $form->unsetValidator();
+
+ return $form;
+ }
+
public function myprofile() {
$form = $this->Member_ProfileForm();
return $this->customise(array(
View
6 javascript/LeftAndMain.BatchActions.js
@@ -157,15 +157,15 @@
// only if the current page was modified
selectedNode.selectTreeNode();
} else if(data.deleted[selectedNode.getIdx()]) {
- $('#Form_EditForm').concrete('ss').removeForm();
+ jQuery('#Form_EditForm').concrete('ss').removeForm();
}
} else {
- $('#Form_EditForm').concrete('ss').removeForm();
+ jQuery('#Form_EditForm').concrete('ss').removeForm();
}
// close panel
// TODO Coupling with tabs
- $('#TreeActions').tabs('select', -1);
+ jQuery('#TreeActions').tabs('select', -1);
},
dataType: 'json'
});

0 comments on commit 98ce1b1

Please sign in to comment.
Something went wrong with that request. Please try again.