Ejemplo n.º 1
0
 public function view()
 {
     $this->setTitle(__('Symphony – Indecent Filter'));
     $this->setPageType('form');
     $this->Form->setAttribute('enctype', 'multipart/form-data');
     $this->appendSubheading(__('Indecent Filter'));
     $words = extension_indecent::processFilterList(true);
     // Word List
     $container = new XMLElement('fieldset');
     $container->setAttribute('class', 'settings');
     $container->appendChild(new XMLElement('legend', __('Word Blacklist')));
     $p = new XMLElement('p', __('Enter each of the terms on a new line.'), array('class' => 'help'));
     $container->appendChild($p);
     // Add last saved timestamp
     if (!empty($words)) {
         $p->setValue($p->getValue() . '<br / >' . __('Last updated: %s', array(extension_indecent::lastUpdateFilterList())));
     }
     $container->appendChild(Widget::Textarea('fields[words]', 30, 30, $words));
     $this->Form->appendChild($container);
     // Actions
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', 'Save', 'submit', array('accesskey' => 's')));
     $this->Form->appendChild($div);
 }
Ejemplo n.º 2
0
 function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $label = Widget::Label(__('URL Expression'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][url_expression]', $this->get('url_expression')));
     $wrapper->appendChild($label);
 }
 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'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][label]', $this->get('label'), null));
     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 entry page'));
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
 }
 public function ttf_form(&$form, &$page)
 {
     $p = new XMLElement('p', __('Wrap patterns with slashes, e.g., "/pattern_here/". You can use backreferences in replacement. Syntax for pattern and replacement is exactly the same as in <a href="http://www.php.net/manual/en/function.preg-replace.php" target="_blank">preg_replace()</a> PHP function.'));
     $p->setAttribute('class', 'help');
     $form->appendChild($p);
     $subsection = new XMLElement('div');
     $subsection->setAttribute('class', 'frame templatedtextformatter-duplicator');
     $ol = new XMLElement('ol');
     $ol->setAttribute('data-add', __('Add regex'));
     $ol->setAttribute('data-remove', __('Remove regex'));
     $temp = $this->_patterns;
     $temp[''] = '';
     foreach ($temp as $pattern => $replacement) {
         $li = new XMLElement('li');
         $li->setAttribute('class', $pattern ? 'field-regex' : 'template field-regex');
         $li->setAttribute('data-type', 'regex');
         $header = new XMLElement('header');
         $header->appendChild(new XMLElement('h4', '<strong>' . __('Replace') . '</strong> <span class="type">' . __('regex') . '</span>'));
         $li->appendChild($header);
         $div = new XMLElement('div');
         $div->setAttribute('class', 'two columns');
         $label = Widget::Label(__('Find with pattern'));
         $label->setAttribute('class', 'column');
         $label->appendChild(Widget::Input('fields[patterns][]', htmlentities($pattern, ENT_QUOTES, 'UTF-8')));
         $div->appendChild($label);
         $label = Widget::Label(__('Replace with'));
         $label->setAttribute('class', 'column');
         $label->appendChild(Widget::Input('fields[replacements][]', htmlentities($replacement, ENT_QUOTES, 'UTF-8')));
         $div->appendChild($label);
         $li->appendChild($div);
         $ol->appendChild($li);
     }
     $subsection->appendChild($ol);
     $form->appendChild($subsection);
 }
 /**
  * Append maintenance mode preferences
  *
  * @param array $context
  *  delegate context
  */
 public function appendPreferences($context)
 {
     // Create preference group
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Maintenance Mode')));
     // Append settings
     $label = Widget::Label();
     $input = Widget::Input('settings[maintenance_mode][enabled]', 'yes', 'checkbox');
     if (Symphony::Configuration()->get('enabled', 'maintenance_mode') === 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' ' . __('Enable maintenance mode'));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of <code>maintenance</code>'), array('class' => 'help')));
     // IP White list
     $label = Widget::Label(__('IP Whitelist'));
     $label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode')));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help')));
     // Append new preference group
     $context['wrapper']->appendChild($group);
 }
 function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     Field::displaySettingsPanel($wrapper, $errors);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $ignore = array('/workspace/events', '/workspace/data-sources', '/workspace/text-formatters', '/workspace/pages', '/workspace/utilities');
     $directories = General::listDirStructure(WORKSPACE, NULL, 'asc', DOCROOT, $ignore);
     $label = Widget::Label(__('Destination Directory'));
     $options = array();
     $options[] = array('/workspace', false, '/workspace');
     if (!empty($directories) && is_array($directories)) {
         foreach ($directories as $d) {
             $d = '/' . trim($d, '/');
             if (!in_array($d, $ignore)) {
                 $options[] = array($d, $this->get('destination') == $d, $d);
             }
         }
     }
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][destination]', $options));
     if (isset($errors['destination'])) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $errors['destination']));
     } else {
         $wrapper->appendChild($label);
     }
     $this->appendRequiredCheckbox($wrapper);
     $label = Widget::Label();
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][allow_multiple_selection]', 'yes', 'checkbox');
     if ($this->get('allow_multiple_selection') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue(__('%s Allow selection of multiple options', array($input->generate())));
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $this->_driver->addPublishHeaders($this->_engine->Page);
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $container = new XMLElement('div', $this->get('label'));
     $container->setAttribute('class', 'label');
     $container->appendChild(new XMLElement('i', __('Optional')));
     $group = new XMLElement('div');
     // From:
     $label = Widget::Label(__('Date'));
     $from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[from]", General::sanitize($data['from_value']));
     $label->appendChild($from);
     $group->appendChild($label);
     // To:
     $label = Widget::Label(__('Until Date'));
     $from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[to]", General::sanitize($data['to_value']));
     $label->appendChild($from);
     $group->appendChild($label);
     // Mode:
     $options = array(array('entire-day', false, 'Entire Day'), array('entire-week', false, 'Entire Week'), array('entire-month', false, 'Entire Month'), array('entire-year', false, 'Entire Year'), array('until-date', false, 'Until Date'));
     foreach ($options as &$option) {
         if ($option[0] != $data['mode']) {
             continue;
         }
         $option[1] = true;
         break;
     }
     $label = Widget::Label(__('Mode'));
     $from = Widget::Select("fields{$prefix}[{$element_name}]{$postfix}[mode]", $options);
     $label->appendChild($from);
     $group->appendChild($label);
     $container->appendChild($group);
     $wrapper->appendChild($container);
 }
