Database Transactions: List view updates. Misc Action Bar adjustments. Include missing class for Conferences (Doh).

This commit is contained in:
Nate
2019-11-05 08:13:42 -07:00
parent 808f1c3d86
commit f4a9767d25
15 changed files with 467 additions and 93 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2016
Portions created by the Initial Developer are Copyright (C) 2016 - 2019
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -27,10 +27,10 @@
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('database_transaction_view')) {
//access granted
}
@@ -43,26 +43,34 @@
$language = new text;
$text = $language->get();
//get posted data
if (is_array($_POST['bridges'])) {
$action = $_POST['action'];
$search = $_POST['search'];
}
//get variables used to control the order
$order_by = $_GET["order_by"] != '' ? $_GET['order_by'] : 'transaction_date';
$order = $_GET["order"] != '' ? $_GET['order'] : 'desc';
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//add the search term
$search = strtolower($_GET["search"]);
if ($search != '') {
$sql_search = "and (";
$sql_search .= " lower(app_name) like :search ";
$sql_search .= " or lower(transaction_code) like :search ";
$sql_search .= " or lower(transaction_address) like :search ";
$sql_search .= " or lower(transaction_type) like :search ";
$sql_search .= " or cast(transaction_date as text) like :search ";
$sql_search .= " lower(t.app_name) like :search ";
$sql_search .= " or lower(t.transaction_code) like :search ";
$sql_search .= " or lower(t.transaction_address) like :search ";
$sql_search .= " or lower(t.transaction_type) like :search ";
$sql_search .= " or cast(t.transaction_date as text) like :search ";
$sql_search .= ") ";
$parameters['search'] = '%'.$search.'%';
}
//prepare to page the results
$sql = "select count(database_transaction_uuid) from v_database_transactions ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql = "select count(*) from v_database_transactions as t ";
$sql .= "left outer join v_domains as d using (domain_uuid) ";
$sql .= "left outer join v_users as u using (user_uuid) ";
$sql .= "where t.domain_uuid = :domain_uuid ";
$sql .= $sql_search;
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
@@ -73,46 +81,42 @@
$param = "search=".$search;
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page;
//get the list
$sql = "select ";
$sql .= "t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, ";
$sql .= "t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date ";
$sql .= "from v_database_transactions as t ";
$sql .= "left outer join v_domains as d using (domain_uuid) ";
$sql .= "left outer join v_users as u using (user_uuid) ";
$sql .= "where t.domain_uuid = :domain_uuid ";
$sql .= $sql_search;
$sql .= order_by($order_by, $order);
$sql = str_replace('count(*)','t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date', $sql);
$sql .= order_by($order_by, $order, 't.transaction_date', 'desc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters, 'all');
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
unset($sql);
//additional includes
require_once "resources/header.php";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-database_transactions']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".escape($search)."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-database_transactions']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
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'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
echo " </form>\n";
echo " </tr>\n";
echo "</table>\n";
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo $text['description-database_transactions']."\n";
echo "<br /><br />\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
echo th_order_by('username', $text['label-user_uuid'], $order_by, $order);
echo th_order_by('app_name', $text['label-app_name'], $order_by, $order);
@@ -123,58 +127,44 @@
//echo th_order_by('transaction_old', $text['label-transaction_old'], $order_by, $order);
//echo th_order_by('transaction_new', $text['label-transaction_new'], $order_by, $order);
//echo th_order_by('transaction_result', $text['label-transaction_result'], $order_by, $order);
echo "<td class='list_control_icon'>";
echo " &nbsp;\n";
echo "</td>\n";
echo "<tr>\n";
if (permission_exists('database_transaction_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($result)) {
$x = 0;
foreach($result as $row) {
if (permission_exists('database_transaction_edit')) {
$tr_link = "href='database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).($page != '' ? "&page=".urlencode($page) : null).($search != '' ? "&search=".urlencode($search) : null)."'";
$list_row_url = "database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).($page != '' ? "&page=".urlencode($page) : null).($search != '' ? "&search=".urlencode($search) : null);
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['domain_name'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['username'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['app_name'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_code'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_address'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_type'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_date'])."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_old']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_new']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['transaction_result']."&nbsp;</td>\n";
echo " <td class='list_control_icon'>";
echo "<tr class='list-row' href='".$list_row_url."'>\n";
echo " <td>".escape($row['domain_name'])."&nbsp;</td>\n";
echo " <td>".escape($row['username'])."&nbsp;</td>\n";
echo " <td><a href='".$list_row_url."'>".escape($row['app_name'])."</a>&nbsp;</td>\n";
echo " <td>".escape($row['transaction_code'])."&nbsp;</td>\n";
echo " <td>".escape($row['transaction_address'])."&nbsp;</td>\n";
echo " <td>".escape($row['transaction_type'])."&nbsp;</td>\n";
echo " <td>".escape($row['transaction_date'])."&nbsp;</td>\n";
//echo " <td>".escape($row['transaction_old']."&nbsp;</td>\n";
//echo " <td>".escape($row['transaction_new']."&nbsp;</td>\n";
//echo " <td>".escape($row['transaction_result']."&nbsp;</td>\n";
if (permission_exists('database_transaction_edit')) {
echo "<a href='database_transaction_edit.php?id=".urlencode($row['database_transaction_uuid']).($page != '' ? "&page=".urlencode($page) : null).($search != '' ? "&search=".urlencode($search) : null)."' alt='".$text['button-view']."'>$v_link_label_view</a>";
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]);
echo " </td>\n";
}
//if (permission_exists('database_transaction_delete')) {
// echo "<a href='database_transaction_delete.php?id=".escape($row['database_transaction_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
//}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
$x++;
}
unset($result);
}
echo "<tr>\n";
echo "<td colspan='11' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
echo "&nbsp;";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
echo "</table>\n";
echo "<br />\n";
echo "<div align='center'>".$paging_controls."</div>\n";
//include the footer
require_once "resources/footer.php";
?>
?>