Contacts - Edit: Add bulk delete Users and Groups, convert bulk deletion of Properties to use dynamic delete button.

This commit is contained in:
Nate 2020-03-03 23:27:35 -07:00
parent d92de7e63e
commit 9c81da353a
12 changed files with 915 additions and 840 deletions

View File

@ -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,73 +54,68 @@
$contact_addresses = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-15'>".$text['label-address_label']."</th>\n";
echo "<th>".$text['label-address_address']."</th>\n";
echo "<th>".$text['label-address_locality'].", ".$text['label-address_region']."</th>\n";
echo "<th class='center'>".$text['label-address_country']."</th>\n";
echo "<th class='shrink'>&nbsp;</th>\n";
echo "<th class='hide-md-dn'>".$text['label-address_description']."</th>\n";
if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
$x = 0;
foreach ($contact_addresses as $row) {
$map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code'];
if (permission_exists('contact_address_edit')) {
$list_row_url = "contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_address_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//show the content
echo "<div class='action_bar sub shrink'>\n";
echo " <div class='heading'><b>".$text['label-addresses']."</b></div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_addresses[$x][uuid]' value='".escape($row['contact_address_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".escape($row['address_label'])." ".($row['address_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
$address = escape($row['address_street']).($row['address_extended'] != '' ? " ".escape($row['address_extended']) : null);
echo " <td class='pct-25 overflow no-wrap'><a href='".$list_row_url."'>".$address."</a>&nbsp;</td>\n";
echo " <td class='no-wrap'>".escape($row['address_locality']).(($row['address_locality'] != '' && $row['address_region'] != '') ? ", " : null).escape($row['address_region'])."&nbsp;</td>\n";
echo " <td class='center'>".escape($row['address_country'])."&nbsp;</td>\n";
echo " <td class='button no-link'><a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\"><img src='resources/images/icon_gmaps.png' style='width: 21px; height: 21px; alt='".$text['label-google_map']."' title='".$text['label-google_map']."'></a></td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['address_description'])."&nbsp;</td>\n";
echo "<th class='pct-15'>".$text['label-address_label']."</th>\n";
echo "<th>".$text['label-address_address']."</th>\n";
echo "<th>".$text['label-address_locality'].", ".$text['label-address_region']."</th>\n";
echo "<th class='center'>".$text['label-address_country']."</th>\n";
echo "<th class='shrink'>&nbsp;</th>\n";
echo "<th class='hide-md-dn'>".$text['label-address_description']."</th>\n";
if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_addresses);
if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
$x = 0;
foreach ($contact_addresses as $row) {
$map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code'];
if (permission_exists('contact_address_edit')) {
$list_row_url = "contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_address_uuid']);
}
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=\"edit_delete_action('addresses');\">\n";
echo " <input type='hidden' name='contact_addresses[$x][uuid]' value='".escape($row['contact_address_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>".escape($row['address_label'])." ".($row['address_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
$address = escape($row['address_street']).($row['address_extended'] != '' ? " ".escape($row['address_extended']) : null);
echo " <td class='pct-25 overflow no-wrap'><a href='".$list_row_url."'>".$address."</a>&nbsp;</td>\n";
echo " <td class='no-wrap'>".escape($row['address_locality']).(($row['address_locality'] != '' && $row['address_region'] != '') ? ", " : null).escape($row['address_region'])."&nbsp;</td>\n";
echo " <td class='center'>".escape($row['address_country'])."&nbsp;</td>\n";
echo " <td class='button no-link'><a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\"><img src='resources/images/icon_gmaps.png' style='width: 21px; height: 21px; alt='".$text['label-google_map']."' title='".$text['label-google_map']."'></a></td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['address_description'])."&nbsp;</td>\n";
if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_addresses);
}
echo "</table>\n";
echo "<br />\n";
}
echo "</table>\n";
echo "<br />\n";
?>

View File

@ -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,102 +49,97 @@
$contact_attachments = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//styles and attachment layer
echo "<style>\n";
echo " #contact_attachment_layer {\n";
echo " z-index: 999999;\n";
echo " position: absolute;\n";
echo " left: 0px;\n";
echo " top: 0px;\n";
echo " right: 0px;\n";
echo " bottom: 0px;\n";
echo " text-align: center;\n";
echo " vertical-align: middle;\n";
echo " }\n";
echo "</style>\n";
echo "<div id='contact_attachment_layer' style='display: none;'></div>\n";
//script
echo "<script>\n";
echo " function display_attachment(id) {\n";
echo " $('#contact_attachment_layer').load('contact_attachment.php?id=' + id + '&action=display', function(){\n";
echo " $('#contact_attachment_layer').fadeIn(200);\n";
echo " });\n";
echo " }\n";
echo "</script>\n";
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-15'>".$text['label-type']."</th>\n";
echo "<th>".$text['label-attachment_filename']."</th>\n";
echo "<th>".$text['label-attachment_size']."</th>\n";
echo "<th>".$text['label-tools']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-attachment_description']."</th>\n";
if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
$x = 0;
foreach ($contact_attachments as $row) {
$attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION));
$attachment_type_label = $attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png' ? $text['label-image'] : $text['label-file'];
if (permission_exists('contact_attachment_edit')) {
$list_row_url = "contact_attachment_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_attachment_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//styles and attachment layer
echo "<style>\n";
echo " #contact_attachment_layer {\n";
echo " z-index: 999999;\n";
echo " position: absolute;\n";
echo " left: 0px;\n";
echo " top: 0px;\n";
echo " right: 0px;\n";
echo " bottom: 0px;\n";
echo " text-align: center;\n";
echo " vertical-align: middle;\n";
echo " }\n";
echo "</style>\n";
echo "<div id='contact_attachment_layer' style='display: none;'></div>\n";
//script
echo "<script>\n";
echo " function display_attachment(id) {\n";
echo " $('#contact_attachment_layer').load('contact_attachment.php?id=' + id + '&action=display', function(){\n";
echo " $('#contact_attachment_layer').fadeIn(200);\n";
echo " });\n";
echo " }\n";
echo "</script>\n";
//show the content
echo "<div class='action_bar sub shrink'>\n";
echo " <div class='heading'><b>".$text['label-attachments']."</b></div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_attachments[$x][uuid]' value='".escape($row['contact_attachment_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".$attachment_type_label." ".($row['attachment_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td><a href='".$list_row_url."'>".escape($row['attachment_filename'])."</a></td>\n";
echo " <td>".strtoupper(byte_convert($row['attachment_size']))."</td>\n";
echo " <td class='no-link' style='cursor: pointer;'>";
if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') {
echo button::create(['type'=>'button','class'=>'link','label'=>$text['button-view'],'onclick'=>"display_attachment('".escape($row['contact_attachment_uuid'])."');"]);
}
else {
echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-download'],'onclick'=>"window.location='contact_attachment.php?id=".urlencode($row['contact_attachment_uuid'])."&action=download';"]);
}
echo " </td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['attachment_description'])."</td>\n";
echo "<th class='pct-15'>".$text['label-type']."</th>\n";
echo "<th>".$text['label-attachment_filename']."</th>\n";
echo "<th>".$text['label-attachment_size']."</th>\n";
echo "<th>".$text['label-tools']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-attachment_description']."</th>\n";
if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_attachments);
echo "</table>";
echo "<br />\n";
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
$x = 0;
foreach ($contact_attachments as $row) {
$attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION));
$attachment_type_label = $attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png' ? $text['label-image'] : $text['label-file'];
if (permission_exists('contact_attachment_edit')) {
$list_row_url = "contact_attachment_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_attachment_uuid']);
}
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=\"edit_delete_action('attachments');\">\n";
echo " <input type='hidden' name='contact_attachments[$x][uuid]' value='".escape($row['contact_attachment_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>".$attachment_type_label." ".($row['attachment_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td><a href='".$list_row_url."'>".escape($row['attachment_filename'])."</a></td>\n";
echo " <td>".strtoupper(byte_convert($row['attachment_size']))."</td>\n";
echo " <td class='no-link' style='cursor: pointer;'>";
if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') {
echo button::create(['type'=>'button','class'=>'link','label'=>$text['button-view'],'onclick'=>"display_attachment('".escape($row['contact_attachment_uuid'])."');"]);
}
else {
echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-download'],'onclick'=>"window.location='contact_attachment.php?id=".urlencode($row['contact_attachment_uuid'])."&action=download';"]);
}
echo " </td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['attachment_description'])."</td>\n";
if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_attachments);
echo "</table>";
echo "<br />\n";
}
?>

View File

@ -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,7 +507,9 @@
}
if ($action == "update") {
if (
permission_exists('contact_delete') && (
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') ||
@ -462,38 +519,15 @@
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 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',
'title'=>$text['modal_title-confirmation'],
'message'=>$text['message-delete_selection'],
'type'=>'delete',
'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');"])
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();"])
]);
}
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_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','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');"])]);
}
}
}
if (permission_exists('contact_edit') || permission_exists('contact_add')) {
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>($action != 'update' ?: 'margin-left: 15px;'),'collapse'=>'hide-sm-dn','onclick'=>"document.getElementById('frm').submit();"]);
@ -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,118 +718,115 @@
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'>".$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' 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'>".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 " </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
echo " <option value='".escape($field['user_uuid'])."'>".escape($field['username'])."</option>\n";
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>";
echo " </select>";
if ($action == "update") {
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 " <tr>\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 " </td>\n";
echo "</tr>\n";
$assigned_groups[] = $field['group_uuid'];
// 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";
}
}
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) {
echo " <select name='group_uuid' class='formfld' style='width: auto; margin-right: 3px;'>\n";
echo " <option value=''></option>\n";
foreach ($result as $field) {
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 ($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 " <option value='".escape($field['group_uuid'])."'>".escape($field['group_name'])."</option>\n";
}
echo " </select>";
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,50 +834,32 @@
}
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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"; }
if (permission_exists('contact_url_view')) { require "contact_urls.php"; }
if (permission_exists('contact_extension_view')) { require "contact_extensions.php"; }
if (permission_exists('contact_relation_view')) { require "contact_relations.php"; }
if (permission_exists('contact_note_view')) { require "contact_notes.php"; }
if (permission_exists('contact_time_view')) { require "contact_times.php"; }
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>";
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"; }
if (permission_exists('contact_url_view')) { require "contact_urls.php"; }
if (permission_exists('contact_extension_view')) { require "contact_extensions.php"; }
if (permission_exists('contact_relation_view')) { require "contact_relations.php"; }
if (permission_exists('contact_note_view')) { require "contact_notes.php"; }
if (permission_exists('contact_time_view')) { require "contact_times.php"; }
if (permission_exists('contact_setting_view')) { require "contact_settings.php"; }
if (permission_exists('contact_attachment_view')) { require "contact_attachments.php"; }
echo "</td>\n";
}
@ -857,7 +868,33 @@
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";
?>
?>

