diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d023c616ac..3db46a92f7 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2008-10-14 Esteban Sanchez + + * include/config_process.php: Added ENTERPRISE_DIR constant. + + * + 2008-10-14 Esteban Sanchez * operation/reporting/reporting_viewer.php, diff --git a/pandora_console/extensions/hello.php b/pandora_console/extensions/hello.php index fb682d6220..841928b507 100644 --- a/pandora_console/extensions/hello.php +++ b/pandora_console/extensions/hello.php @@ -21,7 +21,7 @@ function hello_extension_main () { /* Here you can do almost all you want! */ echo "

Hello world!

"; - echo "This is a sample of minimal plugin"; + echo "This is a sample of minimal extension"; } /* This adds a option in the operation menu */ diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 4a6f6b8cc1..f979b17171 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -62,10 +62,9 @@ if ($create_layout) { $sql = sprintf ('INSERT INTO tlayout (name, id_group, background, height, width) VALUES ("%s", %d, "%s", %d, %d)', $name, $id_group, $background, $height, $width); - $result = mysql_query ($sql); - if ($result) { + $id_layout = process_sql ($sql, 'insert-id'); + if ($result !== false) { echo '

'.__('Created successfully').'

'; - $id_layout = mysql_insert_id (); } else { echo '

'.__('Not created. Error inserting data').'

'; } @@ -76,9 +75,9 @@ if ($create_layout) { if ($delete_layout) { $sql = sprintf ('DELETE FROM tlayout_data WHERE id_layout = %d', $id_layout); - mysql_query ($sql); + process_sql ($sql); $sql = sprintf ('DELETE FROM tlayout WHERE id = %d', $id_layout); - $result = mysql_query ($sql); + $result = process_sql ($sql); if ($result) { echo '

'.__('Deleted successfully').'

'; } else { @@ -161,9 +160,9 @@ if ($create_layout_data) { $layout_data_id_agent_module, $layout_data_parent_item, $layout_data_period * 3600, $layout_data_width, $layout_data_height); - $result = mysql_query ($sql); + $result = process_sql ($sql, 'insert-id'); - if ($result) { + if ($result !== false) { echo '

'.__('Created successfully').'

'; } else { echo '

'.__('Not created. Error inserting data').'

'; @@ -182,7 +181,7 @@ if ($update_layout_data_coords) { pos_x = %d, pos_y = %d WHERE id = %d', $layout_data_x, $layout_data_y, $id_layout_data); - $result = mysql_query ($sql); + process_sql ($sql); if (defined ('AJAX')) { exit; @@ -195,10 +194,10 @@ if ($delete_layout_data) { foreach ($ids_layout_data as $id_layout_data) { $sql = sprintf ('UPDATE tlayout_data SET parent_item = 0 WHERE parent_item = %d', $id_layout_data); - $result = mysql_query ($sql); + process_sql ($sql); $sql = sprintf ('DELETE FROM tlayout_data WHERE id = %d', $id_layout_data); - $result = mysql_query ($sql); + process_sql ($sql); } if (defined ('AJAX')) { @@ -235,9 +234,9 @@ if ($update_layout_data) { $layout_data_map_linked, $layout_data_width, $layout_data_height, $id_layout_data); - $result = mysql_query ($sql); + $result = process_sql ($sql); - if ($result) { + if ($result !== false) { echo '

'.__('Updated successfully').'

'; } else { echo '

'.__('Not updated. Error updating data').'

'; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index aecc45fbd1..78f0e7e945 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -98,6 +98,9 @@ if ($config["language"] == 'ast_es') { if (! defined ('EXTENSIONS_DIR')) define ('EXTENSIONS_DIR', 'extensions'); +if (! defined ('ENTERPRISE_DIR')) + define ('ENTERPRISE_DIR', 'enterprise'); + require_once ('functions_extensions.php'); $config['extensions'] = get_extensions (); diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 0e78703dfe..36ec63e1a0 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1008,7 +1008,7 @@ function give_agentmodule_flag ($id_agent_module) { */ function list_group ($id_user, $show_all = 1){ $mis_grupos = array (); // Define array mis_grupos to put here all groups with Agent Read permission - $sql = 'SELECT id_grupo, nombre FROM tgrupo'; + $sql = 'SELECT id_grupo, nombre FROM tgrupo ORDER BY nombre'; $result = get_db_all_rows_sql ($sql); if (!$result) return $mis_grupos; @@ -1033,7 +1033,7 @@ function list_group ($id_user, $show_all = 1){ */ function list_group2 ($id_user) { $mis_grupos = array (); // Define array mis_grupos to put here all groups with Agent Read permission - $result = get_db_all_fields_in_table ("tgrupo","id_grupo"); + $result = get_db_all_fields_in_table ("tgrupo", "id_grupo"); if (!$result) return $mis_grupos; foreach ($result as $row) { @@ -1054,12 +1054,12 @@ function list_group2 ($id_user) { */ function list_users ($order = "nombre_real") { switch ($order) { - case "id_usuario": - case "fecha_registro": - case "nombre_real": - break; - default: - $order = "nombre_real"; + case "id_usuario": + case "fecha_registro": + case "nombre_real": + break; + default: + $order = "nombre_real"; } $output = array(); @@ -1380,7 +1380,7 @@ function get_db_row ($table, $field_search, $condition) { * * @param sql SQL statement to execute * @param field Field number to get, beggining by 0. Default: 0 - * @param cache Cache the query while generating this page. Default: 1 + * * @return The selected field of the first row in a select statement. */ function get_db_sql ($sql, $field = 0) { @@ -1417,9 +1417,9 @@ function get_db_all_rows_sql ($sql) { * @param $sql SQL statement to execute * * @param $rettype (optional) What type of info to return in case of INSERT/UPDATE. - * insert_id will return the ID of an autoincrement value - * info will return the full (debug) information of a query - * default will return mysql_affected_rows + * 'affected_rows' will return mysql_affected_rows (default value) + * 'insert_id' will return the ID of an autoincrement value + * 'info' will return the full (debug) information of a query * * @return An array with the rows, columns and values in a multidimensional array */ @@ -1461,6 +1461,7 @@ function process_sql ($sql, $rettype = "affected_rows") { * Get all the rows in a table of the database. * * @param $table Database table name. + * @param $order_field Field to order by. * * @return A matrix with all the values in the table */ @@ -1478,6 +1479,7 @@ function get_db_all_rows_in_table ($table, $order_field = "") { * @param $table Database table name. * @param $field Field of the table. * @param $condition Condition the field must have to be selected. + * @param $order_field Field to order by. * * @return A matrix with all the values in the table that matches the condition in the field */ @@ -1491,7 +1493,7 @@ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field } if ($order_field != "") - $sql .= sprintf(" ORDER BY %s",$order_field); + $sql .= sprintf (" ORDER BY %s", $order_field); return get_db_all_rows_sql ($sql); } @@ -1504,11 +1506,15 @@ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field * * @return A matrix with all the values in the table that matches the condition in the field */ -function get_db_all_fields_in_table ($table, $field, $condition='') { +function get_db_all_fields_in_table ($table, $field, $condition = '', $order_field = '') { $sql = sprintf ("SELECT * FROM `%s`", $table); - if($condition != '') { + if ($condition != '') { $sql .= sprintf (" WHERE `%s` = '%s'", $field, $condition); } + + if ($order_field != "") + $sql .= sprintf (" ORDER BY %s", $order_field); + return get_db_all_rows_sql ($sql); } @@ -1519,14 +1525,13 @@ function get_db_all_fields_in_table ($table, $field, $condition='') { * * @return True if there were alerts fired. */ -function return_status_agent_module ($id_agentmodule = 0){ - $sql = sprintf ('SELECT `estado` FROM `tagente_estado` WHERE `id_agente_modulo` = %d', $id_agentmodule); - $estado = get_db_sql($sql); - if ($estado == 100) { +function return_status_agent_module ($id_agentmodule = 0) { + $status = get_db_vakye ('estado', 'tagente_estado', 'id_agente_modulo', $id_agentmodule); + if ($status == 100) { // We need to check if there are any alert on this item - $sql = sprintf ('SELECT SUM(times_fired) FROM `talerta_agente_modulo` WHERE `id_agente_modulo` = %d', $id_agentmodule); - $times_fired = get_db_sql($sql); - if ($times_fired > 0){ + $times_fired = get_db_value ('SUM(times_fired)', 'talerta_agente_modulo', + 'id_agente_modulo', $id_agentmodule); + if ($times_fired > 0) { return 0; } // No alerts fired for this agent module @@ -1581,7 +1586,8 @@ function return_status_layout ($id_layout = 0) { * @return */ function return_value_agent_module ($id_agentmodule) { - return format_numeric (get_db_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_agentmodule)); + return format_numeric (get_db_value ('datos', 'tagente_estado', + 'id_agente_modulo', $id_agentmodule)); } /** diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index 2adc7c7cdd..094440edd5 100644 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -57,8 +57,11 @@ function is_extension ($page) { return isset ($config['extensions'][$filename]); } -function get_extensions () { - $handle = @opendir (EXTENSIONS_DIR); +function get_extensions ($enterprise = false) { + $dir = EXTENSIONS_DIR; + if ($enterprise) + $dir = ENTERPRISE_DIR.'/'.EXTENSIONS_DIR; + $handle = @opendir ($dir); if (! $handle) { return; } @@ -70,7 +73,7 @@ function get_extensions () { $file = readdir ($handle); continue; } - $filepath = realpath (EXTENSIONS_DIR."/".$file); + $filepath = realpath ($dir."/".$file); if (! is_readable ($filepath) || is_dir ($filepath) || ! preg_match ("/.*\.php$/", $filepath)) { $file = readdir ($handle); continue; @@ -81,9 +84,16 @@ function get_extensions () { $extension['main_function'] = ''; $extension['godmode_function'] = ''; $extension['login_function'] = ''; + $extension['enterprise'] = $enterprise; + $extension['dir'] = $dir; $extensions[$file] = $extension; $file = readdir ($handle); } + + /* Load extensions in enterprise directory */ + if (! $enterprise && file_exists (ENTERPRISE_DIR.'/'.EXTENSIONS_DIR)) + return array_merge ($extensions, get_extensions (true)); + return $extensions; } @@ -93,7 +103,7 @@ function load_extensions ($extensions) { foreach ($extensions as $extension) { $extension_file = $extension['file']; - include_once (realpath (EXTENSIONS_DIR."/".$extension_file)); + include_once (realpath ($extension['dir']."/".$extension_file)); } } @@ -105,8 +115,8 @@ function add_operation_menu_option ($name) { be called before any function the extension call, we are sure it will be set. */ $option_menu['name'] = substr ($name, 0, 15); - $option_menu['sec2'] = EXTENSIONS_DIR.'/'.substr ($extension_file, 0, -4); $extension = &$config['extensions'][$extension_file]; + $option_menu['sec2'] = $extension['dir'].'/'.substr ($extension_file, 0, -4); $extension['operation_menu'] = $option_menu; } @@ -119,8 +129,8 @@ function add_godmode_menu_option ($name, $acl) { be set. */ $option_menu['acl'] = $acl; $option_menu['name'] = substr ($name, 0, 15); - $option_menu['sec2'] = EXTENSIONS_DIR.'/'.substr ($extension_file, 0, -4); $extension = &$config['extensions'][$extension_file]; + $option_menu['sec2'] = $extension['dir'].'/'.substr ($extension_file, 0, -4); $extension['godmode_menu'] = $option_menu; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 6adf1c9274..b99ca626bb 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -211,20 +211,21 @@ function general_stats ($id_user, $id_group = 0) { } } - $data = array(); - $data[0] = $monitor_checks; - $data[1] = $monitor_ok; - $data[2] = $monitor_bad; - $data[3] = $monitor_unknown; - $data[4] = $monitor_alert; - $data[5] = $total_agents; - $data[6] = $data_checks; - $data[7] = $data_unknown; - $data[8] = $data_alert; - $data[9] = $data_alert_total; - $data[10] = $monitor_alert_total; - $data[11] = $data_not_init; - $data[12] = $monitor_not_init; + $data = array (); + $data[0] = $data['monitor_checks'] = $monitor_checks; + $data[1] = $data['monitor_ok'] = $monitor_ok; + $data[2] = $data['monitor_bad'] = $monitor_bad; + $data[3] = $data['monitor_unknown'] = $monitor_unknown; + $data[4] = $data['monitor_alert'] = $monitor_alert; + $data[5] = $data['total_agents'] = $total_agents; + $data[6] = $data['data_checks'] = $data_checks; + $data[7] = $data['data_unknown'] = $data_unknown; + $data[8] = $data['data_alert'] = $data_alert; + $data[9] = $data['data_alert_total'] = $data_alert_total; + $data[10] = $data['monitor_alert_total'] = $monitor_alert_total; + $data[11] = $data['data_not_iniv'] = $data_not_init; + $data[12] = $data['monitor_not_init'] = $monitor_not_init; + return $data; } diff --git a/pandora_console/include/javascript/jquery.ui.core.js b/pandora_console/include/javascript/jquery.ui.core.js index d459c8668e..0c00b1a43c 100644 --- a/pandora_console/include/javascript/jquery.ui.core.js +++ b/pandora_console/include/javascript/jquery.ui.core.js @@ -1 +1 @@ -(function(C){C.ui={plugin:{add:function(E,F,H){var G=C.ui[E].prototype;for(var D in H){G.plugins[D]=G.plugins[D]||[];G.plugins[D].push([F,H[D]])}},call:function(D,F,E){var H=D.plugins[F];if(!H){return }for(var G=0;G').addClass(D).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[D]=!!((!(/auto|default/).test(E.css("cursor"))||(/^[1-9]/).test(E.css("height"))||(/^[1-9]/).test(E.css("width"))||!(/none/).test(E.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));try{C("body").get(0).removeChild(E.get(0))}catch(F){}return C.ui.cssCache[D]},disableSelection:function(D){D.unselectable="on";D.onselectstart=function(){return false};if(D.style){D.style.MozUserSelect="none"}},enableSelection:function(D){D.unselectable="off";D.onselectstart=function(){return true};if(D.style){D.style.MozUserSelect=""}},hasScroll:function(G,E){var D=/top/.test(E||"top")?"scrollTop":"scrollLeft",F=false;if(G[D]>0){return true}G[D]=1;F=G[D]>0?true:false;G[D]=0;return F}};var B=C.fn.remove;C.fn.remove=function(){C("*",this).add(this).trigger("remove");return B.apply(this,arguments)};function A(E,F,G){var D=C[E][F].getter||[];D=(typeof D=="string"?D.split(/,?\s+/):D);return(C.inArray(G,D)!=-1)}C.widget=function(E,D){var F=E.split(".")[0];E=E.split(".")[1];C.fn[E]=function(J){var H=(typeof J=="string"),I=Array.prototype.slice.call(arguments,1);if(H&&A(F,E,J)){var G=C.data(this[0],E);return(G?G[J].apply(G,I):undefined)}return this.each(function(){var K=C.data(this,E);if(H&&K&&C.isFunction(K[J])){K[J].apply(K,I)}else{if(!H){C.data(this,E,new C[F][E](this,J))}}})};C[F][E]=function(I,H){var G=this;this.widgetName=E;this.widgetBaseClass=F+"-"+E;this.options=C.extend({disabled:false},C[F][E].defaults,H);this.element=C(I).bind("setData."+E,function(L,J,K){return G.setData(J,K)}).bind("getData."+E,function(K,J){return G.getData(J)}).bind("remove",function(){return G.destroy()});this.init()};C[F][E].prototype=C.extend({},C.widget.prototype,D)};C.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(D){return this.options[D]},setData:function(D,E){this.options[D]=E;if(D=="disabled"){this.element[E?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};C.ui.mouse={mouseInit:function(){var D=this;this.element.bind("mousedown."+this.widgetName,function(E){return D.mouseDown(E)});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(F){(this._mouseStarted&&this.mouseUp(F));this._mouseDownEvent=F;var E=this,G=(F.which==1),D=(typeof this.options.cancel=="string"?C(F.target).is(this.options.cancel):false);if(!G||D||!this.mouseCapture(F)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(F)&&this.mouseDelayMet(F)){this._mouseStarted=(this.mouseStart(F)!==false);if(!this._mouseStarted){F.preventDefault();return true}}this._mouseMoveDelegate=function(H){return E.mouseMove(H)};this._mouseUpDelegate=function(H){return E.mouseUp(H)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(D){if(C.browser.msie&&!D.button){return this.mouseUp(D)}if(this._mouseStarted){this.mouseDrag(D);return false}if(this.mouseDistanceMet(D)&&this.mouseDelayMet(D)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,D)!==false);(this._mouseStarted?this.mouseDrag(D):this.mouseUp(D))}return !this._mouseStarted},mouseUp:function(D){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(D)}return false},mouseDistanceMet:function(D){return(Math.max(Math.abs(this._mouseDownEvent.pageX-D.pageX),Math.abs(this._mouseDownEvent.pageY-D.pageY))>=this.options.distance)},mouseDelayMet:function(D){return this._mouseDelayMet},mouseStart:function(D){},mouseDrag:function(D){},mouseStop:function(D){},mouseCapture:function(D){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery) \ No newline at end of file +(function(C){C.ui={plugin:{add:function(E,F,H){var G=C.ui[E].prototype;for(var D in H){G.plugins[D]=G.plugins[D]||[];G.plugins[D].push([F,H[D]])}},call:function(D,F,E){var H=D.plugins[F];if(!H){return }for(var G=0;G').addClass(D).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[D]=!!((!(/auto|default/).test(E.css("cursor"))||(/^[1-9]/).test(E.css("height"))||(/^[1-9]/).test(E.css("width"))||!(/none/).test(E.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));try{C("body").get(0).removeChild(E.get(0))}catch(F){}return C.ui.cssCache[D]},disableSelection:function(D){C(D).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(D){C(D).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(G,E){var D=/top/.test(E||"top")?"scrollTop":"scrollLeft",F=false;if(G[D]>0){return true}G[D]=1;F=G[D]>0?true:false;G[D]=0;return F}};var B=C.fn.remove;C.fn.remove=function(){C("*",this).add(this).triggerHandler("remove");return B.apply(this,arguments)};function A(E,F,G){var D=C[E][F].getter||[];D=(typeof D=="string"?D.split(/,?\s+/):D);return(C.inArray(G,D)!=-1)}C.widget=function(E,D){var F=E.split(".")[0];E=E.split(".")[1];C.fn[E]=function(J){var H=(typeof J=="string"),I=Array.prototype.slice.call(arguments,1);if(H&&A(F,E,J)){var G=C.data(this[0],E);return(G?G[J].apply(G,I):undefined)}return this.each(function(){var K=C.data(this,E);if(H&&K&&C.isFunction(K[J])){K[J].apply(K,I)}else{if(!H){C.data(this,E,new C[F][E](this,J))}}})};C[F][E]=function(I,H){var G=this;this.widgetName=E;this.widgetBaseClass=F+"-"+E;this.options=C.extend({},C.widget.defaults,C[F][E].defaults,H);this.element=C(I).bind("setData."+E,function(L,J,K){return G.setData(J,K)}).bind("getData."+E,function(K,J){return G.getData(J)}).bind("remove",function(){return G.destroy()});this.init()};C[F][E].prototype=C.extend({},C.widget.prototype,D)};C.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(D){return this.options[D]},setData:function(D,E){this.options[D]=E;if(D=="disabled"){this.element[E?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};C.widget.defaults={disabled:false};C.ui.mouse={mouseInit:function(){var D=this;this.element.bind("mousedown."+this.widgetName,function(E){return D.mouseDown(E)});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(F){(this._mouseStarted&&this.mouseUp(F));this._mouseDownEvent=F;var E=this,G=(F.which==1),D=(typeof this.options.cancel=="string"?C(F.target).parents().add(F.target).filter(this.options.cancel).length:false);if(!G||D||!this.mouseCapture(F)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(F)&&this.mouseDelayMet(F)){this._mouseStarted=(this.mouseStart(F)!==false);if(!this._mouseStarted){F.preventDefault();return true}}this._mouseMoveDelegate=function(H){return E.mouseMove(H)};this._mouseUpDelegate=function(H){return E.mouseUp(H)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(D){if(C.browser.msie&&!D.button){return this.mouseUp(D)}if(this._mouseStarted){this.mouseDrag(D);return false}if(this.mouseDistanceMet(D)&&this.mouseDelayMet(D)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,D)!==false);(this._mouseStarted?this.mouseDrag(D):this.mouseUp(D))}return !this._mouseStarted},mouseUp:function(D){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(D)}return false},mouseDistanceMet:function(D){return(Math.max(Math.abs(this._mouseDownEvent.pageX-D.pageX),Math.abs(this._mouseDownEvent.pageY-D.pageY))>=this.options.distance)},mouseDelayMet:function(D){return this._mouseDelayMet},mouseStart:function(D){},mouseDrag:function(D){},mouseStop:function(D){},mouseCapture:function(D){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery) \ No newline at end of file diff --git a/pandora_console/include/javascript/jquery.ui.draggable.js b/pandora_console/include/javascript/jquery.ui.draggable.js index f4610f037d..4ab9155646 100644 --- a/pandora_console/include/javascript/jquery.ui.draggable.js +++ b/pandora_console/include/javascript/jquery.ui.draggable.js @@ -1 +1 @@ -(function(A){A.widget("ui.draggable",A.extend(A.ui.mouse,{init:function(){var B=this.options;if(B.helper=="original"&&!(/(relative|absolute|fixed)/).test(this.element.css("position"))){this.element.css("position","relative")}this.element.addClass("ui-draggable");(B.disabled&&this.element.addClass("ui-draggable-disabled"));this.mouseInit()},mouseStart:function(F){var H=this.options;if(this.helper||H.disabled||A(F.target).is(".ui-resizable-handle")){return false}var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==F.target){C=true}});if(!C){return false}if(A.ui.ddmanager){A.ui.ddmanager.current=this}this.helper=A.isFunction(H.helper)?A(H.helper.apply(this.element[0],[F])):(H.helper=="clone"?this.element.clone():this.element);if(!this.helper.parents("body").length){this.helper.appendTo((H.appendTo=="parent"?this.element[0].parentNode:H.appendTo))}if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position"))){this.helper.css("position","absolute")}this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:F.pageX-this.offset.left,top:F.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&A.browser.mozilla){B={top:0,left:0}}this.offset.parent={top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var E=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:E.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:E.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(F);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(H.cursorAt){if(H.cursorAt.left!=undefined){this.offset.click.left=H.cursorAt.left+this.margins.left}if(H.cursorAt.right!=undefined){this.offset.click.left=this.helperProportions.width-H.cursorAt.right+this.margins.left}if(H.cursorAt.top!=undefined){this.offset.click.top=H.cursorAt.top+this.margins.top}if(H.cursorAt.bottom!=undefined){this.offset.click.top=this.helperProportions.height-H.cursorAt.bottom+this.margins.top}}if(H.containment){if(H.containment=="parent"){H.containment=this.helper[0].parentNode}if(H.containment=="document"||H.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(H.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(A(H.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(H.containment)){var D=A(H.containment)[0];var G=A(H.containment).offset();this.containment=[G.left+(parseInt(A(D).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,G.top+(parseInt(A(D).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,G.left+Math.max(D.scrollWidth,D.offsetWidth)-(parseInt(A(D).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),G.top+Math.max(D.scrollHeight,D.offsetHeight)-(parseInt(A(D).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}}this.propagate("start",F);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(A.ui.ddmanager&&!H.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,F)}this.helper.addClass("ui-draggable-dragging");this.mouseDrag(F);return true},convertPositionTo:function(C,D){if(!D){D=this.position}var B=C=="absolute"?1:-1;return{top:(D.top+this.offset.relative.top*B+this.offset.parent.top*B-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*B+(this.cssPosition=="fixed"?this.offsetParent[0].scrollTop:0)*B+this.margins.top*B),left:(D.left+this.offset.relative.left*B+this.offset.parent.left*B-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*B+(this.cssPosition=="fixed"?this.offsetParent[0].scrollLeft:0)*B+this.margins.left*B)}},generatePosition:function(E){var F=this.options;var B={top:(E.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)-(this.cssPosition=="fixed"?this.offsetParent[0].scrollTop:0)),left:(E.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)-(this.cssPosition=="fixed"?this.offsetParent[0].scrollLeft:0))};if(!this.originalPosition){return B}if(this.containment){if(B.leftthis.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(F.grid){var D=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/F.grid[1])*F.grid[1];B.top=this.containment?(!(Dthis.containment[3])?D:(!(Dthis.containment[2])?C:(!(C').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(C,B){A("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","scroll",{start:function(D,C){var E=C.options;var B=A(this).data("draggable");E.scrollSensitivity=E.scrollSensitivity||20;E.scrollSpeed=E.scrollSpeed||20;B.overflowY=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-y"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);B.overflowX=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-x"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){B.overflowYOffset=B.overflowY.offset()}if(B.overflowX[0]!=document&&B.overflowX[0].tagName!="HTML"){B.overflowXOffset=B.overflowX.offset()}},drag:function(D,C){var E=C.options;var B=A(this).data("draggable");if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){if((B.overflowYOffset.top+B.overflowY[0].offsetHeight)-D.pageY=0;H--){var E=I.snapElements[H].left,B=E+I.snapElements[H].width,R=I.snapElements[H].top,M=R+I.snapElements[H].height;if(!((E-Lthis.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(F.grid){var D=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/F.grid[1])*F.grid[1];B.top=this.containment?(!(Dthis.containment[3])?D:(!(Dthis.containment[2])?C:(!(C').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(C,B){A("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","scroll",{start:function(D,C){var E=C.options;var B=A(this).data("draggable");E.scrollSensitivity=E.scrollSensitivity||20;E.scrollSpeed=E.scrollSpeed||20;B.overflowY=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-y"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);B.overflowX=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-x"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){B.overflowYOffset=B.overflowY.offset()}if(B.overflowX[0]!=document&&B.overflowX[0].tagName!="HTML"){B.overflowXOffset=B.overflowX.offset()}},drag:function(D,C){var E=C.options;var B=A(this).data("draggable");if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){if((B.overflowYOffset.top+B.overflowY[0].offsetHeight)-D.pageY=0;H--){var E=I.snapElements[H].left,B=E+I.snapElements[H].width,R=I.snapElements[H].top,M=R+I.snapElements[H].height;if(!((E-L=K&&I<=G)||(H>=K&&H<=G)||(IG))&&((D>=E&&D<=B)||(C>=E&&C<=B)||(DB));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(D,F){var B=A.ui.ddmanager.droppables;var E=F?F.type:null;for(var C=0;C=K&&I<=G)||(H>=K&&H<=G)||(IG))&&((D>=E&&D<=B)||(C>=E&&C<=B)||(DB));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(D,F){var B=A.ui.ddmanager.droppables;var E=F?F.type:null;for(var C=0;C