Example #1
0
 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][o:source]');
     $urlInput->setOptions(['label' => $view->translate('Video URL'), 'info' => $view->translate('URL for the video to embed.')]);
     $urlInput->setAttributes(['id' => 'media-youtube-source-__index__', 'required' => true]);
     $urlInput->setAttributes(['id' => 'media-youtube-source-__index__', 'required' => true]);
     $startInput = new Text('o:media[__index__][start]');
     $startInput->setOptions(['label' => $view->translate('Start'), 'info' => $view->translate('Begin playing the video at the given number of seconds from the start of the video.')]);
     $endInput = new Text('o:media[__index__][end]');
     $endInput->setOptions(['label' => $view->translate('End'), 'info' => $view->translate('End playing the video at the given number of seconds from the start of the video.')]);
     return $view->formRow($urlInput) . $view->formRow($startInput) . $view->formRow($endInput);
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][o:source]');
     $urlInput->setOptions(['label' => $view->translate('oEmbed URL'), 'info' => $view->translate('URL for the media to embed.')]);
     $urlInput->setAttributes(['id' => 'media-oembed-source-__index__', 'required' => true]);
     return $view->formRow($urlInput);
 }
Example #3
0
 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][ingest_url]');
     $urlInput->setOptions(['label' => $view->translate('URL'), 'info' => $view->translate('A URL to the media.')]);
     $urlInput->setAttributes(['id' => 'media-url-ingest-url-__index__', 'required' => true]);
     return $view->formRow($urlInput);
 }
Example #4
0
 /**
  * {@inheritDoc}
  */
 public function form(PhpRenderer $view, array $options = [])
 {
     $fileInput = new File('file[__index__]');
     $fileInput->setOptions(['label' => $view->translate('Upload File')]);
     $fileInput->setAttributes(['id' => 'media-file-input-__index__']);
     $field = $view->formRow($fileInput);
     return $field . '<input type="hidden" name="o:media[__index__][file_index]" value="__index__">';
 }
Example #5
0
 public function form(PhpRenderer $view, SiteRepresentation $site, SitePageBlockRepresentation $block = null)
 {
     $textarea = new Textarea("o:block[__blockIndex__][o:data][html]");
     $textarea->setAttribute('class', 'block-html full wysiwyg');
     if ($block) {
         $textarea->setAttribute('value', $this->getData($block->data(), 'html'));
     }
     return $view->formRow($textarea);
 }
Example #6
0
 public function form(PhpRenderer $view, SiteRepresentation $site, SitePageBlockRepresentation $block = null)
 {
     $text = new Text("o:block[__blockIndex__][o:data][query]");
     if ($block) {
         $text->setAttribute('value', $this->getData($block->data(), 'query'));
     }
     $html = '<div class="field"><div class="field-meta">';
     $html .= '<label>' . $view->translate('Query') . '</label>';
     $html .= '<div class="field-description">' . $view->translate('Display resources using this search query') . '</div>';
     $html .= '</div>';
     $html .= '<div class="inputs">' . $view->formRow($text) . '</div></div>';
     return $html;
 }
Example #7
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->getName() == 'Deploy') {
         foreach ($fieldset as $element) {
             // Default renderer would prepend
             $output .= $view->formRow($element, 'append') . "\n";
         }
     } else {
         $output .= parent::renderFieldset($view, $fieldset);
     }
     return $output;
 }
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->has('Groups')) {
         $groups = $fieldset->get('Groups');
         if ($groups->count()) {
             $output = "<div>\n";
             foreach ($groups as $element) {
                 if ($element instanceof \Zend\Form\Element\Radio) {
                     $label = $view->htmlTag('a', $view->escapeHtml($element->getLabel()), array('href' => $view->consoleUrl('group', 'general', array('name' => $element->getLabel()))));
                     $output .= $view->htmlTag('fieldset', "<legend>{$label}</legend>\n" . $view->formRadio($element));
                 }
             }
             $output .= $view->formRow($fieldset->get('Submit'));
             $output .= "\n</div>\n";
         }
     }
     return $output;
 }
