+ init: function(options, element) {\r
+ this.classname = "scheduler2";\r
+ // Call the parent constructor, see FAQ when forgotten\r
+ this._super(options, element);\r
+ scheduler2Instance = this;\r
+ // We need to remember the active filter for datatables filtering\r
+ this.filters = Array();\r
+\r
+\r
+ SchedulerSlots = schedulerGetSlots(60 / schedulerSlotsPerHour);\r
+ //selection from table \r
+ $(window).keydown(function(evt) {\r
+ if (evt.which == 17) { // ctrl\r
+ schedulerCtrlPressed = true;\r
+ }\r
+ }).keyup(function(evt) {\r
+ if (evt.which == 17) { // ctrl\r
+ schedulerCtrlPressed = false;\r
+ }\r
+ });\r
+ $("#" + schedulerTblId).on('mousedown', 'td', rangeMouseDown).on('mouseup', 'td', rangeMouseUp).on('mousemove', 'td', rangeMouseMove);\r
+\r
+ // Explain this will allow query events to be handled\r
+ // What happens when we don't define some events ?\r
+ // Some can be less efficient\r
+\r
+ if (schedulerDebug) console.time("Listening_to_queries");\r
+ /* Listening to queries */\r
+\r
+ this.listen_query(options.query_uuid);\r
+ //this.listen_query(options.query_all_uuid, 'all');\r
+ this.listen_query(options.query_all_resources_uuid, 'all_resources');\r
+ this.listen_query(options.query_lease_uuid, 'lease');\r
+ this.listen_query(options.query_all_leases_uuid, 'all_leases');\r
+ if (schedulerDebug) console.timeEnd("Listening_to_queries");\r
+\r
+ },\r
+\r
+ /* Handlers */\r
+\r
+ /* all_ev QUERY HANDLERS Start */\r
+ on_all_ev_clear_records: function(data) {\r
+ //alert('all_ev clear_records');\r
+ },\r
+ on_all_ev_query_in_progress: function(data) {\r
+ // alert('all_ev query_in_progress');\r
+ },\r
+ on_all_ev_new_record: function(data) {\r
+ //alert('all_ev new_record');\r
+ },\r
+ on_all_ev_query_done: function(data) {\r
+ //alert('all_ev query_done');\r
+ },\r
+ //another plugin has modified something, that requires you to update your display. \r
+ on_all_ev_field_state_changed: function(data) {\r
+ //alert('all_ev query_done');\r
+ },\r
+ /* all_ev QUERY HANDLERS End */\r
+ /* all_resources QUERY HANDLERS Start */\r
+ on_all_resources_clear_records: function(data) {\r
+ //data is empty on load\r
+ },\r
+ on_all_resources_query_in_progress: function(data) {\r
+ //data is empty on load\r
+ },\r
+ on_all_resources_new_record: function(data) {\r
+ //alert(data.toSource());\r
+ if (data.exclusive == true) {\r
+ var tmpGran = schedulerDebug && data.granularity == null ? 1800 : data.granularity;\r
+ SchedulerData.push({\r
+ id: data.urn,\r
+ index: SchedulerData.length,\r
+ name: data.hrn,\r
+ granularity: tmpGran,\r
+ leases: schedulerGetLeases(60 / schedulerSlotsPerHour, tmpGran),\r
+ type: data.type,\r
+ org_resource: data\r
+ });\r
+ /*if (schedulerDebug && SchedulerData[SchedulerData.length - 1].org_resource.network_hrn == 'omf') {\r
+ SchedulerData[SchedulerData.length - 1].granularity = 1800;\r
+ }*/\r