Author: bpapez
Date: Fri Jun 15 14:35:28 2007
New Revision: 1203

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D1203&repname=
=3Dcorporate_portal_templates
Log:
Site dependent action menu icons and fix positioning

Modified:
    trunk/src/view/jsp/actions.css
    trunk/src/view/jsp/actions.js

Modified: trunk/src/view/jsp/actions.css
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/view/jsp/ac=
tions.css&rev=3D1203&repname=3Dcorporate_portal_templates
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/view/jsp/actions.css (original)
+++ trunk/src/view/jsp/actions.css Fri Jun 15 14:35:28 2007
@@ -1,23 +1,24 @@
 div.menu,
 div.menu a.menuItem {
   font-family: "MS Sans Serif", Arial, sans-serif;
-  font-size: 8pt;
+  font-size: 8pt !important;
   font-style: normal;
   font-weight: normal;
   color: #000000;
   white-space: nowrap;
+  text-decoration:none;
+  text-indent: 0px;    =

+  margin: 0px !important;    =

 }
 =

 div.menu {
   background-color: #d0d0d0;
   border: 2px solid;
   border-color: #f0f0f0 #909090 #909090 #f0f0f0;
-  left: 0px;
   padding: 0px 1px 1px 0px;
   position: absolute;
-  top: 0px;
   visibility: hidden;
-  z-index: 101;
+  vertical-align: top;
 }
 =

 div.menu a.menuItem {
@@ -27,6 +28,8 @@
   padding: 3px 1em;
   text-decoration: none;
   white-space: nowrap;
+  font-weight: normal;  =

+  clear: both;  =

 }
 =

 div.menu a.menuItem:hover, div.menu a.menuItemHighlight {
@@ -46,3 +49,58 @@
   margin: 4px 2px;
 }
 =

+div.menu  a span {
+    padding:0 11px 0 0;
+    display:inline;
+    margin: 0px !important;   =

+}
+
+div.menu  a span img {
+    margin: 0px !important;   =

+}
+
+/* uncomment and customize this section if you want to set custom action i=
cons
+img.actionIcon, img.lockIcon,
+div img.addIcon, div img.updateIcon,
+div img.deleteIcon, div img.lockgreyIcon,
+div img.copyIcon, div img.pasteIcon,
+div img.pickerIcon {
+    visibility:hidden;
+}
+.actionIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/action.gif");
+}
+.lockIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/lock.gif");
+}
+div .addIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/add.gif");
+}
+div .updateIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/update.gif");
+}
+div .deleteIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/delete.gif");
+}
+div .lockgreyIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/lock_grey.gif");
+}
+div .copyIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/copy.gif");
+}
+div .pasteIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/paste.gif");
+}
+div .pickerIcon {
+    background-repeat: no-repeat;
+    background-image: url("../img/actions/picker.gif");
+}
+*/
\ No newline at end of file

Modified: trunk/src/view/jsp/actions.js
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/view/jsp/ac=
tions.js&rev=3D1203&repname=3Dcorporate_portal_templates
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/view/jsp/actions.js (original)
+++ trunk/src/view/jsp/actions.js Fri Jun 15 14:35:28 2007
@@ -13,37 +13,61 @@
 =

 function Browser() {
 =

-    var ua, s, i;
+  var ua, s, i;
 =

-    this.isIE =3D false;
-    // Internet Explorer
-    this.isNS =3D false;
-    // Netscape
-    this.version =3D null;
-
-    ua =3D navigator.userAgent;
-
-    s =3D "MSIE";
-    if ((i =3D ua.indexOf(s)) >=3D 0) {
-        this.isIE =3D true;
-        this.version =3D parseFloat(ua.substr(i + s.length));
-        return;
-    }
-
-    s =3D "Netscape6/";
-    if ((i =3D ua.indexOf(s)) >=3D 0) {
-        this.isNS =3D true;
-        this.version =3D parseFloat(ua.substr(i + s.length));
-        return;
-    }
-
-    // Treat any other "Gecko" browser as NS 6.1.
-
-    s =3D "Gecko";
-    if ((i =3D ua.indexOf(s)) >=3D 0) {
-        this.isNS =3D true;
-        this.version =3D 6.1;
-    }
+  this.isIE    =3D false;  // Internet Explorer
+  this.isNS    =3D false;  // Netscape
+  this.isOpera =3D false;  =

+  this.version =3D null;
+
+  ua =3D navigator.userAgent;
+
+  s =3D "MSIE";
+  if ((i =3D ua.indexOf(s)) >=3D 0) {
+    this.isIE =3D true;
+    this.version =3D parseFloat(ua.substr(i + s.length));
+    if (ua.indexOf("Opera") >=3D 0)
+      this.isOpera =3D true;        // detecting Opera impersonating MSIE =
   =

+    return;
+  }
+
+  s =3D "Netscape6/";
+  if ((i =3D ua.indexOf(s)) >=3D 0) {
+    this.isNS =3D true;
+    this.version =3D parseFloat(ua.substr(i + s.length));
+    return;
+  }
+
+  s =3D "Opera/";
+  i =3D ua.indexOf(s);
+  if (i < 0)                 // the '/' is missing when Opera tries to imp=
ersonate another
+    i =3D ua.indexOf("Opera"); // browser but 'Opera' is still part of the=
 user agent string
+
+  if (i >=3D 0) {
+    this.isOpera =3D true; // Note: If you want to detect Opera always che=
ck isOpera first, because
+    this.isNS =3D true;    // isNS (or isIE if it tries to impersonate MSI=
E) will also be set to true!
+                         // We did this for safety: Some scripts might not=
 yet be aware of Opera and also
+                         // have no suitable default in their case distinc=
tion; Opera is sufficiently
+                         // NS compatible and such scripts should treat it=
 as NS rather than "unknown" (or,
+                         // when impersonating MSIE, as MSIE - except for =
MSIE-only features like iFrames).
+                         // E.g. menuItemMouseover() had: if (browser.isIE=
) {...} if (browser.isNS) {...}
+                         // with no else-branch for other browsers :-(that=
 function seems to be obsolete but
+                         // would crash with undefined variables if ever c=
alled). Of course, although
+                         // maybe never called, we fixed that function but=
 other scripts in other files might
+                         // have (or develop) similar cross-browser defect=
s (and with this precaution they'd
+                         // at least stand a good chance to work with Oper=
a)
+    this.version =3D parseFloat(ua.substr(i + s.length));
+    return;
+  }
+
+  // Treat any other "Gecko" browser as NS 6.1.
+
+  s =3D "Gecko";
+  if ((i =3D ua.indexOf(s)) >=3D 0) {
+    this.isNS =3D true;
+    this.version =3D 6.1;
+    return;
+  }
 }
 =

 var browser =3D new Browser();
@@ -61,127 +85,155 @@
 // deactivated.
 =

 if (browser.isIE)
-    document.onmousedown =3D pageMousedown;
+  document.onmousedown =3D pageMousedown;
 else