Ejemplo n.º 8
0
 public function appendEventFilterDocumentation(array $context)
 {
     if (in_array('validate-xsrf', $context['selected'])) {
         $context['documentation'][] = new XMLElement('p', __('To validate a XSRF token, ensure it is passed in the form.'));
         $context['documentation'][] = contentAjaxEventDocumentation::processDocumentationCode(Widget::Input('xsrf', '{$cookie-xsrf-token}', 'hidden'));
     }
 }
 public function cbAppendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('SMTP Email Library')));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Host'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][host]', Symphony::Configuration()->get('host', 'smtp_email_library')));
     $div->appendChild($label);
     $label = Widget::Label(__('Port'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][port]', Symphony::Configuration()->get('port', 'smtp_email_library')));
     $div->appendChild($label);
     $group->appendChild($div);
     $label = Widget::Label();
     $input = Widget::Input('settings[smtp_email_library][auth]', '1', 'checkbox');
     if (Symphony::Configuration()->get('auth', 'smtp_email_library') == '1') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Requires authentication');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Some SMTP connections require authentication. If that is the case, enter the username/password combination below.', array('class' => 'help')));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Username'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][username]', Symphony::Configuration()->get('username', 'smtp_email_library')));
     $div->appendChild($label);
     $label = Widget::Label(__('Password'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][password]', Symphony::Configuration()->get('password', 'smtp_email_library')));
     $div->appendChild($label);
     $group->appendChild($div);
     $context['wrapper']->appendChild($group);
 }
