mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Moved ul.tree rules from cms/css/cms_left.css to sapphire/javascript/tree/tree.css (particularly around multiselect tickbox styling) (see r98854) (merged from r98855) (from r98865)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99686 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9624757e14
commit
033d27ac3f
@ -477,18 +477,8 @@ JS;
|
|||||||
$this->extend('updateEditForm', $form);
|
$this->extend('updateEditForm', $form);
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
} if ($id == 0) {
|
} if ($id == 0 || $id == 'root') {
|
||||||
$siteConfig = SiteConfig::current_site_config();
|
$form = $this->RootForm();
|
||||||
$fields = $siteConfig->getFormFields();
|
|
||||||
if(Object::has_extension('SiteConfig',"Translatable")){
|
|
||||||
$fields->push(new HiddenField('Locale','', $siteConfig->Locale ));
|
|
||||||
}
|
|
||||||
$form = new Form($this, "EditForm", $fields, $siteConfig->getFormActions());
|
|
||||||
$form->loadDataFrom($siteConfig);
|
|
||||||
|
|
||||||
$this->extend('updateEditForm', $form);
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
} else if($id) {
|
} else if($id) {
|
||||||
return new Form($this, "EditForm", new FieldSet(
|
return new Form($this, "EditForm", new FieldSet(
|
||||||
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldSet());
|
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldSet());
|
||||||
@ -496,7 +486,22 @@ JS;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
|
function RootForm() {
|
||||||
|
$siteConfig = SiteConfig::current_site_config();
|
||||||
|
$fields = $siteConfig->getFormFields();
|
||||||
|
if(Object::has_extension('SiteConfig',"Translatable")){
|
||||||
|
$fields->push(new HiddenField('Locale','', $siteConfig->Locale ));
|
||||||
|
}
|
||||||
|
$form = new Form($this, "EditForm", $fields, $siteConfig->getFormActions());
|
||||||
|
$form->loadDataFrom($siteConfig);
|
||||||
|
|
||||||
|
$this->extend('updateEditForm', $form);
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------//
|
//------------------------------------------------------------------------------------------//
|
||||||
// Data saving handlers
|
// Data saving handlers
|
||||||
|
@ -29,6 +29,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
'memberimport',
|
'memberimport',
|
||||||
'GroupImportForm',
|
'GroupImportForm',
|
||||||
'groupimport',
|
'groupimport',
|
||||||
|
'RootForm'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,82 +58,105 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js");
|
||||||
Requirements::javascript(THIRDPARTY_DIR . "/greybox/greybox.js");
|
Requirements::javascript(THIRDPARTY_DIR . "/greybox/greybox.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEditForm($id = null) {
|
||||||
|
if(!$id) $id = $this->currentPageID();
|
||||||
|
|
||||||
public function getEditForm($id) {
|
if($id && $id != 'root') {
|
||||||
$record = null;
|
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
|
||||||
|
if(!$record) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($id && is_numeric($id)) {
|
||||||
|
$fields = $record->getCMSFields();
|
||||||
|
|
||||||
|
if($fields->hasTabSet()) {
|
||||||
|
$fields->findOrMakeTab('Root.Import',_t('Group.IMPORTTABTITLE', 'Import'));
|
||||||
|
$fields->addFieldToTab('Root.Import',
|
||||||
|
new LiteralField(
|
||||||
|
'MemberImportFormIframe',
|
||||||
|
sprintf(
|
||||||
|
'<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="400px" border="0"></iframe>',
|
||||||
|
$this->Link('memberimport')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Root form
|
$actions = new FieldSet(
|
||||||
if (($id == 'root' || $id == 0)) {
|
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
|
||||||
$fields = new FieldSet(
|
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
|
||||||
new TabSet(
|
);
|
||||||
'Root',
|
|
||||||
new Tab('Import', _t('SecurityAdmin.TABIMPORT', 'Import'),
|
$form = new Form($this, "EditForm", $fields, $actions);
|
||||||
new LiteralField(
|
$form->loadDataFrom($record);
|
||||||
'GroupImportFormIframe',
|
|
||||||
sprintf(
|
if(!$record->canEdit()) {
|
||||||
'<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="400px" border="0"></iframe>',
|
$readonlyFields = $form->Fields()->makeReadonly();
|
||||||
$this->Link('groupimport')
|
$form->setFields($readonlyFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter permissions
|
||||||
|
$permissionField = $form->Fields()->dataFieldByName('Permissions');
|
||||||
|
if($permissionField) $permissionField->setHiddenPermissions(self::$hidden_permissions);
|
||||||
|
|
||||||
|
$this->extend('updateEditForm', $form);
|
||||||
|
} else {
|
||||||
|
$form = $this->RootForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return FieldSet
|
||||||
|
*/
|
||||||
|
function RootForm() {
|
||||||
|
$memberList = new MemberTableField(
|
||||||
|
$this,
|
||||||
|
"Members"
|
||||||
|
);
|
||||||
|
// unset 'inlineadd' permission, we don't want inline addition
|
||||||
|
$memberList->setPermissions(array('show', 'edit', 'delete', 'add'));
|
||||||
|
$memberList->setRelationAutoSetting(false);
|
||||||
|
|
||||||
|
$fields = new FieldSet(
|
||||||
|
new TabSet(
|
||||||
|
'Root',
|
||||||
|
new Tab('Members', singleton('Member')->i18n_plural_name(),
|
||||||
|
$memberList,
|
||||||
|
new LiteralField('MembersCautionText',
|
||||||
|
sprintf('<p class="caution-remove"><strong>%s</strong></p>',
|
||||||
|
_t(
|
||||||
|
'SecurityAdmin.MemberListCaution',
|
||||||
|
'Caution: Removing members from this list will remove them from all groups and the database'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// necessary for tree node selection in LeftAndMain.EditForm.js
|
new Tab('Import', _t('SecurityAdmin.TABIMPORT', 'Import'),
|
||||||
new HiddenField('ID', false, 0)
|
new LiteralField(
|
||||||
);
|
'GroupImportFormIframe',
|
||||||
|
sprintf(
|
||||||
$actions = new FieldSet();
|
'<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="400px" border="0"></iframe>',
|
||||||
|
$this->Link('groupimport')
|
||||||
$form = new Form(
|
)
|
||||||
$this,
|
|
||||||
'EditForm',
|
|
||||||
$fields,
|
|
||||||
$actions
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->extend('updateEditForm', $form);
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($id && $id != 'root') {
|
|
||||||
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$record) return false;
|
|
||||||
|
|
||||||
$fields = $record->getCMSFields();
|
|
||||||
|
|
||||||
if($fields->hasTabSet()) {
|
|
||||||
$fields->findOrMakeTab('Root.Import',_t('Group.IMPORTTABTITLE', 'Import'));
|
|
||||||
$fields->addFieldToTab('Root.Import',
|
|
||||||
new LiteralField(
|
|
||||||
'MemberImportFormIframe',
|
|
||||||
sprintf(
|
|
||||||
'<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="400px" border="0"></iframe>',
|
|
||||||
$this->Link('memberimport')
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
),
|
||||||
}
|
// necessary for tree node selection in LeftAndMain.EditForm.js
|
||||||
|
new HiddenField('ID', false, 0)
|
||||||
|
);
|
||||||
$actions = new FieldSet(
|
$actions = new FieldSet(
|
||||||
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
|
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member'))
|
||||||
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$form = new Form($this, "EditForm", $fields, $actions);
|
$form = new Form(
|
||||||
$form->loadDataFrom($record);
|
$this,
|
||||||
|
'EditForm',
|
||||||
if(!$record->canEdit()) {
|
$fields,
|
||||||
$readonlyFields = $form->Fields()->makeReadonly();
|
$actions
|
||||||
$form->setFields($readonlyFields);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// Filter permissions
|
|
||||||
$permissionField = $form->Fields()->dataFieldByName('Permissions');
|
|
||||||
if($permissionField) $permissionField->setHiddenPermissions(self::$hidden_permissions);
|
|
||||||
|
|
||||||
$this->extend('updateEditForm', $form);
|
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ class SecurityAdminTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||||
|
|
||||||
/* First, open the applicable group */
|
/* First, open the applicable group */
|
||||||
$this->get('admin/security/getitem?ID=' . $this->idFromFixture('Group','admin'));
|
$this->get('admin/security/show/' . $this->idFromFixture('Group','admin'));
|
||||||
$this->assertRegExp('/<input[^>]+id="Form_EditForm_Title"[^>]+value="Administrators"[^>]*>/',$this->content());
|
$this->assertRegExp('/<input[^>]+id="Form_EditForm_Title"[^>]+value="Administrators"[^>]*>/',$this->content());
|
||||||
|
|
||||||
/* Then load the export page */
|
/* Then load the export page */
|
||||||
$this->get('admin/security//EditForm/field/Members/export');
|
$this->get('admin/security/EditForm/field/Members/export');
|
||||||
$lines = preg_split('/\n/', $this->content());
|
$lines = preg_split('/\n/', $this->content());
|
||||||
|
|
||||||
$this->assertEquals(count($lines), 3, "Export with members has one content row");
|
$this->assertEquals(count($lines), 3, "Export with members has one content row");
|
||||||
$this->assertRegExp('/"","","admin@example.com"/', $lines[1], "Member values are correctly exported");
|
$this->assertRegExp('/"","","admin@example.com"/', $lines[1], "Member values are correctly exported");
|
||||||
}
|
}
|
||||||
@ -25,11 +25,11 @@ class SecurityAdminTest extends FunctionalTest {
|
|||||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||||
|
|
||||||
/* First, open the applicable group */
|
/* First, open the applicable group */
|
||||||
$this->get('admin/security/getitem?ID=' . $this->idFromFixture('Group','empty'));
|
$this->get('admin/security/show/' . $this->idFromFixture('Group','empty'));
|
||||||
$this->assertRegExp('/<input[^>]+id="Form_EditForm_Title"[^>]+value="Empty Group"[^>]*>/',$this->content());
|
$this->assertRegExp('/<input[^>]+id="Form_EditForm_Title"[^>]+value="Empty Group"[^>]*>/',$this->content());
|
||||||
|
|
||||||
/* Then load the export page */
|
/* Then load the export page */
|
||||||
$this->get('admin/security//EditForm/field/Members/export');
|
$this->get('admin/security/EditForm/field/Members/export');
|
||||||
$lines = preg_split('/\n/', $this->content());
|
$lines = preg_split('/\n/', $this->content());
|
||||||
|
|
||||||
$this->assertEquals(count($lines), 2, "Empty export only has header fields and an empty row");
|
$this->assertEquals(count($lines), 2, "Empty export only has header fields and an empty row");
|
||||||
|
Loading…
Reference in New Issue
Block a user