Ejemplo n.º 1
0
 public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
 {
     $page = Administration::instance()->Page;
     $page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/bbcww_api_client/assets/view.js'));
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $right = $layout->createColumn(Layout::LARGE);
     $fieldset = Widget::Fieldset(__('Essentials'));
     $label = Widget::Label(__('Name'));
     $label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
     if (isset($errors->{'about::name'})) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
     } else {
         $fieldset->appendChild($label);
     }
     $field_groups = $options = array();
     foreach ($this->driver->getMemberSections() as $section) {
         $source = $section->{'api-source'};
         $field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section);
         if (!isset($options[$source])) {
             $options[$source] = array('label' => ucwords(strtr($source, '-', ' ')), 'options' => array());
         }
         $options[$source]['options'][] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
     }
     $label = Widget::Label(__('Section'));
     $label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
     $fieldset->appendChild($label);
     $left->appendChild($fieldset);
     $fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
     foreach ($this->driver->getMemberSections() as $section) {
         $this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
     }
     $right->appendChild($fieldset);
     $layout->appendTo($wrapper);
 }
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     $wrapper->appendChild(new XMLElement('h4', ucwords($this->name())));
     $wrapper->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][type]', $this->handle(), 'hidden'));
     if ($this->get('id')) {
         $wrapper->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][id]', $this->get('id'), 'hidden'));
     }
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Label (fixed)'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][label]', 'Entry Versions', null, array('readonly' => 'readonly')));
     if (isset($errors['label'])) {
         $div->appendChild(Widget::wrapFormElementWithError($label, $errors['label']));
     } else {
         $div->appendChild($label);
     }
     $div->appendChild($this->buildLocationSelect($this->get('location'), 'fields[' . $this->get('sortorder') . '][location]'));
     $wrapper->appendChild($div);
     $order = $this->get('sortorder');
     $label = Widget::Label();
     $input = Widget::Input("fields[{$order}][hide_in_publish]", 'yes', 'checkbox');
     if ($this->get('show_in_publish') == 'no') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Hide version history list on publish page');
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
 }
Ejemplo n.º 3
0
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = NULL;
     if (isset($data['value'])) {
         $value = is_array($data['value']) ? self::__tagArrayToString($data['value']) : $data['value'];
     }
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
     if ($this->get('pre_populate_source') != NULL) {
         $existing_tags = $this->findAllTags();
         if (is_array($existing_tags) && !empty($existing_tags)) {
             $taglist = new XMLElement('ul');
             $taglist->setAttribute('class', 'tags');
             foreach ($existing_tags as $tag) {
                 $taglist->appendChild(new XMLElement('li', $tag));
             }
             $wrapper->appendChild($taglist);
         }
     }
 }
