コード例 #1
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);
 }
コード例 #2
0
 function displaySettingsPanel(XMLElement &$wrapper, $errors = null)
 {
     // Initialize field settings based on class defaults (name, placement)
     field::displaySettingsPanel($wrapper, $errors);
     /*-----------------------------------------------------------------------*/
     $columns = new XMLElement('div', null, array('class' => 'two columns'));
     $wrapper->appendChild($columns);
     // Prepopulation
     $checkbox = Widget::Input('fields[' . $this->get('sortorder') . '][prepopulate]', 'yes', 'checkbox');
     if ((int) $this->get('prepopulate') === 1) {
         $checkbox->setAttribute('checked', 'checked');
     }
     $setting = new XMLElement('label', __('%s Pre-populate with current date', array($checkbox->generate())), array('class' => 'column'));
     $columns->appendChild($setting);
     // Time
     $checkbox = Widget::Input('fields[' . $this->get('sortorder') . '][time]', 'yes', 'checkbox');
     if ((int) $this->get('time') === 1) {
         $checkbox->setAttribute('checked', 'checked');
     }
     $setting = new XMLElement('label', __('%s Display time', array($checkbox->generate())), array('class' => 'column'));
     $columns->appendChild($setting);
     // Multiple dates
     $checkbox = Widget::Input('fields[' . $this->get('sortorder') . '][multiple]', 'yes', 'checkbox');
     if ((int) $this->get('multiple') === 1) {
         $checkbox->setAttribute('checked', 'checked');
     }
     $setting = new XMLElement('label', __('%s Allow multiple dates', array($checkbox->generate())), array('class' => 'column'));
     $columns->appendChild($setting);
     // Date ranges
     $checkbox = Widget::Input('fields[' . $this->get('sortorder') . '][range]', 'yes', 'checkbox');
     if ((int) $this->get('range') === 1) {
         $checkbox->setAttribute('checked', 'checked');
     }
     $setting = new XMLElement('label', __('%s Enable date ranges', array($checkbox->generate())), array('class' => 'column'));
     $columns->appendChild($setting);
     /*-----------------------------------------------------------------------*/
     // General
     $fieldset = new XMLElement('fieldset');
     $group = new XMLElement('div', NULL, array('class' => 'two columns'));
     $this->appendRequiredCheckbox($group);
     $this->appendShowColumnCheckbox($group);
     $fieldset->appendChild($group);
     $wrapper->appendChild($fieldset);
 }