當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldSet::makeFieldReadonly方法代碼示例

本文整理匯總了PHP中FieldSet::makeFieldReadonly方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::makeFieldReadonly方法的具體用法?PHP FieldSet::makeFieldReadonly怎麽用?PHP FieldSet::makeFieldReadonly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FieldSet的用法示例。


在下文中一共展示了FieldSet::makeFieldReadonly方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getCMSFields

 /**
  * Get the fields that are sent to the CMS. In
  * your decorators: updateCMSFields(&$fields)
  *
  * @return Fieldset
  */
 function getCMSFields()
 {
     Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
     $fields = new FieldSet(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes(), '', null, _t('SiteConfig.DEFAULTTHEME', '(Use default theme)'))), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?"), 2), $viewersOptionsField = new OptionsetField("CanViewType"), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups")), new HeaderField('WhoCanEditHeader', _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?"), 2), $editorsOptionsField = new OptionsetField("CanEditType"), $editorGroupsField = new TreeMultiselectField("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups")), new HeaderField('WhoCanCreateTopLevelHeader', _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?"), 2), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType"), $topLevelCreatorsGroupsField = new TreeMultiselectField("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators")))));
     $viewersOptionsSource = array();
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     $topLevelCreatorsOptionsField->setSource($editorsOptionsSource);
     // Translatable doesn't handle updateCMSFields on DataObjects,
     // so add it here to save the current Locale,
     // because onBeforeWrite does not work.
     if (Object::has_extension('SiteConfig', "Translatable")) {
         $fields->push(new HiddenField("Locale"));
     }
     if (!Permission::check('EDIT_SITECONFIG')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         $fields->makeFieldReadonly($viewerGroupsField);
         $fields->makeFieldReadonly($editorsOptionsField);
         $fields->makeFieldReadonly($editorGroupsField);
         $fields->makeFieldReadonly($topLevelCreatorsOptionsField);
         $fields->makeFieldReadonly($topLevelCreatorsGroupsField);
         $fields->makeFieldReadonly($taglineField);
         $fields->makeFieldReadonly($titleField);
     }
     $tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main"));
     $tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access"));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
開發者ID:Raiser,項目名稱:Praktikum,代碼行數:41,代碼來源:SiteConfig.php

