/usr/share/zabbix/js/class.cscreen.js is in zabbix-frontend-php 1:1.8.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /*
** ZABBIX
** Copyright (C) 2000-2009 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
// JavaScript Document
// Screen class beta
// Author: Aly
// [!CDATA[
var ZBX_SCREENS = new Array(); // screens obj reference
Position.includeScrollOffsets = true;
// screenid ALWAYS must be a STRING (js doesn't support uint64) !!!!
function init_screen(screenid, obj_id, id){
if(typeof(id) == 'undefined'){
var id = ZBX_SCREENS.length;
}
if(is_number(screenid) && (screenid > 100000000000000)){
throw('Error: Wrong type of arguments passed to function [init_screen]');
}
ZBX_SCREENS[id] = new Object;
ZBX_SCREENS[id].screen = new Cscreen(screenid, obj_id, id);
}
var Cscreen = Class.create();
Cscreen.prototype = {
id: 0, // inner js class id
screenid: 0,
dragged: 0, // element dragged or just clicked
screen_obj: null, // DOM ref to screen obj
debug_status: 0, // debug status: 0 - off, 1 - on, 2 - SDI;
debug_info: '', // debug string
initialize: function(screenid, obj_id, id){
this.debug('initialize');
this.screenid = screenid;
this.id = id;
this.screen_obj = $(obj_id);
// this.add_divs(this.screen_obj, 'td', 'draggable');
var trs = this.screen_obj.getElementsByTagName("tr");
function wedge(event){ return false }
for (var i = 0; i < trs.length; i++){
var divs = document.getElementsByClassName("draggable", trs[i]);
for (var j = 0; j < divs.length; ++j){
addListener(divs[j], 'mousedown', this.deactivate_drag.bindAsEventListener(this), false);
new Draggable(divs[j], {//revert: 'failure',
// handle:'handle'+c,
revert: true,
// function(){
// if(IE){
// Event.stopObserving(document.body, "drag", wedge, false);
// Event.stopObserving(document.body, "selectstart", wedge, false);
// }
// },
onStart: function(){
if(IE){
Event.observe(document.body, "drag", wedge, false);
Event.observe(document.body, "selectstart", wedge, false);
}
},
onEnd: this.activate_drag.bind(this)
});
}
}
var divs = document.getElementsByClassName("draggable", this.screen_obj);
for (var j = 0; j < divs.length; ++j){
Droppables.add(divs[j], {accept:'draggable',
hoverclass:'hoverclass123',
onDrop: this.on_drop.bind(this)
});
}
},
on_drop: function(element, dropon, event){
var dropon_parent = dropon.parentNode;
element.parentNode.appendChild(dropon);
dropon_parent.appendChild(element);
element.style.top = '0px';
element.style.left = '0px';
var pos = element.id.split('_');
var r1 = pos[1];
var c1 = pos[2];
pos = dropon.id.split('_');
var r2 = pos[1];
var c2 = pos[2];
var url = new Curl(location.href);
var args = url.getArguments();
for(a in args){
if(a == 'screenid') continue;
url.unsetArgument(a);
}
url.setArgument('sw_pos[0]',r1);
url.setArgument('sw_pos[1]',c1);
url.setArgument('sw_pos[2]',r2);
url.setArgument('sw_pos[3]',c2);
// url.unsetArgument('add_row');
// url.unsetArgument('add_col');
// url.unsetArgument('rmv_row');
// url.unsetArgument('rmv_col');
location.href = url.getUrl();
},
element_onclick: function(href){
if(this.dragged == 0){
location.href = href;
}
},
activate_drag: function(){
this.debug('activate_drag');
this.dragged = 1;
},
deactivate_drag: function(){
this.debug('deactivate_drag');
this.dragged = 0;
},
debug: function(str){
if(this.debug_status){
this.debug_info += str + '\n';
if(this.debug_status == 2){
SDI(str);
}
}
}
}
|