Ejemplo n.º 4
0
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = isset($data['author_id']) ? $data['author_id'] : NULL;
     if (!is_array($value)) {
         $value = array($value);
     }
     if (!$value) {
         $value = $this->_engine->getAuthorID();
     }
     $authorManager = new AuthorManager($this->_engine);
     $authors = $authorManager->fetch();
     $options = array();
     foreach ($authors as $a) {
         $options[] = array($a->get('id'), in_array($a->get('id'), $value), $a->get('first_name') . ' ' . $a->get('last_name'));
     }
     $fieldname = 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix;
     if ($this->get('allow_multiple_selection') == 'yes') {
         $fieldname .= '[]';
     }
     $attr = array();
     if ($this->get('allow_multiple_selection') == 'yes') {
         $attr['multiple'] = 'multiple';
     }
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Select($fieldname, $options, $attr));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $label = Widget::Label($this->get('label'));
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', __('Optional')));
     }
     $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $this->get('size'), '50', strlen($data['value']) != 0 ? General::sanitize($data['value']) : NULL);
     if ($this->get('formatter') != 'none') {
         $textarea->setAttribute('class', $this->get('formatter'));
     }
     /**
      * Allows developers modify the textarea before it is rendered in the publish forms
      * 
      * @delegate ModifyTextareaFieldPublishWidget
      * @param string $context
      * '/backend/'
      * @param Field $field
      * @param Widget $label
      * @param Widget $textarea
      */
     Symphony::ExtensionManager()->notifyMembers('ModifyTextareaFieldPublishWidget', '/backend/', array('field' => &$this, 'label' => &$label, 'textarea' => &$textarea));
     $label->appendChild($textarea);
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 6
0
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = isset($data['author_id']) ? $data['author_id'] : NULL;
     $callback = Administration::instance()->getPageCallback();
     if ($this->get('default_to_current_user') == 'yes' && empty($data) && empty($_POST)) {
         $value = array(Administration::instance()->Author->get('id'));
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $authors = AuthorManager::fetch();
     $options = array();
     foreach ($authors as $a) {
         $options[] = array($a->get('id'), in_array($a->get('id'), $value), $a->get('first_name') . ' ' . $a->get('last_name'));
     }
     $fieldname = 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix;
     if ($this->get('allow_multiple_selection') == 'yes') {
         $fieldname .= '[]';
     }
     $attr = array();
     if ($this->get('allow_multiple_selection') == 'yes') {
         $attr['multiple'] = 'multiple';
     }
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Select($fieldname, $options, $attr));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $note = isset($data['value']) ? $data['value'] : $this->get('note');
     $editable = $this->get('editable');
     # Add <div>
     $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
     $wrapper->appendChild($div);
     # Editable
     if (isset($editable) && $editable) {
         $wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
         $edit = new XMLElement("a", "Edit note", array("class" => "publishnotes-edit", "href" => "#edit"));
         $wrapper->appendChild($edit);
         # Add <textarea>
         $label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
         $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, '50', strlen($note) != 0 ? General::sanitize($note) : NULL);
         $label->appendChild($textarea);
         $control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
         $label->appendChild($control);
         if ($flagWithError != NULL) {
             $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
         } else {
             $wrapper->appendChild($label);
         }
     }
 }
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $sectionManager = new SectionManager($this->_engine);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $options = array();
     // iterate over sections to build list of fields
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $section) {
             $section_fields = $section->fetchFields();
             if (!is_array($section_fields)) {
                 continue;
             }
             $fields = array();
             foreach ($section_fields as $f) {
                 // only show select box link fields
                 if ($f->get('type') == 'selectbox_link') {
                     $fields[] = array($f->get('id'), $this->get('related_sbl_id') == $f->get('id'), $f->get('label'));
                 }
             }
             if (!empty($fields)) {
                 $options[] = array('label' => $section->get('name'), 'options' => $fields);
             }
         }
     }
     $group = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label(__('Child Select Box Link'));
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_sbl_id]', $options));
     if (isset($errors['related_sbl_id'])) {
         $group->appendChild(Widget::wrapFormElementWithError($label, $errors['related_sbl_id']));
     } else {
         $group->appendChild($label);
     }
     $wrapper->appendChild($group);
 }
Ejemplo n.º 9
0
 public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
 {
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $right = $layout->createColumn(Layout::LARGE);
     //	Essentials --------------------------------------------------------
     $fieldset = Widget::Fieldset(__('Essentials'));
     // Name:
     $label = Widget::Label(__('Name'));
     $input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
     $label->appendChild($input);
     if (isset($errors->{'about::name'})) {
         $label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
     }
     $fieldset->appendChild($label);
     $left->appendChild($fieldset);
     $fieldset = Widget::Fieldset(__('Content'));
     $label = Widget::Label(__('Source XML'));
     $input = Widget::Textarea('fields[xml]', $this->parameters()->{'xml'}, array('rows' => '24', 'cols' => '50', 'class' => 'code'));
     $label->appendChild($input);
     if (isset($errors->{'xml'})) {
         $label = Widget::wrapFormElementWithError($label, $errors->{'xml'});
     }
     $fieldset->appendChild($label);
     $right->appendChild($fieldset);
     $layout->appendTo($wrapper);
 }
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     $order = $this->get('sortorder');
     $label = Widget::Label(__('Point <code>@links</code> to'));
     $label->appendChild(Widget::Select("fields[{$order}][linked_field_id]", $this->findOptions()));
     if (isset($errors['linked_field_id'])) {
         $label = Widget::wrapFormElementWithError($label, $errors['linked_field_id']);
     }
     parent::displaySettingsPanel($wrapper, $errors, null, $label);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $label = Widget::Label($this->get('label'));
     $name = $this->get('element_name');
     $input = Widget::Input("fields{$prefix}[{$name}]{$postfix}", strlen($data['value']) != 0 ? General::sanitize($data['value']) : null);
     $label->appendChild($input);
     if ($error != null) {
         $label = Widget::wrapFormElementWithError($label, $error);
     }
     $wrapper->appendChild($label);
 }
