/**
  * Renders the output
  *
  * @return  string
  *
  * @throws  Zend_Controller_Action_Exception
  */
 public function render()
 {
     if (!$this->getPane(self::SEARCH_PANE)->hasDashlets()) {
         throw new Zend_Controller_Action_Exception(t('Page not found'), 404);
     }
     return parent::render();
 }
Beispiel #2
0
 /**
  * Build AddUrl form elements
  *
  * @see Form::createElements()
  */
 public function createElements(array $formData)
 {
     $groupElements = array();
     $panes = array();
     if ($this->dashboard) {
         $panes = $this->dashboard->getPaneKeyTitleArray();
     }
     $this->addElement('hidden', 'org_pane', array('required' => false));
     $this->addElement('hidden', 'org_dashlet', array('required' => false));
     $this->addElement('text', 'url', array('required' => true, 'label' => $this->translate('Url'), 'description' => $this->translate('Enter url to be loaded in the dashlet. You can paste the full URL, including filters.'), 'validators' => array(new UrlValidator(), new InternalUrlValidator())));
     $this->addElement('text', 'dashlet', array('required' => true, 'label' => $this->translate('Dashlet Title'), 'description' => $this->translate('Enter a title for the dashlet.')));
     $this->addElement('note', 'note', array('decorators' => array(array('HtmlTag', array('tag' => 'hr')))));
     $this->addElement('checkbox', 'create_new_pane', array('autosubmit' => true, 'required' => false, 'label' => $this->translate('New dashboard'), 'description' => $this->translate('Check this box if you want to add the dashlet to a new dashboard')));
     if (empty($panes) || isset($formData['create_new_pane']) && $formData['create_new_pane'] != false) {
         $this->addElement('text', 'pane', array('required' => true, 'label' => $this->translate('New Dashboard Title'), 'description' => $this->translate('Enter a title for the new dashboard')));
     } else {
         $this->addElement('select', 'pane', array('required' => true, 'label' => $this->translate('Dashboard'), 'multiOptions' => $panes, 'description' => $this->translate('Select a dashboard you want to add the dashlet to')));
     }
 }
Beispiel #3
0
 /**
  * Build AddUrl form elements
  *
  * @see Form::createElements()
  */
 public function createElements(array $formData)
 {
     $groupElements = array();
     $panes = array();
     if ($this->dashboard) {
         $panes = $this->dashboard->getPaneKeyTitleArray();
     }
     $this->addElement('hidden', 'org_pane', array('required' => false));
     $this->addElement('hidden', 'org_dashlet', array('required' => false));
     $this->addElement('text', 'url', array('required' => true, 'label' => $this->translate('Url'), 'description' => $this->translate('Enter url being loaded in the dashlet. You can paste the full URL, including filters.')));
     $this->addElement('text', 'dashlet', array('required' => true, 'label' => $this->translate('Dashlet Title'), 'description' => $this->translate('Enter a title for the dashlet.'), 'validators' => array(array('Regex', false, array('pattern' => '/^[^\\[\\]]+$/', 'messages' => array('regexNotMatch' => $this->translate('The name cannot contain \'[\' or \']\'.')))))));
     $this->addElement('note', 'note', array('decorators' => array(array('HtmlTag', array('tag' => 'hr')))));
     if (empty($panes) || isset($formData['create_new_pane']) && $formData['create_new_pane'] != false) {
         $this->addElement('text', 'pane', array('required' => true, 'label' => $this->translate("New Dashboard Title"), 'description' => $this->translate('Enter a title for the new pane.')));
     } else {
         $this->addElement('select', 'pane', array('required' => true, 'label' => $this->translate('Dashboard'), 'multiOptions' => $panes, 'description' => $this->translate('Select a pane you want to add the dashlet.')));
     }
     $this->addElement('checkbox', 'create_new_pane', array('autosubmit' => true, 'required' => false, 'label' => $this->translate('New dashboard'), 'description' => $this->translate('Check this box if you want to add the dashlet to a new dashboard')));
 }
 /**
  * @expectedException \Icinga\Exception\ConfigurationError
  */
 public function testWhetherDetermineActivePaneThrowsAnExceptionIfCouldNotDetermine()
 {
     $dashboard = new Dashboard();
     $dashboard->determineActivePane();
 }