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);
 }
 public static function buildEditor(XMLElement $wrapper, array &$errors = array(), array $settings = null, $handle = null)
 {
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/section_schemas/assets/section_schemas.datasource.js', 100);
     if (is_null($settings[self::getClass()]['fields'])) {
         $settings[self::getClass()]['fields'] = array();
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings contextual ' . __CLASS__);
     $fieldset->setAttribute('data-context', General::createHandle(self::getName()));
     $fieldset->appendChild(new XMLElement('legend', self::getName()));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'two columns');
     $options = array();
     $sections = SectionManager::fetch();
     foreach ($sections as $section) {
         $options[] = array($section->get('handle'), $settings[self::getClass()]['section'] == $section->get('handle'), $section->get('name'));
     }
     $label = Widget::Label(__('Section'));
     $label->setAttribute('class', 'column');
     $label->appendChild(Widget::Select('fields[' . self::getClass() . '][section]', $options));
     $group->appendChild($label);
     foreach ($sections as $section) {
         $fields = $section->fetchFields();
         $options = array();
         foreach ($fields as $field) {
             $options[] = array($field->get('element_name'), in_array($field->get('element_name'), $settings[self::getClass()]['fields']), $field->get('label') . ' (' . $field->get('type') . ')');
         }
         $label = Widget::Label(__('Fields'));
         $label->setAttribute('class', 'column fields fields-for-' . $section->get('handle'));
         $label->appendChild(Widget::Select('fields[' . self::getClass() . '][fields][]', $options, array('multiple' => 'multiple')));
         $group->appendChild($label);
     }
     $fieldset->appendChild($group);
     $wrapper->appendChild($fieldset);
 }
Esempio n. 3
0
 /**
  * Add site preferences
  */
 public function __addPreferences($context)
 {
     // Get selected languages
     $selection = Symphony::Configuration()->get('datetime');
     if (empty($selection)) {
         $selection = array();
     }
     // Build default options
     $options = array();
     foreach ($this->languages as $name => $codes) {
         $options[$name] = array($name . '::' . $codes, array_key_exists($name, $selection) ? true : false, __(ucfirst($name)));
     }
     // Add custom options
     foreach (array_diff_key($selection, $this->languages) as $name => $codes) {
         $options[$name] = array($name . '::' . $codes, true, __(ucfirst($name)));
     }
     // Sort options
     ksort($options);
     // Add fieldset
     $group = new XMLElement('fieldset', '<legend>' . __('Date and Time') . '</legend>', array('class' => 'settings'));
     $select = Widget::Select('settings[datetime][]', $options, array('multiple' => 'multiple'));
     $label = Widget::Label('Languages included in the Date and Time Data Source', $select);
     $group->appendChild($label);
     $help = new XMLElement('p', __('You can add more languages in you configuration file.'), array('class' => 'help'));
     $group->appendChild($help);
     $context['wrapper']->appendChild($group);
 }
