Contacts - Edit: List view, button and bulk action updates, modal integration.

This commit is contained in:
Nate
2020-01-23 21:24:10 -07:00
parent 70e4acf668
commit 9995bc4361
25 changed files with 1294 additions and 946 deletions

View File

@@ -64,6 +64,27 @@ $text['title-contacts']['ru-ru'] = "Контакты";
$text['title-contacts']['sv-se'] = "Kontakter";
$text['title-contacts']['uk-ua'] = "Контакти";
$text['title-contact_properties']['en-us'] = "Contact Properties";
$text['title-contact_properties']['ar-eg'] = "Contact Properties";
$text['title-contact_properties']['de-at'] = "Contact Properties";
$text['title-contact_properties']['de-ch'] = "Contact Properties";
$text['title-contact_properties']['de-de'] = "Contact Properties";
$text['title-contact_properties']['el-gr'] = "Contact Properties";
$text['title-contact_properties']['es-cl'] = "Contact Properties";
$text['title-contact_properties']['es-mx'] = "Contact Properties";
$text['title-contact_properties']['fr-ca'] = "Contact Properties";
$text['title-contact_properties']['fr-fr'] = "Contact Properties";
$text['title-contact_properties']['he-il'] = "Contact Properties";
$text['title-contact_properties']['it-it'] = "Contact Properties";
$text['title-contact_properties']['nl-nl'] = "Contact Properties";
$text['title-contact_properties']['pl-pl'] = "Contact Properties";
$text['title-contact_properties']['pt-br'] = "Contact Properties";
$text['title-contact_properties']['pt-pt'] = "Contact Properties";
$text['title-contact_properties']['ro-ro'] = "Contact Properties";
$text['title-contact_properties']['ru-ru'] = "Contact Properties";
$text['title-contact_properties']['sv-se'] = "Contact Properties";
$text['title-contact_properties']['uk-ua'] = "Contact Properties";
$text['title-contact_email-edit']['en-us'] = "Contact Email Edit";
$text['title-contact_email-edit']['ar-eg'] = "";
$text['title-contact_email-edit']['de-at'] = "Email des Kontakts bearbeiten"; //copied from de-de
@@ -4432,7 +4453,7 @@ $text['description-import_delimiter']['ru-ru'] = "Выберите раздел
$text['description-import_delimiter']['sv-se'] = "Välj avgränsare (comma or pipe). ";
$text['description-import_delimiter']['uk-ua'] = "";
$text['description-users']['en-us'] = "Select the users that are allowed to view this contact.";
$text['description-users']['en-us'] = "Users allowed to view this contact.";
$text['description-users']['ar-eg'] = "";
$text['description-users']['de-at'] = "Weisen Sie diesem Konferenzraum weitere Administratoren zu. "; //copied from de-de
$text['description-users']['de-ch'] = "Weisen Sie diesem Konferenzraum weitere Administratoren zu. "; //copied from de-de
@@ -4453,7 +4474,7 @@ $text['description-users']['ru-ru'] = "Выберите пользователе
$text['description-users']['sv-se'] = "Lägg till ytterligare användare som administratörer för detta konferensrum.";
$text['description-users']['uk-ua'] = "Зв'язати додаткових користувачів як адміністраторів цього конференц-залу.";
$text['description-groups']['en-us'] = "Select the groups that are allowed to view this contact.";
$text['description-groups']['en-us'] = "Groups allowed to view this contact.";
$text['description-groups']['ar-eg'] = "";
$text['description-groups']['de-at'] = "Legen Sie die Gruppen fest, für die dieser Kontakt sichtbar ist."; //copied from de-de
$text['description-groups']['de-ch'] = "Legen Sie die Gruppen fest, für die dieser Kontakt sichtbar ist."; //copied from de-de
@@ -5944,4 +5965,181 @@ $text['button-user']['ru-ru'] = "Пользователь";
$text['button-user']['sv-se'] = "Användare";
$text['button-user']['uk-ua'] = "Користувач";
?>
$text['label-click_to_call']['en-us'] = "Click to Call";
$text['label-click_to_call']['ar-eg'] = "";
$text['label-click_to_call']['de-at'] = "Click to Call"; //copied from de-de
$text['label-click_to_call']['de-ch'] = "Click to Call"; //copied from de-de
$text['label-click_to_call']['de-de'] = "Click to Call";
$text['label-click_to_call']['es-cl'] = "Pulse para Llamar";
$text['label-click_to_call']['es-mx'] = "Pulse para Llamar"; //copied from es-cl
$text['label-click_to_call']['fr-ca'] = "Cliquez pour appeler"; //copied from fr-fr
$text['label-click_to_call']['fr-fr'] = "Cliquez pour appeler";
$text['label-click_to_call']['he-il'] = "";
$text['label-click_to_call']['it-it'] = "Clicca per Chiamare";
$text['label-click_to_call']['nl-nl'] = "Klik voor oproep";
$text['label-click_to_call']['pl-pl'] = "";
$text['label-click_to_call']['pt-br'] = "Clique para chamar"; //copied from pt-pt
$text['label-click_to_call']['pt-pt'] = "Clique para chamar";
$text['label-click_to_call']['ro-ro'] = "";
$text['label-click_to_call']['ru-ru'] = "Вызов по клику";
$text['label-click_to_call']['sv-se'] = "Klicka för att ringa";
$text['label-click_to_call']['uk-ua'] = "";
$text['label-setting']['en-us'] = "Setting";
$text['label-setting']['ar-eg'] = "";
$text['label-setting']['de-at'] = "Einstellungen"; //copied from de-de
$text['label-setting']['de-ch'] = "Einstellungen"; //copied from de-de
$text['label-setting']['de-de'] = "Einstellungen";
$text['label-setting']['es-cl'] = "Ajustes";
$text['label-setting']['es-mx'] = "Ajustes"; //copied from es-cl
$text['label-setting']['fr-ca'] = "Paramètre"; //copied from fr-fr
$text['label-setting']['fr-fr'] = "Paramètre";
$text['label-setting']['he-il'] = "הגדרות";
$text['label-setting']['it-it'] = "Parametri";
$text['label-setting']['nl-nl'] = "";
$text['label-setting']['pl-pl'] = "Ustawienia";
$text['label-setting']['pt-br'] = "Definiçõe"; //copied from pt-pt
$text['label-setting']['pt-pt'] = "Definiçõe";
$text['label-setting']['ro-ro'] = "";
$text['label-setting']['ru-ru'] = "Настройки";
$text['label-setting']['sv-se'] = "Inställningar";
$text['label-setting']['uk-ua'] = "Налаштування";
$text['label-email']['en-us'] = "Email";
$text['label-email']['ar-eg'] = "البريد الإليكتروني";
$text['label-email']['de-at'] = "Email"; //copied from de-de
$text['label-email']['de-ch'] = "Email"; //copied from de-de
$text['label-email']['de-de'] = "Email";
$text['label-email']['es-cl'] = "Email";
$text['label-email']['es-mx'] = "Email"; //copied from es-cl
$text['label-email']['fr-ca'] = "Courriel"; //copied from fr-fr
$text['label-email']['fr-fr'] = "Courriel";
$text['label-email']['he-il'] = "אימייל";
$text['label-email']['it-it'] = "Email";
$text['label-email']['nl-nl'] = "E-mail";
$text['label-email']['pl-pl'] = "Email";
$text['label-email']['pt-br'] = "Email"; //copied from pt-pt
$text['label-email']['pt-pt'] = "Email";
$text['label-email']['ro-ro'] = "";
$text['label-email']['ru-ru'] = "Электронная Почта";
$text['label-email']['sv-se'] = "E-post";
$text['label-email']['uk-ua'] = "Електронна пошта";
$text['label-url']['en-us'] = "URL";
$text['label-url']['ar-eg'] = "";
$text['label-url']['de-at'] = "URL"; //copied from de-de
$text['label-url']['de-ch'] = "URL"; //copied from de-de
$text['label-url']['de-de'] = "URL";
$text['label-url']['es-cl'] = "URL";
$text['label-url']['es-mx'] = "URL"; //copied from es-cl
$text['label-url']['fr-ca'] = "URL"; //copied from fr-fr
$text['label-url']['fr-fr'] = "URL";
$text['label-url']['he-il'] = "";
$text['label-url']['it-it'] = "URL";
$text['label-url']['nl-nl'] = "URL";
$text['label-url']['pl-pl'] = "URL";
$text['label-url']['pt-br'] = "URL"; //copied from pt-pt
$text['label-url']['pt-pt'] = "URL";
$text['label-url']['ro-ro'] = "";
$text['label-url']['ru-ru'] = "URL-адрес";
$text['label-url']['sv-se'] = "URL";
$text['label-url']['uk-ua'] = "URL";
$text['label-image']['en-us'] = "Image";
$text['label-image']['ar-eg'] = "صورة";
$text['label-image']['de-at'] = "Bild"; //copied from de-de
$text['label-image']['de-ch'] = "Bild"; //copied from de-de
$text['label-image']['de-de'] = "Bild";
$text['label-image']['es-cl'] = "Imagen";
$text['label-image']['es-mx'] = "Imagen"; //copied from es-cl
$text['label-image']['fr-ca'] = "image"; //copied from fr-fr
$text['label-image']['fr-fr'] = "image";
$text['label-image']['he-il'] = "תמונה";
$text['label-image']['it-it'] = "Immagine";
$text['label-image']['nl-nl'] = "";
$text['label-image']['pl-pl'] = "Obraz";
$text['label-image']['pt-br'] = "Imagem"; //copied from pt-pt
$text['label-image']['pt-pt'] = "Imagem";
$text['label-image']['ro-ro'] = "Imagine";
$text['label-image']['ru-ru'] = "Изображение";
$text['label-image']['sv-se'] = "Bild";
$text['label-image']['uk-ua'] = "зображення";
$text['label-file']['en-us'] = "File";
$text['label-file']['ar-eg'] = "";
$text['label-file']['de-at'] = "Dateien"; //copied from de-de
$text['label-file']['de-ch'] = "Dateien"; //copied from de-de
$text['label-file']['de-de'] = "Dateien";
$text['label-file']['es-cl'] = "Archivo";
$text['label-file']['es-mx'] = "Archivo"; //copied from es-cl
$text['label-file']['fr-ca'] = "Fichier"; //copied from fr-fr
$text['label-file']['fr-fr'] = "Fichier";
$text['label-file']['he-il'] = "";
$text['label-file']['it-it'] = "File";
$text['label-file']['nl-nl'] = "Bestanden";
$text['label-file']['pl-pl'] = "";
$text['label-file']['pt-br'] = "Arquivo"; //copied from pt-pt
$text['label-file']['pt-pt'] = "Ficheiro";
$text['label-file']['ro-ro'] = "";
$text['label-properties']['en-us'] = "Properties";
$text['label-properties']['ar-eg'] = "Properties";
$text['label-properties']['de-at'] = "Properties";
$text['label-properties']['de-ch'] = "Properties";
$text['label-properties']['de-de'] = "Properties";
$text['label-properties']['es-cl'] = "Properties";
$text['label-properties']['es-mx'] = "Properties";
$text['label-properties']['fr-ca'] = "Properties";
$text['label-properties']['fr-fr'] = "Properties";
$text['label-properties']['he-il'] = "Properties";
$text['label-properties']['it-it'] = "Properties";
$text['label-properties']['nl-nl'] = "Properties";
$text['label-properties']['pl-pl'] = "Properties";
$text['label-properties']['pt-br'] = "Properties";
$text['label-properties']['pt-pt'] = "Properties";
$text['label-properties']['ro-ro'] = "Properties";
$text['label-contact']['en-us'] = "Contact";
$text['label-contact']['ar-eg'] = "Contact";
$text['label-contact']['de-at'] = "Kontakt"; //copied from de-de
$text['label-contact']['de-ch'] = "Kontakt"; //copied from de-de
$text['label-contact']['de-de'] = "Kontakt";
$text['label-contact']['el-gr'] = "Επαφή";
$text['label-contact']['es-cl'] = "Contacto";
$text['label-contact']['es-mx'] = "Contacto"; //copied from es-cl
$text['label-contact']['fr-ca'] = "Contact"; //copied from fr-fr
$text['label-contact']['fr-fr'] = "Contact";
$text['label-contact']['he-il'] = "איש קשר";
$text['label-contact']['it-it'] = "Contatto";
$text['label-contact']['nl-nl'] = "Kontact";
$text['label-contact']['pl-pl'] = "Kontakt";
$text['label-contact']['pt-br'] = "Contato";
$text['label-contact']['pt-pt'] = "Contacto";
$text['label-contact']['ro-ro'] = "Contact";
$text['label-contact']['ru-ru'] = "Контакт";
$text['label-contact']['sv-se'] = "Kontakt";
$text['label-contact']['uk-ua'] = "Контакт";
$text['message-delete_selection']['en-us'] = "What do you wish to delete?";
$text['message-delete_selection']['ar-eg'] = "What do you wish to delete?";
$text['message-delete_selection']['de-at'] = "What do you wish to delete?";
$text['message-delete_selection']['de-ch'] = "What do you wish to delete?";
$text['message-delete_selection']['de-de'] = "What do you wish to delete?";
$text['message-delete_selection']['el-gr'] = "What do you wish to delete?";
$text['message-delete_selection']['es-cl'] = "What do you wish to delete?";
$text['message-delete_selection']['es-mx'] = "What do you wish to delete?";
$text['message-delete_selection']['fr-ca'] = "What do you wish to delete?";
$text['message-delete_selection']['fr-fr'] = "What do you wish to delete?";
$text['message-delete_selection']['he-il'] = "What do you wish to delete?";
$text['message-delete_selection']['it-it'] = "What do you wish to delete?";
$text['message-delete_selection']['nl-nl'] = "What do you wish to delete?";
$text['message-delete_selection']['pl-pl'] = "What do you wish to delete?";
$text['message-delete_selection']['pt-br'] = "What do you wish to delete?";
$text['message-delete_selection']['pt-pt'] = "What do you wish to delete?";
$text['message-delete_selection']['ro-ro'] = "What do you wish to delete?";
$text['message-delete_selection']['ru-ru'] = "What do you wish to delete?";
$text['message-delete_selection']['sv-se'] = "What do you wish to delete?";
$text['message-delete_selection']['uk-ua'] = "What do you wish to delete?";
$text['message-delete_selection']['tr-tr'] = "What do you wish to delete?";
?>

