Merge branch 'master' of git://github.com/silverstripe/silverstripe-cms

This commit is contained in:
Stig Lindqvist 2012-03-09 09:34:34 +13:00
commit fd3e5381a9
21 changed files with 377 additions and 143 deletions

View File

@ -6,7 +6,7 @@
* @package cms
* @subpackage assets
*/
class AssetAdmin extends LeftAndMain {
class AssetAdmin extends LeftAndMain implements PermissionProvider{
static $url_segment = 'assets';
@ -30,7 +30,7 @@ class AssetAdmin extends LeftAndMain {
'removefile',
'savefile',
'deleteUnusedThumbnails' => 'ADMIN',
'SyncForm',
'doSync',
'filter',
);
@ -122,8 +122,8 @@ JS
new GridFieldSortableHeader(),
new GridFieldDefaultColumns(),
new GridFieldPaginator(15),
new GridFieldAction_Edit(),
new GridFieldAction_Delete(),
new GridFieldDeleteAction(),
new GridFieldEditAction(),
new GridFieldPopupForms()
);
$gridField = new GridField('File','Files', $this->getList(), $gridFieldConfig);
@ -160,7 +160,12 @@ JS
$addFolderBtn = new LiteralField(
'AddFolderButton',
sprintf(
'<a class="ss-ui-button ss-ui-action-constructive cms-panel-link cms-page-add-button" data-icon="add" href="%s">%s</a>',
'<a class="ss-ui-button ss-ui-action-constructive cms-add-folder-link" data-icon="add" data-url="%s" href="%s">%s</a>',
Controller::join_links($this->Link('AddForm'), '?' . http_build_query(array(
'action_doAdd' => 1,
'ParentID' => $folder->ID,
'SecurityID' => $form->getSecurityToken()->getValue()
))),
Controller::join_links($this->Link('addfolder'), '?ParentID=' . $folder->ID),
_t('Folder.AddFolderButton', 'Add folder')
)
@ -169,6 +174,20 @@ JS
$addFolderBtn = '';
}
if($folder->canEdit()) {
$syncButton = new LiteralField(
'SyncButton',
sprintf(
'<a class="ss-ui-button ss-ui-action cms-link-ajax" title="%s" href="%s">%s</a>',
_t('AssetAdmin.FILESYSTEMSYNCTITLE', 'Update the CMS database entries of files on the filesystem. Useful when new files have been uploaded outside of the CMS, e.g. through FTP.'),
$this->Link('doSync'),
_t('FILESYSTEMSYNC','Sync files')
)
);
} else {
$syncButton = null;
}
// Move existing fields to a "details" tab, unless they've already been tabbed out through extensions.
// Required to keep Folder->getCMSFields() simple and reuseable,
// without any dependencies into AssetAdmin (e.g. useful for "add folder" views).
@ -177,8 +196,11 @@ JS
$tabList = new Tab('ListView', _t('AssetAdmin.ListView', 'List View')),
$tabTree = new Tab('TreeView', _t('AssetAdmin.TreeView', 'Tree View'))
);
$tabList->addExtraClass("content-listview");
$tabTree->addExtraClass("content-treeview");
if($fields->Count() && $folder->exists()) {
$tabs->push($tabDetails = new Tab('DetailsView', _t('AssetAdmin.DetailsView', 'Details')));
$tabDetails->addExtraClass("content-galleryview");
foreach($fields as $field) {
$fields->removeByName($field->Name());
$tabDetails->push($field);
@ -192,7 +214,8 @@ JS
$actionsComposite = Object::create('CompositeField',
Object::create('CompositeField',
$uploadBtn,
$addFolderBtn
$addFolderBtn,
$syncButton //TODO: add this into a batch actions menu as in https://github.com/silverstripe/silverstripe-design/raw/master/Design/ss3-ui_files-manager-list-view.jpg
)->addExtraClass('cms-actions-row')
)->addExtraClass('cms-content-toolbar field'),
$gridField
@ -217,10 +240,9 @@ JS
));
$fields->setForm($form);
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('center ss-tabset ' . $this->BaseCSSClasses());
$form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$this->extend('updateEditForm', $form);
@ -318,9 +340,9 @@ JS
$fields->dataFieldByName('ParentID')->setValue($this->request->getVar('ParentID'));
$form->setFields($fields);
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->addExtraClass('center ' . $this->BaseCSSClasses());
// TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('cms-add-form cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
return $form;
}
@ -341,20 +363,23 @@ JS
singleton($class)->hasExtension('Hierarchy')
&& isset($data['ParentID'])
&& is_numeric($data['ParentID'])
&& $data['ParentID']
) {
$parentRecord = DataObject::get_by_id($class, $data['ParentID']);
if(
$parentRecord->hasMethod('canAddChildren')
&& !$parentRecord->canAddChildren()
) return Security::permissionFailure($this);
} else {
$parentRecord = null;
}
$parent = (isset($data['ParentID']) && is_numeric($data['ParentID'])) ? (int)$data['ParentID'] : 0;
$name = (isset($data['Name'])) ? basename($data['Name']) : _t('AssetAdmin.NEWFOLDER',"NewFolder");
if(!isset($parentRecord) || !$parentRecord->ID) $parent = 0;
if(!$parentRecord || !$parentRecord->ID) $parent = 0;
// Get the folder to be created
if(isset($parentRecord->ID)) $filename = $parentRecord->FullPath . $name;
if($parentRecord && $parentRecord->ID) $filename = $parentRecord->FullPath . $name;
else $filename = ASSETS_PATH . '/' . $name;
// Actually create
@ -380,14 +405,10 @@ JS
mkdir($record->FullPath);
chmod($record->FullPath, Filesystem::$file_create_mask);
if($this->isAjax()) {
$link = Controller::join_links($this->Link('show'), $record->ID);
$parentID = $parentRecord ? $parentRecord->ID : 'root';
$link = Controller::join_links($this->Link('show'), $parentID);
$this->getResponse()->addHeader('X-ControllerURL', $link);
$form = $this->getEditForm($record->ID);
return $form->forTemplate();
} else {
return $this->redirect(Controller::join_links($this->Link('show'), $record->ID));
}
return $this->redirect($link);
}
/**
@ -419,28 +440,15 @@ JS
//------------------------------------------------------------------------------------------//
// Data saving handlers
/**
* @return Form
* Can be queried with an ajax request to trigger the filesystem sync. It returns a FormResponse status message
* to display in the CMS
*/
public function SyncForm() {
$form = new Form(
$this,
'SyncForm',
new FieldList(
),
new FieldList(
FormAction::create('doSync', _t('FILESYSTEMSYNC','Look for new files'))
->describe(_t('AssetAdmin_left.ss.FILESYSTEMSYNC_DESC', 'SilverStripe maintains its own database of the files &amp; images stored in your assets/ folder. Click this button to update that database, if files are added to the assets/ folder from outside SilverStripe, for example, if you have uploaded files via FTP.'))
->setUseButtonTag(true)
)
);
$form->setFormMethod('GET');
return $form;
}
public function doSync($data, $form) {
return Filesystem::sync();
public function doSync() {
$message = Filesystem::sync();
FormResponse::status_message($message, 'good');
echo FormResponse::respond();
}
/**
@ -541,9 +549,6 @@ JS
public function Breadcrumbs($unlinked = false) {
$items = parent::Breadcrumbs($unlinked);
// The root element should explicitly point to the root node
$items[0]->Link = Controller::join_links($this->Link('show'), 'root');
// If a search is in progress, don't show the path
if($this->request->requestVar('q')) {
$items = $items->getRange(0, 1);
@ -553,9 +558,27 @@ JS
)));
}
// If we're adding a folder, note that in breadcrumbs as well
if($this->request->param('Action') == 'addfolder') {
$items->push(new ArrayData(array(
'Title' => _t('Folder.AddFolderButton', 'Add folder'),
'Link' => false
)));
}
return $items;
}
function providePermissions() {
$title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
return array(
"CMS_ACCESS_AssetAdmin" => array(
'name' => sprintf(_t('CMSMain.ACCESS', "Access to '%s' section"), $title),
'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access')
)
);
}
}
/**
* Delete multiple {@link Folder} records (and the associated filesystem nodes).

View File

@ -1,9 +1,11 @@
<?php
class CMSFileAddController extends AssetAdmin {
class CMSFileAddController extends LeftAndMain {
static $url_segment = 'assets/add';
static $url_priority = 60;
static $required_permission_codes = 'CMS_ACCESS_AssetAdmin';
static $menu_title = 'Files';
public static $tree_class = 'Folder';
// public function upload($request) {
// $formHtml = $this->renderWith(array('AssetAdmin_UploadContent'));
@ -16,6 +18,34 @@ class CMSFileAddController extends AssetAdmin {
// }
// }
/**
* Custom currentPage() method to handle opening the 'root' folder
*/
public function currentPage() {
$id = $this->currentPageID();
if($id && is_numeric($id)) {
return DataObject::get_by_id('Folder', $id);
} else {
// ID is either '0' or 'root'
return singleton('Folder');
}
}
/**
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
*/
public function currentPageID() {
if($this->request->requestVar('ID')) {
return $this->request->requestVar('ID');
} elseif (is_numeric($this->urlParams['ID'])) {
return $this->urlParams['ID'];
} elseif(Session::get("{$this->class}.currentPage")) {
return Session::get("{$this->class}.currentPage");
} else {
return "root";
}
}
/**
* @return Form
* @todo what template is used here? AssetAdmin_UploadContent.ss doesn't seem to be used anymore
@ -45,6 +75,7 @@ class CMSFileAddController extends AssetAdmin {
new FieldList()
);
$form->addExtraClass('center cms-edit-form ' . $this->BaseCSSClasses());
// Don't use AssetAdmin_EditForm, as it assumes a different panel structure
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->Fields()->push(
new LiteralField(
@ -61,8 +92,22 @@ class CMSFileAddController extends AssetAdmin {
return $form;
}
function Tools() {
return false;
/**
* @return ArrayList
*/
public function Breadcrumbs($unlinked = false) {
$items = parent::Breadcrumbs($unlinked);
// The root element should explicitly point to the root node.
// Used in CMSFileAddController subclass as well, so specifically link to AssetAdmin
$items[0]->Link = Controller::join_links(singleton('AssetAdmin')->Link('show'), 'root');
$items->push(new ArrayData(array(
'Title' => _t('AssetAdmin.Upload', 'Upload'),
'Link' => $this->Link()
)));
return $items;
}
}

