Esempio n. 1
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getIdentifier() == 'delete') {
         $view->setTemplate('Nethgui\\Template\\Table\\Delete');
     }
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $h = \NethServer\Module\Mail\Mailbox::getQuotaUiFunction($this->getPlatform()->getDatabase('configuration'));
     $h['unlimited'] = $view->translate('Unlimited_quota');
     $view['MailQuotaCustomDatasource'] = \Nethgui\Renderer\AbstractRenderer::hashToDatasource($h);
     $view['MailSpamRetentionTimeDatasource'] = \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')));
 }
Esempio n. 3
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\TrafficShaping\\Ip\\Modify', 'update' => 'NethServer\\Template\\TrafficShaping\\Ip\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $view['Source'] = $view['SrcRaw'] ? \NethServer\Module\FirewallRules\RuleGenericController::translateFirewallObjectTitle($view, $view['SrcRaw']) : '';
     $view['PriorityDatasource'] = array(array('1', $view->translate('1_label')), array('2', $view->translate('2_label')), array('3', $view->translate('3_label')));
 }
Esempio n. 4
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\TrafficShaping\\Ports\\Modify', 'update' => 'NethServer\\Template\\TrafficShaping\\Ports\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $view['ProtoDatasource'] = array(array('tcp', $view->translate('tcp_label')), array('udp', $view->translate('udp_label')), array('tcp,udp', $view->translate('tcp,udp_label')), array('icmp', $view->translate('icmp_label')));
     $view['PriorityDatasource'] = array(array('1', $view->translate('1_label')), array('2', $view->translate('2_label')), array('3', $view->translate('3_label')));
 }
Esempio n. 5
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\FirewallObjects\\Services\\Modify', 'update' => 'NethServer\\Template\\FirewallObjects\\Services\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $view['ProtocolDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->protocols);
 }
Esempio n. 6
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getIdentifier() == 'delete') {
         $view->setTemplate('Nethgui\\Template\\Table\\Delete');
     }
     $view['DaysDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->days);
 }
Esempio n. 7
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\FirewallObjects\\Zones\\Modify', 'update' => 'NethServer\\Template\\FirewallObjects\\Zones\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     if (!$this->interfaces) {
         $this->interfaces = $this->readInterfaces();
     }
     $view['InterfaceDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $fmt);
     }, $this->interfaces);
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\Fetchmail\\Accounts\\Modify', 'update' => 'NethServer\\Template\\Fetchmail\\Accounts\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $ynds = array(array('YES', $view->translate('YES_label')), array('NO', $view->translate('NO_label')));
     $view['nokeepDatasource'] = $ynds;
     $view['sslDatasource'] = $ynds;
     $view['protoDatasource'] = array(array('pop3', $view->translate('pop3_label')), array('imap', $view->translate('imap_label')));
     if ($this->getRequest()->isValidated()) {
         $view['accountDatasource'] = $this->getAccounts($view);
     }
 }
Esempio n. 9
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\Providers\\Modify', 'update' => 'NethServer\\Template\\Providers\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     if (!$this->interfaces) {
         $this->interfaces = $this->readInterfaces();
     }
     $tmp = array();
     foreach ($this->interfaces as $key) {
         $tmp[] = array($key, $key);
     }
     $view['interfaceDatasource'] = $tmp;
 }
Esempio n. 10
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['DeviceDatasource'] = array_map(function ($fmt) use($view) {
         if ($fmt == '') {
             $label = $view->translate('any_label');
         } else {
             $label = $fmt;
         }
         return array($fmt, $label);
     }, $this->listInterfaces());
     $templates = array('create' => 'NethServer\\Template\\StaticRoutes\\Modify', 'update' => 'NethServer\\Template\\StaticRoutes\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
 }
Esempio n. 11
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getIdentifier() != 'delete') {
         $view->setTemplate('NethServer\\Template\\Proxy\\BypassModify');
     } else {
         $view->setTemplate('Nethgui\\Template\\Table\\Delete');
     }
     $this->prepareVars();
     $h = $view->translate('Hosts_label');
     $hg = $view->translate('HostGroups_label');
     $hosts = $this->arrayToDatasource($this->hosts, 'host');
     $groups = $this->arrayToDatasource($this->hostGroups, 'host-group');
     $view['HostDatasource'] = array(array($hosts, $h), array($groups, $hg));
 }
Esempio n. 12
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\VPN\\Accounts\\Modify', 'update' => 'NethServer\\Template\\VPN\\Accounts\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $users = $this->getPlatform()->getDatabase('accounts')->getAll('user');
     $tmp = array();
     foreach ($users as $user => $props) {
         if (!isset($props['VPNClientAccess']) || $props['VPNClientAccess'] == 'no') {
             $tmp[] = array($user, $user);
         }
     }
     $view['UserDatasource'] = $tmp;
     $view['AccountType'] = 'vpn';
 }
Esempio n. 13
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if (!$this->getRequest()->isValidated()) {
         return;
     }
     $view['accessDatasource'] = array_map(function ($fmt) use($view) {
         $label = $view->translate($fmt . '_label');
         if ($label == $fmt . '_label') {
             $label = $fmt;
         }
         return array($fmt, $label);
     }, $this->listZones());
     $serviceRecord = $this->getPlatform()->getDatabase('configuration')->getKey($this->parameters['name']);
     $view['Config'] = self::getConfigForView($view, $serviceRecord);
 }
Esempio n. 14
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\TrafficShaping\\Interfaces\\Modify', 'update' => 'NethServer\\Template\\TrafficShaping\\Interfaces\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     if ($this->getIdentifier() == 'create') {
         $interfaces = $this->getPlatform()->getDatabase('networks')->getAll('ethernet');
         $configured = $this->getPlatform()->getDatabase('tc')->getAll('device');
         $tmp = array();
         foreach ($interfaces as $interface => $props) {
             if (!in_array($interface, array_keys($configured))) {
                 # add only not configured interface with role red (for now)
                 if (isset($props['role']) && strpos($props['role'], 'red') !== false) {
                     $tmp[] = array($interface, $interface);
                 }
             }
         }
         $view['deviceDatasource'] = $tmp;
     }
 }
Esempio n. 15
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\SharedFolder\\Modify', 'update' => 'NethServer\\Template\\SharedFolder\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $owners = array(array('locals', $view->translate('locals_group_label')));
     $subjects = array(array('locals', $view->translate('locals_group_label')));
     foreach ($this->getPlatform()->getDatabase('accounts')->getAll('group') as $keyName => $props) {
         $entry = array($keyName, sprintf("%s (%s)", isset($props['Description']) ? $props['Description'] : $keyName, $keyName));
         $owners[] = $entry;
         $subjects[] = $entry;
     }
     $view['OwningGroupDatasource'] = $owners;
     foreach ($this->getPlatform()->getDatabase('accounts')->getAll('user') as $keyName => $props) {
         $entry = array($keyName, sprintf("%s (%s)", trim($props['FirstName'] . ' ' . $props['LastName']), $keyName));
         $subjects[] = $entry;
     }
     $view['AclSubjects'] = $subjects;
     $view['reset-permissions'] = $view->getModuleUrl('../reset-permissions/' . $this->getAdapter()->getKeyValue());
 }