-    document.addEventListener("mousedown", pageMousedown, true);
+  document.addEventListener("mousedown", pageMousedown, true);
 =

 function pageMousedown(event) {
 =

-    var el;
+  var el;
 =

-    // If there is no active button, exit.
+  // If there is no active button, exit.
 =

-    if (activeButton =3D=3D null)
-        return;
+  if (activeButton =3D=3D null)
+    return;
 =

-    // Find the element that was clicked on.
+  // Find the element that was clicked on.
 =

-    if (browser.isIE)
-        el =3D window.event.srcElement;
-    else
-        el =3D (event.target.tagName ? event.target : event.target.parentN=
ode);
+  if (browser.isIE)
+    el =3D window.event.srcElement;
+  else
+    el =3D (event.target.tagName ? event.target : event.target.parentNode);
 =

-    // If the active button was clicked on, exit.
+  // If the active button was clicked on, exit.
 =

-    if (el =3D=3D activeButton)
-        return;
+  if (el =3D=3D activeButton)
+    return;
 =

-    // If the element is not part of a menu, reset and clear the active
-    // button.
+  // If the element is not part of a menu, reset and clear the active
+  // button.
 =

-    if (getContainerWith(el, "DIV", "menu") =3D=3D null) {
-        resetButton(activeButton);
-        activeButton =3D null;
-    }
+  if (getContainerWith(el, "DIV", "menu") =3D=3D null) {
+    resetButton(activeButton);
+    activeButton =3D null;
+  }
 }
 =

 // Opens up the menu of the given id
-function buttonClick(menuId) {
-    var button =3D getObjectById("button_" + menuId);
-
-    // Blur focus from the link to remove that annoying outline.
-    button.blur();
-
-    // Associate the named menu to this button if not already done.
-    // Additionally, initialize menu display.
-    if (button.menu =3D=3D null) {
-        button.menu =3D getObjectById(menuId);
-        if (button.menu.isInitialized =3D=3D null) {
-            menuInit(button.menu);
-        }
-    }
-
-    // Reset the currently active button, if any.
-
-    if (activeButton !=3D null) {
-        resetButton(activeButton);
-    }
-
-    // Activate this button, unless it was the currently active one.
-
-    if (button !=3D activeButton) {
-        depressButton(button);
-        activeButton =3D button;
-    } else {
-        activeButton =3D null;
-    }
+function buttonClick (event, menuId) {
+  var button =3D getObjectById ("button_" + menuId);
+  var positioner;
+
+  // Get the target button element.
+
+  if (browser.isIE) { =

+    event =3D window.event;
+  }
+  =

+  if (event && event.target)  // With w3c conforming browsers, positioner =
should be event.target, i.e. the
+    positioner =3D event.target; // event originator; this is a child (usu=
ally an img) of event.currentTarget
+  else                       // (in our case the link element that process=
es the event). Due to wordwrap,
+    positioner =3D button;     // the link could extend over 2 lines and g=
ive us bad coordinates for placing
+                             // the menu, so if we have a better positione=
r we use it
+                             // (IE knows only event.srcElement but that s=
eems ok anyway).
+
+  // Blur focus from the link to remove that annoying outline.
+  button.blur();
+
+  // Associate the named menu to this button if not already done.
+  // Additionally, initialize menu display.
+  if (button.menu =3D=3D null) {
+       button.menu =3D getObjectById (menuId);
+    if (button.menu.isInitialized =3D=3D null) {
+      menuInit(button.menu);
+       }
+  }
+
+  // Reset the currently active button, if any.
+
+  if (activeButton !=3D null) {
+    resetButton(activeButton);
+  }
+
+  // Activate this button, unless it was the currently active one.
+
+  if (button !=3D activeButton) {
+    depressButton(button, positioner);
+    activeButton =3D button;
+  } else {
+    activeButton =3D null;
+  }
 }
 =

 // Switches menu if the user's mouse goes on another menu
 function buttonMouseover(event, menuId) {
-    var button;
-
-    // Find the target button element.
-    if (browser.isIE) {
-        button =3D window.event.srcElement;
-    } else {
-        button =3D event.currentTarget;
-    }
-
-    // If any other button menu is active, make this one active instead.
-    if (activeButton !=3D null && activeButton !=3D button) {
-        buttonClick(menuId);
-    }
+// this functionality has been removed, as with AJAX menues =

+// need to be initialized first
 }
 =

-function depressButton(button) {
-    var x, y;
-
-    // Update the button's style class to make it look like it's
-    // depressed.
-
-    button.className +=3D " menuButtonActive";
-
-    // Position the associated drop down menu under the button and
-    // show it.
-
-    x =3D getPageOffsetLeft(button);
-    y =3D getPageOffsetTop(button) + button.offsetHeight;
-
-    // For IE, adjust position.
-
-    if (browser.isIE) {
-        x +=3D button.offsetParent.clientLeft;
-        y +=3D button.offsetParent.clientTop;
-    }
-
-    button.menu.style.left =3D x + "px";
-    button.menu.style.top =3D y + "px";
-    button.menu.style.visibility =3D "visible";
+// This function handles the menu button appearance on pressing it
+// and sets the menu element's size, positon style and visibility
+// to make the menu associated with the pop up on screen.
+
+function depressButton(button, positioner) {
+
+  if (!positioner)       // if no better element for positioning is given
+    positioner =3D button; // we position the menu relative to the button
+
+  var x, y;
+
+  // Update the button's style class to make it look like it's
+  // depressed.
+
+  button.className +=3D " menuButtonActive";
+
+  applyCommonlyWantedMenuStyles(button.menu); // enforce those styles that=
 should be common to all menus
+  =

+  // Position the associated drop down menu near the button
+  =

+  var xMenuParent =3D getPageOffsetLeft(button.menu.offsetParent); // menu=
 is positioned relative to
+  var yMenuParent =3D getPageOffsetTop(button.menu.offsetParent); // this =
"offsetParent"
+  x =3D getPageOffsetLeft(positioner) - xMenuParent;             // so we =
must subtract offsetParent's position
+  y =3D getPageOffsetTop(positioner) - yMenuParent;             // if posi=
tioner has a different offsetParent
+  // x +=3D positioner.offsetWidth;      // place menu at the positioner's=
 right side
+  y +=3D positioner.offsetHeight;  // originally was below but that would =
cover
+                                    // vertically stacked (=3D quite commo=
n!) buttons below our button
+
+  // For IE, adjust position.
+
+  if (browser.isIE) {
+    x +=3D positioner.offsetParent.clientLeft;
+    y +=3D positioner.offsetParent.clientTop;
+  }
+  ensureMenuSize(button);  // maybe must enlarge menu to avoid cut-off; wh=
en we finally know size:
+                           // maybe must flip menu position to avoid menu =
going partially off screen:
+  var delta =3D x + xMenuParent + button.menu.offsetWidth - getRightWindow=
Boundary();
+  if (delta > 0)
+    x -=3D button.menu.offsetWidth - positioner.offsetWidth;
+  delta =3D y + yMenuParent + button.menu.offsetHeight - getBottomWindowBo=
undary();
+  if (delta > 0)
+    y -=3D button.menu.offsetHeight + positioner.offsetHeight;
+  =

+  button.menu.style.left =3D x + "px";        // set position and visibili=
ty
+  button.menu.style.top  =3D y + "px";        // to finally make this menu
+  activateZorderShield(button.menu);        // if needed: shield from elem=
ents that ignore zIndex (MSIE 5.5+)
+  button.menu.style.visibility =3D "visible"; // pop up on screen
 }
 =

 function resetButton(button) {
 =

-    // Restore the button's style class.
-
-    removeClassName(button, "menuButtonActive");
-
-    // Hide the button's menu, first closing any sub menus.
-
-    if (button.menu !=3D null) {
-        closeSubMenu(button.menu);
-        button.menu.style.visibility =3D "hidden";
-    }
+  deactivateZorderShield(button.menu); // hide the shield if any was place=
d between menu and background (MSIE 5.5+)
+  =

+  // Restore the button's style class.
+
+  removeClassName(button, "menuButtonActive");
+
+  // Hide the button's menu, first closing any sub menus.
+
+  if (button.menu !=3D null) {
+    closeSubMenu(button.menu);
+    button.menu.style.visibility =3D "hidden";
+  }
 }
 =

 //------------------------------------------------------------------------=
