diff --git a/install/sql/incremental/upd_0033.sql b/install/sql/incremental/upd_0033.sql new file mode 100644 index 0000000000000000000000000000000000000000..d5ea973568171b53a6c1a4841e08f9a08c76d336 --- /dev/null +++ b/install/sql/incremental/upd_0033.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS `client_circle` ( + `circle_id` int(11) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `circle_name` varchar(64) DEFAULT NULL, + `client_ids` text, + `description` text, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`circle_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index fe97e9ca3d9a83ab84d486b3e31b2f96d422575c..842d6188859a41b7dcffe9a8ef420ae9ec420061 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -152,6 +152,26 @@ CREATE TABLE `client` ( -- -------------------------------------------------------- +-- +-- Table structure for table `client_circle` +-- + +CREATE TABLE `client_circle` ( + `circle_id` int(11) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `circle_name` varchar(64) DEFAULT NULL, + `client_ids` text, + `description` text, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`circle_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + -- -- Table structure for table `client_template` -- diff --git a/interface/web/client/client_circle_del.php b/interface/web/client/client_circle_del.php new file mode 100644 index 0000000000000000000000000000000000000000..5764eb52cfe1a21dcbb161d9b4e0b755d8412a1b --- /dev/null +++ b/interface/web/client/client_circle_del.php @@ -0,0 +1,59 @@ +auth->check_module_permissions('client'); +if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.'); + +$app->uses('tpl,tform'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + +} + +$page = new page_action; +$page->onDelete() + +?> diff --git a/interface/web/client/client_circle_edit.php b/interface/web/client/client_circle_edit.php new file mode 100644 index 0000000000000000000000000000000000000000..629e526e0d66a9cabfd413a06fc85d95e0cae1ba --- /dev/null +++ b/interface/web/client/client_circle_edit.php @@ -0,0 +1,59 @@ +auth->check_module_permissions('client'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + +} + +$page = new page_action; +$page->onLoad(); + +?> diff --git a/interface/web/client/client_circle_list.php b/interface/web/client/client_circle_list.php new file mode 100644 index 0000000000000000000000000000000000000000..935fbee3e9cd90a7c9431fe5e1b89eac30836d1d --- /dev/null +++ b/interface/web/client/client_circle_list.php @@ -0,0 +1,24 @@ +auth->check_module_permissions('client'); + +$app->uses('listform_actions'); + +$app->listform_actions->SQLOrderBy = 'ORDER BY circle_name, circle_id'; +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php index f555c9995515a4acf364325aff376d9cb5845a9a..f9dd60e04b65c579624abb280425e29f7204f3ed 100644 --- a/interface/web/client/client_message.php +++ b/interface/web/client/client_message.php @@ -59,13 +59,28 @@ if(isset($_POST) && count($_POST) > 1) { //* Send message if($error == '') { - //* Select all clients and resellers - if($_SESSION["s"]["user"]["typ"] == 'admin'){ - $sql = "SELECT * FROM client WHERE email != ''"; + if(intval($_POST['recipient']) > 0){ + $circle = $app->db->queryOneRecord("SELECT client_ids FROM client_circle WHERE active = 'y' AND circle_id = ".intval($_POST['recipient'])); + if(isset($circle['client_ids']) && $circle['client_ids'] != ''){ + $tmp_client_ids = explode(',',$circle['client_ids']); + $where = array(); + foreach($tmp_client_ids as $tmp_client_id){ + $where[] = 'client_id = '.$tmp_client_id; + } + if(!empty($where)) $where_clause = ' AND ('.implode(' OR ', $where).')'; + $sql = "SELECT * FROM client WHERE email != ''".$where_clause; + } else { + $sql = "SELECT * FROM client WHERE 0"; + } } else { - $client_id = intval($_SESSION['s']['user']['client_id']); - if($client_id == 0) die('Invalid Client ID.'); - $sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'"; + //* Select all clients and resellers + if($_SESSION["s"]["user"]["typ"] == 'admin'){ + $sql = "SELECT * FROM client WHERE email != ''"; + } else { + $client_id = intval($_SESSION['s']['user']['client_id']); + if($client_id == 0) die('Invalid Client ID.'); + $sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'"; + } } //* Get clients @@ -73,7 +88,6 @@ if(isset($_POST) && count($_POST) > 1) { if(is_array($clients)) { $msg = $wb['email_sent_to_txt'].' '; foreach($clients as $client) { - //* Parse cleint details into message $message = $_POST['message']; foreach($client as $key => $val) { @@ -94,6 +108,17 @@ if(isset($_POST) && count($_POST) > 1) { } } +// Recipient Drop-Down +$recipient = ''; +$sql = "SELECT * FROM client_circle WHERE active = 'y'"; +$circles = $app->db->queryAllRecords($sql); +if(is_array($circles) && !empty($circles)){ + foreach($circles as $circle){ + $recipient .= ''; + } +} +$app->tpl->setVar('recipient',$recipient); + if($_SESSION["s"]["user"]["typ"] == 'admin'){ $app->tpl->setVar('form_legend_txt',$wb['form_legend_admin_txt']); } else { diff --git a/interface/web/client/form/client_circle.tform.php b/interface/web/client/form/client_circle.tform.php new file mode 100644 index 0000000000000000000000000000000000000000..c2f323286f80e87ee62b3ac7c3255733289356e1 --- /dev/null +++ b/interface/web/client/form/client_circle.tform.php @@ -0,0 +1,137 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +//* Languages +$language_list = array(); +$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); +while ($file = @readdir ($handle)) { + if ($file != '.' && $file != '..') { + if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') { + $tmp = substr($file, 0, 2); + $language_list[$tmp] = $tmp; + } + } +} + +//* Load themes +$themes_list = array(); +$handle = @opendir(ISPC_THEMES_PATH); +while ($file = @readdir ($handle)) { + if (substr($file, 0, 1) != '.') { + if(@is_dir(ISPC_THEMES_PATH."/$file")) { + $themes_list[$file] = $file; + } + } +} + +$form["tabs"]['circle'] = array ( + 'title' => "Circle", + 'width' => 100, + 'template' => "templates/client_circle_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'circle_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '30', + 'maxlength' => '255', + 'rows' => '', + 'cols' => '', + 'searchable' => 2 + ), + 'client_ids' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOXARRAY', + 'default' => '', + 'separator' => ',', + 'datasource' => array ( 'type' => 'SQL', + 'querystring' => 'SELECT client_id,contact_name FROM client WHERE 1 ORDER BY contact_name', + 'keyfield'=> 'client_id', + 'valuefield'=> 'contact_name' + ), + 'value' => '' + ), + 'description' => array ( + 'datatype' => 'TEXT', + 'formtype' => 'TEXTAREA', + 'default' => '', + 'value' => '', + 'separator' => '', + 'width' => '', + 'maxlength' => '', + 'rows' => '10', + 'cols' => '30' + ), + 'active' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n',1 => 'y') + ), + ################################## + # END Datatable fields + ################################## + ) +); + + +?> diff --git a/interface/web/client/lib/lang/de.lng b/interface/web/client/lib/lang/de.lng index a20601a4c2fb9bf960ce44d527efda6e78999d9b..f4e7ffeaf3d1f97fd99b3c3a9fac4aecf4c85a57 100644 --- a/interface/web/client/lib/lang/de.lng +++ b/interface/web/client/lib/lang/de.lng @@ -14,4 +14,5 @@ $wb['add_additional_template_txt'] = 'Zusätzliches Template hinzufügen'; $wb['delete_additional_template_txt'] = 'Zusätzliches Template löschen'; $wb['Messaging'] = 'Benachrichtigungen'; $wb['Send email'] = 'E-Mail versenden'; +$wb['Edit Client Circle'] = 'Kundenkreis bearbeiten'; ?> diff --git a/interface/web/client/lib/lang/de_client_circle.lng b/interface/web/client/lib/lang/de_client_circle.lng new file mode 100644 index 0000000000000000000000000000000000000000..6e579d5496e11873781b19a9452fcef283368317 --- /dev/null +++ b/interface/web/client/lib/lang/de_client_circle.lng @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/de_client_circle_list.lng b/interface/web/client/lib/lang/de_client_circle_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..0a9c43a3ceb1d610547f531c2d778b4302af3383 --- /dev/null +++ b/interface/web/client/lib/lang/de_client_circle_list.lng @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/de_client_message.lng b/interface/web/client/lib/lang/de_client_message.lng index 2578197bbbe63704de29455bbc4653c19952b59f..79de5b9001f5b11fbe20ed1e2ef31b95935c7c7f 100644 --- a/interface/web/client/lib/lang/de_client_message.lng +++ b/interface/web/client/lib/lang/de_client_message.lng @@ -4,10 +4,12 @@ $wb["btn_cancel_txt"] = 'Abbrechen'; $wb["sender_txt"] = 'Absender-E-Mail-Adresse'; $wb["subject_txt"] = 'Betreff'; $wb["message_txt"] = 'Nachricht'; -$wb["form_legend_client_txt"] = 'E-Mail-Nachricht an alle Kunden versenden.'; -$wb["form_legend_admin_txt"] = 'E-Mail-Nachricht an alle Kunden und Reseller versenden.'; +$wb["form_legend_client_txt"] = 'E-Mail-Nachricht an Kunden versenden.'; +$wb["form_legend_admin_txt"] = 'E-Mail-Nachricht an Kunden und Reseller versenden.'; $wb["sender_invalid_error"] = 'Absender-E-Mail-Adresse ist ungültig.'; $wb["subject_invalid_error"] = 'Betreff ist leer.'; $wb["message_invalid_error"] = 'Nachricht ist leer.'; $wb["email_sent_to_txt"] = 'E-Mail verschickt an:'; +$wb["recipient_txt"] = 'Empfänger'; +$wb["all_clients_resellers_txt"] = 'Alle Kunden und Reseller'; ?> diff --git a/interface/web/client/lib/lang/en.lng b/interface/web/client/lib/lang/en.lng index 0562201e3e1647af2583d7f388ed91896ee6e575..3e48f598d981a341fdaaf6f4328d7ed343889e08 100644 --- a/interface/web/client/lib/lang/en.lng +++ b/interface/web/client/lib/lang/en.lng @@ -14,4 +14,5 @@ $wb['add_additional_template_txt'] = 'Add additional template'; $wb['delete_additional_template_txt'] = 'Delete additional template'; $wb['Messaging'] = 'Messaging'; $wb['Send email'] = 'Send Email'; +$wb['Edit Client Circle'] = 'Edit Client Circle'; ?> \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_client_circle.lng b/interface/web/client/lib/lang/en_client_circle.lng new file mode 100644 index 0000000000000000000000000000000000000000..80fd704c08fc38f5842c68f3e0fb32d80366bbae --- /dev/null +++ b/interface/web/client/lib/lang/en_client_circle.lng @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_client_circle_list.lng b/interface/web/client/lib/lang/en_client_circle_list.lng new file mode 100644 index 0000000000000000000000000000000000000000..266aced82927da5551dbb838185a1cf627df8527 --- /dev/null +++ b/interface/web/client/lib/lang/en_client_circle_list.lng @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_client_message.lng b/interface/web/client/lib/lang/en_client_message.lng index 4f4ef3799f6380b3749c69d50ea7696b64041c5e..e9c91693273332043c77fce237a9dd83db9d99f6 100644 --- a/interface/web/client/lib/lang/en_client_message.lng +++ b/interface/web/client/lib/lang/en_client_message.lng @@ -4,10 +4,12 @@ $wb["btn_cancel_txt"] = 'Cancel'; $wb["sender_txt"] = 'Sender email address'; $wb["subject_txt"] = 'Subject'; $wb["message_txt"] = 'Message'; -$wb["form_legend_client_txt"] = 'Send email message to all clients.'; -$wb["form_legend_admin_txt"] = 'Send email message to all clients and resellers.'; +$wb["form_legend_client_txt"] = 'Send email message to clients.'; +$wb["form_legend_admin_txt"] = 'Send email message to clients and resellers.'; $wb["sender_invalid_error"] = 'Sender email invalid.'; $wb["subject_invalid_error"] = 'Subject is empty.'; $wb["message_invalid_error"] = 'Message is empty.'; $wb["email_sent_to_txt"] = 'Email sent to:'; +$wb["recipient_txt"] = 'Recipient'; +$wb["all_clients_resellers_txt"] = 'All clients and resellers'; ?> diff --git a/interface/web/client/lib/module.conf.php b/interface/web/client/lib/module.conf.php index 3e36a26e88782d011f0a389c98da3a4210f4702e..9422362137cd46bad884bd86f22764c3d493227a 100644 --- a/interface/web/client/lib/module.conf.php +++ b/interface/web/client/lib/module.conf.php @@ -56,6 +56,11 @@ $module["nav"][] = array( 'title' => 'Resellers', unset($items); } +$items[] = array( 'title' => "Edit Client Circle", + 'target' => 'content', + 'link' => 'client/client_circle_list.php', + 'html_id' => 'client_circle_list'); + $items[] = array( 'title' => "Send email", 'target' => 'content', 'link' => 'client/client_message.php', diff --git a/interface/web/client/list/client_circle.list.php b/interface/web/client/list/client_circle.list.php new file mode 100644 index 0000000000000000000000000000000000000000..075c9cda2c63c6365dedc6b46fc442a272f7e89e --- /dev/null +++ b/interface/web/client/list/client_circle.list.php @@ -0,0 +1,86 @@ + "circle_id", + 'datatype' => "INTEGER", + 'formtype' => "TEXT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "active", + 'datatype' => "VARCHAR", + 'formtype' => "SELECT", + 'op' => "=", + 'prefix' => "", + 'suffix' => "", + 'width' => "", + 'value' => array('y' => "
Yes
",'n' => "
No
")); + +$liste["item"][] = array( 'field' => "circle_name", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +$liste["item"][] = array( 'field' => "description", + 'datatype' => "VARCHAR", + 'formtype' => "TEXT", + 'op' => "like", + 'prefix' => "%", + 'suffix' => "%", + 'width' => "", + 'value' => ""); + +?> \ No newline at end of file diff --git a/interface/web/client/templates/client_circle_edit.htm b/interface/web/client/templates/client_circle_edit.htm new file mode 100644 index 0000000000000000000000000000000000000000..2ad39c8f128528f82af863f992abcca443833c1f --- /dev/null +++ b/interface/web/client/templates/client_circle_edit.htm @@ -0,0 +1,39 @@ +

