mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
FEATURE SiteConfig (from r85339)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@89194 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
beb6b5fe55
commit
53d735c4f6
@ -351,6 +351,14 @@ JS;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function save_siteconfig($data, $form) {
|
||||
$siteConfig = SiteConfig::current_site_config();
|
||||
$form->saveInto($siteConfig);
|
||||
$siteConfig->write();
|
||||
FormResponse::status_message('Saved site configuration', "good");
|
||||
FormResponse::add("$('Form_EditForm').resetElements();");
|
||||
return FormResponse::respond();
|
||||
}
|
||||
/**
|
||||
* Get a database record to be managed by the CMS
|
||||
*/
|
||||
@ -396,7 +404,7 @@ JS;
|
||||
|
||||
$fields = $record->getCMSFields($this);
|
||||
if ($fields == null) {
|
||||
user_error("getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);
|
||||
user_error("getCMSFields returned null on a '".get_class($record)."' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);
|
||||
}
|
||||
$fields->push($idField = new HiddenField("ID"));
|
||||
$fields->push($liveURLField = new HiddenField("LiveURLSegment"));
|
||||
@ -459,6 +467,11 @@ JS;
|
||||
$form->setFields($readonlyFields);
|
||||
}
|
||||
|
||||
return $form;
|
||||
} if ($id == 0) {
|
||||
$siteConfig = SiteConfig::current_site_config();
|
||||
$form = new Form($this, "EditForm", $siteConfig->getFormFields(), $siteConfig->getFormActions());
|
||||
$form->loadDataFrom($siteConfig);
|
||||
return $form;
|
||||
} else if($id) {
|
||||
return new Form($this, "EditForm", new FieldSet(
|
||||
|
@ -992,12 +992,16 @@ JS;
|
||||
// Include JavaScript to ensure HtmlEditorField works.
|
||||
HtmlEditorField::include_js();
|
||||
|
||||
if ($this->currentPageID() != 0) {
|
||||
$record = $this->currentPage();
|
||||
if(!$record) return false;
|
||||
|
||||
if($record && !$record->canView()) return Security::permissionFailure($this);
|
||||
}
|
||||
if ($this->hasMethod('getEditForm')) {
|
||||
return $this->getEditForm($this->currentPageID());
|
||||
}
|
||||
|
||||
return $this->getEditForm($record->ID);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function myprofile() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user