details:   /erp/devel/pi/rev/4a73659a9927
changeset: 7878:4a73659a9927
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Tue Jul 13 18:14:24 2010 +0200
summary:   Fixed issue 13669: Now SF banner is loaded at the end (instead of at 
the beginning)

diffstat:

 src/org/openbravo/erpCommon/security/Login_F1.html |  25 +++++++-
 web/js/utils.js                                    |  71 +++++++++++++++++++--
 2 files changed, 86 insertions(+), 10 deletions(-)

diffs (150 lines):

diff -r e12428e2fe3c -r 4a73659a9927 
src/org/openbravo/erpCommon/security/Login_F1.html
--- a/src/org/openbravo/erpCommon/security/Login_F1.html        Tue Jul 13 
17:43:42 2010 +0200
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html        Tue Jul 13 
18:14:24 2010 +0200
@@ -77,6 +77,27 @@
 
 </script>
 <script language="JavaScript" type="text/javascript">
+  function hideSFBanner() {
+    try {
+      addStyleRule(".Login_Logo_SourceForge", "background: none;");
+    } catch (e) {
+    }
+  }
+
+  function showSFBanner() {
+    try {
+      var classPositionArray = getStyleRulePosition(".Login_Logo_SourceForge");
+      var classPosition = classPositionArray[classPositionArray.length-1];
+      if (classPositionArray.length > 0) {
+        removeStyleRule(classPosition);
+      }
+    } catch (e) {
+    }
+  }
+
+  hideSFBanner();
+</script>
+<script language="JavaScript" type="text/javascript">
   function onLoadDo() {
     redirectWhenPopup();
     this.windowTables = new Array(
@@ -90,13 +111,15 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if ((!revisionControl('7833')) || (isOpsInstance() != 
isOpsInstanceCached())) {
+    if ((!revisionControl('7876')) || (isOpsInstance() != 
isOpsInstanceCached())) {
       alert(cacheMsg);
     }
 
     if (!checkBrowserCompatibility()) {
       alert(browserMsg);
     }
+
+    showSFBanner();
   }
 
   function onResizeDo() {
diff -r e12428e2fe3c -r 4a73659a9927 web/js/utils.js
--- a/web/js/utils.js   Tue Jul 13 17:43:42 2010 +0200
+++ b/web/js/utils.js   Tue Jul 13 18:14:24 2010 +0200
@@ -88,7 +88,7 @@
 * Return a number that would be checked at the Login screen to know if the 
file is cached with the correct version
 */
 function getCurrentRevision() {
-  var number = '7833';
+  var number = '7876';
   return number;
 }
 
@@ -3139,11 +3139,9 @@
 }
 
 /**
-* Adds a style definition to Openbravo ERP main CSS
-* @param {String} selector
-* @param {declaration} declaration
-*/
-function addStyleRule (selector, declaration) {
+* Gets Openbravo_ERP css javascript reference
+*/
+function getOpenbravoERPStyleSheet() {
   var stylesheet;
 
   for (var i=0; i < document.styleSheets.length; i++) {
@@ -3155,16 +3153,71 @@
     }
   }
 
- if (typeof stylesheet === "object") {
-    if (stylesheet.addRule) {
+  return stylesheet;
+}
+
+/**
+* Adds a style definition to Openbravo ERP main CSS in last position
+* @param {String} selector
+* @param {declaration} declaration
+*/
+function addStyleRule(selector, declaration) {
+  var stylesheet = getOpenbravoERPStyleSheet();
+
+  if (typeof stylesheet === "object") {
+    if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1) {
       stylesheet.addRule(selector, declaration);
-    } else if (stylesheet.insertRule) {
+    } else {
       stylesheet.insertRule(selector + ' { ' + declaration + ' }', 
stylesheet.cssRules.length);
     }
   }
 }
 
 /**
+* Removes a style definition at given position in Openbravo ERP main CSS
+* @param {Ingeter} selectorIndex
+*/
+function removeStyleRule(selectorIndex) {
+  var stylesheet = getOpenbravoERPStyleSheet();
+
+  if (typeof stylesheet === "object") {
+    if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1) {
+      stylesheet.removeRule(selectorIndex);
+    } else {
+      stylesheet.deleteRule(selectorIndex);
+    }
+  }
+}
+
+/**
+* Returns an array with the desired selector positions
+* @param {String} selector
+* @param {declaration} declaration
+*/
+function getStyleRulePosition(selector) {
+  var stylesheet = getOpenbravoERPStyleSheet();
+  var position = new Array();
+  var i;
+
+ if (typeof stylesheet === "object") {
+    if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1) {
+      for (i=0; i < stylesheet.rules.length; i++) {
+        if (stylesheet.rules[i].selectorText.toLowerCase() === 
selector.toLowerCase()) {
+          position.push(i);
+        }
+      }
+    } else {
+      for (i=0; i < stylesheet.cssRules.length; i++) {
+        if (typeof stylesheet.cssRules[i].selectorText !== "undefined" && 
stylesheet.cssRules[i].selectorText.toLowerCase() === selector.toLowerCase()) {
+          position.push(i);
+        }
+      }
+    }
+  }
+  return position;
+}
+
+/**
 * Small changes in a 2.50 skin to proper view in a MDI tab
 */
 function adaptSkinToMDIEnvironment() {

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to