----
@@ -190,106 +242,106 @@
 =

 function menuMouseover(event) {
 =

-    var menu;
+  var menu;
 =

-    // Find the target menu element.
+  // Find the target menu element.
 =

-    if (browser.isIE)
-        menu =3D getContainerWith(window.event.srcElement, "DIV", "menu");
-    else
-        menu =3D event.currentTarget;
+  if (browser.isIE)
+    menu =3D getContainerWith(window.event.srcElement, "DIV", "menu");
+  else
+    menu =3D event.currentTarget;
 =

-    // Close any active sub menu.
+  // Close any active sub menu.
 =

-    if (menu.activeItem !=3D null)
-        closeSubMenu(menu);
+  if (menu.activeItem !=3D null)
+    closeSubMenu(menu);
 }
 =

 function menuItemMouseover(event, menuId) {
 =

-    var item, menu, x, y;
+  var item, menu, x, y;
 =

-    // Find the target item element and its parent menu element.
+  // Find the target item element and its parent menu element.
 =

-    if (browser.isIE)
-        item =3D getContainerWith(window.event.srcElement, "A", "menuItem"=
);
-    else
-        item =3D event.currentTarget;
-    menu =3D getContainerWith(item, "DIV", "menu");
+  if (browser.isIE)
+    item =3D getContainerWith(window.event.srcElement, "A", "menuItem");
+  else
+    item =3D event.currentTarget;
+  menu =3D getContainerWith(item, "DIV", "menu");
 =

-    // Close any active sub menu and mark this one as active.
+  // Close any active sub menu and mark this one as active.
 =

-    if (menu.activeItem !=3D null)
-        closeSubMenu(menu);
-    menu.activeItem =3D item;
+  if (menu.activeItem !=3D null)
+    closeSubMenu(menu);
+  menu.activeItem =3D item;
 =

-    // Highlight the item element.
+  // Highlight the item element.
 =

-    item.className +=3D " menuItemHighlight";
+  item.className +=3D " menuItemHighlight";
 =

-    // Initialize the sub menu, if not already done.
+  // Initialize the sub menu, if not already done.
 =

-    if (item.subMenu =3D=3D null) {
-        item.subMenu =3D document.getElementById(menuId);
-        if (item.subMenu.isInitialized =3D=3D null)
-            menuInit(item.subMenu);
-    }
+  if (item.subMenu =3D=3D null) {
+    item.subMenu =3D document.getElementById(menuId);
+    if (item.subMenu.isInitialized =3D=3D null)
+      menuInit(item.subMenu);
+  }
 =

-    // Get position for submenu based on the menu item.
+  // Get position for submenu based on the menu item.
 =

-    x =3D getPageOffsetLeft(item) + item.offsetWidth;
-    y =3D getPageOffsetTop(item);
+  x =3D getPageOffsetLeft(item) + item.offsetWidth;
+  y =3D getPageOffsetTop(item);
 =

-    // Adjust position to fit in view.
+  // Adjust position to fit in view.
 =

-    var maxX, maxY;
+  var maxX, maxY;
 =

-    if (browser.isNS) {
-        maxX =3D window.scrollX + window.innerWidth;
-        maxY =3D window.scrollY + window.innerHeight;
-    }
-    if (browser.isIE) {
-        maxX =3D (document.documentElement.scrollLeft !=3D 0 ? document.do=
cumentElement.scrollLeft    : document.body.scrollLeft)
-                + (document.documentElement.clientWidth !=3D 0 ? document.=
documentElement.clientWidth   : document.body.clientWidth);
-        maxY =3D (document.documentElement.scrollTop !=3D 0 ? document.doc=
umentElement.scrollTop    : document.body.scrollTop)
-                + (document.documentElement.clientHeight !=3D 0 ? document=
.documentElement.clientHeight : document.body.clientHeight);
-    }
-    maxX -=3D item.subMenu.offsetWidth;
-    maxY -=3D item.subMenu.offsetHeight;
+  if (browser.isIE) {
+    maxX =3D (document.documentElement.scrollLeft   !=3D 0 ? document.docu=
mentElement.scrollLeft    : document.body.scrollLeft)
+         + (document.documentElement.clientWidth  !=3D 0 ? document.docume=
ntElement.clientWidth   : document.body.clientWidth);
+    maxY =3D (document.documentElement.scrollTop    !=3D 0 ? document.docu=
mentElement.scrollTop    : document.body.scrollTop)
+         + (document.documentElement.clientHeight !=3D 0 ? document.docume=
ntElement.clientHeight : document.body.clientHeight);
+  } else {
+    maxX =3D window.scrollX + window.innerWidth;
+    maxY =3D window.scrollY + window.innerHeight;
+  }
+  =

+  maxX -=3D item.subMenu.offsetWidth;
+  maxY -=3D item.subMenu.offsetHeight;
+
+  if (x > maxX)
+    x =3D Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
+      + (menu.offsetWidth - item.offsetWidth));
+  y =3D Math.max(0, Math.min(y, maxY));
 =

-    if (x > maxX)
-        x =3D Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
-                + (menu.offsetWidth - item.offsetWidth));
-    y =3D Math.max(0, Math.min(y, maxY));
-
-    // Position and show it.
-
-    item.subMenu.style.left =3D x + "px";
-    item.subMenu.style.top =3D y + "px";
-    item.subMenu.style.visibility =3D "visible";
-
-    // Stop the event from bubbling.
-
-    if (browser.isIE)
-        window.event.cancelBubble =3D true;
-    else
-        event.stopPropagation();
+  // Position and show it.
+
+  item.subMenu.style.left =3D x + "px";
+  item.subMenu.style.top  =3D y + "px";
+  item.subMenu.style.visibility =3D "visible";
+
+  // Stop the event from bubbling.
+
+  if (browser.isIE)
+    window.event.cancelBubble =3D true;
+  else
+    event.stopPropagation();
 }
 =

 function closeSubMenu(menu) {
 =

-    if (menu =3D=3D null || menu.activeItem =3D=3D null)
-        return;
+  if (menu =3D=3D null || menu.activeItem =3D=3D null)
+    return;
 =

-    // Recursively close any sub menus.
+  // Recursively close any sub menus.
 =

-    if (menu.activeItem.subMenu !=3D null) {
-        closeSubMenu(menu.activeItem.subMenu);
-        menu.activeItem.subMenu.style.visibility =3D "hidden";
-        menu.activeItem.subMenu =3D null;
-    }
-    removeClassName(menu.activeItem, "menuItemHighlight");
-    menu.activeItem =3D null;
+  if (menu.activeItem.subMenu !=3D null) {
+    closeSubMenu(menu.activeItem.subMenu);
+    menu.activeItem.subMenu.style.visibility =3D "hidden";
+    menu.activeItem.subMenu =3D null;
+  }
+  removeClassName(menu.activeItem, "menuItemHighlight");
+  menu.activeItem =3D null;
 }
 =

 //------------------------------------------------------------------------=