Ejemplo n.º 10
0
 public function view()
 {
     $emergency = false;
     if (isset($this->_context[0]) && in_array(strlen($this->_context[0]), array(6, 8))) {
         if (!$this->__loginFromToken($this->_context[0])) {
             if (Administration::instance()->isLoggedIn()) {
                 redirect(SYMPHONY_URL);
             }
         }
     }
     $this->Form = Widget::Form(SYMPHONY_URL . '/login/', 'post');
     $this->Form->setAttribute('class', 'frame');
     $this->Form->appendChild(new XMLElement('h1', __('Symphony')));
     $fieldset = new XMLElement('fieldset');
     if ($this->_context[0] == 'retrieve-password') {
         $this->Form->setAttribute('action', SYMPHONY_URL . '/login/retrieve-password/');
         if (isset($this->_email_sent) && $this->_email_sent) {
             $fieldset->appendChild(new XMLElement('p', __('An email containing a customised login link has been sent. It will expire in 2 hours.')));
             $this->Form->appendChild($fieldset);
         } else {
             $fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote login link with further instructions for logging in.')));
             $label = Widget::Label(__('Email Address'));
             $label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus' => 'autofocus')));
             if (isset($this->_email_sent) && !$this->_email_sent) {
                 $label = Widget::Error($label, __('There was a problem locating your account. Please check that you are using the correct email address.'));
             }
             $fieldset->appendChild($label);
             $this->Form->appendChild($fieldset);
             $div = new XMLElement('div', NULL, array('class' => 'actions'));
             $div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[reset]', 'type' => 'submit')));
             $this->Form->appendChild($div);
         }
     } else {
         $fieldset->appendChild(new XMLElement('legend', __('Login')));
         $label = Widget::Label(__('Username'));
         $username = Widget::Input('username', $_POST['username']);
         if (!$this->_invalidPassword) {
             $username->setAttribute('autofocus', 'autofocus');
         }
         $label->appendChild($username);
         if (isset($_POST['action'], $_POST['action']['login']) && empty($_POST['username'])) {
             $username->setAttribute('autofocus', 'autofocus');
             $label = Widget::Error($label, __('No username was entered.'));
         }
         $fieldset->appendChild($label);
         $label = Widget::Label(__('Password'));
         $password = Widget::Input('password', NULL, 'password');
         $label->appendChild($password);
         if ($this->_invalidPassword) {
             $password->setAttribute('autofocus', 'autofocus');
             $label = Widget::Error($label, __('The supplied password was rejected.') . ' <br /><a href="' . SYMPHONY_URL . '/login/retrieve-password/">' . __('Retrieve password?') . '</a>');
         }
         $fieldset->appendChild($label);
         $this->Form->appendChild($fieldset);
         $div = new XMLElement('div', NULL, array('class' => 'actions'));
         $div->appendChild(new XMLElement('button', __('Login'), array('name' => 'action[login]', 'type' => 'submit', 'accesskey' => 's')));
         $this->Form->appendChild($div);
     }
     $this->Body->appendChild($this->Form);
 }
