mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +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);
|
||||
|
||||
return $form;
|
||||
} if ($id == 0) {
|
||||
$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;
|
||||
} if ($id == 0 || $id == 'root') {
|
||||
$form = $this->RootForm();
|
||||
} else if($id) {
|
||||
return new Form($this, "EditForm", 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
|
||||
|
@ -29,6 +29,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
'memberimport',
|
||||
'GroupImportForm',
|
||||
'groupimport',
|
||||
'RootForm'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -57,82 +58,105 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js");
|
||||
Requirements::javascript(THIRDPARTY_DIR . "/greybox/greybox.js");
|
||||
}
|
||||
|
||||
function getEditForm($id = null) {
|
||||
if(!$id) $id = $this->currentPageID();
|
||||
|
||||
public function getEditForm($id) {
|
||||
$record = null;
|
||||
if($id && $id != 'root') {
|
||||
$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
|
||||
if (($id == 'root' || $id == 0)) {
|
||||
$fields = new FieldSet(
|
||||
new TabSet(
|
||||
'Root',
|
||||
new Tab('Import', _t('SecurityAdmin.TABIMPORT', 'Import'),
|
||||
new LiteralField(
|
||||
'GroupImportFormIframe',
|
||||
sprintf(
|
||||
'<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="400px" border="0"></iframe>',
|
||||
$this->Link('groupimport')
|
||||
$actions = new FieldSet(
|
||||
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
|
||||
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
|
||||
);
|
||||
|
||||
$form = new Form($this, "EditForm", $fields, $actions);
|
||||
$form->loadDataFrom($record);
|
||||
|
||||
if(!$record->canEdit()) {
|
||||
$readonlyFields = $form->Fields()->makeReadonly();
|
||||
$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 HiddenField('ID', false, 0)
|
||||
);
|
||||
|
||||
$actions = new FieldSet();
|
||||
|
||||
$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')
|
||||
new Tab('Import', _t('SecurityAdmin.TABIMPORT', 'Import'),
|
||||
new LiteralField(
|
||||
'GroupImportFormIframe',
|
||||
sprintf(
|
||||
'<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="400px" border="0"></iframe>',
|
||||
$this->Link('groupimport')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
),
|
||||
// necessary for tree node selection in LeftAndMain.EditForm.js
|
||||
new HiddenField('ID', false, 0)
|
||||
);
|
||||
$actions = new FieldSet(
|
||||
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
|
||||
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
|
||||
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member'))
|
||||
);
|
||||
|
||||
$form = new Form($this, "EditForm", $fields, $actions);
|
||||
$form->loadDataFrom($record);
|
||||
|
||||
if(!$record->canEdit()) {
|
||||
$readonlyFields = $form->Fields()->makeReadonly();
|
||||
$form->setFields($readonlyFields);
|
||||
}
|
||||
|
||||
// Filter permissions
|
||||
$permissionField = $form->Fields()->dataFieldByName('Permissions');
|
||||
if($permissionField) $permissionField->setHiddenPermissions(self::$hidden_permissions);
|
||||
|
||||
$this->extend('updateEditForm', $form);
|
||||
$form = new Form(
|
||||
$this,
|
||||
'EditForm',
|
||||
$fields,
|
||||
$actions
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ class SecurityAdminTest extends FunctionalTest {
|
||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||
|
||||
/* 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());
|
||||
|
||||
/* 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());
|
||||
|
||||
|
||||
$this->assertEquals(count($lines), 3, "Export with members has one content row");
|
||||
$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'));
|
||||
|
||||
/* 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());
|
||||
|
||||
/* 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());
|
||||
|
||||
$this->assertEquals(count($lines), 2, "Empty export only has header fields and an empty row");
|
||||
|
Loading…
Reference in New Issue
Block a user