----
@@ -298,64 +350,64 @@
 =

 function menuInit(menu) {
 =

-    var itemList, spanList;
-    var textEl, arrowEl;
-    var itemWidth;
-    var w, dw;
-    var i, j;
-
-    // For IE, replace arrow characters.
-
-    if (browser.isIE) {
-        menu.style.lineHeight =3D "2.5ex";
-        spanList =3D menu.getElementsByTagName("SPAN");
-        for (i =3D 0; i < spanList.length; i++)
-            if (hasClassName(spanList[i], "menuItemArrow")) {
-                spanList[i].style.fontFamily =3D "Webdings";
-                spanList[i].firstChild.nodeValue =3D "4";
-            }
-    }
-
-    // Find the width of a menu item.
-
-    itemList =3D menu.getElementsByTagName("A");
-    if (itemList.length > 0)
-        itemWidth =3D itemList[0].offsetWidth;
-    else
-        return;
-
-    // For items with arrows, add padding to item text to make the
-    // arrows flush right.
-
-    for (i =3D 0; i < itemList.length; i++) {
-        spanList =3D itemList[i].getElementsByTagName("SPAN");
-        textEl =3D null;
-        arrowEl =3D null;
-        for (j =3D 0; j < spanList.length; j++) {
-            if (hasClassName(spanList[j], "menuItemText"))
-                textEl =3D spanList[j];
-            if (hasClassName(spanList[j], "menuItemArrow"))
-                arrowEl =3D spanList[j];
-        }
-        if (textEl !=3D null && arrowEl !=3D null)
-            textEl.style.paddingRight =3D (itemWidth
-                    - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
-    }
-
-    // Fix IE hover problem by setting an explicit width on first item of
-    // the menu.
-
-    if (browser.isIE) {
-        w =3D itemList[0].offsetWidth;
-        itemList[0].style.width =3D w + "px";
-        dw =3D itemList[0].offsetWidth - w;
-        w -=3D dw;
-        itemList[0].style.width =3D w + "px";
-    }
+  var itemList, spanList;
+  var textEl, arrowEl;
+  var itemWidth;
+  var w, dw;
+  var i, j;
+
+  // For IE, replace arrow characters.
+
+  if (browser.isIE) {
+    menu.style.lineHeight =3D "2.5ex";
+    spanList =3D menu.getElementsByTagName("SPAN");
+    for (i =3D 0; i < spanList.length; i++)
+      if (hasClassName(spanList[i], "menuItemArrow")) {
+        spanList[i].style.fontFamily =3D "Webdings";
+        spanList[i].firstChild.nodeValue =3D "4";
+      }
+  }
+
+  // Find the width of a menu item.
+
+  itemList =3D menu.getElementsByTagName("A");
+  if (itemList.length > 0)
+    itemWidth =3D itemList[0].offsetWidth;
+  else
+    return;
+
+  // For items with arrows, add padding to item text to make the
+  // arrows flush right.
+
+  for (i =3D 0; i < itemList.length; i++) {
+    spanList =3D itemList[i].getElementsByTagName("SPAN");
+    textEl  =3D null;
+    arrowEl =3D null;
+    for (j =3D 0; j < spanList.length; j++) {
+      if (hasClassName(spanList[j], "menuItemText"))
+        textEl =3D spanList[j];
+      if (hasClassName(spanList[j], "menuItemArrow"))
+        arrowEl =3D spanList[j];
+    }
+    if (textEl !=3D null && arrowEl !=3D null)
+      textEl.style.paddingRight =3D (itemWidth
+        - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
+  }
+
+  // Fix IE hover problem by setting an explicit width on first item of
+  // the menu.
+
+  if (browser.isIE) {
+    w =3D itemList[0].offsetWidth;
+    itemList[0].style.width =3D w + "px";
+    dw =3D itemList[0].offsetWidth - w;
+    w -=3D dw;
+    itemList[0].style.width =3D w + "px";
+  }
 =

-    // Mark menu as initialized.
+  // Mark menu as initialized.
 =

-    menu.isInitialized =3D true;
+  menu.isInitialized =3D true;
 }
 =

 //------------------------------------------------------------------------=
----
@@ -364,137 +416,391 @@
 =

 function getContainerWith(node, tagName, className) {
 =

-    // Starting with the given node, find the nearest containing element
-    // with the specified tag name and style class.
+  // Starting with the given node, find the nearest containing element
+  // with the specified tag name and style class.
 =

-    while (node !=3D null) {
-        if (node.tagName !=3D null && node.tagName =3D=3D tagName &&
-            hasClassName(node, className))
-            return node;
-        node =3D node.parentNode;
-    }
+  while (node !=3D null) {
+    if (node.tagName !=3D null && node.tagName =3D=3D tagName &&
+        hasClassName(node, className))
+      return node;
+    node =3D node.parentNode;
+  }
 =

-    return node;
+  return node;
 }
 =

 function hasClassName(el, name) {
 =

-    var i, list;
+  var i, list;
 =

-    // Return true if the given element currently has the given class
-    // name.
+  // Return true if the given element currently has the given class
+  // name.
 =

-    list =3D el.className.split(" ");
-    for (i =3D 0; i < list.length; i++)
-        if (list[i] =3D=3D name)
-            return true;
+  list =3D el.className.split(" ");
+  for (i =3D 0; i < list.length; i++)
+    if (list[i] =3D=3D name)
+      return true;
 =

-    return false;
+  return false;
 }
 =

 function removeClassName(el, name) {
 =

-    var i, curList, newList;
+  var i, curList, newClassName;
 =

-    if (el.className =3D=3D null)
-        return;
+  if (el.className =3D=3D null)
+    return;
 =

-    // Remove the given class name from the element's className property.
+  // Remove the given class name from the element's className property.
 =

-    newList =3D new Array();
-    curList =3D el.className.split(" ");
-    for (i =3D 0; i < curList.length; i++)
-        if (curList[i] !=3D name) {
-            // Workaround to replace the push method.
-            var _curList =3D new Array(curList[i]);
-            newList.concat(_curList);
-            // Comment this line because not supported by IE5.0
-            //newList.push(curList[i]);
-        }
-    el.className =3D newList.join(" ");
+  curList =3D el.className.split(" ");
+  for (i =3D 0; i < curList.length; i++)
+    if (curList[i] !=3D name) {
+        if (newClassName =3D=3D null)
+          newClassName =3D curList[i];
+        else  =

+          newClassName +=3D " " + curList[i];
+    }
+  el.className =3D newClassName;
 }
 =

 function getPageOffsetLeft(el) {
 =

-    var x;
-
-    // Return the x coordinate of an element relative to the page.
-
-    x =3D el.offsetLeft;
-    if (el.offsetParent !=3D null)
-        x +=3D getPageOffsetLeft(el.offsetParent);
-
-    return x;
+  // Return the x coordinate of an element relative to the page.
+  =

+  if (el.offsetParent !=3D null)
+    return el.offsetLeft + getPageOffsetLeft(el.offsetParent);
+  else
+    return el.offsetLeft;
 }
 =

 function getPageOffsetTop(el) {
 =

-    var y;
+  // Return the y coordinate of an element relative to the page.
 =

-    // Return the x coordinate of an element relative to the page.
-
-    y =3D el.offsetTop;
-    if (el.offsetParent !=3D null)
-        y +=3D getPageOffsetTop(el.offsetParent);
-
-    return y;
+  if (el.offsetParent !=3D null)
+    return el.offsetTop + getPageOffsetTop(el.offsetParent);
+  else
+    return el.offsetTop;
+}
+
+// Returns the substring starting 1 after the first occurrence of the give=
n regex
+
+function skipAfter(text, regex)
+{
+  var pos =3D text.search(regex);
+  if (pos < 0)
+    return "";
+  return text.substring(pos+1, text.length);
+}
+// Returns the length of what appears to be the longest menu text
+// assuming the menu's innerHTML has some recognizable and
+// not too complex structure (actually looking for some start- and
+// end-tags and the usual call to some OpenJahia... macro and
+// excluding superfluous whitespace and counting entities like &nbsp;
+// &auml; etc. as single char)
+// Note: We keep a minimum length to avoid "tiny" menus and assume
+// a "safe maximum" if the innerHTML's structure does not meet our
+// expectations, i.e. if someone changes the typical menu construction:
+// In such case our parsing expectations should be changed too.
+// Currently we expect menu text enclosed by an anchor tag and within
+// the anchor possibly preceded by an img tag. If the img is present
+// we assume a length increase equivalent to 2 extra characters.
+
+function getMenuTextLength(text)
+{
+  var pos, newLen, len =3D 0, imgLen =3D 0;
+  var entry;
+  while (text.length > 0)
+  {
+    text =3D skipAfter(text, /\<a/i);    // find start of anchor tag
+    text =3D skipAfter(text, /\>/);      // and its closing bracket
+    entry =3D skipAfter(text, /\<span/i); // maybe span tag
+    if (entry !=3D "")                    // if found:
+    {
+      text =3D entry;
+      text =3D skipAfter(text, /\/span>/);    // find its closing bracket
+    }
+    entry =3D skipAfter(text, /\<img/i); // maybe img tag
+    if (entry !=3D "")                   // if found:
+    { imgLen =3D 2;
+      text =3D entry;
+      text =3D skipAfter(text, /\>/);    // find its closing bracket
+    }
+    pos =3D text.search(/\<\/a/i);       // find end-anchor tag
+    if (pos < 0)
+      break;
+    entry =3D text.substring(0, pos);
+    entry =3D semiNormalizeHtmlText(entry);
+    newLen =3D entry.length;
+    len =3D len < newLen ? newLen : len;
+    text =3D text.substring(pos, text.length);
+  }
+  if (len =3D=3D 0)    // no parsing result: menu entries did not have exp=
ected structure
+    len =3D 32;      // return 0
+  len +=3D imgLen;
+  return len > 5 ? len : 5;  // keep minimum length of 5 to avoid "tiny" m=
enus
+}
+
+// Returns a text where character sequences which are displayed
+// as single character have been replaced with a single character.
+// This method was named "semi"-normalize because it does not always
+// use the appropriate replacement character (e.g. the &...uml; sequences
+// are replaced with ? while one of the umlauts =C3=A4=C3=B6=C3=BC=C3=84=
=C3=96=C3=9C would be more
+// appropriate; Also =C3=9F, &, < and > are all mapped to ?. But for our p=
urpose
+// we only care for the number of characters since we just want to determi=
ne
+// the actual text length.
+
+function semiNormalizeHtmlText(text)
+{
+  text =3D text.replace(/\s+/g, " ");            // replace sequences of w=
hitespaces with one space
+                                               // must do this before(!) d=
ealing with non-breaking spaces!
+  text =3D text.replace(/&nbsp;/g, " ");         // non-breaking space
+  text =3D text.replace(/&szlig;/g, "?");        // =C3=9F (replacing with=
 ? rather than =C3=9F because =C3=9F in a String literal causes a syntax er=
ror in IE 5.5
+  text =3D text.replace(/&[AaOoUu]uml;/g, "?");  // =C3=84=C3=96=C3=9C=C3=
=A4=C3=B6=C3=BC (but replacing with ? because abovementioned bug of IE's JS=
cript engine strikes for these characters same as for =C3=9F)
+  text =3D text.replace(/&#x?[^;]{4};/g, "?");   // hex or decimal unicode=
s (&#x20AC; &#8364; etc.)
+  text =3D text.replace(/&[lg]t;/g, "?");        // <>
+  text =3D text.replace(/&quot;/g, "\"");        // double quotes
+  text =3D text.replace(/&amp;/g, "?");          // & (inserting ? rather =
than &: not necessary if this is the
+                                               // last call but if someday=
 someone adds more calls to replace()
+  return text;                                 // he might be fooled by & =
characters that we insert here)
+}
+
+// Returns the horizontal extent beyond which dynamically positioned eleme=
nts
+// like popup menus should not extend in order to not go off-screen
+// and maybe cause the document width to be increased unnecessarily
+
+function getRightWindowBoundary()
+{
+  if (browser.isIE)
+    return document.body.clientWidth + document.body.scrollLeft;
+  else
+  { var areaWidth;
+    if (document.body.clientWidth)            // if possible (it's not sta=
ndard but Firefox knows clientWidth):
+      areaWidth =3D document.body.clientWidth; // get width without vertic=
al scrollbar
+    else                                    // else must subtract 16px for=
 vert scrollbar (if any) from innerWidth
+    { areaWidth =3D window.innerWidth -                              // we=
 don't know if that scrollbar was really vertical
+        (window.scrollbars && window.scrollbars.visible ? 16 : 0); // but =
assume it: better stay on the safe side
+    }
+    return areaWidth + window.pageXOffset;
+  }
+}
+
+// Returns the vertical extent below which dynamically positioned elements
+// like popup menus should not extend in order to not go off-screen
+// and maybe cause the document height to be increased unnecessarily
+
+function getBottomWindowBoundary()
+{
+  if (browser.isIE)
+  {
+    return document.body.clientHeight + document.body.scrollTop;
+  }
+  else
+  { var areaHeight;
+    areaHeight =3D window.innerHeight -
+        (window.scrollbars && window.scrollbars.visible ? 16 : 0); // 16 =
=3D scrollbarheight (but we don't know if really a horiz scrollbar is shown)
+
+    return areaHeight + window.pageYOffset;
+  }
+}
+
+// Set some styles that should be common to all menus
+// but might have been influenced inadvertently by CSS entries:
+// It's hard enough for designers to get a complex page right
+// so the menus should be isolated somewhat from CSS side effects.
+// This function would normally be called before we resize, position
+// and show a popup menu.
+// Note that e.g. for id=3Dmenubar there are stylesheet settings which
+// (for CSS 2.0 at least; maybe not 2.1) take precedence even over local
+// settings because the reference to an id is considered "more specific".
+// Hence we get e.g. a bold font where our popup menu is enclosed by an
+// element with id=3Dmenubar although the popup menu has nothing to do with
+// the menubar. This can only be sorted out by applying an even more speci=
fic
+// style in our stylesheet (actions.css) unless menubar styling is redesig=
ned
+// to key off a style class rather than a specific id.
+
+function applyCommonlyWantedMenuStyles(menu)
+{
+  menu.style.zIndex =3D 32000;        // make sure it pops up above other =
page elements
+                                    // (remember: the menu, too, is just a=
 div on the page!)
+  menu.style.textAlign =3D "left";    // enforce left-alignment for menu e=
ntries (else it looks
+                                    // funny when a menu div gets included=
 in a document section
+                                    // with right-aligned or centered text)
+  menu.style.whiteSpace =3D "nowrap"; // nowrap seems reasonable for menus
+}
+
+// Sets width of menu element as a style since some browsers (Firefox) see=
m to
+// cut off the element (and hence its background) if there's not enough ro=
om
+// for all content - menu icon and text; for this we assume a standard con=
tent
+// structure, see also getMenuTextLength() - but lets the content run outs=
ide the
+// element so that text is hard to read without the proper background behi=
nd it.
+// The div element that constitutes the menu must have the same font-size =
as the
+// anchor element that contains the menu text since we express the require=
d size
+// in em-units of the div's font-size (plus some safety margin).
+// The icon, if detected, is assumed to have a width of roughly 2 characte=
rs.
+// Height is currently not changed since that seems always ok... so far.
+// Note: This function sets styled width to actual value for situations th=
at need
+// no width correction at all since, without this trick, at least IE will =
sometimes
+// show menu icon and text "not on the same line".
+
+function ensureMenuSize(button)
+{
+  var safeMenuHeight =3D button.menu.offsetHeight; // no FF-corrections in=
 this version: just assuming height is ok (which seems to be always the cas=
e for whatever reason)
+  var oldWidth =3D button.menu.offsetWidth;
+  var safeMenuWidth =3D oldWidth; // which is true for IE but not necessar=
ily for other browsers, so we must correct:
+                      // menu element (actually a div) is enclosed in some=
 parent but often positioned halfway outside parent;
+                      // Firefox still shows all text then (default style =
of overflow:visible) but cuts off the div with its
+                      // background (image or color), so the text is hardl=
y readable while IE keeps text and background visible by just enlarging the=
 div:
+
+  if (!browser.isIE                // IE (and newer Opera) provides automa=
tically increased oldWidth here but Firefox cuts off the div at parent boun=
daries;
+      && !browser.isOpera          // for unknown browsers we believe they=
 behave like FF or might even style the div
+                                   // as overflow:hidden by default (who k=
nows) so, to be on the safe side, we treat them just like FF
+      && !button.menu.style.width) // but only if no width has been explic=
itly set to this menu already (either
+                                   // by our mechanism here on an earlier =
invocation for this menu or by the human page designer):
+  {
+    var safeEm =3D 3 + getMenuTextLength(button.menu.innerHTML); // get ch=
arcount of longest entry and add 3 for safety
+    safeEm =3D safeEm * 0.5;                                    // assume:=
 chars average to 0.5em or less in width
+    safeEm +=3D "em";
+    =

+//    button.menu.style.height =3D safeMenuHeight; // does not seem necess=
ary so far: height was always ok on our tests
+    button.menu.style.width =3D safeEm;            // try and set safe wid=
th in em-units
+    safeMenuWidth =3D button.menu.offsetWidth;     // check result in px
+    if (oldWidth > safeMenuWidth)                // for safety:
+      button.menu.style.width =3D oldWidth;        // reset to old px-valu=
e if that was greater
+  }
+  else                                       // in IE, where no width corr=
ection is necessary we explicitly set the width therdiv already has: this s=
eems
+    button.menu.style.width =3D safeMenuWidth; // to avoid "linebreaks" be=
tween icon and menu text in popup menus embedded in certain places (e.g. in=
 our newsbox)
+}
+
+// Returns an iFrame (as supported by MSIE 5.5 and higher)
+// that can cover a windowed control (like a combobox, applet,
+// flash player component etc.) such that a non windowed control
+// (such as a div) which should hover on top of that (typically a
+// popup menu) is not hidden by the windowed control.
+// Note: This has effect only on MSIE 5.5 or higher, where iFrames
+// respect zIndex while all other windowed controls do not.
+// Other browsers don't seem to have the problem and older MSIE
+// versions offer no good solution, so we do nothing for these cases.
+// Also note: The iFrame is stored in elem as property zorderShield,
+// so on element types that need shielding this property name should
+// remain reserved for this purpose!
+
+function getZorderShield(elem)
+{
+  if (!needsZorderShield())
+    return null;
+  =

+  var shield =3D elem.zorderShield;
+  if (shield)
+    return shield;
+  =

+  shield =3D document.createElement("<iframe scrolling=3D'no' frameborder=
=3D'0'"+
+                                      "style=3D'position:absolute; top:0px=
;"+
+                                      "left:0px; display:none'></iframe>")=
; =

+  // shield.style.filter=3D"progid:DXImageTransform.Microsoft.Alpha(style=
=3D0,opacity=3D0)"; // untested (try that in case we need transparent eleme=
nts)
+
+  if (elem.offsetParent =3D=3D null)   // || elem.offsetParent.id=3D=3D"") =