Ejemplo n.º 11
0
 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'CacheLite'));
     # Add Site Reference field
     $label = Widget::Label('Cache Period');
     $label->appendChild(Widget::Input('settings[cachelite][lifetime]', General::Sanitize($this->_get_lifetime())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Length of cache period in seconds.', array('class' => 'help')));
     $label = Widget::Label('Excluded URLs');
     $label->appendChild(Widget::Textarea('cachelite[excluded-pages]', 10, 50, $this->_get_excluded_pages()));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Add a line for each URL you want to be excluded from the cache. Add a <code>*</code> to the end of the URL for wildcard matches.', array('class' => 'help')));
     $label = Widget::Label();
     $input = Widget::Input('settings[cachelite][show-comments]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('show-comments', 'cachelite') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Show comments in page source?');
     $group->appendChild($label);
     $label = Widget::Label();
     $input = Widget::Input('settings[cachelite][backend-delegates]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('backend-delegates', 'cachelite') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Expire cache when entries are created/updated through the backend?');
     $group->appendChild($label);
     $context['wrapper']->appendChild($group);
 }
 public function view()
 {
     $this->appendSubheading(__('Preferences'));
     $bIsWritable = true;
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if (!is_writable(CONFIG)) {
         $this->pageAlert(__('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.'), Alert::ERROR);
         $bIsWritable = false;
     } else {
         if ($formHasErrors) {
             $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR);
         } else {
             if (isset($this->_context[0]) && $this->_context[0] == 'success') {
                 $this->pageAlert(__('Preferences saved.'), Alert::SUCCESS);
             }
         }
     }
     ###
     # Delegate: AddCustomPreferenceFieldsets
     # Description: Add Extension custom preferences. Use the $wrapper reference to append objects.
     $this->_Parent->ExtensionManager->notifyMembers('AddCustomPreferenceFieldsets', '/system/preferences/', array('wrapper' => &$this->Form));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     if (!$bIsWritable) {
         $attr['disabled'] = 'disabled';
     }
     $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', $attr));
     $this->Form->appendChild($div);
 }
Ejemplo n.º 13
0
 /**
  * Append maintenance mode preferences
  *
  * @param array $context
  *  delegate context
  */
 public function appendPreferences($context)
 {
     // Create preference group
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Maintenance Mode')));
     // Append settings
     $label = Widget::Label();
     $input = Widget::Input('settings[maintenance_mode][enabled]', 'yes', 'checkbox');
     if (Symphony::Configuration()->get('enabled', 'maintenance_mode') === 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' ' . __('Enable maintenance mode'));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of <code>maintenance</code>'), array('class' => 'help')));
     // IP White list
     $label = Widget::Label(__('IP Whitelist'));
     $label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode')));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help')));
     // Useragent White list
     $label = Widget::Label(__('Useragent Whitelist'));
     $whitelist = json_decode(Symphony::Configuration()->get('useragent_whitelist', 'maintenance_mode'));
     if (is_array($whitelist) && !empty($whitelist)) {
         $useragent = implode("\r\n", $whitelist);
     }
     $label->appendChild(Widget::Textarea('settings[maintenance_mode][useragent_whitelist]', 5, 50, $useragent));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Any useragent that listed above will be granted access. This eliminates the need to allow a user backend access, useful when third party services need to access your site prior to launch. Insert in json array format eg ["useragent1","useragent2"].'), array('class' => 'help')));
     // Append new preference group
     $context['wrapper']->appendChild($group);
 }