View File

@@ -24,16 +24,20 @@
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_address_edit') || permission_exists('contact_address_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('contact_address_edit') || permission_exists('contact_address_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
@@ -213,13 +217,13 @@ else {
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact_addresses-edit'];
}
else if ($action == "add") {
$document['title'] = $text['title-contact_addresses-add'];
}
require_once "resources/header.php";
//javascript to toggle input/select boxes
echo "<script type='text/javascript'>";
@@ -233,23 +237,23 @@ else {
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'><b>";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo $text['header-contact_addresses-edit'];
echo "<b>".$text['header-contact_addresses-edit']."</b>";
}
else if ($action == "add") {
echo $text['header-contact_addresses-add'];
echo "<b>".$text['header-contact_addresses-add']."</b>";
}
echo "</b></td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=$contact_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if ($action == "update") {
echo $text['description-contact_addresses-edit'];
@@ -260,6 +264,7 @@ else {
echo "<br /><br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-address_label']."\n";
@@ -436,22 +441,18 @@ else {
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_address_uuid' value='".escape($contact_address_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_address_uuid' value='".escape($contact_address_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -43,15 +43,7 @@
$contact_uuid = $_GET['id'];
}
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-addresses']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the contact list
//get the address list
$sql = "select * from v_contact_addresses ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
@@ -59,67 +51,76 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$contact_addresses = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
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 "<tr>\n";
echo "<th>".$text['label-address_label']."</th>\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 style='text-align: center;'>".$text['label-address_country']."</th>\n";
echo "<th>&nbsp;</th>\n";
echo "<th>".$text['label-address_description']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_address_add')) {
echo "<a href='contact_address_edit.php?contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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 "</td>\n";
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
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')) {
$tr_link = "href='contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_address_uuid'])."'";
}
echo "<tr ".$tr_link." ".((escape($row['address_primary'])) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['address_label'])."&nbsp;</td>\n";
$address='';
if ($row['address_extended'] != '') {
$address= escape($row['address_street'])." ".escape($row['address_extended']);
}
else {
$address= escape($row['address_street']);
}
echo " <td valign='top' class='".$row_style[$c]."' style='width: 25%; max-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;'>".$address."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' style='white-space: nowrap;'>".escape($row['address_locality']).(($row['address_locality'] != '' && $row['address_region'] != '') ? ", " : null).escape($row['address_region'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".escape($row['address_country'])."&nbsp;</td>\n";
echo " <td valign='middle' class='".$row_style[$c]." tr_link_void' style='padding: 0px;'>\n";
echo " <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>\n";
echo " </td>\n";
echo " <td valign='top' class='row_stylebg'>".escape($row['address_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_address_edit')) {
echo "<a href='contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".escape($row['contact_address_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
$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 "<a href='contact_address_delete.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".escape($row['contact_address_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
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 " <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 " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
$x++;
}
unset($result, $row);
unset($contact_addresses);
}
echo "</table>";
echo "</table>\n";
echo "<br />\n";
?>
?>

View File

@@ -143,45 +143,40 @@
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact_attachment-edit'];
}
else if ($action == "add") {
$document['title'] = $text['title-contact_attachment-add'];
}
require_once "resources/header.php";
//show the content
echo "<form method='post' name='frm' enctype='multipart/form-data' action=''>\n";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
echo "<form method='post' name='frm' enctype='multipart/form-data'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo "<input type='hidden' name='contact_attachment_uuid' value='".escape($contact_attachment_uuid)."'>\n";
}
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'><b>";
if ($action == "update") {
echo $text['header-contact_attachment-edit'];
echo "<b>".$text['header-contact_attachment-edit']."</b>";
}
else if ($action == "add") {
echo $text['header-contact_attachment-add'];
echo "<b>".$text['header-contact_attachment-add']."</b>";
}
echo "</b></td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=$contact_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-attachment']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
$attachment_type = strtolower(pathinfo($attachment_filename, PATHINFO_EXTENSION));
if ($action == 'update') {
echo "<input type='hidden' name='attachment_filename' value=\"".escape($attachment_filename)."\">\n";
@@ -232,15 +227,15 @@
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <br>\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_attachment_uuid' value='".escape($contact_attachment_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer

View File

@@ -30,8 +30,12 @@
require_once "resources/check_auth.php";
//check permissions
if (!permission_exists('contact_attachment_view')) {
echo "access denied"; exit;
if (permission_exists('contact_attachment_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the contact attachment list
@@ -45,14 +49,8 @@
$contact_attachments = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//styles
//styles and attachment layer
echo "<style>\n";
echo " #contact_attachment_layer {\n";
echo " z-index: 999999;\n";
echo " position: absolute;\n";
@@ -63,68 +61,90 @@
echo " text-align: center;\n";
echo " vertical-align: middle;\n";
echo " }\n";
echo "</style>\n";
//ticket attachment layer
echo "<div id='contact_attachment_layer' style='display: none;'></div>\n";
//show the content
echo "<b>".$text['label-attachments']."</b>\n";
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-attachment_filename']."</th>\n";
echo "<th>".$text['label-attachment_size']."</th>\n";
echo "<th>".$text['label-attachment_description']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_attachment_add')) {
echo "<a href='contact_attachment_edit.php?contact_uuid=".escape($_GET['id'])."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
echo "</td>\n";
echo "</tr>\n";
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
foreach($contact_attachments as $row) {
if (permission_exists('contact_attachment_edit')) {
$tr_link = "href='contact_attachment_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_attachment_uuid'])."'";
}
echo "<tr ".$tr_link." ".((escape($row['attachment_primary'])) ? "style='font-weight: bold;'" : null).">\n";
$attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION));
if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') {
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='cursor: pointer;' onclick=\"display_attachment('".escape($row['contact_attachment_uuid'])."');\">";
}
else {
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='cursor: pointer;' onclick=\"window.location='contact_attachment.php?id=".escape($row['contact_attachment_uuid'])."&action=download';\">";
}
echo " <a>".escape($row['attachment_filename'])."</a>\n";
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".strtoupper(byte_convert($row['attachment_size']))."</td>\n";
echo " <td valign='top' class='row_stylebg'>".escape($row['attachment_description'])."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_attachment_edit')) {
echo "<a href='contact_attachment_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_attachment_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('contact_attachment_delete')) {
echo "<a href='contact_attachment_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_attachment_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = $c ?: 1;
}
}
unset($contact_attachments, $row);
echo "</table>";
//javascript
//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";
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=\"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 " <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

@@ -42,6 +42,50 @@
$language = new text;
$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));
break;
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');
break;
}
exit;
}
//action add or update
if (is_uuid($_REQUEST["id"])) {
$action = "update";
@@ -122,7 +166,6 @@
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
message::add($text['message-add']);
$location = "contact_edit.php?id=".urlencode($contact_uuid);
}
//update the contact
@@ -130,7 +173,6 @@
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
message::add($text['message-update']);
$location = "contact_edit.php?id=".urlencode($contact_uuid);
}
//create array
@@ -194,13 +236,8 @@
$p->delete('contact_group_add', 'temp');
}
//handle redirect
if ($_POST['submit'] == $text['button-add']) {
$location = "contact_edit.php?id=".urlencode($contact_uuid);
}
//redirect the browser
header("Location: ".$location);
header("Location: contact_edit.php?id=".urlencode($contact_uuid));
exit;
}
@@ -245,7 +282,7 @@
//determine if contact assigned to a user
if (is_array($users) && sizeof($users) != 0) {
foreach($users as $user) {
foreach ($users as $user) {
if ($user['contact_uuid'] == $contact_uuid) {
$contact_user_uuid = $user['user_uuid'];
break;
@@ -271,13 +308,13 @@
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact-edit'];
}
else if ($action == "add") {
$document['title'] = $text['title-contact-add'];
}
require_once "resources/header.php";
//determine qr branding
if ($_SESSION['theme']['qr_brand_type']['text'] == 'image' && $_SESSION['theme']['qr_brand_image']['text'] != '') {
@@ -346,17 +383,17 @@
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td valign='top' align='left' width='30%' nowrap='nowrap'><b>";
switch ($action) {
case "add": echo $text['header-contact-add']; break;
case "update": echo $text['header-contact-edit']; break;
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "add") {
echo "<b>".$text['header-contact-add']."</b>";
}
echo "</b></td>\n";
echo "<td valign='top' width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contacts.php'\" value='".$text['button-back']."'>\n";
else if ($action == "update") {
echo "<b>".$text['header-contact-edit']."</b>";
}
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-sm-dn','style'=>'margin-right: 15px;','link'=>'contacts.php']);
if ($action == "update") {
if (permission_exists('contact_time_add')) {
//detect timer state (and start time)
@@ -373,46 +410,96 @@
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$time_start = $database->select($sql, $parameters, 'column');
$btn_mod = $time_start != '' ? "style='background-color: #3693df; background-image: none;'" : null;
$btn_style = $time_start ? 'color: #fff; background-color: #3693df; background-image: none;' : null;
unset($sql, $parameters);
echo " <input type='button' class='btn' ".$btn_mod." alt='".$text['button-timer']."' ".($time_start != '' ? "title='".escape($time_start)."'" : null)." onclick=\"window.open('contact_timer.php?domain_uuid=".urlencode($domain_uuid)."&contact_uuid=".urlencode($contact_uuid)."','contact_time_".escape($contact_uuid)."','width=300, height=375, top=30, left='+(screen.width - 350)+', menubar=no, scrollbars=no, status=no, toolbar=no, resizable=no');\" value='".$text['button-timer']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-timer'],'icon'=>'clock','style'=>$btn_style,'title'=>$time_start,'collapse'=>'hide-sm-dn','onclick'=>"window.open('contact_timer.php?domain_uuid=".urlencode($domain_uuid)."&contact_uuid=".urlencode($contact_uuid)."','contact_time_".escape($contact_uuid)."','width=300, height=375, top=30, left='+(screen.width - 350)+', menubar=no, scrollbars=no, status=no, toolbar=no, resizable=no');"]);
}
echo " <input type='button' class='btn' name='' alt='".$text['button-qr_code']."' onclick=\"$('#qr_code_container').fadeIn(400);\" value='".$text['button-qr_code']."'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-vcard']."' onclick=\"window.location='contacts_vcard.php?id=".urlencode($contact_uuid)."&type=download'\" value='".$text['button-vcard']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','collapse'=>'hide-sm-dn','onclick'=>"$('#qr_code_container').fadeIn(400);"]);
echo button::create(['type'=>'button','label'=>$text['button-vcard'],'icon'=>'address-card','collapse'=>'hide-sm-dn','link'=>'contacts_vcard.php?id='.urlencode($contact_uuid).'&type=download']);
}
if ($action == "update" && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/invoices')) {
echo " <input type='button' class='btn' name='' alt='".$text['button-invoices']."' onclick=\"window.location='".PROJECT_PATH."/app/invoices/invoices.php?id=".urlencode($contact_uuid)."'\" value='".$text['button-invoices']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-invoices'],'icon'=>'file-invoice-dollar','collapse'=>'hide-sm-dn','link'=>'../invoices/invoices.php?id='.urlencode($contact_uuid)]);
}
if ($action == "update" && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/certificates')) {
echo " <input type='button' class='btn' name='' alt='".$text['button-certificate']."' onclick=\"window.location='".PROJECT_PATH."/app/certificates/index.php?name=".urlencode($contact_name_given." ".$contact_name_family)."'\" value='".$text['button-certificate']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-certificate'],'icon'=>'certificate','collapse'=>'hide-sm-dn','link'=>'../certificates/index.php?name='.urlencode($contact_name_given." ".$contact_name_family)]);
}
if ($action == "update" && permission_exists('user_edit') && is_uuid($contact_user_uuid)) {
echo " <input type='button' class='btn' name='' alt='".$text['button-user']."' onclick=\"window.location='".PROJECT_PATH."/core/users/user_edit.php?id=".urlencode($contact_user_uuid)."'\" value='".$text['button-user']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-user'],'icon'=>'user','collapse'=>'hide-sm-dn','link'=>'../../core/users/user_edit.php?id='.urlencode($contact_user_uuid)]);
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"left\" colspan='2'>\n";
switch ($action) {
case "add" : echo $text['description-contact-add']; break;
case "update" : echo $text['description-contact-edit']; break;
if (
$action == "update" && (
permission_exists('contact_phone_add') ||
permission_exists('contact_address_add') ||
permission_exists('contact_email_add') ||
permission_exists('contact_url_add') ||
permission_exists('contact_relation_add') ||
permission_exists('contact_note_add') ||
permission_exists('contact_time_add') ||
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 " <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"; }
if (permission_exists('contact_email_add')) { echo "<option value='email'>".$text['label-email']."</option>\n"; }
if (permission_exists('contact_url_add')) { echo "<option value='url'>".$text['label-url']."</option>\n"; }
if (permission_exists('contact_relation_add')) { echo "<option value='relation'>".$text['label-contact_relation_label']."</option>\n"; }
if (permission_exists('contact_note_add')) { echo "<option value='note'>".$text['label-contact_note']."</option>\n"; }
if (permission_exists('contact_time_add')) { echo "<option value='time'>".$text['label-time_time']."</option>\n"; }
if (permission_exists('contact_setting_add')) { echo "<option value='setting'>".$text['label-setting']."</option>\n"; }
if (permission_exists('contact_attachment_add')) { echo "<option value='attachment'>".$text['label-attachment']."</option>\n"; }
echo " </select>";
}
if (
$action == "update" && (
permission_exists('contact_phone_delete') ||
permission_exists('contact_deleteress_delete') ||
permission_exists('contact_email_delete') ||
permission_exists('contact_url_delete') ||
permission_exists('contact_relation_delete') ||
permission_exists('contact_note_delete') ||
permission_exists('contact_time_delete') ||
permission_exists('contact_setting_delete') ||
permission_exists('contact_attachment_delete')
)) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','link'=>'#modal-delete']);
echo modal::create([
'id'=>'modal-delete',
'title'=>$text['modal_title-confirmation'],
'message'=>$text['message-delete_selection'],
'actions'=>
button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>'times','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');"])
]);
}
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();"]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if ($action == "add") {
echo $text['description-contact-add']."\n";
}
else if ($action == "update") {
echo $text['description-contact-edit']."\n";
}
echo "<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
echo "<tr>\n";
echo "<td width='40%' valign='top' align='left' nowrap='nowrap'>\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";
echo " ".$text['label-contact_type']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
if (is_array($_SESSION["contact"]["type"])) {
sort($_SESSION["contact"]["type"]);
echo " <select class='formfld' name='contact_type'>\n";
@@ -438,8 +525,6 @@
echo " <option value='volunteer' ".(($contact_type == "volunteer") ? "selected='selected'" : null).">".$text['option-contact_type_volunteer']."</option>\n";
echo " </select>\n";
}
//echo "<br />\n";
//echo $text['description-contact_type']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -449,8 +534,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_organization' maxlength='255' value=\"".escape($contact_organization)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_organization']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -460,8 +543,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_name_prefix' maxlength='255' value=\"".escape($contact_name_prefix)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_name_prefix']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -471,8 +552,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_name_given' maxlength='255' value=\"".escape($contact_name_given)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_name_given']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -482,8 +561,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_name_middle' maxlength='255' value=\"".escape($contact_name_middle)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_name_middle']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -493,8 +570,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_name_family' maxlength='255' value=\"".escape($contact_name_family)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_name_family']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -504,8 +579,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_name_suffix' maxlength='255' value=\"".escape($contact_name_suffix)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_name_suffix']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -515,8 +588,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_nickname' maxlength='255' value=\"".escape($contact_nickname)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_nickname']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -537,8 +608,6 @@
else {
echo " <input class='formfld' type='text' name='contact_title' maxlength='255' value=\"".escape($contact_title)."\">\n";
}
//echo "<br />\n";
//echo $text['description-contact_title']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -559,8 +628,6 @@
else {
echo " <input class='formfld' type='text' name='contact_category' maxlength='255' value=\"".escape($contact_category)."\">\n";
}
//echo "<br />\n";
//echo $text['description-contact_category']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -581,8 +648,6 @@
else {
echo " <input class='formfld' type='text' name='contact_role' maxlength='255' value=\"".escape($contact_role)."\">\n";
}
//echo "<br />\n";
//echo $text['description-contact_role']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -592,8 +657,6 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_time_zone' maxlength='255' value=\"".escape($contact_time_zone)."\">\n";
//echo "<br />\n";
//echo $text['description-contact_time_zone']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -601,30 +664,31 @@
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-users']."</td>";
echo " <td class='vtable' align='left'>";
if ($action == "update") {
echo " <table border='0' style='width : 235px;'>\n";
foreach($contact_users as $field) {
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 " <tr>\n";
echo " <td class='vtable'>".escape($field['username'])."</td>\n";
echo " <td style='width: 25px;' align='right'>\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 " <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>\n";
echo " </tr>\n";
}
echo " </table>\n";
echo " <br />\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";
foreach($users as $field) {
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";
}
echo " </select>";
if ($action == "update") {
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
}
unset($users);
echo " <br>\n";
@@ -656,14 +720,14 @@
$database = new database;
$result = $database->select($sql, $parameters, 'all');
if (is_array($result) && @sizeof($result) != 0) {
echo " <table width='52%'>\n";
foreach($result as $field) {
echo " <table style='width: 100%;'>\n";
foreach ($result as $field) {
if (strlen($field['group_name']) > 0) {
echo "<tr>\n";
echo " <td class='vtable'>".escape($field['group_name'])."</td>\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 " <a href='contact_group_delete.php?id=".urlencode($field['contact_group_uuid'])."&contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."');\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
@@ -697,7 +761,7 @@
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) {
foreach ($result 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";
@@ -705,7 +769,7 @@
echo " </select>";
if ($action == "update") {
echo " <input type='submit' name='submit' class='btn' value=\"".$text['button-add']."\">\n";
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
}
echo "<br>";
}
@@ -723,50 +787,55 @@
echo " ".$text['label-contact_note']."\n";
echo " </td>\n";
echo " <td width='70%' class='vtable' align='left'>\n";
echo " <textarea class='formfld' style='width: 100%; height: 80px;' name='contact_note'>".$contact_note."</textarea>\n";
//echo "<br />\n";
//echo $text['description-contact_note']."\n";
echo " <textarea class='formfld' style='width: 100%; height: 160px;' name='contact_note'>".$contact_note."</textarea>\n";
echo " </td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
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 " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
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='60%' valign='top'>\n";
//echo " <img src='contacts_vcard.php?id=$contact_uuid&type=image' width='90%'><br /><br />\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"; }
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>";
echo "</td>\n";
}
echo "</tr>\n";
echo "</table>\n";
echo "<br><br>";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -209,23 +209,23 @@ if (is_uuid($_GET["contact_uuid"])) {
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'><b>";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo $text['header-contact_email-edit'];
echo "<b>".$text['header-contact_email-edit']."</b>";
}
else if ($action == "add") {
echo $text['header-contact_email-add'];
echo "<b>".$text['header-contact_email-add']."</b>";
}
echo "</b></td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".escape($contact_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if ($action == "update") {
echo $text['description-contact_email-edit'];
@@ -236,6 +236,7 @@ if (is_uuid($_GET["contact_uuid"])) {
echo "<br /><br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-email_label']."\n";
@@ -305,21 +306,18 @@ if (is_uuid($_GET["contact_uuid"])) {
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_email_uuid' value='".escape($contact_email_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_email_uuid' value='".escape($contact_email_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -38,65 +38,76 @@
exit;
}
//get the contact list
$sql = "select * from v_contact_emails ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$sql .= "order by email_primary desc, email_label asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$contact_emails = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-emails']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the contact list
$sql = "select * from v_contact_emails ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$sql .= "order by email_primary desc, email_label asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-email_label']."</th>\n";
echo "<th>".$text['label-email_address']."</th>\n";
echo "<th>".$text['label-email_description']."</th>\n";
echo "<td class='list_control_icons'>";
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 "<a href='contact_email_edit.php?contact_uuid=".escape($contact_uuid)."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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 "</td>\n";
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
$x = 0;
foreach ($contact_emails as $row) {
if (permission_exists('contact_email_edit')) {
$tr_link = "href='contact_email_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_email_uuid'])."'";
}
echo "<tr ".$tr_link." ".((escape($row['email_primary'])) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['email_label'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a>&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".escape($row['email_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_email_edit')) {
echo "<a href='contact_email_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_email_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
$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 "<a href='contact_email_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_email_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
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 " <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 " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
$x++;
}
}
unset($result, $row);
unset($contact_emails);
echo "</table>";
echo "<br />\n";
?>
?>

View File

@@ -38,86 +38,72 @@
exit;
}
//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";
//get the extension list
$sql = "select e.extension_uuid, e.extension, e.enabled, e.description ";
$sql .= "from v_extensions e, v_extension_users eu, v_users u ";
$sql .= "where e.extension_uuid = eu.extension_uuid ";
$sql .= "and u.user_uuid = eu.user_uuid ";
$sql .= "and e.domain_uuid = :domain_uuid ";
$sql .= "and u.contact_uuid = :contact_uuid ";
$sql .= "order by e.extension asc ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$contact_extensions = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-contact_extensions']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the extension list
$sql = "select e.extension_uuid, e.extension, e.enabled, e.description ";
$sql .= "from v_extensions e, v_extension_users eu, v_users u ";
$sql .= "where e.extension_uuid = eu.extension_uuid ";
$sql .= "and u.user_uuid = eu.user_uuid ";
$sql .= "and e.domain_uuid = :domain_uuid ";
$sql .= "and u.contact_uuid = :contact_uuid ";
$sql .= "order by e.extension asc ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th>".$text['label-enabled']."</th>\n";
echo "<th>".$text['label-description']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('extension_add')) {
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
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 "</td>\n";
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
$tr_link = (permission_exists('extension_edit')) ? "href='/app/extensions/extension_edit.php?id=".escape($row['extension_uuid'])."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
$x = 0;
foreach ($contact_extensions as $row) {
if (permission_exists('extension_edit')) {
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".escape($row['extension_uuid'])."'>".escape($row['extension'])."</a>";
$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 valign='top' class='".$row_style[$c]."'>".$text['label-'.escape($row['enabled'])]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('extension_edit')) {
echo "<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".escape($row['extension_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
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";
}
if (permission_exists('extension_delete')) {
echo "<a href='".PROJECT_PATH."/app/extensions/extension_delete.php?id=".escape($row['extension_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
$x++;
}
}
unset($result, $row);
unset($contact_extensions);
echo "</table>";
echo "<br />\n";
?>
?>

View File

@@ -55,7 +55,7 @@
}
//set the max php execution time
ini_set(max_execution_time,7200);
ini_set('max_execution_time',7200);
//get the http get values and set them as php variables
$action = check_str($_POST["action"]);

View File

@@ -17,12 +17,13 @@
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-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
@@ -173,58 +174,56 @@
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact_notes-edit'];
}
else if ($action == "add") {
$document['title'] = $text['title-contact_notes-add'];
}
require_once "resources/header.php";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'>";
if ($action == "add") {
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo "<b>".$text['header-contact_notes-edit']."</b>";
}
else if ($action == "add") {
echo "<b>".$text['header-contact_notes-add']."</b>";
}
if ($action == "update") {
echo "<b>".$text['header-contact_notes-edit']."</b>\n";
}
echo "</td>\n";
echo "<td width='70%' align='right'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".escape($contact_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr><td colspan='2'>&nbsp;</td></tr>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_note']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <textarea class='formfld' type='text' rows=\"20\" style='width: 100%' name='contact_note'>".$contact_note."</textarea>\n";
echo "<br />\n";
echo "\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <textarea class='formfld' name='contact_note' style='min-width: 100%; height: 400px;'>".$contact_note."</textarea>\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_note_uuid' value='".escape($contact_note_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_note_uuid' value='".escape($contact_note_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -43,14 +43,6 @@
$contact_uuid = $_GET['id'];
}
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-contact_notes']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the contact list
$sql = "select * from v_contact_notes ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -62,56 +54,70 @@
$contact_notes = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//set the row style array
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-note_content']."</th>\n";
echo "<th style='text-align: right;'>".$text['label-note_user']."</th>\n";
echo "<td class='list_control_icons'>";
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 "<a href='contact_note_edit.php?contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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)]);
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
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";
echo "<div id='contact_notes' style='width: 100%; overflow: auto; direction: rtl; text-align: right; margin-bottom: 23px;'>";
echo "<table class='tr_hover' style='width: 100%; direction: ltr; padding-left: 1px' border='0' cellpadding='0' cellspacing='0'>\n";
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
foreach($contact_notes as $row) {
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')) {
$tr_link = "href='contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid'])."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."' colspan='2'>";
echo " <div style='display: inline-block; float: right; margin: -5px -7px 5px 5px; padding: 3px 4px; font-size: 10px; background-color: #f0f2f6;'><span style='color: #000; font-weight: bold;'>".escape($row['last_mod_user'])."</span>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</div>";
echo $contact_note."&nbsp;";
echo " </td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_note_edit')) {
echo "<a href='contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
$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 "<a href='contact_note_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
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 " <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 " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
$x++;
}
}
unset($contact_notes, $row);
unset($contact_notes);
echo "</table>";
echo "</div>\n";
echo "<br />\n";
echo "<script>if (document.getElementById('contact_notes').offsetHeight > 200) { document.getElementById('contact_notes').style.height = 200; }</script>\n";
// echo "<script>if (document.getElementById('contact_notes').offsetHeight > 200) { document.getElementById('contact_notes').style.height = 200; }</script>\n";
?>
?>

View File

@@ -215,13 +215,13 @@
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact_phones-edit'];
}
else if ($action == "add") {
$document['title'] = $text['title-contact_phones-add'];
}
require_once "resources/header.php";
//javascript to toggle input/select boxes
echo "<script type='text/javascript'>\n";
@@ -235,26 +235,26 @@
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'><b>";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo $text['header-contact_phones-edit'];
echo "<b>".$text['header-contact_phones-edit']."</b>";
}
else if ($action == "add") {
echo $text['header-contact_phones-add'];
echo "<b>".$text['header-contact_phones-add']."</b>";
}
echo "</b></td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=$contact_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-phone_label']."\n";
@@ -366,22 +366,18 @@
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_phone_uuid' value='".escape($contact_phone_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_phone_uuid' value='".escape($contact_phone_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -49,11 +49,6 @@
$contact_phones = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//javascript function: send_cmd
echo "<script type=\"text/javascript\">\n";
echo "function send_cmd(url) {\n";
@@ -70,70 +65,86 @@
echo "</script>\n";
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-phone_numbers']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
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='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-phone_label']."</th>\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>".$text['label-phone_description']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_phone_add')) {
echo "<a href='contact_phone_edit.php?contact_uuid=".escape($_GET['id'])."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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 "</td>\n";
echo "</tr>\n";
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
foreach($contact_phones as $row) {
$x = 0;
foreach ($contact_phones as $row) {
if (permission_exists('contact_phone_edit')) {
$tr_link = "href='contact_phone_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_phone_uuid'])."'";
$list_row_url = "contact_phone_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_phone_uuid']);
}
echo "<tr ".$tr_link." ".((escape($row['phone_primary'])) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".(($row['phone_label'] == strtolower($row['phone_label'])) ? ucwords($row['phone_label']) : $row['phone_label'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'>\n";
echo " <a href=\"javascript:void(0)\" onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".escape(urlencode($row['phone_number']))."&src_cid_number=".escape(urlencode($row['phone_number']))."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode(escape($_SESSION['user']['extension'][0]['outbound_caller_id_number']))."&src=".urlencode(escape($_SESSION['user']['extension'][0]['user']))."&dest=".escape(urlencode($row['phone_number']))."&rec=false&ringback=us-ring&auto_answer=true');\">\n";
echo " ".escape(format_phone($row['phone_number']))."</a>&nbsp;\n";
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('contact_phone_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='contact_phones[$x][checked]' id='checkbox_".$x."' class='checkbox_phones' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_phones').checked = false; }\">\n";
echo " <input type='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 valign='top' class='".$row_style[$c]."'>\n";
if ($row['phone_type_voice']) { $phone_types[] = $text['label-voice']; }
if ($row['phone_type_fax']) { $phone_types[] = $text['label-fax']; }
if ($row['phone_type_video']) { $phone_types[] = $text['label-video']; }
if ($row['phone_type_text']) { $phone_types[] = $text['label-text']; }
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";
echo " ".implode(" ", $phone_types)."\n";
}
unset($phone_types);
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' nowrap='nowrap'>\n";
echo " <a href=\"".PROJECT_PATH."/app/xml_cdr/xml_cdr.php?caller_id_number=".escape($row['phone_number'])."\">".$text['button-cdr']."</a>\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;\n";
echo " <a href=\"javascript:void(0)\" onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".escape(urlencode($row['phone_number']))."&src_cid_number=".escape(urlencode($row['phone_number']))."&dest_cid_name=".urlencode(escape($_SESSION['user']['extension'][0]['outbound_caller_id_name']))."&dest_cid_number=".urlencode(escape($_SESSION['user']['extension'][0]['outbound_caller_id_number']))."&src=".urlencode(escape($_SESSION['user']['extension'][0]['user']))."&dest=".escape(urlencode($row['phone_number']))."&rec=false&ringback=us-ring&auto_answer=true');\">".$text['label-phone_call']."</a>\n";
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 valign='top' class='row_stylebg'>".escape($row['phone_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_phone_edit')) {
echo "<a href='contact_phone_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_phone_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
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";
}
if (permission_exists('contact_phone_delete')) {
echo "<a href='contact_phone_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_phone_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($contact_phones, $row);
} //end if results
$x++;
}
unset($contact_phones);
}
echo "</table>";
echo "</table>\n";
echo "<br />\n";
?>
?>

View File

@@ -24,16 +24,20 @@
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_relation_edit') || permission_exists('contact_relation_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('contact_relation_edit') || permission_exists('contact_relation_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
@@ -200,21 +204,19 @@ else {
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'>";
echo " <b>".$text['header-contact_relation']."</b>";
echo "</td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".escape($contact_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header-contact_relation']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_label']."\n";
@@ -282,8 +284,6 @@ else {
}
unset($sql, $parameters, $result, $row);
echo "</select>\n";
// echo "<br />\n";
// echo $text['description-related_contact']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -322,25 +322,21 @@ else {
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
}
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_relation_uuid' value='".escape($contact_relation_uuid)."'>\n";
else {
echo "</table>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_relation_uuid' value='".escape($contact_relation_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -63,55 +63,65 @@
$contact_relations = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header-contact_relations']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
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";
//show the relations
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\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";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_relation_add')) {
echo "<a href='contact_relation_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</td>\n";
echo "</tr>\n";
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
foreach($contact_relations as $row) {
$x = 0;
foreach ($contact_relations as $row) {
if (permission_exists('contact_relation_edit')) {
$tr_link = "href='contact_relation_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_relation_uuid'])."' ";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['relation_label'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='contact_edit.php?id=".escape($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a>&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='contact_edit.php?id=".escape($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 " <td class='list_control_icons'>";
if (permission_exists('contact_relation_edit')) {
echo "<a href='contact_relation_edit.php?contact_uuid=".$contact_uuid."&id=".escape($row['contact_relation_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
$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 "<a href='contact_relation_delete.php?contact_uuid=".$contact_uuid."&id=".escape($row['contact_relation_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
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 " <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 " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($contact_relations, $row);
} //end if results
$x++;
}
unset($contact_relations);
}
echo "</table>";
echo "<br />\n";
?>
?>

View File

@@ -199,33 +199,33 @@
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact_setting_edit'];
}
elseif ($action == "add") {
$document['title'] = $text['title-contact_setting_add'];
}
require_once "resources/header.php";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td valign='top' align='left' width='30%' nowrap='nowrap'><b>";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo $text['header-contact_setting_edit'];
echo "<b>".$text['header-contact_setting_edit']."</b>";
}
if ($action == "add") {
echo $text['header-contact_setting_add'];
else if ($action == "add") {
echo "<b>".$text['header-contact_setting_add']."</b>";
}
echo "</b></td>\n";
echo "<td valign='top' width='70%' align='right'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".escape($contact_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if ($action == "update") {
echo $text['description-contact_setting_edit'];
}
@@ -233,8 +233,8 @@
echo $text['description-contact_setting_add'];
}
echo "<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
@@ -343,22 +343,18 @@
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " <input type='hidden' name='contact_uuid' value='".$contact_uuid."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_setting_uuid' value='".$contact_setting_uuid."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".$contact_uuid."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_setting_uuid' value='".$contact_setting_uuid."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -50,76 +50,87 @@
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$contact_settings = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-contact_settings']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
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='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-contact_setting_category']."</th>";
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 style='text-align: center;'>".$text['label-enabled']."</th>";
echo "<th>".$text['label-description']."</th>";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_setting_add')) {
echo "<a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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 "</td>\n";
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
$previous_category = '';
foreach($result as $row) {
if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
$x = 0;
foreach ($contact_settings as $row) {
if (permission_exists('contact_setting_edit')) {
$tr_link = " href='contact_setting_edit.php?contact_uuid=".$contact_uuid."&id=".escape($row['contact_setting_uuid'])."'";
$list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']);
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['contact_setting_category'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."&id=".escape($row['contact_setting_uuid'])."'>".escape($row['contact_setting_subcategory'])."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['contact_setting_name'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('contact_setting_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='contact_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_settings' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_settings').checked = false; }\">\n";
echo " <input type='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 " ******** &nbsp;\n";
echo " ********\n";
}
elseif ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
echo " ******** &nbsp;\n";
} else {
else if ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
echo " ********\n";
}
else {
echo escape($row['contact_setting_value']);
}
echo " &nbsp;\n";
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-'.escape($row['contact_setting_enabled'])]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['contact_setting_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons' nowrap='nowrap'>";
if (permission_exists('contact_setting_edit')) {
echo "<a href='contact_setting_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_setting_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
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";
}
if (permission_exists('contact_setting_delete')) {
echo "<a href='contact_setting_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_setting_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$previous_category = escape($row['contact_setting_category']);
$c = ($c) ? 0 : 1;
} //end foreach
unset($result, $row);
} //end if results
$x++;
}
unset($contact_settings);
}
echo "</table>";
echo "<br />\n";
?>
?>

View File

@@ -23,16 +23,20 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_time_edit') || permission_exists('contact_time_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('contact_time_edit') || permission_exists('contact_time_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
@@ -171,33 +175,32 @@ else {
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-contact_time_edit'];
}
else if ($action == "add") {
$document['title'] = $text['title-contact_time_add'];
}
require_once "resources/header.php";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'><b>";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo $text['header-contact_time_edit'];
echo "<b>".$text['header-contact_time_edit']."</b>";
}
else if ($action == "add") {
echo $text['header-contact_time_add'];
echo "<b>".$text['header-contact_time_add']."</b>";
}
echo "</b></td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".escape($contact_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@@ -228,22 +231,18 @@ else {
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_time_uuid' value='".escape($contact_time_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_time_uuid' value='".escape($contact_time_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -53,105 +53,80 @@
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$contact_times = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header_contact_times']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th id='th_filler' style='display: none; padding: 0px;'>".img_spacer('21px', '1px')."</th>\n";
echo "<th width='20%'>".$text['label-time_user']."</th>\n";
echo "<th width='20%'>".$text['label-time_start']."</th>\n";
echo "<th width='20%'>".$text['label-time_duration']."</th>\n";
echo "<th width='40%'>".$text['label-time_description']."</th>\n";
echo "<td class='list_control_icons' nowrap>";
echo img_spacer('25px', '1px');
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 "<a href='contact_time_edit.php?contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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)]);
}
else {
echo img_spacer('25px', '1px');
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 "</td>\n";
echo "</tr>\n";
echo "</table>\n";
*/
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<div id='div_contact_times' style='width: 100%; overflow: auto; direction: rtl; text-align: right; margin-bottom: 23px;'>";
echo "<table id='table_contact_times' class='tr_hover' style='width: 100%; direction: ltr;' border='0' cellpadding='0' cellspacing='0'>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
$tr_link = (permission_exists('contact_time_edit') && $row['user_uuid'] == $_SESSION["user"]["user_uuid"]) ? "href='contact_time_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_time_uuid'])."'" : null;
echo "<tr ".$tr_link.">\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";
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); }
else {
unset($time);
}
$tmp = explode(' ', $row['time_start']);
$time_start = $tmp[0];
echo " <td valign='top' class='".$row_style[$c]."' width='20%'><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 valign='top' class='".$row_style[$c]."' width='20%'>".$time_start."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' width='20%'>".$time."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg' style='width: 40%; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;'>".escape($row['time_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons' nowrap>";
if (permission_exists('contact_time_edit')) {
if ($row['user_uuid'] == $_SESSION["user"]["user_uuid"]) {
echo "<a href='contact_time_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_time_uuid'])."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
else {
echo "<span onclick=\"alert('".$text['message-access_denied']."');\" alt='".$text['button-edit']."'>".str_replace("list_control_icon", "list_control_icon_disabled", $v_link_label_edit)."</span>";
}
$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')) {
if ($row['user_uuid'] == $_SESSION["user"]["user_uuid"]) {
echo "<a href='contact_time_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_time_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
else {
echo "<span onclick=\"alert('".$text['message-access_denied']."');\" alt='".$text['button-delete']."'>".str_replace("list_control_icon", "list_control_icon_disabled", $v_link_label_delete)."</span>";
}
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 " <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 " </td>\n";
echo "</tr>\n";
$c = $c ? 0 : 1;
} //end foreach
unset($result, $row);
} //end if results
echo "</table>";
echo "</div>\n";
$x++;
}
unset($contact_times);
}
echo "<script>";
echo " var div_times = document.getElementById('div_contact_times');";
echo " var table_times = document.getElementById('table_contact_times');";
echo " var th_filler = document.getElementById('th_filler');";
echo "</table>\n";
echo "<br />\n";
echo " if (div_times.offsetHeight > 200) { ";
echo " div_times.style.height = 200; ";
echo " }";
echo " else {";
echo " div_times.style.height = div_times.scrollHeight + 1; ";
echo " }";
echo " if (div_times.scrollHeight > div_times.clientHeight) {";
echo " th_filler.style.display = ''; ";
echo " table_times.style.paddingLeft = 1;";
echo " }";
echo " else {";
echo " th_filler.style.display = 'none'; ";
echo " table_times.style.paddingLeft = 0;";
echo " }";
echo "</script>\n";
?>
?>

View File

@@ -17,23 +17,27 @@
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-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_url_edit') || permission_exists('contact_url_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('contact_url_edit') || permission_exists('contact_url_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
@@ -206,23 +210,23 @@ else {
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'><b>";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'>";
if ($action == "update") {
echo $text['header-contact_url-edit'];
echo "<b>".$text['header-contact_url-edit']."</b>";
}
else if ($action == "add") {
echo $text['header-contact_url-add'];
echo "<b>".$text['header-contact_url-add']."</b>";
}
echo "</b></td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".escape($contact_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if ($action == "update") {
echo $text['description-contact_url-edit'];
@@ -233,6 +237,7 @@ else {
echo "<br /><br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-url_label']."\n";
@@ -302,21 +307,18 @@ else {
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_url_uuid' value='".escape($contact_url_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
if ($action == "update") {
echo "<input type='hidden' name='contact_url_uuid' value='".escape($contact_url_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -43,65 +43,76 @@
$contact_uuid = $_GET['id'];
}
//get the contact list
$sql = "select * from v_contact_urls ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$sql .= "order by url_primary desc, url_label asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$contact_urls = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-urls']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the contact list
$sql = "select * from v_contact_urls ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$sql .= "order by url_primary desc, url_label asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-url_label']."</th>\n";
echo "<th>".$text['label-url_address']."</th>\n";
echo "<th>".$text['label-url_description']."</th>\n";
echo "<td class='list_control_icons'>";
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 "<a href='contact_url_edit.php?contact_uuid=".urlencode($contact_uuid)."' alt='".$text['button-add']."'>$v_link_label_add</a>";
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 "</td>\n";
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
$x = 0;
foreach ($contact_urls as $row) {
if (permission_exists('contact_url_edit')) {
$tr_link = "href='contact_url_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_url_uuid'])."'";
}
echo "<tr ".$tr_link." ".(escape($row['url_primary']) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['url_label'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='width: 40%; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;'><a href='".escape($row['url_address'])."' target='_blank'>".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."</a>&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".escape($row['url_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_url_edit')) {
echo "<a href='contact_url_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_url_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
$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 "<a href='contact_url_delete.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_url_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
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 " <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 " </td>\n";
echo "</tr>\n";
$c = $c ? 0 : 1;
$x++;
}
}
unset($result, $row);
unset($contact_urls);
echo "</table>\n";
echo "<br />\n";
?>
?>

View File

@@ -253,18 +253,19 @@
echo " <div class='heading'><b>".$text['header-contacts']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
if (permission_exists('contact_add')) {
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'style'=>'margin-right: 15px;','link'=>'contact_import.php']);
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'collapse'=>'hide-sm-dn','style'=>'margin-right: 15px;','link'=>'contact_import.php']);
}
if (permission_exists('contact_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'contact_edit.php']);
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_edit.php']);
}
if (permission_exists('contact_delete') && $contacts) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
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'); list_form_submit('form_list');"])]);
}
echo "<form id='form_search' class='inline' method='get'>\n";
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'contacts.php','style'=>($search == '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','collapse'=>'hide-sm-dn','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','collapse'=>'hide-sm-dn','link'=>'contacts.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}

View File

@@ -98,8 +98,8 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'column');
$vcard->data['url'] = $row["url_address"];
$url_address = $database->select($sql, $parameters, 'column');
$vcard->data['url'] = $url_address;
unset($sql, $parameters, $row);

View File

@@ -38,6 +38,11 @@ if (!class_exists('contacts')) {
private $tables;
private $uuid_prefix;
/**
* declare public variables
*/
public $contact_uuid;
/**
* called when the object is created
*/
@@ -136,6 +141,57 @@ if (!class_exists('contacts')) {
unset($records);
}
}
}
public function delete_properties($records) {
//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) {
//check permissions and build the delete array
$x = 0;
foreach ($records as $property_name => $properties) {
$database = new database;
if (permission_exists($database->singular($property_name).'_delete')) {
if (is_array($properties) && @sizeof($properties) != 0) {
foreach ($properties as $property) {
if ($property['checked'] == 'true' && is_uuid($property['uuid'])) {
$array[$property_name][$x][$database->singular($property_name).'_uuid'] = $property['uuid'];
$array[$property_name][$x]['contact_uuid'] = $this->contact_uuid;
$array[$property_name][$x]['domain_uuid'] = $_SESSION['domain_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);
//set message
message::add($text['message-delete']);
}
unset($records);
}
} //method
} //class