View File

@ -38,7 +38,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'publishall',
'publishitems',
'PublishItemsForm',
'RootForm',
'sidereport',
'SideReportsForm',
'submit',
@ -525,8 +524,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$this->extend('updateEditForm', $form);
return $form;
} if ($id == 0 || $id == 'root') {
return $this->RootForm();
} else if($id) {
return new Form($this, "EditForm", new FieldList(
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldList()
@ -534,32 +531,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
}
/**
* @return Form
*/
function RootForm() {
$siteConfig = SiteConfig::current_site_config();
$fields = $siteConfig->getCMSFields();
$actions = $siteConfig->getCMSActions();
$form = new Form($this, 'RootForm', $fields, $actions);
$form->addExtraClass('root-form');
$form->addExtraClass('cms-edit-form');
// TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('cms-content center ss-tabset');
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->setHTMLID('Form_EditForm');
$form->loadDataFrom($siteConfig);
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// Use <button> to allow full jQuery UI styling
foreach($actions->dataFields() as $action) $action->setUseButtonTag(true);
$this->extend('updateEditForm', $form);
return $form;
}
public function currentPageID() {
$id = parent::currentPageID();
@ -1315,44 +1286,19 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
);
}
/**
* Provide the permission codes used by LeftAndMain.
* Can't put it on LeftAndMain since that's an abstract base class.
*/
function providePermissions() {
$classes = ClassInfo::subclassesFor('LeftAndMain');
foreach($classes as $i => $class) {
$title = _t("{$class}.MENUTITLE", LeftAndMain::menu_title_for_class($class));
$perms["CMS_ACCESS_" . $class] = array(
'name' => sprintf(_t(
'CMSMain.ACCESS',
"Access to '%s' section",
PR_MEDIUM,
"Item in permission selection identifying the admin section. Example: Access to 'Files & Images'"
), $title, null),
'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access')
);
}
$perms["CMS_ACCESS_LeftAndMain"] = array(
'name' => _t('CMSMain.ACCESSALLINTERFACES', 'Access to all CMS sections'),
$title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController'));
return array(
"CMS_ACCESS_CMSMain" => array(
'name' => sprintf(_t('CMSMain.ACCESS', "Access to '%s' section"), $title),
'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access'),
'help' => _t('CMSMain.ACCESSALLINTERFACESHELP', 'Overrules more specific access settings.'),
'sort' => -100
);
$perms['CMS_ACCESS_CMSMain']['help'] = _t(
'help' => _t(
'CMSMain.ACCESS_HELP',
'Allow viewing of the section containing page tree and content. View and edit permissions can be handled through page specific dropdowns, as well as the separate "Content permissions".'
),
'sort' => -99 // below "CMS_ACCESS_LeftAndMain", but above everything else
)
);
$perms['CMS_ACCESS_SecurityAdmin']['help'] = _t(
'SecurityAdmin.ACCESS_HELP',
'Allow viewing, adding and editing users, as well as assigning permissions and roles to them.'
);
if (isset($perms['CMS_ACCESS_ModelAdmin'])) unset($perms['CMS_ACCESS_ModelAdmin']);
return $perms;
}
}