+    window.document.body.appendChild(shield);
+  else =

+    elem.offsetParent.appendChild(shield); =

+
+  elem.zorderShield =3D shield;
+  return shield;
+}
+
+// Activates the z-order shield if applicable so elem
+// (which should be a non-windowed control) is not hidden
+// by windowed controls.
+
+function activateZorderShield(elem)
+{
+  if (!needsZorderShield())
+    return;
+    =

+  var shield =3D getZorderShield(elem);
+        =

+  shield.style.width =3D elem.offsetWidth;
+  shield.style.height =3D elem.offsetHeight;
+  shield.style.top =3D elem.offsetTop;      // elem.style.top;
+  shield.style.left =3D elem.offsetLeft;    // elem.style.left;
+  shield.style.zIndex =3D elem.style.zIndex - 1;
+  shield.style.position =3D "absolute";
+  shield.style.display =3D "block";
+}
+
+// Deactivates the z-order shield if applicable for this browser.
+
+function deactivateZorderShield(elem)
+{
+  if (!needsZorderShield())
+    return;
+  =

+  var shield =3D elem.zorderShield;
+  if (shield)
+    shield.style.display =3D "none";
+}
+
+function needsZorderShield()
+{
+  return (!browser.isOpera && browser.isIE && browser.version > 5.4);
 }
 =

 // Check the browser for DOM manipulation
