Dialplans - List: Fix Admin view.

This commit is contained in:
Nate 2020-03-30 11:58:17 -06:00
parent 76592ab7cb
commit 8d3e7bbee4
1 changed files with 36 additions and 31 deletions

View File

@ -390,39 +390,44 @@
foreach ($dialplans as $row) { foreach ($dialplans as $row) {
//get the application id //get the application id
if (is_uuid($row['app_uuid'])) { // if (is_uuid($row['app_uuid'])) {
$app_uuid = $row['app_uuid']; // $app_uuid = $row['app_uuid'];
} // }
// blank app id if doesn't match others, so will return to dialplan manager // blank app id if doesn't match others, so will return to dialplan manager
switch ($app_uuid) { // switch ($app_uuid) {
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": // inbound route // case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": // inbound route
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": // outbound route // case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": // outbound route
case "16589224-c876-aeb3-f59f-523a1c0801f7": // fifo // case "16589224-c876-aeb3-f59f-523a1c0801f7": // fifo
case "4b821450-926b-175a-af93-a03c441818b1": // time condition // case "4b821450-926b-175a-af93-a03c441818b1": // time condition
break; // break;
default: // default:
unset($app_uuid); // unset($app_uuid);
} // }
if ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) { if ($row['app_uuid'] == "4b821450-926b-175a-af93-a03c441818b1") {
$list_row_url = PROJECT_PATH."/app/time_conditions/time_condition_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null); if (permission_exists('time_condition_edit') || permission_exists('dialplan_edit')) {
$list_row_url = PROJECT_PATH."/app/time_conditions/time_condition_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null);
}
} }
else if ( else if (
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) || ($row['app_uuid'] == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) || ($row['app_uuid'] == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) ||
($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) || ($row['app_uuid'] == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) ||
permission_exists('dialplan_edit') permission_exists('dialplan_edit')
) { ) {
$list_row_url = "dialplan_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null); $list_row_url = "dialplan_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null);
} }
else {
unset($list_row_url);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n"; echo "<tr class='list-row' href='".$list_row_url."'>\n";
if ( if (
(!is_uuid($app_uuid) && (permission_exists('dialplan_add') || permission_exists('dialplan_edit') || permission_exists('dialplan_delete'))) ||
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && (permission_exists('inbound_route_copy') || permission_exists('inbound_route_edit') || permission_exists('inbound_route_delete'))) || ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && (permission_exists('inbound_route_copy') || permission_exists('inbound_route_edit') || permission_exists('inbound_route_delete'))) ||
($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && (permission_exists('outbound_route_copy') || permission_exists('outbound_route_edit') || permission_exists('outbound_route_delete'))) || ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && (permission_exists('outbound_route_copy') || permission_exists('outbound_route_edit') || permission_exists('outbound_route_delete'))) ||
($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7" && (permission_exists('fifo_add') || permission_exists('fifo_edit') || permission_exists('fifo_delete'))) || ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7" && (permission_exists('fifo_add') || permission_exists('fifo_edit') || permission_exists('fifo_delete'))) ||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && (permission_exists('time_condition_add') || permission_exists('time_condition_edit') || permission_exists('time_condition_delete'))) || ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && (permission_exists('time_condition_add') || permission_exists('time_condition_edit') || permission_exists('time_condition_delete')))
permission_exists('dialplan_add') || permission_exists('dialplan_edit') || permission_exists('dialplan_delete')
) { ) {
echo " <td class='checkbox'>\n"; echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='dialplans[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n"; echo " <input type='checkbox' name='dialplans[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
@ -452,11 +457,11 @@
} }
echo " <td class='center'>".escape($row['dialplan_order'])."</td>\n"; echo " <td class='center'>".escape($row['dialplan_order'])."</td>\n";
if ( if (
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) || (!is_uuid($app_uuid) && permission_exists('dialplan_edit')) ||
($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) || ($row['app_uuid'] == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) || ($row['app_uuid'] == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) ||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) || ($row['app_uuid'] == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) ||
permission_exists('dialplan_edit') ($row['app_uuid'] == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit'))
) { ) {
echo " <td class='no-link center'>"; echo " <td class='no-link center'>";
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['dialplan_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]); echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['dialplan_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
@ -467,13 +472,13 @@
} }
echo " </td>\n"; echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['dialplan_description'])."&nbsp;</td>\n"; echo " <td class='description overflow hide-sm-dn'>".escape($row['dialplan_description'])."&nbsp;</td>\n";
if (( if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true' && (
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) || (!is_uuid($app_uuid) && permission_exists('dialplan_edit')) ||
($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) || ($row['app_uuid'] == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) || ($row['app_uuid'] == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) ||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) || ($row['app_uuid'] == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) ||
permission_exists('dialplan_edit')) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true' ($row['app_uuid'] == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit'))
) { )) {
echo " <td class='action-button'>"; echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); 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";