Esempio n. 4
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 displaySettingsPanel(&$wrapper, $errors = null)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $order = $this->get('sortorder');
     // Destination --------------------------------------------------------
     $ignore = array('events', 'data-sources', 'text-formatters', 'pages', 'utilities');
     $directories = General::listDirStructure(WORKSPACE, true, 'asc', DOCROOT, $ignore);
     $label = Widget::Label('Destination Directory');
     $options = array(array('/workspace', false, '/workspace'));
     if (!empty($directories) and 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[{$order}][destination]", $options));
     if (isset($errors['destination'])) {
         $label = Widget::wrapFormElementWithError($label, $errors['destination']);
     }
     $wrapper->appendChild($label);
     // Validator ----------------------------------------------------------
     $this->buildValidationSelect($wrapper, $this->get('validator'), "fields[{$order}][validator]", 'upload');
     $this->appendRequiredCheckbox($wrapper);
     $this->appendShowColumnCheckbox($wrapper);
 }
 public function __viewIndex()
 {
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Utilities'))));
     $this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new utility'), 'class' => 'create button')));
     $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
     $utilities = $utilities['filelist'];
     $uTableHead = array(array(__('Name'), 'col'));
     $uTableBody = array();
     $colspan = count($uTableHead);
     if (!is_array($utilities) or empty($utilities)) {
         $uTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
     } else {
         foreach ($utilities as $util) {
             $uRow = Widget::TableData(Widget::Anchor($util, ADMIN_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/'));
             $uRow->appendChild(Widget::Input("items[{$util}]", null, 'checkbox'));
             $uTableBody[] = Widget::TableRow(array($uRow));
         }
     }
     $table = Widget::Table(Widget::TableHead($uTableHead), null, Widget::TableBody($uTableBody), array('id' => 'utilities-list'));
     $this->Form->appendChild($table);
     $tableActions = $this->createElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
Esempio n. 7
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 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);
 }
 function buildSelectField($field, $start, $current, $parent = NULL, $element_name, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $exclude = NULL, $settingsPannel = NULL)
 {
     if (!($tree = $this->getTree($field, $start, $exclude))) {
         return Widget::Select(NULL, NULL, array('disabled' => 'true'));
     }
     $right = array($tree[0]['rgt']);
     if (!$settingsPannel) {
         $options = array(array(NULL, NULL, 'None'));
     } elseif ($settingsPannel && count($tree) == 1) {
         return new XMLElement('p', __('It looks like youre trying to create a field. Perhaps you want categories first? <br/><a href="%s">Click here to create some.</a>', array(URL . '/symphony/extension/nested_cats/overview/new/')));
     } else {
         $options = array(array($tree[0]['id'], NULL, 'Full Tree'));
     }
     array_shift($tree);
     $selected = isset($parent) ? $parent : $current;
     foreach ($tree as $o) {
         while ($right[count($right) - 1] < $o['rgt']) {
             array_pop($right);
         }
         $options[] = array($o['id'], $o['id'] == $selected, str_repeat('- ', count($right) - 1) . $o['title']);
         $right[] = $o['rgt'];
     }
     $select = Widget::Select('fields' . $fieldnamePrefix . '[' . $element_name . ']' . $fieldnamePostfix, $options, count($tree) > 0 ? NULL : array('disabled' => 'true'));
     return $select;
 }
Esempio n. 10
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);
 }
 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);
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Sections'))));
     $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . 'new/', __('Create a section'), 'create button'));
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
     $aTableBody = array();
     if (!is_array($sections) || empty($sections)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         $bOdd = true;
         foreach ($sections as $s) {
             $entry_count = intval(Symphony::Database()->fetchVar('count', 0, "SELECT count(*) AS `count` FROM `tbl_entries` WHERE `section_id` = '" . $s->get('id') . "' "));
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($s->get('name'), $this->_Parent->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$entry_count}", URL . '/symphony/publish/' . $s->get('handle') . '/'));
             $td3 = Widget::TableData($s->get('navigation_group'));
             $td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), $bOdd ? 'odd' : NULL);
             $bOdd = !$bOdd;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm'), array('delete-entries', false, __('Delete Entries'), 'confirm'));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
    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() . '
			';
    }
 /**
  * Generates the view on the publish page
  *
  * @param XMLElement               $wrapper
  *	 The XMLElement wrapper in which the view is placed
  * @param string                   $fieldname
  *	 The name of the field
  * @param array                    $options
  *	 The options
  * @param fieldSelectBox_Link_image $field
  *	 The field instance
  *
  * @return void
  */
 public function generateView(XMLElement &$wrapper, $fieldname, $options, fieldSelectBox_Link_image $field)
 {
     $attributes['class'] = 'target';
     if ($field->get('allow_multiple_selection')) {
         $attributes['multiple'] = 'multiple';
     }
     $wrapper->appendChild(Widget::Select($fieldname, $options, $attributes));
 }
 public function view()
 {
     //Page options
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Campaign Monitor Subscribers'))));
     $this->appendSubheading(__('Campaign Monitor Subscribers'));
     //Form action
     $this->Form->setAttribute('action', $this->_Parent->getCurrentPageURL());
     //Get Campaign Monitor preferences
     $api_key = $this->_Parent->Configuration->get('api_key', 'campaign_monitor');
     $list_id = $this->_Parent->Configuration->get('list_id', 'campaign_monitor');
     //New Campaign Monitor instance
     $cm = new CampaignMonitor($api_key);
     //Get subscriber list
     $result = $cm->subscribersGetActive(0, $list_id);
     $subscribers = $result['anyType']['Subscriber'];
     //Subscriber table headers
     $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Date Subscribed'), 'col'), array(__('Status'), 'col'));
     $aTableBody = array();
     if (!is_array($subscribers) || empty($subscribers)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('You currently have no subscribers.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         if (is_array($subscribers[0])) {
             //Check if the subscriber list is longer than one, in which case it's an array of arrays
             foreach ($subscribers as $subscriber) {
                 $td1 = Widget::TableData($subscriber["Name"]);
                 $td2 = Widget::TableData($subscriber["EmailAddress"]);
                 $td2->appendChild(Widget::Input('items[' . $subscriber["EmailAddress"] . ']', 'on', 'checkbox'));
                 $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscriber["Date"])));
                 $td4 = Widget::TableData($subscriber["State"]);
                 //Add table data to row and body
                 $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
             }
         } else {
             //Single subscriber
             $td1 = Widget::TableData($subscribers["Name"]);
             $td2 = Widget::TableData($subscribers["EmailAddress"]);
             $td2->appendChild(Widget::Input('items[' . $subscribers["EmailAddress"] . ']', 'on', 'checkbox'));
             $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscribers["Date"])));
             $td4 = Widget::TableData($subscribers["State"]);
             //Add table data to row and body
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable');
     //Append the subscriber table to the page
     $this->Form->appendChild($table);
     //Actions for this page
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('unsubscribe', false, __('Unsubscribe')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     //Append actions to the page
     $this->Form->appendChild($tableActions);
 }
 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);
 }