Ejemplo n.º 12
0
 public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
 {
     $page = Administration::instance()->Page;
     $page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'));
     $layout = new Layout();
     $column_1 = $layout->createColumn(Layout::SMALL);
     $column_2 = $layout->createColumn(Layout::SMALL);
     $column_3 = $layout->createColumn(Layout::LARGE);
     $fieldset = Widget::Fieldset(__('Essentials'));
     $label = Widget::Label(__('Name'));
     $label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
     if (isset($errors->{'about::name'})) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
     } else {
         $fieldset->appendChild($label);
     }
     $label = Widget::Label(__('Section'));
     $options = array();
     foreach (new SectionIterator() as $section) {
         $options[] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
     }
     $label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
     $fieldset->appendChild($label);
     $column_1->appendChild($fieldset);
     $fieldset = Widget::Fieldset(__('Processing Options'));
     $label = Widget::Label(__('Filter Rules'));
     $filters = $this->parameters()->filters;
     if (!is_array($filters)) {
         $filters = array();
     }
     $options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple')));
     ###
     # Delegate: AppendEventFilter
     # Description: Allows adding of new filter rules to the Event filter
     # rule select box. A reference to the $options array is provided, and selected filters
     Extension::notify('AppendEventFilter', '/blueprints/events/', array('selected' => $filters, 'options' => &$options));
     $label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
     $fieldset->appendChild($label);
     $label = Widget::Label();
     $input = Widget::Input('fields[output-id-on-save]', 'yes', 'checkbox');
     if ($this->parameters()->{'output-id-on-save'} == true) {
         $input->setAttribute('checked', 'checked');
     }
     $label->appendChild($input);
     $label->appendChild(new DOMText(__('Add entry ID to the parameter pool in the format of $this-name-id when saving is successful.')));
     $fieldset->appendChild($label);
     $column_2->appendChild($fieldset);
     $fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
     foreach (new SectionIterator() as $section) {
         $this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
     }
     $column_3->appendChild($fieldset);
     $layout->appendTo($wrapper);
 }
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = General::sanitize($data['value']);
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 14
0
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     if ($this->get('hide') != 'yes') {
         $value = long2ip($data['value']);
         $label = Widget::Label($this->get('label'));
         $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL, 'text', array('disabled' => 'disabled')));
         if ($flagWithError != NULL) {
             $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
         } else {
             $wrapper->appendChild($label);
         }
     }
 }
Ejemplo n.º 15
0
 public function displayPublishPanel(SymphonyDOMElement $wrapper, MessageStack $errors, Entry $entry = NULL, $data = NULL)
 {
     $document = $wrapper->ownerDocument;
     $sortorder = $this->{'sortorder'};
     $element_name = $this->{'element-name'};
     $label = Widget::Label(isset($this->{'publish-label'}) && strlen(trim($this->{'publish-label'})) > 0 ? $this->{'publish-label'} : $this->name);
     // Input box:
     $input = Widget::Input("fields[{$element_name}]", $data->value);
     $label->appendChild($input);
     if ($errors->valid()) {
         $label = Widget::wrapFormElementWithError($label, $errors->current()->message);
     }
     $wrapper->appendChild($label);
 }
Ejemplo n.º 16
0
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = $data['value'];
     $label = Widget::Label($this->get('label'));
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', 'Optional'));
     }
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 public function displayPublishPanel(&$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null)
 {
     $label = Widget::Label($this->get('label'));
     $name = $this->get('element_name');
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', 'Optional'));
     }
     $input = Widget::Input("fields{$fieldnamePrefix}[{$name}]{$fieldnamePostfix}", strlen($data['value']) != 0 ? General::sanitize($data['value']) : NULL);
     $label->appendChild($input);
     if ($flagWithError != null) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 18
