/** * Get version * * @return string */ public static function getFrameworkVersion() { $lm = new LeftAndMain(); $version = $lm->CMSVersion(); if ($version) { $parts = explode(', ', $version); foreach ($parts as $part) { $p = explode(': ', $part); if ($p[0] == 'Framework') { return $p[1]; } } } // As fallback, we can use deprecation but this can be changed by the user return Deprecation::dump_settings()['version']; }
public function init() { parent::init(); // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment if (!Director::is_ajax()) { Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => (SSViewer::current_theme() ? "themes/" . SSViewer::current_theme() : project()) . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang())); } Requirements::javascript('cms/javascript/CMSMain.js'); Requirements::javascript('cms/javascript/CMSMain_left.js'); Requirements::javascript('cms/javascript/CMSMain_right.js'); Requirements::javascript('sapphire/javascript/UpdateURL.js'); /** * HACK ALERT: Project-specific requirements * * We need a better way of including all of the CSS that *might* be used by this application. * Perhaps the ajax responses can include some instructions to go get more CSS / JavaScript? */ Requirements::css("survey/css/SurveyFilter.css"); Requirements::javascript("survey/javascript/SurveyResponses.js"); Requirements::javascript("survey/javascript/FormResponses.js"); Requirements::javascript("parents/javascript/NotifyMembers.js"); Requirements::css("tourism/css/SurveyCMSMain.css"); Requirements::javascript("tourism/javascript/QuotasReport.js"); Requirements::javascript("sapphire/javascript/ReportField.js"); Requirements::javascript("ptraining/javascript/BookingList.js"); Requirements::javascript("forum/javascript/ForumAccess.js"); Requirements::javascript('gallery/javascript/GalleryPage_CMS.js'); }
public function init() { parent::init(); //CSS/JS Dependencies - currently not much there Requirements::css("calendar/css/admin/CalendarAdmin.css"); Requirements::javascript("calendar/javascript/admin/CalendarAdmin.js"); }
function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) { if (!$childrenMethod) { $childrenMethod = 'ChildFolders'; } return parent::getSiteTreeFor($className, $rootID, $childrenMethod, $numChildrenMethod, $filterFunction, $minNodeCount); }
/** * @return Form */ public function getEditForm($id = null, $fields = null) { if (!$id) { $id = $this->currentPageID(); } $form = parent::getEditForm($id); $record = $this->getRecord($id); if ($record && !$record->canView()) { return Security::permissionFailure($this); } $newComments = Comment::get()->filter('Moderated', 0); $newGrid = new CommentsGridField('NewComments', _t('CommentsAdmin.NewComments', 'New'), $newComments, CommentsGridFieldConfig::create()); $approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0); $approvedGrid = new CommentsGridField('ApprovedComments', _t('CommentsAdmin.ApprovedComments', 'Approved'), $approvedComments, CommentsGridFieldConfig::create()); $spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1); $spamGrid = new CommentsGridField('SpamComments', _t('CommentsAdmin.SpamComments', 'Spam'), $spamComments, CommentsGridFieldConfig::create()); $newCount = '(' . count($newComments) . ')'; $approvedCount = '(' . count($approvedComments) . ')'; $spamCount = '(' . count($spamComments) . ')'; $fields = new FieldList($root = new TabSet('Root', new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount, $newGrid), new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount, $approvedGrid), new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount, $spamGrid))); $root->setTemplate('CMSTabSet'); $actions = new FieldList(); $form = new Form($this, 'EditForm', $fields, $actions); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); if ($form->Fields()->hasTabset()) { $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); } $this->extend('updateEditForm', $form); return $form; }
/** * Apply custom styles to the absolute description element. * * @parameter <{DESCRIPTION_CSS}> array(string) */ public static function customise_css($styles) { if (is_array($styles)) { // Determine the path to write against. $URL = DESCRIPTIVE_PATH . '/css/custom.css'; $path = Director::baseFolder() . "/{$URL}"; // Collate each custom style where appropriate. $CSS = '#cms-menu-descriptive {' . PHP_EOL; foreach ($styles as $style => $value) { if (!is_numeric($style)) { $CSS .= "\t{$style}: {$value} !important;" . PHP_EOL; // Apply any possible background change. if (strtolower($style) === 'background') { $background = '#cms-menu-descriptive:before,' . PHP_EOL . '#cms-menu-descriptive:after {' . PHP_EOL; $background .= "\tborder-top: 10px solid {$value} !important;" . PHP_EOL . '}' . PHP_EOL . PHP_EOL; $background .= '#cms-menu-descriptive:before {' . PHP_EOL; $background .= "\tborder-top: 13px solid !important;" . PHP_EOL; $background .= "\tborder-top-color: inherit !important;" . PHP_EOL . '}' . PHP_EOL; } } } $CSS .= '}' . PHP_EOL . PHP_EOL . $background; // Write the custom styles. file_put_contents($path, $CSS); chmod($path, 0664); LeftAndMain::require_css($URL); } }
/** * Provides hook for decorators, so that they can overwrite css * and other definitions. * * @param bool $skipUpdateInit Set to true to skip the parents updateInit extension * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 20.02.2013 */ public function init($skipUpdateInit = false) { parent::init(); if (!$skipUpdateInit) { $this->extend('updateInit'); } }
function init() { parent::init(); // somehow themed css gets mixed in, remove it $reqbe = Requirements::backend(); foreach ($reqbe->get_css() as $file => $val) { if (preg_match('/^themes\\//', $file)) { Requirements::block($file); } } Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.widget.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.mouse.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.tabs.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.button.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.position.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.dialog.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.draggable.js'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.core.css'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.dialog.css'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.theme.css'); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.tabs.css'); Requirements::clear('jsparty/prototype.js'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js"); Requirements::add_i18n_javascript('dbplumber/javascript/lang'); Requirements::javascript("dbplumber/javascript/DatabaseBrowser.js"); Requirements::javascript("dbplumber/thirdparty/jquery.event.drag-1.4.js"); Requirements::javascript("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.js"); Requirements::javascript("dbplumber/thirdparty/jquery.textarea-expander.js"); Requirements::css("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.css"); Requirements::css("dbplumber/css/DatabaseBrowser_left.css"); Requirements::css("dbplumber/css/DatabaseBrowser_right.css"); }
public function init() { parent::init(); if (!$this->request->isAjax()) { Requirements::css('timeline/css/notification-wall.css'); } }
/** * Loads the requirements, checks perms, etc. If an ID is in the URL, that becomes the * current folder. */ public function init() { parent::init(); if (!Permission::check("ADMIN") && !Permission::check("CMS_ACCESS_BrowseFiles")) { return Security::permissionFailure($this, _t('KickAssets.PERMISSIONFAIL', 'You do not have permission to access this section of the CMS.')); } Requirements::clear(); Requirements::css('kickassets/css/core.css'); Requirements::css('kickassets/css/kickassets.css'); Requirements::javascript('kickassets/javascript/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); Requirements::javascript('kickassets/javascript/apprise/apprise-1.5.full.js'); Requirements::javascript('kickassets/javascript/jquery.tooltip.js'); Requirements::css('kickassets/javascript/apprise/apprise.css'); Requirements::javascript('kickassets/javascript/kickassets_ui.js'); Requirements::javascript('kickassets/javascript/chosen/chosen.jquery.js'); Requirements::css('kickassets/javascript/chosen/chosen.css'); Requirements::javascript('kickassets/javascript/jquery.form.js'); Requirements::javascript('kickassets/javascript/kickassets.js'); Requirements::css('kickassets/css/kickassets_ui.css'); if ($this->getRequest()->param('ID')) { $this->currentFolder = DataObject::get_by_id("Folder", (int) $this->getRequest()->param('ID')); $this->currentPath = KickAssetUtil::relative_asset_dir($this->currentFolder->Filename); } else { $this->currentFolder = singleton('Folder'); $this->currentPath = false; } }
public function init() { // In LeftAndMain::init() the current theme is unset. // we need to restore the current theme here for make the dropdown of template list. $theme = SSViewer::current_theme(); parent::init(); if (isset($theme) && $theme) { SSViewer::set_theme($theme); } Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/tiny_mce_improvements.js'); //TODO what is going on here? where did that hover.js go? can't find it. //TODO We need to reimplement a hover.js? Requirements::javascript(CMS_DIR . '/javascript/hover.js'); Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/controls.js'); Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_left.js'); Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_right.js'); Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js'); Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin.js'); Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_left.js'); Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_right.js'); Requirements::javascript(NEWSLETTER_DIR . '/javascript/ProgressBar.js'); // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment if (!Director::is_ajax()) { Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js'); HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css'); HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang()); } // Always block the HtmlEditorField.js otherwise it will be sent with an ajax request Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js'); Requirements::css(NEWSLETTER_DIR . '/css/NewsletterAdmin.css'); }
/** * @return Form */ public function getEditForm($id = null, $fields = null) { if (!$id) { $id = $this->currentPageID(); } $form = parent::getEditForm($id); $record = $this->getRecord($id); if ($record && !$record->canView()) { return Security::permissionFailure($this); } $commentsConfig = GridFieldConfig::create()->addComponents(new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldSortableHeader(), new GridFieldPaginator(25), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldExportButton(), new GridFieldEditButton(), new GridFieldDetailForm()); $needs = new GridField('Comments', _t('CommentsAdmin.NeedsModeration', 'Needs Moderation'), Comment::get()->where('Moderated = 0'), $commentsConfig); $moderated = new GridField('CommentsModerated', _t('CommentsAdmin.CommentsModerated'), Comment::get()->where('Moderated = 1'), $commentsConfig); $fields = new FieldList($root = new TabSet('Root', new Tab('NeedsModeration', _t('CommentAdmin.NeedsModeration', 'Needs Moderation'), $needs), new Tab('Comments', _t('CommentAdmin.Moderated', 'Moderated'), $moderated))); $root->setTemplate('CMSTabSet'); $actions = new FieldList(); $form = new Form($this, 'EditForm', $fields, $actions); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); if ($form->Fields()->hasTabset()) { $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); } $this->extend('updateEditForm', $form); return $form; }
public function init() { parent::init(); Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); Requirements::javascript("jsparty/tiny_mce_improvements.js"); Requirements::javascript("jsparty/hover.js"); Requirements::javascript("jsparty/scriptaculous/controls.js"); Requirements::javascript("cms/javascript/SecurityAdmin.js"); Requirements::javascript("cms/javascript/LeftAndMain_left.js"); Requirements::javascript("cms/javascript/LeftAndMain_right.js"); Requirements::javascript("cms/javascript/CMSMain_left.js"); Requirements::javascript("cms/javascript/ReportAdmin_left.js"); Requirements::javascript("cms/javascript/ReportAdmin_right.js"); Requirements::css("cms/css/ReportAdmin.css"); // TODO Find a better solution to integrate optional Requirements in a specific order if (Director::fileExists("ecommerce/css/DataReportCMSMain.css")) { Requirements::css("ecommerce/css/DataReportCMSMain.css"); } if (Director::fileExists("ecommerce/css/DataReportCMSMain.css")) { Requirements::javascript("ecommerce/javascript/DataReport.js"); } if (Director::fileExists(project() . "/css/DataReportCMSMain.css")) { Requirements::css(project() . "/css/DataReportCMSMain.css"); } if (Director::fileExists(project() . "/css/DataReportCMSMain.css")) { Requirements::javascript(project() . "/javascript/DataReport.js"); } // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment if (!Director::is_ajax()) { Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => project() . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang())); } }
public function init() { // Check permissions // if(!Member::currentUser() || !Member::currentUser()->isAdmin()) Security::permissionFailure($this); parent::init(); /* if(!$this->can('AdminCMS')) { $messageSet = array( 'default' => "Please choose an authentication method and enter your credentials to access the CMS.", 'alreadyLoggedIn' => "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' => "You have been logged out of the CMS. If you would like to log in again, enter a username and password below.", ); Security::permissionFailure($this, $messageSet); return; }*/ Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); Requirements::javascript("jsparty/tiny_mce_improvements.js"); Requirements::javascript("jsparty/hover.js"); Requirements::javascript("jsparty/scriptaculous/controls.js"); Requirements::javascript("cms/javascript/SecurityAdmin.js"); Requirements::javascript("cms/javascript/LeftAndMain_left.js"); Requirements::javascript("cms/javascript/LeftAndMain_right.js"); Requirements::javascript("cms/javascript/CMSMain_left.js"); Requirements::javascript("cms/javascript/NewsletterAdmin_left.js"); Requirements::javascript("cms/javascript/NewsletterAdmin_right.js"); Requirements::javascript("sapphire/javascript/ProgressBar.js"); // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment if (!Director::is_ajax()) { Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => project() . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang())); } // needed for MemberTableField (Requirements not determined before Ajax-Call) Requirements::javascript("cms/javascript/MemberTableField.js"); Requirements::css("cms/css/NewsletterAdmin.css"); }
/** * @param bool $unlinked * @return ArrayList */ public function Breadcrumbs($unlinked = false) { $items = parent::Breadcrumbs($unlinked); $items[0]->Link = singleton('CloudinaryAdmin')->Link('show'); $items->push(new ArrayData(array('Title' => _t('CloudinaryAdmin.Upload', 'Upload'), 'Link' => $this->Link()))); return $items; }
public function init() { parent::init(); Requirements::css(SS_NR_BASE . '/css/NewRelicPerformanceReport.css'); Requirements::add_i18n_javascript(SS_NR_BASE . '/javascript/lang'); Requirements::javascript(SS_NR_BASE . '/javascript/NewRelicPerformanceReport.js'); Requirements::javascript(SS_NR_BASE . '/thirdparty/nnnick/chart-js/chart.min.js'); }
public function init() { parent::init(); Requirements::javascript('queuedjobs/javascript/QueuedJobsAdmin.js'); $qs = singleton('QueuedJobService'); /* @var $qs QueuedJobService */ $this->queuedJobsService = $qs; }
public function getResponseNegotiator() { $neg = parent::getResponseNegotiator(); $controller = $this; $neg->setCallback('CurrentForm', function () use(&$controller) { return $controller->renderWith($controller->getTemplatesWithSuffix('_Content')); }); return $neg; }
public function getEditForm($id = null, $fields = null) { $form = parent::getEditForm(); $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses()); $fields = $form->Fields(); $this->createFields($fields); $fields->setForm($form); return $form; }
public function getResponseNegotiator() { $negotiator = parent::getResponseNegotiator(); $self = $this; // Register a new callback $negotiator->setCallback('SubsiteList', function () use(&$self) { return $self->SubsiteList(); }); return $negotiator; }
function testShouldChangeSubsite() { $l = new LeftAndMain(); Config::inst()->nest(); Config::inst()->update('CMSPageEditController', 'treats_subsite_0_as_global', false); $this->assertTrue($l->shouldChangeSubsite('CMSPageEditController', 0, 5)); $this->assertFalse($l->shouldChangeSubsite('CMSPageEditController', 0, 0)); $this->assertTrue($l->shouldChangeSubsite('CMSPageEditController', 1, 5)); $this->assertFalse($l->shouldChangeSubsite('CMSPageEditController', 1, 1)); Config::inst()->update('CMSPageEditController', 'treats_subsite_0_as_global', true); $this->assertFalse($l->shouldChangeSubsite('CMSPageEditController', 0, 5)); $this->assertFalse($l->shouldChangeSubsite('CMSPageEditController', 0, 0)); $this->assertTrue($l->shouldChangeSubsite('CMSPageEditController', 1, 5)); $this->assertFalse($l->shouldChangeSubsite('CMSPageEditController', 1, 1)); Config::inst()->unnest(); }
function testAlternateAccessCheck() { $admin = $this->objFromFixture("Member", "admin"); $this->loginAs($admin); $ids = array(); $subsite1 = $this->objFromFixture('Subsite', 'domaintest1'); $subsite2 = $this->objFromFixture('Subsite', 'domaintest2'); $subsite3 = $this->objFromFixture('Subsite', 'domaintest3'); $ids[] = $subsite1->ID; $ids[] = $subsite2->ID; $ids[] = $subsite3->ID; $ids[] = 0; foreach ($ids as $id) { Subsite::changeSubsite($id); //switch to main site (subsite ID zero) $left = new LeftAndMain(); $this->assertTrue($left->canView(), "Admin user can view subsites LeftAndMain with id = '{$id}'"); $this->assertEquals($id, Subsite::currentSubsiteID(), "The current subsite has not been changed in the process of checking permissions for admin user."); } }
/** * Get the shortcodable class by whatever means possible. * Determine if this is a new shortcode, or editing an existing one. */ function init() { parent::init(); if ($data = $this->getShortcodeData()) { $this->isnew = false; $this->shortcodableclass = $data['name']; } elseif ($type = $this->request->requestVar('ShortcodeType')) { $this->shortcodableclass = $type; } else { $this->shortcodableclass = $this->request->param('ShortcodeType'); } }
/** * Test that CMS versions can be interpreted appropriately */ public function testCMSVersion() { $l = new LeftAndMain(); $this->assertEquals("2.4", $l->versionFromVersionFile('$URL: http://svn.silverstripe.com/open/modules/cms/branches/2.4/silverstripe_version $')); $this->assertEquals("2.2.0", $l->versionFromVersionFile('$URL: http://svn.silverstripe.com/open/modules/cms/tags/2.2.0/silverstripe_version $')); $this->assertEquals("trunk", $l->versionFromVersionFile('$URL: http://svn.silverstripe.com/open/modules/cms/trunk/silverstripe_version $')); $this->assertEquals("2.4.0-alpha1", $l->versionFromVersionFile('$URL: http://svn.silverstripe.com/open/modules/cms/tags/alpha/2.4.0-alpha1/silverstripe_version $')); $this->assertEquals("2.4.0-beta1", $l->versionFromVersionFile('$URL: http://svn.silverstripe.com/open/modules/cms/tags/beta/2.4.0-beta1/silverstripe_version $')); $this->assertEquals("2.4.0-rc1", $l->versionFromVersionFile('$URL: http://svn.silverstripe.com/open/modules/cms/tags/rc/2.4.0-rc1/silverstripe_version $')); }
public function init() { //setting the uploads directory to make sure images uploaded through the content //editor are saved the right place $curr = LeftAndMain::curr(); if ($curr) { //Debug::dump(get_class($curr)); //Debug::dump(ClassInfo::ancestry($curr)); $currClass = null; foreach (ClassInfo::ancestry($curr) as $class) { foreach (self::$supported_classes as $supported_class) { if ($class == $supported_class) { $currClass = $class; } } } //Debug::dump($currClass); //switch (get_class($curr)) { switch ($currClass) { //Page administration case 'CMSPagesController': case 'CMSPageEditController': $page = $curr->currentPage(); if ($page && $page->hasExtension('AssetsFolderExtension')) { Upload::config()->uploads_folder = $page->getAssetsFolderDirName(); } //Debug::dump($page->Title); break; case 'ModelAdmin': //For ModelAdmin we're falling back to cookies that we believe to have //been set when setting the cms fields, see AssetFolderExtension::updateCMSFields() //...as it seems to be almost impossible to figure out the current object elsewise //see below for tries //pull requests to fix this welcome!!! //Debug::dump($this->owner->getURLParams()); //Debug::dump($this->owner->request->param('ModelClass')); //Debug::dump($this->owner->request->remaining()); //Debug::dump($this->owner->request->getVars()); //Debug::dump($this->owner->request->params()); //Debug::dump($curr->currentPageID()); Upload::config()->uploads_folder = Cookie::get('cms-uploaddirrules-uploads-folder'); break; //Settings //Settings case 'CMSSettingsController': if (Object::has_extension('SiteConfig', 'AssetsFolderExtension')) { $sc = SiteConfig::current_site_config(); Upload::config()->uploads_folder = $sc->getAssetsFolderDirName(); } default: } } }
public function init() { parent::init(); Requirements::css('silverstripe-upgrade-notification/css/custom.css'); Requirements::javascript('silverstripe-upgrade-notification/javascript/custom.js'); $slug_parts = explode('/', $_SERVER['REQUEST_URI']); if (count($slug_parts) > 3) { if ($slug_parts[1] == 'admin' && $slug_parts[2] == 'upgrade' && $slug_parts[3] == 'refresh') { $this->refresh = true; } } }
public function getEditForm($id = null, $field = null) { $form = parent::getEditForm($id, $field); $form->addExtraClass("center"); // Setup Fields $form->setFields($this->facebook->getCMSFields()); // Setup Actions $form->setActions($this->getCMSActions()); // Populate Form $form->loadDataFrom($this->facebook); return $form; }
/** * @return ArrayList */ public function Breadcrumbs($unlinked = false) { $items = parent::Breadcrumbs($unlinked); // The root element should explicitly point to the root node. $items[0]->Link = Controller::join_links(singleton('AssetAdmin')->Link('show'), 0); // Enforce linkage of hierarchy to AssetAdmin foreach ($items as $item) { $baselink = $this->Link('show'); if (strpos($item->Link, $baselink) !== false) { $item->Link = str_replace($baselink, singleton('AssetAdmin')->Link('show'), $item->Link); } } $items->push(new ArrayData(array('Title' => _t('AssetAdmin.Upload', 'Upload'), 'Link' => $this->Link()))); return $items; }
/** * Does the parent permission checks, but also * makes sure that instantiatable subclasses of * {@link Report} exist. By default, the CMS doesn't * include any Reports, so there's no point in showing * * @param Member $member * @return boolean */ function canView($member = null) { if (!$member && $member !== FALSE) { $member = Member::currentUser(); } if (!parent::canView($member)) { return false; } $hasViewableSubclasses = false; foreach ($this->Reports() as $report) { if ($report->canView($member)) { return true; } } return false; }
public function init() { parent::init(); Requirements::javascript(THIRDPARTY_DIR . "/hover.js"); Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js"); // needed for MemberTableField (Requirements not determined before Ajax-Call) Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/TableListField.js"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/TableField.js"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/ComplexTableField.js"); Requirements::javascript(CMS_DIR . "/javascript/MemberTableField.js"); Requirements::css(THIRDPARTY_DIR . "/greybox/greybox.css"); Requirements::css(SAPPHIRE_DIR . "/css/ComplexTableField.css"); Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin_left.js'); Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin_right.js'); Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js"); Requirements::javascript(THIRDPARTY_DIR . "/greybox/greybox.js"); }