pandorafms/pandora_console/include/javascript/jquery.timeentry.js

7 lines
15 KiB
JavaScript
Raw Normal View History

2008-06-17 Esteban Sanchez <estebans@artica.es> * ajax.php: Added to repository. AJAX interface for Pandora. A new time is coming... * pandoradb.sql: Added id_group to treport. A report is now assigned to a group of agents. Changes in treport_content to add an order field, drop sla fields and use an enum for the type. NOTE: This will break all your current defined reports, update under your responsabillity. Added table treport_content_sla_combined to define SLAs in the SLA types reports. * godmode/reporting/graph_builder.php: Use Pandora functions. Adde javascript code to display the module icon when changing from the dropdown menu. * godmode/reporting/reporting_builder.php: Almost complet rewritten to use Pandora HTML functions. Style correction. * include/functions.php: Added new report types. Style correction. * include/functions_db.php: Use Pandora database functions to get simple values. Added functions get_agents_in_group(), get_modules_in_agent(), get_simple_alerts_in_agent(), get_combined_alerts_in_agent(), get_alerts_in_agent(), get_monitor_downs_in_period(), get_monitor_last_down_timestamp_in_period(), get_alert_fires_in_period(), get_alert_last_fire_timestamp_in_period(). Deleted debug output and fixed calling to an inexistent function in return_moduledata_sum_value(). * include/functions_html.php: Tab style correction. Thanks to Ramon for the advice. Fixed some errors on print_table that was causing not to work fine if rowclass or colspan was defined. * include/functions_reporting.php: Adde date support to return_module_SLA(), event_reporting(). Added alert_reporting(), monitor_health_reporting(), general_group_reporting() and agents_detailed_reporting() to implement new report types. Style correction. * include/javascript/pandora.js: Added html_entity_decode() function to decode some AJAX results. * javascript/jquery.js: Added to repository. jQuery version 1.2.4a * include/javascript/jquery.timeentry.js: jQuery plugin to manage time inputs. * include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage date inputs in a dropdown calendar. * include/languages/date_*.js, include/languages/time_*.js: Added to repository. Translation of date and time strings for the new calendar javascript support. * include/languages/language_en.php: Added new strings relatives to reports. * include/languages/language_de.php, include/languages/language_fr.php, include/languages/language_gl.php, include/languages/language_pt_br.php: Fixed a variable name. * godmode/groups/group_list.php: Avoid the use of an extra indentation by returning if no success on comprueba_login(). * include/styles/pandora.css: Add some classes. Tab style correction. * operation/agentes/ver_agente.php: Added AJAX support to agent operations. * operation/reporting/graph_viewer.php: Period dropdown selection improved and printed with Pandora functions. * operation/reporting/reporting_viewer.php: Massive rewritten. Implemented date and time support, added new report types, use Pandora functions... * reporting/fgraph.php: Documentation fix. Added a new graphic to show monitors health. * godmode/agentes/agent_manager.php, operation/reporting/custom_reporting.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
/* http://keith-wood.name/timeEntry.html
Time entry for jQuery v1.3.1.
Written by Keith Wood (kbwood@virginbroadband.com.au) June 2007.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
Please attribute the author if you use it. */
(function($){function TimeEntry(){this._nextId=0;this._inst=[];this._disabledInputs=[];this.regional=[];this.regional['']={show24Hours:false,separator:':',ampmPrefix:'',ampmNames:['AM','PM'],spinnerTexts:['Now','Previous field','Next field','Increment','Decrement']};this._defaults={appendText:'',showSeconds:false,timeSteps:[1,1,1],initialField:0,useMouseWheel:true,defaultTime:null,minTime:null,maxTime:null,spinnerImage:'timeEntry.png',spinnerSize:[20,20,8],spinnerIncDecOnly:false,spinnerRepeat:[500,250],beforeShow:null};$.extend(this._defaults,this.regional[''])}$.extend(TimeEntry.prototype,{markerClassName:'hasTimeEntry',_register:function(a){var b=this._nextId++;this._inst[b]=a;return b},_getInst:function(a){return this._inst[a]||a},setDefaults:function(a){extendRemove(this._defaults,a||{})},_doFocus:function(a){var b=(a.nodeName&&a.nodeName.toLowerCase()=='input'?a:this);if($.timeEntry._lastInput==b){return}if($.timeEntry._isDisabledTimeEntry(b)){return}var c=$.timeEntry._getInst(b._timeId);c._input=$(b);$.timeEntry._focussed=true;$.timeEntry._lastInput=b;$.timeEntry._blurredInput=null;var d=c._get('beforeShow');extendRemove(c._settings,(d?d(b):{}));c._parseTime()},_doBlur:function(a){$.timeEntry._blurredInput=$.timeEntry._lastInput;$.timeEntry._lastInput=null},_doClick:function(a){var b=a.target;var c=$.timeEntry._getInst(b._timeId);if(!$.timeEntry._focussed){var d=c._get('separator').length+2;c._field=0;if($.browser.msie){var e=b.value;var f=a.clientX+$.timeEntry._findScroll(a.srcElement)[0]-$.timeEntry._findPos(a.srcElement)[0];for(var g=0;g<=Math.max(1,c._secondField,c._ampmField);g++){var h=(g!=c._ampmField?(g*d)+2:(c._ampmField*d)+c._get('ampmPrefix').length+c._get('ampmNames')[0].length);b.value=e.substring(0,h);var i=b.createTextRange();if(f<i.boundingWidth){c._field=g;break}}b.value=e}else{for(var g=0;g<=Math.max(1,c._secondField,c._ampmField);g++){var j=(g!=c._ampmField?(g*d)+2:(c._ampmField*d)+c._get('ampmPrefix').length+c._get('ampmNames')[0].length);if(b.selectionStart<j){c._field=g;break}}}}c._showField();$.timeEntry._focussed=false},_doKeyDown:function(a){if(a.keyCode>=48){return true}var b=$.timeEntry._getInst(this._timeId);switch(a.keyCode){case 9:return(a.shiftKey?b._previousField(true):b._nextField(true));case 35:if(a.ctrlKey){b._setValue('')}else{b._field=Math.max(1,b._secondField,b._ampmField);b._adjustField(0)}break;case 36:if(a.ctrlKey){b._setTime()}else{b._field=0;b._adjustField(0)}break;case 37:b._previousField(false);break;case 38:b._adjustField(+1);break;case 39:b._nextField(false);break;case 40:b._adjustField(-1);break;case 46:b._setValue('');break}return false},_doKeyPress:function(a){var b=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);if(b<' '){return true}var c=$.timeEntry._getInst(this._timeId);c._handleKeyPress(b);return false},_doMouseWheel:function(a,b){b=($.browser.opera?-b/Math.abs(b):b);var c=$.timeEntry._getInst(this._timeId);c._adjustField(b);a.preventDefault()},_connectTimeEntry:function(b,c){var d=$(b);if(d.is('.'+this.markerClassName)){return}var e=c._get('spinnerImage');var f=c._get('spinnerText');var g=c._get('spinnerSize');var h=c._get('appendText');var i=(!e?null:$('<span class="timeEntry_control" _timeid="'+c._id+'" style="display: inline-block; background: url(\''+e+'\') 0 0 no-repeat; '+'width: '+g[0]+'px; height: '+g[1]+'px;'+($.browser.mozilla&&$.browser.version.substr(0,3)!='1.9'?' padding-left: '+g[0]+'px; padding-bottom: '+(g[1]-18)+'px;':'')+'"></span>'));d.wrap('<span class="timeEntry_wrap"></span>').after(h?'<span class="timeEntry_append">'+h+'</span>':'').after(i||'');d.addClass(this.markerClassName).bind('focus.timeEntry',this._doFocus).bind('blur.timeEntry',this._doBlur).bind('click.timeEntry',this._doClick).bind('keydown.timeEntry',this._doKeyDown).bind('keypress.timeEntry',this._doKeyPress);if($.browser.mozilla){d.bind('input.timeEntry',function(a){c._parseTime()})}if($.browser.msie){d.bind('paste.timeEntry',function(a){setTimeout(function(){c._parseTime()},1)})}if(c._get('useMouseWheel')&&$.fn.mousewheel){d.mousewheel(this._doMouseWheel