2008-10-14 Esteban Sanchez <estebans@artica.es>
* include/config_process.php: Added ENTERPRISE_DIR constant. * extensions/hello.php: Use extension better than plugin which is already used in other places. * godmode/reporting/map_builder.php: Use process_sql() to make SQL queries. * include/functions_db.php: Fixed some functions documentation. Added order_field to get_db_all_fields_in_table(). Style correction. * include/functions_extensions.php: Support to load enterprise extensions. * include/functions_reporting.php: Fixed general_stats() to returns stats also with a field name. * include/javascript/jquery.ui.core.js, include/javascript/jquery.ui.draggable.js, include/javascript/jquery.ui.droppable.js: Updated to latest version of jQuery UI. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1149 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4b1b4dc1cc
commit
5f47862a39
|
@ -1,3 +1,9 @@
|
|||
2008-10-14 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/config_process.php: Added ENTERPRISE_DIR constant.
|
||||
|
||||
*
|
||||
|
||||
2008-10-14 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* operation/reporting/reporting_viewer.php,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
function hello_extension_main () {
|
||||
/* Here you can do almost all you want! */
|
||||
echo "<h1>Hello world!</h1>";
|
||||
echo "This is a sample of minimal plugin";
|
||||
echo "This is a sample of minimal extension";
|
||||
}
|
||||
|
||||
/* This adds a option in the operation menu */
|
||||
|
|
|
@ -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 '<h3 class="suc">'.__('Created successfully').'</h3>';
|
||||
$id_layout = mysql_insert_id ();
|
||||
} else {
|
||||
echo '<h3 class="err">'.__('Not created. Error inserting data').'</h3>';
|
||||
}
|
||||
|
@ -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 '<h3 class="suc">'.__('Deleted successfully').'</h3>';
|
||||
} 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 '<h3 class="suc">'.__('Created successfully').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('Not created. Error inserting data').'</h3>';
|
||||
|
@ -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 '<h3 class="suc">'.__('Updated successfully').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('Not updated. Error updating data').'</h3>';
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<H.length;G++){if(D.options[H[G][0]]){H[G][1].apply(D.element,E)}}}},cssCache:{},css:function(D){if(C.ui.cssCache[D]){return C.ui.cssCache[D]}var E=C('<div class="ui-resizable-gen">').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)
|
||||
(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<H.length;G++){if(D.options[H[G][0]]){H[G][1].apply(D.element,E)}}}},cssCache:{},css:function(D){if(C.ui.cssCache[D]){return C.ui.cssCache[D]}var E=C('<div class="ui-gen">').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)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue