summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-06-04 12:55:26 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-06-04 12:55:26 +0000
commit9c976c3c04e8a3f9bc9f9dbbdb429d82559f58b0 (patch)
tree928b80f63c70a9b8addd26cf3d099140e5f0febd /frontends/php/include
parent16bfe6f1840d96fda7902f78a781430aa21d1e7e (diff)
- added history of last five visited pages (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@4229 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/config.inc.php71
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
-rw-r--r--frontends/php/include/page_header.php30
-rw-r--r--frontends/php/include/users.inc.php4
4 files changed, 98 insertions, 8 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 100504b4..d3b71f18 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1343,8 +1343,10 @@ $result =
}
- function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN)
- {
+/********** USER PROFILE ***********/
+
+//---------- GET USER VALUE -------------
+ function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN){
global $USER_DETAILS;
$result = $default_value;
@@ -1375,6 +1377,7 @@ $result =
return $result;
}
+//----------- ADD/EDIT USERPROFILE -------------
function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN)
{
@@ -1411,6 +1414,70 @@ $result =
}
}
+/***********************************/
+
+/************ HISTORY **************/
+ function get_user_history(){
+ $history='';
+ $delimiter = new CSpan('&raquo;','delimiter');
+ $delimiter = $delimiter->ToString();
+ for($i = 0; $i < 5; $i++){
+ if($rows = get_profile('web.history.'.$i,false)){
+ $history.= ($i>0)?($delimiter):('');
+ $url = new CLink($rows[0],$rows[1],'history');
+ $history.= SPACE.($url->ToString()).SPACE;
+ }
+ }
+ return $history;
+ }
+
+ function add_user_history($page){
+
+ $title = explode('[',$page['title']);
+ $title = $title[0];
+
+ if(!(isset($page['hist_arg']) && is_array($page['hist_arg']))){
+ return FALSE;
+ }
+
+ $url = '';
+ foreach($page['hist_arg'] as $arg){
+ if(isset($_REQUEST[$arg]) && !empty($_REQUEST[$arg])){
+ $url.=((empty($url))?('?'):('&')).$arg.'='.$_REQUEST[$arg];
+ }
+ }
+ $url = $page['file'].$url;
+
+ $curr = 0;
+ $profile = array();
+ for($i = 0; $i < 5; $i++){
+ if($history = get_profile('web.history.'.$i,false)){
+ if($history[0] != $title){
+ $profile[$curr] = $history;
+ $curr++;
+ }
+ }
+ }
+
+ $history = array($title,$url);
+
+ if($curr < 5){
+ for($i = 0; $i < $curr; $i++){
+ update_profile('web.history.'.$i,$profile[$i],PROFILE_TYPE_ARRAY);
+ }
+ $result = update_profile('web.history.'.$curr,$history,PROFILE_TYPE_ARRAY);
+ } else {
+ for($i = 1; $i < 5; $i++){
+ update_profile('web.history.'.($i-1),$profile[$i],PROFILE_TYPE_ARRAY);
+ }
+ $result = update_profile('web.history.'.(5-1),$history,PROFILE_TYPE_ARRAY);
+ }
+
+ return $result;
+ }
+
+/***********************************/
+
function insert_showhint_javascript()
{
if(defined('SHOW_HINT_SCRIPT_INSERTTED')) return;
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 16d3c185..a8ae0f53 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -1046,6 +1046,7 @@
'S_ROOT_SMALL'=> 'root',
'S_IT_SERVICE'=> 'IT service',
'S_IT_SERVICES'=> 'IT services',
+ 'S_CONFIGURATION_OF_IT_SERVICES'=> 'Configuration of IT services',
'S_SERVICE_UPDATED'=> 'Service updated',
'S_CANNOT_UPDATE_SERVICE'=> 'Cannot update service',
'S_SERVICE_ADDED'=> 'Service added',
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index 05665354..d776b53c 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -350,8 +350,8 @@ COpt::profiling_start("page");
<meta name="Author" content="ZABBIX SIA">
<script type="text/javascript" src="js/common.js"></script>
<?php
- if(isset($page['scripts'])){
- foreach($page['scripts'] as $script){
+ if(isset($page['scripts']) && is_array($page['scripts'])){
+ foreach($page['scripts'] as $id => $script){
if(file_exists('js/'.$script)){
echo ' <script type="text/javascript" src="js/'.$script.'"></script>'."\n";
} elseif(file_exists($script)){
@@ -428,10 +428,10 @@ COpt::compare_files_with_menu($ZBX_MENU);
$table = new CTable();
$table->SetCellSpacing(0);
$table->SetCellPadding(0);
- $table->options['style'] = "width: 100%;";
+ $table->AddOption('style','width: 100%;');
$r_col = new CCol($node_form);
- $r_col->options['style'] = "text-align: right;";
+ $r_col->AddOption('style','text-align: right;');
$table->AddRow(array($menu_table,$r_col));
$table->Show();
@@ -440,9 +440,29 @@ COpt::compare_files_with_menu($ZBX_MENU);
$sub_menu_table->SetCellSpacing(0);
$sub_menu_table->SetCellPadding(5);
$sub_menu_table->AddRow(new CCol($sub_menu_row));
-
$sub_menu_table->Show();
}
+//------------------------------------- <HISTORY> ---------------------------------------
+ if(isset($page['hist_arg'])){
+ $table = new CTable();
+ $table->SetClass('history');
+
+ $table->SetCellSpacing(0);
+ $table->SetCellPadding(0);
+
+ $history = get_user_history();
+ add_user_history($page);
+
+ $tr = new CRow(new CCol('History:','caption'));
+ $tr->AddItem($history);
+
+ $table->AddRow($tr);
+ $table->Show();
+ } else {
+ echo BR;
+ }
+//------------------------------------ </HISTORY> ---------------------------------------
+
unset($ZBX_MENU);
unset($table, $top_page_row, $menu_table, $node_form);
diff --git a/frontends/php/include/users.inc.php b/frontends/php/include/users.inc.php
index 8cf885bf..79e00d29 100644
--- a/frontends/php/include/users.inc.php
+++ b/frontends/php/include/users.inc.php
@@ -134,7 +134,8 @@
return $result;
}
- # Update User Profile
+
+ # Update User definition
function update_user_profile($userid,$passwd, $url,$autologout,$lang,$refresh)
{
@@ -187,6 +188,7 @@
/* error("No user with id [$userid]"); */
return false;
}
+
/**************************
USER GROUPS