Ejemplo n.º 14
0
 public function dashboardPanelOptions($context)
 {
     if ($context['type'] != 'piwik') {
         return;
     }
     $config = $context['existing_config'];
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Piwik')));
     $label = Widget::Label(__('Module'));
     $select = Widget::Select('config[module]', $this->getModuleOptions(isset($config['module']) ? $config['module'] : null));
     $label->appendChild($select);
     $fieldset->appendChild($label);
     $input = Widget::Input('config[columns]', isset($config['columns']) ? $config['columns'] : null);
     $input->setAttribute('type', 'number');
     $input->setAttribute('size', '3');
     $label = Widget::Label(__('Show the first %s columns in table.', array($input->generate())));
     $fieldset->appendChild($label);
     $input = Widget::Input('config[entries]', isset($config['entries']) ? $config['entries'] : null);
     $input->setAttribute('type', 'number');
     $input->setAttribute('size', '3');
     $label = Widget::Label(__('Show the first %s entries in table.', array($input->generate())));
     $fieldset->appendChild($label);
     $context['form'] = $fieldset;
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle('Symphony &ndash; Importers');
     $tableHead = array(array('Name', 'col'), array('Version', 'col'), array('Author', 'col'));
     $tableBody = array();
     if (!is_array($this->_importers) or empty($this->_importers)) {
         $tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
     } else {
         foreach ($this->_importers as $importer) {
             $importer = (object) $importer;
             $col_name = Widget::TableData(Widget::Anchor($this->_driver->truncateValue($importer->name), $this->_uri . "/importers/edit/{$importer->handle}/"));
             $col_name->appendChild(Widget::Input("items[{$importer->id}]", null, 'checkbox'));
             $col_version = Widget::TableData($this->_driver->truncateValue($importer->version));
             $col_author = Widget::TableData($this->_driver->truncateValue($importer->version));
             if (isset($importer->author['website']) and preg_match('/^[^\\s:\\/?#]+:(?:\\/{2,3})?[^\\s.\\/?#]+(?:\\.[^\\s.\\/?#]+)*(?:\\/[^\\s?#]*\\??[^\\s?#]*(#[^\\s#]*)?)?$/', $importer->author['website'])) {
                 $col_author = Widget::Anchor($importer->author['name'], General::validateURL($importer->author['website']));
             } elseif (isset($importer->author['email']) and preg_match('/^\\w(?:\\.?[\\w%+-]+)*@\\w(?:[\\w-]*\\.)+?[a-z]{2,}$/i', $importer->author['email'])) {
                 $col_author = Widget::Anchor($importer->author['name'], 'mailto:' . $importer->author['email']);
             } else {
                 $col_author = $importer->author['name'];
             }
             $col_author = Widget::TableData($col_author);
             $tableBody[] = Widget::TableRow(array($col_name, $col_version, $col_author));
         }
     }
     $table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody));
     $this->Form->appendChild($table);
 }
Ejemplo n.º 16
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);
 }
Ejemplo n.º 17
0
 /**
  * Create row for page on the manage page fields page.  This contains the applicable actions
  * for the page fields.
  *
  * @param array page The page details.
  * @param bool Is the row odd or not?
  *
  * @return Widget Row for page.
  */
 private function createViewPageFieldsRowForPage($page, $isOdd)
 {
     $class = array();
     $pageTitle = $this->_Parent->resolvePageTitle($page['id']);
     $pageUrl = URL . '/' . $this->_Parent->resolvePagePath($page['id']) . '/';
     $pageEditUrl = URL . '/symphony/blueprints/pages/edit/' . $page['id'] . '/';
     $colTitle = Widget::TableData(Widget::Anchor($pageTitle, $pageEditUrl, $page['handle']));
     $colTitle->appendChild(Widget::Input("items[{$page['id']}]", null, 'checkbox'));
     $colUrl = Widget::TableData(Widget::Anchor($pageUrl, $pageUrl));
     if ($page['section_id'] == NULL) {
         $colActions = Widget::TableData(Widget::Anchor('Create', URL . PF_MANAGE_URL . 'create/' . $page['id'] . '/'));
     } else {
         $colActions = Widget::TableData();
         $colActions->appendChild(Widget::Anchor('Edit', URL . '/symphony/blueprints/sections/edit/' . $page['section_id'] . '/'));
         $colActions->appendChild(new XMLElement('span', ', '));
         $colActions->appendChild(Widget::Anchor('Delete', URL . PF_MANAGE_URL . 'delete/' . $page['section_id'] . '/'));
     }
     if ($isOdd) {
         $class[] = 'odd';
     }
     if (in_array($page['id'], $this->_hilights)) {
         $class[] = 'failed';
     }
     return Widget::TableRow(array($colTitle, $colUrl, $colActions), implode(' ', $class));
 }
Ejemplo n.º 18
0
 public function __viewIndex()
 {
     $this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Section Schema data sources');
     $this->appendSubheading('Section Schema data sources');
     $container = new XMLElement('fieldset');
     $container->setAttribute('class', 'settings');
     $container->appendChild(new XMLElement('legend', 'Sections'));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'group');
     $sm = new SectionManager($this->_Parent);
     $sections = $sm->fetch();
     $options = array();
     $dsm = new DatasourceManager($this->_Parent);
     $datasources = $dsm->listAll();
     foreach ($sections as $section) {
         $selected = in_array('section_schema_' . str_replace('-', '_', $section->_data['handle']), array_keys($datasources));
         $options[] = array($section->_data['handle'], $selected, $section->_data['name']);
     }
     $section = Widget::Label('Create data sources for these sections:');
     $section->appendChild(Widget::Select('sections[]', $options, array('multiple' => 'multiple')));
     $group->appendChild($section);
     $container->appendChild($group);
     $this->Form->appendChild($container);
     //---------------------------------------------------------------------
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
     $this->Form->appendChild($div);
 }
