/** * Returns Url to the photoset * @return string|"" url of the photoset if userId is set */ public function getUrl() { if ($this->userId === null || !is_string($this->userId)) { return ""; } return sprintf('%swww.flickr.com/photos/%s/sets/%s', Director::protocol(), $this->userId, $this->data['id']); }
public function MarketPlaceReviewForm() { Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::combine_files('marketplace_review_form.js', array("themes/openstack/javascript/jquery.validate.custom.methods.js", "marketplace/code/ui/frontend/js/star-rating.min.js", "marketplace/code/ui/frontend/js/marketplace.review.js")); $css_files = array("marketplace/code/ui/frontend/css/star-rating.min.css", "marketplace/code/ui/frontend/css/marketplace-review.css"); foreach ($css_files as $css_file) { Requirements::css($css_file); } $form = new MarketPlaceReviewForm($this, 'MarketPlaceReviewForm'); $data = Session::get("FormInfo.Form_MarketPlaceReviewForm.data"); $review = $this->review_repository->getReview($this->company_service_ID, Member::CurrentUserID()); if (is_array($data)) { //get data from cache $form->loadDataFrom($data); } elseif ($review) { // get submitted review $form->loadDataFrom($review); } // Optional spam protection if (class_exists('SpamProtectorManager')) { SpamProtectorManager::update_form($form); } return $form; }
public function FieldHolder($attributes = array()) { Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::css("registration/css/affiliations.css"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); $js_scripts = array("themes/openstack/javascript/pure.min.js", "themes/openstack/javascript/jquery.serialize.js", "themes/openstack/javascript/jquery.cleanform.js", "themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js", "themes/openstack/javascript/jquery.validate.custom.methods.js", 'registration/javascript/affiliations.js'); foreach ($js_scripts as $js) { Requirements::javascript($js); } $arrayData = new ArrayData(array('Title' => 'Edit Affiliation')); $modal = $arrayData->renderWith('AffiliationModalForm'); $modal = trim(preg_replace('/\\s\\s+/', ' ', $modal)); $script = <<<JS (function( \$ ){ \$(document).ready(function() { \$('{$modal}').appendTo(\$('body')); \$("#edit-affiliation-form").affiliations({ storage:'{$this->mode}' }); }); }( jQuery )); JS; Requirements::customScript($script); return parent::FieldHolder($attributes); }
function init() { parent::init(); $this->securityToken = new SecurityToken(); Requirements::css('news/code/ui/frontend/css/news.css'); Requirements::css(Director::protocol() . '://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); }
public function GerritStatisticsReport() { Requirements::block(SAPPHIRE_DIR . "/javascript/jquery_improvements.js"); Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.min.js'); Requirements::block(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js'); if (Director::isLive()) { Requirements::javascript('themes/openstack/javascript/jquery.min.js'); } else { Requirements::javascript('themes/openstack/javascript/jquery.js'); } Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js'); Requirements::javascript("themes/openstack/javascript/jquery.cookie.js"); Requirements::javascript("themes/openstack/javascript/bootstrap.min.js"); Requirements::css('themes/openstack/css/bootstrap.min.css'); Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false"); Requirements::javascript("marketplace/code/ui/admin/js/utils.js"); Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js"); Requirements::javascript("marketplace/code/ui/frontend/js/oms.min.js"); Requirements::javascript("marketplace/code/ui/frontend/js/infobubble-compiled.js"); Requirements::javascript("marketplace/code/ui/frontend/js/google.maps.jquery.js"); Requirements::javascript('themes/openstack/javascript/Chart.js'); Requirements::javascript("gerrit_ingest/js/sangria.page.gerrit.statistics.report.js"); Requirements::css('gerrit_ingest/css/sangria.page.gerrit.statistics.report.css'); return $this->owner->getViewer('GerritStatisticsReport')->process($this->owner); }
function updateCMSFields(FieldList $fields) { $subsites = Subsite::accessible_sites("CMS_ACCESS_CMSMain"); $subsitesMap = array(); if ($subsites && $subsites->Count()) { $subsitesMap = $subsites->map('ID', 'Title'); unset($subsitesMap[$this->owner->SubsiteID]); } // Master page edit field (only allowed from default subsite to avoid inconsistent relationships) $isDefaultSubsite = $this->owner->SubsiteID == 0 || $this->owner->Subsite()->DefaultSite; if ($isDefaultSubsite && $subsitesMap) { $fields->addFieldToTab('Root.Main', new DropdownField("CopyToSubsiteID", _t('SiteTreeSubsites.CopyToSubsite', "Copy page to subsite"), $subsitesMap, '')); $fields->addFieldToTab('Root.Main', $copyAction = new InlineFormAction("copytosubsite", _t('SiteTreeSubsites.CopyAction', "Copy"))); $copyAction->includeDefaultJS(false); } // replace readonly link prefix $subsite = $this->owner->Subsite(); $nested_urls_enabled = Config::inst()->get('SiteTree', 'nested_urls'); if ($subsite && $subsite->ID) { $baseUrl = Director::protocol() . $subsite->domain() . '/'; $baseLink = Controller::join_links($baseUrl, $nested_urls_enabled && $this->owner->ParentID ? $this->owner->Parent()->RelativeLink(true) : null); $urlsegment = $fields->dataFieldByName('URLSegment'); $urlsegment->setURLPrefix($baseLink); } }
function init() { parent::init(); $google_geo_coding_api_key = null; $google_geo_coding_client_id = null; $google_geo_coding_private_key = null; if (defined('GOOGLE_GEO_CODING_API_KEY')) { $google_geo_coding_api_key = GOOGLE_GEO_CODING_API_KEY; } else { if (defined('GOOGLE_GEO_CODING_CLIENT_ID') && defined('GOOGLE_GEO_CODING_PRIVATE_KEY')) { $google_geo_coding_client_id = GOOGLE_GEO_CODING_CLIENT_ID; $google_geo_coding_private_key = GOOGLE_GEO_CODING_PRIVATE_KEY; } } //managers $this->factory = new EventRegistrationRequestFactory(); $this->event_registration_request_manager = new EventRegistrationRequestManager(new SapphireEventRegistrationRequestRepository(), new SapphireEventRepository(), $this->factory, new GoogleGeoCodingService(new SapphireGeoCodingQueryRepository(), new UtilFactory(), SapphireTransactionManager::getInstance(), $google_geo_coding_api_key, $google_geo_coding_client_id, $google_geo_coding_private_key), new SapphireEventPublishingService(), new EventValidatorFactory(), SapphireTransactionManager::getInstance()); //js files Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::combine_files('event_registration_request_page.js', array("themes/openstack/javascript/chosen.jquery.min.js", "themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js", "themes/openstack/javascript/jquery.validate.custom.methods.js", 'events/js/event.registration.request.page.js')); }
function init() { parent::init(); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::customScript("jQuery(document).ready(function(\$) {\n \$('#consulting','.marketplace-nav').addClass('current');\n });"); Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false"); Requirements::combine_files('marketplace_consultants_directory_page.js', array("marketplace/code/ui/frontend/js/markerclusterer.js", "marketplace/code/ui/frontend/js/oms.min.js", "marketplace/code/ui/frontend/js/infobubble-compiled.js", "marketplace/code/ui/frontend/js/google.maps.jquery.js", "themes/openstack/javascript/chosen.jquery.min.js", "marketplace/code/ui/frontend/js/consultants.directory.page.js")); Requirements::customScript($this->GATrackingCode()); $this->consultant_repository = new SapphireConsultantRepository(); $this->region_repository = new SapphireRegionRepository(); $this->consultants_locations_query = new ConsultantsOfficesLocationsQueryHandler(); $this->consultants_service_query = new ConsultantsServicesQueryHandler(); $google_geo_coding_api_key = null; $google_geo_coding_client_id = null; $google_geo_coding_private_key = null; if (defined('GOOGLE_GEO_CODING_API_KEY')) { $google_geo_coding_api_key = GOOGLE_GEO_CODING_API_KEY; } else { if (defined('GOOGLE_GEO_CODING_CLIENT_ID') && defined('GOOGLE_GEO_CODING_PRIVATE_KEY')) { $google_geo_coding_client_id = GOOGLE_GEO_CODING_CLIENT_ID; $google_geo_coding_private_key = GOOGLE_GEO_CODING_PRIVATE_KEY; } } $this->manager = new ConsultantManager($this->consultant_repository, new SapphireMarketPlaceVideoTypeRepository(), new SapphireMarketPlaceTypeRepository(), new SapphireOpenStackApiVersionRepository(), new SapphireOpenStackComponentRepository(), new SapphireOpenStackReleaseRepository(), new SapphireRegionRepository(), new SapphireSupportChannelTypeRepository(), new SapphireSpokenLanguageRepository(), new SapphireConfigurationManagementTypeRepository(), new SapphireConsultantServiceOfferedTypeRepository(), new ConsultantAddPolicy($this->consultant_repository, new SapphireMarketPlaceTypeRepository()), new CompanyServiceCanAddResourcePolicy(), new CompanyServiceCanAddVideoPolicy(), new ConsultantFactory(), new MarketplaceFactory(), new ValidatorFactory(), new OpenStackApiFactory(), new GoogleGeoCodingService(new SapphireGeoCodingQueryRepository(), new UtilFactory(), SapphireTransactionManager::getInstance(), $google_geo_coding_api_key, $google_geo_coding_client_id, $google_geo_coding_private_key), null, new SessionCacheService(), SapphireTransactionManager::getInstance()); }
public static function forceNonWWW() { if (!Director::isDev() && !Director::isTest() && strpos($_SERVER['HTTP_HOST'], 'www') === 0) { $destURL = str_replace(Director::protocol() . 'www.', Director::protocol(), Director::absoluteURL($_SERVER['REQUEST_URI'])); self::force_redirect($destURL); } }
function init() { parent::init(); Requirements::css("marketplace/code/ui/frontend/css/marketplace.landing.css"); Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false"); Requirements::combine_files('marketplace_landing.js', array("marketplace/code/ui/frontend/js/markerclusterer.js", "marketplace/code/ui/frontend/js/oms.min.js", "marketplace/code/ui/frontend/js/infobubble-compiled.js", "marketplace/code/ui/frontend/js/google.maps.jquery.js", "marketplace/code/ui/frontend/js/landing.page.js")); $this->public_cloud_repository = new SapphirePublicCloudRepository(); }
public function FieldHolder() { Requirements::css(Director::protocol() . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css'); Requirements::css('eventresources/thirdparty/jquery-fullcalendar/fullcalendar.css'); Requirements::javascript('eventresources/thirdparty/jquery-fullcalendar/fullcalendar.min.js'); Requirements::javascript('eventresources/javascript/EventResourceCalendar.js'); return $this->createTag('div', array('id' => $this->id(), 'class' => 'event-resource-calendar ' . $this->extraClass(), 'href' => $this->Link('bookings'))); }
function init() { parent::init(); Requirements::css(Director::protocol() . "code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"); Requirements::css('news/code/ui/frontend/css/news.admin.css'); Requirements::javascript(Director::protocol() . "code.jquery.com/ui/1.10.4/jquery-ui.min.js"); Requirements::javascript('news/code/ui/frontend/js/news.admin.js'); }
function init() { parent::init(); $this->securityToken = new SecurityToken(); Requirements::css('news/code/ui/frontend/css/news.css'); Requirements::css(Director::protocol() . '://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); Requirements::javascript("themes/openstack/javascript/bootstrap-paginator.js"); Requirements::javascript("news/code/ui/frontend/js/news.archived.js"); }
public function onAfterInit() { Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js"); Requirements::javascript('themes/openstack/javascript/sangria/sangria.page.export.data.js'); }
public static function CanTrackEvents(Controller $controller) { $bIsContentController = is_a($controller, 'ContentController'); if ($bIsContentController && SiteConfig::current_site_config()->GoogleAnalyticsTrackingID) { $strCurrentDomain = str_replace(Director::protocol(), '', Director::protocolAndHost()); $arrDomains = explode(',', SiteConfig::current_site_config()->GoogleAnalyticsTrackDomain); return in_array($strCurrentDomain, $arrDomains); } }
public function init() { parent::init(); Requirements::css('themes/openstack/css/signin.page.css'); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript("themes/openstack/javascript/jquery.autocomplete.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript('themes/openstack/javascript/signin.page.js'); }
/** * PresentationForm constructor. * @param Controller $controller * @param string $name * @param FieldList $actions * @param ISummit $summit * @param IPresentationManager $presentation_manager * @param IPresentation $presentation */ public function __construct($controller, $name, $actions, ISummit $summit, IPresentationManager $presentation_manager, IPresentation $presentation) { $this->presentation_manager = $presentation_manager; $this->summit = $summit; $this->presentation = $presentation; Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript('summit/javascript/presentation-form.js'); Requirements::css('themes/openstack/bower_assets/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css'); parent::__construct($controller, $name, $this->getPresentationFields(), $actions, $this->getPresentationValidator()); }
public function CCLATeamAdmin() { Requirements::javascript('marketplace/code/ui/admin/js/utils.js'); Requirements::customScript('var company_id = ' . $this->getCompanyID() . ';'); Requirements::javascript('ICLA/js/edit.profile.ccla.teams.js'); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js"); Requirements::css('ICLA/css/edit.profile.ccla.teams.css'); return $this->owner->getViewer('CCLATeamAdmin')->process($this->owner); }
public function init() { parent::init(); Requirements::javascript("summit/bower_components/sweetalert/lib/sweet-alert.js"); Requirements::css("summit/bower_components/sweetalert/lib/sweet-alert.css"); Requirements::javascript("summit/javascript/summit.js"); // Summit pages are so different visually we don't pull in the main css file Requirements::block("themes/openstack/css/combined.css"); Requirements::css("summit/css/combined.css"); Requirements::css("themes/openstack/static/css/combined.css"); Requirements::css(Director::protocol() . '://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css?' . time()); }
/** * @return String The first available domain, with the current protocol prefixed, * suitable for redirections etc. */ public function getFullSiteDomainNormalized() { $domains = explode(',', $this->owner->FullSiteDomain); $domain = array_shift($domains); if (!$domain) { return false; } if (!parse_url($domain, PHP_URL_SCHEME)) { $domain = Director::protocol() . $domain; } return $domain; }
public function alternateAbsoluteLink($action = null) { $link = Director::absoluteURL($this->owner->Link($action)); if ($this->owner->hasExtension('Translatable')) { $targetLoc = $this->owner->Locale; $currLoc = Translatable::get_current_locale(); if ($targetLoc != $currLoc) { $link = Controller::join_links(Director::protocol() . LocaleDomains::getHostFromLocale($targetLoc), $this->owner->RelativeLink($action)); } } return $link; }
public function draw() { Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false"); Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js"); Requirements::javascript("marketplace/code/ui/frontend/js/oms.min.js"); Requirements::javascript("marketplace/code/ui/frontend/js/infobubble-compiled.js"); Requirements::javascript("marketplace/code/ui/frontend/js/google.maps.jquery.js"); Requirements::css("marketplace/code/ui/frontend/css/marketplace.css"); Requirements::javascript("marketplace/code/ui/frontend/js/consultant.page.js"); $this->consultant->setServicesAndRegions($this->region_repository); return Controller::curr()->Customise($this->consultant)->renderWith(array('ConsultantsDirectoryPage_consultant', 'ConsultantsDirectoryPage', 'MarketPlacePage')); }
function init() { parent::init(); // require custom CSS Requirements::css("themes/openstack/css/chosen.css"); Requirements::css("themes/openstack/css/jquery.autocomplete.css"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::combine_files('company_list.js', array("themes/openstack/javascript/chosen.jquery.min.js", "themes/openstack/javascript/jquery.autocomplete.min.js")); }
function init() { parent::init(); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); $css_files = array("themes/openstack/css/chosen.css", "registration/css/affiliations.css", 'registration/css/registration.page.css'); foreach ($css_files as $css_file) { Requirements::css($css_file); } Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::combine_files('registration.js', array("themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js", "themes/openstack/javascript/jquery.validate.custom.methods.js", "themes/openstack/javascript/chosen.jquery.min.js", "themes/openstack/javascript/pure.min.js", "themes/openstack/javascript/jquery.serialize.js", "themes/openstack/javascript/jquery.cleanform.js", "registration/javascript/affiliations.js", "registration/javascript/registration.page.js", "themes/openstack/javascript/tag-it.js")); }
public function init() { parent::init(); if ($this->ForceProtocol) { if ($this->ForceProtocol == 'http://' && Director::protocol() != 'http://') { return $this->redirect(preg_replace('#https://#', 'http://', $this->AbsoluteLink())); } elseif ($this->ForceProtocol == 'https://' && Director::protocol() != 'https://') { return $this->redirect(preg_replace('#http://#', 'https://', $this->AbsoluteLink())); } } if ($this->IFrameURL) { Requirements::javascript('iframe/javascript/iframe_page.js'); } }
function init() { parent::init(); //managers $this->factory = new EventRegistrationRequestFactory(); $this->event_registration_request_manager = new EventRegistrationRequestManager(new SapphireEventRegistrationRequestRepository(), new SapphireEventRepository(), $this->factory, new GoogleGeoCodingService(new SapphireGeoCodingQueryRepository(), new UtilFactory(), SapphireTransactionManager::getInstance()), new SapphireEventPublishingService(), new EventValidatorFactory(), SapphireTransactionManager::getInstance()); //js files Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::combine_files('event_registration_request_page.js', array("themes/openstack/javascript/chosen.jquery.min.js", "themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js", "themes/openstack/javascript/jquery.validate.custom.methods.js", 'events/js/event.registration.request.page.js')); }
private function commonScripts() { Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::css("events/css/sangria.page.view.event.details.css"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript("themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js"); Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js"); Requirements::javascript('marketplace/code/ui/admin/js/utils.js'); Requirements::javascript('themes/openstack/javascript/jquery.cleanform.js'); }
/** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { parent::updateCMSFields($fields); // Fix URLSegment field issue for root pages if (!SiteTree::config()->nested_urls || empty($this->owner->ParentID)) { $baseUrl = Director::baseURL(); if (class_exists('Subsite') && $this->owner->SubsiteID) { $baseUrl = Director::protocol() . $this->owner->Subsite()->domain() . '/'; } $baseLink = Director::absoluteURL(Controller::join_links($baseUrl, Fluent::alias(Fluent::current_locale()), '/')); $urlsegment = $fields->dataFieldByName('URLSegment'); $urlsegment->setURLPrefix($baseLink); } }
public function __construct($controller, $name, $actions) { Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); parent::__construct($controller, $name, $this->getSpeakerFields(), $actions, $this->getSpeakerValidator()); $script = <<<JS var form_validator_{$this->FormName()} = null; (function( \$ ){ \$(document).ready(function(){ form_validator_{$this->FormName()} = \$('#{$this->FormName()}').validate( { ignore:[], highlight: function(element) { \$(element).closest('.form-group').addClass('has-error'); }, unhighlight: function(element) { \$(element).closest('.form-group').removeClass('has-error'); }, errorElement: 'span', errorClass: 'help-block', errorPlacement: function(error, element) { if(element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } }, invalidHandler: function(form, validator) { if (!validator.numberOfInvalids()) return; var element = \$(validator.errorList[0].element); if(!element.is(":visible")){ element = element.parent(); } \$('html, body').animate({ scrollTop: element.offset().top }, 2000); }, }); \$("#SpeakerForm_BioForm_CountriesToTravel").chosen({width: '100%'}); }); // End of closure. }(jQuery )); JS; Requirements::customScript($script); }
/** * Returns text of link, either as entered for External or generated from Internal. If Internal an target page * isn't found then returns LinkAttributeExtension.InternalLink.MissingTarget message e.g. '[linked page not found]' type message * * @return string */ public function ResolvedLink() { $link = ''; if ($this->IsExternal()) { $externalLink = $this()->ExternalLink; if (!\Director::is_absolute_url($externalLink)) { $link = \Director::protocol() . $externalLink; } else { $link = $externalLink; } } elseif ($this()->InternalLink()) { $link = $this()->InternalLink()->Link(); } return $link; }