/**
  * 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);
 }
 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;
 }
 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;
 }
 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');
 }
 /**
  * @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);
 }
Esempio n. 6
0
 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 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;
 }
 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");
 }
 /**
  * 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();
 }
Esempio n. 10
0
    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;
    }
 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');
 }
 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');
 }
 public function Field($properties = array())
 {
     Requirements::javascript(BOLTTOOLS_DIR . '/javascript/addnewlistboxfield.js');
     $this->setTemplate('AddNewListboxField');
     $this->addExtraClass('has-chzn');
     return parent::Field($properties);
 }
 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 . '
                 });
             });
         ');
     }
 }
 /**
  * @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;
 }
 public function Field($properties = array())
 {
     FormExtraJquery::include_jquery();
     FormExtraJquery::include_accounting();
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/AccountingField.js');
     return parent::Field($properties);
 }
Esempio n. 17
0
    function Field()
    {
        Requirements::javascript("jsparty/calendar/calendar.js");
        Requirements::javascript("jsparty/calendar/lang/calendar-en.js");
        Requirements::javascript("jsparty/calendar/calendar-setup.js");
        Requirements::css("sapphire/css/CalendarDateField.css");
        Requirements::css("jsparty/calendar/calendar-win2k-1.css");
        Requirements::javascript("sapphire/javascript/CalendarDateField.js");
        $field = DateField::Field();
        $id = $this->id();
        $val = $this->attrValue();
        if (preg_match('/^\\d{2}\\/\\d{2}\\/\\d{4}$/', $val)) {
            $dateArray = explode('/', $val);
            $val = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0];
        }
        $dateArray = explode('-', $val);
        $day = $dateArray[2];
        $month = $dateArray[1];
        $year = $dateArray[0];
        preg_match('/(.*)[(.+)]$/', $this->name, $fieldNameParts);
        $fieldNamePrefix = $fieldNameParts[1];
        $fieldName = $fieldNameParts[2];
        return <<<HTML
\t\t\t<div class="dmycalendardate">
\t\t\t\t<input type="hidden" id="{$id}" name="{$this->name}" value="{$val}" />
\t\t\t\t<input type="text" id="{$id}-day" class="day numeric" name="{$fieldNamePrefix}[{$fieldName}-Day]" value="{$day}" maxlength="2" />/
\t\t\t\t<input type="text" id="{$id}-month" class="month numeric" name="{$fieldNamePrefix}[{$fieldName}-Month]" value="{$month}" maxlength="2" />/
\t\t\t\t<input type="text" id="{$id}-year" class="year numeric" name="{$fieldNamePrefix}[{$fieldName}-Year]" value="{$year}" maxlength="4" />
\t\t\t\t<div class="calendarpopup" id="{$id}-calendar"></div>
\t\t\t</div>
HTML;
    }
 /**
  * Requiring the combined js/css files- can be separate library files
  * @param array $libArr
  */
 private static function process_combined($libArr, $type)
 {
     //Debug::dump($libArr);
     $theme = self::$theme;
     //Defining library files
     foreach ($libArr as $lib => $arr) {
         $files = array();
         foreach ($arr as $str) {
             $files[] = self::replace_vars($str);
         }
         foreach ($files as $f) {
             if ($type == 'javascript') {
                 Requirements::javascript($f);
             } elseif ($type == 'css') {
                 Requirements::css($f);
             }
         }
         if ($type == 'javascript') {
             $libName = "{$theme}/{$lib}.js";
         } elseif ($type == 'css') {
             $libName = "{$theme}/{$lib}.css";
         }
         Requirements::combine_files($libName, $files);
     }
 }