Esempio n. 16
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\VPN\\IpsecTunnels\\Modify', 'update' => 'NethServer\\Template\\VPN\\IpsecTunnels\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $view['ikecipherDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->ciphers);
     $view['ikehashDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->hashes);
     $view['ikepfsgroupDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->pfsgroups);
     $view['espcipherDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->ciphers);
     $view['esphashDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->hashes);
     $view['esppfsgroupDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->pfsgroups);
     $left = array();
     foreach ($this->getNetworkInterfaces() as $key => $props) {
         if (isset($props['ipaddr']) && $props['ipaddr']) {
             $label = "{$key} - {$props['ipaddr']}";
         } elseif (isset($props['bootproto']) && $props['bootproto'] === 'dhcp') {
             $label = "{$key} - DHCP";
         } elseif (isset($props['type']) && $props['type'] === 'xdsl') {
             $label = "{$key} - PPPoE";
         } else {
             continue;
         }
         $left[] = array("%{$key}", $label);
     }
     $view['leftDatasource'] = $left;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\Pseudonym\\Modify', 'update' => 'NethServer\\Template\\Pseudonym\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     if (!$this->getRequest()->isMutation() && $this->getRequest()->isValidated()) {
         $view['AccountDatasource'] = $this->getAccountDatasource();
         if ($this->getIdentifier() === 'create') {
             $view['domainAddressDatasource'] = $this->readDomainAddressDatasource($view);
         }
     }
 }
Esempio n. 18
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $this->prepareVars();
     if ($this->getIdentifier() == 'delete') {
         $view->setTemplate('Nethgui\\Template\\Table\\Delete');
     }
     $view['FilterDatasource'] = $this->arrayToDatasource($this->filters, 'filter');
     $tmp = $this->arrayToDatasource($this->times, 'time');
     array_unshift($tmp, array('', $view->translate('always_label')));
     $view['TimeDatasource'] = $tmp;
     $tmp = array();
     $u = $view->translate('Users_label');
     $ug = $view->translate('UserGroups_label');
     $users = $this->arrayToDatasource($this->users, 'user');
     if ($users) {
         $tmp[] = array($users, $u);
     }
     $groups = $this->arrayToDatasource($this->userGroups, 'group');
     if ($groups) {
         $tmp[] = array($groups, $ug);
     }
     $h = $view->translate('Hosts_label');
     $hg = $view->translate('HostGroups_label');
     $hosts = $this->arrayToDatasource($this->hosts, 'host');
     if ($hosts) {
         $tmp[] = array($hosts, $h);
     }
     $hgroups = $this->arrayToDatasource($this->hostGroups, 'host-group');
     if ($hgroups) {
         $tmp[] = array($hgroups, $hg);
     }
     $i = $view->translate('IpRanges_label');
     $ipranges = $this->arrayToDatasource($this->ipranges, 'iprange');
     if ($ipranges) {
         $tmp[] = array($ipranges, $i);
     }
     $c = $view->translate('Cidrs_label');
     $cidrs = $this->arrayToDatasource($this->cidrs, 'cidr');
     if ($cidrs) {
         $tmp[] = array($cidrs, $c);
     }
     $roles = $this->arrayToDatasource($this->roles, 'role');
     $zones = $this->arrayToDatasource($this->zones, 'zone');
     $z = $view->translate('Zones_label');
     if ($zones || $roles) {
         $tmp[] = array(array_merge($roles, $zones), $z);
     }
     $adu = $view->translate('ADUsers_label');
     $adusers = array();
     foreach ($this->ADUsers as $k) {
         $adusers[] = array($k, $k);
     }
     if ($adusers) {
         $tmp[] = array($adusers, $adu);
     }
     $view['SrcDatasource'] = $tmp;
 }
Esempio n. 19
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getIdentifier() === 'create' && !$this->getRequest()->isMutation()) {
         $view['setPassword'] = '******';
     }
     if (isset($this->parameters['username'])) {
         $view['ChangePassword'] = $view->getModuleUrl('../ChangePassword/' . $this->parameters['username']);
         $view['FormAction'] = $view->getModuleUrl($this->parameters['username']);
     } else {
         $view['ChangePassword'] = '';
     }
     $tmp = array();
     if ($this->getRequest()->isValidated()) {
         foreach ($this->getGroupProvider()->getGroups() as $key => $values) {
             $tmp[] = array($key, $key);
         }
         $view->getCommandList()->show();
         // required by nextPath() method of this class
     }
     $view['isAD'] = $this->getGroupProvider()->isAD();
     $view['groupsDatasource'] = $tmp;
     $view['domain'] = $this->getPlatform()->getDatabase('configuration')->getType('DomainName');
 }
Esempio n. 20
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\VPN\\Clients\\Modify', 'update' => 'NethServer\\Template\\VPN\\Clients\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $view['ModeDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, array('routed', 'bridged'));
 }
Esempio n. 21
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\FirewallObjects\\HostGroups\\Modify', 'update' => 'NethServer\\Template\\FirewallObjects\\HostGroups\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
 }
Esempio n. 22
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\PortForward\\Modify', 'update' => 'NethServer\\Template\\PortForward\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $view['ProtoDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, $this->protocols);
     if (!$this->wanips) {
         $this->wanips = $this->readWanIPs();
     }
     $view['OriDstDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $fmt ? $fmt : $view->translate('any_label'));
     }, $this->wanips);
     $view['Destination'] = $view['DstRaw'] ? \NethServer\Module\FirewallRules\RuleGenericController::translateFirewallObjectTitle($view, $view['DstRaw']) : '';
 }
Esempio n. 23
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if ($this->getIdentifier() == 'delete') {
         $view->setTemplate('Nethgui\\Template\\Table\\Delete');
     }
     $view['BlockAllDatasource'] = array_map(function ($fmt) use($view) {
         return array($fmt, $view->translate($fmt . '_label'));
     }, array('enabled', 'disabled'));
     if (!$this->categories) {
         $this->readCategories();
     }
     $tmp = array();
     $lang = strtoupper($view->getTranslator()->getLanguageCode());
     foreach ($this->categories as $cat) {
         $t = $cat;
         if (isset($this->index[$cat]["NAME {$lang}"])) {
             $t = $this->index[$cat]["NAME {$lang}"];
         } else {
             if (isset($this->index[$cat]["NAME"])) {
                 $t = $this->index[$cat]["NAME"];
             }
         }
         $tmp[] = array($cat, ucfirst($t));
     }
     usort($tmp, array($this, 'cmpcat'));
     $view['CategoriesDatasource'] = $tmp;
 }
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $view['contactDefaults'] = $this->getPlatform()->getDatabase('configuration')->getKey('OrganizationContact');
     if (isset($this->parameters['username'])) {
         $view['ChangePassword'] = $view->getModuleUrl('../ChangePassword/' . $this->parameters['username']);
         $view['FormAction'] = $view->getModuleUrl($this->parameters['username']);
     } else {
         $view['ChangePassword'] = '';
     }
 }
Esempio n. 25
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     $templates = array('create' => 'NethServer\\Template\\Group\\Modify', 'update' => 'NethServer\\Template\\Group\\Modify', 'delete' => 'Nethgui\\Template\\Table\\Delete');
     $view->setTemplate($templates[$this->getIdentifier()]);
     $tmp = array();
     if ($this->getRequest()->isValidated()) {
         foreach ($this->getUserProvider()->getUsers() as $key => $values) {
             $tmp[] = array($key, $key);
         }
         $view->getCommandList()->show();
         // required by nextPath() method of this class
     }
     $view['membersDatasource'] = $tmp;
     $view['domain'] = $this->getPlatform()->getDatabase('configuration')->getType('DomainName');
 }