summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-12-27 13:58:16 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-12-27 13:58:16 +0000
commit0c61274fcf75d2fcc545b761d64d3307323afcd3 (patch)
tree33c8c74f5ddd66cde9c98bbc6f7aca8d3c46cb23 /frontends/php
parent4f6965b12e09c357d57b03fae328dcbb9d384310 (diff)
downloadzabbix-0c61274fcf75d2fcc545b761d64d3307323afcd3.tar.gz
zabbix-0c61274fcf75d2fcc545b761d64d3307323afcd3.tar.xz
zabbix-0c61274fcf75d2fcc545b761d64d3307323afcd3.zip
- [DEV-91] added printable view for pages (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5204 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/css.css24
-rw-r--r--frontends/php/hosts.php1
-rw-r--r--frontends/php/include/classes/cspan.inc.php17
-rw-r--r--frontends/php/include/classes/ctable.inc.php5
-rw-r--r--frontends/php/include/config.inc.php49
-rw-r--r--frontends/php/include/locales/en_gb.inc.php2
-rw-r--r--frontends/php/include/page_header.php16
-rw-r--r--frontends/php/include/validate.inc.php1
-rw-r--r--frontends/php/tr_status.php10
9 files changed, 110 insertions, 15 deletions
diff --git a/frontends/php/css.css b/frontends/php/css.css
index 8159aee1..57937def 100644
--- a/frontends/php/css.css
+++ b/frontends/php/css.css
@@ -12,7 +12,7 @@
body{
background-color:#e5e5e5;
- margin: 0px 0px 0px 0px;
+ margin: 0px;
padding: 0px;
color:black;
font-family:verdana, arial, helvetica, sans-serif;
@@ -20,8 +20,28 @@ body{
text-decoration: none;
line-height:16px;
}
+/**************** MEDIA *****************/
+@media print {
+ div.printless{
+ visibility: hidden;
+ display: none;
+ }
+ div.printonly{
+ display: block;
+ visibility:visible;
+ }
+}
-
+@media screen {
+ div.printless{
+ visibility:visible;
+ display:block;
+ }
+ div.printonly{
+ visibility: hidden;
+ display:none;
+ }
+}
/**************** OTHERS ****************/
.top { vertical-align: top; }
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php
index 6e3d09f6..125fc818 100644
--- a/frontends/php/hosts.php
+++ b/frontends/php/hosts.php
@@ -796,6 +796,7 @@ include_once "include/page_header.php";
$show_only_tmp ? SPACE : NULL,
$show_only_tmp ? new CButtonQMessage('delete_and_clear',S_DELETE_SELECTED_WITH_LINKED_ELEMENTS,S_DELETE_SELECTED_HOSTS_Q) : NULL
);
+
$table->SetFooter(new CCol($footerButtons));
$form->AddItem($table);
diff --git a/frontends/php/include/classes/cspan.inc.php b/frontends/php/include/classes/cspan.inc.php
index fee3f99f..9ef2e068 100644
--- a/frontends/php/include/classes/cspan.inc.php
+++ b/frontends/php/include/classes/cspan.inc.php
@@ -35,4 +35,21 @@
$this->tag_body_end = "";
}
}
+
+ class CDiv extends CTag
+ {
+/* public */
+ function CDiv($items=NULL,$class=NULL)
+ {
+ parent::CTag("div","yes");
+ $this->SetClass($class);
+ $this->AddItem($items);
+ $this->tag_body_start = "";
+
+ $this->tag_start= "";
+ $this->tag_end = "";
+ $this->tag_body_start = "";
+ $this->tag_body_end = "";
+ }
+ }
?>
diff --git a/frontends/php/include/classes/ctable.inc.php b/frontends/php/include/classes/ctable.inc.php
index b7f1fb11..4de17a2f 100644
--- a/frontends/php/include/classes/ctable.inc.php
+++ b/frontends/php/include/classes/ctable.inc.php
@@ -48,6 +48,7 @@
/* public */
function CRow($item=NULL,$class=NULL){
parent::CTag("tr","yes");
+
$this->AddItem($item);
$this->SetClass($class);
}
@@ -65,13 +66,11 @@
if(strtolower(get_class($el))=='ccol') {
parent::AddItem($el);
} elseif(!is_null($el)) {
-// parent::AddItem('<td>'.unpack_object($el).'</td>');
parent::AddItem(new CCol($el));
}
}
}
elseif(!is_null($item)){
-// parent::AddItem('<td>'.unpack_object($item).'</td>');
parent::AddItem(new CCol($item));
}
}
@@ -157,6 +156,7 @@
}
function SetHeader($value=NULL,$class=NULL){
+ if(isset($_REQUEST['print'])) hide_form_items($value);
if(is_null($class)) $class = $this->headerClass;
if(strtolower(get_class($value))=='crow') {
@@ -169,6 +169,7 @@
}
function SetFooter($value=NULL,$class=NULL){
+ if(isset($_REQUEST['print'])) hide_form_items($value);
if(is_null($class)) $class = $this->footerClass;
$this->footer = $this->PrepareRow($value,$class);
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index b0e6bdb3..2be1d66f 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1007,26 +1007,63 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
return DBexecute('update config set '.implode(',',$update).
' where '.DBin_node('configid', get_current_nodeid(false)));
}
+
+/* Function:
+ * hide_form_items()
+ *
+ * Desc:
+ * Searches items/objects for Form tags like "<input"/Form classes like CForm, and makes it empty
+ *
+ * Author:
+ * Aly
+ */
+ function hide_form_items(&$obj){
+ if(is_array($obj)){
+ foreach($obj as $id => $item){
+ hide_form_items($obj[$id]); // Attention recursion;
+ }
+ }
+ else if(is_object($obj)){
+ if(in_array(strtolower(get_class($obj)),array('cform','ccheckbox','cselect','cbutton','cbuttonqmessage','cbuttondelete','cbuttoncancel'))){
+ $obj=SPACE;
+ }
+ if(isset($obj->items) && !empty($obj->items)){
+ foreach($obj->items as $id => $item){
+ hide_form_items($obj->items[$id]); // Recursion
+ }
+ }
+ }
+ else{
+ foreach(array('<form','<input','<select') as $item){
+ if(strpos($obj,$item) !== FALSE) $obj = SPACE;
+ }
+ }
+ }
- function &get_table_header($col1, $col2=SPACE)
- {
+ function get_table_header($col1, $col2=SPACE){
+ if(isset($_REQUEST['print'])){
+ hide_form_items($col1);
+ hide_form_items($col2);
+ //if empty header than do not show it
+ if(($col1 == SPACE) && ($col2 == SPACE)) return new CScript('');
+ }
+
$table = new CTable(NULL,"header");
$table->SetCellSpacing(0);
$table->SetCellPadding(1);
$table->AddRow(array(new CCol($col1,"header_l"), new CCol($col2,"header_r")));
- return $table;
+ return $table;
}
function show_table_header($col1, $col2=SPACE)
{
- $table =& get_table_header($col1, $col2);
+ $table = get_table_header($col1, $col2);
$table->Show();
}
# Show History Graph
- function show_history($itemid,$from,$stime,$period)
- {
+ function show_history($itemid,$from,$stime,$period){
$till=date(S_DATE_FORMAT_YMDHMS,time(NULL)-$from*3600);
show_table_header(S_TILL.SPACE.$till.' ('.($period/3600).' HOURs)');
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 9ca9d8c4..6331711b 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -149,6 +149,7 @@
'S_EXPORT_BIG'=> 'EXPORT',
'S_PREVIEW'=> 'Preview',
'S_BACK'=> 'Back',
+ 'S_BACK_BIG'=> 'BACK',
'S_NO_DATA_FOR_EXPORT'=> 'No data for export',
'S_NO_DATA_SMALL'=> 'no data',
'S_RULES'=> 'Rules',
@@ -1396,6 +1397,7 @@
'S_AUDIT'=> 'Audit',
'S_LOGIN'=> 'Login',
'S_LOGOUT'=> 'Logout',
+ 'S_PRINT'=> 'Print',
'S_LATEST_DATA'=> 'Latest data',
// Errors
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index 5162c3c9..9b2cfac1 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -378,6 +378,19 @@ COpt::profiling_start("page");
define ('PAGE_HEADER_LOADED', 1);
+ if(isset($_REQUEST['print'])){
+ define('ZBX_PAGE_NO_MENU', 1);
+ $req = substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'print')-1);
+
+ $link = new CLink(bold('&laquo;'.S_BACK_BIG), $req, 'small_font');
+ $link->AddOption('style','padding-left: 10px;');
+
+ $printview = new CDiv($link,'printless');
+ $printview->AddOption('style','border: 1px #333 dotted;');
+ $printview->Show();
+
+ }
+
if(!defined('ZBX_PAGE_NO_MENU'))
{
COpt::compare_files_with_menu($ZBX_MENU);
@@ -386,8 +399,9 @@ COpt::compare_files_with_menu($ZBX_MENU);
$help->SetTarget('_blank');
$support = new CLink(S_GET_SUPPORT, "http://www.zabbix.com/support.php", "small_font");
$support->SetTarget('_blank');
+ $printview = new CLink(S_PRINT, $_SERVER['REQUEST_URI'].(empty($_GET)?'?':'&').'print=1', 'small_font');
- $page_header_r_col = array($help,array("|", $support));
+ $page_header_r_col = array($help,'|', $support,'|',$printview);
if($USER_DETAILS["alias"] != ZBX_GUEST_USER){
$page_header_r_col[] = array("|",
new CLink(S_PROFILE, "profile.php", "small_font"),"|",
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php
index 9fbb2bc1..80a923ef 100644
--- a/frontends/php/include/validate.inc.php
+++ b/frontends/php/include/validate.inc.php
@@ -545,6 +545,7 @@
"sessionid"=> array(T_ZBX_STR, O_OPT, P_SYS, HEX(),NULL),
"switch_node"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL),
"triggers_hash"=> array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY,NULL),
+ 'print'=> array(T_ZBX_INT, O_OPT, P_SYS, IN("1"),NULL),
'sort'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL,NULL),
'sortorder'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL,NULL)
);
diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php
index f4532cfa..3208fcb7 100644
--- a/frontends/php/tr_status.php
+++ b/frontends/php/tr_status.php
@@ -585,15 +585,17 @@ include_once "include/page_header.php";
unset($row,$description, $actions);
}
- zbx_add_post_js('blink.init();');
- $m_form->AddItem($table);
-
- $m_form->Additem(get_table_header(array(S_TOTAL.": ",
+ $table->SetFooter(new CCol(array(S_TOTAL.": ",
$table->GetNumRows(),
SPACE.SPACE.SPACE,
($config['event_ack_enable'])?(new CButton('bulkacknowledge',S_BULK_ACKNOWLEDGE,'javascript: submit();')):(SPACE)
)));
+
+ $m_form->AddItem($table);
$m_form->Show();
+ unset($table);
+
+ zbx_add_post_js('blink.init();');
$jsmenu = new CPUMenu(null,170);
$jsmenu->InsertJavaScript();