2009-04-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_ui.php: Added get_url_refresh which gets the correct url to refresh a page against instead of manually reconstructing for each form. Modified process_page_head to use this new function * general/header.php: Use of new function get_url_refresh. Fixes some minor annoyances I had with this refresh when groups were selected with a post * ajax.php: Error message didn't display the right page name * operation/agentes/estado_agente.php: Fixed bug #2770377 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1640 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ad6a9df089
commit
7128b47f7e
|
@ -1,3 +1,17 @@
|
||||||
|
2009-04-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
|
* include/functions_ui.php: Added get_url_refresh which gets the correct
|
||||||
|
url to refresh a page against instead of manually reconstructing for each
|
||||||
|
form. Modified process_page_head to use this new function
|
||||||
|
|
||||||
|
* general/header.php: Use of new function get_url_refresh. Fixes some
|
||||||
|
minor annoyances I had with this refresh when groups were selected with
|
||||||
|
a post
|
||||||
|
|
||||||
|
* ajax.php: Error message didn't display the right page name
|
||||||
|
|
||||||
|
* operation/agentes/estado_agente.php: Fixed bug #2770377
|
||||||
|
|
||||||
2009-04-21 Sancho Lerena <slerena@gmail.com>
|
2009-04-21 Sancho Lerena <slerena@gmail.com>
|
||||||
|
|
||||||
* operation/servers/view_server.php: New stats for server (threads,
|
* operation/servers/view_server.php: New stats for server (threads,
|
||||||
|
|
|
@ -48,6 +48,6 @@ session_write_close ();
|
||||||
if (file_exists ($page)) {
|
if (file_exists ($page)) {
|
||||||
require_once ($page);
|
require_once ($page);
|
||||||
} else {
|
} else {
|
||||||
echo '<br /><b class="error">Sorry! I can\'t find the page $page!</b>';
|
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -82,11 +82,11 @@ echo "</a>";
|
||||||
// Autorefresh
|
// Autorefresh
|
||||||
echo '</td><td width="20%">';
|
echo '</td><td width="20%">';
|
||||||
if ($config["refr"]) {
|
if ($config["refr"]) {
|
||||||
echo '<a id="autorefresh" class="white_grey_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? safe_input ($_SERVER['REQUEST_URI']) : 'index.php?' ).'&refr=0"><img src="images/page_lightning.png" class="bot" alt="lightning" /> '. __('Autorefresh');
|
echo '<a id="autorefresh" class="white_grey_bold" href="'.get_url_refresh ().'&refr=0"><img src="images/page_lightning.png" class="bot" alt="lightning" /> '. __('Autorefresh');
|
||||||
echo ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
echo ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
} else {
|
} else {
|
||||||
echo '<a id="autorefresh" class="white_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? safe_input ($_SERVER['REQUEST_URI']) : "index.php?" ).(count($_GET) ? "&" : "?").'refr="><img src="images/page_lightning.png" class="bot" alt="lightning" /> '.__('Autorefresh').'</a>';
|
echo '<a id="autorefresh" class="white_bold" href="'.get_url_refresh ().'&refr="><img src="images/page_lightning.png" class="bot" alt="lightning" /> '.__('Autorefresh').'</a>';
|
||||||
$values = array ('5' => '5 '.__('seconds'),
|
$values = array ('5' => '5 '.__('seconds'),
|
||||||
'10' => '10 '.__('seconds'),
|
'10' => '10 '.__('seconds'),
|
||||||
'15' => '15 '.__('seconds'),
|
'15' => '15 '.__('seconds'),
|
||||||
|
|
|
@ -577,40 +577,7 @@ function process_page_head ($string, $bitfield) {
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if ($config["refr"] > 0) {
|
if ($config["refr"] > 0) {
|
||||||
// Agent selection filters and refresh
|
$query = get_url_refresh (false);
|
||||||
$protocol = 'http';
|
|
||||||
$ssl = false;
|
|
||||||
if ($config['https']) {
|
|
||||||
/* Check with "on" because some web servers like Cherokee always
|
|
||||||
set this value even if SSL is not enabled */
|
|
||||||
if (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
|
|
||||||
$protocol = 'https';
|
|
||||||
$ssl = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $protocol.'://' . $_SERVER['SERVER_NAME'];
|
|
||||||
|
|
||||||
if ((!$ssl && $_SERVER['SERVER_PORT'] != 80) || ($ssl && $_SERVER['SERVER_PORT'] != 443)) {
|
|
||||||
$query .= ":".$_SERVER['SERVER_PORT'];
|
|
||||||
}
|
|
||||||
$query .= $_SERVER['SCRIPT_NAME'];
|
|
||||||
|
|
||||||
if (sizeof ($_REQUEST))
|
|
||||||
//Some (old) browsers don't like the ?&key=var
|
|
||||||
$query .= '?1=1';
|
|
||||||
|
|
||||||
//We don't clean these variables up as they're only being passed along
|
|
||||||
foreach ($_GET as $key => $value) {
|
|
||||||
/* Avoid the 1=1 */
|
|
||||||
if ($key == 1)
|
|
||||||
continue;
|
|
||||||
$query .= '&'.$key.'='.$value;
|
|
||||||
}
|
|
||||||
foreach ($_POST as $key => $value) {
|
|
||||||
$query .= '&'.$key.'='.$value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$output .= '<meta http-equiv="refresh" content="'.$config["refr"].'; URL='.$query.'" />';
|
$output .= '<meta http-equiv="refresh" content="'.$config["refr"].'; URL='.$query.'" />';
|
||||||
}
|
}
|
||||||
$output .= "\n\t";
|
$output .= "\n\t";
|
||||||
|
@ -1163,4 +1130,55 @@ function get_include_contents ($filename, $params = false) {
|
||||||
|
|
||||||
return $contents;
|
return $contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct and return the URL to be used in order to refresh the current page correctly.
|
||||||
|
*
|
||||||
|
* @param bool $relative Whether to return the relative URL or the absolute URL. Returns relative by default
|
||||||
|
*/
|
||||||
|
function get_url_refresh ($relative = true) {
|
||||||
|
// Agent selection filters and refresh
|
||||||
|
global $config;
|
||||||
|
$url = '';
|
||||||
|
|
||||||
|
if (sizeof ($_REQUEST))
|
||||||
|
//Some (old) browsers don't like the ?&key=var
|
||||||
|
$url .= '?1=1';
|
||||||
|
|
||||||
|
//We don't clean these variables up as they're only being passed along
|
||||||
|
foreach ($_GET as $key => $value) {
|
||||||
|
/* Avoid the 1=1 */
|
||||||
|
if ($key == 1)
|
||||||
|
continue;
|
||||||
|
$url .= '&'.$key.'='.$value;
|
||||||
|
}
|
||||||
|
foreach ($_POST as $key => $value) {
|
||||||
|
$url .= '&'.$key.'='.$value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($relative === false) {
|
||||||
|
if ($config['https']) {
|
||||||
|
//When $config["https"] is set, always force https
|
||||||
|
$protocol = 'https';
|
||||||
|
$ssl = true;
|
||||||
|
} elseif (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
|
||||||
|
$protocol = 'https';
|
||||||
|
$ssl = true;
|
||||||
|
} else {
|
||||||
|
$protocol = 'http';
|
||||||
|
$ssl = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fullurl = $protocol.'://' . $_SERVER['SERVER_NAME'];
|
||||||
|
|
||||||
|
if ((!$ssl && $_SERVER['SERVER_PORT'] != 80) || ($ssl && $_SERVER['SERVER_PORT'] != 443)) {
|
||||||
|
$fullurl .= ":".$_SERVER['SERVER_PORT'];
|
||||||
|
}
|
||||||
|
$fullurl .= $_SERVER['SCRIPT_NAME'];
|
||||||
|
|
||||||
|
return $fullurl.$url;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -49,25 +49,21 @@ if (is_ajax ()) {
|
||||||
// Take some parameters (GET)
|
// Take some parameters (GET)
|
||||||
$offset = get_parameter ("offset", 0);
|
$offset = get_parameter ("offset", 0);
|
||||||
$group_id = get_parameter ("group_id", 0);
|
$group_id = get_parameter ("group_id", 0);
|
||||||
$ag_group = get_parameter ("ag_group", $group_id);
|
|
||||||
$ag_group = get_parameter_get ("ag_group_refresh", $ag_group); //if it isn't set, defaults to prev. value
|
|
||||||
$search = get_parameter ("search", "");
|
$search = get_parameter ("search", "");
|
||||||
|
|
||||||
echo "<h2>".__('Pandora Agents')." » ".__('Summary')."</h2>";
|
echo "<h2>".__('Pandora Agents')." » ".__('Summary')."</h2>";
|
||||||
|
|
||||||
// Show group selector (POST)
|
if ($group_id > 1) {
|
||||||
if (isset($_POST["ag_group"])){
|
echo '<form method="post" action="'.get_url_refresh ().'&group_id='.$group_id.'">';
|
||||||
$ag_group = get_parameter_post ("ag_group");
|
|
||||||
echo '<form method="post" action="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&ag_group_refresh='.$ag_group.'">';
|
|
||||||
} else {
|
} else {
|
||||||
echo '<form method="post" action="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60">';
|
echo '<form method="post" action="'.get_url_refresh ().'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<table cellpadding="4" cellspacing="4" class="databox" width="95%">';
|
echo '<table cellpadding="4" cellspacing="4" class="databox" width="95%">';
|
||||||
echo '<tr><td style="white-space:nowrap;">'.__('Group').': ';
|
echo '<tr><td style="white-space:nowrap;">'.__('Group').': ';
|
||||||
|
|
||||||
$groups = get_user_groups ();
|
$groups = get_user_groups ();
|
||||||
print_select ($groups, 'ag_group', $ag_group, 'this.form.submit()', '', '');
|
print_select ($groups, 'group_id', $group_id, 'this.form.submit()', '', '');
|
||||||
|
|
||||||
echo '</td><td style="white-space:nowrap;">';
|
echo '</td><td style="white-space:nowrap;">';
|
||||||
|
|
||||||
|
@ -88,8 +84,8 @@ if ($search != ""){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show only selected groups
|
// Show only selected groups
|
||||||
if ($ag_group > 1) {
|
if ($group_id > 1) {
|
||||||
$agent_names = get_group_agents ($ag_group, $search_sql, "upper");
|
$agent_names = get_group_agents ($group_id, $search_sql, "upper");
|
||||||
// Not selected any specific group
|
// Not selected any specific group
|
||||||
} else {
|
} else {
|
||||||
$user_group = get_user_groups ($config["id_user"], "AR");
|
$user_group = get_user_groups ($config["id_user"], "AR");
|
||||||
|
@ -97,7 +93,8 @@ if ($ag_group > 1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty ($agent_names)) {
|
if (!empty ($agent_names)) {
|
||||||
$agents = get_db_all_rows_sql (sprintf ("SELECT * FROM tagente WHERE id_agente IN (%s)", implode (",", array_keys ($agent_names))));
|
$num_agents = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente WHERE id_agente IN (%s)", implode (",", array_keys ($agent_names))));
|
||||||
|
$agents = get_db_all_rows_sql (sprintf ("SELECT * FROM tagente WHERE id_agente IN (%s) ORDER BY nombre ASC LIMIT %d,%d", implode (",", array_keys ($agent_names)), $offset, $config["block_size"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($agents)) {
|
if (empty ($agents)) {
|
||||||
|
@ -105,7 +102,7 @@ if (empty ($agents)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare pagination
|
// Prepare pagination
|
||||||
pagination (count ($agents), "index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60&search=$search", $offset);
|
pagination ($num_agents, get_url_refresh ()."&group_id=".$group_id."&search=".$search, $offset);
|
||||||
|
|
||||||
// Show data.
|
// Show data.
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
|
|
Loading…
Reference in New Issue