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


PHP SSViewer::setOption方法代码示例

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


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

示例1: init

 function init()
 {
     parent::init();
     Requirements::themedCSS('editor');
     Requirements::javascript('mysite/js/signup-now.js');
     SSViewer::setOption('rewriteHashlinks', false);
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:7,代码来源:RegistrationPage.php

示例2: init

 function init()
 {
     parent::init();
     Requirements::themedCSS('jquery-filestyle.min');
     Requirements::javascript('mysite/js/jquery-filestyle.min.js');
     Requirements::javascript('mysite/js/create-heatmap.js');
     SSViewer::setOption('rewriteHashlinks', false);
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:8,代码来源:CreateHeatmap.php

示例3: show

 public function show($params)
 {
     if ($params['ID']) {
         $this->setCurrentPageID($params['ID']);
     }
     if (isset($params['OtherID'])) {
         Session::set('currentMember', $params['OtherID']);
     }
     if (Director::is_ajax()) {
         SSViewer::setOption('rewriteHashlinks', false);
         return $this->EditForm() ? $this->EditForm()->formHtmlContent() : false;
     }
     return array();
 }
开发者ID:halkyon,项目名称:silverstripe-linkchecker,代码行数:14,代码来源:LinkCheckAdmin.php

示例4: showWithEditForm

 protected function showWithEditForm($params, $editForm)
 {
     if (isset($params['ID'])) {
         Session::set('currentPage', $params['ID']);
     }
     if (isset($params['OtherID'])) {
         Session::set('currentOtherID', $params['OtherID']);
     }
     if (Director::is_ajax()) {
         SSViewer::setOption('rewriteHashlinks', false);
         $result = $this->customise(array('EditForm' => $editForm))->renderWith($this->getTemplatesWithSuffix("_right"));
         return $this->getLastFormIn($result);
     } else {
         return array();
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:16,代码来源:ReportAdmin.php

示例5: getitem

 public function getitem()
 {
     $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : $this->templateID;
     $this->setCurrentPageID($id);
     SSViewer::setOption('rewriteHashlinks', false);
     if (isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID'])) {
         $record = DataObject::get_by_id("DynamicTemplate", $_REQUEST['ID']);
         if ($record && !$record->canView()) {
             return Security::permissionFailure($this);
         }
     }
     $form = $this->EditForm();
     if ($form) {
         $content = $form->formHtmlContent();
         if ($this->ShowSwitchView()) {
             $content .= '<div id="AjaxSwitchView">' . $this->SwitchView() . '</div>';
         }
         return $content;
     } else {
         return "";
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-dynamictemplate,代码行数:22,代码来源:DynamicTemplateAdmin.php

示例6: show

 public function show($request)
 {
     // TODO Necessary for TableListField URLs to work properly
     if ($request->param('ID')) {
         $this->setCurrentPageID($request->param('ID'));
     }
     if ($this->isAjax()) {
         SSViewer::setOption('rewriteHashlinks', false);
         $form = $this->getEditForm($request->param('ID'));
         $content = $form->formHtmlContent();
     } else {
         // Rendering is handled by template, which will call EditForm() eventually
         $content = $this->renderWith($this->getViewer('show'));
     }
     if ($this->ShowSwitchView()) {
         $content .= '<div id="AjaxSwitchView">' . $this->SwitchView() . '</div>';
     }
     return $content;
 }
开发者ID:rodneyway,项目名称:silverstripe-cms,代码行数:19,代码来源:LeftAndMain.php

示例7: sendFormToBrowser

 function sendFormToBrowser($templateData)
 {
     if (Director::is_ajax()) {
         SSViewer::setOption('rewriteHashlinks', false);
         $result = $this->customise($templateData)->renderWith($this->class . '_right');
         $parts = split('</?form[^>]*>', $result);
         return $parts[sizeof($parts) - 2];
     } else {
         return array("Right" => $this->customise($templateData)->renderWith($this->class . '_right'));
     }
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:11,代码来源:CMSMain.php

示例8: testRewriteHashlinksInPhpMode

    public function testRewriteHashlinksInPhpMode()
    {
        $oldRewriteHashLinks = SSViewer::getOption('rewriteHashlinks');
        SSViewer::setOption('rewriteHashlinks', 'php');
        $tmplFile = TEMP_FOLDER . '/SSViewerTest_testRewriteHashlinksInPhpMode_' . sha1(rand()) . '.ss';
        // Note: SSViewer_FromString doesn't rewrite hash links.
        file_put_contents($tmplFile, '<!DOCTYPE html>
			<html>
				<head><% base_tag %></head>
				<body>
				<a class="inline" href="#anchor">InlineLink</a>
				$InsertedLink
				<body>
			</html>');
        $tmpl = new SSViewer($tmplFile);
        $obj = new ViewableData();
        $obj->InsertedLink = '<a class="inserted" href="#anchor">InsertedLink</a>';
        $result = $tmpl->process($obj);
        $this->assertContains('<a class="inserted" href="<?php echo strip_tags(', $result);
        // TODO Fix inline links in PHP mode
        // $this->assertContains(
        // 	'<a class="inline" href="<?php echo str_replace(',
        // 	$result
        // );
        unlink($tmplFile);
        SSViewer::setOption('rewriteHashlinks', $oldRewriteHashLinks);
    }
开发者ID:normann,项目名称:sapphire,代码行数:27,代码来源:SSViewerTest.php

示例9: getitem

 public function getitem()
 {
     $this->setCurrentPageID($_REQUEST['ID']);
     SSViewer::setOption('rewriteHashlinks', false);
     // Changed 3/11/2006 to not use getLastFormIn because that didn't have _form_action, _form_name, etc.
     $form = $this->EditForm();
     if ($form) {
         return $form->formHtmlContent();
     } else {
         return "";
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:12,代码来源:LeftAndMain.php

示例10: newmember

 public function newmember()
 {
     Session::clear('currentMember');
     $newMemberForm = array("MemberForm" => $this->getMemberForm('new'));
     // This should be using FormResponse ;-)
     if (Director::is_ajax()) {
         SSViewer::setOption('rewriteHashlinks', false);
         $customised = $this->customise($newMemberForm);
         $result = $customised->renderWith($this->class . "_rightbottom");
         $parts = split('</?form[^>]*>', $result);
         return $parts[1];
     } else {
         return $newMemberForm;
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:15,代码来源:SecurityAdmin.php

示例11: init

 /**
  * @uses LeftAndMainExtension->init()
  * @uses LeftAndMainExtension->accessedCMS()
  * @uses CMSMenu
  */
 function init()
 {
     parent::init();
     SSViewer::setOption('rewriteHashlinks', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::set_date_format($member->DateFormat);
     }
     if (!empty($member->TimeFormat)) {
         i18n::set_time_format($member->TimeFormat);
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', PR_HIGH, 'Menu title'), self::$help_link);
     // Allow customisation of the access check by a extension
     // Also all the canView() check to execute Director::redirect()
     if (!$this->canView() && !$this->response->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 return Director::redirect($candidate->Link);
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "Please choose an authentication method and enter your credentials to access the CMS."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."));
         return Security::permissionFailure($this, $messageSet);
     }
     // Don't continue if there's already been a redirection request.
     if (Director::redirected_to()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Requirements
     Requirements::combine_files('lib.js', array(THIRDPARTY_DIR . '/prototype/prototype.js', THIRDPARTY_DIR . '/behaviour/behaviour.js', THIRDPARTY_DIR . '/jquery/jquery.js', SAPPHIRE_DIR . '/javascript/jquery_improvements.js', THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js', SAPPHIRE_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', SAPPHIRE_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js', SAPPHIRE_DIR . '/javascript/TreeDropdownField.js', SAPPHIRE_DIR . "/thirdparty/jquery-form/jquery.form.js", SAPPHIRE_DIR . '/javascript/DateField.js', SAPPHIRE_DIR . '/javascript/HtmlEditorField.js', SAPPHIRE_DIR . '/javascript/TabSet.js', SAPPHIRE_DIR . '/javascript/Validator.js', SAPPHIRE_DIR . '/javascript/i18n.js', SAPPHIRE_ADMIN_DIR . '/javascript/ssui.core.js'));
     Requirements::combine_files('leftandmain.js', array(SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Content.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.AddForm.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js', SAPPHIRE_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js'));
     Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
     Requirements::add_i18n_javascript(SAPPHIRE_ADMIN_DIR . '/javascript/lang');
     Requirements::combine_files('lib.css', array(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css', SAPPHIRE_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css', THIRDPARTY_DIR . '/jstree/themes/apple/style.css', SAPPHIRE_DIR . '/javascript/TreeDropdownField.css', SAPPHIRE_ADMIN_DIR . '/css/unjquery.css'));
     Requirements::css(SAPPHIRE_ADMIN_DIR . '/css/screen.css');
     // Set the members html editor config
     HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS());
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HtmlEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     if (!$htmlEditorConfig->getOption('content_css')) {
         $cssFiles = array();
         $cssFiles[] = 'sapphire/admin/css/editor.css';
         // Use theme from the site config
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (SSViewer::current_theme()) {
             $theme = SSViewer::current_theme();
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles[] = THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles[] = project() . '/css/editor.css';
             }
         }
         // Remove files that don't exist
         foreach ($cssFiles as $k => $cssFile) {
             if (!file_exists(BASE_PATH . '/' . $cssFile)) {
                 unset($cssFiles[$k]);
             }
         }
         $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
     }
     foreach (self::$extra_requirements['javascript'] as $file) {
         Requirements::javascript($file[0]);
     }
     foreach (self::$extra_requirements['css'] as $file) {
         Requirements::css($file[0], $file[1]);
     }
     foreach (self::$extra_requirements['themedcss'] as $file) {
         Requirements::themedCSS($file[0], $file[1]);
     }
     $dummy = null;
     $this->extend('init', $dummy);
     // The user's theme shouldn't affect the CMS, if, for example, they have replaced
     // TableListField.ss or Form.ss.
     SSViewer::set_theme(null);
//.........这里部分代码省略.........
开发者ID:rixrix,项目名称:sapphire,代码行数:101,代码来源:LeftAndMain.php

示例12: getitem

	public function getitem() {
		$this->setCurrentPageID($_REQUEST['ID']);
		SSViewer::setOption('rewriteHashlinks', false);

		if(isset($_REQUEST['ID']) && is_numeric($_REQUEST['ID'])) {
			$record = DataObject::get_by_id($this->stat('tree_class'), $_REQUEST['ID']);
			if($record && !$record->canView()) return Security::permissionFailure($this);
		}

		$form = $this->EditForm();
		if($form) return $form->formHtmlContent();
		else return "";
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:13,代码来源:LeftAndMain.php

示例13: publishPages

 function publishPages($urls)
 {
     // Do we need to map these?
     // Detect a numerically indexed arrays
     if (is_numeric(join('', array_keys($urls)))) {
         $urls = $this->urlsToPaths($urls);
     }
     // This can be quite memory hungry and time-consuming
     // @todo - Make a more memory efficient publisher
     increase_time_limit_to();
     increase_memory_limit_to();
     // Set the appropriate theme for this publication batch.
     // This may have been set explicitly via StaticPublisher::static_publisher_theme,
     // or we can use the last non-null theme.
     if (!StaticPublisher::static_publisher_theme()) {
         SSViewer::set_theme(SSViewer::current_custom_theme());
     } else {
         SSViewer::set_theme(StaticPublisher::static_publisher_theme());
     }
     $currentBaseURL = Director::baseURL();
     if (self::$static_base_url) {
         Director::setBaseURL(self::$static_base_url);
     }
     if ($this->fileExtension == 'php') {
         SSViewer::setOption('rewriteHashlinks', 'php');
     }
     if (StaticPublisher::echo_progress()) {
         echo $this->class . ": Publishing to " . self::$static_base_url . "\n";
     }
     $files = array();
     $i = 0;
     $totalURLs = sizeof($urls);
     foreach ($urls as $url => $path) {
         if (self::$static_base_url) {
             Director::setBaseURL(self::$static_base_url);
         }
         $i++;
         if ($url && !is_string($url)) {
             user_error("Bad url:" . var_export($url, true), E_USER_WARNING);
             continue;
         }
         if (StaticPublisher::echo_progress()) {
             echo " * Publishing page {$i}/{$totalURLs}: {$url}\n";
             flush();
         }
         Requirements::clear();
         if ($url == "") {
             $url = "/";
         }
         if (Director::is_relative_url($url)) {
             $url = Director::absoluteURL($url);
         }
         $response = Director::test(str_replace('+', ' ', $url));
         Requirements::clear();
         singleton('DataObject')->flushCache();
         //skip any responses with a 404 status code. We don't want to turn those into statically cached pages
         if (!$response || $response->getStatusCode() == '404') {
             continue;
         }
         // Generate file content
         // PHP file caching will generate a simple script from a template
         if ($this->fileExtension == 'php') {
             if (is_object($response)) {
                 if ($response->getStatusCode() == '301' || $response->getStatusCode() == '302') {
                     $content = $this->generatePHPCacheRedirection($response->getHeader('Location'));
                 } else {
                     $content = $this->generatePHPCacheFile($response->getBody(), HTTP::get_cache_age(), date('Y-m-d H:i:s'));
                 }
             } else {
                 $content = $this->generatePHPCacheFile($response . '', HTTP::get_cache_age(), date('Y-m-d H:i:s'));
             }
             // HTML file caching generally just creates a simple file
         } else {
             if (is_object($response)) {
                 if ($response->getStatusCode() == '301' || $response->getStatusCode() == '302') {
                     $absoluteURL = Director::absoluteURL($response->getHeader('Location'));
                     $content = "<meta http-equiv=\"refresh\" content=\"2; URL={$absoluteURL}\">";
                 } else {
                     $content = $response->getBody();
                 }
             } else {
                 $content = $response . '';
             }
         }
         $files[] = array('Content' => $content, 'Folder' => dirname($path) . '/', 'Filename' => basename($path));
         // Add externals
         /*
         			$externals = $this->externalReferencesFor($content);
         			if($externals) foreach($externals as $external) {
         				// Skip absolute URLs
         				if(preg_match('/^[a-zA-Z]+:\/\//', $external)) continue;
         				// Drop querystring parameters
         				$external = strtok($external, '?');
         				
         				if(file_exists("../" . $external)) {
         					// Break into folder and filename
         					if(preg_match('/^(.*\/)([^\/]+)$/', $external, $matches)) {
         						$files[$external] = array(
         							"Copy" => "../$external",
         							"Folder" => $matches[1],
//.........这里部分代码省略.........
开发者ID:comperio,项目名称:silverstripe-cms,代码行数:101,代码来源:FilesystemPublisher.php

示例14: init

 /**
  * @uses LeftAndMainExtension->init()
  * @uses LeftAndMainExtension->accessedCMS()
  * @uses CMSMenu
  */
 function init()
 {
     parent::init();
     SSViewer::setOption('rewriteHashlinks', false);
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     if (!empty($member->DateFormat)) {
         i18n::set_date_format($member->DateFormat);
     }
     if (!empty($member->TimeFormat)) {
         i18n::set_time_format($member->TimeFormat);
     }
     // can't be done in cms/_config.php as locale is not set yet
     CMSMenu::add_link('Help', _t('LeftAndMain.HELP', 'Help', 'Menu title'), self::$help_link);
     // Allow customisation of the access check by a extension
     // Also all the canView() check to execute Controller::redirect()
     if (!$this->canView() && !$this->response->isFinished()) {
         // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
         $menu = $this->MainMenu();
         foreach ($menu as $candidate) {
             if ($candidate->Link && $candidate->Link != $this->Link() && $candidate->MenuItem->controller && singleton($candidate->MenuItem->controller)->canView()) {
                 return $this->redirect($candidate->Link);
             }
         }
         if (Member::currentUser()) {
             Session::set("BackURL", null);
         }
         // if no alternate menu items have matched, return a permission error
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "Please choose an authentication method and enter your credentials to access the CMS."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."));
         return Security::permissionFailure($this, $messageSet);
     }
     // Don't continue if there's already been a redirection request.
     if ($this->redirectedTo()) {
         return;
     }
     // Audit logging hook
     if (empty($_REQUEST['executeForm']) && !$this->request->isAjax()) {
         $this->extend('accessedCMS');
     }
     // Set the members html editor config
     HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS());
     // Set default values in the config if missing.  These things can't be defined in the config
     // file because insufficient information exists when that is being processed
     $htmlEditorConfig = HtmlEditorConfig::get_active();
     $htmlEditorConfig->setOption('language', i18n::get_tinymce_lang());
     if (!$htmlEditorConfig->getOption('content_css')) {
         $cssFiles = array();
         $cssFiles[] = FRAMEWORK_ADMIN_DIR . '/css/editor.css';
         // Use theme from the site config
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (SSViewer::current_theme()) {
             $theme = SSViewer::current_theme();
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles[] = THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles[] = project() . '/css/editor.css';
             }
         }
         // Remove files that don't exist
         foreach ($cssFiles as $k => $cssFile) {
             if (!file_exists(BASE_PATH . '/' . $cssFile)) {
                 unset($cssFiles[$k]);
             }
         }
         $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
     }
     // Using uncompressed files as they'll be processed by JSMin in the Requirements class.
     // Not as effective as other compressors or pre-compressed+finetuned files,
     // but overall the unified minification into a single file brings more performance benefits
     // than a couple of saved bytes (after gzip) in individual files.
     // We also re-compress already compressed files through JSMin as this causes weird runtime bugs.
     Requirements::combine_files('lib.js', array(THIRDPARTY_DIR . '/jquery/jquery.js', FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js', FRAMEWORK_ADMIN_DIR . '/javascript/lib.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', THIRDPARTY_DIR . '/jquery-form/jquery.form.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', FRAMEWORK_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js', FRAMEWORK_DIR . '/javascript/TreeDropdownField.js', FRAMEWORK_DIR . '/javascript/DateField.js', FRAMEWORK_DIR . '/javascript/HtmlEditorField.js', FRAMEWORK_DIR . '/javascript/TabSet.js', FRAMEWORK_DIR . '/javascript/i18n.js', FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js', FRAMEWORK_DIR . '/javascript/GridField.js'));
     if (Director::isDev()) {
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/leaktools.js');
     }
     HTMLEditorField::include_js();
     Requirements::combine_files('leftandmain.js', array_unique(array_merge(array(FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.AddForm.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js'), Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true), Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true))));
     // TODO Confuses jQuery.ondemand through document.write()
     if (Director::isDev()) {
         Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
     }
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css');
     Requirements::css(THIRDPARTY_DIR . '/jstree/themes/apple/style.css');
     Requirements::css(FRAMEWORK_DIR . '/css/TreeDropdownField.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css');
//.........这里部分代码省略.........
开发者ID:prostart,项目名称:cobblestonepath,代码行数:101,代码来源:LeftAndMain.php

示例15: getversion

 /**
  * Supports both direct URL links (format: admin/getversion/<page-id>/<version>),
  * and through GET parameters: admin/getversion/?ID=<page-id>&Versions[]=<version>
  */
 function getversion()
 {
     $id = $this->request->param('ID') ? $this->request->param('ID') : $this->request->requestVar('ID');
     $version = $this->request->param('OtherID') ? $this->request->param('OtherID') : $this->request->requestVar('Versions');
     $record = Versioned::get_version("SiteTree", $id, $version);
     if ($record) {
         if ($record && !$record->canView()) {
             return Security::permissionFailure($this);
         }
         $fields = $record->getCMSFields($this);
         $fields->removeByName("Status");
         $fields->push(new HiddenField("ID"));
         $fields->push(new HiddenField("Version"));
         $versionAuthor = DataObject::get_by_id('Member', $record->AuthorID);
         if (!$versionAuthor) {
             $versionAuthor = new ArrayData(array('Title' => 'Unknown author'));
         }
         $fields->insertBefore(new LiteralField('YouAreViewingHeader', '<p class="message notice">' . sprintf(_t('CMSMain.VIEWING', "You are viewing version #%s, created %s by %s", PR_MEDIUM, 'Version number is a linked string, created is a relative time (e.g. 2 days ago), by a specific author'), "<a href=\"admin/getversion/{$record->ID}/{$version}\" title=\"" . ($versionAuthor ? $versionAuthor->Title : '') . "\">{$version}</a>", $record->obj('LastEdited')->Ago(), $versionAuthor ? $versionAuthor->Title : '') . '</p>'), 'Root');
         $actions = new FieldSet(new FormAction("email", _t('CMSMain.EMAIL', "Email")), new FormAction("rollback", _t('CMSMain.ROLLBACK', "Roll back to this version")));
         // encode the message to appear in the body of the email
         $archiveURL = Director::absoluteBaseURL() . $record->URLSegment . '?archiveDate=' . $record->obj('LastEdited')->URLDatetime();
         // Ensure that source file comments are disabled
         SSViewer::set_source_file_comments(false);
         $archiveEmailMessage = urlencode($this->customise(array('ArchiveDate' => $record->obj('LastEdited'), 'ArchiveURL' => $archiveURL))->renderWith('ViewArchivedEmail'));
         $archiveEmailMessage = preg_replace('/\\+/', '%20', $archiveEmailMessage);
         $fields->push(new HiddenField('ArchiveEmailMessage', '', $archiveEmailMessage));
         $fields->push(new HiddenField('ArchiveEmailSubject', '', preg_replace('/\\+/', '%20', urlencode('Archived version of ' . $record->Title))));
         $fields->push(new HiddenField('ArchiveURL', '', $archiveURL));
         $form = new Form($this, "EditForm", $fields, $actions);
         $form->loadDataFrom($record);
         $form->loadDataFrom(array("ID" => $id, "Version" => $version));
         // historical version shouldn't be editable
         $readonlyFields = $form->Fields()->makeReadonly();
         $form->setFields($readonlyFields);
         SSViewer::setOption('rewriteHashlinks', false);
         if ($this->isAjax()) {
             $content = $form->formHtmlContent();
             if ($this->ShowSwitchView()) {
                 $content .= '<div id="AjaxSwitchView">' . $this->SwitchView($record) . '</div>';
             }
             return $content;
         } else {
             $templateData = $this->customise(array("EditForm" => $form));
             return $templateData->renderWith('LeftAndMain');
         }
     }
 }
开发者ID:hamishcampbell,项目名称:silverstripe-cms,代码行数:51,代码来源:CMSMain.php


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