Example #9
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->has('Packages')) {
         $packages = $fieldset->get('Packages');
         if ($packages->count()) {
             $formRow = $view->plugin('FormRow');
             $translatorEnabled = $formRow->isTranslatorEnabled();
             $formRow->setTranslatorEnabled(false);
             $output = "<div class='table'>\n";
             foreach ($packages as $package) {
                 $output .= $view->formRow($package, 'append') . "\n\n";
             }
             $output .= "<span class='cell'></span>\n";
             $output .= $view->formSubmit($fieldset->get('Submit')) . "\n";
             $output .= "</div>\n";
             $formRow->setTranslatorEnabled($translatorEnabled);
         }
     }
     return $output;
 }
Example #10
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = "<div class='table'>\n";
     $output .= "<fieldset><legend><span>What to save</span></legend>\n";
     $output .= $view->formRow($fieldset->get('What'));
     $output .= "</fieldset>\n";
     $output .= "<fieldset><legend><span>Where to save</span></legend>\n";
     $output .= $view->formRow($fieldset->get('Where'));
     foreach (array('NewGroup', 'Description') as $name) {
         $element = $fieldset->get($name);
         $output .= $view->formRow($element, null, false);
         $output .= $view->formElementErrors($element, array('class' => 'error'));
     }
     $output .= $view->formRow($fieldset->get('ExistingGroup'));
     $output .= "</fieldset>\n";
     $output .= $view->formRow($fieldset->get('Submit'));
     $output .= "</div>\n";
     return $output;
 }
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = "<div class='table'>\n";
     $types = $this->get('Types');
     foreach ($this->_definedTypes as $name => $count) {
         $element = $types->get($name);
         if ($element->getMessages()) {
             $element->setAttribute('class', 'input-error');
         }
         $row = $view->formText($element);
         if ($count == 0) {
             $row .= $view->htmlElement('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deletedevicetype', array('name' => $name))), true);
         }
         $output .= $view->htmlElement('div', $row);
         $output .= $view->formElementErrors($element, array('class' => 'error'));
         $output .= "\n";
     }
     $add = $this->get('Add');
     $output .= $view->formRow($add, null, false);
     $output .= $view->formElementErrors($add, array('class' => 'error'));
     $output .= $view->formRow($this->get('Submit'));
     $output .= "\n</div>\n";
     return $output;
 }
Example #12
0
 /**
  * Get the HTML editor textarea markup.
  *
  * @param PhpRenderer $view
  * @param string $id HTML ID for the textarea
  * @param string $value Value to pre-fill
  *
  * @return string
  */
 protected function getForm(PhpRenderer $view, $id, $value = '')
 {
     $view->ckEditor();
     $textarea = new Textarea('o:media[__index__][html]');
     $textarea->setOptions(['label' => $view->translate('HTML'), 'info' => $view->translate('HTML or plain text.')]);
     $textarea->setAttributes(['rows' => 15, 'id' => $id, 'required' => true, 'class' => 'media-html', 'value' => $value]);
     $field = $view->formRow($textarea);
     $field .= "\n            <script type='text/javascript'>\n                \$('#{$id}').ckeditor();\n            </script>\n        ";
     return $field;
 }
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = '';
     $name = $fieldset->getName();
     switch ($name) {
         case 'inspect':
             $output .= "<div class='textcenter'>\n";
             $output .= $view->formRow($fieldset->get('inspect'), 'append') . "\n";
             $output .= "</div>\n";
             break;
         case 'existing':
             $table = '';
             foreach ($this->_definedValues as $value) {
                 $id = $value['Id'];
                 $element = $fieldset->get("value_{$id}_name");
                 $row = $view->htmlElement('td', $view->formElement($element) . $view->formElementErrors($element, array('class' => 'errors')));
                 $row .= $view->htmlElement('td', $view->escapeHtml($element->getLabel()));
                 $row .= $view->htmlElement('td', $view->htmlElement('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deleteregistryvalue', array('name' => $value['Name'])))));
                 $table .= $view->htmlElement('tr', $row);
             }
             $output .= $view->htmlElement('table', $table);
             break;
         case 'new_value':
             $output .= parent::renderFieldset($view, $fieldset);
             break;
         default:
             if ($fieldset == $this) {
                 $output .= $this->renderFieldset($view, $fieldset->get('inspect'));
                 if (count($this->_definedValues)) {
                     $output .= $view->htmlElement('h2', $view->translate('Values'));
                     $output .= $this->renderFieldset($view, $fieldset->get('existing'));
                 }
                 $output .= $view->htmlElement('h2', $view->translate('Add'));
                 $output .= $this->renderFieldset($view, $fieldset->get('new_value'));
             }
             break;
     }
     return $output;
 }