Esempio n. 17
0
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     field::displaySettingsPanel($wrapper, $errors);
     // ## bucket Folder
     // $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(__('Bucket'));
     try {
         $buckets = $this->S3->listBuckets();
     } catch (Exception $e) {
     }
     $options = array();
     if (!empty($buckets) && is_array($buckets)) {
         foreach ($buckets as $b) {
             $options[] = array($b, $this->get('bucket') == $b, $b);
         }
     }
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][bucket]', $options));
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     if (isset($errors['bucket'])) {
         $div->appendChild(Widget::Error($label, $errors['bucket']));
     } else {
         $div->appendChild($label);
     }
     $label = Widget::Label(__('CNAME'));
     $label->appendChild(new XMLElement('i', __('Optional')));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][cname]', htmlspecialchars($this->get('cname'))));
     if (isset($errors['cname'])) {
         $div->appendChild(Widget::Error($label, $errors['cname']));
     } else {
         $div->appendChild($label);
     }
     $wrapper->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $this->buildValidationSelect($wrapper, $this->get('validator'), 'fields[' . $this->get('sortorder') . '][validator]', 'upload');
     $setting = new XMLElement('label', '<input name="fields[' . $this->get('sortorder') . '][ssl_option]" value="1" type="checkbox"' . ($this->get('ssl_option') != 0 || $this->get('ssl_option') == null ? ' checked="checked"' : '') . '/> ' . __('Build links using https://'));
     $div->appendChild($setting);
     $setting = new XMLElement('label', '<input name="fields[' . $this->get('sortorder') . '][unique_filename]" value="1" type="checkbox"' . ($this->get('unique_filename') != 0 || $this->get('unique_filename') == null ? ' checked="checked"' : '') . '/> ' . __('Automatically give the files a unique filename'));
     $div->appendChild($setting);
     $wrapper->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $setting = new XMLElement('label', '<input name="fields[' . $this->get('sortorder') . '][remove_from_bucket]" value="1" type="checkbox"' . ($this->get('remove_from_bucket') != 0 || $this->get('remove_from_bucket') == null ? ' checked="checked"' : '') . '/> ' . __('Remove file from S3 upon deletion of entry'));
     $div->appendChild($setting);
     $this->appendRequiredCheckbox($div);
     $wrapper->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $this->appendShowColumnCheckbox($div);
     $wrapper->appendChild($div);
 }
 /**
  * Display the settings panel
  *
  * @param      $wrapper
  * @param null $errors
  *
  * @return void
  */
 public function displaySettingsPanel(XMLElement &$wrapper, $errors = NULL)
 {
     // Just load the regular settings panel:
     parent::displaySettingsPanel($wrapper, $errors);
     $fieldset = new XMLElement('div', null, array('class' => 'two columns'));
     // Parent created
     $label = Widget::Label(null, null, 'column');
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][show_created]', 'yes', 'checkbox');
     if ($this->get('show_created') == 1) {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue(__('<br />%s Only show entries created by the parent entry', array($input->generate())));
     $fieldset->appendChild($label);
     // View picker
     $label = Widget::Label(__('View'), null, 'column');
     $options = array();
     $files = glob(EXTENSIONS . '/selectbox_link_field_image/views/view.*.php');
     foreach ($files as $file) {
         require_once $file;
         $handle = str_replace(array('view.', '.php'), '', basename($file));
         $class_name = 'SBLPView_' . ucfirst($handle);
         /** @var $view SBLPView */
         $view = new $class_name();
         $options[] = array($handle, $this->get('view') == $handle, $view->getName());
     }
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][view]', $options));
     $fieldset->appendChild($label);
     $wrapper->insertChildAt(4, $fieldset);
     $fieldset = new XMLElement('div', null, array('class' => 'three columns'));
     // Create button
     $label = Widget::Label(null, null, 'column');
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][enable_create]', 'yes', 'checkbox');
     if ($this->get('enable_create') == 1) {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue(__('<br />%s Enable Create button', array($input->generate())));
     $fieldset->appendChild($label);
     // Edit button
     $label = Widget::Label(null, null, 'column');
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][enable_edit]', 'yes', 'checkbox');
     if ($this->get('enable_edit') == 1) {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue(__('<br />%s Enable Edit button', array($input->generate())));
     $fieldset->appendChild($label);
     // Delete button
     $label = Widget::Label(null, null, 'column');
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][enable_delete]', 'yes', 'checkbox');
     if ($this->get('enable_delete') == 1) {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue(__('<br />%s Enable Delete button', array($input->generate())));
     $fieldset->appendChild($label);
     $wrapper->insertChildAt(5, $fieldset);
 }