0
 public function displayPublishPanel(XMLElement &$wrapper, $data = null, $error = null, $prefix = null, $postfix = null, $entry_id = null)
 {
     $field_id = $this->get('id');
     $handle = $this->get('element_name');
     // Identity
     $label = Widget::Label($this->get('label'));
     if (!($this->get('required') == 'yes')) {
         $label->appendChild(new XMLElement('i', __('Optional')));
     }
     $label->appendChild(Widget::Input("fields{$prefix}[{$handle}]{$postfix}", $data['value']));
     // Error?
     if (!is_null($error)) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $error));
     } else {
         $wrapper->appendChild($label);
     }
 }
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $this->_engine->Page->addScriptToHead('http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $this->_engine->Configuration->get('google-api-key', 'map-location-field'), 75);
     $this->_engine->Page->addScriptToHead(URL . '/extensions/maplocationfield/assets/gmap.js', 80);
     $value = $data['value'];
     $label = Widget::Label($this->get('label'));
     $label->setAttribute('class', 'GMap');
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', 'Optional'));
     }
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $value ? $value : $this->get('default_location_coords')));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 20
0
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $label = Widget::Label($this->get('label'));
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', __('Optional')));
     }
     $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $this->get('size'), '50', strlen($data['value']) != 0 ? General::sanitize($data['value']) : NULL);
     ###
     # Delegate: ModifyTextareaFieldPublishWidget
     # Description: Allows developers modify the textarea before it is rendered in the publish forms
     $this->_engine->ExtensionManager->notifyMembers('ModifyTextareaFieldPublishWidget', '/backend/', array('field' => &$this, 'label' => &$label, 'textarea' => &$textarea));
     $label->appendChild($textarea);
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 public function buildSummaryBlock($errors = NULL)
 {
     $div = new XMLElement('div');
     // required label field (hidden)
     $this->set('label', 'Static Section');
     $label_input = Widget::Input('fields[' . $this->get('sortorder') . '][label]', $this->get('label'), 'hidden');
     if (isset($errors['label'])) {
         $div->appendChild(Widget::wrapFormElementWithError($label_input, $errors['label']));
     } else {
         $div->appendChild($label_input);
     }
     // help comments
     $diva = new XMLElement('div');
     $diva->setAttribute('class', 'group');
     $diva->appendChild(Widget::Label(__('Adding this field will convert this section into a Static Section.<br/>Static Sections are used to simplify the process of editing field collections that should only exist once in Symphony.<br />Please ensure that this section does not already contain more than one entry when this field is added.<br /><br />To disable Static Section functionality for this section, simply remove this field.')));
     $div->appendChild($diva);
     return $div;
 }
Ejemplo n.º 22
0
 public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
 {
     $page = $wrapper->ownerDocument;
     $page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'), 55533140);
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $middle = $layout->createColumn(Layout::LARGE);
     $right = $layout->createColumn(Layout::SMALL);
     //	Essentials --------------------------------------------------------
     $fieldset = Widget::Fieldset(__('Essentials'), null, array('class' => 'settings'));
     // Name:
     $label = Widget::Label(__('Name'));
     $input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
     $label->appendChild($input);
     if (isset($errors->{'about::name'})) {
         $label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
     }
     $fieldset->appendChild($label);
     $left->appendChild($fieldset);
     //	Filtering ---------------------------------------------------------
     $fieldset = Widget::Fieldset(__('Filtering'), '<code>{$param}</code> or <code>Value</code>', array('class' => 'settings'));
     // Filters
     $duplicator = new Duplicator(__('Add Filter'));
     $filters = array('id' => __('ID'), 'username' => __('Username'), 'first-name' => __('First Name'), 'last-name' => __('Last Name'), 'email' => __('Email Address'));
     foreach ($filters as $handle => $name) {
         $this->appendFilter($duplicator, $handle, $name);
         if (is_array($this->parameters()->filters) && array_key_exists($handle, $this->parameters()->filters)) {
             $this->appendFilter($duplicator, $handle, $name, $this->parameters()->filters[$handle]);
         }
     }
     $duplicator->appendTo($fieldset);
     $middle->appendChild($fieldset);
     //	Output options ----------------------------------------------------
     $fieldset = Widget::Fieldset(__('Output Options'));
     $select = Widget::Select('fields[included-elements][]', array(array('username', in_array('username', $this->parameters()->{"included-elements"}), 'username'), array('name', in_array('name', $this->parameters()->{"included-elements"}), 'name'), array('email-address', in_array('email-address', $this->parameters()->{"included-elements"}), 'email-address'), array('language', in_array('language', $this->parameters()->{"included-elements"}), 'language'), array('authentication-token', in_array('authentication-token', $this->parameters()->{"included-elements"}), 'authentication-token'), array('default-section', in_array('default-section', $this->parameters()->{"included-elements"}), 'default-section')));
     $select->setAttribute('class', 'filtered');
     $select->setAttribute('multiple', 'multiple');
     $label = Widget::Label(__('Included Elements'));
     $label->appendChild($select);
     $fieldset->appendChild($label);
     $right->appendChild($fieldset);
     $layout->appendTo($wrapper);
 }