View File

@ -5,6 +5,7 @@ class CMSPageAddController extends CMSMain {
static $url_rule = '/$Action/$ID/$OtherID';
static $url_priority = 42;
static $menu_title = 'Add page';
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
function AddForm() {
$form = parent::AddForm();

View File

@ -8,4 +8,5 @@ class CMSPageEditController extends CMSMain {
static $url_segment = 'page/edit';
static $url_rule = '/$Action/$ID/$OtherID';
static $url_priority = 41;
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
}

View File

@ -10,6 +10,7 @@ class CMSPageHistoryController extends CMSMain {
static $url_rule = '/$Action/$ID/$VersionID/$OtherVersionID';
static $url_priority = 42;
static $menu_title = 'History';
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
static $allowed_actions = array(
'VersionsForm',
@ -81,6 +82,8 @@ class CMSPageHistoryController extends CMSMain {
$versionID = ($record) ? $record->Version : $versionID;
$form = parent::getEditForm($record, ($record) ? $record->getCMSFields() : null);
// Respect permission failures from parent implementation
if(!($form instanceof Form)) return $form;
$form->setActions(new FieldList(
$revert = FormAction::create('doRollback', _t('CMSPageHistoryController.REVERTTOTHISVERSION', 'Revert to this version'))->setUseButtonTag(true)

View File

@ -6,10 +6,9 @@
class CMSPageSettingsController extends CMSMain {
static $url_segment = 'page/settings';
static $url_rule = '/$Action/$ID/$OtherID';
static $url_priority = 42;
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
function getEditForm($id = null, $fields = null) {
$record = $this->getRecord($id ? $id : $this->currentPageID());

View File

@ -9,6 +9,7 @@ class CMSPagesController extends CMSMain {
static $url_rule = '/$Action/$ID/$OtherID';
static $url_priority = 41;
static $menu_title = 'Pages';
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
function init() {
parent::init();
@ -38,6 +39,10 @@ class CMSPagesController extends CMSMain {
return false;
}
function AddLink() {
return singleton("CMSPageAddController")->Link();
}
public function currentPageID() {
return false;
}

View File

@ -6,8 +6,31 @@ class CMSSettingsController extends CMSMain {
static $menu_priority = -1;
static $menu_title = 'Settings';
function getEditForm($id = null, $fields = null) {
return $this->RootForm();
/**
* @return Form
*/
function getEditForm($id = null) {
$siteConfig = SiteConfig::current_site_config();
$fields = $siteConfig->getCMSFields();
$actions = $siteConfig->getCMSActions();
$form = new Form($this, 'EditForm', $fields, $actions);
$form->addExtraClass('root-form');
$form->addExtraClass('cms-edit-form');
// TODO Can't merge $FormAttributes in template at the moment
$form->addExtraClass('cms-content center ss-tabset');
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->setHTMLID('Form_EditForm');
$form->loadDataFrom($siteConfig);
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// Use <button> to allow full jQuery UI styling
$actions = $actions->dataFields();
if($actions) foreach($actions as $action) $action->setUseButtonTag(true);
$this->extend('updateEditForm', $form);
return $form;
}
function PreviewLink() {

View File

@ -11,7 +11,7 @@
* @package cms
* @subpackage reports
*/
class ReportAdmin extends LeftAndMain {
class ReportAdmin extends LeftAndMain implements PermissionProvider {
static $url_segment = 'reports';
@ -97,5 +97,15 @@ class ReportAdmin extends LeftAndMain {
FormResponse::load_form($this->EditForm()->forTemplate());
return FormResponse::respond();
}
function providePermissions() {
$title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
return array(
"CMS_ACCESS_ReportAdmin" => array(
'name' => sprintf(_t('CMSMain.ACCESS', "Access to '%s' section"), $title),
'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access')
)
);
}
}

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

@ -1846,7 +1846,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
),
$tabMeta = new Tab('Metadata',
$urlsegment,
new HeaderField('MetaTagsHeader',$this->fieldLabel('MetaTagsHeader')),
new TextField("MetaTitle", $this->fieldLabel('MetaTitle')),
new TextareaField("MetaKeywords", $this->fieldLabel('MetaKeywords'), 1),
new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')),
@ -1890,6 +1889,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 +1927,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)
)
)
);
@ -2001,10 +2005,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$labels['Title'] = _t('SiteTree.PAGETITLE', "Page name");
$labels['MenuTitle'] = _t('SiteTree.MENUTITLE', "Navigation label");
$labels['MetaTagsHeader'] = _t('SiteTree.METAHEADER', "Search Engine Meta-tags");
$labels['MetaTitle'] = _t('SiteTree.METATITLE', "Title");
$labels['MetaDescription'] = _t('SiteTree.METADESC', "Description");
$labels['MetaKeywords'] = _t('SiteTree.METAKEYWORDS', "Keywords");
$labels['MetaTitle'] = _t('SiteTree.METATITLE', "Meta Title");
$labels['MetaDescription'] = _t('SiteTree.METADESC', "Meta Description");
$labels['MetaKeywords'] = _t('SiteTree.METAKEYWORDS', "Meta Keywords");
$labels['ExtraMeta'] = _t('SiteTree.METAEXTRA', "Custom Meta Tags");
$labels['ClassName'] = _t('SiteTree.PAGETYPE', "Page type", PR_MEDIUM, 'Classname of a page object');
$labels['ParentType'] = _t('SiteTree.PARENTTYPE', "Page location", PR_MEDIUM);
@ -2060,7 +2063,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// "unpublish"
$minorActions->push(
FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'), 'delete')
->describe(_t('SiteTree.BUTTONUNPUBLISHDESC', 'Remove this page from the published site'))
->setDescription(_t('SiteTree.BUTTONUNPUBLISHDESC', 'Remove this page from the published site'))
->addExtraClass('ss-ui-action-destructive')->setAttribute('data-icon', 'unpublish')
);
}
@ -2070,7 +2073,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// "rollback"
$minorActions->push(
FormAction::create('rollback', _t('SiteTree.BUTTONCANCELDRAFT', 'Cancel draft changes'), 'delete')
->describe(_t('SiteTree.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published page'))
->setDescription(_t('SiteTree.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published page'))
->addExtraClass('delete')->setAttribute('data-icon', 'delete')
);
}
@ -2655,7 +2658,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
'name' => _t('SiteTree.EDIT_ALL_DESCRIPTION', 'Edit any page'),
'category' => _t('Permissions.CONTENT_CATEGORY', 'Content permissions'),
'sort' => -50,
'help' => _t('SiteTree.EDIT_ALL_HELP', 'Ability to edit any page on the site, regardless of the settings on the Access tab. Requires the "Access to Site Content" permission')
'help' => _t('SiteTree.EDIT_ALL_HELP', 'Ability to edit any page on the site, regardless of the settings on the Access tab. Requires the "Access to \'Pages\' section" permission')
),
'SITETREE_REORGANISE' => array(
'name' => _t('SiteTree.REORGANISE_DESCRIPTION', 'Change site structure'),

View File

@ -10,7 +10,19 @@
.CMSPageHistoryController ins { background-color: #DFD; padding: 2px; text-decoration: none; }
.CMSPageHistoryController del { background-color: #FDD; padding: 2px; color: #ff4444; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav li a { font-weight: bold; line-height: 16px; padding: 12px 20px 11px; text-indent: -9999em; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav li a.content-treeview { background: url(../images/content-header-tabs-sprite.png) no-repeat 2px 0px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav li a.content-galleryview { background: url(../images/content-header-tabs-sprite.png) no-repeat -87px 0px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav li a.content-listview { background: url(../images/content-header-tabs-sprite.png) no-repeat -38px 0px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active { border-top: none; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active a.content-treeview, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active a.content-treeview, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active a.content-treeview { background: url(../images/content-header-tabs-sprite.png) no-repeat 2px -40px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active a.content-galleryview, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active a.content-galleryview, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active a.content-galleryview { background: url(../images/content-header-tabs-sprite.png) no-repeat -87px -40px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active a.content-listview, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active a.content-listview, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active a.content-listview { background: url(../images/content-header-tabs-sprite.png) no-repeat -38px -40px; }
.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button { background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f3f3f3), color-stop(100%, #d9d9d9)); background-image: -webkit-linear-gradient(#f3f3f3, #d9d9d9); background-image: -moz-linear-gradient(#f3f3f3, #d9d9d9); background-image: -o-linear-gradient(#f3f3f3, #d9d9d9); background-image: -ms-linear-gradient(#f3f3f3, #d9d9d9); background-image: linear-gradient(#f3f3f3, #d9d9d9); border-color: #c0c0c2; }
.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button span.btn-icon-add { height: 17px; }
.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button span.ui-button-text { color: #393939; text-shadow: white 0 1px 1px; }
.cms .AssetAdmin #Form_EditForm_File td { padding-top: 0; padding-bottom: 0; }
.cms .AssetAdmin #Form_EditForm_File td.bottom-all { padding: 0.7em; }
.cms .AssetAdmin #Form_EditForm_File td.col-StripThumbnail { padding: 0; width: 32px; height: 32px; display: block; }
.cms .AssetAdmin #Form_EditForm_File td.col-StripThumbnail img { width: 32px; height: 32px; }
.cms .AssetAdmin #Form_EditForm_File tr[data-class=Folder] td.col-StripThumbnail { background: transparent url(../../sapphire/admin/images/sprites-32x32/blue-folder-horizontal.png) no-repeat top left; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -28,10 +28,10 @@
* Load folder detail view via controller methods
* rather than built-in GridField view (which is only geared towards showing files).
*/
$('#Form_EditForm_File .ss-gridfield-item').entwine({
$('.AssetAdmin.cms-edit-form .ss-gridfield-item').entwine({
onclick: function(e) {
// Let actions do their own thing
if($(e.target).is('.action')) {
if($(e.target).closest('.action').length) {
this._super(e);
return;
}
@ -45,13 +45,39 @@
}
});
$('.cms-edit-form :submit[name=action_delete]').entwine({
$('.AssetAdmin.cms-edit-form .action.gridfield-button-delete').entwine({
onclick: function(e) {
if(!confirm(ss.i18n._t('AssetAdmin.ConfirmDelete'))) return false;
this.getGridField().reload({data: [{name: this.attr('name'), value: this.val()}]});
e.preventDefault();
return false;
}
});
$('.AssetAdmin.cms-edit-form :submit[name=action_delete]').entwine({
onclick: function(e) {
if(!confirm(ss.i18n._t('AssetAdmin.ConfirmDelete'))) return false;
else this._super(e);
}
});
/**
* Prompt for a new foldername, rather than using dedicated form.
* Better usability, but less flexibility in terms of inputs and validation.
* Mainly necessary because AssetAdmin->AddForm() returns don't play nicely
* with the nested AssetAdmin->EditForm() DOM structures.
*/
$('.AssetAdmin .cms-add-folder-link').entwine({
onclick: function(e) {
var name = prompt(ss.i18n._t('Folder.Name'));
if(!name) return false;
this.closest('.cms-container').loadPanel(this.data('url') + '&Name=' + name);
return false;
}
});
/**
* Class: #Form_SyncForm
*/

View File

@ -35,6 +35,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
'SecurityAdmin.BATCHACTIONSDELETECONFIRM': "Do you really want to delete %s groups?",
'CMSMAIN.AddSearchCriteria': 'Add Criteria',
'WidgetAreaEditor.TOOMANY': 'Sorry, you have reached the maximum number of widgets in this area',
'AssetAdmin.ConfirmDelete': 'Do you really want to delete this folder and all contained files?'
'AssetAdmin.ConfirmDelete': 'Do you really want to delete this folder and all contained files?',
'Folder.Name': 'Foldername'
});
}

View File

@ -357,7 +357,7 @@ $lang['en_US']['SiteTree']['EDITHEADER'] = 'Who can edit this page?';
$lang['en_US']['SiteTree']['EDITONLYTHESE'] = 'Only these people (choose from list)';
$lang['en_US']['SiteTree']['EDITORGROUPS'] = 'Editor Groups';
$lang['en_US']['SiteTree']['EDIT_ALL_DESCRIPTION'] = 'Edit any page';
$lang['en_US']['SiteTree']['EDIT_ALL_HELP'] = 'Ability to edit any page on the site, regardless of the settings on the Access tab. Requires the "Access to Site Content" permission';
$lang['en_US']['SiteTree']['EDIT_ALL_HELP'] = 'Ability to edit any page on the site, regardless of the settings on the Access tab. Requires the "Access to \'Pages\' section" permission';
$lang['en_US']['SiteTree']['Editors'] = 'Editors Groups';
$lang['en_US']['SiteTree']['HASBROKENLINKS'] = 'This page has broken links.';
$lang['en_US']['SiteTree']['HOMEPAGEFORDOMAIN'] = array(
@ -374,11 +374,10 @@ $lang['en_US']['SiteTree']['HomepageForDomain'] = 'Hompage for this domain';
$lang['en_US']['SiteTree']['INHERIT'] = 'Inherit from parent page';
$lang['en_US']['SiteTree']['LINKCHANGENOTE'] = 'Changing this page\'s link will also affect the links of all child pages.';
$lang['en_US']['SiteTree']['MENUTITLE'] = 'Navigation label';
$lang['en_US']['SiteTree']['METADESC'] = 'Description';
$lang['en_US']['SiteTree']['METADESC'] = 'Meta Description';
$lang['en_US']['SiteTree']['METAEXTRA'] = 'Custom Meta Tags';
$lang['en_US']['SiteTree']['METAHEADER'] = 'Search Engine Meta-tags';
$lang['en_US']['SiteTree']['METAKEYWORDS'] = 'Keywords';
$lang['en_US']['SiteTree']['METATITLE'] = 'Title';
$lang['en_US']['SiteTree']['METAKEYWORDS'] = 'Meta Keywords';
$lang['en_US']['SiteTree']['METATITLE'] = 'Meta Title';
$lang['en_US']['SiteTree']['MODIFIEDONDRAFT'] = 'Modified on draft site';
$lang['en_US']['SiteTree']['NOTEUSEASHOMEPAGE'] = 'Use this page as the \'home page\' for the following domains:
(separate multiple domains with commas)';

View File

@ -1,9 +1,68 @@
.cms .AssetAdmin {
.cms-content-header-tabs {
.ui-tabs-nav {
li {
a {
font-weight: bold;
line-height: 16px;
padding: 12px 20px 11px;
text-indent:-9999em;
&.content-treeview {
background:url(../images/content-header-tabs-sprite.png) no-repeat 2px 0px;
}
&.content-galleryview {
background:url(../images/content-header-tabs-sprite.png) no-repeat -87px 0px;
}
&.content-listview {
background:url(../images/content-header-tabs-sprite.png) no-repeat -38px 0px;
}
}
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
border: {
top:none;
}
a {
&.content-treeview {
background:url(../images/content-header-tabs-sprite.png) no-repeat 2px -40px;
}
&.content-galleryview {
background:url(../images/content-header-tabs-sprite.png) no-repeat -87px -40px;
}
&.content-listview {
background:url(../images/content-header-tabs-sprite.png) no-repeat -38px -40px;
}
}
}
}
}
.cms-content-toolbar {
.cms-page-add-button {
@include background-image (linear-gradient(lighten(#e6e6e6, 5%), darken(#e6e6e6, 5%)));
border-color:#c0c0c2;
span.btn-icon-add {
height:17px;
}
span.ui-button-text {
color:#393939;
text-shadow: white 0 1px 1px;
}
}
}
#Form_EditForm_File {
td {
// Taken care of by minimum image sizes
padding-top: 0;
padding-bottom: 0;
&.bottom-all {
padding:0.7em;
}
}
td.col-StripThumbnail {
padding: 0;
@ -29,3 +88,4 @@
}
}
}

View File

@ -0,0 +1,41 @@
<div class="cms-content center ss-tabset $BaseCSSClasses" data-layout-type="border">
<div class="cms-content-header north">
<div>
<% control EditForm %>
<% if Backlink %>
<a class="backlink ss-ui-button cms-panel-link" data-icon="back" href="$Backlink">
<% _t('Back', 'Back') %>
</a>
<% end_if %>
<h2 id="page-title-heading">
<% control Controller %>
<% include CMSBreadcrumbs %>
<% end_control %>
</h2>
<% if Fields.hasTabset %>
<% with Fields.fieldByName('Root') %>
<div class="cms-content-header-tabs">
<ul>
<% control Tabs %>
<li><a href="#$id"<% if extraClass %> class="$extraClass"<% end_if %>>$Title</a></li>
<% end_control %>
</ul>
</div>
<% end_with %>
<% end_if %>
<% end_control %>
</div>
</div>
<div class="cms-content-fields center ui-widget-content" data-layout-type="border">
$Tools
$EditForm
</div>
</div>

View File

@ -0,0 +1,30 @@
<form $FormAttributes>
<% if Message %>
<p id="{$FormName}_error" class="message $MessageType">$Message</p>
<% else %>
<p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
<% end_if %>
<fieldset>
<% if Legend %><legend>$Legend</legend><% end_if %>
<% control Fields %>
$FieldHolder
<% end_control %>
<div class="clear"><!-- --></div>
</fieldset>
<% if Actions %>
<div class="Actions">
<% control Actions %>
$Field
<% end_control %>
<% if CurrentPage.PreviewLink %>
<a href="$CurrentPage.PreviewLink" class="cms-preview-toggle-link ss-ui-button" data-icon="preview">
<% _t('LeftAndMain.PreviewButton', 'Preview') %> &raquo;
</a>
<% end_if %>
</div>
<% end_if %>
</form>

View File

@ -13,7 +13,7 @@
</div>
<div class="cms-actions-row">
<a class="ss-ui-button ss-ui-action-constructive" data-icon="add" href="#cms-page-add-form"><% _t('CMSMain.AddNewButton', 'Add new') %></a>
<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-icon="add" href="$AddLink"><% _t('CMSMain.AddNewButton', 'Add new') %></a>
</div>
<div class="cms-content-batchactions">