Esempio n. 19
0
 public function addCachingOpportunity($context)
 {
     $current_cache = Symphony::Configuration()->get('remotedatasource', 'caching');
     $label = Widget::Label(__('Remote Datasource'));
     $options = array();
     foreach ($context['available_caches'] as $handle => $cache_name) {
         $options[] = array($handle, $current_cache == $handle || !isset($current_cache) && $handle === 'database', $cache_name);
     }
     $select = Widget::Select('settings[caching][remotedatasource]', $options, array('class' => 'picker'));
     $label->appendChild($select);
     $context['wrapper']->appendChild($label);
 }
    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)) {
            //Template
            $label = new XMLElement('label', __('Reset Password Email Template'));
            $reset_password_templates = extension_Members::setActiveTemplate($templates, 'reset-password-template');
            $label->appendChild(Widget::Select('members[reset-password-template][]', $reset_password_templates, array('multiple' => 'multiple')));
            $div->appendChild($label);
        }
        // Auto Login
        $div->appendChild(Widget::Input("members[auto-login]", 'no', 'hidden'));
        $label = new XMLElement('label');
        $input = Widget::Input("members[auto-login]", 'yes', 'checkbox');
        if (extension_Members::getSetting('reset-password-auto-login') == 'yes') {
            $input->setAttribute('checked', 'checked');
        }
        $label->setValue(__('%s Automatically log the member in after changing their password', array($input->generate())));
        $div->appendChild($label);
        $div->appendChild(Widget::Input('members[event]', 'reset-password', 'hidden'));
        $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
        return '
				<p>This event requires the user to enter their recovery code and then their new password. Should the recovery code
				be correct and the new password validate, the member\'s password will be changed to their new password.</p><p>
				A recovery code is available by including the
				Member: Password field in a data source on the same page as this event, or by using
				the event\'s result.</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 the member\'s recovery code, either the member\'s email address or username and two password
				fields (one for password, one to confirm) will allow the member to change their password.</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;label&gt;Recovery Code: &lt;input name="fields[password][recovery-code]" type="text" value="{$code}"/&gt;&lt;/label&gt;
					&lt;label&gt;Password: &lt;input name="fields[password][password]" type="password" /&gt;&lt;/label&gt;
					&lt;label&gt;Confirm Password: &lt;input name="fields[password][confirm]" type="password" /&gt;&lt;/label&gt;
					&lt;input type="hidden" name="members-section-id" value="{$your-section-id}"/&gt;
					&lt;input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Recover Account"/&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-Reset-Password">wiki</a>.</p>
				' . $div->generate() . '
			';
    }
