public function init()
 {
     parent::init();
     CMSBatchActionHandler::register('batchCmsWorkflowPublish', 'BatchPublishPages');
     CMSBatchActionHandler::register('batchCmsWorkflowApprove', 'BatchApprovePages');
     CMSBatchActionHandler::register('forcepublish', 'BatchForcePublishPages');
 }
コード例 #2
0
 public function init()
 {
     parent::init();
     Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin.js');
     Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin.Tree.js');
     CMSBatchActionHandler::register('delete', 'SecurityAdmin_DeleteBatchAction', 'Group');
 }
コード例 #3
0
ファイル: CMSMain.php プロジェクト: redema/silverstripe-cms
	public function init() {
		// set reading lang
		if(Object::has_extension('SiteTree', 'Translatable') && !$this->request->isAjax()) {
			Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
		}
		
		parent::init();
		
		Requirements::css(CMS_DIR . '/css/screen.css');
		
		Requirements::combine_files(
			'cmsmain.js',
			array_merge(
				array(
					CMS_DIR . '/javascript/CMSMain.js',
					CMS_DIR . '/javascript/CMSMain.EditForm.js',
					CMS_DIR . '/javascript/CMSMain.AddForm.js',
					CMS_DIR . '/javascript/CMSPageHistoryController.js',
					CMS_DIR . '/javascript/CMSMain.Tree.js',
					CMS_DIR . '/javascript/SilverStripeNavigator.js'
				),
				Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', true, true)
			)
		);

		CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish');
		CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish');
		CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete');
		CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
	}
コード例 #4
0
 public function init()
 {
     parent::init();
     // Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
     // or implied on a translated record (see {@link Translatable->updateCMSFields()}).
     // $Lang serves as a "context" which can be inspected by Translatable - hence it
     // has the same name as the database property on Translatable.
     if ($this->getRequest()->requestVar("Locale")) {
         $this->Locale = $this->getRequest()->requestVar("Locale");
     } elseif ($this->getRequest()->requestVar("locale")) {
         $this->Locale = $this->getRequest()->requestVar("locale");
     } else {
         $this->Locale = Translatable::default_locale();
     }
     Translatable::set_current_locale($this->Locale);
     // collect languages for TinyMCE spellchecker plugin.
     // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
     $langName = i18n::get_locale_name($this->Locale);
     HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$this->Locale}");
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.Tree.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.EditForm.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.Translatable.js');
     Requirements::css(CMS_DIR . '/css/CMSMain.css');
     CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish');
     CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish');
     CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete');
     CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
 }
コード例 #5
0
 /**
  * @todo Test the results of a publication better
  */
 public function testPublish()
 {
     $page1 = $this->objFromFixture('Page', "page1");
     $page2 = $this->objFromFixture('Page', "page2");
     $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
     $response = $this->get('admin/pages/publishall?confirm=1');
     $this->assertContains('Done: Published 30 pages', $response->getBody());
     $actions = CMSBatchActionHandler::config()->batch_actions;
     // Some modules (e.g., cmsworkflow) will remove this action
     $actions = CMSBatchActionHandler::config()->batch_actions;
     if (isset($actions['publish'])) {
         $response = $this->get('admin/pages/batchactions/publish?ajax=1&csvIDs=' . implode(',', array($page1->ID, $page2->ID)));
         $responseData = Convert::json2array($response->getBody());
         $this->assertArrayHasKey($page1->ID, $responseData['modified']);
         $this->assertArrayHasKey($page2->ID, $responseData['modified']);
     }
     // Get the latest version of the redirector page
     $pageID = $this->idFromFixture('RedirectorPage', 'page5');
     $latestID = DB::query('select max("Version") from "RedirectorPage_versions" where "RecordID"=' . $pageID)->value();
     $dsCount = DB::query('select count("Version") from "RedirectorPage_versions" where "RecordID"=' . $pageID . ' and "Version"=' . $latestID)->value();
     $this->assertEquals(1, $dsCount, "Published page has no duplicate version records: it has " . $dsCount . " for version " . $latestID);
     $this->session()->clear('loggedInAs');
     //$this->assertRegexp('/Done: Published 4 pages/', $response->getBody())
     /*
     $response = Director::test("admin/pages/publishitems", array(
     	'ID' => ''
     	'Title' => ''
     	'action_publish' => 'Save and publish',
     ), $session);
     $this->assertRegexp('/Done: Published 4 pages/', $response->getBody())
     */
 }