View File

@ -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,65 +49,60 @@
$contact_emails = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
echo "<th>".$text['label-email_address']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-email_description']."</th>\n";
if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
$x = 0;
foreach ($contact_emails as $row) {
if (permission_exists('contact_email_edit')) {
$list_row_url = "contact_email_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_email_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//show the content
echo "<div class='action_bar sub shrink'>\n";
echo " <div class='heading'><b>".$text['label-emails']."</b></div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_emails[$x][uuid]' value='".escape($row['contact_email_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".escape($row['email_label'])." ".($row['email_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td class='no-link'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a>&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['email_description'])."&nbsp;</td>\n";
echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
echo "<th>".$text['label-email_address']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-email_description']."</th>\n";
if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_emails);
echo "</table>";
echo "<br />\n";
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
$x = 0;
foreach ($contact_emails as $row) {
if (permission_exists('contact_email_edit')) {
$list_row_url = "contact_email_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_email_uuid']);
}
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=\"edit_delete_action('emails');\">\n";
echo " <input type='hidden' name='contact_emails[$x][uuid]' value='".escape($row['contact_email_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>".escape($row['email_label'])." ".($row['email_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td class='no-link'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a>&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['email_description'])."&nbsp;</td>\n";
if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_emails);
echo "</table>";
echo "<br />\n";
}
?>

View File

@ -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,58 +52,56 @@
$contact_extensions = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th class='center'>".$text['label-enabled']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-description']."</th>\n";
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
$x = 0;
foreach ($contact_extensions as $row) {
if (permission_exists('extension_edit')) {
$list_row_url = PROJECT_PATH.'/app/extensions/extension_edit.php?id='.urlencode($row['extension_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."' ".($row['url_primary'] ? "style='font-weight: bold;'" : null).">\n";
echo " <td>";
if (permission_exists('extension_edit')) {
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".urlencode($row['extension_uuid'])."'>".escape($row['extension'])."</a>";
}
else {
echo $row['extension'];
}
echo " </td>\n";
echo " <td class='center'>".$text['label-'.escape($row['enabled'])]."&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".$row['description']."&nbsp;</td>\n";
//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 style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th class='center'>".$text['label-enabled']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-description']."</th>\n";
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_extensions);
echo "</table>";
echo "<br />\n";
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
$x = 0;
foreach ($contact_extensions as $row) {
if (permission_exists('extension_edit')) {
$list_row_url = PROJECT_PATH.'/app/extensions/extension_edit.php?id='.urlencode($row['extension_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."' ".($row['url_primary'] ? "style='font-weight: bold;'" : null).">\n";
echo " <td>";
if (permission_exists('extension_edit')) {
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".urlencode($row['extension_uuid'])."'>".escape($row['extension'])."</a>";
}
else {
echo $row['extension'];
}
echo " </td>\n";
echo " <td class='center'>".$text['label-'.escape($row['enabled'])]."&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".$row['description']."&nbsp;</td>\n";
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_extensions);
echo "</table>";
echo "<br />\n";
}
?>

View File

@ -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,70 +54,60 @@
$contact_notes = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th>".$text['label-note_content']."</th>\n";
echo "<th class='shrink'>".$text['label-note_user']."</th>\n";
if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
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";
//show if exists
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
foreach ($contact_notes as $row) {
$contact_note = $row['contact_note'];
$contact_note = escape($contact_note);
$contact_note = str_replace("\n","<br />",$contact_note);
if (permission_exists('contact_note_add')) {
$list_row_url = "contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//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 style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_notes[$x][uuid]' value='".escape($row['contact_note_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td class='overflow'>".$contact_note."</td>\n";
echo " <td class='description no-wrap'><strong>".escape($row['last_mod_user'])."</strong>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</td>\n";
echo "<th>".$text['label-note_content']."</th>\n";
echo "<th class='shrink'>".$text['label-note_user']."</th>\n";
if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
foreach ($contact_notes as $row) {
$contact_note = $row['contact_note'];
$contact_note = escape($contact_note);
$contact_note = str_replace("\n","<br />",$contact_note);
if (permission_exists('contact_note_add')) {
$list_row_url = "contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid']);
}
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=\"edit_delete_action('notes');\">\n";
echo " <input type='hidden' name='contact_notes[$x][uuid]' value='".escape($row['contact_note_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td class='overflow'>".$contact_note."</td>\n";
echo " <td class='description no-wrap'><strong>".escape($row['last_mod_user'])."</strong>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</td>\n";
if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_notes);
echo "</table>";
echo "<br />\n";
}
unset($contact_notes);
echo "</table>";
echo "<br />\n";
// echo "<script>if (document.getElementById('contact_notes').offsetHeight > 200) { document.getElementById('contact_notes').style.height = 200; }</script>\n";
?>

View File

@ -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,102 +49,97 @@
$contact_phones = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//javascript function: send_cmd
echo "<script type=\"text/javascript\">\n";
echo "function send_cmd(url) {\n";
echo " if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n";
echo " xmlhttp=new XMLHttpRequest();\n";
echo " }\n";
echo " else {// code for IE6, IE5\n";
echo " xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " }\n";
echo " xmlhttp.open(\"GET\",url,true);\n";
echo " xmlhttp.send(null);\n";
echo " document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;\n";
echo "}\n";
echo "</script>\n";
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-15'>".$text['label-phone_label']."</th>\n";
echo "<th>".$text['label-phone_number']."</th>\n";
echo "<th>".$text['label-phone_type']."</th>\n";
echo "<th>".$text['label-phone_tools']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-phone_description']."</th>\n";
if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
$x = 0;
foreach ($contact_phones as $row) {
if (permission_exists('contact_phone_edit')) {
$list_row_url = "contact_phone_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_phone_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//javascript function: send_cmd
echo "<script type=\"text/javascript\">\n";
echo "function send_cmd(url) {\n";
echo " if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n";
echo " xmlhttp=new XMLHttpRequest();\n";
echo " }\n";
echo " else {// code for IE6, IE5\n";
echo " xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " }\n";
echo " xmlhttp.open(\"GET\",url,true);\n";
echo " xmlhttp.send(null);\n";
echo " document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;\n";
echo "}\n";
echo "</script>\n";
//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 style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_phones[$x][uuid]' value='".escape($row['contact_phone_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".($row['phone_label'] == strtolower($row['phone_label']) ? ucwords($row['phone_label']) : $row['phone_label'])." ".($row['phone_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td class='no-link'>\n";
echo button::create(['type'=>'button','class'=>'link','label'=>escape(format_phone($row['phone_number'])),'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
echo " </td>\n";
echo " <td class='no-wrap'>\n";
if ($row['phone_type_voice']) { $phone_types[] = "<i class='fas fa-phone fa-fw' style='margin-right: 3px;' title=\"".$text['label-voice']."\"></i>"; }
if ($row['phone_type_fax']) { $phone_types[] = "<i class='fas fa-fax fa-fw' style='margin-right: 3px;' title=\"".$text['label-fax']."\"></i>"; }
if ($row['phone_type_video']) { $phone_types[] = "<i class='fas fa-video fa-fw' style='margin-right: 3px;' title=\"".$text['label-video']."\"></i>"; }
if ($row['phone_type_text']) { $phone_types[] = "<i class='fas fa-sms fa-fw' style='margin-right: 3px;' title=\"".$text['label-text']."\"></i>"; }
if (is_array($phone_types)) {
echo " ".implode(" ", $phone_types)."\n";
}
unset($phone_types);
echo " </td>\n";
echo " <td class='no-link no-wrap'>\n";
echo " <a href='../xml_cdr/xml_cdr.php?caller_id_number=".urlencode($row['phone_number'])."'>".$text['button-cdr']."</a>";
if ($row['phone_type_voice']) {
echo "&nbsp;<span class='hide-sm-dn'>\n";
echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-phone_call'],'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
echo "</span>";
}
echo " </td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['phone_description'])."&nbsp;</td>\n";
echo "<th class='pct-15'>".$text['label-phone_label']."</th>\n";
echo "<th>".$text['label-phone_number']."</th>\n";
echo "<th>".$text['label-phone_type']."</th>\n";
echo "<th>".$text['label-phone_tools']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-phone_description']."</th>\n";
if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_phones);
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
$x = 0;
foreach ($contact_phones as $row) {
if (permission_exists('contact_phone_edit')) {
$list_row_url = "contact_phone_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_phone_uuid']);
}
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='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";
}
echo " <td>".($row['phone_label'] == strtolower($row['phone_label']) ? ucwords($row['phone_label']) : $row['phone_label'])." ".($row['phone_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td class='no-link'>\n";
echo button::create(['type'=>'button','class'=>'link','label'=>escape(format_phone($row['phone_number'])),'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
echo " </td>\n";
echo " <td class='no-wrap'>\n";
if ($row['phone_type_voice']) { $phone_types[] = "<i class='fas fa-phone fa-fw' style='margin-right: 3px;' title=\"".$text['label-voice']."\"></i>"; }
if ($row['phone_type_fax']) { $phone_types[] = "<i class='fas fa-fax fa-fw' style='margin-right: 3px;' title=\"".$text['label-fax']."\"></i>"; }
if ($row['phone_type_video']) { $phone_types[] = "<i class='fas fa-video fa-fw' style='margin-right: 3px;' title=\"".$text['label-video']."\"></i>"; }
if ($row['phone_type_text']) { $phone_types[] = "<i class='fas fa-sms fa-fw' style='margin-right: 3px;' title=\"".$text['label-text']."\"></i>"; }
if (is_array($phone_types)) {
echo " ".implode(" ", $phone_types)."\n";
}
unset($phone_types);
echo " </td>\n";
echo " <td class='no-link no-wrap'>\n";
echo " <a href='../xml_cdr/xml_cdr.php?caller_id_number=".urlencode($row['phone_number'])."'>".$text['button-cdr']."</a>";
if ($row['phone_type_voice']) {
echo "&nbsp;<span class='hide-sm-dn'>\n";
echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-phone_call'],'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
echo "</span>";
}
echo " </td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['phone_description'])."&nbsp;</td>\n";
if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_phones);
}
echo "</table>\n";
echo "<br />\n";
}
echo "</table>\n";
echo "<br />\n";
?>

View File

@ -63,65 +63,60 @@
$contact_relations = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th>".$text['label-contact_relation_label']."</th>\n";
echo "<th>".$text['label-contact_relation_organization']."</th>\n";
echo "<th>".$text['label-contact_relation_name']."</th>\n";
if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
$x = 0;
foreach ($contact_relations as $row) {
if (permission_exists('contact_relation_edit')) {
$list_row_url = "contact_relation_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_relation_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//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 style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_relations[$x][uuid]' value='".escape($row['contact_relation_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".escape($row['relation_label'])."&nbsp;</td>\n";
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a>&nbsp;</td>\n";
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).escape($row['contact_name_family'])."</a>&nbsp;</td>\n";
echo "<th>".$text['label-contact_relation_label']."</th>\n";
echo "<th>".$text['label-contact_relation_organization']."</th>\n";
echo "<th>".$text['label-contact_relation_name']."</th>\n";
if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_relations);
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
$x = 0;
foreach ($contact_relations as $row) {
if (permission_exists('contact_relation_edit')) {
$list_row_url = "contact_relation_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_relation_uuid']);
}
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=\"edit_delete_action('relations');\">\n";
echo " <input type='hidden' name='contact_relations[$x][uuid]' value='".escape($row['contact_relation_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>".escape($row['relation_label'])."&nbsp;</td>\n";
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a>&nbsp;</td>\n";
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).escape($row['contact_name_family'])."</a>&nbsp;</td>\n";
if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_relations);
}
echo "</table>";
echo "<br />\n";
}
echo "</table>";
echo "<br />\n";
?>

View File

@ -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,84 +53,79 @@
$contact_settings = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-15'>".$text['label-contact_setting_category']."</th>";
echo "<th>".$text['label-contact_setting_subcategory']."</th>";
echo "<th>".$text['label-contact_setting_type']."</th>";
echo "<th>".$text['label-contact_setting_value']."</th>";
echo "<th class='center'>".$text['label-enabled']."</th>";
echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
$x = 0;
foreach ($contact_settings as $row) {
if (permission_exists('contact_setting_edit')) {
$list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//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 style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_settings[$x][uuid]' value='".escape($row['contact_setting_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".escape($row['contact_setting_category'])."&nbsp;</td>\n";
echo " <td><a href='".$list_row_url."'>".escape($row['contact_setting_subcategory'])."</a></td>\n";
echo " <td>".escape($row['contact_setting_name'])."&nbsp;</td>\n";
echo " <td>\n";
$category = escape($row['contact_setting_category']);
$subcategory = escape($row['contact_setting_subcategory']);
$name = escape($row['contact_setting_name']);
if ($category == "callingcard" && $subcategory == "username" && $name == "var" ) {
echo " ********\n";
}
else if ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
echo " ********\n";
}
else {
echo escape($row['contact_setting_value']);
}
echo " </td>\n";
echo " <td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]."&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".$row['contact_setting_description']."&nbsp;</td>\n";
echo "<th class='pct-15'>".$text['label-contact_setting_category']."</th>";
echo "<th>".$text['label-contact_setting_subcategory']."</th>";
echo "<th>".$text['label-contact_setting_type']."</th>";
echo "<th>".$text['label-contact_setting_value']."</th>";
echo "<th class='center'>".$text['label-enabled']."</th>";
echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_settings);
if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
$x = 0;
foreach ($contact_settings as $row) {
if (permission_exists('contact_setting_edit')) {
$list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']);
}
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=\"edit_delete_action('settings');\">\n";
echo " <input type='hidden' name='contact_settings[$x][uuid]' value='".escape($row['contact_setting_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>".escape($row['contact_setting_category'])."&nbsp;</td>\n";
echo " <td><a href='".$list_row_url."'>".escape($row['contact_setting_subcategory'])."</a></td>\n";
echo " <td>".escape($row['contact_setting_name'])."&nbsp;</td>\n";
echo " <td>\n";
$category = escape($row['contact_setting_category']);
$subcategory = escape($row['contact_setting_subcategory']);
$name = escape($row['contact_setting_name']);
if ($category == "callingcard" && $subcategory == "username" && $name == "var" ) {
echo " ********\n";
}
else if ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
echo " ********\n";
}
else {
echo escape($row['contact_setting_value']);
}
echo " </td>\n";
echo " <td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]."&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".$row['contact_setting_description']."&nbsp;</td>\n";
if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_settings);
}
echo "</table>";
echo "<br />\n";
}
echo "</table>";
echo "<br />\n";
?>

View File

@ -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,77 +56,72 @@
$contact_times = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-20'>".$text['label-time_user']."</th>\n";
echo "<th class='pct-20'>".$text['label-time_start']."</th>\n";
echo "<th class='pct-20'>".$text['label-time_duration']."</th>\n";
echo "<th class='pct-40 hide-md-dn'>".$text['label-time_description']."</th>\n";
if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_times) && @sizeof($contact_times) != 0) {
$x = 0;
foreach ($contact_times as $row) {
if ($row["time_start"] != '' && $row['time_stop'] != '') {
$time_start = strtotime($row["time_start"]);
$time_stop = strtotime($row['time_stop']);
$time = gmdate("H:i:s", ($time_stop - $time_start));
}
else {
unset($time);
}
$tmp = explode(' ', $row['time_start']);
$time_start = $tmp[0];
if (permission_exists('contact_time_edit')) {
$list_row_url = "contact_time_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_time_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//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 style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_times[$x][uuid]' value='".escape($row['contact_time_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td><span ".($row['user_domain_uuid'] != $domain_uuid ? "title='".$_SESSION['domains'][escape($row['user_domain_uuid'])]['domain_name']."' style='cursor: help;'" : null).">".escape($row["username"])."</span>&nbsp;</td>\n";
echo " <td>".$time_start."&nbsp;</td>\n";
echo " <td>".$time."&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['time_description'])."&nbsp;</td>\n";
echo "<th class='pct-20'>".$text['label-time_user']."</th>\n";
echo "<th class='pct-20'>".$text['label-time_start']."</th>\n";
echo "<th class='pct-20'>".$text['label-time_duration']."</th>\n";
echo "<th class='pct-40 hide-md-dn'>".$text['label-time_description']."</th>\n";
if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_times);
if (is_array($contact_times) && @sizeof($contact_times) != 0) {
$x = 0;
foreach ($contact_times as $row) {
if ($row["time_start"] != '' && $row['time_stop'] != '') {
$time_start = strtotime($row["time_start"]);
$time_stop = strtotime($row['time_stop']);
$time = gmdate("H:i:s", ($time_stop - $time_start));
}
else {
unset($time);
}
$tmp = explode(' ', $row['time_start']);
$time_start = $tmp[0];
if (permission_exists('contact_time_edit')) {
$list_row_url = "contact_time_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_time_uuid']);
}
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=\"edit_delete_action('times');\">\n";
echo " <input type='hidden' name='contact_times[$x][uuid]' value='".escape($row['contact_time_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td><span ".($row['user_domain_uuid'] != $domain_uuid ? "title='".$_SESSION['domains'][escape($row['user_domain_uuid'])]['domain_name']."' style='cursor: help;'" : null).">".escape($row["username"])."</span>&nbsp;</td>\n";
echo " <td>".$time_start."&nbsp;</td>\n";
echo " <td>".$time."&nbsp;</td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['time_description'])."&nbsp;</td>\n";
if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
unset($contact_times);
}
echo "</table>\n";
echo "<br />\n";
}
echo "</table>\n";
echo "<br />\n";
?>

View File

@ -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,65 +54,60 @@
$contact_urls = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//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";
echo "<table class='list'>\n";
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 " </th>\n";
}
echo "<th class='pct-15'>".$text['label-url_label']."</th>\n";
echo "<th>".$text['label-url_address']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-url_description']."</th>\n";
if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
//show if exists
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
$x = 0;
foreach ($contact_urls as $row) {
if (permission_exists('contact_url_edit')) {
$list_row_url = "contact_url_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_url_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
//show the content
echo "<div class='action_bar sub shrink'>\n";
echo " <div class='heading'><b>".$text['label-urls']."</b></div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\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='hidden' name='contact_urls[$x][uuid]' value='".escape($row['contact_url_uuid'])."' />\n";
echo " </td>\n";
echo " <th class='checkbox'>\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 " <td>".escape($row['url_label'])." ".($row['url_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td class='no-link overflow no-wrap'><a href='".escape($row['url_address'])."' target='_blank'>".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."</a></td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['url_description'])."&nbsp;</td>\n";
echo "<th class='pct-15'>".$text['label-url_label']."</th>\n";
echo "<th>".$text['label-url_address']."</th>\n";
echo "<th class='hide-md-dn'>".$text['label-url_description']."</th>\n";
if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_urls);
echo "</table>\n";
echo "<br />\n";
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
$x = 0;
foreach ($contact_urls as $row) {
if (permission_exists('contact_url_edit')) {
$list_row_url = "contact_url_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_url_uuid']);
}
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=\"edit_delete_action('urls');\">\n";
echo " <input type='hidden' name='contact_urls[$x][uuid]' value='".escape($row['contact_url_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>".escape($row['url_label'])." ".($row['url_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
echo " <td class='no-link overflow no-wrap'><a href='".escape($row['url_address'])."' target='_blank'>".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."</a></td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['url_description'])."&nbsp;</td>\n";
if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
}
unset($contact_urls);
echo "</table>\n";
echo "<br />\n";
}
?>

View File

@ -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