Esempio n. 21
0
 function view()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Translation Manager'))));
     $this->appendSubheading(__('Languages'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . 'edit/', __('Create new translation'), 'create button'));
     $link = new XMLElement('link');
     $link->setAttributeArray(array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen', 'href' => URL . '/extensions/translationmanager/assets/admin.css'));
     $this->addElementToHead($link, 500);
     $this->addScriptToHead(URL . '/extensions/translationmanager/assets/admin.js', 501);
     $default = $this->_tm->defaultDictionary();
     $translations = $this->_tm->listAll();
     $allextensions = $this->_Parent->ExtensionManager->listAll();
     $current = $this->_Parent->Configuration->get('lang', 'symphony');
     $warnings = array_shift($default);
     $allnames = array('symphony' => __('Symphony'));
     foreach ($allextensions as $extension => $about) {
         $allnames[$extension] = $about['name'];
     }
     $aTableHead = array(array(__('Name'), 'col'), array(__('Code'), 'col'), array(__('Extensions*'), 'col', array('title' => __('Out of %s (including Symphony)', array(count($allextensions) + 1)))), array(__('Translated*'), 'col', array('title' => __('Out of %1$s (with %2$s parser warnings)', array(count($default), count($warnings) > 0 ? count($warnings) : __('no'))))), array(__('Obsolete'), 'col'), array(__('Current'), 'col'));
     $aTableBody = array();
     if (!is_array($translations) || empty($translations)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         foreach ($translations as $lang => $extensions) {
             $language = $this->_tm->get($lang);
             $translated = array_intersect_key(array_filter($language['dictionary'], 'trim'), $default);
             $obsolete = array_diff_key($language['dictionary'], $default);
             $names = array_intersect_key($allnames, array_fill_keys($extensions, true));
             if (!$language['about']['name']) {
                 $language['about']['name'] = $lang;
             }
             $td1 = Widget::TableData(Widget::Anchor($language['about']['name'], $this->_Parent->getCurrentPageURL() . 'edit/' . $lang . '/', $lang));
             $td2 = Widget::TableData($lang);
             $td3 = Widget::TableData((string) count($extensions), NULL, NULL, NULL, array('title' => implode(', ', $names)));
             $td4 = Widget::TableData(count($translated) . ' <small>(' . floor(count($translated) / count($default) * 100) . '%)</small>');
             $td5 = Widget::TableData((string) count($obsolete));
             $td6 = Widget::TableData($lang == $current ? __('Yes') : __('No'));
             $td1->appendChild(Widget::Input('item', $lang, 'radio'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6), 'single' . ($lang == $this->_Parent->Configuration->get('lang', 'symphony') ? ' current' : ''));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'languages');
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')), array('switch', false, __('Make it current')), array('export', false, __('Export ZIP')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
 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);
             }
         }
     }
     // Get available languages
     $languages = Lang::getAvailableLanguages(new ExtensionManager(Administration::instance()));
     if (count($languages) > 1) {
         // Create language selection
         $group = new XMLElement('fieldset');
         $group->setAttribute('class', 'settings');
         $group->appendChild(new XMLElement('legend', __('System Language')));
         $label = Widget::Label();
         // Get language names
         asort($languages);
         foreach ($languages as $code => $name) {
             $options[] = array($code, $code == Symphony::Configuration()->get('lang', 'symphony'), $name);
         }
         $select = Widget::Select('settings[symphony][lang]', $options);
         $label->appendChild($select);
         $group->appendChild($label);
         $group->appendChild(new XMLElement('p', __('Authors can set up a differing language in their profiles.'), array('class' => 'help')));
         // Append language selection
         $this->Form->appendChild($group);
     }
     ###
     # 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);
 }
 public function displaySettingsPanel(XMLElement &$wrapper, $errors = null)
 {
     Field::displaySettingsPanel($wrapper, $errors);
     $options = array();
     $div = new XMLElement('div', NULL, array('class' => 'two columns'));
     try {
         $buckets = $this->s3->listBuckets();
         $options = array();
         if (!empty($buckets) && is_array($buckets)) {
             foreach ($buckets as $b) {
                 $bucketName = $b['Name'];
                 $options[] = array($bucketName, $this->get('bucket') == $bucketName, $bucketName);
             }
         }
     } catch (Exception $e) {
     }
     $label = Widget::Label(__('Bucket'));
     $label->setAttribute('class', 'column');
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][bucket]', $options));
     if (isset($errors['bucket'])) {
         $div->appendChild(Widget::Error($label, $errors['bucket']));
     } else {
         $div->appendChild($label);
     }
     $label = Widget::Label(__('CNAME'));
     $label->setAttribute('class', 'column');
     $label->appendChild(new XMLElement('i', __('Optional')));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][cname]', htmlspecialchars($this->get('cname'))));
     if (isset($errors['cname'])) {
         $div->appendChild(Widget::Error($label, $errors['cname']));
     } else {
         $div->appendChild($label);
     }
     $wrapper->appendChild($div);
     $this->buildValidationSelect($wrapper, $this->get('validator'), 'fields[' . $this->get('sortorder') . '][validator]', 'upload');
     $div = new XMLElement('div', NULL, array('class' => 'two columns'));
     $setting = new XMLElement('label', '<input name="fields[' . $this->get('sortorder') . '][ssl_option]" value="1" type="checkbox"' . ($this->get('ssl_option') != 0 || $this->get('ssl_option') == null ? ' checked="checked"' : '') . '/> ' . __('Build links using https://'), array('class' => 'column'));
     $div->appendChild($setting);
     $setting = new XMLElement('label', '<input name="fields[' . $this->get('sortorder') . '][unique_filename]" value="1" type="checkbox"' . ($this->get('unique_filename') != 0 || $this->get('unique_filename') == null ? ' checked="checked"' : '') . '/> ' . __('Automatically give the files a unique filename'), array('class' => 'column'));
     $div->appendChild($setting);
     $wrapper->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'two columns'));
     $setting = new XMLElement('label', '<input name="fields[' . $this->get('sortorder') . '][remove_from_bucket]" value="1" type="checkbox"' . ($this->get('remove_from_bucket') != 0 || $this->get('remove_from_bucket') == null ? ' checked="checked"' : '') . '/> ' . __('Remove file from S3 upon deletion of entry'), array('class' => 'column'));
     $div->appendChild($setting);
     $this->appendRequiredCheckbox($div);
     $wrapper->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'two columns'));
     $this->appendShowColumnCheckbox($div);
     $wrapper->appendChild($div);
 }