コード例 #6
0
 /**
  * Set up the controller
  */
 public function init()
 {
     parent::init();
     Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
     Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true);
     Requirements::css(CMS_DIR . "/css/screen.css");
     CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
 }
コード例 #7
0
    /**
     * Set up the controller
     */
    public function init()
    {
        parent::init();
        Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
        Requirements::javascript(CMS_DIR . '/javascript/CMSMain.GridField.js');
        Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true);
        Requirements::css(CMS_DIR . "/css/screen.css");
        $frameworkDir = FRAMEWORK_DIR;
        Requirements::customScript(<<<JS
\t\t\t_TREE_ICONS = {};
\t\t\t_TREE_ICONS['Folder'] = {
\t\t\t\t\tfileIcon: '{$frameworkDir}/javascript/tree/images/page-closedfolder.gif',
\t\t\t\t\topenFolderIcon: '{$frameworkDir}/javascript/tree/images/page-openfolder.gif',
\t\t\t\t\tclosedFolderIcon: '{$frameworkDir}/javascript/tree/images/page-closedfolder.gif'
\t\t\t};
JS
);
        CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
    }
コード例 #8
0
    /**
     * Set up the controller, in particular, re-sync the File database with the assets folder./
     */
    function init()
    {
        parent::init();
        // Create base folder if it doesnt exist already
        if (!file_exists(ASSETS_PATH)) {
            Filesystem::makeFolder(ASSETS_PATH);
        }
        Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
        Requirements::css(CMS_DIR . "/css/AssetAdmin.css");
        Requirements::customScript(<<<JS
\t\t\t_TREE_ICONS = {};
\t\t\t_TREE_ICONS['Folder'] = {
\t\t\t\t\tfileIcon: 'sapphire/javascript/tree/images/page-closedfolder.gif',
\t\t\t\t\topenFolderIcon: 'sapphire/javascript/tree/images/page-openfolder.gif',
\t\t\t\t\tclosedFolderIcon: 'sapphire/javascript/tree/images/page-closedfolder.gif'
\t\t\t};
JS
);
        CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
    }
コード例 #9
0
	/**
	 * Set up the controller, in particular, re-sync the File database with the assets folder./
	 */
	public function init() {
		parent::init();
		
		// Create base folder if it doesnt exist already
		if(!file_exists(ASSETS_PATH)) Filesystem::makeFolder(ASSETS_PATH);

		Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
		Requirements::javascript(CMS_DIR . '/javascript/CMSMain.GridField.js');
		Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true);
		Requirements::css(CMS_DIR . "/css/screen.css");
		$frameworkDir = FRAMEWORK_DIR;
		Requirements::customScript(<<<JS
			_TREE_ICONS = {};
			_TREE_ICONS['Folder'] = {
					fileIcon: '$frameworkDir/javascript/tree/images/page-closedfolder.gif',
					openFolderIcon: '$frameworkDir/javascript/tree/images/page-openfolder.gif',
					closedFolderIcon: '$frameworkDir/javascript/tree/images/page-closedfolder.gif'
			};
JS
		);
		
		CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
	}
コード例 #10
0
 static function tear_down_once()
 {
     CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions'];
     parent::tear_down_once();
 }
