]> err.no Git - scalable-opengroupware.org/blobdiff - UI/WebServerResources/SchedulerUI.js
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1032 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / WebServerResources / SchedulerUI.js
index d0f858b230d76dd99dae83f2c1e6e5922c846a2b..88a6680f6c5b3254d655483e19c79f9ed2e09247 100644 (file)
@@ -817,36 +817,32 @@ function changeWeekCalendarDisplayOfSelectedDay(node) {
   node.addClassName("selectedDay");
 }
 
-function findMonthCalendarSelectedCell(table) {
-  var tbody = table.tBodies[0];
-  var rows = tbody.rows;
-
-  var i = 1;
-  while (i < rows.length && !table.selectedCell) {
-    var cells = rows[i].cells;
-    var j = 0;
-    while (j < cells.length && !table.selectedCell) {
-      if (cells[j].hasClassName("selectedDay"))
-        table.selectedCell = cells[j];
+function findMonthCalendarSelectedCell(daysContainer) {
+   var found = false;
+   var i = 0;
+
+   while (!found && i < daysContainer.childNodes.length) {
+      var currentNode = daysContainer.childNodes[i];
+      if (currentNode instanceof HTMLDivElement
+          && currentNode.hasClassName("selectedDay")) {
+         daysContainer.selectedCell = currentNode;
+         found = true;
+      }
       else
-        j++;
-    }
-    i++;
-  }
+         i++;
+   }
 }
 
 function changeMonthCalendarDisplayOfSelectedDay(node)
 {
-  var tr = node.parentNode;
-  var table = tr.parentNode.parentNode;
-
-  if (!table.selectedCell)
-    findMonthCalendarSelectedCell(table);
-
-  if (table.selectedCell)
-    table.selectedCell.removeClassName("selectedDay");
-  table.selectedCell = node;
-  node.addClassName("selectedDay");
+   var daysContainer = node.parentNode;
+   if (!daysContainer.selectedCell)
+      findMonthCalendarSelectedCell(daysContainer);
+   
+   if (daysContainer.selectedCell)
+      daysContainer.selectedCell.removeClassName("selectedDay");
+   daysContainer.selectedCell = node;
+   node.addClassName("selectedDay");
 }
 
 function onHideCompletedTasks(node)
@@ -1162,4 +1158,13 @@ function initCalendars() {
     initCalendarContactsSelector();
 }
 
+function onSchedulerBodyKeyUp(event) {
+   if (event.which == 46) {
+      window.alert("coucou");
+      deleteEvent();
+      event.cancelBubble = true;
+   }
+}
+
 window.addEventListener("load", initCalendars, false);
+// document.body.addEventListener("keyup", onSchedulerBodyKeyUp, false);