mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +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;
|
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
|
* Get a database record to be managed by the CMS
|
||||||
*/
|
*/
|
||||||
@ -396,7 +404,7 @@ JS;
|
|||||||
|
|
||||||
$fields = $record->getCMSFields($this);
|
$fields = $record->getCMSFields($this);
|
||||||
if ($fields == null) {
|
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($idField = new HiddenField("ID"));
|
||||||
$fields->push($liveURLField = new HiddenField("LiveURLSegment"));
|
$fields->push($liveURLField = new HiddenField("LiveURLSegment"));
|
||||||
@ -459,6 +467,11 @@ JS;
|
|||||||
$form->setFields($readonlyFields);
|
$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;
|
return $form;
|
||||||
} else if($id) {
|
} else if($id) {
|
||||||
return new Form($this, "EditForm", new FieldSet(
|
return new Form($this, "EditForm", new FieldSet(
|
||||||
|
@ -992,12 +992,16 @@ JS;
|
|||||||
// Include JavaScript to ensure HtmlEditorField works.
|
// Include JavaScript to ensure HtmlEditorField works.
|
||||||
HtmlEditorField::include_js();
|
HtmlEditorField::include_js();
|
||||||
|
|
||||||
$record = $this->currentPage();
|
if ($this->currentPageID() != 0) {
|
||||||
if(!$record) return false;
|
$record = $this->currentPage();
|
||||||
|
if(!$record) return false;
|
||||||
|
if($record && !$record->canView()) return Security::permissionFailure($this);
|
||||||
|
}
|
||||||
|
if ($this->hasMethod('getEditForm')) {
|
||||||
|
return $this->getEditForm($this->currentPageID());
|
||||||
|
}
|
||||||
|
|
||||||
if($record && !$record->canView()) return Security::permissionFailure($this);
|
return false;
|
||||||
|
|
||||||
return $this->getEditForm($record->ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function myprofile() {
|
public function myprofile() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user