Example #14
0
 public function form(PhpRenderer $view, array $options = [])
 {
     $urlInput = new UrlElement('o:media[__index__][o:source]');
     $urlInput->setOptions(['label' => $view->translate('IIIF Image URL'), 'info' => $view->translate('URL for the image to embed.')]);
     return $view->formRow($urlInput);
 }
Example #15
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = "<div class='table'>\n";
     $fields = $this->get('Fields');
     foreach ($this->_definedFields as $name => $type) {
         $element = $fields->get($name);
         if ($element->getMessages()) {
             $element->setAttribute('class', 'input-error');
         }
         $row = $view->formText($element) . "\n";
         $row .= $view->htmlTag('span', $view->translate($type), array('class' => 'cell'));
         $row .= $view->htmlTag('span', $view->htmlTag('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deletefield', array('name' => $name))), true), array('class' => 'cell'));
         $output .= $view->htmlTag('div', $row, array('class' => 'row'));
         $output .= $view->formElementErrors($element, array('class' => 'error'));
         $output .= "\n";
     }
     $newName = $this->get('NewName');
     $output .= $view->htmlTag('div', $view->formRow($newName, null, false) . $view->formRow($this->get('NewType')), array('class' => 'row'));
     $output .= $view->formElementErrors($newName, array('class' => 'error'));
     $output .= $view->formRow($this->get('Submit'));
     $output .= "\n</div>\n";
     return $output;
 }
Example #16
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $headers = array('Id' => 'ID', 'Name' => $view->translate('Name'), 'NetworkInterface.MacAddress' => $view->translate('MAC address'), 'Serial' => $view->translate('Serial number'), 'AssetTag' => $view->translate('Asset tag'), 'LastContactDate' => $view->translate('Last contact'));
     $renderCriteria = function ($view, $client, $property) {
         $value = $client[$property];
         if ($value === null) {
             // NULL values are never considered for duplicates and cannot be blacklisted.
             return;
         }
         if ($property == 'NetworkInterface.MacAddress') {
             $property = 'MacAddress';
         }
         // Hyperlink to blacklist form
         return $view->htmlElement('a', $view->escapeHtml($value), array('href' => $view->consoleUrl('duplicates', 'allow', array('criteria' => $property, 'value' => $value))), true);
     };
     $renderCallbacks = array('Id' => function ($view, $client) {
         // Display ID and a checkbox. Render checkbox manually because
         // ZF's MultiCheckbox element does not handle duplicate values.
         // $_POST['clients'] will become an array of selected
         // (possibly duplicate) IDs.
         return sprintf('<input type="checkbox" name="clients[]" value="%d">%d', $client['Id'], $client['Id']);
     }, 'Name' => function ($view, $client) {
         // Hyperlink to "customfields" page of given client.
         // This allows for easy review of the information about to be merged.
         return $view->htmlElement('a', $view->escapeHtml($client['Name']), array('href' => $view->consoleUrl('client', 'customfields', array('id' => $client['Id']))), true);
     }, 'NetworkInterface.MacAddress' => $renderCriteria, 'Serial' => $renderCriteria, 'AssetTag' => $renderCriteria);
     $formContent = $view->table($this->getOption('clients'), $headers, array('order' => $this->getOption('order'), 'direction' => $this->getOption('direction')), $renderCallbacks);
     $formContent .= "<div>\n";
     foreach ($this as $element) {
         $formContent .= $view->formRow($element, 'append') . "\n";
     }
     $formContent .= "</div>\n";
     return $formContent;
 }
Example #17
0
 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = $view->htmlTag('div', $view->formRow($fieldset->get('DeleteInterfaces'), 'append'));
     $output .= $view->htmlTag('div', $view->formRow($fieldset->get('yes')) . $view->formRow($fieldset->get('no')));
     return $output;
 }