From 97f427254660d390d357e68e412c29a4abd91b2d Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 15 May 2007 16:36:58 +0000 Subject: [PATCH] Fix to some IE6 related issues with portlet template refactoring, improved exception handing in WebScriptServlet git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5686 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../client/portlet_node_summary_panel.ftl | 14 +-- .../alfresco/portlets/doclist_get_html.ftl | 23 ++-- .../alfresco/portlets/mytasks_get_html.ftl | 2 +- .../alfresco/portlets/mywebforms_get_html.ftl | 2 +- .../web/scripts/WebScriptServlet.java | 11 +- source/web/scripts/ajax/common.js | 119 +++++++++++++++++- 6 files changed, 130 insertions(+), 41 deletions(-) diff --git a/config/alfresco/templates/client/portlet_node_summary_panel.ftl b/config/alfresco/templates/client/portlet_node_summary_panel.ftl index c38f73c903..016a2a8c24 100644 --- a/config/alfresco/templates/client/portlet_node_summary_panel.ftl +++ b/config/alfresco/templates/client/portlet_node_summary_panel.ftl @@ -19,7 +19,7 @@ - + <#assign isImage=node.isDocument && (node.mimetype = "image/gif" || node.mimetype = "image/jpeg" || node.mimetype = "image/png")> <#assign isVideo=node.isDocument && node.mimetype?starts_with("video/")> <#if isImage> @@ -33,18 +33,16 @@ <#else> - +
- - - - + +
- +
@@ -88,4 +86,4 @@ - \ No newline at end of file + diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl index 731461c87d..9752668eea 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl @@ -2,9 +2,9 @@ + - @@ -60,15 +60,13 @@ <#assign count=count+1>
- document + ${d.name}
-
-
- ${d.name?html} - - - -
+
+ ${d.name?html} + + +
@@ -151,13 +149,6 @@ a.docfilterLinkSelected:link, a.docfilterLinkSelected:visited border-bottom: 1px solid #CCD4DB; } -.docRowAlt -{ - padding-top: 4px; - border-bottom: 1px solid #CCD4DB; - background-color: #EEF7FB; -} - .docFooter { width: 700px; diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks_get_html.ftl index 0705e66da5..579c6dc67c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks_get_html.ftl @@ -2,9 +2,9 @@ + - diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl index da69ee7713..ef1b1809d3 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl @@ -2,9 +2,9 @@ + - diff --git a/source/java/org/alfresco/web/scripts/WebScriptServlet.java b/source/java/org/alfresco/web/scripts/WebScriptServlet.java index 568f5ad1ef..fdaa662d8a 100644 --- a/source/java/org/alfresco/web/scripts/WebScriptServlet.java +++ b/source/java/org/alfresco/web/scripts/WebScriptServlet.java @@ -91,15 +91,8 @@ public class WebScriptServlet extends HttpServlet if (logger.isDebugEnabled()) logger.debug("Processing request (" + req.getMethod() + ") " + req.getRequestURL() + (req.getQueryString() != null ? "?" + req.getQueryString() : "")); - try - { - WebScriptRuntime runtime = new WebScriptServletRuntime(registry, transactionService, authenticator, req, res); - runtime.executeScript(); - } - catch(Throwable e) - { - res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } + WebScriptRuntime runtime = new WebScriptServletRuntime(registry, transactionService, authenticator, req, res); + runtime.executeScript(); } } diff --git a/source/web/scripts/ajax/common.js b/source/web/scripts/ajax/common.js index 88264a4e57..bb8cd36beb 100644 --- a/source/web/scripts/ajax/common.js +++ b/source/web/scripts/ajax/common.js @@ -210,7 +210,115 @@ function getContextPath() return txt; }, - + + /** + * Returns the x/y position of the element in page coordinates. + * Takes all parent scrollable containers into account. + */ + getPageXY: function(el) + { + var parentNode = null; + var pos = new Object(); + + if (el.getBoundingClientRect) // IE + { + var box = el.getBoundingClientRect(); + var doc = document; + + var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop); + var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft); + + pos.x = box.left + scrollLeft; + pos.y = box.top + scrollTop; + + return pos; + } + else + { + // firefox, opera + pos.x = el.offsetLeft; + pos.y = el.offsetTop; + parentNode = el.offsetParent; + if (parentNode != el) + { + while (parentNode) + { + pos.x += parentNode.offsetLeft; + pos.y += parentNode.offsetTop; + parentNode = parentNode.offsetParent; + } + } + } + + if (el.parentNode) + { + parentNode = el.parentNode; + } + else + { + parentNode = null; + } + + while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML') + { + // account for any scrolled ancestors + if ($(parentNode).getStyle('display') != 'inline') + { + pos.x -= parentNode.scrollLeft; + pos.y -= parentNode.scrollTop; + } + + if (parentNode.parentNode) + { + parentNode = parentNode.parentNode; + } + else + { + parentNode = null; + } + } + + return pos; + }, + + /** + * Returns the height of the document. + */ + getDocumentHeight: function() + { + var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight; + return Math.max(scrollHeight, this.getViewportHeight()); + }, + + /** + * Returns the width of the document. + */ + getDocumentWidth: function() + { + var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth; + return Math.max(scrollWidth, this.getViewportWidth()); + }, + + /** + * Returns the current height of the viewport. + */ + getViewportHeight: function() + { + return (document.compatMode == 'CSS1Compat') ? + document.documentElement.clientHeight : // Standards + document.body.clientHeight; // Quirks + }, + + /** + * Returns the current width of the viewport. + */ + getViewportWidth: function() + { + return (document.compatMode == 'CSS1Compat') ? + document.documentElement.clientWidth : // Standards + document.body.clientWidth; // Quirks + }, + /** * Aligns an element against the specified element. Automatically adjusts the element above or to * the left of the destination if the element would cause a scrollbar to appear. @@ -221,12 +329,11 @@ function getContextPath() */ smartAlignElement: function (el, destEl, maxwidth) { - // extend elements with useful mootools prototypes + // extend element with useful mootools prototypes el = $(el); - destEl = $(destEl); // get the position of the element we are aligning against - var pos = destEl.getPosition(); + var pos = this.getPageXY(destEl); // calculate display position for the element var region = el.getCoordinates(); @@ -237,7 +344,7 @@ function getContextPath() { if (elWidth > maxwidth) elWidth = maxwidth; } - var docWidth = Window.innerWidth + Window.scrollMaxX; + var docWidth = this.getDocumentWidth(); if (pos.x + 20 + elWidth < docWidth) { el.style.left = (pos.x + 20) + "px"; @@ -247,7 +354,7 @@ function getContextPath() // Shifting X coord left - overflow el.style.left = (pos.x + 20 - ((pos.x + elWidth) - docWidth)) + "px"; } - if (pos.y + 12 + elHeight < (Window.innerHeight + Window.scrollMaxY)) + if (pos.y + 12 + elHeight < this.getDocumentHeight()) { el.style.top = (pos.y + 12) + "px"; }