--- /usr/share/zabbix/js/main.js.orig 2013-10-12 15:51:48.000000000 +0200 +++ /usr/share/zabbix/js/main.js 2013-10-17 14:53:33.000000000 +0200 @@ -911,6 +911,22 @@ /* * Zabbix ajax requests */ +function update_pinned_status(pinned) { + if ('undefined' == typeof(Ajax)) { + throw('Prototype.js lib is required!'); + } + + if (typeof(pinned) == 'undefined' || empty(pinned)) { + return; + } + + var params = { + 'pinned': pinned + }; + + send_params(params); +} + function add2favorites(favobj, favid) { if ('undefined' == typeof(Ajax)) { throw('Prototype.js lib is required!'); --- /usr/share/zabbix/include/html.inc.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/include/html.inc.php. 2013-10-23 19:12:58.000000000 +0200 @@ -268,6 +268,25 @@ case 'reset': $icon = new CIcon(_('Reset'), 'iconreset', 'timeControl.objectReset();'); break; + case 'pinned': + $pinned= $params['pinned'] ? 0 : 1; + + if ($pinned) { + $title = _('Pin period'); + $class = 'iconpinunset'; + } + else { + $title = _('Unpin period'); + $class = 'iconpinset'; + } + + $icon = new CIcon( + $title, + $class, + 'update_pinned_status('.$pinned.')' + ); + $icon->setAttribute('id', 'upd_pin'); + break; } return $icon; } --- /usr/share/zabbix/include/classes/screens/CScreenBase.php.orig 2013-10-12 15:51:49.000000000 +0200 +++ /usr/share/zabbix/include/classes/screens/CScreenBase.php 2013-10-17 13:30:59.000000000 +0200 @@ -316,6 +316,10 @@ if (empty($options['profileIdx2'])) { $options['profileIdx2'] = 0; } + if (CProfile::get('web.common.pinned.set')) { + $options['profileIdx'] = 'web.common.pinned'; + $options['profileIdx2'] = 0; + } // show only latest data without update is set only period if (!empty($options['period']) && empty($options['stime'])) { @@ -343,6 +347,7 @@ } if ($options['updateProfile'] && !empty($options['profileIdx'])) { CProfile::update($options['profileIdx'].'.period', $options['period'], PROFILE_TYPE_INT, $options['profileIdx2']); + CProfile::update('web.common.pinned.period', $options['period'], PROFILE_TYPE_INT, 0); } // stime @@ -368,6 +373,8 @@ if ($options['updateProfile'] && !empty($options['profileIdx'])) { CProfile::update($options['profileIdx'].'.stime', $options['stime'], PROFILE_TYPE_STR, $options['profileIdx2']); CProfile::update($options['profileIdx'].'.isnow', $isNow, PROFILE_TYPE_STR, $options['profileIdx2']); + CProfile::update('web.common.pinned.stime', $options['stime'], PROFILE_TYPE_STR, 0); + CProfile::update('web.common.pinned.isnow', $isNow, PROFILE_TYPE_STR, 0); } } else { --- /usr/share/zabbix/host_screen.php.orig 2013-10-12 15:51:53.000000000 +0200 +++ /usr/share/zabbix/host_screen.php 2013-10-21 10:43:59.000000000 +0200 @@ -50,7 +50,8 @@ 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove','flop'"), null), - 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, null) + 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, null), + 'pinned' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, null) ); check_fields($fields); @@ -96,6 +97,23 @@ } } +if (isset($_REQUEST['pinned'])) { + if ($_REQUEST['pinned'] == 0) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Pin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(1); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinunset", "iconpinset");'; + } + elseif ($_REQUEST['pinned'] == 1) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Unpin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(0); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinset", "iconpinunset");'; + } +} else { + $_REQUEST['pinned'] = CProfile::get('web.common.pinned.set', 0); +} + if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) { require_once dirname(__FILE__).'/include/page_footer.php'; exit(); @@ -109,7 +127,8 @@ 'fullscreen' => get_request('fullscreen', 0), 'screenid' => get_request('screenid', CProfile::get('web.hostscreen.screenid', null)), 'period' => get_request('period'), - 'stime' => get_request('stime') + 'stime' => get_request('stime'), + 'pinned' => get_request('pinned') ); CProfile::update('web.hostscreen.screenid', $data['screenid'], PROFILE_TYPE_ID); --- /usr/share/zabbix/include/views/monitoring.hostscreen.php.orig 2013-10-12 15:51:49.000000000 +0200 +++ /usr/share/zabbix/include/views/monitoring.hostscreen.php 2013-10-21 10:36:24.000000000 +0200 @@ -37,7 +37,9 @@ )); } else { - $screenWidget->addPageHeader(_('SCREENS'), array(get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); + $screenWidget->addPageHeader(_('SCREENS'), array( + get_icon('pinned', array('pinned' => $this->data['pinned'])), + get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); $screenWidget->addItem(BR()); // host screen list --- /usr/share/zabbix/charts.php.orig 2013-10-12 15:51:53.000000000 +0200 +++ /usr/share/zabbix/charts.php 2013-10-17 15:28:43.000000000 +0200 @@ -49,7 +49,8 @@ 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, null), - 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove'"), null) + 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove'"), null), + 'pinned' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, null) ); check_fields($fields); @@ -100,6 +101,24 @@ } } } + +if (isset($_REQUEST['pinned'])) { + if ($_REQUEST['pinned'] == 0) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Pin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(1); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinunset", "iconpinset");'; + } + elseif ($_REQUEST['pinned'] == 1) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Unpin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(0); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinset", "iconpinunset");'; + } +} else { + $_REQUEST['pinned'] = CProfile::get('web.common.pinned.set', 0); +} + if (!empty($_REQUEST['period']) || !empty($_REQUEST['stime'])) { CScreenBase::calculateTime(array( 'profileIdx' => 'web.screens', @@ -130,7 +149,8 @@ $data = array( 'pageFilter' => $pageFilter, 'graphid' => $pageFilter->graphid, - 'fullscreen' => get_request('fullscreen') + 'fullscreen' => get_request('fullscreen'), + 'pinned' => get_request('pinned') ); // render view --- /usr/share/zabbix/include/views/monitoring.charts.php.orig 2013-10-23 19:22:38.000000000 +0200 +++ /usr/share/zabbix/include/views/monitoring.charts.php 2013-10-23 16:24:54.000000000 +0200 @@ -30,6 +30,8 @@ $chartsWidget->addPageHeader(_('Graphs'), array( get_icon('favourite', array('fav' => 'web.favorite.graphids', 'elname' => 'graphid', 'elid' => $this->data['graphid'])), SPACE, + get_icon('pinned', array('pinned' => $this->data['pinned'])), + SPACE, get_icon('reset', array('id' => $this->data['graphid'])), SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])) --- /usr/share/zabbix/screens.php.orig 2013-10-12 15:51:53.000000000 +0200 +++ /usr/share/zabbix/screens.php 2013-10-21 15:29:28.000000000 +0200 @@ -52,7 +52,8 @@ 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove','flop'"), null), - 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, null) + 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, null), + 'pinned' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, null) ); check_fields($fields); @@ -104,6 +105,23 @@ } } +if (isset($_REQUEST['pinned'])) { + if ($_REQUEST['pinned'] == 0) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Pin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(1); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinunset", "iconpinset");'; + } + elseif ($_REQUEST['pinned'] == 1) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Unpin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(0); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinset", "iconpinunset");'; + } +} else { + $_REQUEST['pinned'] = CProfile::get('web.common.pinned.set', 0); +} + if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) { require_once dirname(__FILE__).'/include/page_footer.php'; exit(); @@ -119,7 +137,8 @@ 'elementid' => get_request('elementid', false), // whether we should use screen name to fetch a screen (if this is false, elementid is used) - 'use_screen_name' => isset($_REQUEST['screenname']) + 'use_screen_name' => isset($_REQUEST['screenname']), + 'pinned' => get_request('pinned') ); // if none is provided --- /usr/share/zabbix/include/views/monitoring.screen.php.orig 2013-10-12 15:51:49.000000000 +0200 +++ /usr/share/zabbix/include/views/monitoring.screen.php 2013-10-21 13:42:27.000000000 +0200 @@ -69,6 +69,8 @@ SPACE, get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'screenid', 'elid' => $screen['screenid'])), SPACE, + get_icon('pinned', array('pinned' => $this->data['pinned'])), + SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])) )); $screenWidget->addItem(BR()); --- /usr/share/zabbix/history.php.orig 2013-10-12 15:51:53.000000000 +0200 +++ /usr/share/zabbix/history.php 2013-10-17 15:28:40.000000000 +0200 @@ -38,7 +38,7 @@ // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array( - 'itemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '!isset({favobj})'), + 'itemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '!isset({favobj})&&!isset({pinned})'), 'period' => array(T_ZBX_INT, O_OPT, null, null, null), 'dec' => array(T_ZBX_INT, O_OPT, null, null, null), 'inc' => array(T_ZBX_INT, O_OPT, null, null, null), @@ -64,7 +64,8 @@ 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_copy_to' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null), - 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, null, null) + 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), + 'pinned' => array(T_ZBX_INT, O_OPT, P_SYS, NULL, null) ); check_fields($fields); @@ -109,6 +110,23 @@ } } +if (isset($_REQUEST['pinned'])) { + if ($_REQUEST['pinned'] == 0) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Pin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(1); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinunset", "iconpinset");'; + } + elseif ($_REQUEST['pinned'] == 1) { + CProfile::update('web.common.pinned.set', $_REQUEST['pinned'], PROFILE_TYPE_INT); + echo '$("upd_pin").title = "'._('Unpin period').'";'."\n"; + echo '$("upd_pin").onclick = function() { update_pinned_status(0); }'."\n"; + echo 'switchElementsClass("upd_pin", "iconpinset", "iconpinunset");'; + } +} else { + $_REQUEST['pinned'] = CProfile::get('web.common.pinned.set', 0); +} + if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) { require_once dirname(__FILE__).'/include/page_footer.php'; exit(); @@ -167,7 +185,8 @@ 'stime' => get_request('stime'), 'plaintext' => isset($_REQUEST['plaintext']), 'iv_string' => array(ITEM_VALUE_TYPE_LOG => 1, ITEM_VALUE_TYPE_TEXT => 1), - 'iv_numeric' => array(ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1) + 'iv_numeric' => array(ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1), + 'pinned' => get_request('pinned') ); // render view --- /usr/share/zabbix/include/views/monitoring.history.php.orig 2013-10-23 19:31:26.000000000 +0200 +++ /usr/share/zabbix/include/views/monitoring.history.php 2013-10-23 19:29:29.000000000 +0200 @@ -38,6 +38,7 @@ 'elid' => $this->data['item']['itemid'], 'elname' => 'itemid' )); + $header['right'][] = get_icon('pinned', array('pinned' => $this->data['pinned'])); } } --- /usr/share/zabbix/styles/icon.css.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/styles/icon.css 2013-10-17 15:07:00.000000000 +0200 @@ -58,6 +58,8 @@ .iconsnooze { background-image: url('../images/general/bttn/snooze.png'); } .iconclose { background-image: url('../images/general/bttn/close.png'); } .iconmove { background-image: url('../images/general/bttn/move.png'); cursor: move; } +.iconpinset { background-image: url('../images/general/bttn/pinset.png'); } +.iconpinunset { background-image: url('../images/general/bttn/pinunset.png'); } .filterclosed{ height: 9px;