Esempio n. 24
0
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     // get current section id
     parent::displaySettingsPanel($wrapper, $errors);
     $section_id = Administration::instance()->Page->_context[1];
     //choose page
     $label = Widget::Label(__('xsl:fo page'));
     $pages = Symphony::Database()->fetch("SELECT tbl_pages.id FROM `tbl_pages` LEFT JOIN `tbl_pages_types` ON tbl_pages.id=tbl_pages_types.page_id WHERE tbl_pages_types.type = 'fop' ORDER BY sortorder ASC");
     if (!empty($pages)) {
         foreach ($pages as $page) {
             $options[] = array($page['id'], $page['id'] == $this->get('page'), '/' . Administration::instance()->resolvePagePath($page['id']));
         }
     }
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][page]', $options));
     $wrapper->appendChild($label);
     ## Destination Folder
     $ignore = array('/workspace/events', '/workspace/data-sources', '/workspace/text-formatters', '/workspace/pages', '/workspace/utilities');
     $directories = General::listDirStructure(WORKSPACE, null, true, 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);
     }
     //filename
     $label = Widget::Label(__('Filename pattern'));
     $label->appendChild(new XMLElement('i', 'You can use xPath to build dinamic values'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][filename]', $this->get('filename')));
     $wrapper->appendChild($label);
     $available_fields = $this->findAllFields($section_id);
     if (is_array($available_fields) && !empty($available_fields)) {
         $fieldslist = new XMLElement('ul');
         $fieldslist->setAttribute('class', 'tags inline');
         foreach ($available_fields as $field) {
             $fieldslist->appendChild(new XMLElement('li', '{' . $field . '}'));
         }
         $wrapper->appendChild($fieldslist);
     }
 }
 public function addPrototypeFieldset($context)
 {
     $page = Administration::instance()->Page;
     $page_context = $page->getContext();
     $form = $context['form'];
     if ($page_context[0] == 'new' || $page_context[0] == 'edit') {
         // Add prototype page type
         $elements = $form->getChildren();
         $fieldset = $elements[0]->getChildren();
         $group = $fieldset[2]->getChildren();
         $div = $group[1]->getChildren();
         $types = $div[2]->getChildren();
         // Search for existing prototype type
         $flag = false;
         foreach ($types as $type) {
             if ($type->getValue() == 'prototype') {
                 $flag = true;
             }
         }
         // Append maintenance type
         if ($flag == false) {
             $mode = new XMLElement('li', 'prototype');
             $div[2]->appendChild($mode);
         }
         // Add prototype fieldset
         $page_id = $page_context[1];
         if (isset($page_id)) {
             $page_prototype = PagePrototypes::fetchPrototypeOfPage($page_id);
             $prototype_id = $page_prototype['id'];
         }
         $prototypes = PagePrototypes::fetchPrototypes();
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings');
         $fieldset->appendChild(new XMLElement('legend', __('Prototype')));
         $fieldset->appendChild(new XMLElement('p', __('This page will inherit the template and settings from the selected prototype.'), array('class' => 'help')));
         $div = new XMLElement('div');
         $label = Widget::Label(__('Prototype Page'));
         $options = array(array('', false, __('None')));
         if (!empty($prototypes)) {
             foreach ($prototypes as $prototype) {
                 $options[] = array($prototype['id'], $prototype_id == $prototype['id'], $prototype['title']);
             }
         }
         $label->appendChild(Widget::Select('fields[prototype_id]', $options, array('id' => 'prototype_pages-prototype_id')));
         $div->appendChild($label);
         $fieldset->appendChild($div);
         $form->prependChild($fieldset);
     }
 }
    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)) {
            // Template
            $label = new XMLElement('label', __('Activate Account Email Template'));
            $activate_account_templates = extension_Members::setActiveTemplate($templates, 'activate-account-template');
            $label->appendChild(Widget::Select('members[activate-account-template][]', $activate_account_templates, array('multiple' => 'multiple')));
            $div->appendChild($label);
        }
        // Auto Login
        $div->appendChild(Widget::Input("members[auto-login]", 'no', 'hidden'));
        $label = new XMLElement('label');
        $input = Widget::Input("members[auto-login]", 'yes', 'checkbox');
        if (extension_Members::getSetting('activate-account-auto-login') == 'yes') {
            $input->setAttribute('checked', 'checked');
        }
        $label->setValue(__('%s Automatically log the member in after activation', array($input->generate())));
        $div->appendChild($label);
        // Add Save Changes
        $div->appendChild(Widget::Input('members[event]', 'activate-account', 'hidden'));
        $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
        return '
				<p>This event takes an activation code and an identifier for the Member (either Email or Username) to activate their account.
				An activation code is available by including the Members: Activation field in a data source on the same page as this event, or by using
				the event\'s result.</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 the member\'s activation code and 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;label&gt;Activation: &lt;input name="fields[activation]" type="text" value="{$code}"/&gt;&lt;/label&gt;
					&lt;input type="hidden" name="members-section-id" value="{$your-section-id}"/&gt;
					&lt;input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Activate Account"/&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-Activate-Account">wiki</a>.</p>
				' . $div->generate() . '
			';
    }
