public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getRequest()->isValidated()) {
         $view->getCommandList()->sendQuery($view->getModuleUrl('/MailQueue/read'));
     }
 }
 public function nextPath()
 {
     if ($this->getRequest()->isMutation()) {
         return 'ConfirmInterfaceCreation';
     }
     return parent::nextPath();
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['WanMode'] = $this->getPlatform()->getDatabase('configuration')->getProp('firewall', 'WanMode');
     $view['WanModeDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->modes);
 }
 public function process()
 {
     parent::process();
     if ($this->getRequest()->isMutation()) {
         $ndb = $this->getPlatform()->getDatabase('networks');
         $ndb->deleteKey($this->parameters['device']);
         $this->getAdapter()->flush();
     }
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $this->declareParameter('username', Validate::USERNAME);
     parent::bind($request);
     $username = \Nethgui\array_end($request->getPath());
     if (!$username) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1322148400);
     }
     $this->parameters['username'] = $username;
 }
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $this->declareParameter('service', Validate::ANYTHING);
     parent::bind($request);
     $service = \Nethgui\array_end($request->getPath());
     if (!$service) {
         throw new \Nethgui\Exception\HttpException('Not found', 404, 1454344500);
     }
     $this->parameters['service'] = $service;
 }
Example #7
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['username'] = $this->getAdapter()->getKeyValue();
     $view['ChangePassword'] = $view->getModuleUrl('../ChangePassword');
     $defaults = array_merge(array('Company' => '', 'Department' => '', 'City' => '', 'Street' => '', 'PhoneNumber' => ''), $this->getPlatform()->getDatabase('configuration')->getKey('OrganizationContact'));
     $view['Default_Company'] = $defaults['Company'];
     $view['Default_Dept'] = $defaults['Department'];
     $view['Default_City'] = $defaults['City'];
     $view['Default_Street'] = $defaults['Street'];
     $view['Default_Phone'] = $defaults['PhoneNumber'];
 }
 public function validate(\Nethgui\Controller\ValidationReportInterface $report)
 {
     parent::validate($report);
     if (!$this->getRequest()->isMutation()) {
         return;
     }
     $crtValidator = $this->createValidator()->platform('pem-certificate');
     $keyValidator = $this->createValidator()->platform('rsa-key');
     if (!$crtValidator->evaluate($_FILES['crt']['tmp_name'])) {
         $report->addValidationError($this, 'UploadCrt', $crtValidator);
     }
     if (!$keyValidator->evaluate($_FILES['key']['tmp_name'])) {
         $report->addValidationError($this, 'UploadKey', $keyValidator);
     }
     if (file_exists(sprintf('/etc/pki/tls/certs/%s.crt', $this->parameters['UploadName']))) {
         $report->addValidationErrorMessage($this, 'UploadName', 'vaild_UploadName_file_exists');
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['message'] = $this->getMessageText($view);
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['ibay'] = $this->key;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['values'] = $this->parameters->getArrayCopy();
     $view['actions'] = $this->getActionsText($view);
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $X2 = function ($x) use($view) {
         if ($x === '') {
             return array($x, $view->translate("NoSuccessor_label"));
         } else {
             return array($x, $x);
         }
     };
     $view['successorDatasource'] = array_map($X2, array_merge($this->getDeviceParts($this->parameters['device']), array('')));
     $view['message'] = $view->translate(sprintf("DeleteLogicalInterface_%s_message", $this->parameters['type']), \iterator_to_array($this->parameters));
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     $parent = $this->getParent();
     $dsMap = function ($x) use($parent, $view) {
         return array($x, sprintf("%s %s", $x, call_user_func(array($parent, 'getRoleText'), $view, $x)));
     };
     parent::prepareView($view);
     $view['PppoeInterfaceDatasource'] = array_map($dsMap, $this->getValidInterfaces());
 }
 public function initialize()
 {
     parent::initialize();
     $this->declareParameter('HairpinNat', Validate::SERVICESTATUS, array('configuration', 'firewall', 'HairpinNat'));
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view->copyFrom($this->getCertDefaults());
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getRequest()->isValidated()) {
         $view['roleDatasource'] = array_map(function ($fmt) use($view) {
             return array($fmt, $view->translate($fmt . '_label'));
         }, $this->getParent()->getInterfaceRoles());
         $parent = $this->getParent();
         $dsMap = function ($x) use($parent, $view) {
             return array($x, sprintf("%s %s", $x, call_user_func(array($parent, 'getRoleText'), $view, $x)));
         };
         $view['bondDatasource'] = array_map($dsMap, $this->getBondParts());
         $view['bondModeDatasource'] = array_map(function ($x) use($view) {
             return array($x, $view->translate("BondMode_{$x}_label"));
         }, $this->bondModeList);
         $view['bridgeDatasource'] = array_map($dsMap, $this->getBridgeParts());
         if ($this->getRequest()->isMutation()) {
             if ($this->parameters['type'] === 'xdsl') {
                 $view->getCommandList()->sendQuery($view->getModuleUrl('../SetPppoeParameters'));
             } else {
                 $view->getCommandList()->sendQuery($view->getModuleUrl('../SetIpAddress'));
             }
         } else {
             $view->getCommandList()->show();
         }
     }
     if (!$view['type']) {
         $view['type'] = 'bond';
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['messageCount'] = $this->messageCount;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['username'] = $this->userName;
 }
 protected function onParametersSaved($changedParameters)
 {
     parent::onParametersSaved($changedParameters);
     $this->getPlatform()->signalEvent('proxy-modify');
 }
 public function getAuthorizationAttribute($attributeName)
 {
     return $this->innerAction->getAuthorizationAttribute($attributeName);
 }
 public function process()
 {
     $this->getPlatform()->exec('/usr/bin/sudo /usr/libexec/nethserver/fetchmail-wakeup');
     parent::process();
 }
 protected function saveParameters()
 {
     $save1 = parent::saveParameters();
     if (isset($this->originalAdapter)) {
         $save2 = $this->originalAdapter->save();
     } else {
         $save2 = FALSE;
     }
     return $save1 || $save2;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getIdentifier() === 'create') {
         $view['OwnersDatasource'] = $this->getOwnersDatasource($view);
         $view->setTemplate('NethServer\\Template\\MailAccount\\SharedMailbox\\Edit');
         $view['domainAddressDatasource'] = $this->readDomainAddressDatasource($view);
     } elseif ($this->getIdentifier() === 'delete') {
         $view['__key'] = 'Name';
         // tell what is the key parameter
         $view->setTemplate('Nethgui\\Template\\Table\\Delete');
     } elseif ($this->getIdentifier() === 'update') {
         $view['OwnersDatasource'] = $this->getOwnersDatasource($view);
         $view['Others'] = $this->others;
         $view->setTemplate('NethServer\\Template\\MailAccount\\SharedMailbox\\Edit');
     }
     if ($this->getRequest()->isMutation()) {
         if ($this->getRequest()->isValidated() && $this->getIdentifier() === 'create' && $this->parameters['CreateAlias'] === 'enabled') {
             $view->getCommandList()->sendQuery($view->getModuleUrl('/MailAccount/Pseudonym'));
         }
     } else {
         $this->parameters['CreateAlias'] = 'enabled';
     }
 }