Related to issue 20207: Improved style of labels after checkboxes in IE9 and HTML5
authorDavid Baz Fayos <david.baz@openbravo.com>
Fri, 11 May 2012 01:24:29 +0200
changeset 16492 b53dc1683c2c
parent 16491 29d705534d05
child 16493 6fef658096a2
Related to issue 20207: Improved style of labels after checkboxes in IE9 and HTML5
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/SelectExpectedPayments.html
web/js/utils.js
web/skins/Default/Openbravo_ERP_250.css
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/SelectExpectedPayments.html	Thu May 10 21:06:22 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/SelectExpectedPayments.html	Fri May 11 01:24:29 2012 +0200
@@ -441,7 +441,7 @@
             <tr>
               <td class="Radio_Check_ContentCell" colspan="3">
                 <span class="Radio_Check_ContentCell Checkbox_container_NOT_Focused"><input type="checkbox" name="inpAlternativePaymentMethod" value="Y" id="paramAlternativePaymentMethod" onclick="loadGridList()"></input></span>
-                <span class="TitleCell LabelText"><label for="paramAlternativePaymentMethod">Show payments for alternative payment methods</label></span>
+                <span class="TitleCell LabelText"><label for="paramAlternativePaymentMethod" class="LabelTextAfterCheckbox">Show payments for alternative payment methods</label></span>
               </td>
               <td class="TableEdition_OneCell_width"></td>
               <td class="TableEdition_OneCell_width"></td>
--- a/web/js/utils.js	Thu May 10 21:06:22 2012 +0200
+++ b/web/js/utils.js	Fri May 11 01:24:29 2012 +0200
@@ -33,12 +33,14 @@
   isWindowInMDITab = checkWindowInMDITab();
   isWindowInMDIPage = checkWindowInMDIPage();
   isWindowInMDIContext = checkWindowInMDIContext();
+  isRTL = checkWindowInRTLMode();
   if (isWindowInMDIPage) {
     adaptSkinToMDIEnvironment();
   }
 }
 
 var isIE9Strict = false;
+var isRTL = false;
 var isWindowInMDIPopup = false;
 var isWindowInMDITab = false;
 var isWindowInMDIPage = false;
@@ -3403,6 +3405,12 @@
   if (isIE9Strict) {
     addStyleRule("th.DataGrid_Header_Cell", "height: 20px;");
 
+    if (!isRTL) {
+      addStyleRule('.LabelTextAfterCheckbox', 'margin-left: 15px;');
+    } else {
+      addStyleRule('.LabelTextAfterCheckbox', 'margin-right: 15px;');
+    }
+
     var messageType = {};
     messageType.name = ['ERROR', 'INFO', 'SUCCESS', 'WARNING'];
     messageType.backgroundColor = ['C72F15', '5886BF', '7BBF58', 'ECE274'];
@@ -5728,6 +5736,28 @@
   } catch (e) { }
 }
 
+/*
+ * Function that checks if the rendered html is rendered in RTL mode or not.
+ */
+function checkWindowInRTLMode() {
+  var strDirection = '';
+  var htmlTag = document.getElementsByTagName('html')[0];
+
+  if (htmlTag) {
+    if(document.defaultView && document.defaultView.getComputedStyle){
+      strDirection = document.defaultView.getComputedStyle(htmlTag, '').getPropertyValue('direction');
+    } else if(htmlTag.currentStyle){
+      strDirection = htmlTag.currentStyle['direction'];
+    }
+  }
+
+  if (strDirection.toLowerCase() === 'rtl') {
+    return true;
+  } else {
+    return false;
+  }
+}
+
 function fixIE9WindowBorders() {
   if (isIE9Strict) {
     var leftContentPane = getElementsByClassName('Main_ContentPane_Left', 'table');
--- a/web/skins/Default/Openbravo_ERP_250.css	Thu May 10 21:06:22 2012 +0200
+++ b/web/skins/Default/Openbravo_ERP_250.css	Fri May 11 01:24:29 2012 +0200
@@ -2869,6 +2869,9 @@
   color: #404040;
 }
 
+.LabelTextAfterCheckbox {
+}
+
 .Label_ReadOnly_Text {
   font-size: 8pt;
   font-weight: bold;