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
+49 -43
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";
?>
?>