Fixed issue 15055. Force reload of purpose image or system info window using 2.50 ui.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Thu, 28 Oct 2010 16:03:36 +0200
changeset 8783 beedd2ff8f70
parent 8782 2b2594b366d7
child 8784 0ead9342d172
Fixed issue 15055. Force reload of purpose image or system info window using 2.50 ui.
src/org/openbravo/erpCommon/ad_forms/InstancePurpose.html
src/org/openbravo/erpCommon/utility/Home.html
--- a/src/org/openbravo/erpCommon/ad_forms/InstancePurpose.html	Thu Oct 28 15:36:33 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/InstancePurpose.html	Thu Oct 28 16:03:36 2010 +0200
@@ -59,9 +59,10 @@
     window.close();
   }
   function buttonOK() {
-    if (document.frmMain.instancePurpose.value == null || document.frmMain.instancePurpose.value == "") {
+    var purpose = document.frmMain.instancePurpose;
+    if (purpose.value == null || purpose.value == "") {
       displayLogicElement('noPurposeSelected', true);
-      setWindowElementFocus(document.frmMain.instancePurpose);
+      setWindowElementFocus(purpose);
       return false;
     }
 
@@ -72,7 +73,24 @@
       openHeartbeat();
     if (nextPopup == 'R')
       openRegistration();
-    window.close();
+    if (!isWindowInMDIContext) {
+      var appFrame = getFrame('appFrame');
+      if (appFrame && !appFrame.updatePurposeImage) {
+        if (appFrame.document.getElementById('buttonRefresh')) {
+          appFrame.document.getElementById('buttonRefresh').onclick();
+        } else {
+          window.close();
+        }
+      } else if (appFrame) {
+        appFrame.updatePurposeImage(purpose.value);
+        window.close();
+      } else {
+        window.close();
+      }
+    } else {
+      window.close();
+    }
+
   }
   </script>
   <script language="JavaScript" type="text/javascript">
--- a/src/org/openbravo/erpCommon/utility/Home.html	Thu Oct 28 15:36:33 2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/Home.html	Thu Oct 28 16:03:36 2010 +0200
@@ -30,6 +30,21 @@
 <script language="JavaScript" type="text/javascript" id="paramLanguage">var defaultLang = "en_US";</script>
 <script type="text/javascript" id="fieldUrls"></script>
 <script language="JavaScript" type="text/javascript">
+  function updatePurposeImage(purposeCode) {
+    var divPurpose = document.getElementById('cbPurpose');
+    if (purposeCode == 'D') {
+      divPurpose.className = 'Login_Home_Community_Branding_development';
+    } else if (purposeCode == 'P') {
+      divPurpose.className = 'Login_Home_Community_Branding_production';
+    } else if (purposeCode == 'T') {
+      divPurpose.className = 'Login_Home_Community_Branding_testing';
+    } else if (purposeCode == 'E') {
+      divPurpose.className = 'Login_Home_Community_Branding_evaluation';
+    } else {
+      divPurpose.className = 'Login_Home_Community_Branding_unknown';
+    }
+  }
+
   function setIframeUrl() {
     var iframe = document.getElementById('cbiframe');
     if(!iframe) {