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)
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 @@ 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

View File

@ -50,7 +50,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'SiteTreeAsUL',
'getshowdeletedsubtree',
'getfilteredsubtree',
'batchactions',
'SearchTreeForm',
'ReportForm',
'LangForm',
@ -979,13 +978,6 @@ JS;
}
}
}
/**
* Batch Actions Handler
*/
function batchactions() {
return new CMSBatchActionHandler($this, 'batchactions');
}
function buildbrokenlinks() {
if($this->urlParams['ID']) {
@ -1111,45 +1103,6 @@ JS;
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 File

@ -45,6 +45,8 @@ class LeftAndMain extends Controller {
'Member_ProfileForm',
'EditorToolbar',
'EditForm',
'BatchActionsForm',
'batchactions',
);
/**
@ -823,6 +825,52 @@ JS;
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 File

@ -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'
});