コード例 #11
0
ファイル: CMSMain.php プロジェクト: hemant-chakka/awss
 public function BatchActionParameters()
 {
     $batchActions = CMSBatchActionHandler::config()->batch_actions;
     $forms = array();
     foreach ($batchActions as $urlSegment => $batchAction) {
         $SNG_action = singleton($batchAction);
         if ($SNG_action->canView() && ($fieldset = $SNG_action->getParameterFields())) {
             $formHtml = '';
             foreach ($fieldset as $field) {
                 $formHtml .= $field->Field();
             }
             $forms[$urlSegment] = $formHtml;
         }
     }
     $pageHtml = '';
     foreach ($forms as $urlSegment => $html) {
         $pageHtml .= "<div class=\"params\" id=\"BatchActionParameters_{$urlSegment}\">{$html}</div>\n\n";
     }
     return new LiteralField("BatchActionParameters", '<div id="BatchActionParameters" style="display:none">' . $pageHtml . '</div>');
 }
コード例 #12
0
<?php

/*
LeftAndMain::require_css(basename(__DIR__) . '/css/markstrap.css');
LeftAndMain::require_javascript(basename(__DIR__) . '/javascript/markstrap.js');
*/
// Set the site locale
i18n::set_locale('en_AU');
// CMS Batch Actions
CMSBatchActionHandler::register('hidefrommenus', 'CMSBatchAction_HideFromMenus');
CMSBatchActionHandler::register('hidefromsearch', 'CMSBatchAction_HideFromSearch');
// Visualblocks plugin
HtmlEditorConfig::get('cms')->enablePlugins(array('visualblocks' => '../../../framework/thirdparty/tinymce/plugins/visualblocks/editor_plugin.js'));
HtmlEditorConfig::get('cms')->addButtonsToLine(1, 'visualblocks');
// Remove formatting button
HtmlEditorConfig::get('cms')->addButtonsToLine(1, 'removeformat');
// Codemagic plugin for TinyMCE
HtmlEditorConfig::get('cms')->enablePlugins(array('codemagic' => sprintf('../../../markstrap/thirdparty/codemagic/editor_plugin_src.js')));
HtmlEditorConfig::get('cms')->insertButtonsBefore('fullscreen', 'codemagic');
HtmlEditorConfig::get('cms')->removeButtons('code');
コード例 #13
0
<?php

// Default batch action: move to
CMSBatchActionHandler::register('moveto', 'CMSBatchAction_MoveTo');
CMSMenu::remove_menu_item('CMSBatchAction_MoveToController');
// Extras, to be moved to project config as required
// CMSBatchActionHandler::register('hidefrommenus', 'CMSBatchAction_HideFromMenus');
// CMSBatchActionHandler::register('hidefromsearch', 'CMSBatchAction_HideFromSearch');
LeftAndMain::require_javascript(basename(__DIR__) . '/javascript/LeftAndMain.BatchActionsPlus.js');
LeftAndMain::require_css(basename(__DIR__) . '/css/batchactionsplus.css');
コード例 #14
0
 function init()
 {
     // We need to make sure these CMSMain scripts are included first
     Requirements::javascript('cms/javascript/CMSMain.js');
     Requirements::javascript('cms/javascript/CMSMain_left.js');
     Requirements::javascript('cms/javascript/CMSMain_right.js');
     CMSBatchActionHandler::register('batchCmsWorkflowSetEmbargo', 'BatchSetEmbargo');
     CMSBatchActionHandler::register('batchCmsWorkflowSetExpiry', 'BatchSetExpiry');
     CMSBatchActionHandler::register('batchCmsWorkflowResetEmbargo', 'BatchResetEmbargo');
     CMSBatchActionHandler::register('batchCmsWorkflowResetExpiry', 'BatchResetExpiry');
     Requirements::javascript('cmsworkflow/javascript/LeftAndMainCMSWorkflow.js');
     Requirements::customScript("CMSWorkflow.setOption('noPromptForAdmin', " . Convert::raw2json(!self::$prompt_admin_for_comments) . ')');
     RSSFeed::linkToFeed(Director::absoluteURL('admin/cms/changes.rss'), 'All content changes');
 }