Esempio n. 1
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     if (!$this->getRequest()->isValidated()) {
         $this->getAdapter()->setLoader(NULL);
     } else {
         $view->getCommandList()->show();
     }
     if ($this->getRequest()->hasParameter('installSuccess')) {
         $this->getAction('AdminTodo')->emitNotifications = TRUE;
         $this->notifications->message($view->translate('package_success'));
     }
     parent::prepareView($view);
 }
Esempio n. 2
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     if (!$this->getRequest()->isValidated()) {
         $this->getAdapter()->setLoader(NULL);
     } else {
         $view->getCommandList()->show();
     }
     if ($this->getRequest()->hasParameter('installSuccess')) {
         $this->getAction('AdminTodo')->emitNotifications = TRUE;
         $this->notifications->yumSuccess(array('message' => $view->translate('YumSuccess_message'), 'description' => $view->translate('YumSuccess_description'), 'buttonLabel' => $view->translate('YumSuccess_button_label'), 'action' => $view->getModuleUrl('..')));
     } elseif ($this->getRequest()->hasParameter('installFailure')) {
         $taskStatus = $this->systemTasks->getTaskStatus($this->getRequest()->getParameter('taskId'));
         if (isset($taskStatus['children'][0]['message'])) {
             $message = $taskStatus['children'][0]['message'];
         } else {
             $message = $view->translate('An unknown installation error has occurred');
         }
         $this->notifications->yumError(array('message' => $message, 'description' => $view->translate('ClearYumCache_description'), 'buttonLabel' => $view->translate('ClearYumCache_label'), 'action' => $view->getModuleUrl('../ClearYumCache')));
     }
     parent::prepareView($view);
     if (isset($this->yumError)) {
         $this->notifications->yumError(array('message' => $this->yumError, 'description' => $view->translate('ClearYumCache_description'), 'buttonLabel' => $view->translate('ClearYumCache_label'), 'action' => $view->getModuleUrl('../ClearYumCache')));
     }
 }
Esempio n. 3
0
 /**
  * XXX: experimental -> CSS injection 
  **/
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     $cssCode = "\n           tr.running td:nth-child(3) { color: green }\n           tr.stopped td:nth-child(3) { color: red }\n       ";
     $view->getCommandList('/Resource/css')->appendCode($cssCode, 'css');
     $moduleUrl = json_encode($view->getModuleUrl("/Dashboard/Services"));
     $jsCode = "\n(function ( \$ ) {\n    \$(document).ready(function() {\n        \$.Nethgui.Server.ajaxMessage({\n            isMutation: false,\n            url: {$moduleUrl}\n        });\n    });\n} ( jQuery ));\n       ";
     $view->getCommandList('/Resource/js')->appendCode($jsCode, 'js');
     parent::prepareView($view);
 }
Esempio n. 4
0
 public function getCommandList($selector = '')
 {
     return $this->view->getCommandList($selector);
 }
 /**
  * Save a request/response round, putting the next view data in the response
  * 
  * @param \Nethgui\View\ViewInterface $view 
  */
 private function prepareNextViewOptimized(\Nethgui\View\ViewInterface $view)
 {
     $np = $this->currentAction->nextPath();
     if ($np === FALSE) {
         return;
     }
     $nextModule = $this->getAction(\Nethgui\array_head(explode('/', $np)));
     $location = $view->getModuleUrl($np);
     if ($nextModule instanceof \Nethgui\View\ViewableInterface) {
         // spawn and prepare the next view data:
         $nextView = $view->spawnView($nextModule, TRUE);
         $nextModule->prepareView($nextView);
         if ($view->getTargetFormat() === $view::TARGET_JSON) {
             $nextView->getCommandList()->prefetched();
             // placeholder.
             $nextView->getCommandList()->show();
             // Display the prefetched view
             $this->getPlatform()->setDetachedProcessCondition('success', array('location' => array('url' => $location . '?taskStatus=success&taskId={taskId}'), 'freeze' => TRUE))->setDetachedProcessCondition('failure', array('location' => array('url' => $location . '?taskStatus=failure&taskId={taskId}'), 'freeze' => TRUE));
         } else {
             // show is implemented as HTTP redirection. Avoid self-loops:
             if ($nextModule !== $this->currentAction) {
                 $view->getCommandList()->sendQuery($location);
             }
         }
     } else {
         // next path does not corresponds to a child action: start
         // a new query request to get the next view data:
         $view->getCommandList()->sendQuery($location);
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     $view->getCommandList()->sendQuery($view->getModuleUrl('/UserProfile'));
 }