function PopupForm()
 {
     $form = new Form($this, "{$this->name}/PopupForm", new FieldList($headerWrap = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', 'Edit Source'))), $codeField = new CodeEditorField('TinyMCESource', '')), new FieldList(ResetFormAction::create('cancel', 'Cancel')->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true), FormAction::create('update', 'Update')->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     $headerWrap->addExtraClass('CompositeField composite cms-content-header nolabel ');
     //	$contentComposite->addExtraClass('tinymce-codeeditor-field content');
     $codeField->addExtraClass('nolabel stacked');
     $form->unsetValidator();
     $form->loadDataFrom($this);
     $form->addExtraClass('htmleditorfield-form htmleditorfield-codeform cms-dialog-content');
     //	$this->extend('updateLinkForm', $form);
     return $form;
 }
 /**
  * Get a search form for a single {@link DataObject} subclass.
  * 
  * @return Form
  */
 public function SearchForm()
 {
     $context = singleton($this->modelClass)->getDefaultSearchContext();
     $fields = $context->getSearchFields();
     $columnSelectionField = $this->ColumnSelectionField();
     $fields->push($columnSelectionField);
     $validator = new RequiredFields();
     $validator->setJavascriptValidationHandler('none');
     $form = new Form($this, "SearchForm", $fields, new FieldSet(new FormAction('search', _t('MemberTableField.SEARCH', 'Search')), $clearAction = new ResetFormAction('clearsearch', _t('ModelAdmin.CLEAR_SEARCH', 'Clear Search'))), $validator);
     //$form->setFormAction(Controller::join_links($this->Link(), "search"));
     $form->setFormMethod('get');
     $form->setHTMLID("Form_SearchForm_" . $this->modelClass);
     $form->disableSecurityToken();
     $clearAction->useButtonTag = true;
     $clearAction->addExtraClass('minorAction');
     return $form;
 }
Beispiel #3
0
 /**
  * Return a {@link Form} instance allowing a user to
  * add links in the TinyMCE content editor.
  *  
  * @return Form
  */
 public function LinkForm()
 {
     $siteTree = new TreeDropdownField('internal', _t('HtmlEditorField.PAGE', "Page"), 'SiteTree', 'ID', 'MenuTitle', true);
     // mimic the SiteTree::getMenuTitle(), which is bypassed when the search is performed
     $siteTree->setSearchFunction(array($this, 'siteTreeSearchCallback'));
     $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
     $form = new Form($this->controller, "{$this->name}/LinkForm", new FieldList($headerWrap = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.LINK', 'Insert Link')))), $contentComposite = new CompositeField(new OptionsetField('LinkType', sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.LINKTO', 'Link to')), array('internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'), 'external' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'), 'anchor' => _t('HtmlEditorField.LINKANCHOR', 'Anchor on this page'), 'email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'), 'file' => _t('HtmlEditorField.LINKFILE', 'Download a file')), 'internal'), new LiteralField('Step2', '<div class="step2">' . sprintf($numericLabelTmpl, '2', _t('HtmlEditorField.DETAILS', 'Details')) . '</div>'), $siteTree, new TextField('external', _t('HtmlEditorField.URL', 'URL'), 'http://'), new EmailField('email', _t('HtmlEditorField.EMAIL', 'Email address')), new TreeDropdownField('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), new TextField('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')), new TextField('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')), new CheckboxField('TargetBlank', _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')), new HiddenField('Locale', null, $this->controller->Locale))), new FieldList(ResetFormAction::create('remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true), FormAction::create('insert', _t('HtmlEditorField.BUTTONINSERTLINK', 'Insert link'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     $headerWrap->addExtraClass('CompositeField composite cms-content-header nolabel ');
     $contentComposite->addExtraClass('ss-insert-link content');
     $form->unsetValidator();
     $form->loadDataFrom($this);
     $form->addExtraClass('htmleditorfield-form htmleditorfield-linkform cms-dialog-content');
     $this->extend('updateLinkForm', $form);
     return $form;
 }
 function MyForm()
 {
     $form = Form::create($this, "MyForm", new FieldList(TextField::create("FirstName")->setTitle('First name')->setAttribute("placeholder", "Min. 3 znaky")->setAttribute("data-validation-required-message", "nezabudnite vpísať vaše meno")->setAttribute("required", true), TextField::create("Surname")->setTitle('Last name')->setMaxLength(50)->setAttribute("required", true), EmailField::create("Email")->setTitle("Email address")->setAttribute("required", true)->setAttribute("data-validation-email-message", "nezabudnite napísať existujúci majl")->setAttribute('type', 'email'), DropdownField::create("Cisla")->setTitle("Čísla")->setSource(array("jedna", "dva", "tri"))->addExtraClass("expand")->setEmptyString("musíš vybrať jedno numero"), CheckboxField::create("Donkey")->setTitle("Si donkey?"), CheckboxField::create("Donkey2")->setTitle("Si veľmi dlhý a vráskavý donkey s malými ušami?"), ReadonlyField::create("ReadOnly")->setTitle("Toto nezmeníte.... readonly")->setValue("nemeniteľné"), TextareaField::create("Text")->setTitle("Poznámka"), DateField::create("Dátum")->setConfig("showcalendar", true)->setConfig("jQueryUI.firstDay", 1)->setConfig("jQueryUI.dayNamesMin", array("Ne", "Po", "Ut", "St", "Št", "Pi", "So"))->setLocale('sk_SK'), DatetimeField::create('DátumČas', 'Dátum a čas')->setConfig('datavalueformat', 'yyyy-MM-dd HH:mm')->setConfig('showcalendar', 1), GroupedDropdownField::create("grouped")->setTitle("Zoskupený dropdown")->setSource(array("numbers" => array("1", "2", "3"), "letters" => array("a", "b", "c"))), OptionsetField::create("options")->setTitle("Čísla 2")->setSource(array("jedna", "dva", "tri")), HeaderField::create("header", "Toto je nadpis")->setTitle("overwritten nadpissss"), LiteralField::create("dataless", "html here")->setTitle("dataless")->setContent("<p>Or overwritten here</p><ul><li>item 1</li><li>item 2</li></ul>"), FileField::create("Nahraj")), new FieldList(FormAction::create("doMyForm")->setTitle("Odoslať")->addExtraClass("button radius"), ResetFormAction::create("resetMyForm", "Reset")->addExtraClass("button secondary small radius")), new RequiredFields("Email", "FirstName", "Text"))->setAttribute("novalidate", "novalidate")->addExtraClass("custom horizontal");
     return $form;
 }
Beispiel #5
0
 function SearchForm()
 {
     // get all page types in a dropdown-compatible format
     $pageTypes = SiteTree::page_type_classes();
     array_unshift($pageTypes, 'All');
     $pageTypes = array_combine($pageTypes, $pageTypes);
     asort($pageTypes);
     // get all filter instances
     $filters = ClassInfo::subclassesFor('CMSSiteTreeFilter');
     $filterMap = array();
     // remove base class
     array_shift($filters);
     // add filters to map
     foreach ($filters as $filter) {
         $filterMap[$filter] = call_user_func(array($filter, 'title'));
     }
     // ensure that 'all pages' filter is on top position
     uasort($filterMap, create_function('$a,$b', 'return ($a == "CMSSiteTreeFilter_Search") ? 1 : -1;'));
     $fields = new FieldSet(new TextField('Term', _t('CMSSearch.FILTERLABELTEXT', 'Content')), $dateGroup = new FieldGroup($dateFrom = new DateField('LastEditedFrom', _t('CMSSearch.FilterDateFrom', 'from')), $dateTo = new DateField('LastEditedTo', _t('CMSSearch.FilterDateFrom', 'to'))), new DropdownField('FilterClass', _t('CMSMain.SearchTreeFormPagesDropdown', 'Pages'), $filterMap), new DropdownField('ClassName', _t('CMSMain.PAGETYPEOPT', 'Page Type', PR_MEDIUM, 'Dropdown for limiting search to a page type'), $pageTypes, null, null, _t('CMSMain.PAGETYPEANYOPT', 'Any')));
     $dateGroup->subfieldParam = 'FieldHolder';
     $dateFrom->setConfig('showcalendar', true);
     $dateTo->setConfig('showcalendar', true);
     $actions = new FieldSet($resetAction = new ResetFormAction('clear', _t('CMSMain_left.ss.CLEAR', 'Clear')), $searchAction = new FormAction('doSearch', _t('CMSMain_left.ss.SEARCH', 'Search')));
     $resetAction->addExtraClass('ss-ui-action-minor');
     $form = new Form($this, 'SearchForm', $fields, $actions);
     $form->setFormMethod('GET');
     $form->disableSecurityToken();
     $form->unsetValidator();
     return $form;
 }
 public function SearchForm()
 {
     if ($this->modelClass != 'All') {
         $context = singleton($this->modelClass)->getDefaultSearchContext();
         $fields = $context->getSearchFields();
     } else {
         $fields = new FieldSet();
     }
     $fields->push(new DropdownField('State', 'State', array('unapproved' => 'Awaiting Moderation', 'approved' => 'Approved', 'spam' => 'Marked as Spam'), 'unapproved'));
     $fields->push(new HiddenField('Page', 'Page', 0));
     $form = new Form($this, "SearchForm", $fields, new FieldSet(new FormAction('search', _t('MemberTableField.SEARCH', 'Search')), $clearAction = new ResetFormAction('clearsearch', _t('ModelAdmin.CLEAR_SEARCH', 'Clear Search'))));
     $form->setFormMethod('get');
     $form->setHTMLID("Form_SearchForm_" . $this->modelClass);
     $clearAction->useButtonTag = true;
     $clearAction->addExtraClass('minorAction');
     return $form;
 }