Add show all button for dialplan -> destinations

This commit is contained in:
Mark Crane 2015-03-07 12:59:53 +00:00
parent 98305d23e9
commit d5ac3009a5
3 changed files with 54 additions and 5 deletions

View File

@ -42,6 +42,10 @@
$apps[$x]['permissions'][$y]['name'] = 'destination_domain';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'destination_show_all';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
//schema details
$y = 0; //table array index

View File

@ -275,4 +275,14 @@ $text["billing-warning"]["es-cl"] = "Si está utilizando la aplicación de factu
$text["billing-warning"]["pt-pt"] = "Se você estiver usando o aplicativo de faturamento fusionpbx, certifique-se de adicionar variáveis accountcode e carrier";
$text["billing-warning"]["fr-fr"] = "Si vous utilisez l'application de facturation fusionpbx, assurez-vous d'ajouter des variables de accountcode et carrier";
$text['button-show_all']['en-us'] = "Show All";
$text['button-show_all']['es-cl'] = "Mostrar Todos";
$text['button-show_all']['pt-pt'] = "Mostrar Todos";
$text['button-show_all']['fr-fr'] = "Montrer Tout";
$text['label-domain-name']['en-us'] = "Domain Name";
$text['label-domain-name']['es-cl'] = "Nombre de Dominio";
$text['label-domain-name']['pt-pt'] = "Nome de Domínio";
$text['label-domain-name']['fr-fr'] = "Nom de Domaine";
?>

View File

@ -53,6 +53,11 @@ else {
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-destinations']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' align='right'>\n";
//SCJB
if (permission_exists('destination_show_all')) {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='destinations.php?showall=true';\">\n";
}
//ECJB
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </td>\n";
@ -67,9 +72,18 @@ else {
//prepare to page the results
$sql = " select count(*) as num_rows from v_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
if (strlen($search) > 0) {
$sql .= "where ";
}
} else {
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($search) > 0) {
$sql .= " and ";
}
}
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " (";
$sql .= " destination_type like '%".$search."%' ";
$sql .= " or destination_number like '%".$search."%' ";
$sql .= " or destination_context like '%".$search."%' ";
@ -100,9 +114,20 @@ else {
//get the list
$sql = "select * from v_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if ($_GET['showall'] && permission_exists('destination_show_all')) {
$sql .= " join v_domains on v_domains.domain_uuid = v_destinations.domain_uuid ";
$param = "&showall=" . $_GET['showall'];
if (strlen($search) > 0) {
$sql .= " where ";
}
} else {
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($search) > 0) {
$sql .= " and ";
}
}
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " (";
$sql .= " destination_type like '%".$search."%' ";
$sql .= " or destination_number like '%".$search."%' ";
$sql .= " or destination_context like '%".$search."%' ";
@ -124,6 +149,9 @@ else {
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if ($_GET['showall'] && permission_exists('destination_show_all')) {
echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, $param);
}
echo th_order_by('destination_type', $text['label-destination_type'], $order_by, $order);
echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order);
echo th_order_by('destination_context', $text['label-destination_context'], $order_by, $order);
@ -138,6 +166,9 @@ else {
foreach($result as $row) {
$tr_link = "href='destination_edit.php?id=".$row['destination_uuid']."'";
echo "<tr ".$tr_link.">\n";
if ($_GET['showall'] && permission_exists('destination_show_all')) {
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['domain_name'])."</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['destination_type'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='destination_edit.php?id=".$row['destination_uuid']."'>".$row['destination_number']."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_context']."</td>\n";
@ -154,7 +185,11 @@ else {
} //end if results
echo "<tr>\n";
echo "<td colspan='6' align='left'>\n";
if ($_GET['showall'] && permission_exists('destination_show_all')) {
echo "<td colspan='7' align='left'>\n";
} else {
echo "<td colspan='6' align='left'>\n";
}
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";