Esempio n. 27
0
 function __viewIndex()
 {
     $this->addStylesheetToHead(URL . '/extensions/nested_cats/assets/nested_cats.css', 'screen', 120);
     $this->addScriptToHead(URL . '/extensions/nested_cats/assets/nested_cats.js', 200);
     $this->setTitle('Symphony &ndash; Nested Cats &ndash; Overview');
     $this->setPageType('table');
     $this->appendSubheading('Overview', Widget::Anchor('Create New', URL . '/symphony/extension/nested_cats/overview/new/', 'Create a new category', 'create button'));
     $aTableHead = array(array('Title', 'col'));
     $tree = $this->_driver->getTree('lft', 0);
     $right = array($tree[0]['rgt']);
     array_shift($tree);
     if (!is_array($tree) || empty($tree)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData('None found.', 'inactive', NULL, count($aTableHead)))));
     } else {
         $tableData = array();
         foreach ($tree as $branch) {
             while ($right[count($right) - 1] < $branch['rgt']) {
                 array_pop($right);
             }
             $isBranch = $branch['rgt'] != $branch['lft'] + 1 ? true : false;
             $c = count($right) - 1;
             $class = $isBranch ? 'n' . $c . ' is_branch' : 'n' . $c;
             $tableData[] = Widget::TableData(Widget::Anchor($branch['title'], $this->_Parent->getCurrentPageURL() . 'edit/' . $branch['id'] . '/', 'Edit Category: ' . $branch['title'], $class));
             ###### With-Selected Input
             $tableData[count($tableData) - 1]->appendChild(Widget::Input('items[' . $branch['id'] . ']', NULL, 'checkbox'));
             $aTableBody[] = Widget::TableRow($tableData, $bEven ? 'even' : NULL);
             $bEven = !$bEven;
             unset($tableData);
             $right[] = $branch['rgt'];
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, 'With Selected...'), array('delete', false, 'Delete'));
     $wrapDiv = new XMLElement('div');
     $wrapDiv->appendChild(Widget::Select('with-selected', $options, array('id' => 'sel')));
     $wrapDiv->appendChild(Widget::Input('action[apply]', 'Apply', 'submit'));
     $tableActions->appendChild($wrapDiv);
     // 		$tableActions->appendChild(Widget::Select('with-selected', $options, array('id' => 'sel')));
     // 		$tableActions->appendChild(Widget::Input('action[apply]', 'Apply', 'submit'));
     $notice = new XMLElement('p', 'All categories that are decsendants of selected will be also deleted.');
     $notice->setAttribute('id', 'note');
     $notice->setAttribute('class', 'hidden');
     $tableActions->appendChild($notice);
     $this->Form->appendChild($tableActions);
 }