Esempio n. 19
0
 public function Field($properties = array())
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript(SORTABLEFILE_DIR . '/javascript/SortableUploadField.js');
     Requirements::css(SORTABLEFILE_DIR . '/css/SortableUploadField.css');
     return parent::Field($properties);
 }
 /**
  * Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
  * @param GridField $gridField Grid Field Reference
  * @return Array Map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
  */
 public function getHTMLFragments($gridField)
 {
     $dataList = $gridField->getList();
     if (class_exists('UnsavedRelationList') && $dataList instanceof UnsavedRelationList) {
         return array();
     }
     $state = $gridField->State->GridFieldSortableRows;
     if (!is_bool($state->sortableToggle)) {
         $state->sortableToggle = false;
     }
     //Ensure user can edit
     if (!singleton($gridField->getModelClass())->canEdit()) {
         return array();
     }
     //Sort order toggle
     $sortOrderToggle = GridField_FormAction::create($gridField, 'sortablerows-toggle', 'sorttoggle', 'sortableRowsToggle', null)->addExtraClass('sortablerows-toggle');
     $sortOrderSave = GridField_FormAction::create($gridField, 'sortablerows-savesort', 'savesort', 'saveGridRowSort', null)->addExtraClass('sortablerows-savesort');
     //Sort to Page Action
     $sortToPage = GridField_FormAction::create($gridField, 'sortablerows-sorttopage', 'sorttopage', 'sortToPage', null)->addExtraClass('sortablerows-sorttopage');
     $data = array('SortableToggle' => $sortOrderToggle, 'SortOrderSave' => $sortOrderSave, 'SortToPage' => $sortToPage, 'Checked' => $state->sortableToggle == true ? ' checked = "checked"' : '', 'List' => $dataList);
     $forTemplate = new ArrayData($data);
     //Inject Requirements
     $custom = Config::inst()->get('GridFieldSortableRows', 'Base');
     $base = $custom ?: SORTABLE_GRIDFIELD_BASE;
     Requirements::css($base . '/css/GridFieldSortableRows.css');
     Requirements::javascript($base . '/javascript/GridFieldSortableRows.js');
     $args = array('Colspan' => count($gridField->getColumns()), 'ID' => $gridField->ID(), 'DisableSelection' => $this->disable_selection);
     $fragments = array('header' => $forTemplate->renderWith('GridFieldSortableRows', $args));
     if ($gridField->getConfig()->getComponentByType('GridFieldPaginator')) {
         $fragments['after'] = $forTemplate->renderWith('GridFieldSortableRows_paginator');
     }
     return $fragments;
 }
    public function __construct($controller, $name, FieldList $fields, FieldList $actions, $validator = null)
    {
        parent::__construct($controller, $name, $fields, $actions, $validator);
        Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-form/jquery.form.js');
        $name = $this->FormName();
        $action = $this->FormAction();
        $loading = _t('BootstrapAjaxForm.LOADING', 'BootstrapAjaxForm.LOADING');
        $js = <<<JS
(function(\$){
    \$(function(){
        \$('#{$name}').ajaxForm({
            delegation: true,
            target: '#AjaxForm_{$name}',
            beforeSubmit: function(data, form, options){
                \$('#{$name} [type=submit]').prop("disabled", true).html('{$loading}');
            }
\t});
    });
})(jQuery);
JS;
        Requirements::customScript($js, 'BootstrapAjaxForm_Js_' . $this->FormName());
        if (!Director::is_ajax()) {
            $this->setTemplate('BootstrapAjaxForm');
        }
    }
    public function Field($properties = array())
    {
        $content = '';
        Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
        Requirements::javascript(FRAMEWORK_DIR . "/javascript/ToggleField.js");
        if ($this->startClosed) {
            $this->addExtraClass('startClosed');
        }
        $valforInput = $this->value ? Convert::raw2att($this->value) : "";
        $rawInput = Convert::html2raw($valforInput);
        if ($this->charNum) {
            $reducedVal = substr($rawInput, 0, $this->charNum);
        } else {
            $reducedVal = DBField::create_field('Text', $rawInput)->{$this->truncateMethod}();
        }
        // only create togglefield if the truncated content is shorter
        if (strlen($reducedVal) < strlen($rawInput)) {
            $content = <<<HTML
\t\t\t<div class="readonly typography contentLess" style="display: none">
\t\t\t\t{$reducedVal}
\t\t\t\t&nbsp;<a href="#" class="triggerMore">{$this->labelMore}</a>
\t\t\t</div>
\t\t\t<div class="readonly typography contentMore">
\t\t\t\t{$this->value}
\t\t\t\t&nbsp;<a href="#" class="triggerLess">{$this->labelLess}</a>
\t\t\t</div>\t
\t\t\t<br />
\t\t\t<input type="hidden" name="{$this->name}" value="{$valforInput}" />
HTML;
        } else {
            $this->dontEscape = true;
            $content = parent::Field();
        }
        return $content;
    }
