Contacts - Edit: Add bulk delete Users and Groups, convert bulk deletion of Properties to use dynamic delete button.
This commit is contained in:
parent
d92de7e63e
commit
9c81da353a
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -54,19 +54,12 @@
|
|||
$contact_addresses = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-addresses']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_address_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_address_edit.php?contact_uuid='.urlencode($_GET['id'])]);
|
||||
}
|
||||
if (permission_exists('contact_address_delete') && $contact_addresses) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -74,7 +67,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_address_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_addresses' name='checkbox_all' onclick=\"list_all_toggle('addresses');\" ".($contact_addresses ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_addresses' name='checkbox_all' onclick=\"edit_all_toggle('addresses');\" ".($contact_addresses ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-address_label']."</th>\n";
|
||||
|
|
@ -98,7 +91,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_address_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_addresses[$x][checked]' id='checkbox_".$x."' class='checkbox_addresses' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_addresses').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_addresses[$x][checked]' id='checkbox_".$x."' class='checkbox_addresses' value='true' onclick=\"edit_delete_action('addresses');\">\n";
|
||||
echo " <input type='hidden' name='contact_addresses[$x][uuid]' value='".escape($row['contact_address_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -123,4 +116,6 @@
|
|||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -49,6 +49,9 @@
|
|||
$contact_attachments = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
|
||||
|
||||
//styles and attachment layer
|
||||
echo "<style>\n";
|
||||
echo " #contact_attachment_layer {\n";
|
||||
|
|
@ -76,16 +79,6 @@
|
|||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-attachments']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_attachment_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_attachment_edit.php?contact_uuid='.urlencode($_GET['id'])]);
|
||||
}
|
||||
if (permission_exists('contact_attachment_delete') && $contact_attachments) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -93,7 +86,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_attachment_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_attachments' name='checkbox_all' onclick=\"list_all_toggle('attachments');\" ".($contact_attachments ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_attachments' name='checkbox_all' onclick=\"edit_all_toggle('attachments');\" ".($contact_attachments ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-type']."</th>\n";
|
||||
|
|
@ -117,7 +110,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_attachment_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_attachments[$x][checked]' id='checkbox_".$x."' class='checkbox_attachments' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_attachments').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_attachments[$x][checked]' id='checkbox_".$x."' class='checkbox_attachments' value='true' onclick=\"edit_delete_action('attachments');\">\n";
|
||||
echo " <input type='hidden' name='contact_attachments[$x][uuid]' value='".escape($row['contact_attachment_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -147,4 +140,6 @@
|
|||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -43,47 +43,6 @@
|
|||
$text = $language->get();
|
||||
|
||||
|
||||
//get the http post data from the contact property lists (numbers, addresses, etc) and process by action
|
||||
if (is_array($_POST) && is_uuid($_POST['contact_uuid'])) {
|
||||
$contact_uuid = $_POST['contact_uuid'];
|
||||
|
||||
switch ($_POST['action']) {
|
||||
case 'delete_properties':
|
||||
$array = array();
|
||||
if (permission_exists('contact_phone_delete')) { $contact_properties['contact_phones'] = $_POST['contact_phones']; }
|
||||
if (permission_exists('contact_address_delete')) { $contact_properties['contact_addresses'] = $_POST['contact_addresses']; }
|
||||
if (permission_exists('contact_email_delete')) { $contact_properties['contact_emails'] = $_POST['contact_emails']; }
|
||||
if (permission_exists('contact_url_delete')) { $contact_properties['contact_urls'] = $_POST['contact_urls']; }
|
||||
//if (permission_exists('contact_extension_delete')) { $contact_properties['contact_extensions'] = $_POST['contact_extensions']; }
|
||||
if (permission_exists('contact_relation_delete')) { $contact_properties['contact_relations'] = $_POST['contact_relations']; }
|
||||
if (permission_exists('contact_note_delete')) { $contact_properties['contact_notes'] = $_POST['contact_notes']; }
|
||||
if (permission_exists('contact_time_delete')) { $contact_properties['contact_times'] = $_POST['contact_times']; }
|
||||
if (permission_exists('contact_setting_delete')) { $contact_properties['contact_settings'] = $_POST['contact_settings']; }
|
||||
if (permission_exists('contact_attachment_delete')) { $contact_properties['contact_attachments'] = $_POST['contact_attachments']; }
|
||||
|
||||
if (@sizeof($contact_properties) != 0) {
|
||||
$obj = new contacts;
|
||||
$obj->contact_uuid = $contact_uuid;
|
||||
$obj->delete_properties($contact_properties);
|
||||
}
|
||||
|
||||
header('Location: contact_edit.php?id='.urlencode($contact_uuid));
|
||||
exit;
|
||||
case 'delete_contact':
|
||||
if (permission_exists('contact_delete')) {
|
||||
$array[0]['checked'] = 'true';
|
||||
$array[0]['uuid'] = $contact_uuid;
|
||||
|
||||
$obj = new contacts;
|
||||
$obj->delete($array);
|
||||
}
|
||||
|
||||
header('Location: contacts.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
|
|
@ -95,6 +54,24 @@
|
|||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
|
||||
//process the http post data by submitted action
|
||||
if ($_POST['action'] != '' && is_uuid($_POST['contact_uuid'])) {
|
||||
$array[0]['checked'] = 'true';
|
||||
$array[0]['uuid'] = $_POST['contact_uuid'];
|
||||
|
||||
switch ($_POST['action']) {
|
||||
case 'delete':
|
||||
if (permission_exists('contact_delete')) {
|
||||
$obj = new contacts;
|
||||
$obj->delete($array);
|
||||
|
||||
header('Location: contacts.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$user_uuid = $_POST["user_uuid"];
|
||||
$group_uuid = $_POST['group_uuid'];
|
||||
$contact_type = $_POST["contact_type"];
|
||||
|
|
@ -110,6 +87,8 @@
|
|||
$contact_role = $_POST["contact_role"];
|
||||
$contact_time_zone = $_POST["contact_time_zone"];
|
||||
$contact_note = $_POST["contact_note"];
|
||||
$contact_users_delete = $_POST['contact_users_delete'];
|
||||
$contact_groups_delete = $_POST['contact_groups_delete'];
|
||||
}
|
||||
|
||||
//process the form data
|
||||
|
|
@ -234,6 +213,49 @@
|
|||
$p->delete('contact_group_add', 'temp');
|
||||
}
|
||||
|
||||
//delete checked contact properties
|
||||
$array = array();
|
||||
if (permission_exists('contact_phone_delete')) { $contact_properties['contact_phones'] = $_POST['contact_phones']; }
|
||||
if (permission_exists('contact_address_delete')) { $contact_properties['contact_addresses'] = $_POST['contact_addresses']; }
|
||||
if (permission_exists('contact_email_delete')) { $contact_properties['contact_emails'] = $_POST['contact_emails']; }
|
||||
if (permission_exists('contact_url_delete')) { $contact_properties['contact_urls'] = $_POST['contact_urls']; }
|
||||
//if (permission_exists('contact_extension_delete')) { $contact_properties['contact_extensions'] = $_POST['contact_extensions']; }
|
||||
if (permission_exists('contact_relation_delete')) { $contact_properties['contact_relations'] = $_POST['contact_relations']; }
|
||||
if (permission_exists('contact_note_delete')) { $contact_properties['contact_notes'] = $_POST['contact_notes']; }
|
||||
if (permission_exists('contact_time_delete')) { $contact_properties['contact_times'] = $_POST['contact_times']; }
|
||||
if (permission_exists('contact_setting_delete')) { $contact_properties['contact_settings'] = $_POST['contact_settings']; }
|
||||
if (permission_exists('contact_attachment_delete')) { $contact_properties['contact_attachments'] = $_POST['contact_attachments']; }
|
||||
|
||||
if (@sizeof($contact_properties) != 0) {
|
||||
$obj = new contacts;
|
||||
$obj->contact_uuid = $contact_uuid;
|
||||
$obj->delete_properties($contact_properties);
|
||||
}
|
||||
|
||||
//remove checked users
|
||||
if (
|
||||
$action == 'update'
|
||||
&& permission_exists('contact_user_delete')
|
||||
&& is_array($contact_users_delete)
|
||||
&& @sizeof($contact_users_delete) != 0
|
||||
) {
|
||||
$obj = new contacts;
|
||||
$obj->contact_uuid = $contact_uuid;
|
||||
$obj->delete_users($contact_users_delete);
|
||||
}
|
||||
|
||||
//remove checked groups
|
||||
if (
|
||||
$action == 'update'
|
||||
&& permission_exists('contact_group_delete')
|
||||
&& is_array($contact_groups_delete)
|
||||
&& @sizeof($contact_groups_delete) != 0
|
||||
) {
|
||||
$obj = new contacts;
|
||||
$obj->contact_uuid = $contact_uuid;
|
||||
$obj->delete_groups($contact_groups_delete);
|
||||
}
|
||||
|
||||
//redirect the browser
|
||||
header("Location: contact_edit.php?id=".urlencode($contact_uuid));
|
||||
exit;
|
||||
|
|
@ -298,9 +320,41 @@
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$contact_users = $database->select($sql, $parameters, 'all');
|
||||
$contact_users_assigned = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the assigned groups of this contact
|
||||
$sql = "select g.*, cg.contact_group_uuid ";
|
||||
$sql .= "from v_groups as g, v_contact_groups as cg ";
|
||||
$sql .= "where cg.group_uuid = g.group_uuid ";
|
||||
$sql .= "and cg.domain_uuid = :domain_uuid ";
|
||||
$sql .= "and cg.contact_uuid = :contact_uuid ";
|
||||
$sql .= "and cg.group_uuid <> :group_uuid ";
|
||||
$sql .= "order by g.group_name asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['group_uuid'] = $_SESSION["user_uuid"];
|
||||
$database = new database;
|
||||
$contact_groups_assigned = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($contact_groups_assigned) && @sizeof($contact_groups_assigned) != 0) {
|
||||
foreach ($contact_groups_assigned as $field) {
|
||||
$contact_groups[] = "'".$field['group_uuid']."'";
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the available groups to this contact
|
||||
$sql = "select group_uuid, group_name from v_groups ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
if (is_array($contact_groups) && @sizeof($contact_groups) != 0) {
|
||||
$sql .= "and group_uuid not in (".implode(',', $contact_groups).") ";
|
||||
}
|
||||
$sql .= "order by group_name asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$contact_groups_available = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters, $contact_groups);
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
|
@ -381,6 +435,8 @@
|
|||
echo "</script>";
|
||||
|
||||
//show the content
|
||||
echo "<form id='frm' method='post'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'>";
|
||||
if ($action == "add") {
|
||||
|
|
@ -436,8 +492,7 @@
|
|||
permission_exists('contact_setting_add') ||
|
||||
permission_exists('contact_attachment_add')
|
||||
)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'style'=>'margin-left: 15px;','collapse'=>'hide-sm-dn','onclick'=>"document.getElementById('select_add').style.display='inline'; this.style.display='none';"]);
|
||||
echo "<select class='formfld' style='display: none; width: auto; margin-left: 15px;' id='select_add' onchange=\"document.location.href='contact_' + (this.options[this.selectedIndex].value) + '_edit.php?contact_uuid=".urlencode($contact_uuid)."';\">\n";
|
||||
echo "<select class='formfld' style='width: auto; margin-left: 15px;' id='select_add' onchange=\"document.location.href='contact_' + (this.options[this.selectedIndex].value) + '_edit.php?contact_uuid=".urlencode($contact_uuid)."';\">\n";
|
||||
echo " <option value=''>".$text['button-add']."...</option>\n";
|
||||
if (permission_exists('contact_phone_add')) { echo "<option value='phone'>".$text['label-phone_number']."</option>\n"; }
|
||||
if (permission_exists('contact_address_add')) { echo "<option value='address'>".$text['label-address_address']."</option>\n"; }
|
||||
|
|
@ -452,34 +507,9 @@
|
|||
}
|
||||
if ($action == "update") {
|
||||
if (
|
||||
permission_exists('contact_delete') && (
|
||||
permission_exists('contact_phone_delete') ||
|
||||
permission_exists('contact_address_delete') ||
|
||||
permission_exists('contact_email_delete') ||
|
||||
permission_exists('contact_url_delete') ||
|
||||
permission_exists('contact_relation_delete') ||
|
||||
permission_exists('contact_note_delete') ||
|
||||
permission_exists('contact_time_delete') ||
|
||||
permission_exists('contact_setting_delete') ||
|
||||
permission_exists('contact_attachment_delete')
|
||||
)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','link'=>'#modal-delete']);
|
||||
echo modal::create([
|
||||
'id'=>'modal-delete',
|
||||
'title'=>$text['modal_title-confirmation'],
|
||||
'message'=>$text['message-delete_selection'],
|
||||
'actions'=>
|
||||
button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>'times','collapse'=>'hide-xs','onclick'=>'modal_close();']).
|
||||
button::create(['type'=>'button','label'=>$text['label-contact'],'icon'=>$_SESSION['theme']['button_icon_user'],'style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); if (confirm('".$text['confirm-delete']."')) { document.getElementById('contact_action').value='delete_contact'; document.getElementById('frm').submit(); } else { this.blur(); return false; }"]).
|
||||
button::create(['type'=>'button','label'=>$text['label-properties'],'icon'=>'check-square','collapse'=>'never','style'=>'float: right;','onclick'=>"modal_close(); list_action_set('delete_properties'); list_form_submit('form_list');"])
|
||||
]);
|
||||
}
|
||||
else {
|
||||
if (permission_exists('contact_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','link'=>'#modal-delete']);
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); document.getElementById('contact_action').value='delete_contact'; document.getElementById('frm').submit();"])]);
|
||||
}
|
||||
else if (
|
||||
permission_exists('contact_delete') ||
|
||||
permission_exists('contact_user_delete') ||
|
||||
permission_exists('contact_group_delete') ||
|
||||
permission_exists('contact_phone_delete') ||
|
||||
permission_exists('contact_address_delete') ||
|
||||
permission_exists('contact_email_delete') ||
|
||||
|
|
@ -490,9 +520,13 @@
|
|||
permission_exists('contact_setting_delete') ||
|
||||
permission_exists('contact_attachment_delete')
|
||||
) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','link'=>'#modal-delete']);
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete_properties'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','collapse'=>'hide-sm-dn','link'=>"#modal-delete"]);
|
||||
echo modal::create([
|
||||
'id'=>'modal-delete',
|
||||
'type'=>'delete',
|
||||
'actions'=>
|
||||
button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','name'=>'action','value'=>'delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close();"])
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (permission_exists('contact_edit') || permission_exists('contact_add')) {
|
||||
|
|
@ -514,8 +548,6 @@
|
|||
echo "<tr>\n";
|
||||
echo "<td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
|
||||
echo "<form id='frm' method='post'>\n";
|
||||
|
||||
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
|
|
@ -686,26 +718,42 @@
|
|||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-users']."</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
if ($action == "update" && is_array($contact_users) && @sizeof($contact_users) != 0) {
|
||||
echo " <table border='0' style='width: 100%;'>\n";
|
||||
foreach ($contact_users as $field) {
|
||||
echo " <table border='0' cellpadding='0' cellspacing='0' style='width: 100%;'>\n";
|
||||
if ($action == "update" && is_array($contact_users_assigned) && @sizeof($contact_users_assigned) != 0) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='width: 100%;'>".escape($field['username'])."</td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('contact_user_delete')) {
|
||||
echo " <a href='contact_user_delete.php?id=".urlencode($field['contact_user_uuid'])."&contact_uuid=".urlencode($contact_uuid)."' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."');\">$v_link_label_delete</a>\n";
|
||||
echo " <td class='vtable'>".$text['label-username']."</td>\n";
|
||||
if ($contact_users_assigned && permission_exists('contact_user_delete')) {
|
||||
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_users', 'delete_toggle_users');\" onmouseout=\"swap_display('delete_label_users', 'delete_toggle_users');\">\n";
|
||||
echo " <span id='delete_label_users'>".$text['label-delete']."</span>\n";
|
||||
echo " <span id='delete_toggle_users'><input type='checkbox' id='checkbox_all_users' name='checkbox_all' onclick=\"edit_all_toggle('users');\"></span>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
foreach ($contact_users_assigned as $x => $field) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>".escape($field['username'])."</td>\n";
|
||||
if ($contact_users_assigned && permission_exists('contact_user_delete')) {
|
||||
if (is_uuid($field['contact_user_uuid'])) {
|
||||
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
||||
echo " <input type='checkbox' name='contact_users_delete[".$x."][checked]' value='true' class='chk_delete checkbox_users' onclick=\"edit_delete_action('users');\">\n";
|
||||
echo " <input type='hidden' name='contact_users_delete[".$x."][uuid]' value='".escape($field['contact_user_uuid'])."' />\n";
|
||||
}
|
||||
else {
|
||||
echo " <td>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
// echo " <a href='contact_user_delete.php?id=".urlencode($field['contact_user_uuid'])."&contact_uuid=".urlencode($contact_uuid)."' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."');\">$v_link_label_delete</a>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
echo " </table>\n";
|
||||
echo " <br />\n";
|
||||
}
|
||||
if (permission_exists('contact_user_add')) {
|
||||
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='border-bottom: none;' colspan='2'>\n";
|
||||
echo " <select name='user_uuid' class='formfld' style='width: auto;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($users as $field) {
|
||||
if (in_array($field['user_uuid'], array_column($contact_users, 'user_uuid'))) { continue; } //skip users already assigned
|
||||
if (in_array($field['user_uuid'], array_column($contact_users_assigned, 'user_uuid'))) { continue; } //skip users already assigned
|
||||
echo " <option value='".escape($field['user_uuid'])."'>".escape($field['username'])."</option>\n";
|
||||
}
|
||||
echo " </select>";
|
||||
|
|
@ -713,91 +761,72 @@
|
|||
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
|
||||
}
|
||||
unset($users);
|
||||
echo " <br>\n";
|
||||
echo " ".$text['description-users']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <tr>\n";
|
||||
}
|
||||
echo " </table>\n";
|
||||
echo " ".$text['description-users']."\n";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
|
||||
if (permission_exists('contact_group_view')) {
|
||||
echo "<tr>";
|
||||
echo " <td width='30%' class='vncell' valign='top'>".$text['label-groups']."</td>";
|
||||
echo " <td width='70%' class='vtable'>";
|
||||
$sql = "select ";
|
||||
$sql .= "g.*, ";
|
||||
$sql .= "cg.contact_group_uuid ";
|
||||
$sql .= "from ";
|
||||
$sql .= "v_groups as g, ";
|
||||
$sql .= "v_contact_groups as cg ";
|
||||
$sql .= "where ";
|
||||
$sql .= "cg.group_uuid = g.group_uuid ";
|
||||
$sql .= "and cg.domain_uuid = :domain_uuid ";
|
||||
$sql .= "and cg.contact_uuid = :contact_uuid ";
|
||||
$sql .= "and cg.group_uuid <> :group_uuid ";
|
||||
$sql .= "order by g.group_name asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['group_uuid'] = $_SESSION["user_uuid"];
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
echo " <table style='width: 100%;'>\n";
|
||||
foreach ($result as $field) {
|
||||
echo " <td class='vncell' valign='top'>".$text['label-groups']."</td>";
|
||||
echo " <td class='vtable'>";
|
||||
echo " <table border='0' cellpadding='0' cellspacing='0' style='width: 100%;'>\n";
|
||||
if (is_array($contact_groups_assigned) && @sizeof($contact_groups_assigned) != 0) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>".$text['label-group']."</td>\n";
|
||||
if ($contact_groups_assigned && permission_exists('contact_group_delete')) {
|
||||
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_groups', 'delete_toggle_groups');\" onmouseout=\"swap_display('delete_label_groups', 'delete_toggle_groups');\">\n";
|
||||
echo " <span id='delete_label_groups'>".$text['label-delete']."</span>\n";
|
||||
echo " <span id='delete_toggle_groups'><input type='checkbox' id='checkbox_all_groups' name='checkbox_all' onclick=\"edit_all_toggle('groups');\"></span>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
foreach ($contact_groups_assigned as $x => $field) {
|
||||
if (strlen($field['group_name']) > 0) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='width: 100%;'>".escape($field['group_name'])."</td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('contact_group_delete') || if_group("superadmin")) {
|
||||
echo " <a href='contact_group_delete.php?id=".urlencode($field['contact_group_uuid'])."&contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."');\">$v_link_label_delete</a>\n";
|
||||
echo " <td class='vtable'>".escape($field['group_name'])."</td>\n";
|
||||
if (permission_exists('contact_group_delete')) {
|
||||
if (is_uuid($field['contact_group_uuid'])) {
|
||||
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
||||
echo " <input type='checkbox' name='contact_groups_delete[".$x."][checked]' value='true' class='chk_delete checkbox_groups' onclick=\"edit_delete_action('groups');\">\n";
|
||||
echo " <input type='hidden' name='contact_groups_delete[".$x."][uuid]' value='".escape($field['contact_group_uuid'])."' />\n";
|
||||
}
|
||||
else {
|
||||
echo " <td>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
// echo " <a href='contact_group_delete.php?id=".urlencode($field['contact_group_uuid'])."&contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."');\">$v_link_label_delete</a>\n";
|
||||
echo " </tr>\n";
|
||||
$assigned_groups[] = $field['group_uuid'];
|
||||
}
|
||||
}
|
||||
echo " </table>\n";
|
||||
echo " <br />\n";
|
||||
}
|
||||
unset($sql, $parameters, $result, $field);
|
||||
|
||||
if (permission_exists('contact_group_add') || if_group("superadmin")) {
|
||||
$sql = "select * from v_groups ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "or domain_uuid is null ";
|
||||
if (is_array($assigned_groups) && @sizeof($assigned_groups) != 0) {
|
||||
foreach ($assigned_groups as $index => $assigned_group) {
|
||||
$sql_where_and[] = "group_uuid <> :group_uuid_".$index." ";
|
||||
$parameters['group_uuid_'.$index] = $assigned_group;
|
||||
}
|
||||
if (is_array($sql_where_and) && @sizeof($sql_where_and) != 0) {
|
||||
$sql .= "and ".implode(' and ', $sql_where_and)." ";
|
||||
}
|
||||
}
|
||||
$sql .= "order by group_name asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $sql_where_and, $index, $parameters, $assigned_groups, $assigned_group);
|
||||
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
if (permission_exists('contact_group_add')) {
|
||||
if (is_array($contact_groups_available) && @sizeof($contact_groups_available) != 0) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable' style='border-bottom: none;' colspan='2'>\n";
|
||||
echo " <select name='group_uuid' class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($result as $field) {
|
||||
foreach ($contact_groups_available as $field) {
|
||||
if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; } //only show superadmin group to superadmins
|
||||
if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin"))) { continue; } //only show admin group to admins
|
||||
echo " <option value='".escape($field['group_uuid'])."'>".escape($field['group_name'])."</option>\n";
|
||||
}
|
||||
echo " </select>";
|
||||
|
||||
if ($action == "update") {
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
|
||||
}
|
||||
echo "<br>";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
unset($result, $field);
|
||||
}
|
||||
|
||||
echo " </table>\n";
|
||||
echo " ".$text['description-groups']."\n";
|
||||
|
||||
echo " </td>";
|
||||
|
|
@ -805,33 +834,22 @@
|
|||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-contact_note']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " <textarea class='formfld' style='width: 100%; height: 160px;' name='contact_note'>".$contact_note."</textarea>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' id='contact_action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
|
||||
}
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
echo "</td>\n";
|
||||
|
||||
if ($action == "update") {
|
||||
echo "<td> </td>";
|
||||
echo "<td width='100%' valign='top'>\n";
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
|
||||
if (permission_exists('contact_phone_view')) { require "contact_phones.php"; }
|
||||
if (permission_exists('contact_address_view')) { require "contact_addresses.php"; }
|
||||
if (permission_exists('contact_email_view')) { require "contact_emails.php"; }
|
||||
|
|
@ -843,13 +861,6 @@
|
|||
if (permission_exists('contact_setting_view')) { require "contact_settings.php"; }
|
||||
if (permission_exists('contact_attachment_view')) { require "contact_attachments.php"; }
|
||||
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
|
||||
}
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
echo "</td>\n";
|
||||
}
|
||||
|
||||
|
|
@ -857,6 +868,32 @@
|
|||
echo "</table>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
|
||||
}
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>";
|
||||
|
||||
//hide the delete button when nothing to delete
|
||||
if (
|
||||
$action == 'update' &&
|
||||
!permission_exists('contact_delete') && (
|
||||
(!is_array($contact_users_assigned) || @sizeof($contact_users_assigned) == 0) &&
|
||||
(!is_array($contact_groups_assigned) || @sizeof($contact_groups_assigned) == 0) &&
|
||||
(!is_array($contact_phones) || @sizeof($contact_phones) == 0) &&
|
||||
(!is_array($contact_addresses) || @sizeof($contact_addresses) == 0) &&
|
||||
(!is_array($contact_emails) || @sizeof($contact_emails) == 0) &&
|
||||
(!is_array($contact_urls) || @sizeof($contact_urls) == 0) &&
|
||||
(!is_array($contact_extensions) || @sizeof($contact_extensions) == 0) &&
|
||||
(!is_array($contact_relations) || @sizeof($contact_relations) == 0) &&
|
||||
(!is_array($contact_notes) || @sizeof($contact_notes) == 0) &&
|
||||
(!is_array($contact_times) || @sizeof($contact_times) == 0) &&
|
||||
(!is_array($contact_settings) || @sizeof($contact_settings) == 0) &&
|
||||
(!is_array($contact_attachments) || @sizeof($contact_attachments) == 0)
|
||||
)) {
|
||||
echo "<script>document.getElementsByName('btn_delete')[0].style.display='none';</script>\n";
|
||||
}
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -49,19 +49,12 @@
|
|||
$contact_emails = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-emails']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_email_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_email_edit.php?contact_uuid='.urlencode($_GET['id'])]);
|
||||
}
|
||||
if (permission_exists('contact_email_delete') && $contact_emails) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -69,7 +62,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_email_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_emails' name='checkbox_all' onclick=\"list_all_toggle('emails');\" ".($contact_emails ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_emails' name='checkbox_all' onclick=\"edit_all_toggle('emails');\" ".($contact_emails ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
|
||||
|
|
@ -89,7 +82,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_email_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_emails[$x][checked]' id='checkbox_".$x."' class='checkbox_emails' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_emails').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_emails[$x][checked]' id='checkbox_".$x."' class='checkbox_emails' value='true' onclick=\"edit_delete_action('emails');\">\n";
|
||||
echo " <input type='hidden' name='contact_emails[$x][uuid]' value='".escape($row['contact_email_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -110,4 +103,6 @@
|
|||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -52,16 +52,12 @@
|
|||
$contact_extensions = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-contact_extensions']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_url_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>PROJECT_PATH.'/app/extensions/extension_edit.php']);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -106,4 +102,6 @@
|
|||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -54,19 +54,12 @@
|
|||
$contact_notes = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-contact_notes']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_note_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_note_edit.php?contact_uuid='.urlencode($contact_uuid)]);
|
||||
}
|
||||
if (permission_exists('contact_note_delete') && $contact_notes) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -74,7 +67,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_note_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"list_all_toggle('notes');\" ".($contact_notes ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"edit_all_toggle('notes');\" ".($contact_notes ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th>".$text['label-note_content']."</th>\n";
|
||||
|
|
@ -84,9 +77,6 @@
|
|||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
// echo "<div id='contact_notes' style='width: 100%; overflow: auto; direction: rtl; text-align: right; margin-bottom: 23px;'>";
|
||||
// echo "<table class='tr_hover' style='width: 100%; direction: ltr; padding-left: 1px' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
|
||||
foreach ($contact_notes as $row) {
|
||||
$contact_note = $row['contact_note'];
|
||||
|
|
@ -98,7 +88,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_note_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_notes[$x][checked]' id='checkbox_".$x."' class='checkbox_notes' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_notes').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_notes[$x][checked]' id='checkbox_".$x."' class='checkbox_notes' value='true' onclick=\"edit_delete_action('notes');\">\n";
|
||||
echo " <input type='hidden' name='contact_notes[$x][uuid]' value='".escape($row['contact_note_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -118,6 +108,6 @@
|
|||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
// echo "<script>if (document.getElementById('contact_notes').offsetHeight > 200) { document.getElementById('contact_notes').style.height = 200; }</script>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -49,6 +49,9 @@
|
|||
$contact_phones = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
|
||||
|
||||
//javascript function: send_cmd
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
echo "function send_cmd(url) {\n";
|
||||
|
|
@ -67,16 +70,6 @@
|
|||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-phone_numbers']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_phone_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_phone_edit.php?contact_uuid='.urlencode($_GET['id'])]);
|
||||
}
|
||||
if (permission_exists('contact_phone_delete') && $contact_phones) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -84,7 +77,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_phone_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_phones' name='checkbox_all' onclick=\"list_all_toggle('phones');\" ".($contact_phones ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_phones' name='checkbox_all' onclick=\"edit_all_toggle('phones');\" ".($contact_phones ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-phone_label']."</th>\n";
|
||||
|
|
@ -106,7 +99,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_phone_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_phones[$x][checked]' id='checkbox_".$x."' class='checkbox_phones' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_phones').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_phones[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_phones' value='true' onclick=\"edit_delete_action('phones');\">\n";
|
||||
echo " <input type='hidden' name='contact_phones[$x][uuid]' value='".escape($row['contact_phone_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -147,4 +140,6 @@
|
|||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -63,19 +63,12 @@
|
|||
$contact_relations = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-contact_relations']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_relation_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_relation_edit.php?contact_uuid='.urlencode($contact_uuid)]);
|
||||
}
|
||||
if (permission_exists('contact_relation_delete') && $contact_relations) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -83,7 +76,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_relation_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_relations' name='checkbox_all' onclick=\"list_all_toggle('relations');\" ".($contact_relations ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_relations' name='checkbox_all' onclick=\"edit_all_toggle('relations');\" ".($contact_relations ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th>".$text['label-contact_relation_label']."</th>\n";
|
||||
|
|
@ -103,7 +96,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_relation_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_relations[$x][checked]' id='checkbox_".$x."' class='checkbox_relations' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_relations').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_relations[$x][checked]' id='checkbox_".$x."' class='checkbox_relations' value='true' onclick=\"edit_delete_action('relations');\">\n";
|
||||
echo " <input type='hidden' name='contact_relations[$x][uuid]' value='".escape($row['contact_relation_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -124,4 +117,6 @@
|
|||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -53,19 +53,12 @@
|
|||
$contact_settings = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-contact_settings']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_setting_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_setting_edit.php?contact_uuid='.urlencode($contact_uuid)]);
|
||||
}
|
||||
if (permission_exists('contact_setting_delete') && $contact_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -73,7 +66,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_setting_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_settings' name='checkbox_all' onclick=\"list_all_toggle('settings');\" ".($contact_settings ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_settings' name='checkbox_all' onclick=\"edit_all_toggle('settings');\" ".($contact_settings ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-contact_setting_category']."</th>";
|
||||
|
|
@ -96,7 +89,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_setting_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_settings' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_settings').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_settings' value='true' onclick=\"edit_delete_action('settings');\">\n";
|
||||
echo " <input type='hidden' name='contact_settings[$x][uuid]' value='".escape($row['contact_setting_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -133,4 +126,6 @@
|
|||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -56,19 +56,12 @@
|
|||
$contact_times = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_times) && @sizeof($contact_times) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['header_contact_times']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_time_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_time_edit.php?contact_uuid='.urlencode($contact_uuid)]);
|
||||
}
|
||||
if (permission_exists('contact_time_delete') && $contact_times) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -76,7 +69,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_time_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_times' name='checkbox_all' onclick=\"list_all_toggle('times');\" ".($contact_times ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_times' name='checkbox_all' onclick=\"edit_all_toggle('times');\" ".($contact_times ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-20'>".$text['label-time_user']."</th>\n";
|
||||
|
|
@ -107,7 +100,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_time_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_times[$x][checked]' id='checkbox_".$x."' class='checkbox_times' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_times').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_times[$x][checked]' id='checkbox_".$x."' class='checkbox_times' value='true' onclick=\"edit_delete_action('times');\">\n";
|
||||
echo " <input type='hidden' name='contact_times[$x][uuid]' value='".escape($row['contact_time_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -129,4 +122,6 @@
|
|||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -54,19 +54,12 @@
|
|||
$contact_urls = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-urls']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
/*
|
||||
if (permission_exists('contact_url_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_url_edit.php?contact_uuid='.urlencode($_GET['id'])]);
|
||||
}
|
||||
if (permission_exists('contact_url_delete') && $contact_urls) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
*/
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -74,7 +67,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_url_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_urls' name='checkbox_all' onclick=\"list_all_toggle('urls');\" ".($contact_urls ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_urls' name='checkbox_all' onclick=\"edit_all_toggle('urls');\" ".($contact_urls ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-url_label']."</th>\n";
|
||||
|
|
@ -94,7 +87,7 @@
|
|||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('contact_url_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='contact_urls[$x][checked]' id='checkbox_".$x."' class='checkbox_urls' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_urls').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='contact_urls[$x][checked]' id='checkbox_".$x."' class='checkbox_urls' value='true' onclick=\"edit_delete_action('urls');\">\n";
|
||||
echo " <input type='hidden' name='contact_urls[$x][uuid]' value='".escape($row['contact_url_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -115,4 +108,6 @@
|
|||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -179,19 +179,109 @@ if (!class_exists('contacts')) {
|
|||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_users($records) {
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'contact_user_';
|
||||
$this->table = 'contact_users';
|
||||
$this->uuid_prefix = 'contact_user_';
|
||||
|
||||
if (permission_exists($this->permission_prefix.'delete')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//delete multiple records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//filter out unchecked ivr menu options, build delete array
|
||||
$x = 0;
|
||||
foreach ($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['contact_uuid'] = $this->contact_uuid;
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_groups($records) {
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'contact_group_';
|
||||
$this->table = 'contact_groups';
|
||||
$this->uuid_prefix = 'contact_group_';
|
||||
|
||||
if (permission_exists($this->permission_prefix.'delete')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: '.$this->list_page);
|
||||
exit;
|
||||
}
|
||||
|
||||
//delete multiple records
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//filter out unchecked ivr menu options, build delete array
|
||||
$x = 0;
|
||||
foreach ($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['contact_uuid'] = $this->contact_uuid;
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//execute delete
|
||||
$database = new database;
|
||||
$database->app_name = $this->app_name;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->delete($array);
|
||||
unset($array);
|
||||
}
|
||||
unset($records);
|
||||
}
|
||||
}
|
||||
} //method
|
||||
|
||||
} //class
|
||||
|
|
|
|||
Loading…
Reference in New Issue