public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $keyValue = \Nethgui\array_head($request->getPath());
     $this->getAdapter()->setKeyValue($keyValue);
     parent::bind($request);
     $this->parameters['active'] = $this->getIdentifier() === 'enable' ? 'YES' : 'NO';
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $ruleId = \Nethgui\array_head($request->getPath());
     if (!$this->getAdapter()->offsetExists($ruleId)) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399992974);
     }
     parent::bind($request);
     $this->parameters['ruleId'] = $ruleId;
 }
 protected function bindPosition(\Nethgui\Controller\RequestInterface $request)
 {
     $A = $this->getAdapter();
     $position = \Nethgui\array_head($request->getPath());
     $id = $request->spawnRequest($position)->getParameter('id');
     if (isset($id, $A[$id])) {
         $this->copyDefaults = \iterator_to_array($A[$id]);
     }
     return $position;
 }
Exemple #4
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $keyValue = \Nethgui\array_head($request->getPath());
     $A = $this->getParent()->getAdapter();
     if (!isset($A[$keyValue])) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399033549);
     }
     if (isset($A[$keyValue]['role']) && in_array($A[$keyValue]['role'], array('bridged', 'slave', 'alias'))) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399033550);
     }
     $this->getAdapter()->setKeyValue($keyValue);
     parent::bind($request);
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $keyValue = \Nethgui\array_head($request->getPath());
     $adapter = $this->getParent()->getAdapter();
     if (!isset($adapter[$keyValue])) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456905);
     }
     if (!in_array($adapter[$keyValue]['type'], array('bridge', 'bond', 'alias', 'vlan', 'xdsl'))) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456906);
     }
     parent::bind($request);
     $this->parameters['type'] = $adapter[$keyValue]['type'];
     $this->parameters['device'] = $keyValue;
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $keyValue = \Nethgui\array_head($request->getPath());
     $adapter = $this->getParent()->getAdapter();
     if (!isset($adapter[$keyValue])) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456808);
     }
     $props = $adapter[$keyValue];
     if ($props['type'] !== 'ethernet') {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399456809);
     }
     parent::bind($request);
     $this->parameters['device'] = $keyValue;
 }
Exemple #7
0
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $idList = array_filter($request->getParameterNames(), function ($p) use($request) {
         return is_array($request->getParameter($p));
     });
     $this->moduleId = \Nethgui\array_head($request->getPath());
     if (!$this->moduleId) {
         return;
     }
     try {
         foreach ($idList as $moduleIdentifier) {
             $moduleInstance = $this->moduleSet->getModule($moduleIdentifier);
             $this->addChild($moduleInstance);
         }
     } catch (\Nethgui\Exception\AuthorizationException $ex) {
         throw $ex;
     } catch (\RuntimeException $ex) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1324379722, $ex);
     }
     $this->authorize($request);
     parent::bind($request);
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $ruleId = \Nethgui\array_head($request->getPath());
     if (!$this->getAdapter()->offsetExists($ruleId)) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1399992975);
     }
     $this->worker->ruleId = $ruleId;
     $this->worker->bind($request);
     $subrequest = $request->spawnRequest($ruleId);
     if ($subrequest->hasParameter('f') || $subrequest->hasParameter('Submit')) {
         // resume values from
         $this->workflow->resume($this->getParent()->getSession())->copyTo($this->worker->parameters, array('SrcRaw', 'DstRaw', 'ServiceRaw', 'status', 'Description', 'LogType', 'Action'));
     } else {
         // start new workflow
         $defaults = array();
         foreach (array('SrcRaw', 'DstRaw', 'ServiceRaw', 'status', 'Description', 'LogType', 'Action') as $f) {
             if ($request->hasParameter($f)) {
                 $defaults[$f] = $request->getParameter($f);
             }
         }
         $this->workflow->start($this->getParent()->getSession(), $this->getIdentifier(), 'Edit/' . $ruleId, $ruleId, $defaults);
     }
 }
Exemple #9
0
 /**
  *
  * @param \Nethgui\Controller\RequestInterface $originalRequest
  * @return \Nethgui\Module\Menu
  */
 public function setCurrentModuleIdentifier(\Nethgui\Controller\RequestInterface $originalRequest)
 {
     $this->currentItem = \Nethgui\array_head($originalRequest->getPath());
     return $this;
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $this->setUserName(\Nethgui\array_end($request->getPath()));
     parent::bind($request);
 }
 protected function bindPosition(\Nethgui\Controller\RequestInterface $request)
 {
     return \Nethgui\array_head($request->getPath());
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $keyValue = '/' . implode('/', $request->getPath());
     $this->getAdapter()->setKeyValue($keyValue);
     parent::bind($request);
 }