Esempio n. 23
0
 public function initialize()
 {
     Requirements::javascript('jsparty/jquery/jquery.js');
     Requirements::javascript('image_gallery/gallery_ui/prettyphoto/javascript/jquery.prettyPhoto.js');
     Requirements::javascript('image_gallery/gallery_ui/prettyphoto/javascript/prettyphoto_init.js');
     Requirements::css('image_gallery/gallery_ui/prettyphoto/css/prettyPhoto.css');
 }
 public function onAfterInit()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
     Requirements::javascript("silverstripe-accordian-content/assets/javascript/main.js");
     Requirements::css("silverstripe-accordian-content/assets/css/styles.css");
 }
 public function FieldHolder()
 {
     Requirements::javascript('dataobject_manager/javascript/jquery.wysiwyg.js');
     Requirements::css('dataobject_manager/css/jquery.wysiwyg.css');
     Requirements::customScript("\n\t\t\t\$(function() {\n\t\t\t\t\$('#{$this->id()}').wysiwyg({\n\t\t\t\t\t{$this->getConfig()}\n\t\t\t\t}).parents('.simplehtmleditor').removeClass('hidden');\n\t\t\t\t\n\t\t\t});\n\t\t");
     return parent::FieldHolder();
 }
Esempio n. 26
0
 public function __construct($controller, $name, $fields = null, $actions = null, $validator = null)
 {
     if (!$fields) {
         $helpHtml = _t('MemberImportForm.Help1', '<p>Import users in <em>CSV format</em> (comma-separated values).' . ' <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>');
         $helpHtml .= _t('MemberImportForm.Help2', '<div class="advanced">' . '<h4>Advanced usage</h4>' . '<ul>' . '<li>Allowed columns: <em>%s</em></li>' . '<li>Existing users are matched by their unique <em>Code</em> property, and updated with any new values from ' . 'the imported file.</li>' . '<li>Groups can be assigned by the <em>Groups</em> column. Groups are identified by their <em>Code</em> property, ' . 'multiple groups can be separated by comma. Existing group memberships are not cleared.</li>' . '</ul>' . '</div>');
         $importer = new MemberCsvBulkLoader();
         $importSpec = $importer->getImportSpec();
         $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields'])));
         $fields = new FieldList(new LiteralField('Help', $helpHtml), $fileField = new FileField('CsvFile', _t('SecurityAdmin_MemberImportForm.FileFieldLabel', 'CSV File <small>(Allowed extensions: *.csv)</small>')));
         $fileField->getValidator()->setAllowedExtensions(array('csv'));
     }
     if (!$actions) {
         $action = new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import from CSV'));
         $action->addExtraClass('ss-ui-button');
         $actions = new FieldList($action);
     }
     if (!$validator) {
         $validator = new RequiredFields('CsvFile');
     }
     parent::__construct($controller, $name, $fields, $actions, $validator);
     Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js');
     $this->addExtraClass('cms');
     $this->addExtraClass('import-form');
 }
 function init()
 {
     if (!Permission::check('ADMIN')) {
         Requirements::css('iq-security/css/iq-security.css');
     }
     Requirements::javascript('iq-security/javascript/iq-security.js');
 }
 public function init()
 {
     if (!$this->currentDashboard) {
         Restrictable::set_enabled(false);
         if (Member::currentUserID()) {
             Restrictable::set_enabled(true);
             $this->currentDashboard = $this->getDashboard();
         }
         Restrictable::set_enabled(true);
     }
     parent::init();
     if ($this->currentDashboard && !$this->currentDashboard->checkPerm('View')) {
         if (!Member::currentUserID() && !$this->redirectedTo()) {
             Security::permissionFailure($this, "You must be logged in");
             return;
         }
     }
     Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('frontend-dashboards/javascript/jquery-1.10.2.min.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript('frontend-dashboards/thirdparty/jquery-cookie/jquery.cookie.js');
     Requirements::javascript(FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js');
     Requirements::javascript('frontend-dashboards/javascript/dashboards.js');
     Requirements::javascript('frontend-dashboards/javascript/dashboard-dialogs.js');
     Requirements::css('frontend-dashboards/css/dashboards.css');
     Requirements::javascript('frontend-dashboards/javascript/jquery.gridster.js');
     Requirements::css('frontend-dashboards/css/jquery.gridster.css');
     //		Requirements::javascript('frontend-dashboards/javascript/jquery.gridly.js');
     //		Requirements::css('frontend-dashboards/css/jquery.gridly.css');
 }
	function FieldHolder() {
		$ret = parent::FieldHolder();
		
		Requirements::javascript(CMS_DIR . '/javascript/AssetTableField.js');

		return $ret;
	}
 /**
  * @param array $properties
  *
  * @return string - HTML
  */
 public function FieldHolder($properties = array())
 {
     $moduleDir = substr(Director::makeRelative(dirname(dirname(dirname(__FILE__)))), 1);
     Requirements::css($moduleDir . '/css/WidgetAreaEditor.css');
     Requirements::javascript($moduleDir . '/javascript/WidgetAreaEditor.js');
     return $this->renderWith("WidgetAreaEditor");
 }