当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlEditorField::include_js方法代码示例

本文整理汇总了PHP中HtmlEditorField::include_js方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlEditorField::include_js方法的具体用法?PHP HtmlEditorField::include_js怎么用?PHP HtmlEditorField::include_js使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlEditorField的用法示例。


在下文中一共展示了HtmlEditorField::include_js方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Field

 public function Field($properties = array())
 {
     // Load TinyMCE if needed
     if (isset(self::$scenarios[$this->scenario]['fields'])) {
         $fields = self::$scenarios[$this->scenario]['fields'];
         foreach ($fields as $field) {
             if (isset($field['type']) && $field['type'] == 'htmleditor') {
                 HtmlEditorField::include_js();
                 break;
             }
         }
     }
     // Assets
     Requirements::css(SimpleListFieldDir . '/forms/SimpleListField/css/SimpleListField.css');
     Requirements::javascript(SimpleListFieldDir . '/forms/SimpleListField/js/jquery.serializejson.min.js');
     Requirements::javascript(SimpleListFieldDir . '/forms/SimpleListField/js/SimpleListField.js');
     // Set attributes
     $this->setAttribute('type', 'hidden');
     $this->addExtraClass('hide');
     if ($this->scenario) {
         $this->setAttribute('data-scenario', (string) $this->scenario);
         // heading
         if (isset(self::$scenarios[$this->scenario]['heading']) && !self::$scenarios[$this->scenario]['heading']) {
             $this->setAttribute('data-heading', 0);
         } else {
             $this->setAttribute('data-heading', 1);
         }
         // fields
         if (isset(self::$scenarios[$this->scenario]['fields']) && self::$scenarios[$this->scenario]['fields'] && is_array(self::$scenarios[$this->scenario]['fields'])) {
             $this->setAttribute('data-fields', json_encode(self::$scenarios[$this->scenario]['fields']));
         }
     }
     // Render the fields
     return $this->customise($properties)->renderWith($this->getTemplates());
 }
开发者ID:helpfulrobot,项目名称:silverbusters-silverstripe-simplelistfield,代码行数:35,代码来源:SimpleListField.php

