Compress the vertical spacing default settings code. Display the category API in upper case.

This commit is contained in:
Mark Crane 2015-03-21 05:36:52 +00:00
parent 96fcd2d098
commit 2661f7f6e5
1 changed files with 211 additions and 225 deletions

View File

@ -39,8 +39,7 @@ else {
$text = $language->get();
//get posted values, if any
if (sizeof($_REQUEST) > 0) {
if (sizeof($_REQUEST) > 0) {
$action = check_str($_REQUEST["action"]);
$default_setting_uuids = $_REQUEST["id"];
$enabled = check_str($_REQUEST['enabled']);
@ -59,13 +58,10 @@ if (sizeof($_REQUEST) > 0) {
}
if ($action == 'copy' && permission_exists('domain_setting_add')) {
$target_domain_uuid = check_str($_POST["target_domain_uuid"]);
if ($target_domain_uuid != '' && sizeof($default_setting_uuids) > 0) {
$settings_copied = 0;
foreach ($default_setting_uuids as $default_setting_uuid) {
// get default setting from db
@ -111,9 +107,8 @@ if (sizeof($_REQUEST) > 0) {
// fix null
$default_setting_order = ($default_setting_order != '') ? $default_setting_order : 'null';
if ($action == "add" && permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) {
// insert for target domain
if ($action == "add" && permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) {
$sql = "insert into v_domain_settings ";
$sql .= "(";
$sql .= "domain_uuid, ";
@ -142,11 +137,9 @@ if (sizeof($_REQUEST) > 0) {
unset($sql);
$settings_copied++;
} // add
if ($action == "update" && permission_exists('domain_setting_edit')) {
$sql = "update v_domain_settings set ";
$sql .= "domain_setting_category = '".$default_setting_category."', ";
$sql .= "domain_setting_subcategory = '".$default_setting_subcategory."', ";
@ -161,14 +154,11 @@ if (sizeof($_REQUEST) > 0) {
unset($sql);
$settings_copied++;
} // update
} // foreach
// set message
$_SESSION["message"] = $text['message-copy'].": ".$settings_copied;
}
else {
// set message
@ -177,11 +167,9 @@ if (sizeof($_REQUEST) > 0) {
header("Location: default_settings.php");
exit;
}
if ($action == 'delete' && permission_exists('default_setting_delete')) {
if (sizeof($default_setting_uuids) > 0) {
foreach ($default_setting_uuids as $default_setting_uuid) {
//delete default_setting(s)
@ -203,24 +191,20 @@ if (sizeof($_REQUEST) > 0) {
header("Location: default_settings.php");
exit;
}
} // post
} // post
require_once "resources/header.php";
$document['title'] = $text['title-default_settings'];
require_once "resources/paging.php";
//header and paging
require_once "resources/header.php";
$document['title'] = $text['title-default_settings'];
require_once "resources/paging.php";
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
// copy settings javascript
if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) {
//copy settings javascript
if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) {
echo "<script language='javascript' type='text/javascript'>\n";
echo " var fade_speed = 400;\n";
echo " function show_domains() {\n";
@ -255,7 +239,7 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
echo " }\n";
echo " });\n";
echo "</script>";
}
}
//show the content
echo "<form name='frm' id='frm' method='post' action=''>";
@ -288,7 +272,7 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
echo "</table>\n";
echo "<br>";
//prepare to page the results
//prepare to page the results
$sql = "select count(*) as num_rows from v_default_settings ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
@ -302,7 +286,7 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
}
}
//prepare to page the results
//prepare to page the results
$rows_per_page = 200;
$param = "";
$page = $_GET['page'];
@ -310,7 +294,7 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
//get the list
$sql = "select * from v_default_settings ";
if (strlen($order_by) == 0) {
$sql .= "order by default_setting_category, default_setting_subcategory, default_setting_order asc ";
@ -345,6 +329,9 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
}
echo " <br />\n";
echo " <b>\n";
if (strtolower($row['default_setting_category']) == "api") {
echo " API";
}
if (strtolower($row['default_setting_category']) == "cdr") {
echo " CDR";
}
@ -380,7 +367,6 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
echo "</tr>\n";
}
$tr_link = (permission_exists('default_setting_edit')) ? "href='default_setting_edit.php?id=".$row['default_setting_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
if (