]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1100 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 5 Jul 2007 19:15:26 +0000 (19:15 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 5 Jul 2007 19:15:26 +0000 (19:15 +0000)
NEWS
UI/Templates/SchedulerUI/UIxCalDateSelector.wox
UI/WebServerResources/HTMLElement.js
UI/WebServerResources/SchedulerUI.js
UI/WebServerResources/UIxComponentEditor.js
UI/WebServerResources/generic.js

diff --git a/NEWS b/NEWS
index 4d5694a2414c0360d1baa0f6011e00717565bd0e..ab0830fb78212ceb2e3b38e452b45b92cb35ed08 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,3 +4,4 @@
 - added the ability to view the message source;
 - no longer autocreate folders if we are not their owners;
 - made compatible with PostgreSQL 8.2;
+- the months and years menus of the date selector would no longer appear;
index cff93ce686c4200455850c4e0253e478acb5f3fe..f2fb1e15e0efde71455a4266f8191ed82a915702 100644 (file)
@@ -6,27 +6,14 @@
     xmlns:label="OGo:label"
     id="dateSelector">
     <div class="header">
-      <a href="#"
-        id="rightArrow"
-        var:date="nextMonthAsString"
-        onclick="return onDateSelectorGotoMonth(this);"
+      <a href="#" id="rightArrow" var:date="nextMonthAsString"
         ><img id="next" rsrc:src="arrow-rit-sharp.gif"
           /></a>
-      <a href="#"
-        id="leftArrow"
-        var:date="prevMonthAsString"
-        onclick="return onDateSelectorGotoMonth(this);"
+      <a href="#" id="leftArrow" var:date="prevMonthAsString"
         ><img id="previous" rsrc:src="arrow-lft-sharp.gif" />
-      </a><span id="monthLabel"
-        onmousedown="return false;"
-        var:month="headerMonthValue"
-        onclick="popupMonthMenu(event, 'monthListMenu');"
-        ><var:string value="headerMonthString"
-          /></span><span id="yearLabel"
-        onmousedown="return false;"
-        onclick="popupMonthMenu(event, 'yearListMenu');"
-        ><var:string value="headerYearString"
-          /></span>
+      </a><span id="monthLabel" var:month="headerMonthValue"
+       ><var:string value="headerMonthString" /></span
+       ><span id="yearLabel"><var:string value="headerYearString" /></span>
     </div>
 
     <var:month-overview
index 761bbc7f53a122c03dee6dcfb7ab2f049999ffc5..187c70df5d46ba19082f5c9394d1d6385f932ab0 100644 (file)
@@ -123,7 +123,7 @@ Element.addMethods({
     var popup = element.sogoContextMenu;
 
     if (document.currentPopupMenu)
-      hideMenu(event, document.currentPopupMenu);
+      hideMenu(document.currentPopupMenu);
     
     var menuTop = event.pageY;
     var menuLeft = event.pageX;
index e9d014c6fb09454c7e15a6028a7b672f31f0bfa0..3c7c91fe92979443969dec9642e2b10b256e871c 100644 (file)
@@ -285,10 +285,11 @@ function setDateSelectorContent(content) {
 function dateSelectorCallback(http) {
   if (http.readyState == 4
       && http.status == 200) {
-    document.dateSelectorAjaxRequest = null;
-    var content = http.responseText;
-    setDateSelectorContent(content);
-    cachedDateSelectors[http.callbackData] = content;
+     document.dateSelectorAjaxRequest = null;
+     var content = http.responseText;
+     setDateSelectorContent(content);
+     cachedDateSelectors[http.callbackData] = content;
+     initDateSelectorEvents();
   }
   else
     log ("dateSelectorCallback Ajax error");
@@ -955,15 +956,15 @@ function onEventClick(event) {
 }
 
 function selectMonthInMenu(menu, month) {
-  var entries = menu.childNodes[1].childNodesWithTag("LI");
-  for (i = 0; i < entries.length; i++) {
-    var entry = entries[i];
-    var entryMonth = entry.getAttribute("month");
-    if (entryMonth == month)
-      entry.addClassName("currentMonth");
-    else
-      entry.removeClassName("currentMonth");
-  }
+   var entries = menu.childNodes[1].childNodesWithTag("LI");
+   for (i = 0; i < entries.length; i++) {
+      var entry = entries[i];
+      var entryMonth = entry.getAttribute("month");
+      if (entryMonth == month)
+        entry.addClassName("currentMonth");
+      else
+        entry.removeClassName("currentMonth");
+   }
 }
 
 function selectYearInMenu(menu, month) {
@@ -980,32 +981,22 @@ function selectYearInMenu(menu, month) {
   }
 }
 
-function popupMonthMenu(event, menuId) {
-  var node = event.target;
-
+function popupMonthMenu(event) {
   if (event.button == 0) {
-    event.cancelBubble = true;
-    event.returnValue = false;
-
-    if (document.currentPopupMenu)
-      hideMenu(event, document.currentPopupMenu);
+    var id = this.getAttribute("id");
+    if (id == "monthLabel")
+       menuId = "monthListMenu";
+    else
+       menuId = "yearListMenu";
 
     var popup = $(menuId);
-    var id = node.getAttribute("id");
     if (id == "monthLabel")
-      selectMonthInMenu(popup, node.getAttribute("month"));
+      selectMonthInMenu(popup, this.getAttribute("month"));
     else
-      selectYearInMenu(popup, node.innerHTML);
-
-    var diff = (popup.offsetWidth - node.offsetWidth) /2;
+      selectYearInMenu(popup, this.innerHTML);
 
-    popup.style.top = (node.offsetTop + 95) + "px";
-    popup.style.left = (node.offsetLeft - diff) + "px";
-    popup.style.visibility = "visible";
-
-    bodyOnClick = "" + document.body.getAttribute("onclick");
-    document.body.setAttribute("onclick", "onBodyClick('" + menuId + "');");
-    document.currentPopupMenu = popup;
+    popupToolbarMenu(this, menuId);
+    Event.stop(event);
   }
 }
 
@@ -1290,10 +1281,10 @@ function getMenus() {
    menus["yearListMenu"] = dateMenu;
 
    menus["eventsListMenu"] = new Array(onMenuNewEventClick, "-",
-                                            onMenuNewTaskClick,
-                                            editEvent, deleteEvent, "-",
-                                            onSelectAll, "-",
-                                            null, null);
+                                      onMenuNewTaskClick,
+                                      editEvent, deleteEvent, "-",
+                                      onSelectAll, "-",
+                                      null, null);
    menus["calendarsMenu"] = new Array(null, null, "-", null, null, "-",
                                      null, "-", onMenuSharing);
    menus["searchMenu"] = new Array(setSearchCriteria);
@@ -1457,8 +1448,25 @@ function configureLists() {
                 onEventContextMenu.bindAsEventListener(div));
 }
 
+function initDateSelectorEvents() {
+   var arrow = $("rightArrow");
+   Event.observe(arrow, "click",
+                onDateSelectorGotoMonth.bindAsEventListener(arrow));
+   arrow = $("leftArrow");
+   Event.observe(arrow, "click",
+                onDateSelectorGotoMonth.bindAsEventListener(arrow));
+   
+   var menuButton = $("monthLabel");
+   Event.observe(menuButton, "click",
+                popupMonthMenu.bindAsEventListener(menuButton));
+   menuButton = $("yearLabel");
+   Event.observe(menuButton, "click",
+                popupMonthMenu.bindAsEventListener(menuButton));
+}
+
 function initCalendars() {
    if (!document.body.hasClassName("popup")) {
+      initDateSelectorEvents();
       initCalendarSelector();
       configureSearchField();
       configureLists();
index 47a0d619a4a5527c5c50368ff2b4806b0575adae..ab6d81ab4506def17732950698a57ddb4167e211 100644 (file)
@@ -8,9 +8,16 @@ function onPopupAttendeesWindow(event) {
 }
 
 function onSelectPrivacy(event) {
-   popupToolbarMenu(event, "privacy-menu");
-
-   return false;
+   if (event.button == 0) {
+      var node = event.target;
+      if (node.tagName != 'A')
+        node = node.getParentWithTagName("a");
+      node = node.childNodesWithTag("span")[0];
+
+      popupToolbarMenu(node, "privacy-menu");
+      Event.stop(event);
+//       preventDefault(event);
+   }
 }
 
 function onPopupUrlWindow(event) {
@@ -146,7 +153,9 @@ function onComponentEditorLoad(event) {
    initializeDocumentHref();
    initializePrivacyMenu();
    var list = $("calendarList");
-   Event.observe(list, "change", onChangeCalendar.bindAsEventListener(list), false);
+   Event.observe(list, "change",
+                onChangeCalendar.bindAsEventListener(list),
+                false);
    if (document.createEvent) {
      var onSelectionChangeEvent = document.createEvent("Event");
      onSelectionChangeEvent.initEvent("change", false, false);
@@ -158,7 +167,9 @@ function onComponentEditorLoad(event) {
 
    var menuItems = $("itemPrivacyList").childNodesWithTag("li");
    for (var i = 0; i < menuItems.length; i++)
-      Event.observe(menuItems[i], "mouseup", onMenuSetClassification.bindAsEventListener(menuItems[i]), false);
+      Event.observe(menuItems[i], "mouseup",
+                   onMenuSetClassification.bindAsEventListener(menuItems[i]),
+                   false);
 }
 
 addEvent(window, 'load', onComponentEditorLoad);
index a99e2cb3cb8358759e7a68a90abdffa0d9a965c1..d469df7d067e62efdb4e79452a810e7d25e1dc70 100644 (file)
@@ -521,7 +521,7 @@ function popupMenu(event, menuId, target) {
    document.menuTarget = target;
 
    if (document.currentPopupMenu)
-       hideMenu(event, document.currentPopupMenu);
+      hideMenu(document.currentPopupMenu);
 
    var popup = $(menuId);
    var menuTop = event.pageY;
@@ -565,18 +565,17 @@ function getParentMenu(node) {
 
 function onBodyClickMenuHandler(event) {
    document.body.menuTarget = null;
-   hideMenu(event, document.currentPopupMenu);
+   hideMenu(document.currentPopupMenu);
    Event.stopObserving(document.body, "click", onBodyClickMenuHandler);
 
    preventDefault(event);
 }
 
-function hideMenu(event, menuNode) {
+function hideMenu(menuNode) {
   var onHide;
 
-//   log('hiding menu "' + menuNode.getAttribute('id') + '"');
   if (menuNode.submenu) {
-    hideMenu(event, menuNode.submenu);
+    hideMenu(menuNode.submenu);
     menuNode.submenu = null;
   }
 
@@ -709,7 +708,7 @@ function dropDownSubmenu(event) {
       var submenuNode = $(this.submenu);
       var parentNode = getParentMenu(node);
       if (parentNode.submenu)
-        hideMenu(event, parentNode.submenu);
+        hideMenu(parentNode.submenu);
       submenuNode.parentMenuItem = node;
       submenuNode.parentMenu = parentNode;
       parentNode.submenuItem = node;
@@ -749,7 +748,7 @@ function checkDropDown(event) {
         && menuX < itemX + submenuItem.offsetWidth
         && (menuY < itemY
             || menuY > (itemY + submenuItem.offsetHeight))) {
-      hideMenu(event, parentMenu.submenu);
+      hideMenu(parentMenu.submenu);
       parentMenu.submenu = null;
       parentMenu.submenuItem = null;
       parentMenu.setAttribute('onmousemove', null);
@@ -769,7 +768,7 @@ function popupSearchMenu(event) {
     event.returnValue = false;
 
     if (document.currentPopupMenu)
-      hideMenu(event, document.currentPopupMenu);
+      hideMenu(document.currentPopupMenu);
 
     var popup = $(menuId);
     popup.setStyle({ top: this.offsetHeight + "px",
@@ -891,29 +890,18 @@ function initCriteria() {
 }
 
 /* toolbar buttons */
-function popupToolbarMenu(event, menuId) {
-   var toolbar = $("toolbar");
-   var node = getTarget(event);
-   if (node.tagName != 'A')
-      node = node.getParentWithTagName("a");
-   node = node.childNodesWithTag("span")[0];
-
-   if (event.button == 0) {
-      event.cancelBubble = true;
-      event.returnValue = false;
-      
-      if (document.currentPopupMenu)
-        hideMenu(event, document.currentPopupMenu);
-      
-      var popup = document.getElementById(menuId);
-      var top = node.offsetTop + node.offsetHeight - 2;
-      popup.setStyle({ top: top + "px",
-                      left: node.cascadeLeftOffset() + "px",
-                      visibility: "visible" });
-
-      document.currentPopupMenu = popup;
-      Event.observe(document.body, "click", onBodyClickMenuHandler);
-   }
+function popupToolbarMenu(node, menuId) {
+   if (document.currentPopupMenu)
+      hideMenu(document.currentPopupMenu);
+
+   var popup = $(menuId);
+   var top = node.top + node.offsetHeight - 2;
+   popup.setStyle({ top: top + "px",
+                   left: node.cascadeLeftOffset() + "px",
+                   visibility: "visible" });
+
+   document.currentPopupMenu = popup;
+   Event.observe(document.body, "click", onBodyClickMenuHandler);
 }
 
 /* contact selector */