本文整理汇总了PHP中Requirements::javascript方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::javascript方法的具体用法?PHP Requirements::javascript怎么用?PHP Requirements::javascript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirements
的用法示例。
在下文中一共展示了Requirements::javascript方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Returns an instance of this class
*
* @param Controller $controller
* @param string $name
*/
public function __construct($controller, $name)
{
$fields = new FieldList(array(new HiddenField('AuthenticationMethod', null, $this->authenticator_class)));
$actions = new FieldList(array(FormAction::create('redirectToRealMe', _t('RealMeLoginForm.LOGINBUTTON', 'LoginAction'))->setUseButtonTag(true)->setButtonContent('<span class="realme_button_padding">Login or register with RealMe<span class="realme_icon_new_window"></span> <span class="realme_icon_padlock"></span>')->setAttribute('class', 'realme_button')));
// Taken from MemberLoginForm
if (isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} elseif (Session::get('BackURL')) {
$backURL = Session::get('BackURL');
}
if (isset($backURL)) {
// Ensure that $backURL isn't redirecting us back to login form or a RealMe authentication page
if (strpos($backURL, 'Security/login') === false && strpos($backURL, 'Security/realme') === false) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
}
// optionally include requirements {@see /realme/_config/config.yml}
if ($this->config()->include_jquery) {
Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
}
if ($this->config()->include_javascript) {
Requirements::javascript(REALME_MODULE_PATH . "/javascript/realme.js");
}
if ($this->config()->include_css) {
Requirements::css(REALME_MODULE_PATH . "/css/realme.css");
}
parent::__construct($controller, $name, $fields, $actions);
}
示例2: Field
function Field()
{
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/ConfirmedPasswordField.js');
$content = '';
if ($this->showOnClick) {
if ($this->showOnClickTitle) {
$title = $this->showOnClickTitle;
} else {
$title = _t('ConfirmedPasswordField.SHOWONCLICKTITLE', 'Change Password', PR_MEDIUM, 'Label of the link which triggers display of the "change password" formfields');
}
$content .= "<div class=\"showOnClick\">\n";
$content .= "<a href=\"#\"" . $this->getTabIndexHTML() . ">{$title}</a>\n";
$content .= "<div class=\"showOnClickContainer\">";
}
foreach ($this->children as $field) {
$field->setDisabled($this->isDisabled());
$field->setReadonly($this->isReadonly());
$content .= $field->FieldHolder();
}
if ($this->showOnClick) {
$content .= "</div>\n";
$content .= "</div>\n";
}
return $content;
}
示例3: FieldHolder
public function FieldHolder($properties = array())
{
Requirements::css(LINKABLE_PATH . '/css/embeddedobjectfield.css');
Requirements::javascript(LINKABLE_PATH . '/javascript/embeddedobjectfield.js');
if ($this->object && $this->object->ID) {
$properties['SourceURL'] = TextField::create($this->getName() . '[sourceurl]', '')->setAttribute('placeholder', _t('Linkable.SOURCEURL', 'Source URL'));
if (strlen($this->object->SourceURL)) {
$properties['ObjectTitle'] = TextField::create($this->getName() . '[title]', _t('Linkable.TITLE', 'Title'));
$properties['Width'] = TextField::create($this->getName() . '[width]', _t('Linkable.WIDTH', 'Width'));
$properties['Height'] = TextField::create($this->getName() . '[height]', _t('Linkable.HEIGHT', 'Height'));
$properties['ThumbURL'] = HiddenField::create($this->getName() . '[thumburl]', '');
$properties['Type'] = HiddenField::create($this->getName() . '[type]', '');
$properties['EmbedHTML'] = HiddenField::create($this->getName() . '[embedhtml]', '');
$properties['ObjectDescription'] = TextAreaField::create($this->getName() . '[description]', _t('Linkable.DESCRIPTION', 'Description'));
$properties['ExtraClass'] = TextField::create($this->getName() . '[extraclass]', _t('Linkable.CSSCLASS', 'CSS class'));
foreach ($properties as $key => $field) {
if ($key == 'ObjectTitle') {
$key = 'Title';
} elseif ($key == 'ObjectDescription') {
$key = 'Description';
}
$field->setValue($this->object->{$key});
}
if ($this->object->ThumbURL) {
$properties['ThumbImage'] = LiteralField::create($this->getName(), '<img src="' . $this->object->ThumbURL . '" />');
}
}
} else {
$properties['SourceURL'] = TextField::create($this->getName() . '[sourceurl]', '')->setAttribute('placeholder', _t('Linkable.SOURCEURL', 'Source URL'));
}
$field = parent::FieldHolder($properties);
return $field;
}
示例4: init
function init()
{
parent::init();
Requirements::css('newsletter/css/SubscriptionPage.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-validate/jquery.validate.min.js');
}
示例5: InviteForm
/**
* @return Form
*/
public function InviteForm()
{
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js');
Requirements::javascript('eventmanagement/javascript/EventInvitationField_invite.js');
if ($times = $this->form->getRecord()->DateTimes()) {
$times = $times->map('ID', 'Summary');
} else {
$times = array();
}
// Get past date times attached to the parent calendar, so we can get
// all registered members from them.
$past = DataObject::get('RegisterableDateTime', sprintf('"CalendarID" = %d AND "StartDate" < \'%s\'', $this->form->getRecord()->CalendarID, date('Y-m-d')));
if ($past) {
$pastTimes = array();
foreach ($past->groupBy('EventID') as $value) {
$pastTimes[$value->First()->EventTitle()] = $value->map('ID', 'Summary');
}
} else {
$pastTimes = array();
}
$fields = new Tab('Main', new HeaderField('Select A Date/Time To Invite To'), new DropdownField('TimeID', '', $times, null, null, true), new HeaderField('AddPeopleHeader', 'Add People To Invite From'), new SelectionGroup('AddPeople', array('From a member group' => $group = new DropdownField('GroupID', '', DataObject::get('Group')->map(), null, null, true), 'From a past event' => $time = new GroupedDropdownField('PastTimeID', '', $pastTimes, null, null, true))), new HeaderField('EmailsToSendHeader', 'People To Send Invite To'), $emails = new TableField('Emails', 'EventInvitation', array('Name' => 'Name', 'Email' => 'Email Address'), array('Name' => 'TextField', 'Email' => 'TextField')));
$group->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromgroup')));
$time->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromtime')));
$emails->setCustomSourceItems(new DataObjectSet());
$fields = new FieldSet(new TabSet('Root', $fields));
$validator = new RequiredFields('TimeID');
return new Form($this, 'InviteForm', $fields, new FieldSet(new FormAction('doInvite', 'Invite')), $validator);
}
示例6: init
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()));
}
}
示例7: MarketPlaceReviewForm
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;
}
示例8: FieldHolder
function FieldHolder()
{
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/SelectionGroup.js');
Requirements::css(SAPPHIRE_DIR . '/css/SelectionGroup.css');
return $this->renderWith("SelectionGroup");
}
示例9: Field
/**
* Renders the button, includes the JS and CSS
* @param array $properties
*/
public function Field($properties = array())
{
Requirements::css(BETTER_BUTTONS_DIR . '/css/dropdown_form_action.css');
Requirements::javascript(BETTER_BUTTONS_DIR . '/javascript/dropdown_form_action.js');
$this->setAttribute('data-form-action-dropdown', '#' . $this->DropdownID());
return parent::Field();
}
示例10: FieldHolder
function FieldHolder()
{
Requirements::javascript("sapphire/javascript/ReportField.js");
$headerHTML = $this->columnheaders();
$dataCellHTML = $this->datacells();
$id = $this->id() . '_exportToCSV';
if ($this->export) {
$exportButton = <<<HTML
<input name="{$id}" type="submit" id="{$id}" class="ReportField_ExportToCSVButton" value="Export to CSV" />
HTML;
} else {
$exportButton = "";
}
// display the table of results
$html = <<<HTML
<div style="width: 98%; overflow: auto">
\t{$exportButton}
<table class="ReportField" summary="">
\t<thead>
\t\t{$headerHTML}
\t</thead>
\t<tbody>
\t\t{$dataCellHTML}
\t</tbody>
</table>
</div>
HTML;
return $html;
}
示例11: index
public function index()
{
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::customCSS('#OrphanIDs .middleColumn {width: auto;}');
Requirements::customCSS('#OrphanIDs label {display: inline;}');
return $this->renderWith('BlankPage');
}
示例12: init
public function init()
{
parent::init();
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SS3GALLERY_DIR . '/javascript/ss3Gallery.js');
Requirements::css(SS3GALLERY_DIR . '/css/ss3Gallery.css');
}
示例13: Field
public function Field($properties = array())
{
Requirements::javascript(BOLTTOOLS_DIR . '/javascript/addnewlistboxfield.js');
$this->setTemplate('AddNewListboxField');
$this->addExtraClass('has-chzn');
return parent::Field($properties);
}
示例14: init
public function init()
{
parent::init();
$themeDir = SSViewer::get_theme_folder();
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
if (Locator::getLocations()) {
Requirements::javascript('http://maps.google.com/maps/api/js?sensor=false');
Requirements::javascript('locator/thirdparty/handlebars/handlebars-v1.3.0.js');
Requirements::javascript('locator/thirdparty/jquery-store-locator/js/jquery.storelocator.js');
}
Requirements::css('locator/css/map.css');
$featured = Locator::getLocations(array('Featured' => 1))->count() > 0 ? 'featuredLocations: true' : 'featuredLocations: false';
// map config based on user input in Settings tab
// AutoGeocode or Full Map
$load = $this->data()->AutoGeocode ? 'autoGeocode: true, fullMapStart: false,' : 'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
$base = Director::baseFolder();
$themePath = $base . '/' . $themeDir;
$listTemplatePath = file_exists($themePath . '/templates/location-list-description.html') ? $themeDir . '/templates/location-list-description.html' : 'locator/templates/location-list-description.html';
$infowindowTemplatePath = file_exists($themePath . '/templates/infowindow-description.html') ? $themeDir . '/templates/infowindow-description.html' : 'locator/templates/infowindow-description.html';
// in page or modal
$modal = $this->data()->ModalWindow ? 'modalWindow: true' : 'modalWindow: false';
$kilometer = $this->data()->Unit == 'km' ? 'lengthUnit: "km"' : 'lengthUnit: "m"';
$link = $this->Link() . 'xml.xml';
// init map
if (Locator::getLocations()) {
Requirements::customScript("\n \$(function(\$) {\n \$('#map-container').storeLocator({\n " . $load . "\n dataLocation: '" . $link . "',\n listTemplatePath: '" . $listTemplatePath . "',\n infowindowTemplatePath: '" . $infowindowTemplatePath . "',\n originMarker: true,\n " . $modal . ',
' . $featured . ",\n slideMap: false,\n zoomLevel: 0,\n distanceAlert: 120,\n formID: 'Form_LocationSearch',\n inputID: 'Form_LocationSearch_address',\n categoryID: 'Form_LocationSearch_category',\n distanceAlert: -1,\n " . $kilometer . '
});
});
');
}
}
示例15: getEditForm
/**
* @return Form
* @todo what template is used here? AssetAdmin_UploadContent.ss doesn't seem to be used anymore
*/
public function getEditForm($id = null, $fields = null)
{
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
$folder = $this->currentPage();
$uploadField = UploadField::create('AssetUploadField', '');
$uploadField->setConfig('previewMaxWidth', 40);
$uploadField->setConfig('previewMaxHeight', 30);
$uploadField->setConfig('changeDetection', false);
$uploadField->addExtraClass('ss-assetuploadfield');
$uploadField->removeExtraClass('ss-uploadfield');
$uploadField->setTemplate('AssetUploadField');
if ($folder->exists() && $folder->getFilename()) {
// The Upload class expects a folder relative *within* assets/
$path = preg_replace('/^' . ASSETS_DIR . '\\//', '', $folder->getFilename());
$uploadField->setFolderName($path);
} else {
$uploadField->setFolderName('/');
// root of the assets
}
$exts = $uploadField->getValidator()->getAllowedExtensions();
asort($exts);
$uploadField->Extensions = implode(', ', $exts);
$form = CMSForm::create($this, 'EditForm', new FieldList($uploadField, new HiddenField('ID')), new FieldList())->setHTMLID('Form_EditForm');
$form->setResponseNegotiator($this->getResponseNegotiator());
$form->addExtraClass('center cms-edit-form ' . $this->BaseCSSClasses());
// Don't use AssetAdmin_EditForm, as it assumes a different panel structure
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->Fields()->push(new LiteralField('BackLink', sprintf('<a href="%s" class="backlink ss-ui-button cms-panel-link" data-icon="back">%s</a>', Controller::join_links(singleton('AssetAdmin')->Link('show'), $folder ? $folder->ID : 0), _t('AssetAdmin.BackToFolder', 'Back to folder'))));
$form->loadDataFrom($folder);
return $form;
}