Commit 94c9617e authored by Till Brehm's avatar Till Brehm
Browse files

- Added support for reseller templates.

- Resellers can use templates for their clients.
parent 23229cb3
...@@ -106,9 +106,10 @@ class client_templates { ...@@ -106,9 +106,10 @@ class client_templates {
/* /*
* Get the master-template for the client * Get the master-template for the client
*/ */
$sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId); $sql = "SELECT template_master, template_additional,limit_client FROM client WHERE client_id = " . $app->functions->intval($clientId);
$record = $app->db->queryOneRecord($sql); $record = $app->db->queryOneRecord($sql);
$masterTemplateId = $record['template_master']; $masterTemplateId = $record['template_master'];
$is_reseller = ($record['limit_client'] > 0)?true:false;
if($record['template_additional'] != '') { if($record['template_additional'] != '') {
// we have to call the update_client_templates function // we have to call the update_client_templates function
...@@ -222,6 +223,7 @@ class client_templates { ...@@ -222,6 +223,7 @@ class client_templates {
* Write all back to the database * Write all back to the database
*/ */
$update = ''; $update = '';
if(!$is_reseller) unset($limits['limit_client']); // Only Resellers may have limit_client set in template to ensure that we do not convert a client to reseller accidently.
foreach($limits as $k => $v){ foreach($limits as $k => $v){
if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){ if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
if ($update != '') $update .= ', '; if ($update != '') $update .= ', ';
......
...@@ -32,7 +32,7 @@ class custom_datasource { ...@@ -32,7 +32,7 @@ class custom_datasource {
function master_templates($field, $record) { function master_templates($field, $record) {
global $app, $conf; global $app, $conf;
$records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m'"); $records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m' and ".$app->tform->getAuthSQL('r'));
$records_new[0] = $app->lng('Custom'); $records_new[0] = $app->lng('Custom');
foreach($records as $rec) { foreach($records as $rec) {
$key = $rec['template_id']; $key = $rec['template_id'];
......
...@@ -92,6 +92,11 @@ class page_action extends tform_actions { ...@@ -92,6 +92,11 @@ class page_action extends tform_actions {
} }
} }
} }
//* Resellers shall not be able to create another reseller
if($_SESSION["s"]["user"]["typ"] == 'user') {
$this->dataRecord['limit_client'] = 0;
}
if($this->id != 0) { if($this->id != 0) {
$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id); $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
......
...@@ -51,6 +51,18 @@ $app->load('tform_actions'); ...@@ -51,6 +51,18 @@ $app->load('tform_actions');
class page_action extends tform_actions { class page_action extends tform_actions {
function onSubmit() {
global $app;
//* Resellers shall not be able to create another reseller
if($_SESSION["s"]["user"]["typ"] == 'user') {
$this->dataRecord['limit_client'] = 0;
}
parent::onSubmit();
}
function onBeforeUpdate() { function onBeforeUpdate() {
global $app; global $app;
......
...@@ -101,6 +101,20 @@ $form["tabs"]['limits'] = array ( ...@@ -101,6 +101,20 @@ $form["tabs"]['limits'] = array (
//################################# //#################################
// Begin Datatable fields // Begin Datatable fields
//################################# //#################################
'limit_client' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'ISINT',
'errmsg'=> 'limit_client_error_notint'),
),
'default' => '1',
'value' => '',
'separator' => '',
'width' => '10',
'maxlength' => '10',
'rows' => '',
'cols' => ''
),
'limit_maildomain' => array ( 'limit_maildomain' => array (
'datatype' => 'INTEGER', 'datatype' => 'INTEGER',
'formtype' => 'TEXT', 'formtype' => 'TEXT',
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Add Client'; $wb['Add Client'] = 'Add Client';
$wb['Edit Client'] = 'Edit Client'; $wb['Edit Client'] = 'Edit Client';
$wb['Clients'] = 'Clients'; $wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Edit Client-Templates'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Add Reseller'; $wb['Add Reseller'] = 'Add Reseller';
$wb['Edit Reseller'] = 'Edit Reseller'; $wb['Edit Reseller'] = 'Edit Reseller';
$wb['Resellers'] = 'Resellers'; $wb['Resellers'] = 'Resellers';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Ограничения'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Ограничения';
$wb['Add Client'] = 'Добавяне на клиент'; $wb['Add Client'] = 'Добавяне на клиент';
$wb['Edit Client'] = 'Редактиране на клиент'; $wb['Edit Client'] = 'Редактиране на клиент';
$wb['Clients'] = 'Клиенти'; $wb['Clients'] = 'Клиенти';
$wb['Edit Client-Templates'] = 'Редактирай Клиентски-Шаблон'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Добави дистрибутор'; $wb['Add Reseller'] = 'Добави дистрибутор';
$wb['Edit Reseller'] = 'Редактирай дистрибутор'; $wb['Edit Reseller'] = 'Редактирай дистрибутор';
$wb['Resellers'] = 'Дистрибутори'; $wb['Resellers'] = 'Дистрибутори';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites';
$wb['Add Client'] = 'Adcionar Cliente'; $wb['Add Client'] = 'Adcionar Cliente';
$wb['Edit Client'] = 'Editar Cliente'; $wb['Edit Client'] = 'Editar Cliente';
$wb['Clients'] = 'Clientes'; $wb['Clients'] = 'Clientes';
$wb['Edit Client-Templates'] = 'Editar Gabaritos de Clientes'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Adcionar Revendedor'; $wb['Add Reseller'] = 'Adcionar Revendedor';
$wb['Edit Reseller'] = 'Editar Revendedor'; $wb['Edit Reseller'] = 'Editar Revendedor';
$wb['Resellers'] = 'Revendedores'; $wb['Resellers'] = 'Revendedores';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity';
$wb['Add Client'] = 'Přidat klienta'; $wb['Add Client'] = 'Přidat klienta';
$wb['Edit Client'] = 'Upravit klienta'; $wb['Edit Client'] = 'Upravit klienta';
$wb['Clients'] = 'Klienti'; $wb['Clients'] = 'Klienti';
$wb['Edit Client-Templates'] = 'Upravit klientské šablony'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Přidat distributora'; $wb['Add Reseller'] = 'Přidat distributora';
$wb['Edit Reseller'] = 'Upravit distributora'; $wb['Edit Reseller'] = 'Upravit distributora';
$wb['Resellers'] = 'Distributoři (prodejci)'; $wb['Resellers'] = 'Distributoři (prodejci)';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Kunde hinzufügen'; $wb['Add Client'] = 'Kunde hinzufügen';
$wb['Edit Client'] = 'Kunde bearbeiten'; $wb['Edit Client'] = 'Kunde bearbeiten';
$wb['Clients'] = 'Kunden'; $wb['Clients'] = 'Kunden';
$wb['Edit Client-Templates'] = 'Kundenvorlagen'; $wb['Templates'] = 'Vorlagen';
$wb['Limit-Templates'] = 'Kundenvorlagen';
$wb['Add Reseller'] = 'Reseller hinzufügen'; $wb['Add Reseller'] = 'Reseller hinzufügen';
$wb['Edit Reseller'] = 'Reseller bearbeiten'; $wb['Edit Reseller'] = 'Reseller bearbeiten';
$wb['Resellers'] = 'Reseller'; $wb['Resellers'] = 'Reseller';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Όρια'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Όρια';
$wb['Add Client'] = 'Νέος Πελάτης'; $wb['Add Client'] = 'Νέος Πελάτης';
$wb['Edit Client'] = 'Επεξεργασία Πελάτη'; $wb['Edit Client'] = 'Επεξεργασία Πελάτη';
$wb['Clients'] = 'Πελάτες'; $wb['Clients'] = 'Πελάτες';
$wb['Edit Client-Templates'] = 'Επεξεργασία προτύπων πελατών'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Νέος Μεταπωλητής'; $wb['Add Reseller'] = 'Νέος Μεταπωλητής';
$wb['Edit Reseller'] = 'Επεξεργασία Μεταπωλητή'; $wb['Edit Reseller'] = 'Επεξεργασία Μεταπωλητή';
$wb['Resellers'] = 'Μεταπωλητές'; $wb['Resellers'] = 'Μεταπωλητές';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Add Client'; $wb['Add Client'] = 'Add Client';
$wb['Edit Client'] = 'Edit Client'; $wb['Edit Client'] = 'Edit Client';
$wb['Clients'] = 'Clients'; $wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Edit Client-Templates'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Add Reseller'; $wb['Add Reseller'] = 'Add Reseller';
$wb['Edit Reseller'] = 'Edit Reseller'; $wb['Edit Reseller'] = 'Edit Reseller';
$wb['Resellers'] = 'Resellers'; $wb['Resellers'] = 'Resellers';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Límites'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Límites';
$wb['Add Client'] = 'Añadir cliente'; $wb['Add Client'] = 'Añadir cliente';
$wb['Edit Client'] = 'Editar cliente'; $wb['Edit Client'] = 'Editar cliente';
$wb['Clients'] = 'Clientes'; $wb['Clients'] = 'Clientes';
$wb['Edit Client-Templates'] = 'Editar plantillas de clientes'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Añadir revendedor'; $wb['Add Reseller'] = 'Añadir revendedor';
$wb['Edit Reseller'] = 'Editar revendedor'; $wb['Edit Reseller'] = 'Editar revendedor';
$wb['Resellers'] = 'Revendedores'; $wb['Resellers'] = 'Revendedores';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Rajoitukset'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Rajoitukset';
$wb['Add Client'] = 'Lisää asiakas'; $wb['Add Client'] = 'Lisää asiakas';
$wb['Edit Client'] = 'Muokkaa asiakkaan tietoja'; $wb['Edit Client'] = 'Muokkaa asiakkaan tietoja';
$wb['Clients'] = 'Asiakkaat'; $wb['Clients'] = 'Asiakkaat';
$wb['Edit Client-Templates'] = 'Muokkaa asiakasmalleja'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Lisää uusi jälleenmyyjä'; $wb['Add Reseller'] = 'Lisää uusi jälleenmyyjä';
$wb['Edit Reseller'] = 'Muokkaa jälleenmyyjää'; $wb['Edit Reseller'] = 'Muokkaa jälleenmyyjää';
$wb['Resellers'] = 'Jälleenmyyjät'; $wb['Resellers'] = 'Jälleenmyyjät';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites';
$wb['Add Client'] = 'Ajouter un Client'; $wb['Add Client'] = 'Ajouter un Client';
$wb['Edit Client'] = 'Editer un Client'; $wb['Edit Client'] = 'Editer un Client';
$wb['Clients'] = 'Clients'; $wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Editer les modèles de Clients'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Ajouter un Revendeur'; $wb['Add Reseller'] = 'Ajouter un Revendeur';
$wb['Edit Reseller'] = 'Editer un Revendeur'; $wb['Edit Reseller'] = 'Editer un Revendeur';
$wb['Resellers'] = 'Revendeurs'; $wb['Resellers'] = 'Revendeurs';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limiti'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limiti';
$wb['Add Client'] = 'Dodaj klijenta'; $wb['Add Client'] = 'Dodaj klijenta';
$wb['Edit Client'] = 'Editiraj klijenta'; $wb['Edit Client'] = 'Editiraj klijenta';
$wb['Clients'] = 'Klijenti'; $wb['Clients'] = 'Klijenti';
$wb['Edit Client-Templates'] = 'Editiraj predložak za klijente'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Dodaj preprodavača'; $wb['Add Reseller'] = 'Dodaj preprodavača';
$wb['Edit Reseller'] = 'Editiraj preprodavača'; $wb['Edit Reseller'] = 'Editiraj preprodavača';
$wb['Resellers'] = 'Preprodavači'; $wb['Resellers'] = 'Preprodavači';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Korlátok'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Korlátok';
$wb['Add Client'] = 'Ügyfél hozzáadása'; $wb['Add Client'] = 'Ügyfél hozzáadása';
$wb['Edit Client'] = 'Ügyfél adatok szerkesztése'; $wb['Edit Client'] = 'Ügyfél adatok szerkesztése';
$wb['Clients'] = 'Ügyfelek'; $wb['Clients'] = 'Ügyfelek';
$wb['Edit Client-Templates'] = 'Ügyfél-Sablonok szerkesztése'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Új Viszonteladó'; $wb['Add Reseller'] = 'Új Viszonteladó';
$wb['Edit Reseller'] = 'Viszonteladók szerkesztése'; $wb['Edit Reseller'] = 'Viszonteladók szerkesztése';
$wb['Resellers'] = 'Viszonteladók'; $wb['Resellers'] = 'Viszonteladók';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Batasan'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Batasan';
$wb['Add Client'] = 'Tambah Klien'; $wb['Add Client'] = 'Tambah Klien';
$wb['Edit Client'] = 'Sunting Klien'; $wb['Edit Client'] = 'Sunting Klien';
$wb['Clients'] = 'Klien'; $wb['Clients'] = 'Klien';
$wb['Edit Client-Templates'] = 'Sunting Template Klien'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Tambah Reseller'; $wb['Add Reseller'] = 'Tambah Reseller';
$wb['Edit Reseller'] = 'Sunting Reseller'; $wb['Edit Reseller'] = 'Sunting Reseller';
$wb['Resellers'] = 'Reseller'; $wb['Resellers'] = 'Reseller';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = '制限'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = '制限';
$wb['Add Client'] = 'クライアントを追加する'; $wb['Add Client'] = 'クライアントを追加する';
$wb['Edit Client'] = 'クライアントを編集する'; $wb['Edit Client'] = 'クライアントを編集する';
$wb['Clients'] = 'クライアント'; $wb['Clients'] = 'クライアント';
$wb['Edit Client-Templates'] = 'クライアントテンプレートを編集する'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'リセラーを追加する'; $wb['Add Reseller'] = 'リセラーを追加する';
$wb['Edit Reseller'] = 'リセラーを編集する'; $wb['Edit Reseller'] = 'リセラーを編集する';
$wb['Resellers'] = 'リセラー'; $wb['Resellers'] = 'リセラー';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limieten'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limieten';
$wb['Add Client'] = 'Toevoegen klant'; $wb['Add Client'] = 'Toevoegen klant';
$wb['Edit Client'] = 'Wijzigen klant'; $wb['Edit Client'] = 'Wijzigen klant';
$wb['Clients'] = 'klanten'; $wb['Clients'] = 'klanten';
$wb['Edit Client-Templates'] = 'Wijzig klant-template'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Toevoegen Reseller'; $wb['Add Reseller'] = 'Toevoegen Reseller';
$wb['Edit Reseller'] = 'Wijzigen Reseller'; $wb['Edit Reseller'] = 'Wijzigen Reseller';
$wb['Resellers'] = 'Resellers'; $wb['Resellers'] = 'Resellers';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity';
$wb['Add Client'] = 'Dodaj klienta'; $wb['Add Client'] = 'Dodaj klienta';
$wb['Edit Client'] = 'Edytuj klienta'; $wb['Edit Client'] = 'Edytuj klienta';
$wb['Clients'] = 'Klienci'; $wb['Clients'] = 'Klienci';
$wb['Edit Client-Templates'] = 'Edytuj szablony klientów'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Dodaj Resellera'; $wb['Add Reseller'] = 'Dodaj Resellera';
$wb['Edit Reseller'] = 'Edytuj Resellera'; $wb['Edit Reseller'] = 'Edytuj Resellera';
$wb['Resellers'] = 'Resellerzy'; $wb['Resellers'] = 'Resellerzy';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites';
$wb['Add Client'] = 'Adicionar Cliente'; $wb['Add Client'] = 'Adicionar Cliente';
$wb['Edit Client'] = 'Editar Cliente'; $wb['Edit Client'] = 'Editar Cliente';
$wb['Clients'] = 'Clientes'; $wb['Clients'] = 'Clientes';
$wb['Edit Client-Templates'] = 'Editar Templates de Clientes'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Adicionar Revendedor'; $wb['Add Reseller'] = 'Adicionar Revendedor';
$wb['Edit Reseller'] = 'Editar Revendedor'; $wb['Edit Reseller'] = 'Editar Revendedor';
$wb['Resellers'] = 'Revendedores'; $wb['Resellers'] = 'Revendedores';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Add Client'; $wb['Add Client'] = 'Add Client';
$wb['Edit Client'] = 'Edit Client'; $wb['Edit Client'] = 'Edit Client';
$wb['Clients'] = 'Clients'; $wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Edit Client-Templates'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Add Reseller'; $wb['Add Reseller'] = 'Add Reseller';
$wb['Edit Reseller'] = 'Edit Reseller'; $wb['Edit Reseller'] = 'Edit Reseller';
$wb['Resellers'] = 'Resellers'; $wb['Resellers'] = 'Resellers';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Лимиты'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Лимиты';
$wb['Add Client'] = 'Добавить клиента'; $wb['Add Client'] = 'Добавить клиента';
$wb['Edit Client'] = 'Изменить клиента'; $wb['Edit Client'] = 'Изменить клиента';
$wb['Clients'] = 'Клиенты'; $wb['Clients'] = 'Клиенты';
$wb['Edit Client-Templates'] = 'Изменить шаблон клиента'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Добавить реселлера'; $wb['Add Reseller'] = 'Добавить реселлера';
$wb['Edit Reseller'] = 'Изменить реселлера'; $wb['Edit Reseller'] = 'Изменить реселлера';
$wb['Resellers'] = 'Реселлеры'; $wb['Resellers'] = 'Реселлеры';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Add Client'; $wb['Add Client'] = 'Add Client';
$wb['Edit Client'] = 'Edit Client'; $wb['Edit Client'] = 'Edit Client';
$wb['Clients'] = 'Clients'; $wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Edit Client-Templates'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Add Reseller'; $wb['Add Reseller'] = 'Add Reseller';
$wb['Edit Reseller'] = 'Edit Reseller'; $wb['Edit Reseller'] = 'Edit Reseller';
$wb['Resellers'] = 'Resellers'; $wb['Resellers'] = 'Resellers';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity';
$wb['Add Client'] = 'Pridať klienta'; $wb['Add Client'] = 'Pridať klienta';
$wb['Edit Client'] = 'Upraviť klienta'; $wb['Edit Client'] = 'Upraviť klienta';
$wb['Clients'] = 'Klienti'; $wb['Clients'] = 'Klienti';
$wb['Edit Client-Templates'] = 'Upraviť klient-Šablónu'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Pridať nového predajcu'; $wb['Add Reseller'] = 'Pridať nového predajcu';
$wb['Edit Reseller'] = 'Upraviť predajcu'; $wb['Edit Reseller'] = 'Upraviť predajcu';
$wb['Resellers'] = 'Predajcovia'; $wb['Resellers'] = 'Predajcovia';
......
...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limitler'; ...@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limitler';
$wb['Add Client'] = 'Müşteri Ekle'; $wb['Add Client'] = 'Müşteri Ekle';
$wb['Edit Client'] = 'Müşteri Düzenle'; $wb['Edit Client'] = 'Müşteri Düzenle';
$wb['Clients'] = 'Müşteriler'; $wb['Clients'] = 'Müşteriler';
$wb['Edit Client-Templates'] = 'Müşteri-Şablon Düzenle'; $wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Reseller Ekle'; $wb['Add Reseller'] = 'Reseller Ekle';
$wb['Edit Reseller'] = 'Reseller Düzenle'; $wb['Edit Reseller'] = 'Reseller Düzenle';
$wb['Resellers'] = 'Resellerlar'; $wb['Resellers'] = 'Resellerlar';
......
...@@ -66,6 +66,21 @@ $module["nav"][] = array( 'title' => 'Messaging', ...@@ -66,6 +66,21 @@ $module["nav"][] = array( 'title' => 'Messaging',
unset($items); unset($items);
//if($_SESSION["s"]["user"]["typ"] == 'admin'){
$items[] = array( 'title' => "Limit-Templates",
'target' => 'content',
'link' => 'client/client_template_list.php',
'html_id' => 'client_template_list');
$module["nav"][] = array( 'title' => 'Templates',
'open' => 1,
'items' => $items);
unset($items);
//}
$app->uses('ini_parser,getconf'); $app->uses('ini_parser,getconf');
$settings = $app->getconf->get_global_config('domains'); $settings = $app->getconf->get_global_config('domains');
......
...@@ -94,6 +94,26 @@ class page_action extends tform_actions { ...@@ -94,6 +94,26 @@ class page_action extends tform_actions {
} }
} }
} }
if($this->id != 0) {
$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
// check previous type of storing templates
$tpls = explode('/', $this->oldDataRecord['template_additional']);
$this->oldTemplatesAssigned = array();
foreach($tpls as $item) {
$item = trim($item);
if(!$item) continue;
$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
}
unset($tpls);
}
} else {
$this->oldTemplatesAssigned = array();
}
$this->_template_additional = explode('/', $this->dataRecord['template_additional']);
$this->dataRecord['template_additional'] = '';
parent::onSubmit(); parent::onSubmit();
} }
...@@ -117,13 +137,27 @@ class page_action extends tform_actions { ...@@ -117,13 +137,27 @@ class page_action extends tform_actions {
$result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id); $result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
if($result && count($result) > 0) { if($result && count($result) > 0) {
// new style // new style
$items = array();
$text = ''; $text = '';
foreach($result as $item){ foreach($result as $item){
if (trim($item['client_template_id']) != ''){ if (trim($item['client_template_id']) != ''){
if ($text != '') $text .= ''; if ($text != '') $text .= '';
$text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]. '<a href="#" class="button icons16 icoDelete"></a></li>'; $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']];
$text .= '<a href="#" class="button icons16 icoDelete"></a>';
$tmp = new stdClass();
$tmp->id = $item['assigned_template_id'];
$tmp->data = '';
$app->plugin->raiseEvent('get_client_template_details', $tmp);
if($tmp->data != '') $text .= '<br /><em>' . $tmp->data . '</em>';
$text .= '</li>';
$items[] = $item['assigned_template_id'] . ':' . $item['client_template_id'];
} }
} }
$tmprec = $app->tform->getHTML(array('template_additional' => implode('/', $items)), $this->active_tab, 'EDIT');
$app->tpl->setVar('template_additional', $tmprec['template_additional']);
unset($tmprec);
} else { } else {
// old style // old style
$sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id; $sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
...@@ -139,6 +173,7 @@ class page_action extends tform_actions { ...@@ -139,6 +173,7 @@ class page_action extends tform_actions {
} }
$app->tpl->setVar('template_additional_list', $text); $app->tpl->setVar('template_additional_list', $text);
$app->tpl->setVar('app_module', 'client');
//* Set the 'customer no' default value //* Set the 'customer no' default value
if($this->id == 0) { if($this->id == 0) {
...@@ -213,6 +248,11 @@ class page_action extends tform_actions { ...@@ -213,6 +248,11 @@ class page_action extends tform_actions {
$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id; $sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
$app->db->query($sql);