Ejemplo n.º 23
0
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $timestamp = NULL;
     //$obDate = $Admin->getDateObj();
     //$obDate->setFormat('d M Y H:i');
     ## For new entries, the value will be a formatted date. Otherwise it will be a timestamp
     if ($data) {
         $value = $data['gmt'];
         $timestamp = !is_numeric($value) ? strtotime($value) : $value;
         //$obDate->set((!is_numeric($value) ? strtotime($value) : $value), false);
     }
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $data || $this->get('pre_populate') == 'yes' ? DateTimeObj::get(__SYM_DATETIME_FORMAT__, $timestamp) : NULL));
     $label->setAttribute('class', 'date');
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $max_dimensions = new XMLElement('div', NULL, array('class' => 'group'));
     $label = new XMLElement('label', __('Maximum image width <i>Optional</i>'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][max_width]', $this->get('max_width') ? $this->get('max_width') : ''));
     if (isset($errors['max_width'])) {
         $max_dimensions->appendChild(Widget::wrapFormElementWithError($label, $errors['max_width']));
     } else {
         $max_dimensions->appendChild($label);
     }
     $label = new XMLElement('label', __('Maximum image height <i>Optional</i>'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][max_height]', $this->get('max_height') ? $this->get('max_height') : ''));
     if (isset($errors['max_height'])) {
         $max_dimensions->appendChild(Widget::wrapFormElementWithError($label, $errors['max_height']));
     } else {
         $max_dimensions->appendChild($label);
     }
     $wrapper->appendChild($max_dimensions);
 }
Ejemplo n.º 25
0
 function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $name = $this->get('element_name');
     $value = null;
     // New entry:
     if (is_null($data) && $this->get('pre_populate') == 'yes') {
         $value = DateTimeObj::get(__SYM_DATETIME_FORMAT__, null);
     } else {
         if (isset($data['gmt']) && !is_null($data['gmt'])) {
             $value = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $data['gmt']);
         }
     }
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Input("fields{$prefix}[{$name}]{$name}", $value));
     $label->setAttribute('class', 'date');
     if (!is_null($error)) {
         $label = Widget::wrapFormElementWithError($label, $error);
     }
     $wrapper->appendChild($label);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $value = General::sanitize($data['value']);
     $label = Widget::Label();
     if ($this->get('hide') != 'yes') {
         $label->setValue($this->get('label'));
     } else {
         $label->setAttribute('style', 'display:none');
     }
     $name = 'fields' . $prefix . '[' . $this->get('element_name') . ']' . $postfix;
     $label->appendChild(Widget::Input($name, $value, 'hidden'));
     if ($this->get('hide') != 'yes') {
         $label->appendChild(Widget::Input($name, $value, 'text', array('disabled' => 'disabled')));
     }
     if ($error != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 27
0
 public function appendPublishInterface(XMLElement $wrapper, $field_name, StdClass $settings, StdClass $data, MessageStack $errors, $entry_id = null)
 {
     $url = new XMLElement('input');
     $url->setAttribute('type', 'text');
     $url->setAttribute('name', "{$field_name}[data][url]");
     $url->setAttribute('value', $data->{'url'});
     $drivers = new XMLElement('div', __('Supported services: <i>%s</i>', array(implode(', ', $settings->{'drivers'}))));
     if (isset($errors->{'url'})) {
         $url = Widget::wrapFormElementWithError($url, $errors->{'url'});
     }
     if (strlen($data->{'url'})) {
         // Hides input and drivers:
         $url->setAttribute('class', 'irrelevant');
         $drivers->setAttribute('class', 'irrelevant');
         // Create a resource container:
         $res_container = new XMLElement('span');
         $res_container->setAttribute('class', 'frame');
         $change = new XMLElement('a', __('Change'));
         $change->setAttribute('class', 'change');
         $or = new XMLElement('span', __(' or '));
         $remove = new XMLElement('a', __('Remove'));
         $remove->setAttribute('class', 'change remove');
         // Get the embed code:
         $driver = ServiceDispatcher::getServiceDriver($data->{'url'});
         $embed = __('Error. Service unknown.');
         if ($driver instanceof ServiceDriver) {
             $embed = $driver->getEmbedCode(array('oembed_xml' => $data->{'xml'}, 'res_id' => $data->{'id'}), array('location' => 'sidebar', 'width_side' => '320', 'height_side' => '180'));
         }
         $res_container->setValue("<div>{$embed}</div>");
         $res_container->appendChild($change);
         $res_container->appendChild($or);
         $res_container->appendChild($remove);
         $wrapper->appendChild($res_container);
     }
     // Append the input tag into the label:
     $wrapper->appendChild($url);
     // Append the allowed drivers list:
     $wrapper->appendChild($drivers);
 }
Ejemplo n.º 28
0
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null, $entry_id = null)
 {
     $this->_driver->addHeaders($this->_engine->Page);
     $handle = $this->get('element_name');
     $fieldname = "fields{$prefix}[{$handle}]{$postfix}";
     // Defaults -----------------------------------------------------------
     $wrapper->appendChild(Widget::Input("fields{$prefix}[{$handle}][is_cased]{$postfix}", 'no', 'hidden'));
     $wrapper->appendChild(Widget::Input("fields{$prefix}[{$handle}][is_regexp]{$postfix}", 'no', 'hidden'));
     // Expression ---------------------------------------------------------
     $label = Widget::Label(__('Expression'));
     $label->appendChild(Widget::Input("fields{$prefix}[{$handle}][value]{$postfix}", General::sanitize($data['value'])));
     if (isset($error)) {
         $label = Widget::wrapFormElementWithError($label, $error);
     }
     $wrapper->appendChild($label);
     $help = new XMLElement('p');
     $help->setAttribute('class', 'help');
     $help->setValue('Use <code>*</code> as a wild-card unless regular expressions are enabled.');
     $wrapper->appendChild($help);
     // Cased? -------------------------------------------------------------
     $settings = new XMLElement('div');
     $input = Widget::Input("fields{$prefix}[{$handle}][is_cased]{$postfix}", 'yes', 'checkbox', $data['is_cased'] == 'yes' ? array('checked' => 'checked') : null);
     $label = Widget::Label(__('%s Case sensetive?', array($input->generate())));
     $settings->appendChild($label);
     $help = new XMLElement('p');
     $help->setAttribute('class', 'help');
     $help->setValue(__('Treat upper case and lower case letters differently.'));
     $settings->appendChild($help);
     // Regexp? ------------------------------------------------------------
     $input = Widget::Input("fields{$prefix}[{$handle}][is_regexp]{$postfix}", 'yes', 'checkbox', $data['is_regexp'] == 'yes' ? array('checked' => 'checked') : null);
     $label = Widget::Label(__('%s Regular expressions?', array($input->generate())));
     $settings->appendChild($label);
     $help = new XMLElement('p');
     $help->setAttribute('class', 'help');
     $help->setValue(__('Advanced matching with <a href="%s">Perl compatible regular expressions</a>.', array(URL . '/symphony/extension/expressionfield/documentation/')));
     $settings->appendChild($help);
     $wrapper->appendChild($settings);
 }
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     if (!$flagWithError && !is_writable(DOCROOT . $this->get('destination') . '/')) {
         $flagWithError = __('Destination folder, <code>%s</code>, is not writable. Please check permissions.', array($this->get('destination')));
     }
     $label = Widget::Label($this->get('label'));
     $class = 'file';
     $label->setAttribute('class', $class);
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', __('Optional')));
     }
     $span = new XMLElement('span');
     if ($data['file']) {
         $span->appendChild(Widget::Anchor('/workspace' . $data['file'], URL . '/workspace' . $data['file']));
     }
     $span->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $data['file'], $data['file'] ? 'hidden' : 'file'));
     $label->appendChild($span);
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 30
0
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $username = $data['username'];
     $label = Widget::Label('Username');
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', 'Optional'));
     }
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . '][username]' . $fieldnamePostfix, strlen($username) != 0 ? $username : NULL));
     $div->appendChild($label);
     $password = $data['password'];
     $label = Widget::Label('Password');
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', 'Optional'));
     }
     $label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . '][password]' . $fieldnamePostfix, strlen($password) != 0 ? $password : NULL));
     $div->appendChild($label);
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($div, $flagWithError));
     } else {
         $wrapper->appendChild($div);
     }
 }