Ejemplo n.º 19
0
 private function __buildFormContent()
 {
     $fieldset = new XMLElement('fieldset');
     // email was not send
     // or first time here (email_sent == NULL)
     if ($this->_email_sent !== true) {
         $fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote unban link with further instructions.')));
         $label = Widget::Label(__('Email Address'));
         $label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus', 'autofocus')));
     }
     if (isset($this->_email_sent)) {
         if ($this->_email_sent) {
             $div = new XMLElement('div', __('Email sent. Follow the instruction in it.'));
             $fieldset->appendChild($div);
         } else {
             $div = new XMLElement('div', NULL, array('class' => 'invalid'));
             $div->appendChild($label);
             $div->appendChild(new XMLElement('p', __('There was a problem locating your account. Please check that you are using the correct email address.')));
             $fieldset->appendChild($div);
         }
     } else {
         $fieldset->appendChild($label);
     }
     $this->Form->appendChild($fieldset);
     if ($this->_email_sent !== true) {
         $div = new XMLElement('div', NULL, array('class' => 'actions'));
         $div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[send-email]', 'type' => 'submit')));
         $this->Form->appendChild($div);
     }
 }
Ejemplo n.º 20
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.º 21
0
 public function view()
 {
     $this->setPageType('table');
     $this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create a new hub'), 'create button'));
     $aTableHead = array(array(__('Title'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col'));
     $aTableBody = array();
     $formatters = $this->_driver->listAll();
     if (!is_array($formatters) || empty($formatters)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $tfm = new TextformatterManager($this->_Parent);
         foreach ($formatters as $id => $data) {
             $formatter = $tfm->create($id);
             $about = $formatter->about();
             $td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name']));
             $td2 = Widget::TableData($about['templatedtextformatters-type']);
             $td3 = Widget::TableData($about['description']);
             $td1->appendChild(Widget::Input('items[' . $id . ']', NULL, 'checkbox'));
             // Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $order = $this->get('sortorder');
     $label = Widget::Label('Anchor URL (XPath expression)');
     $label->appendChild(Widget::Input("fields[{$order}][expression]", $this->get('expression')));
     $help = new XMLElement('p', 'To access the other fields, use XPath: <code>{entry/field-one} static text {entry/field-two}</code>.');
     $help->setAttribute('class', 'help');
     $wrapper->appendChild($label);
     $label = Widget::Label();
     $input = Widget::Input("fields[{$order}][new_window]", 'yes', 'checkbox');
     if ($this->get('new_window') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Open links in a new window');
     $wrapper->appendChild($label);
     $label = Widget::Label();
     $input = Widget::Input("fields[{$order}][hide]", 'yes', 'checkbox');
     if ($this->get('hide') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Hide this field on publish page');
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
 }
Ejemplo n.º 23
0
 public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     // Check 'mode' exists; otherwise set manually from 'editable'
     $mode = $this->get('mode');
     if (!$mode) {
         if ($this->get('editable') == 'yes') {
             $mode = 'normal';
         } else {
             $mode = 'hidden';
         }
     }
     // Render the field only if it's not hidden
     if ($mode != 'hidden') {
         $name = $this->get('element_name');
         $edited_local = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $data['local']);
         $current_local = DateTimeObj::get(__SYM_DATETIME_FORMAT__, null);
         $label = Widget::Label($this->get('label'));
         if ($mode == 'disabled') {
             $input = Widget::Input("{$name}-display", $edited_local);
             $input->setAttribute('disabled', 'disabled');
         } else {
             $note = new XMLElement('i', __('Previous value: %s', array($edited_local)));
             $label->appendChild($note);
             $input = Widget::Input("fields{$fieldnamePrefix}[{$name}]", $current_local);
         }
         $label->appendChild($input);
         $label->setAttribute('class', 'date');
         if (!is_null($flagWithError)) {
             $label = Widget::Error($label, $error);
         }
         $wrapper->appendChild($label);
     }
 }
Ejemplo n.º 24
0
 /**
  * Appends the show_created input.
  *
  * @param XMLElement $wrapper
  */
 public function generateShowCreated(XMLElement &$wrapper)
 {
     $div = new XMLElement('span', null, array('class' => 'hide-others'));
     $input = Widget::Input('show_created', null, 'checkbox');
     $div->setValue(__('%s hide others', array($input->generate())));
     $wrapper->appendChild($div);
 }
Ejemplo n.º 25
0
 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'PayPal Payments'));
     # Add Merchant Email field
     $label = Widget::Label('Merchant Email/Account ID');
     $label->appendChild(Widget::Input('settings[paypal-payments][business]', General::Sanitize($this->_get_paypal_business())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'The merchant email address or account ID of the payment recipient.', array('class' => 'help')));
     # Country <select>
     $countries = array('Australia', 'United Kingdom', 'United States');
     $selected_country = $this->_get_country();
     foreach ($countries as $country) {
         $selected = $country == $selected_country ? TRUE : FALSE;
         $options[] = array($country, $selected);
     }
     $label = Widget::Label();
     $select = Widget::Select('settings[paypal-payments][country]', $options);
     $label->setValue('PayPal Country' . $select->generate());
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Country you want to target.', array('class' => 'help')));
     # Sandbox
     $label = Widget::Label();
     $input = Widget::Input('settings[paypal-payments][sandbox]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('sandbox', 'paypal-payments') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Enable testing mode');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Directs payments to PayPal’s Sandbox: <code>http://www.sandbox.paypal.com/</code>', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
    public static function documentation()
    {
        // Fetch all the Email Templates available and add to the end of the documentation
        $templates = extension_Members::fetchEmailTemplates();
        $div = new XMLElement('div');
        if (!empty($templates)) {
            $label = new XMLElement('label', __('Regenerate Activation Code Email Template'));
            $regenerate_activation_code_templates = extension_Members::setActiveTemplate($templates, 'regenerate-activation-code-template');
            $label->appendChild(Widget::Select('members[regenerate-activation-code-template][]', $regenerate_activation_code_templates, array('multiple' => 'multiple')));
            $div->appendChild($label);
            $div->appendChild(Widget::Input('members[event]', 'reset-password', 'hidden'));
            $div->appendChild(Widget::Input(null, __('Save Changes'), 'submit', array('accesskey' => 's')));
        }
        return '
				<p>This event will regenerate an activation code for a user and is useful if their current
				activation code has expired. The activation code can be sent to a Member\'s email after
				this event has executed.</p>
				<h3>Example Front-end Form Markup</h3>
				<p>This is an example of the form markup you can use on your front end. An input field
				accepts either the member\'s email address or username.</p>
				<pre class="XML"><code>
				&lt;form method="post"&gt;
					&lt;label&gt;Username: &lt;input name="fields[username]" type="text" value="{$username}"/&gt;&lt;/label&gt;
					or
					&lt;label&gt;Email: &lt;input name="fields[email]" type="text" value="{$email}"/&gt;&lt;/label&gt;
					&lt;input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Regenerate Activation Code"/&gt;
					&lt;input type="hidden" name="redirect" value="{$root}/"/&gt;
				&lt;/form&gt;
				</code></pre>
				<h3>More Information</h3>
				<p>For further information about this event, including response and error XML, please refer to the
				<a href="https://github.com/symphonycms/members/wiki/Members%3A-Regenerate-Activation-Code">wiki</a>.</p>
				' . $div->generate() . '
			';
    }
Ejemplo n.º 27
0
 public function displayDatasourceFilterPanel(&$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $wrapper->appendChild(new XMLElement('h4', $this->get('label') . ' <i>' . $this->Name() . '</i>'));
     $label = Widget::Label('Value');
     $label->appendChild(Widget::Input('fields[filter]' . ($fieldnamePrefix ? '[' . $fieldnamePrefix . ']' : '') . '[' . $this->get('id') . ']' . ($fieldnamePostfix ? '[' . $fieldnamePostfix . ']' : ''), $data ? General::sanitize($data) : NULL));
     $wrapper->appendChild($label);
     $wrapper->appendChild(new XMLElement('p', 'To filter by ranges, add <code>mysql:</code> to the beginning of the filter input. Use <code>value</code> for field name. E.G. <code>mysql: value &gt;= 1.01 AND value &lt;= {$price}</code>', array('class' => 'help')));
 }
Ejemplo n.º 28
0
 public function displayDatasourceFilterPanel(&$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $wrapper->appendChild(new XMLElement('h4', $this->get('label') . ' <i>' . $this->Name() . '</i>'));
     $label = Widget::Label('Value');
     $label->appendChild(Widget::Input('fields[filter]' . ($fieldnamePrefix ? '[' . $fieldnamePrefix . ']' : '') . '[' . $this->get('id') . ']' . ($fieldnamePostfix ? '[' . $fieldnamePostfix . ']' : ''), $data ? General::sanitize($data) : NULL));
     $wrapper->appendChild($label);
     $wrapper->appendChild(new XMLElement('p', 'Accepts either a 32 character hash, or plain text value. If plain text, it will be hashed before comparing.', array('class' => 'help')));
 }
Ejemplo n.º 29
0
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     Field::displaySettingsPanel($wrapper, $errors);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label('Options');
     $sectionManager = new SectionManager($this->_engine);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'name');
     $field_groups = array();
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $section) {
             $field_groups[$section->get('id')] = array('fields' => $section->fetchFields(), 'section' => $section);
         }
     }
     $options = array();
     foreach ($field_groups as $group) {
         if (!is_array($group['fields'])) {
             continue;
         }
         $fields = array();
         foreach ($group['fields'] as $f) {
             if ($f->get('id') != $this->get('id') && $f->canPrePopulate() && !is_null($this->get('related_field_id'))) {
                 $fields[] = array($f->get('id'), in_array($f->get('id'), $this->get('related_field_id')), $f->get('label'));
             }
         }
         if (is_array($fields) && !empty($fields)) {
             $options[] = array('label' => $group['section']->get('name'), 'options' => $fields);
         }
     }
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_field_id][]', $options, array('multiple' => 'multiple')));
     $div->appendChild($label);
     // set field type
     $label = Widget::Label('Field Type');
     $type_options = array(array('select', $this->get('field_type') == 'select', 'Select Box'), array('autocomplete', $this->get('field_type') == 'autocomplete', 'Autocomplete Input'));
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][field_type]', $type_options));
     $div->appendChild($label);
     // Allow selection of multiple items
     $label = Widget::Label();
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][allow_multiple_selection]', 'yes', 'checkbox');
     if ($this->get('allow_multiple_selection') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Allow selection of multiple options');
     $div->appendChild($label);
     if (isset($errors['related_field_id'])) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($div, $errors['related_field_id']));
     } else {
         $wrapper->appendChild($div);
     }
     ## Maximum entries
     $label = Widget::Label();
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][limit]', $this->get('limit'));
     $input->setAttribute('size', '3');
     $label->setValue('Limit to the ' . $input->generate() . ' most recent entries');
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
     $this->appendRequiredCheckbox($wrapper);
 }
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $label = Widget::Label('Update cache (minutes; leave blank to never update) <i>Optional</i>');
     $label->appendChild(Widget::Input("fields[{$this->get('sortorder')}][refresh]", $this->get('refresh')));
     $wrapper->appendChild($label);
     $this->appendRequiredCheckbox($wrapper);
     $this->appendShowColumnCheckbox($wrapper);
 }