public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['tableClass'] = 'small-dataTable'; $view['columns'] = array(array('name' => 'Name'), array('name' => 'Issuer'), array('name' => 'ExpireDate'), array('name' => 'Actions')); $view['rows'] = $this->fetchCertificatesDatabase(); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->isAuthNeeded === TRUE && $this->getRequest()->isMutation()) { $view->getCommandList('/Notification')->showMessage($view->translate('Join_failed_message'), \Nethgui\Module\Notification\AbstractNotification::NOTIFY_ERROR); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['domain'] = \Nethgui\array_end(explode('.', \gethostname(), 2)); $view['Provider'] = $this->provider; $view['Details'] = $this->details; }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['logFile'] = ''; if ($this->getRequest()->isValidated()) { $view['logFile'] = $this->logFile; $args = array($this->logFile); if ($this->offset) { array_unshift($args, '-o', $this->offset); } if ($this->query) { array_unshift($args, '-p', $this->query); } if ($this->isRegexp) { array_unshift($args, '-r'); } $command = $this->prepareCommand('/usr/bin/sudo /sbin/e-smith/logviewer', $args); //$this->getLog()->notice($command); $view->getCommandList('/Main')->setDecoratorTemplate(function (\Nethgui\View\ViewInterface $view) use($command) { // Discard any output buffer: while (ob_get_level() > 0) { ob_end_clean(); } header(sprintf('Content-Type: %s', 'text/plain; charset=UTF-8')); passthru($command); exit(0); }); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $domain = $this->getPlatform()->getDatabase('configuration')->getType('DomainName'); $system = $this->getPlatform()->getDatabase('configuration')->getType('SystemName'); $view['FQDN'] = "{$system}.{$domain}"; }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['MaxPassAgeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('30' => $view->translate('${0} days', array(30)), '60' => $view->translate('${0} days', array(60)), '90' => $view->translate('${0} days', array(90)), '180' => $view->translate('${0} days', array(180)), '365' => $view->translate('${0} days', array(365)))); $view['MinPassAgeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('0' => $view->translate('${0} days', array(0)), '30' => $view->translate('${0} days', array(30)), '60' => $view->translate('${0} days', array(60)), '90' => $view->translate('${0} days', array(90)), '180' => $view->translate('${0} days', array(180)), '365' => $view->translate('${0} days', array(365)))); $view['PassWarningDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('7' => $view->translate('${0} days', array(7)), '15' => $view->translate('${0} days', array(15)), '30' => $view->translate('${0} days', array(30)))); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->getRequest()->isValidated()) { $view->getCommandList()->show(); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->parameters['switch']) { $view->getCommandList()->httpHeader('HTTP/1.1 302 Found')->httpHeader('Location: ' . $view->getSiteUrl() . $view->getPathUrl() . $this->parameters['switch'] . '/' . implode('/', $this->getRequest()->getOriginalPath())); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $h = self::getQuotaUiFunction($this->getPlatform()->getDatabase('configuration')); $view['QuotaDefaultSizeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($h); $view['SpamRetentionTimeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource(array('1d' => $view->translate('${0} day', array(1)), '2d' => $view->translate('${0} days', array(2)), '4d' => $view->translate('${0} days', array(4)), '7d' => $view->translate('${0} days', array(7)), '15d' => $view->translate('${0} days', array(15)), '30d' => $view->translate('${0} days', array(30)), '60d' => $view->translate('${0} days', array(60)), '90d' => $view->translate('${0} days', array(90)), '180d' => $view->translate('${0} days', array(180)), 'infinite' => $view->translate('ever'))); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['statusDatasource'] = array(array('enabled', $view->translate('enabled_label')), array('disabled', $view->translate('disabled_label'))); $view['externalFreqDatasource'] = array_map(function ($fmt) use($view) { return array((string) $fmt, $view->translate($fmt . '_label')); }, array(5, 10, 15, 30, 60)); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->getRequest()->isValidated()) { $view['componentsDatasource'] = $this->getComponentsDatasourceViewValue($view); $view->getCommandList()->show(); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $port = $this->getPlatform()->getDatabase('configuration')->getProp('cups', 'TCPPort'); $hostname = $this->getPlatform()->getDatabase('configuration')->getType('SystemName'); $domain = $this->getPlatform()->getDatabase('configuration')->getType('DomainName'); // redirect to CUPS web interface $view->getCommandList()->httpHeader("Location: https://{$hostname}.{$domain}:{$port}"); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['username'] = $this->userName; $view['FullName'] = $this->getPlatform()->getDatabase('NethServer::Database::Passwd')->getProp($this->userName, 'gecos'); $provider = new \NethServer\Tool\UserProvider($this->getPlatform()); $view['readOnly'] = $provider->isReadOnly(); $view['ChangePassword'] = $view->getModuleUrl('../ChangePassword'); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->getRequest()->isValidated()) { $view->getCommandList()->show(); if ($view['LetsEncryptDomains'] === '') { $view['LetsEncryptDomains'] = \gethostname(); } } }
public function prepareView(\Nethgui\View\ViewInterface $view) { $sz = array('10' => '10 MB', '20' => '20 MB', '50' => '50 MB', '100' => '100 MB', '200' => '200 MB', '500' => '500 MB', '1000' => '1 GB', $this->parameters['MessageSizeMax'] => sprintf('%s MB', $this->parameters['MessageSizeMax'])); ksort($sz, SORT_NUMERIC); $view['MessageSizeMaxDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($sz); $lt = array('1' => $view->translate('${0} day', array(1)), '2' => $view->translate('${0} days', array(2)), '4' => $view->translate('${0} days', array(4)), '7' => $view->translate('${0} days', array(7)), '15' => $view->translate('${0} days', array(15)), '30' => $view->translate('${0} days', array(30)), $this->parameters['MessageQueueLifetime'] => $view->translate('${0} days', array($this->parameters['MessageQueueLifetime']))); ksort($lt, SORT_NUMERIC); $view['MessageQueueLifetimeDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($lt); parent::prepareView($view); }
/** * Add default Cancel and FormAction URLs * * @param \Nethgui\View\ViewInterface $view */ public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if (!isset($view['Cancel'])) { $view['Cancel'] = $view->getModuleUrl('/' . \Nethgui\array_head($view->resolvePath(''))); } if (!$this instanceof \Nethgui\Module\ModuleCompositeInterface) { $view['FormAction'] = $view->getModuleUrl(implode('/', $this->getRequest()->getPath())); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if (!$this->templates) { $this->templates = $this->readTemplates(); } $view['TemplateDatasource'] = array_map(function ($fmt) use($view) { $lang = substr($fmt, 19, 2); return array($fmt, $view->translate('lang_' . $lang . '_label')); }, $this->templates); }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $ips = array(); foreach ($this->getPlatform()->getDatabase('networks')->getAll() as $key => $values) { if (isset($values['role']) && $values['role'] == 'green') { $ips[] = $values['ipaddr']; } } $view['ips'] = $ips; }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $domain = $this->getPlatform()->getDatabase('configuration')->getType('DomainName'); $system = $this->getPlatform()->getDatabase('configuration')->getType('SystemName'); $view['FQDN'] = "{$system}.{$domain}"; $ds = array(); foreach ($this->getNetworkInterfaces() as $key => $props) { $ds[] = array($key, $key . ' - ' . $props['role']); } $view['InterfacesDatasource'] = $ds; }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->adapter instanceof \Nethgui\Adapter\AdapterInterface) { $view['packages'] = array(); $values = iterator_to_array($this->adapter); usort($values, function ($a, $b) { return strcmp($a['name'][0], $b['name'][0]); }); $view['packages'] = $values; $view->getCommandList()->show(); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->getRequest()->isMutation()) { if ($this->joinError === TRUE) { $this->notifications->error('Invalid credentials'); } else { $view->getCommandList('/Main')->sendQuery($view->getModuleUrl('/Account')); } } elseif (!$view['login']) { $view['login'] = '******'; } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if (!isset($this->process)) { return; } if ($this->getRequest()->isMutation()) { if ($this->process->getExitCode() === 0) { $view->getCommandList()->shutdown($view->getModuleUrl() . '?wait=0', $this->parameters['Action'], array($view->translate('shutdown_' . $this->parameters['Action']), $view->translate('test'))); } else { $view->getCommandList('/Notification')->showMessage("error " . $this->process->getOutput(), \Nethgui\Module\Notification\AbstractNotification::NOTIFY_ERROR); } } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if (!$this->backup) { $this->backup = $this->getBackupInfo(); } if (isset($this->backup['size'])) { $view['size'] = round($this->backup['size'] / 1024, 2) . ' KB'; $view['date'] = date("o-m-d G:i", $this->backup['date']); } else { $view['size'] = '-'; $view['date'] = '-'; } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $this->notifications->defineTemplate('adminTodo', \NethServer\Module\AdminTodo::TEMPLATE, 'bg-yellow'); $T = function ($msg, $args = array()) use($view) { return $view->translate($msg, $args); }; $view['cards'] = $this->getCards($T); if ($this->getRequest()->isValidated()) { $view->getCommandList()->show(); } if ($this->getRequest()->isMutation()) { $this->getPlatform()->setDetachedProcessCondition('success', array('location' => array('url' => $view->getModuleUrl('/NetworkAdapter?renameSuccess'), 'freeze' => TRUE))); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); if ($this->getRequest()->isValidated()) { $view['PolicyDatasource'] = array_map(function ($fmt) use($view) { return array($fmt, $view->translate($fmt . '_label')); }, $this->policies); $view['ExternalPingDatasource'] = array_map(function ($fmt) use($view) { return array($fmt, $view->translate($fmt . '_label')); }, array('enabled', 'disabled')); $view['MACValidationPolicyDatasource'] = array_map(function ($fmt) use($view) { return array($fmt, $view->translate($fmt . '_label')); }, $this->mac_policies); $view->getCommandList()->show(); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { if ($this->getRequest()->isMutation()) { $this->getPlatform()->setDetachedProcessCondition('success', array('location' => array('url' => $view->getModuleUrl('/Account/DomainController?installSuccess'), 'freeze' => TRUE))); } parent::prepareView($view); $view['NetbiosDomain'] = $this->getPlatform()->getDatabase('configuration')->getProp('smb', 'Workgroup'); if (!$view['NetbiosDomain']) { $domainName = $this->getPlatform()->getDatabase('configuration')->getType('DomainName'); $view['NetbiosDomain'] = \Nethgui\array_head(explode('.', $domainName)); } $view['NetbiosDomain'] = strtoupper(substr($view['NetbiosDomain'], 0, 15)); if ($this->getRequest()->hasParameter('installSuccess')) { $view->getCommandList('/Main')->sendQuery($view->getModuleUrl('/Account')); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $this->notifications->defineTemplate('adminTodo', self::TEMPLATE, 'bg-yellow'); $view['todos'] = array_map(function ($todo) use($view) { if (isset($todo['action']['url'])) { $todo['action']['url'] = $view->getModuleUrl($todo['action']['url']); } return $todo; }, $this->readTodos()); if ($this->emitNotifications) { foreach ($view['todos'] as $todo) { $this->notifications->adminTodo($todo); } } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view['updates'] = $this->getParent()->getYumUpdates(); $view['updates_count'] = count($view['updates']); $view['changelog'] = $this->getParent()->getYumChangelog(); if ($view['updates_count'] > 0) { $this->notifications->warning($view->translate('updates_available_message', array('updates_count' => $view['updates_count']))); } if ($this->getRequest()->hasParameter('updateSuccess')) { $this->notifications->message($view->translate('update_success_message', array('updates_count' => $view['updates_count']))); } if ($this->getRequest()->isMutation()) { $this->getPlatform()->setDetachedProcessCondition('success', array('location' => array('url' => $view->getModuleUrl('../Update?updateSuccess'), 'freeze' => TRUE))); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { $this->addReadonlyAdapter($view, 'Source', 'SrcRaw'); $this->addReadonlyAdapter($view, 'Destination', 'DstRaw'); $this->addReadonlyAdapter($view, 'Service', 'ServiceRaw'); parent::prepareView($view); $view->setTemplate('NethServer\\Template\\FirewallRules\\Rule'); if (!$this->getRequest()->isValidated()) { return; } $view['RuleId'] = $this->ruleId; if (!$this->getRequest()->isMutation()) { $view->getCommandList()->show(); } else { $view->getCommandList()->sendQuery($view->getModuleUrl($this->getNextRequest())); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $changes = array(); $steps = $this->getPlatform()->getDatabase('SESSION')->getType(get_class($this->getParent())); foreach (is_array($steps) ? $steps : array() as $job) { $message = $job['message']; $module = $this->getParent()->getAction($message['module']); $changes[] = $view->getTranslator()->translate($module ? $module : $this, $message['id'], $message['args']); } $view['changes'] = $changes; // TODO: fetch the module title instead of the module identifier $view['redirect'] = $view->translate('redirect_message', array('moduleTitle' => $this->redirectModule)); if ($this->getRequest()->isMutation()) { $this->getPlatform()->setDetachedProcessCondition('success', array('location' => array('url' => $view->getModuleUrl('../Review?redirect'), 'freeze' => TRUE))); } }