Esempio n. 28
0
 public function __createPageList($context, $datasource)
 {
     $options = array();
     $total_selected = 0;
     foreach ($this->_pages as $page) {
         $selected = in_array($datasource, explode(',', $page['data_sources']));
         if ($selected) {
             $total_selected++;
         }
         $options[] = array($page['id'], $selected, '/' . $this->_Parent->resolvePagePath($page['id']));
     }
     $section = Widget::Label('Pages');
     $section->appendChild(Widget::Select('settings[' . $datasource . '][]', $options, array('multiple' => 'multiple')));
     $context->appendChild($section);
     return $total_selected;
 }
Esempio n. 29
0
 function view()
 {
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/filemanager/assets/styles.css', 'screen', 70);
     $FileManager =& $this->_Parent->ExtensionManager->create('filemanager');
     $path = DOCROOT . $FileManager->getStartLocation() . (is_array($this->_context) && !empty($this->_context) ? '/' . implode('/', $this->_context) . '/' : NULL);
     if (is_writable($path)) {
         // Build file/dir creation menu
         $create_menu = new XMLElement('ul');
         $create_menu->setAttribute('class', 'create-menu');
         $li = new XMLElement('li');
         $li->appendChild(Widget::Anchor(__('New Directory'), extension_filemanager::baseURL() . 'new/directory/' . (is_array($this->_context) && !empty($this->_context) ? implode('/', $this->_context) . '/' : NULL), __('New Directory'), 'button create'));
         $create_menu->appendChild($li);
         $li = new XMLElement('li');
         $li->appendChild(Widget::Anchor(__('New File'), extension_filemanager::baseURL() . 'new/file/' . (is_array($this->_context) && !empty($this->_context) ? implode('/', $this->_context) . '/' : NULL), __('New File'), 'button create'));
         $create_menu->appendChild($li);
         $li = new XMLElement('li');
         $li->appendChild(Widget::Anchor(__('Upload File'), extension_filemanager::baseURL() . 'new/upload/' . (is_array($this->_context) && !empty($this->_context) ? implode('/', $this->_context) . '/' : NULL), __('Upload File'), 'button create'));
         $create_menu->appendChild($li);
     } else {
         $create_menu = new XMLElement('p', __('This directory is not writable'));
         $create_menu->setAttribute('class', 'create-menu');
     }
     $this->setPageType('table');
     $this->appendSubheading(trim($FileManager->getStartLocationLink(), '/') . (is_array($this->_context) ? $FileManager->buildBreadCrumbs($this->_context) : NULL));
     $this->Form->appendChild($create_menu);
     $Iterator = new DirectoryIterator($path);
     $aTableHead = array(array(__('Name'), 'col'), array(__('Size'), 'col'), array(__('Permissions'), 'col'), array(__('Modified'), 'col'), array(__('Available Actions'), 'col'));
     $aTableBody = array();
     if (iterator_count($Iterator) <= 0) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         foreach ($Iterator as $file) {
             if ($row = $FileManager->buildTableRow($file, $path != DOCROOT . $FileManager->getStartLocation())) {
                 $aTableBody[] = $row;
             }
         }
     }
     sort($aTableBody);
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('archive', false, __('Archive')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Sections'))));
     $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a section'), 'create button', NULL, array('accesskey' => 'c')));
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
     $aTableBody = array();
     if (!is_array($sections) || empty($sections)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         foreach ($sections as $s) {
             $entry_count = intval(Symphony::Database()->fetchVar('count', 0, "SELECT count(*) AS `count` FROM `tbl_entries` WHERE `section_id` = '" . $s->get('id') . "' "));
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($s->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$entry_count}", SYMPHONY_URL . '/publish/' . $s->get('handle') . '/'));
             $td3 = Widget::TableData($s->get('navigation_group'));
             $td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', '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), 'orderable selectable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected sections?'))), array('delete-entries', false, __('Delete Entries'), 'confirm', null, array('data-message' => __('Are you sure you want to delete all entries in the selected sections?'))));
     if (is_array($sections) && !empty($sections)) {
         $index = 3;
         $options[$index] = array('label' => __('Set navigation group'), 'options' => array());
         $groups = array();
         foreach ($sections as $s) {
             if (in_array($s->get('navigation_group'), $groups)) {
                 continue;
             }
             $groups[] = $s->get('navigation_group');
             $value = 'set-navigation-group-' . urlencode($s->get('navigation_group'));
             $options[$index]['options'][] = array($value, false, $s->get('navigation_group'));
         }
     }
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }