MINOR Moved batch actions code from AssetAdmin/CMSMain to a common LeftAndMain 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
This commit is contained in:
Ingo Schommer 2009-11-21 03:20:21 +00:00
parent e56852dcd8
commit 98ce1b1f07
4 changed files with 51 additions and 99 deletions

View File

@ -77,9 +77,6 @@ class AssetAdmin extends LeftAndMain {
// needed for MemberTableField (Requirements not determined before Ajax-Call) // needed for MemberTableField (Requirements not determined before Ajax-Call)
Requirements::css(SAPPHIRE_DIR . "/css/ComplexTableField.css"); 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/AssetAdmin.js");
Requirements::javascript(CMS_DIR . "/javascript/CMSMain_upload.js"); Requirements::javascript(CMS_DIR . "/javascript/CMSMain_upload.js");
@ -435,52 +432,6 @@ HTML;
} }
/**
* 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 * @return Form
*/ */

View File

@ -50,7 +50,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'SiteTreeAsUL', 'SiteTreeAsUL',
'getshowdeletedsubtree', 'getshowdeletedsubtree',
'getfilteredsubtree', 'getfilteredsubtree',
'batchactions',
'SearchTreeForm', 'SearchTreeForm',
'ReportForm', 'ReportForm',
'LangForm', 'LangForm',
@ -980,13 +979,6 @@ JS;
} }
} }
/**
* Batch Actions Handler
*/
function batchactions() {
return new CMSBatchActionHandler($this, 'batchactions');
}
function buildbrokenlinks() { function buildbrokenlinks() {
if($this->urlParams['ID']) { if($this->urlParams['ID']) {
$newPageSet[] = DataObject::get_by_id("Page", $this->urlParams['ID']); $newPageSet[] = DataObject::get_by_id("Page", $this->urlParams['ID']);
@ -1112,45 +1104,6 @@ JS;
return $form; 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() { function publishall() {
ini_set("memory_limit", -1); ini_set("memory_limit", -1);
ini_set('max_execution_time', 0); ini_set('max_execution_time', 0);

View File

@ -45,6 +45,8 @@ class LeftAndMain extends Controller {
'Member_ProfileForm', 'Member_ProfileForm',
'EditorToolbar', 'EditorToolbar',
'EditForm', 'EditForm',
'BatchActionsForm',
'batchactions',
); );
/** /**
@ -823,6 +825,52 @@ JS;
return $form; 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() { public function myprofile() {
$form = $this->Member_ProfileForm(); $form = $this->Member_ProfileForm();
return $this->customise(array( return $this->customise(array(

View File

@ -157,15 +157,15 @@
// only if the current page was modified // only if the current page was modified
selectedNode.selectTreeNode(); selectedNode.selectTreeNode();
} else if(data.deleted[selectedNode.getIdx()]) { } else if(data.deleted[selectedNode.getIdx()]) {
$('#Form_EditForm').concrete('ss').removeForm(); jQuery('#Form_EditForm').concrete('ss').removeForm();
} }
} else { } else {
$('#Form_EditForm').concrete('ss').removeForm(); jQuery('#Form_EditForm').concrete('ss').removeForm();
} }
// close panel // close panel
// TODO Coupling with tabs // TODO Coupling with tabs
$('#TreeActions').tabs('select', -1); jQuery('#TreeActions').tabs('select', -1);
}, },
dataType: 'json' dataType: 'json'
}); });