示例2: init

 public function init()
 {
     // set reading lang
     if (Object::has_extension('SiteTree', 'Translatable') && !$this->isAjax()) {
         Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
     }
     parent::init();
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.EditForm.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.AddForm.js');
     Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang');
     Requirements::css(CMS_DIR . '/css/CMSMain.css');
     // navigator
     // Requirements::css(CMS_DIR . '/css/SilverStripeNavigator.css');
     Requirements::javascript(CMS_DIR . '/javascript/SilverStripeNavigator.js');
     Requirements::combine_files('cmsmain.js', array(CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', CMS_DIR . '/javascript/SilverStripeNavigator.js'));
     HtmlEditorField::include_js();
     CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish');
     CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish');
     CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete');
     CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:22,代码来源:CMSMain.php

示例3: EditForm

 /**
  * Return the edit form
  * @see cms/code/LeftAndMain#EditForm()
  */
 public function EditForm($request = null)
 {
     HtmlEditorField::include_js();
     $cur = $this->getCurrentPageID();
     if ($cur) {
         $record = $this->currentPage();
         if (!$record) {
             return false;
         }
         if ($record && !$record->canView()) {
             return Security::permissionFailure($this);
         }
     }
     if ($this->hasMethod('getEditForm')) {
         return $this->getEditForm($this->getCurrentPageID());
     }
     return false;
 }
开发者ID:nyeholt,项目名称:silverstripe-external-content,代码行数:22,代码来源:ExternalContentAdmin.php

示例4: getEditForm

 /**
  * Calls {@link SiteTree->getCMSFields()}
  */
 public function getEditForm($id = null)
 {
     // Include JavaScript to ensure HtmlEditorField works.
     HtmlEditorField::include_js();
     $form = parent::getEditForm($id);
     // TODO Duplicate record fetching (see parent implementation)
     if (!$id) {
         $id = $this->currentPageID();
     }
     $record = $id && $id != "root" ? $this->getRecord($id) : null;
     $fields = $form->Fields();
     $actions = $form->Actions();
     if ($record) {
         $fields->push($idField = new HiddenField("ID", false, $id));
         // Necessary for different subsites
         $fields->push($liveURLField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
         $fields->push($liveURLField = new HiddenField("LiveURLSegment"));
         $fields->push($stageURLField = new HiddenField("StageURLSegment"));
         $fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
         $fields->push(new HiddenField('Sort', '', $record->Sort));
         if ($record->ID && is_numeric($record->ID)) {
             $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = {$record->ID}");
             if ($liveRecord) {
                 $liveURLField->setValue($liveRecord->AbsoluteLink());
             }
         }
         if (!$record->IsDeletedFromStage) {
             $stageURLField->setValue($record->AbsoluteLink());
         }
         // getAllCMSActions can be used to completely redefine the action list
         if ($record->hasMethod('getAllCMSActions')) {
             $actions = $record->getAllCMSActions();
         } else {
             $actions = $record->getCMSActions();
         }
         // Add a default or custom validator.
         // @todo Currently the default Validator.js implementation
         //  adds javascript to the document body, meaning it won't
         //  be included properly if the associated fields are loaded
         //  through ajax. This means only serverside validation
         //  will kick in for pages+validation loaded through ajax.
         //  This will be solved by using less obtrusive javascript validation
         //  in the future, see http://open.silverstripe.com/ticket/2915 and http://open.silverstripe.com/ticket/3386
         if ($record->hasMethod('getCMSValidator')) {
             $validator = $record->getCMSValidator();
         } else {
             $validator = new RequiredFields();
         }
         // The clientside (mainly LeftAndMain*.js) rely on ajax responses
         // which can be evaluated as javascript, hence we need
         // to override any global changes to the validation handler.
         $validator->setJavascriptValidationHandler('prototype');
         $form = new Form($this, "EditForm", $fields, $actions, $validator);
         $form->loadDataFrom($record);
         $form->disableDefaultAction();
         if (!$record->canEdit() || $record->IsDeletedFromStage) {
             $readonlyFields = $form->Fields()->makeReadonly();
             $form->setFields($readonlyFields);
         }
         $this->extend('updateEditForm', $form);
         return $form;
     }
     if ($id == 0 || $id == 'root') {
         return $this->RootForm();
     } else {
         if ($id) {
             return new Form($this, "EditForm", new FieldSet(new LabelField('PageDoesntExistLabel', _t('CMSMain.PAGENOTEXISTS', "This page doesn't exist"))), new FieldSet());
         }
     }
 }
开发者ID:rodneyway,项目名称:silverstripe-cms,代码行数:73,代码来源:CMSMain.php

示例5: edit

 /**
  * Action handler for editing this wiki page
  * 
  * Creates a form that's used for editing the page's content, 
  * as well as adding in a couple of additional toolbar actions
  * for adding a simple link and a simple image
  */
 public function edit()
 {
     HtmlEditorField::include_js();
     //		Requirements::javascript('simplewiki/javascript/sslinks/editor_plugin_src.js');
     $existing = $this->getEditingLocks($this->data(), true);
     // oops, we've somehow got here even though we shouldn't have
     if ($existing && $existing['user'] != Member::currentUser()->Email) {
         return $this->redirect($this->data()->Link());
     }
     if (!$this->data()->canEdit()) {
         return Security::permissionFailure($this);
     }
     $this->form = $this->EditForm();
     // check who's editing and whether or not we should bail out
     return $this->renderWith(array('WikiPage', 'Page'));
 }
开发者ID:nyeholt,项目名称:silverstripe-simplewiki,代码行数:23,代码来源:WikiPage.php

示例6: getEditForm

 /**
  * Calls {@link SiteTree->getCMSFields()}
  */
 public function getEditForm($id = null)
 {
     // Include JavaScript to ensure HtmlEditorField works.
     HtmlEditorField::include_js();
     $form = parent::getEditForm($id);
     // TODO Duplicate record fetching (see parent implementation)
     if (!$id) {
         $id = $this->currentPageID();
     }
     $record = $id && $id != "root" ? $this->getRecord($id) : null;
     $fields = $form->Fields();
     $actions = $form->Actions();
     if ($record) {
         $fields->push($idField = new HiddenField("ID", false, $id));
         // Necessary for different subsites
         $fields->push($liveURLField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
         $fields->push($liveURLField = new HiddenField("LiveURLSegment"));
         $fields->push($stageURLField = new HiddenField("StageURLSegment"));
         $fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
         $fields->push(new HiddenField('Sort', '', $record->Sort));
         if ($record->ID && is_numeric($record->ID)) {
             $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = {$record->ID}");
             if ($liveRecord) {
                 $liveURLField->setValue($liveRecord->AbsoluteLink());
             }
         }
         if (!$record->IsDeletedFromStage) {
             $stageURLField->setValue($record->AbsoluteLink());
         }
         $deleteAction = new FormAction('delete', _t('CMSMain.DELETE', 'Delete from the draft site'));
         $deleteAction->addExtraClass('delete');
         $actions->insertBefore($deleteAction, 'action_save');
         if ($record->IsDeletedFromStage) {
             $form->makeReadonly();
         }
     } elseif ($id == 0) {
         $siteConfig = SiteConfig::current_site_config();
         $fields = $siteConfig->getCMSFields();
         if (Object::has_extension('SiteConfig', "Translatable")) {
             $fields->push(new HiddenField('Locale', '', $siteConfig->Locale));
         }
         $form = new Form($this, "EditForm", $fields, $siteConfig->getCMSActions());
         $form->loadDataFrom($siteConfig);
         return $form;
     } else {
         $form = $this->EmptyForm();
     }
     return $form;
 }
开发者ID:hamishcampbell,项目名称:silverstripe-cms,代码行数:52,代码来源:CMSMain.php

示例7: EditForm

 public function EditForm()
 {
     // 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 false;
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:18,代码来源:LeftAndMain.php

示例8: private_cloud

 public function private_cloud()
 {
     Requirements::javascript('marketplace/code/ui/admin/js/utils.js');
     Requirements::javascript('marketplace/code/ui/admin/js/jquery.text.area.counter.js');
     Requirements::javascript('marketplace/code/ui/admin/js/hypervisors.js');
     Requirements::javascript('marketplace/code/ui/admin/js/guest.os.js');
     Requirements::javascript('marketplace/code/ui/admin/js/components.js');
     Requirements::javascript('marketplace/code/ui/admin/js/videos.js');
     Requirements::javascript('marketplace/code/ui/admin/js/support.channels.js');
     Requirements::javascript('marketplace/code/ui/admin/js/additional.resources.js');
     Requirements::javascript('marketplace/code/ui/admin/js/pricing.schemas.js');
     Requirements::javascript('marketplace/code/ui/admin/js/datacenter.locations.js');
     Requirements::javascript('marketplace/code/ui/admin/js/marketplace.type.header.js');
     Requirements::javascript('marketplace/code/ui/admin/js/implementation_openstack_powered.js');
     Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false");
     Requirements::javascript('marketplace/code/ui/admin/js/geocoding.jquery.js');
     HtmlEditorField::include_js();
     Requirements::javascript('marketplace/code/ui/admin/js/private_cloud.js');
     return $this->getViewer('private_cloud')->process($this);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:20,代码来源:MarketPlaceAdminPage.php

示例9: EditForm

 /**
  * Get the EditForm
  */
 public function EditForm()
 {
     // Include JavaScript to ensure HtmlEditorField works.
     HtmlEditorField::include_js();
     if (isset($_REQUEST['ID']) && isset($_REQUEST['Type']) && $_REQUEST['Type'] == 'Newsletter' || isset($_REQUEST['action_savenewsletter'])) {
         $form = $this->NewsletterEditForm();
     } else {
         // If a mailing list member is being added to a group, then call the Recipient form
         if (isset($_REQUEST['fieldName']) && 'Recipients' == $_REQUEST['fieldName'] || !empty($_REQUEST['MemberSearch'])) {
             $form = $this->MailingListEditForm();
         } else {
             $form = $this->TypeEditForm();
         }
     }
     if ($form) {
         $form->disableDefaultAction();
     }
     return $form;
 }
开发者ID:roed,项目名称:silverstripe-newsletter,代码行数:22,代码来源:NewsletterAdmin.php


注:本文中的HtmlEditorField::include_js方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。