\' */
str_replace("\n", '\n', /* LF => \n */
str_replace("\\", "\\\\", /* \ => \\ */
str_replace("\r", '', /* CR => remove */
($value))))).'\'';
if(is_null($value)) return 'null';
return strval($value);
}
if(count($value) == 0) return '[]';
foreach($value as $id => $v)
{
if(!isset($is_object) && is_string($id)) $is_object = true;
$value[$id] = (isset($is_object) ? '\''.$id.'\' : ' : '').zbx_jsvalue($v);
}
if(isset($is_object))
return '{'.implode(',',$value).'}';
else
return '['.implode(',',$value).']';
}
/* function:
* zbx_add_post_js
*
* description:
* add JavaScript for calling after page loaging.
*
* author: Eugene Grigorjev
*/
function zbx_add_post_js($script)
{
global $ZBX_PAGE_POST_JS;
$ZBX_PAGE_POST_JS[] = $script;
}
function get_js_sizeable_graph($dom_graph_id,$url){
return new CScript('
');
}
function get_dynamic_chart($dom_graph_id,$img_src,$width=0){
if(is_int($width) && $width > 0) $img_src.= url_param($width, false, 'width');
$result = new CScript('
');
return $result;
}
function inseret_javascript_for_editable_combobox(){
if(defined('EDITABLE_COMBOBOX_SCRIPT_INSERTTED')) return;
define('EDITABLE_COMBOBOX_SCRIPT_INSERTTED', 1);
$js = 'function CEditableComboBoxInit(obj){
var opt = obj.options;
if(obj.value) obj.oldValue = obj.value;
for (var i = 0; i < opt.length; i++)
if (-1 == opt.item(i).value)
return;
opt = document.createElement("option");
opt.value = -1;
opt.text = "(other ...)";
if(!obj.options.add)
obj.insertBefore(opt, obj.options.item(0));
else
obj.options.add(opt, 0);
return;
}
function CEditableComboBoxOnChange(obj,size){
if(-1 != obj.value){
obj.oldValue = obj.value;
}
else{
var new_obj = document.createElement("input");
new_obj.type = "text";
new_obj.name = obj.name;
if(size && size > 0){
new_obj.size = size;
}
new_obj.className = obj.className;
if(obj.oldValue) new_obj.value = obj.oldValue;
obj.parentNode.replaceChild(new_obj, obj);
new_obj.focus();
new_obj.select();
}
}';
insert_js($js);
}
function insert_showhint_javascript(){
global $page;
if(defined('SHOW_HINT_SCRIPT_INSERTTED') || (PAGE_TYPE_HTML != $page['type'])) return;
define('SHOW_HINT_SCRIPT_INSERTTED', 1);
echo '';
}
function redirect($url,$timeout=null){
zbx_flush_post_cookies();
echo '';
}
function simple_js_redirect($url,$timeout=null){
echo '';
}
function play_sound($filename){
echo '';
}
function SetFocus($frm_name, $fld_name){
echo '';
}
function Alert($msg){
echo '';
}
function insert_js_function($fnct_name){
switch($fnct_name){
case 'add_item_variable':
echo '';
break;
default:
break;
}
}
function insert_js($script){
print('');
}
?>