mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Ring Groups: Hide buttons till checkbox checked, Updates for PHP 8.1.
This commit is contained in:
@@ -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) 2010-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2010-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -85,7 +85,7 @@ if (!class_exists('ring_groups')) {
|
||||
|
||||
//filter out unchecked ring groups, build where clause for below
|
||||
foreach ($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -195,13 +195,13 @@ if (!class_exists('ring_groups')) {
|
||||
|
||||
//filter out unchecked ring groups, build where clause for below
|
||||
foreach ($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = $record['uuid'];
|
||||
}
|
||||
}
|
||||
|
||||
//get ring group context
|
||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
$sql = "select ring_group_context from v_ring_groups ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ring_group_uuid = :ring_group_uuid ";
|
||||
@@ -213,7 +213,7 @@ if (!class_exists('ring_groups')) {
|
||||
}
|
||||
|
||||
//build the delete array
|
||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
if (!empty($uuids) && is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
$x = 0;
|
||||
foreach ($uuids as $uuid) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
||||
@@ -223,7 +223,7 @@ if (!class_exists('ring_groups')) {
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//execute delete
|
||||
$database = new database;
|
||||
@@ -269,8 +269,8 @@ if (!class_exists('ring_groups')) {
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get current toggle state
|
||||
foreach($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
foreach ($records as $x => $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -366,8 +366,8 @@ if (!class_exists('ring_groups')) {
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get checked records
|
||||
foreach($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
foreach ($records as $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
if (count($_POST) > 0) {
|
||||
|
||||
//process the http post data by submitted action
|
||||
if ($_POST['action'] != '' && is_uuid($ring_group_uuid)) {
|
||||
if (!empty($_POST['action']) && is_uuid($ring_group_uuid)) {
|
||||
$array[0]['checked'] = 'true';
|
||||
$array[0]['uuid'] = $ring_group_uuid;
|
||||
|
||||
@@ -186,8 +186,8 @@
|
||||
$ring_group_call_timeout = $_POST["ring_group_call_timeout"];
|
||||
$ring_group_caller_id_name = $_POST["ring_group_caller_id_name"];
|
||||
$ring_group_caller_id_number = $_POST["ring_group_caller_id_number"];
|
||||
$ring_group_cid_name_prefix = $_POST["ring_group_cid_name_prefix"];
|
||||
$ring_group_cid_number_prefix = $_POST["ring_group_cid_number_prefix"];
|
||||
$ring_group_cid_name_prefix = $_POST["ring_group_cid_name_prefix"] ?? null;
|
||||
$ring_group_cid_number_prefix = $_POST["ring_group_cid_number_prefix"] ?? null;
|
||||
$ring_group_distinctive_ring = $_POST["ring_group_distinctive_ring"];
|
||||
$ring_group_ringback = $_POST["ring_group_ringback"];
|
||||
$ring_group_call_forward_enabled = $_POST["ring_group_call_forward_enabled"];
|
||||
@@ -199,16 +199,16 @@
|
||||
$ring_group_forward_toll_allow = $_POST["ring_group_forward_toll_allow"];
|
||||
$ring_group_enabled = $_POST["ring_group_enabled"] ?? 'false';
|
||||
$ring_group_description = $_POST["ring_group_description"];
|
||||
$dialplan_uuid = $_POST["dialplan_uuid"];
|
||||
$dialplan_uuid = $_POST["dialplan_uuid"] ?? null;
|
||||
//$ring_group_timeout_action = "transfer:1001 XML default";
|
||||
$ring_group_timeout_array = explode(":", $ring_group_timeout_action);
|
||||
$ring_group_timeout_app = array_shift($ring_group_timeout_array);
|
||||
$ring_group_timeout_data = join(':', $ring_group_timeout_array);
|
||||
$destination_number = $_POST["destination_number"];
|
||||
$destination_delay = $_POST["destination_delay"];
|
||||
$destination_timeout = $_POST["destination_timeout"];
|
||||
$destination_prompt = $_POST["destination_prompt"];
|
||||
$ring_group_destinations_delete = $_POST["ring_group_destinations_delete"];
|
||||
$destination_number = $_POST["destination_number"] ?? null;
|
||||
$destination_delay = $_POST["destination_delay"] ?? null;
|
||||
$destination_timeout = $_POST["destination_timeout"] ?? null;
|
||||
$destination_prompt = $_POST["destination_prompt"] ?? null;
|
||||
$ring_group_destinations_delete = $_POST["ring_group_destinations_delete"] ?? null;
|
||||
|
||||
//set the context for users that do not have the permission
|
||||
if (permission_exists('ring_group_context')) {
|
||||
@@ -329,7 +329,7 @@
|
||||
}
|
||||
|
||||
//add the dialplan_uuid
|
||||
if (!is_uuid($_POST["dialplan_uuid"])) {
|
||||
if (empty($_POST["dialplan_uuid"]) || !is_uuid($_POST["dialplan_uuid"])) {
|
||||
$dialplan_uuid = uuid();
|
||||
}
|
||||
|
||||
@@ -358,8 +358,8 @@
|
||||
$array["ring_groups"][0]["ring_group_call_forward_enabled"] = $ring_group_call_forward_enabled;
|
||||
$array["ring_groups"][0]["ring_group_follow_me_enabled"] = $ring_group_follow_me_enabled;
|
||||
if (permission_exists('ring_group_missed_call')) {
|
||||
$array["ring_groups"][0]["ring_group_missed_call_app"] = $ring_group_missed_call_app;
|
||||
$array["ring_groups"][0]["ring_group_missed_call_data"] = $ring_group_missed_call_data;
|
||||
$array["ring_groups"][0]["ring_group_missed_call_app"] = $ring_group_missed_call_app ?? null;
|
||||
$array["ring_groups"][0]["ring_group_missed_call_data"] = $ring_group_missed_call_data ?? null;
|
||||
}
|
||||
if (permission_exists('ring_group_forward')) {
|
||||
$array["ring_groups"][0]["ring_group_forward_enabled"] = $ring_group_forward_enabled;
|
||||
@@ -379,7 +379,7 @@
|
||||
|
||||
$y = 0;
|
||||
foreach ($ring_group_destinations as $row) {
|
||||
if (is_uuid($row['ring_group_destination_uuid'])) {
|
||||
if (!empty($row['ring_group_destination_uuid']) && is_uuid($row['ring_group_destination_uuid'])) {
|
||||
$ring_group_destination_uuid = $row['ring_group_destination_uuid'];
|
||||
}
|
||||
else {
|
||||
@@ -717,7 +717,7 @@
|
||||
echo "<optgroup label=".$text['label-'.$key].">\n";
|
||||
$selected = false;
|
||||
foreach ($value as $row) {
|
||||
if ($ring_group_greeting == $row["value"]) {
|
||||
if (!empty($ring_group_greeting) && $ring_group_greeting == $row["value"]) {
|
||||
$selected = true;
|
||||
echo " <option value='".escape($row["value"])."' selected='selected'>".escape($row["name"])."</option>\n";
|
||||
}
|
||||
@@ -989,8 +989,10 @@
|
||||
echo " <option value=\"\"></option>\n";
|
||||
if (is_array($users) && @sizeof($users) != 0) {
|
||||
foreach ($users as $field) {
|
||||
foreach ($ring_group_users as $user) {
|
||||
if ($user['user_uuid'] == $field['user_uuid']) { continue 2; } //skip already assigned
|
||||
if (!empty($ring_group_users) && is_array($ring_group_users) && @sizeof($ring_group_users) != 0) {
|
||||
foreach ($ring_group_users as $user) {
|
||||
if ($user['user_uuid'] == $field['user_uuid']) { continue 2; } //skip already assigned
|
||||
}
|
||||
}
|
||||
echo " <option value='".escape($field['user_uuid'])."'>".escape($field['username'])."</option>\n";
|
||||
}
|
||||
@@ -1010,13 +1012,13 @@
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='ring_group_call_forward_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($ring_group_call_forward_enabled == "true") {
|
||||
if (!empty($ring_group_call_forward_enabled) && $ring_group_call_forward_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['option-true']."</option>\n";
|
||||
}
|
||||
if ($ring_group_call_forward_enabled == "false") {
|
||||
if (!empty($ring_group_call_forward_enabled) && $ring_group_call_forward_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
@@ -1035,13 +1037,13 @@
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='ring_group_follow_me_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($ring_group_follow_me_enabled == "true") {
|
||||
if (!empty($ring_group_follow_me_enabled) && $ring_group_follow_me_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['option-true']."</option>\n";
|
||||
}
|
||||
if ($ring_group_follow_me_enabled == "false") {
|
||||
if (!empty($ring_group_follow_me_enabled) && $ring_group_follow_me_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
@@ -1081,7 +1083,7 @@
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='ring_group_forward_enabled' id='ring_group_forward_enabled' onchange=\"(this.selectedIndex == 1) ? document.getElementById('ring_group_forward_destination').focus() : null;\">";
|
||||
echo " <option value='false'>".$text['option-disabled']."</option>";
|
||||
echo " <option value='true' ".($ring_group_forward_enabled == 'true' ? "selected='selected'" : null).">".$text['option-enabled']."</option>";
|
||||
echo " <option value='true' ".(!empty($ring_group_forward_enabled) && $ring_group_forward_enabled == 'true' ? "selected='selected'" : null).">".$text['option-enabled']."</option>";
|
||||
echo " </select>";
|
||||
echo "<input class='formfld' type='text' name='ring_group_forward_destination' id='ring_group_forward_destination' placeholder=\"".$text['label-forward_destination']."\" maxlength='255' value=\"".escape($ring_group_forward_destination)."\">";
|
||||
echo "<br />\n";
|
||||
|
||||
@@ -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) 2010-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2010-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -101,7 +101,7 @@
|
||||
//get filtered ring group count
|
||||
if (!empty($search)) {
|
||||
$sql = "select count(*) from v_ring_groups where true ";
|
||||
if ($_GET['show'] != "all" || !permission_exists('ring_group_all')) {
|
||||
if (empty($_GET['show']) || $_GET['show'] != "all" || !permission_exists('ring_group_all')) {
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
}
|
||||
@@ -166,13 +166,13 @@
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','link'=>'ring_group_edit.php']);
|
||||
}
|
||||
if (permission_exists('ring_group_add') && $ring_groups && (!isset($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('ring_group_edit') && $ring_groups) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'name'=>'btn_toggle','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
}
|
||||
if (permission_exists('ring_group_delete') && $ring_groups) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if (permission_exists('ring_group_all')) {
|
||||
@@ -215,7 +215,7 @@
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit') || permission_exists('ring_group_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".!empty($ring_groups ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".!empty($ring_groups ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
if ($show == "all" && permission_exists('ring_group_all')) {
|
||||
@@ -241,7 +241,7 @@
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit') || permission_exists('ring_group_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='ring_groups[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='checkbox' name='ring_groups[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='ring_groups[$x][uuid]' value='".escape($row['ring_group_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user