+

+ +
+ +
+
{tmpl_var name='circle_txt'} +
+ + +
+
+

{tmpl_var name='client_ids_txt'}

+
+ {tmpl_var name='client_ids'} +
+
+
+ + +
+
+

{tmpl_var name='active_txt'}

+
+ {tmpl_var name='active'} +
+
+ {tmpl_var name='required_fields_txt'} +
+ + + +
+ + +
+
+ +
diff --git a/interface/web/client/templates/client_circle_list.htm b/interface/web/client/templates/client_circle_list.htm new file mode 100644 index 0000000000000000000000000000000000000000..c3f974c8e7a6f93a0470950fe05b88391621364c --- /dev/null +++ b/interface/web/client/templates/client_circle_list.htm @@ -0,0 +1,59 @@ +

+

+ +
+ +
+
{tmpl_var name="toolsarea_head_txt"} +
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='search_limit'}
{tmpl_var name="circle_id"}{tmpl_var name="active"}{tmpl_var name="circle_name"}{tmpl_var name="description"} + +
+
+
+ +
diff --git a/interface/web/client/templates/client_message.htm b/interface/web/client/templates/client_message.htm index cc2183ed4b9eba9552ce6a3399f2cf9cd3f1f16b..64201f229bc4511a48b524e059a0feccf0cbb292 100644 --- a/interface/web/client/templates/client_message.htm +++ b/interface/web/client/templates/client_message.htm @@ -14,6 +14,12 @@ +
+ + +