-function checkBrowser() {
-    this.ver =3D navigator.appVersion;
-    this.dom =3D document.getElementById?1:0;
-    this.ie6 =3D (this.ver.indexOf("MSIE 6") > -1 && this.dom)?1:0;
-    this.ie55 =3D ((this.ver.indexOf("MSIE 5.5") > -1 || this.ie6) && this=
.dom)?1:0;
-    this.ie5 =3D ((this.ver.indexOf("MSIE 5") > -1 || this.ie5 || this.ie6=
) && this.dom)?1:0;
-    this.ie4 =3D (document.all && !this.dom)?1:0;
-    this.ns5 =3D (this.dom && parseInt(this.ver) >=3D 5) ?1:0;
-    this.ns4 =3D (document.layers && !this.dom)?1:0;
-    this.ie4plus =3D (this.ie6 || this.ie5 || this.ie4);
-    this.ie5plus =3D (this.ie6 || this.ie5)
-    this.bw =3D (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5);
-    return this;
+function checkBrowser(){
+       this.ver=3Dnavigator.appVersion;
+       this.dom=3Ddocument.getElementById?1:0;
+       this.ie6=3D(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
+       this.ie55=3D((this.ver.indexOf("MSIE 5.5")>-1 || this.ie6) && 
this.dom)?1=
:0;
+       this.ie5=3D((this.ver.indexOf("MSIE 5")>-1 || this.ie5 || this.ie6) && 
th=
is.dom)?1:0;
+       this.ie4=3D(document.all && !this.dom)?1:0;
+       this.ns5=3D(this.dom && parseInt(this.ver) >=3D 5) ?1:0;
+       this.ns4=3D(document.layers && !this.dom)?1:0;
+       this.ie4plus=3D(this.ie6 || this.ie5 || this.ie4);
+       this.ie5plus=3D(this.ie6 || this.ie5)
+       this.bw=3D(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5);
+       return this;
 }
 =

 bw =3D new checkBrowser();
 =

 // Get an Object contained in a DOM document by its ID attribute
-function getObjectById(ID) {
-    var obj;
-    if (bw.dom)
-        return document.getElementById(ID);
-    else if (bw.ie4)
-        return document.all(ID);
-    else
-        alert("Error: Your browser version is not supported. Please upgrad=
e...");
+function getObjectById (ID) {
+       var obj;
+       if (bw.dom)
+               return document.getElementById (ID);
+       else if (bw.ie4)
+               return document.all (ID);
+       else
+               alert ("Error: Your browser version is not supported. Please 
upgrade..."=
);
     return null;
 }
 =

 // Returns an array of values. The delimiter is the ',' character
-function getNodeValues(content, nodeName) {
-    var tag =3D "<" + nodeName + ">";
-    var start =3D content.indexOf(tag);
-    var end =3D content.indexOf("</" + nodeName + ">");
-
-    if (start < end) {
-        var values =3D content.substring(start + tag.length, end);
-        return values.split(";;");
-    } else {
-        return new Array (0);
-    }
+function getNodeValues (content, nodeName) {
+       var tag =3D "<" + nodeName + ">";
+       var start =3D content.indexOf (tag);
+       var end   =3D content.indexOf ("</" + nodeName + ">");
+
+       if (start < end) {
+           var values =3D content.substring (start + tag.length, end);
+               return values.split (";;");
+       } else {
+               return new Array (0);
+       }
 }
 =

 // Returns the value of an XML tag
-function getNodeValue(content, nodeName) {
-    var tag =3D "<" + nodeName + ">";
-    var start =3D content.indexOf(tag);
-    var end =3D content.indexOf("</" + nodeName + ">");
-
-    if (start < end) {
-        return content.substring(start + tag.length, end);
-    } else {
-        return null;
-    }
+function getNodeValue (content, nodeName) {
+       var tag =3D "<" + nodeName + ">";
+       var start =3D content.indexOf (tag);
+       var end   =3D content.indexOf ("</" + nodeName + ">");
+
+       if (start < end) {
+               return content.substring (start + tag.length, end);
+       } else {
+               return null;
+       }
 }
 =

 // AJAX based function to get all Actions to fill up the Action menu
@@ -509,113 +815,114 @@
 =

         var url =3D context + "/ajaxaction/GetMenuItems";
 =

-        if (method =3D=3D "GET") {
-            url +=3D "?" + data;
-            data =3D null;
-        }
-
-        // Create new XMLHttpRequest request
-        if (window.XMLHttpRequest) {
-            req =3D new XMLHttpRequest ();
-
-        } else if (window.ActiveXObject) {
-            req =3D new ActiveXObject ("Microsoft.XMLHTTP");
-
-        } else {
-            alert("Error: Your Browser does not support XMLHTTPRequests, p=
lease upgrade...");
-            return;
-        }
-
-        req.open(method, url, true);
-
-        req.onreadystatechange =3D function () {
-            buildActionMenu();
-        }
-
-        if (method =3D=3D "POST") {
-            req.setRequestHeader("Content-type", "application/x-www-form-u=
rlencoded");
-        }
-        req.send(data);
-
-    } catch (e) {
-        alert("Exception sending the Request: " + e);
-    }
+               if (method =3D=3D "GET") {
+                       url +=3D "?" + data;
+                       data =3D null;
+               }
+
+               // Create new XMLHttpRequest request
+       if (window.XMLHttpRequest) {
+               req =3D new XMLHttpRequest ();
+
+       } else if (window.ActiveXObject) {
+               req =3D new ActiveXObject ("Microsoft.XMLHTTP");
+
+       } else {
+                       alert ("Error: Your Browser does not support 
XMLHTTPRequests, please up=
grade...");
+                       return;
+               }
+
+               req.open (method, url, true);
+
+               req.onreadystatechange =3D function () {
+                       buildActionMenu();
+               }
+
+               if (method =3D=3D "POST") {
+                       req.setRequestHeader ("Content-type", 
"application/x-www-form-urlencode=
d");
+               }
+               req.send (data);
+
+       } catch (e) {
+               alert ("Exception sending the Request: " + e);
+       }
 }
 =

 // Build the Action Menu
-function buildActionMenu() {
-    var readyState =3D req.readyState;
-    if (req.readyState =3D=3D 4) {
-        // alert ("resp: " + req.responseText);
-        if (req.status =3D=3D 200) {
-            try {
-                var response =3D req.responseText;
+function buildActionMenu () {
+       var readyState =3D req.readyState;
+       if (req.readyState =3D=3D 4) {
+               // alert ("resp: " + req.responseText);
+       if (req.status =3D=3D 200) {
+                       try {
+                               var response =3D req.responseText;
                 var uniqueID =3D getNodeValue(response, "domid");
 =

-                var methods =3D getNodeValues(response, "method");
-                var launchers =3D getNodeValues(response, "launcher");
-                var images =3D getNodeValues(response, "image");
+                               var methods =3D getNodeValues (response, 
"method");
+                               var launchers =3D getNodeValues (response, 
"launcher");
+                               var images =3D getNodeValues (response, 
"image");
+                               var styleClasses =3D getNodeValues (response, 
"styleClass");                            =

 =

-                var fieldset =3D getNodeValue(response, "fieldset");
-                updateFieldSet(uniqueID, fieldset);
+                               var fieldset =3D getNodeValue (response, 
"fieldset");
+                               updateFieldSet (uniqueID, fieldset);
 =

-                addActions(uniqueID, methods, launchers, images);
+                               addActions (uniqueID, methods, launchers, 
images, styleClasses);
 =

                 // changeURL(uniqueID);
 =

-                buttonClick(uniqueID);
-
-            } catch (e) {
-                alert("Exception building Action Menu: " + e);
-            }
+                               buttonClick (null, uniqueID);
 =

-        } else {
-            alert("There was a problem processing the request. Status: " +
-                  req.status + ", msg: " + req.statusText);
-        }
-        document.body.style.cursor =3D "default";
-    }
+                       } catch (e) {
+                               alert ("Exception building Action Menu: " + e);
+                       }
+
+               } else {
+                       alert ("There was a problem processing the request. 
Status: " +
+                                                  req.status + ", msg: " + 
req.statusText);
+               }
+               document.body.style.cursor =3D "default";
+       }
 }
 =

 // Changes the default grey border. Use in case the object is locked for e=
xample
-function updateFieldSet(id, param) {
-    // alert ("Updating fieldSet for " + id + ", param =3D " + param);
+function updateFieldSet (id, param) {
+       // alert ("Updating fieldSet for " + id + ", param =3D " + param);
     if (param =3D=3D null) {
         return;
     }
 =

-    var setID =3D "fieldset_" + id;
-    var setElem =3D getObjectById(setID);
+       var setID =3D "fieldset_" + id;
+       var setElem =3D getObjectById (setID);
 =

-    var content;
-    if (param =3D=3D "complete") {
-        content =3D "completeLocked";
+       var content;
+       if (param =3D=3D "complete") {
+               content =3D "completeLocked";
 =

-    } else if (param =3D=3D "partial") {
-        content =3D "partialLocked";
+       } else if (param =3D=3D "partial") {
+               content =3D "partialLocked";
 =

-    } else {
-        return;
-    }
+       } else {
+               content =3D "unlocked";
+       }
 =

-    setElem.className =3D content;
+       setElem.className =3D content;
 }
 =

 // Changes the href value of the given element
-function changeURL(id) {
-    var button =3D getObjectById("button_" + id);
-    button.href =3D "javascript:buttonClick('" + id + "');";
+function changeURL (id) {
+       var button =3D getObjectById ("button_" + id);
+       button.href =3D "javascript:buttonClick(null, '" + id + "');";
 }
 =

 // Adds the Actions to the action menu
-function addActions(id, methods, launchers, images) {
+function addActions(id, methods, launchers, images, styleClasses) {
     var menuDiv =3D getObjectById(id);
     var content =3D "\n";
 =

     var i;
     for (i =3D 0; i < methods.length-1; i++) {
        //alert("i=3D"+i+methods[i])
-       =

+
        if(methods[i]=3D=3D"copies"){
 =

             //specific code to display the list of pickers
@@ -625,7 +932,7 @@
 =

                 content +=3D"<a class=3D\"menuItem\" href=3D\""+parts[3]+"=
\" title=3D\"id:"+parts[0]+"\"><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;"+parts[2]+"</i></a>"
             } else {
-                content +=3D printLauncher(launchers[i]) + printImage(imag=
es[i]) + printMethod(methods[i]);
+                content +=3D printLauncher(launchers[i]) + printImage(styl=
eClasses[i], images[i]) + printMethod(methods[i]);
              }
 =

     }
@@ -633,21 +940,28 @@
 }
 =

 // Returns a String for the Action Launcher URI
-function printLauncher(launcher) {
-    return "   <a class=3D\"menuItem\" href=3D\"javascript:" + launcher + =
"\">\n";
+function printLauncher (launcher) {
+       return "   <a class=3D\"menuItem\" href=3D\"javascript:" + launcher + 
"\"=
>\n";
 }
 =

 // Returns a String for the Action Image
-function printImage(imageName) {
-    return "      <img src=3D\"" + imageName + "\" alt=3D\"\" border=3D\"0=
\" />&nbsp;";
+function printImage (styleClass, imageName) {
+    var imageTag =3D "      <span class=3D\"" + styleClass + "\">";
+    if (imageName !=3D null && imageName.length > 0) {
+      imageTag +=3D "<img class=3D\"" + styleClass + "\" src=3D\"" + image=
Name + "\" alt=3D\"\" border=3D\"0\" />";
+    } else {
+      imageTag +=3D "&nbsp;";    =

+    }
+    imageTag +=3D "</span>";
+       return imageTag;
 }
 =

 // Returns a String for the Action method name
-function printMethod(methodName) {
-    return methodName + "\n   </a>\n";
+function printMethod (methodName) {
+       return methodName + "\n   </a>\n";
 }
 =

-function clipboard(context, objectKey, op, pageID) {
+function clipboard (context, objectKey, op, pageID) {
     document.body.style.cursor =3D "wait";
     try {
         // correct values are "POST" or "GET" (HTTP methods).
@@ -655,34 +969,34 @@
         var data =3D "key=3D" + objectKey + "&cop=3D" + op;
         var url =3D jahiaMainServletPath + "/op/edit/engineName/clipboard/=
pid/" + pageID ;
 =

-        if (method =3D=3D "GET") {
-            url +=3D "?" + data;
-            data =3D null;
-        }
-
-        // Create new XMLHttpRequest request
-        if (window.XMLHttpRequest) {
-            req =3D new XMLHttpRequest ();
-
-        } else if (window.ActiveXObject) {
-            req =3D new ActiveXObject ("Microsoft.XMLHTTP");
-
-        } else {
-            alert("Error: Your Browser does not support XMLHTTPRequests, p=
lease upgrade...");
-            return;
-        }
+               if (method =3D=3D "GET") {
+                       url +=3D "?" + data;
+                       data =3D null;
+               }
+
+               // Create new XMLHttpRequest request
+       if (window.XMLHttpRequest) {
+               req =3D new XMLHttpRequest ();
+
+       } else if (window.ActiveXObject) {
+               req =3D new ActiveXObject ("Microsoft.XMLHTTP");
+
+       } else {
+                       alert ("Error: Your Browser does not support 
XMLHTTPRequests, please up=
grade...");
+                       return;
+               }
 =

-        req.open(method, url, true);
+               req.open (method, url, true);
 =

-        if (op =3D=3D "paste") {
-            req.onreadystatechange =3D function () {
+               if (op =3D=3D "paste") {
+                   req.onreadystatechange =3D function () {
                 if (req.readyState =3D=3D 4) {
                     document.body.style.cursor =3D "default";
                     window.location.reload();
                 }
-            }
-        } else {
-            req.onreadystatechange =3D function () {
+               }
+           } else {
+                   req.onreadystatechange =3D function () {
                 if (req.readyState =3D=3D 4) {
                     //copy
                     myurl =3D "http://"; + document.location.host + context=
 + "/jsp/jahia/engines/images/clipboard_next.png";
@@ -693,15 +1007,15 @@
                     document.body.style.cursor =3D "default";
                 }
             }
-        }
+           }
 =

-        if (method =3D=3D "POST") {
-            req.setRequestHeader("Content-type", "application/x-www-form-u=
rlencoded");
-        }
-        req.send(data);
-    } catch (e) {
-        alert("Exception sending the Request: " + e);
-    }
+               if (method =3D=3D "POST") {
+                       req.setRequestHeader ("Content-type", 
"application/x-www-form-urlencode=
d");
+               }
+               req.send (data);
+       } catch (e) {
+               alert ("Exception sending the Request: " + e);
+       }
 }
 =

 function getWorkflowState(context, key, pid) {

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to