Conference Centers - List: Bulk Toggle and Delete actions added, Edit: Button updates.

This commit is contained in:
Nate
2020-01-23 06:47:54 -07:00
parent e35c6a746f
commit aac98e7d06
3 changed files with 62 additions and 74 deletions

View File

@@ -54,6 +54,19 @@
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//delete the conference center
if ($_POST['action'] == 'delete' && permission_exists('conference_center_delete') && is_uuid($conference_center_uuid)) {
//prepare
$array[0]['checked'] = 'true';
$array[0]['uuid'] = $conference_center_uuid;
//delete
$obj = new conference_centers;
$obj->delete_conference_centers($array);
//redirect
header('Location: conference_centers.php');
exit;
}
//get http post variables and set them to php variables
$conference_center_uuid = $_POST["conference_center_uuid"];
$dialplan_uuid = $_POST["dialplan_uuid"];
@@ -252,23 +265,26 @@
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-conference_center']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' style='margin-right: 15px;' name='' alt='".$text['button-back']."' onclick=\"window.location='conference_centers.php'\" value='".$text['button-back']."'>";
if (permission_exists('conference_center_delete') && $action == 'update') {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'link'=>'conference_center_delete.php?id='.urlencode($conference_center_uuid),'onclick'=>"if (!confirm('".$text['confirm-delete']."')) { this.blur(); return false; }",'style'=>'margin-right: 15px;']);
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-conference_center']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'conference_centers.php']);
if ($action == 'update' && permission_exists('conference_center_delete')) {
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'action','value'=>'delete','onclick'=>"if (confirm('".$text['confirm-delete']."')) { document.getElementById('frm').submit(); } else { this.blur(); return false; }",'style'=>'margin-right: 15px;']);
}
echo "<input type='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-conference_center_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='conference_center_name' maxlength='255' value=\"".escape($conference_center_name)."\">\n";
echo "<br />\n";
echo $text['description-conference_center_name']."\n";
@@ -411,19 +427,8 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_center_enabled'>\n";
echo " <option value=''></option>\n";
if ($conference_center_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($conference_center_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' ".($conference_center_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-conference_center_enabled']."\n";
@@ -439,22 +444,19 @@
echo "<br />\n";
echo $text['description-conference_center_description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
echo " <input type='hidden' name='conference_center_uuid' value='".escape($conference_center_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
if ($action == "update") {
echo "<input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
echo "<input type='hidden' name='conference_center_uuid' value='".escape($conference_center_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -50,26 +50,27 @@
$conference_centers = $_POST['conference_centers'];
}
/*
//process the http post data by action
if ($action != '' && is_array($conference_centers) && @sizeof($conference_centers) != 0) {
switch ($action) {
/*
case 'copy':
if (permission_exists('conference_center_add')) {
$obj = new conference_centers;
$obj->copy($conference_centers);
$obj->copy_conference_centers($conference_centers);
}
break;
*/
case 'toggle':
if (permission_exists('conference_center_edit')) {
$obj = new conference_centers;
$obj->toggle($conference_centers);
$obj->toggle_conference_centers($conference_centers);
}
break;
case 'delete':
if (permission_exists('conference_center_delete')) {
$obj = new conference_centers;
$obj->delete($conference_centers);
$obj->delete_conference_centers($conference_centers);
}
break;
}
@@ -77,7 +78,6 @@
header('Location: conference_centers.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
*/
//get variables used to control the order
$order_by = $_GET["order_by"];
@@ -143,13 +143,13 @@
if (permission_exists('conference_center_add') && $conference_centers) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
*/
if (permission_exists('conference_center_edit') && $conference_centers) {
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
if (permission_exists('conference_center_delete') && $conference_centers) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
*/
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)]);
@@ -171,18 +171,16 @@
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
/*
if (permission_exists('conference_center_add') || permission_exists('conference_center_edit') || permission_exists('conference_center_delete')) {
if (permission_exists('conference_center_edit') || permission_exists('conference_center_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($conference_centers ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
*/
echo th_order_by('conference_center_name', $text['label-conference_center_name'], $order_by, $order);
echo th_order_by('conference_center_extension', $text['label-conference_center_extension'], $order_by, $order);
echo th_order_by('conference_center_greeting', $text['label-conference_center_greeting'], $order_by, $order);
echo th_order_by('conference_center_pin_length', $text['label-conference_center_pin_length'], $order_by, $order);
echo th_order_by('conference_center_enabled', $text['label-conference_center_enabled'], $order_by, $order);
echo th_order_by('conference_center_pin_length', $text['label-conference_center_pin_length'], $order_by, $order, null, "class='center shrink'");
echo th_order_by('conference_center_enabled', $text['label-conference_center_enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('conference_center_description', $text['label-conference_center_description'], $order_by, $order, null, "class='hide-sm-dn'");
if (permission_exists('conference_center_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
@@ -191,24 +189,30 @@
if (is_array($conference_centers) && @sizeof($conference_centers) != 0) {
$x = 0;
foreach($conference_centers as $row) {
foreach ($conference_centers as $row) {
if (permission_exists('conference_center_edit')) {
$list_row_url = "conference_center_edit.php?id=".$row['conference_center_uuid'];
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
/*
if (permission_exists('conference_center_add') || permission_exists('conference_center_edit') || permission_exists('conference_center_delete')) {
if (permission_exists('conference_center_edit') || permission_exists('conference_center_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='conference_centers[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='conference_centers[$x][uuid]' value='".escape($row['conference_center_uuid'])."' />\n";
echo " </td>\n";
}
*/
echo " <td><a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['conference_center_name'])."</a>&nbsp;</td>\n";
echo " <td>".escape($row['conference_center_extension'])."&nbsp;</td>\n";
echo " <td>".escape($row['conference_center_greeting'])."&nbsp;</td>\n";
echo " <td>".escape($row['conference_center_pin_length'])."&nbsp;</td>\n";
echo " <td>".$text['label-'.$row['conference_center_enabled']]."&nbsp;</td>\n";
echo " <td class='center'>".escape($row['conference_center_pin_length'])."&nbsp;</td>\n";
if (permission_exists('conference_center_edit')) {
echo " <td class='no-link center'>\n";
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['conference_center_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
}
else {
echo " <td class='center'>\n";
echo $text['label-'.$row['conference_center_enabled']];
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['conference_center_description'])."&nbsp;</td>\n";
if (permission_exists('conference_center_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>";

View File

@@ -57,20 +57,6 @@ if (!class_exists('conference_centers')) {
private $uuid_prefix;
private $toggle_values;
/**
* declare private variables
*/
/*
private $app_name;
private $app_uuid;
private $permission_prefix;
private $list_page;
private $table;
private $uuid_prefix;
private $toggle_field;
private $toggle_values;
*/
/**
* Called when the object is created
*/
@@ -315,7 +301,6 @@ if (!class_exists('conference_centers')) {
/**
* delete records
*/
/*
public function delete_conference_centers($records) {
//assign private variables
@@ -350,7 +335,7 @@ if (!class_exists('conference_centers')) {
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and conference_center_uuid = :conference_center_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['conference_center_uuid'] = $conference_center_uuid;
$parameters['conference_center_uuid'] = $record['uuid'];
$database = new database;
$dialplan_uuid = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
@@ -401,7 +386,6 @@ if (!class_exists('conference_centers')) {
}
}
}
*/
public function delete_conference_rooms($records) {
@@ -474,7 +458,6 @@ if (!class_exists('conference_centers')) {
/**
* toggle records
*/
/*
public function toggle_conference_centers($records) {
//assign private variables
@@ -570,7 +553,6 @@ if (!class_exists('conference_centers')) {
}
}
*/
public function toggle_conference_rooms($records) {