function Field() { if ($this->includeDefaultJS) { Requirements::javascriptTemplate('sapphire/javascript/InlineFormAction.js', array('ID' => $this->id())); } return "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\" class=\"action{$this->extraClass}\" />"; }
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() { 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 Field($properties = array()) { if ($this->includeDefaultJS) { Requirements::javascriptTemplate(FRAMEWORK_DIR . '/javascript/InlineFormAction.js', array('ID' => $this->id())); } return "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\"" . " class=\"action{$this->extraClass}\" />"; }
/** * @param array $properties * @return string */ public function Field($properties = array()) { if ($this->includeDefaultJS) { Requirements::javascriptTemplate(FRAMEWORK_DIR . '/client/dist/js/InlineFormAction.js', array('ID' => $this->ID())); } return FormField::create_tag('input', array('type' => 'submit', 'name' => sprintf('action_%s', $this->getName()), 'value' => $this->title, 'id' => $this->ID(), 'class' => sprintf('action%s', $this->extraClass))); }
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"); }
function Field() { Requirements::javascript("mysite/javascript/jquery-ui-1.8.6.custom.min.js"); Requirements::javascript("http://maps.google.com/maps/api/js?sensor=true"); Requirements::javascriptTemplate("googlemapselectionfield/javascript/GoogleMapSelectionFieldv2.js", array('Name' => $this->name, 'DefaultLat' => $this->startLat, 'DefaultLon' => $this->startLong, 'MapWidth' => $this->mapWidth, 'MapHeight' => $this->mapHeight, 'Zoom' => $this->zoom)); return " \n\t\t\t<div class=\"googleMapField\"> \n <div id=\"map_{$this->name}\" style=\"margin-top: 20px; width: {$this->mapWidth}; height: {$this->mapHeight};\"></div>\n\t\t\t</div>"; }
/** * Parses the snippet short code * @example [snippet id=123] * @example [snippet id=123 version=456] */ public static function parse($arguments, $content = null, $parser = null) { //Ensure ID is pressent in the arguments if (!array_key_exists('id', $arguments)) { return '<p><b><i>' . _t('CodeBankShortCode.MISSING_ID_ATTRIBUTE', '_Short Code missing the id attribute') . '</i></b></p>'; } //Fetch Snippet $snippet = Snippet::get()->byID(intval($arguments['id'])); if (empty($snippet) || $snippet === false || $snippet->ID == 0) { return '<p><b><i>' . _t('CodeBankShortCode.SNIPPET_NOT_FOUND', '_Snippet not found') . '</i></b></p>'; } //Fetch Text $snippetText = $snippet->SnippetText; //If the version exists fetch it, and replace the text with that of the version if (array_key_exists('version', $arguments)) { $version = $snippet->Version(intval($arguments['version'])); if (empty($version) || $version === false || $version->ID == 0) { $snippetText = $version->Text; } } //Load CSS Requirements Requirements::css(CB_DIR . '/javascript/external/syntaxhighlighter/themes/shCore.css'); Requirements::css(CB_DIR . '/javascript/external/syntaxhighlighter/themes/shCoreDefault.css'); Requirements::css(CB_DIR . '/javascript/external/syntaxhighlighter/themes/shThemeDefault.css'); //Load JS Requirements Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(CB_DIR . '/javascript/external/syntaxhighlighter/brushes/shCore.js'); Requirements::javascript(CB_DIR . '/javascript/external/syntaxhighlighter/brushes/' . self::getBrushName($snippet->Language()->HighlightCode) . '.js'); Requirements::javascriptTemplate(CB_DIR . '/javascript/CodeBankShortCode.template.js', array('ID' => $snippet->ID), 'snippet-highlightinit-' . $snippet->ID); //Render the snippet $obj = new ViewableData(); return $obj->renderWith('CodeBankShortCode', array('ID' => $snippet->ID, 'Title' => $snippet->getField('Title'), 'Description' => $snippet->getField('Description'), 'SnippetText' => DBField::create_field('Text', $snippetText), 'HighlightCode' => strtolower($snippet->Language()->HighlightCode))); }
/** * @param array $properties * @return HTMLText */ public function Field($properties = array()) { if ($this->includeDefaultJS) { Requirements::javascriptTemplate(FRAMEWORK_DIR . '/javascript/InlineFormAction.js', array('ID' => $this->id())); } return DBField::create_field('HTMLText', FormField::create('input', array('name' => sprintf('action_%s', $this->getName()), 'value' => $this->title, 'id' => $this->ID(), 'class' => sprintf('action%s', $this->extraClass)))); }
/** * @return void */ public function init() { parent::init(); $conf = $this->boxes(); $parsed = $this->parseForJS($conf); Requirements::css(INFOBOXES_DIR . '/css/InfoBoxes.css'); Requirements::javascriptTemplate(INFOBOXES_DIR . '/javascript/InfoBoxes.js', $parsed); }
function FieldHolder() { $regions = Region::shipping_regions(); $jsonRegions = json_encode($regions); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascriptTemplate('swipestripe/javascript/RegionField.js', array("regions" => $jsonRegions, 'defaultValue' => $this->Value())); return parent::FieldHolder(); }
function Field() { Requirements::javascript("mysite/javascript/jquery-ui-1.8.6.custom.min.js"); Requirements::javascript("http://maps.google.com/maps/api/js?sensor=true"); Requirements::javascriptTemplate("googlemapselectionfield/javascript/GoogleMapSelectionField.js", array('Name' => $this->name, 'DefaultLat' => $this->startLat, 'DefaultLon' => $this->startLong, 'MapWidth' => $this->mapWidth, 'MapHeight' => $this->mapHeight, 'Zoom' => $this->zoom)); return " \n\t\t\t<div class=\"googleMapField\">\n <div class=\"mapdetails\">\n <p class=\"left\"><input type=\"text\" id=\"{$this->id()}\" name=\"{$this->name}\" value=\"" . _t('GoogleMapSelectableField.ENTERADDRESS', 'Enter Address') . "\" class=\"longText\"/></p>\n <p class=\"left\"><input type=\"text\" id=\"{$this->id()}_Lng\" name=\"{$this->name}_Lng\" /></p>\n <p class=\"left\"><input type=\"text\" id=\"{$this->id()}_Lat\" name=\"{$this->name}_Lat\" /></p>\n <p class=\"field checkbox\">\n <input class=\"left\" type=\"checkbox\" id=\"ShowDetails\" name=\"{$this->name}_ShowDetails\" />\n <label class=\"right\" for=\"ShowDetails\" style=\"cursor: pointer\">Add a better description of the location?</label>\n </p>\n <div id=\"LocationDetailsInput\" style=\"float: left; overflow: hidden; height: 0px\"><p class=\"left\"><input type=\"text\" id=\"{$this->id()}\"_Details\" name=\"{$this->name}_Details\" class=\"longText\"//></p></div>\n \n </div>\n <div class=\"clear\"></div>\n <div id=\"map_{$this->name}\" style=\"margin-top: 20px; width: {$this->mapWidth}; height: {$this->mapHeight};\"></div>\n\t\t\t</div>"; //<input type=\"hidden\" id=\"{$this->id()}_MapURL\" name=\"{$this->name}_MapURL\" /> //<input type=\"submit\" value=\"" . _t('EditableFormField.GO', 'Go') . "\" class=\"submit googleMapAddressSubmit\" /> }
public function onAfterInit() { if ($this->owner->Maps()->exists() && $this->owner->ShowMap && !$this->owner->StaticMap) { foreach ($this->owner->Maps() as $map) { $vars = array('MapID' => "google-map-dynamic-{$map->ID}", 'Content' => $map->Content, 'Address' => $map->Address ? str_replace('/n', ',', $map->Address) . ',' . $map->PostCode : 'false', 'Latitude' => $map->Latitude ? $map->Latitude : 'false', 'Longitude' => $map->Longitude ? $map->Longitude : 'false', 'Zoom' => $map->ZoomLevel); Requirements::javascriptTemplate('googlemaps/javascript/GoogleMap.js', $vars); } } }
public function init() { $mode = Config::inst()->get('UserPreviewPreference', 'DefaultMode'); $userMode = Member::currentUser()->DefaultPreviewMode; if (!empty($userMode)) { $mode = $userMode; } Requirements::javascriptTemplate(CMSPREVIEWPREFERENCE_BASE . '/javascript/preview-mode.template.js', array('PreviewMode' => $mode), 'cms-preview-mode'); }
public function init() { parent::init(); Requirements::css(DISTRIBUTOR_MAP_DIR . '/css/distributor-map.css'); Requirements::javascript(DISTRIBUTOR_MAP_DIR . "/js/DistributorMap.js"); Requirements::javascript(DISTRIBUTOR_MAP_DIR . "/js/Base64Handler.js"); $aVars = array('Address' => $this->Address, 'Project' => PROJECT, 'Module' => DISTRIBUTOR_MAP_DIR, 'MapIcon' => $this->getMapIcon(), 'Distributors' => $this->DistributorList()); Requirements::javascriptTemplate(DISTRIBUTOR_MAP_DIR . '/js/DistributorGoogleMapCode.js', $aVars, "Distributors-" . $this->ID); }
/** * add the requirements */ public function init() { parent::init(); // add the used libs in. Requirements::css(FLEX_IMAGES_GALLERY_MODULE_DIR . '/css/styles.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(FLEX_IMAGES_GALLERY_MODULE_DIR . '/javascript/jquery.flex-images.js'); Requirements::javascript(FLEX_IMAGES_GALLERY_MODULE_DIR . '/javascript/lightbox.js'); // add the defined rowHeight to the js file Requirements::javascriptTemplate(FLEX_IMAGES_GALLERY_MODULE_DIR . '/javascript/GalleryPage.template.js', array('rowHeight' => $this->Height ? $this->Height : 180)); }
public function __construct() { parent::__construct(); Requirements::block("photogallery/shadowbox/shadowbox.css"); Requirements::block("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); Requirements::block("photogallery/shadowbox/shadowbox.js"); Requirements::block("photogallery/js/shadowbox_init.js"); Requirements::CSS("silverstripe-video-embed/assests/javascript/shadowbox/shadowbox.css"); Requirements::javascript("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); Requirements::javascript("silverstripe-video-embed/assests/javascript/shadowbox/shadowbox.js"); Requirements::javascriptTemplate('silverstripe-video-embed/assests/javascript/shadowbox_init.js', array()); }
public function Countdown() { if (!$this->owner->EndDate || !$this->owner->CountdownType) { return; } $this->jsScripts(); $formatDate = $this->formattedEndDate(); $vars = array('EndDate' => $formatDate, 'ElementClass' => $this->owner->CountdownElementClass, 'ElementID' => $this->owner->CountdownElementID); $script = $this->options[$this->owner->CountdownType]['Script']; $template = $this->options[$this->owner->CountdownType]['Template']; Requirements::javascriptTemplate("countdown/js/{$script}.js", $vars, true); return $this->owner->renderWith($template); }
public function FieldHolder($properties = array()) { // load requirements Requirements::css('international-phone-number-field/lib/intl-tel-input/build/css/intlTelInput.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.min.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-validate/jquery.validate.min.js'); Requirements::javascript('international-phone-number-field/lib/intl-tel-input/build/js/intlTelInput.min.js'); $token = Config::inst()->get('InternationalPhoneNumberField', 'ipinfo_access_token'); $tokenParameter = $token && strlen($token) > 0 ? '?token=' . $token : ''; $protocol = $token && strlen($token) > 0 ? 'https' : 'http'; Requirements::javascriptTemplate('international-phone-number-field/javascript/InternationalPhoneNumberField.js', array('TokenParameter' => $tokenParameter, 'Protocol' => $protocol)); // call parent $html = parent::FieldHolder(); return $html; }
public static function parse_googlestreetview($arguments, $caption = null, $parser = null) { // each of latitude, longitude and heading are required at a bare minimum if (!isset($arguments['latitude'])) { return ''; } if (!isset($arguments['longitude'])) { return ''; } if (!isset($arguments['heading'])) { return ''; } // defaults - these can be overriden by using zoom and pitch in the shortcode $defaults = array('Zoom' => 1, 'Pitch' => 0); // ensure JavaScript for the map service is only downloaded once $arguments['DownloadJS'] = !MapUtil::get_map_already_rendered(); MapUtil::set_map_already_rendered(true); // convert parameters to CamelCase as per standard template conventions $arguments['Latitude'] = $arguments['latitude']; $arguments['Longitude'] = $arguments['longitude']; $arguments['Heading'] = $arguments['heading']; // optional parameter caption if (isset($arguments['caption'])) { $arguments['Caption'] = $arguments['caption']; } // optional parameter pitch if (isset($arguments['pitch'])) { $arguments['Pitch'] = $arguments['pitch']; } // optional parameter zoom if (isset($arguments['zoom'])) { $arguments['Zoom'] = $arguments['zoom']; } // the id of the dom element to be used to render the street view $arguments['DomID'] = 'google_streetview_' . self::$gsv_ctr; // incrememt the counter to ensure a unique id for each map canvas self::$gsv_ctr++; // merge defaults and arguments $customised = array_merge($defaults, $arguments); // Include google maps JS at the end of the page Requirements::javascriptTemplate("mappable/javascript/google/streetview.google.template.js", $customised); //get streetview template template $template = new SSViewer('GoogleStreetView'); //return the template customised with the parmameters return $template->process(new ArrayData($customised)); }
public static function parse_googlemap($arguments, $caption = null, $parser = null) { // each of latitude and longitude are required at a bare minimum if (!isset($arguments['latitude'])) { return ''; } if (!isset($arguments['longitude'])) { return ''; } // defaults - can be overriden by using zoom and FIXME in the shortcode $defaults = array('Zoom' => 5, 'MapType' => 'road'); // ensure JavaScript for the map service is only downloaded once $arguments['DownloadJS'] = !MapUtil::get_map_already_rendered(); MapUtil::set_map_already_rendered(true); // convert parameters to CamelCase as per standard template conventions $arguments['Latitude'] = $arguments['latitude']; $arguments['Longitude'] = $arguments['longitude']; // optional parameter caption if (isset($arguments['caption'])) { $arguments['Caption'] = $arguments['caption']; } if (isset($arguments['maptype'])) { $arguments['MapType'] = $arguments['maptype']; } // optional parameter zoom if (isset($arguments['zoom'])) { $arguments['Zoom'] = $arguments['zoom']; } // the id of the dom element to be used to render the street view $arguments['DomID'] = 'google_sc_map_' . self::$gsv_ctr; // fullscreen $arguments['AllowFullScreen'] = Config::inst()->get('Mappable', 'allow_full_screen'); // incrememt the counter to ensure a unique id for each map canvas self::$gsv_ctr++; // merge defaults and arguments $customised = array_merge($defaults, $arguments); // include JavaScript to be appended at the end of the page, namely params for map rendering Requirements::javascriptTemplate("mappable/javascript/google/map.google.template.js", $customised); //get map view template and render the HTML $template = new SSViewer('GoogleMapShortCode'); //return the template customised with the parmameters return $template->process(new ArrayData($customised)); }
/** * Returns the actual video embed code. * If $autoplay isset it will use this value * instead of the value stored in DB. * * @param int $width * @param int $height * @param boolean $autoplay * @return string */ public function VideoEmbed($width = 640, $height = 375, $autoplay = null) { $autoplay = isset($autoplay) ? $autoplay : $this->Autoplay; switch ($this->VideoType) { case 'Embed': if ($this->VideoAddress != '') { return VideoUtility::video_embed($this->VideoAddress, $width, $height, $autoplay); } break; case 'File': if ($this->VideoFileID != 0 && isset($this->VideoFileID)) { $vars = array('ID' => $this->ID, 'Width' => $width, 'Height' => $height, 'VideoURL' => $this->VideoFile()->URL, 'ThemeDir' => $this->ThemeDir(), 'Autoplay' => $autoplay, 'Module' => CleanUtils::$module); Requirements::javascript(CleanUtils::$module . "/javascript/libs/swfobject.js"); Requirements::javascriptTemplate(CleanUtils::$module . "/javascript/init_video.js", $vars); return $this->customise($vars)->renderWith(array('VideoEmbed')); } break; } return false; }
/** * Sets Requirements and checks for Permissions. * Subclass this function to add custom Requirements. */ 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/CMSMain_left.js"); Requirements::javascript("cms/javascript/GenericDataAdmin_left.js"); Requirements::javascript("cms/javascript/GenericDataAdmin_right.js"); Requirements::javascript("cms/javascript/SideTabs.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())); } Requirements::css("cms/css/GenericDataAdmin.css"); //For wrightgroup workshop Requirements::css("writework/css/WorkshopCMSLayout.css"); }
public function init() { parent::init(); Requirements::javascript(CMS_DIR . '/javascript/ReportAdmin_left.js'); Requirements::javascript(CMS_DIR . '/javascript/ReportAdmin_right.js'); Requirements::css(CMS_DIR . '/css/ReportAdmin.css'); // 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"); Requirements::javascriptTemplate(CMS_DIR . '/javascript/tinymce.template.js', array( 'ContentCSS' => project() . '/css/editor.css', 'BaseURL' => Director::absoluteBaseURL(), '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'); }
public function init() { parent::init(); // Note: you should use SS template require tags inside your templates // instead of putting Requirements calls here. However these are // included so that our older themes still work //$query = DataObject::get("VideoPage", "ID = $this->VimeoID"); //$GPSURL = $GPSXML.URL; //Requirements::javaScript("mysite/javascript/vimeo.js"); /* Requirements::javascriptTemplate('mysite/javascript/map.js', array( // 'City' => $City, 'lat' => $this->getLatForMap(), 'lng' => $this->getLngForMap() )); */ Requirements::javascript("framework/thirdparty/jquery/jquery.js"); // Requirements::javascript("http://maps.google.com/maps/api/js?sensor=false"); VERSION 2 (Depreciated) Requirements::javascript("http://maps.googleapis.com/maps/api/js?key=AIzaSyAAaa_ApoYASmy5j35SKI7q1UcLzvdxf2E&sensor=false"); Requirements::javascript("mysite/javascript/GoogleMapConfig.js"); Requirements::javascriptTemplate('mysite/javascript/GoogleMapConfig.js', array('memberCount' => $this->memberCountForMap(), 'content' => $this->getContentForMap(), 'lat' => $this->getLatForMap(), 'lng' => $this->getLngForMap())); // Requirements::javascript("mysite/javascript/MapSettings.js"); VERSION 2 Configuration // Requirements::javascript("mysite/javascript/jquery.scrollto.js"); // Requirements::javascript("mysite/javascript/scrollConfig.js"); /* Requirements::javascriptTemplate('mysite/javascript/MapSettings.js', array( VERSION 2 (Depreciated) 'fname' => $this->getFirstNameForMap(), 'sname' => $this->getSurnameForMap(), 'lat' => $this->getLatForMap(), 'lng' => $this->getLngForMap() )); */ //Debug::show($this->MemberCountForMap()); // Requirements::javascript("mysite/javascript/MapTrigger.js"); // Debug::show($this->getContentForMap()); // Debug::show($this->getLatForMap()); // Debug::show($this->getLngForMap()); //Debug::show($this->getCoordinatesForMap()); self::convertAddressToPoint(); }
/** * updateCMSFields. * Update Silverstripe CMS Fields for SEO Module * * @param FieldList * @return none */ public function updateCMSFields(FieldList $fields) { // exclude SEO tab from some pages if (in_array($this->owner->getClassName(), Config::inst()->get("SeoSiteTreeExtension", "excluded_page_types"))) { return; } Requirements::css(SEO_DIR . '/css/seo.css'); //Requirements::javascript(SEO_DIR.'/javascript/seo.js'); // Get title template $sc = SiteConfig::current_site_config(); if ($sc->SEOTitleTemplate) { $TitleTemplate = $sc->SEOTitleTemplate; } else { $TitleTemplate = "page_title + ' » ' + siteconfig_title"; } $jsvars = array("TitleTemplate" => $TitleTemplate); // check if the page being checked provides images and links information $providedInfoFIeld = null; $class = new ReflectionClass($this->owner); if ($class->implementsInterface('SeoInformationProvider')) { $links = $this->owner->getLinksForSeo(); $images = $this->owner->getImagesForSeo(); // if we have images or links add an extra div containing info in data attributes $info = array(); if (sizeof($links) > 0) { $info['data-has-links'] = true; } if (sizeof($images) > 0) { $info['data-has-images'] = true; } if (sizeof($info) > 0) { $html = '<div id="providedInfo" '; foreach ($info as $key => $val) { $html .= $key . '=' . $val; } $html .= ">INFO HERE</div>"; $providedInfoFIeld = new LiteralField('ProvidedSEOInfo', $html); } } Requirements::javascriptTemplate(SEO_DIR . '/javascript/seo.js', $jsvars); // lets create a new tab on top $fields->addFieldsToTab('Root.SEO', array(LiteralField::create('googlesearchsnippetintro', '<h3>' . _t('SEO.SEOGoogleSearchPreviewTitle', 'Preview google search') . '</h3>'), LiteralField::create('googlesearchsnippet', '<div id="google_search_snippet"></div>'), LiteralField::create('siteconfigtitle', '<div id="ss_siteconfig_title">' . $this->owner->getSiteConfig()->Title . '</div>'))); // move Metadata field from Root.Main to SEO tab for visualising direct impact on search result $fields->removeByName('Metadata'); // Create SEO tabs $fields->addFieldToTab("Root.SEO", new TabSet('Options')); $fields->findOrMakeTab('Root.SEO.Options.HelpAndSEOScore', _t('SEO.SEOScoreAndTips', 'SEO Score and Tips')); $fields->findOrMakeTab('Root.SEO.Options.Meta', _t('SEO.SEOMetaData', 'Metadata')); $fields->findOrMakeTab('Root.SEO.Options.Social', _t('SEO.Social', 'Social')); $fields->findOrMakeTab('Root.SEO.Options.Advanced', _t('SEO.Advanced', 'Advanced')); if ($providedInfoFIeld) { $fields->addFIeldToTab('Root.SEO', $providedInfoFIeld); } // ADD metadata fields $fields->addFieldsToTab('Root.SEO.Options.Meta', array(TextField::create("MetaTitle", _t('SEO.SEOMetaTitle', 'Meta title'))->setRightTitle(_t('SEO.SEOMetaTitleHelp', 'Name of the page, search engines use this as title of search results. If unset, the page title will be used.')), TextareaField::create("MetaDescription", $this->owner->fieldLabel('MetaDescription'))->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results (although it will not influence their ranking)."))->addExtraClass('help'), TextareaField::create("ExtraMeta", $this->owner->fieldLabel('ExtraMeta'))->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example <meta name=\"customName\" content=\"your custom content here\" />"))->addExtraClass('help'))); // ADD SEOTIPS fiels // $template = new SSViewer('Footer'); // $seotips = $template->process($this->owner->customise(new ArrayData(array( // 'ShowError' => true, // )))); //Debug::dump( SSViewer::get_theme_folder() ); // $pagehtml = $this->owner->renderwith(array('Footer')); $fields->addFieldsToTab('Root.SEO.Options.HelpAndSEOScore', array(LiteralField::create('ScoreTitle', '<h4 class="seo_score">' . _t('SEO.SEOScore', 'SEO Score') . '</h4>'), LiteralField::create('Score', $this->getHTMLStars()), HiddenField::create('SEOPageScore', $this->owner->SEOPageScore), LiteralField::create('ScoreClear', '<div class="score_clear"></div>'), GoogleSuggestField::create("SEOPageSubject", _t('SEO.SEOPageSubjectTitle', 'Subject of this page (required to view this page SEO score)')))); // ADD PageSubjectchecks if subject = defined // if (!empty($this->SEOPageSubject)) { $fields->addFieldsToTab('Root.SEO.Options.HelpAndSEOScore', array(LiteralField::create('SimplePageSubjectCheckValues', $this->getHTMLSimplePageSubjectTest()))); // } // Add SEO score tips if below 10 -> add always, show/hide from js. //if ($this->seo_score < 10) { $fields->addFieldsToTab('Root.SEO.Options.HelpAndSEOScore', array(LiteralField::create('ScoreTipsTitle', '<h4 class="seo_score">' . _t('SEO.SEOScoreTips', 'SEO Score Tips') . '</h4>'), LiteralField::create('ScoreTips', $this->getSEOScoreTipsUL()))); //} $fields->addFieldsToTab('Root.SEO.Options.Social', array(TextField::create("SEOFBdescription", _t('SEO.SEOFBdescription', 'Facebook description'))->setRightTitle(_t('SEO.SEOFBdescriptionHelp', 'Wanneer je niet de metabeschrijving wil gebruiken voor het delen van berichten op Facebook, maar een andere omschrijving wil, schrijf het dan hier.')), TextField::create("SEOFBAuthorlink", _t('SEO.SEOFBAuthorlink', 'Facebook author'))->setRightTitle(_t('SEO.SEOFBAuthorlinkHelp', 'Author Facebook PROFILE URL (incl. http://)')), TextField::create("SEOFBPublisherlink", _t('SEO.SEOFBPublisherlink', 'Facebook publisher'))->setRightTitle(_t('SEO.SEOFBPublisherlinkHelp', 'Publisher Facebook PAGE URL (incl. http://)')), TextField::create("SEOGplusAuthorlink", _t('SEO.SEOGplusAuthorlink', 'Google+ author'))->setRightTitle(_t('SEO.SEOGplusAuthorlinkHelp', 'Author Google+ PROFILE URL (incl. http://)')), TextField::create("SEOGplusPublisherlink", _t('SEO.SEOGplusPublisherlink', 'Google+ publisher'))->setRightTitle(_t('SEO.SEOGplusPublisherlinkHelp', 'Publisher Google+ PAGE URL (incl. http://)')))); $fields->addFieldsToTab('Root.SEO.Options.Advanced', array(HeaderField::create('RobotsTitle', _t('SEO.SEORobotSettings', 'Page settings for search engines'), 4), CheckboxField::create('MetaRobotsNoIndex', _t('SEO.MetaRobotsNoIndex', 'Prevent indexing this page')), CheckboxField::create('MetaRobotsNoFollow', _t('SEO.MetaRobotsNoFollow', 'Prevent following any links from this page')), CheckboxField::create('MetaRobotsNoCache', _t('SEO.MetaRobotsNoCache', 'Prevent caching a version of this page')), CheckboxField::create('MetaRobotsNoSnippet', _t('SEO.MetaRobotsNoSnippet', 'Prevent showing a snippet of this page in the search results (also prevents caching)')))); }
public function init() { parent::init(); // Summit Landing Page Redirects // Looks to see if ?source is set and redirects to either English or Chinese landing page // based on the source if (isset($this->request)) { $getVars = $this->request->getVars(); } $chineseLangCampaigns = array("o2", "o4", "o6", "o8", "o17", "o18", "o22"); self::AddRequirements(); $use_shadow_box = Director::get_current_page()->IncludeShadowBox; $use_shadow_box = empty($use_shadow_box) || intval($use_shadow_box) == 0 ? 'false' : 'true'; $this->CustomScripts(); //this will be include inline on body after requirements Requirements::javascriptTemplate('themes/openstack/javascript/page.js', array('UseShadowBox' => $use_shadow_box)); }
function googleMapMultiple($startLat = "-40.996484", $startLng = "172.6", $mapWidth = "300", $mapHeight = "300", $zoom = "5", $events = "") { $LocationsString = $this->getEventsLatLngString('Locations', $events); //Requirements::javascript("mysite/javascript/jquery-ui-1.8.6.custom.min.js"); Requirements::javascript("http://maps.google.com/maps/api/js?sensor=true"); Requirements::javascriptTemplate("googlemapselectionfield/javascript/GoogleMapDisplayMultiple.js", array('Name' => "topeventsmap", 'StartLat' => $startLat, 'StartLng' => $startLng, 'MapWidth' => $mapWidth, 'MapHeight' => $mapHeight, 'Zoom' => $zoom, 'LocationsString' => $LocationsString)); return " <div class=\"googleMapField\">\n <div id=\"map_topeventsmap\" style=\"width: {$mapWidth}px; height: {$mapHeight}px;\"></div>\n\t\t\t</div>"; }
public function AddEditingIncludes() { $minExt = Director::isDev() ? "" : ".min"; Requirements::javascriptTemplate(FRONTEND_ADMIN_DIR . '/javascript/dist/FrontEndAdminTemplate' . $minExt . '.js', $this->getConfig()); Requirements::javascript(FRONTEND_ADMIN_DIR . '/javascript/thirdparty/tinymce/js/tinymce/jquery.tinymce.min.js'); Requirements::javascript(FRONTEND_ADMIN_DIR . '/javascript/dist/FrontEndEditor' . $minExt . '.js'); Requirements::css(FRONTEND_ADMIN_DIR . '/css/frontend-editor' . $minExt . '.css'); }
/** * SilverStripe require javascript template, using self.template_data to * gather variables to pass in (which in turn calls extensions on the * current controller to get relevant info). * * @param $controller * @param $path * @param null $info */ protected static function jst($controller, $path, $info = null) { \Requirements::javascriptTemplate($path, self::requirements_template_data($controller, self::FileTypeJavascriptTemplate, $info)); }