ENHANCEMENT Using chosen.js selection instead of a TreeDropdownField to select groups in SiteConfig->getCMSFields() and SiteTree->getCMSFields()

This commit is contained in:
Ingo Schommer 2012-03-04 22:10:25 +01:00
parent fbbbc9f0bc
commit e938c60e9a
2 changed files with 16 additions and 5 deletions

View File

@ -44,6 +44,9 @@ class SiteConfig extends DataObject implements PermissionProvider {
function getCMSFields() {
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
$groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray();
asort($groupsMap);
$fields = new FieldList(
new TabSet("Root",
$tabMain = new Tab('Main',
@ -53,11 +56,14 @@ class SiteConfig extends DataObject implements PermissionProvider {
),
$tabAccess = new Tab('Access',
$viewersOptionsField = new OptionsetField("CanViewType", _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?")),
$viewerGroupsField = new TreeMultiselectField("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups")),
$viewerGroupsField = Object::create('ListboxField', "ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
->setMultiple(true)->setSource($groupsMap),
$editorsOptionsField = new OptionsetField("CanEditType", _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?")),
$editorGroupsField = new TreeMultiselectField("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups")),
$editorGroupsField = Object::create('ListboxField', "EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
->setMultiple(true)->setSource($groupsMap),
$topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType", _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?")),
$topLevelCreatorsGroupsField = new TreeMultiselectField("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))
$topLevelCreatorsGroupsField = Object::create('ListboxField', "CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))
->setMultiple(true)->setSource($groupsMap)
)
)
);

View File

@ -1890,6 +1890,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return FieldList
*/
function getSettingsFields() {
$groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray();
asort($groupsMap);
$fields = new FieldList(
$rootTab = new TabSet("Root",
$tabBehaviour = new Tab('Settings',
@ -1925,12 +1928,14 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
"CanViewType",
_t('SiteTree.ACCESSHEADER', "Who can view this page?")
),
$viewerGroupsField = new TreeMultiselectField("ViewerGroups", $this->fieldLabel('ViewerGroups')),
$viewerGroupsField = Object::create('ListboxField', "ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
->setMultiple(true)->setSource($groupsMap),
$editorsOptionsField = new OptionsetField(
"CanEditType",
_t('SiteTree.EDITHEADER', "Who can edit this page?")
),
$editorGroupsField = new TreeMultiselectField("EditorGroups", $this->fieldLabel('EditorGroups'))
$editorGroupsField = Object::create('ListboxField', "EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
->setMultiple(true)->setSource($groupsMap)
)
)
);