示例2: update_cms_actions

 /**
  * @param FieldSet $actions
  * @parma SiteTree $page
  */
 public static function update_cms_actions(&$actions, $page)
 {
     $openRequest = $page->OpenWorkflowRequest();
     // if user doesn't have publish rights
     if (!$page->canPublish() || $openRequest) {
         // authors shouldn't be able to revert, as this republishes the page.
         // they should rather change the page and re-request publication
         $actions->removeByName('action_revert');
     }
     // Remove the one click publish if they are not an admin/workflow admin.
     if (self::$force_publishers_to_use_workflow && !Permission::checkMember(Member::currentUser(), 'IS_WORKFLOW_ADMIN')) {
         $actions->removeByName('action_publish');
     }
     // Remove the save & publish button if you don't have edit rights
     if (!$page->canEdit()) {
         $actions->removeByName('action_publish');
     }
     $liveVersion = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree_Live\".\"ID\" = {$page->ID}");
     if ($liveVersion && $liveVersion->ExpiryDate != null && $liveVersion->ExpiryDate != '0000-00-00 00:00:00') {
         if ($page->canApprove()) {
             $actions->push(new FormAction('cms_cancelexpiry', _t('WorkflowPublicationRequest.BUTTONCANCELEXPIRY', 'Cancel expiry')));
         }
     }
     // Optional method
     $isPublishable = $page->hasMethod('isPublishable') ? $page->isPublishable() : true;
     if (!$openRequest && $page->canEdit() && $isPublishable && $page->stagesDiffer('Stage', 'Live') && ($page->Version > 1 || $page->Title != "New Page") && !$page->IsDeletedFromStage && (!$page->canPublish() || self::$publisher_can_create_wf_requests)) {
         $actions->push($requestPublicationAction = new FormAction('cms_requestpublication', _t('SiteTreeCMSWorkflow.BUTTONREQUESTPUBLICATION', 'Request Publication')));
         // don't allow creation of a second request by another author
         if (!self::can_create(null, $page)) {
             $actions->makeFieldReadonly($requestPublicationAction->Name());
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-cmsworkflow,代碼行數:37,代碼來源:WorkflowPublicationRequest.php

示例3: updateCMSFields

 /**
  * Fields to display this {@link Payment} in the CMS, removed some of the 
  * unnecessary fields.
  * 
  * @see DataObjectDecorator::updateCMSFields()
  * @return FieldSet
  */
 function updateCMSFields(FieldSet &$fields)
 {
     $toBeRemoved = array('IP', 'ProxyIP', 'PaidForID', 'PaidForClass', 'PaymentDate', 'ExceptionError', 'Token', 'PayerID', 'RecurringPaymentID');
     foreach ($toBeRemoved as $field) {
         $fields->removeByName($field);
     }
     $toBeReadOnly = array('TransactionID', 'PaidByID');
     foreach ($toBeReadOnly as $field) {
         if ($fields->fieldByName($field)) {
             $fields->makeFieldReadonly($field);
         }
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:21,代碼來源:PaymentDecorator.php

示例4: update_cms_actions

 /**
  * @param FieldSet $actions
  * @parma SiteTree $page
  */
 public static function update_cms_actions(&$actions, $page)
 {
     $openRequest = $page->OpenWorkflowRequest();
     // if user doesn't have publish rights, exchange the behavior from
     // "publish" to "request publish" etc.
     if (!$page->canDeleteFromLive() || $openRequest) {
         // "request removal"
         $actions->removeByName('action_deletefromlive');
     }
     if (!$openRequest && $page->canEdit() && (!$page->canPublish() || self::$publisher_can_create_wf_requests) && $page->IsDeletedFromStage) {
         if ($page->ExistsOnLive) {
             $actions->push($requestDeletionAction = new FormAction('cms_requestdeletefromlive', _t('SiteTreeCMSWorkflow.BUTTONREQUESTREMOVAL', 'Request Removal')));
         }
         // don't allow creation of a second request by another author
         if (!self::can_create(null, $page)) {
             $actions->makeFieldReadonly($requestDeletionAction->Name());
         }
     }
     // @todo deny deletion
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-cmsworkflow,代碼行數:24,代碼來源:WorkflowDeletionRequest.php

示例5: testMakeFieldReadonly

 function testMakeFieldReadonly()
 {
     $fieldSet = new FieldSet(new TabSet('Root', new Tab('Main', new TextField('A'), new TextField('B'))));
     $fieldSet->makeFieldReadonly('A');
     $this->assertTrue($fieldSet->dataFieldByName('A')->isReadonly(), 'Field nested inside a TabSet and FieldSet can be marked readonly by FieldSet->makeFieldReadonly()');
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:6,代碼來源:FieldSetTest.php

示例6: getCMSFields

 /**
  * Returns a FieldSet with which to create the CMS editing form.
  *
  * You can override this in your child classes to add extra fields - first
  * get the parent fields using parent::getCMSFields(), then use
  * addFieldToTab() on the FieldSet.
  *
  * @return FieldSet The fields to be displayed in the CMS.
  */
 function getCMSFields()
 {
     require_once "forms/Form.php";
     Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
     Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
     Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
     Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/UpdateURL.js');
     // Status / message
     // Create a status message for multiple parents
     if ($this->ID && is_numeric($this->ID)) {
         $linkedPages = $this->VirtualPages();
     }
     $parentPageLinks = array();
     if (isset($linkedPages)) {
         foreach ($linkedPages as $linkedPage) {
             $parentPage = $linkedPage->Parent;
             if ($parentPage) {
                 if ($parentPage->ID) {
                     $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/{$linkedPage->ID}\">{$parentPage->Title}</a>";
                 } else {
                     $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/{$linkedPage->ID}\">" . _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . "</a>";
                 }
             }
         }
         $lastParent = array_pop($parentPageLinks);
         $parentList = "'{$lastParent}'";
         if (count($parentPageLinks) > 0) {
             $parentList = "'" . implode("', '", $parentPageLinks) . "' and " . $parentList;
         }
         $statusMessage[] = sprintf(_t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), $parentList);
     }
     if ($this->HasBrokenLink || $this->HasBrokenFile) {
         $statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links.");
     }
     $message = "STATUS: {$this->Status}<br />";
     if (isset($statusMessage)) {
         $message .= "NOTE: " . implode("<br />", $statusMessage);
     }
     $dependentNote = '';
     $dependentTable = new LiteralField('DependentNote', '<p></p>');
     // Create a table for showing pages linked to this one
     $dependentPagesCount = $this->DependentPagesCount();
     if ($dependentPagesCount) {
         $dependentColumns = array('Title' => $this->fieldLabel('Title'), 'AbsoluteLink' => _t('SiteTree.DependtPageColumnURL', 'URL'), 'DependentLinkType' => _t('SiteTree.DependtPageColumnLinkType', 'Link type'));
         if (class_exists('Subsite')) {
             $dependentColumns['Subsite.Title'] = singleton('Subsite')->i18n_singular_name();
         }
         $dependentNote = new LiteralField('DependentNote', '<p>' . _t('SiteTree.DEPENDENT_NOTE', 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.') . '</p>');
         $dependentTable = new TableListField('DependentPages', 'SiteTree', $dependentColumns);
         $dependentTable->setCustomSourceItems($this->DependentPages());
         $dependentTable->setFieldFormatting(array('Title' => '<a href=\\"admin/show/$ID\\">$Title</a>', 'AbsoluteLink' => '<a href=\\"$value\\">$value</a>'));
         $dependentTable->setPermissions(array('show', 'export'));
     }
     // Lay out the fields
     $fields = new FieldSet($rootTab = new TabSet("Root", $tabContent = new TabSet('Content', $tabMain = new Tab('Main', new TextField("Title", $this->fieldLabel('Title')), new TextField("MenuTitle", $this->fieldLabel('MenuTitle')), new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", PR_MEDIUM, 'HTML editor title'))), $tabMeta = new Tab('Metadata', new FieldGroup(_t('SiteTree.URL', "URL"), new LabelField('BaseUrlLabel', Controller::join_links(Director::absoluteBaseURL(), self::nested_urls() && $this->ParentID ? $this->Parent()->RelativeLink(true) : null)), new UniqueRestrictedTextField("URLSegment", "URLSegment", "SiteTree", _t('SiteTree.VALIDATIONURLSEGMENT1', "Another page is using that URL. URL must be unique for each page"), "[^A-Za-z0-9-]+", "-", _t('SiteTree.VALIDATIONURLSEGMENT2', "URLs can only be made up of letters, digits and hyphens."), "", "", "", 50), new LabelField('TrailingSlashLabel', "/")), new LiteralField('LinkChangeNote', self::nested_urls() && count($this->Children()) ? '<p>' . $this->fieldLabel('LinkChangeNote') . '</p>' : null), 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')), new TextareaField("ExtraMeta", $this->fieldLabel('ExtraMeta')))), $tabBehaviour = new Tab('Behaviour', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array("root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree'), new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')), new CheckboxField("ProvideComments", $this->fieldLabel('ProvideComments')), new LiteralField("HomepageForDomainInfo", "<p>" . _t('SiteTree.NOTEUSEASHOMEPAGE', "Use this page as the 'home page' for the following domains: \n\t\t\t\t\t\t\t(separate multiple domains with commas)") . "</p>"), new TextField("HomepageForDomain", _t('SiteTree.HOMEPAGEFORDOMAIN', "Domain(s)", PR_MEDIUM, 'Listing domains that should be used as homepage'))), $tabToDo = new Tab(_t('SiteTree.TABTODO', 'To-do') . ($this->ToDo ? '**' : ''), new LiteralField("ToDoHelp", _t('SiteTree.TODOHELP', "<p>You can use this to keep track of work that needs to be done to the content of your site.  To see all your pages with to do information, open the 'Site Reports' window on the left and select 'To Do'</p>")), new TextareaField("ToDo", "", 10)), $tabDependent = new Tab('Dependent', $dependentNote, $dependentTable), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteTree.ACCESSHEADER', "Who can view this page?"), 2), $viewersOptionsField = new OptionsetField("CanViewType", ""), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", $this->fieldLabel('ViewerGroups')), new HeaderField('WhoCanEditHeader', _t('SiteTree.EDITHEADER', "Who can edit this page?"), 2), $editorsOptionsField = new OptionsetField("CanEditType", ""), $editorGroupsField = new TreeMultiselectField("EditorGroups", $this->fieldLabel('EditorGroups')))));
     /*
      * This filter ensures that the ParentID dropdown selection does not show this node,
      * or its descendents, as this causes vanishing bugs.
      */
     $parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
     // Conditional dependent pages tab
     if ($dependentPagesCount) {
         $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ({$dependentPagesCount})");
     } else {
         $fields->removeFieldFromTab('Root', 'Dependent');
     }
     // Make page location fields read-only if the user doesn't have the appropriate permission
     if (!Permission::check("SITETREE_REORGANISE")) {
         $fields->makeFieldReadonly('ParentType');
         if ($this->ParentType == 'root') {
             $fields->removeByName('ParentID');
         } else {
             $fields->makeFieldReadonly('ParentID');
         }
     }
     $viewersOptionsSource = array();
     $viewersOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     if (!Permission::check('SITETREE_GRANT_ACCESS')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         if ($this->CanViewType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($viewerGroupsField);
//.........這裏部分代碼省略.........
開發者ID:eLBirador,項目名稱:AllAboutCity,代碼行數:101,代碼來源:SiteTree.php

示例7: getSettingsFields

 /**
  * Returns fields related to configuration aspects on this record, e.g. access control.
  * See {@link getCMSFields()} for content-related fields.
  * 
  * @return FieldSet
  */
 function getSettingsFields()
 {
     $fields = new FieldSet($rootTab = new TabSet("Root", $tabBehaviour = new Tab('Settings', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array("root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree', 'ID', 'MenuTitle'), new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')), new LiteralField("HomepageForDomainInfo", "<p>" . _t('SiteTree.NOTEUSEASHOMEPAGE', "Use this page as the 'home page' for the following domains: \n\t\t\t\t\t\t\t(separate multiple domains with commas)") . "</p>"), new TextField("HomepageForDomain", _t('SiteTree.HOMEPAGEFORDOMAIN', "Domain(s)", PR_MEDIUM, 'Listing domains that should be used as homepage'))), $tabAccess = new Tab('Access', $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?")), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", $this->fieldLabel('ViewerGroups')), $editorsOptionsField = new OptionsetField("CanEditType", _t('SiteTree.EDITHEADER', "Who can edit this page?")), $editorGroupsField = new TreeMultiselectField("EditorGroups", $this->fieldLabel('EditorGroups')))));
     /*
      * This filter ensures that the ParentID dropdown selection does not show this node,
      * or its descendents, as this causes vanishing bugs.
      */
     $parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
     $tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR', "Behavior"));
     $tabAccess->setTitle(_t('SiteTree.TABACCESS', "Access"));
     // Make page location fields read-only if the user doesn't have the appropriate permission
     if (!Permission::check("SITETREE_REORGANISE")) {
         $fields->makeFieldReadonly('ParentType');
         if ($this->ParentType == 'root') {
             $fields->removeByName('ParentID');
         } else {
             $fields->makeFieldReadonly('ParentID');
         }
     }
     $viewersOptionsSource = array();
     $viewersOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     if (!Permission::check('SITETREE_GRANT_ACCESS')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         if ($this->CanViewType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($viewerGroupsField);
         } else {
             $fields->removeByName('ViewerGroups');
         }
         $fields->makeFieldReadonly($editorsOptionsField);
         if ($this->CanEditType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($editorGroupsField);
         } else {
             $fields->removeByName('EditorGroups');
         }
     }
     if (self::$runCMSFieldsExtensions) {
         $this->extend('updateSettingsFields', $fields);
     }
     return $fields;
 }
開發者ID:rixrix,項目名稱:silverstripe-cms,代碼行數:55,代碼來源:SiteTree.php

示例8: getCMSFields


//.........這裏部分代碼省略.........
								_t('SiteTree.VALIDATIONURLSEGMENT2', "URLs can only be made up of letters, digits and hyphens."),
								"",
								"",
								"",
								50
							),
							new LabelField('TrailingSlashLabel',"/")
						),
						new HeaderField('MetaTagsHeader',$this->fieldLabel('MetaTagsHeader')),
						new TextField("MetaTitle", $this->fieldLabel('MetaTitle')),
						new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')),
						new TextareaField("MetaKeywords", $this->fieldLabel('MetaKeywords')),
						new TextareaField("ExtraMeta",$this->fieldLabel('ExtraMeta'))
					)
				),
				$tabBehaviour = new Tab('Behaviour',
					new DropdownField(
						"ClassName", 
						$this->fieldLabel('ClassName'), 
						$this->getClassDropdown()
					),
					new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')),
					new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')),
					/*, new TreeMultiselectField("MultipleParents", "Page appears within", "SiteTree")*/
					new CheckboxField("ProvideComments", $this->fieldLabel('ProvideComments')),
					new LiteralField(
						"", 
						"<p>" . 
							_t('SiteTree.NOTEUSEASHOMEPAGE', 
							"Use this page as the 'home page' for the following domains: 
							(separate multiple domains with commas)") .
						"</p>"
					),
					new TextField(
						"HomepageForDomain",
						_t('SiteTree.HOMEPAGEFORDOMAIN', "Domain(s)", PR_MEDIUM, 'Listing domains that should be used as homepage')
					)
				),
				$tabToDo = new Tab($this->ToDo ? 'To-do **' : 'To-do',
					new LiteralField("ToDoHelp", _t('SiteTree.TODOHELP', "<p>You can use this to keep track of work that needs to be done to the content of your site.  To see all your pages with to do information, open the 'Site Reports' window on the left and select 'To Do'</p>")),
					new TextareaField("ToDo", "")
				),
				$tabReports = new TabSet('Reports',
					$tabBacklinks = new Tab('Backlinks',
						$backLinksNote,
						$backLinksTable
					)
				),
				$tabAccess = new Tab('Access',
					new HeaderField('WhoCanViewHeader',_t('SiteTree.ACCESSHEADER', "Who can view this page?"), 2),
					$viewersOptionsField = new OptionsetField(
						"CanViewType", 
						""
					),
					$viewerGroupsField = new TreeMultiselectField("ViewerGroups", $this->fieldLabel('ViewerGroups')),
					new HeaderField('WhoCanEditHeader',_t('SiteTree.EDITHEADER', "Who can edit this page?"), 2),
					$editorsOptionsField = new OptionsetField(
						"CanEditType", 
						""
					),
					$editorGroupsField = new TreeMultiselectField("EditorGroups", $this->fieldLabel('EditorGroups'))
				)
			)
			//new NamedLabelField("Status", $message, "pageStatusMessage", true)
		);

		if(!Permission::check('SITETREE_GRANT_ACCESS')) {
			$fields->makeFieldReadonly($viewersOptionsField);
			$fields->makeFieldReadonly($viewerGroupsField);
			$fields->makeFieldReadonly($editorsOptionsField);
			$fields->makeFieldReadonly($editorGroupsField);
		}
		
		$viewersOptionsSource = array();
		if($this->Parent()->ID || $this->CanViewType == 'Inherit') $viewersOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
		$viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
		$viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
		$viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
		$viewersOptionsField->setSource($viewersOptionsSource);
		
		$editorsOptionsSource = array();
		if($this->Parent()->ID || $this->CanEditType == 'Inherit') $editorsOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
		$editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
		$editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
		$editorsOptionsField->setSource($editorsOptionsSource);
		
		$tabContent->setTitle(_t('SiteTree.TABCONTENT', "Content"));
		$tabMain->setTitle(_t('SiteTree.TABMAIN', "Main"));
		$tabMeta->setTitle(_t('SiteTree.TABMETA', "Metadata"));
		$tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR', "Behaviour"));
		$tabReports->setTitle(_t('SiteTree.TABREPORTS', "Reports"));
		$tabAccess->setTitle(_t('SiteTree.TABACCESS', "Access"));
		$tabBacklinks->setTitle(_t('SiteTree.TABBACKLINKS', "BackLinks"));
		
		if(self::$runCMSFieldsExtensions) {
			$this->extend('updateCMSFields', $fields);
		}

		return $fields;
	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:101,代碼來源:SiteTree.php

示例9: updateFieldSet

	/**
	 * Make a readonly transformation on all fields in the given
	 * FieldSet which have a name corresponding to a key in the
	 * given $values array.
	 * 
	 * @param FieldSet &$fields
	 * @param array $values
	 */
	public function updateFieldSet(FieldSet &$fields, array $values) {
		foreach ($values as $field => $value) {
			if ($fields->dataFieldByName($field))
				$fields->makeFieldReadonly($field);
		}
	}
開發者ID:redema,項目名稱:silverstripe-handyman,代碼行數:14,代碼來源:DataObjectEnforceDBValueDecorator.php


注:本文中的FieldSet::makeFieldReadonly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。