Move some more RTL code out of tree renderer
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 23 Aug 2010 20:56:13 +0000 (14:56 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 24 Aug 2010 06:00:58 +0000 (00:00 -0600)
framework/Core/lib/Horde/Core/Tree/Javascript.php
horde/js/hordetree.js
horde/js/sidebar.js
horde/services/sidebar.php
horde/templates/sidebar/sidebar.inc
horde/themes/rtl.css
horde/themes/screen.css

index 9335509..c743ba7 100644 (file)
@@ -96,8 +96,6 @@ class Horde_Core_Tree_Javascript extends Horde_Core_Tree_Html
             'imgNullOnly' => $this->_images['null_only'],
             'imgLeaf' => $this->_images['leaf'],
 
-            'floatDir' => (empty($GLOBALS['registry']->nlsconfig['rtl'][$GLOBALS['language']]) ? 'left' : 'right'),
-
             'initTree' => $this->renderNodeDefinitions()
         );
 
index cc4be0f..320c1c9 100644 (file)
@@ -36,10 +36,6 @@ var Horde_Tree = Class.create({
         this.node_pos = [];
         this.output = document.createDocumentFragment();
 
-        if (!this.div_temp) {
-            this.div_temp = new Element('DIV').setStyle({ cssFloat: this.opts.floatDir });
-        }
-
         this._buildHeader();
 
         this.rootNodes.each(function(r) {
@@ -71,7 +67,7 @@ var Horde_Tree = Class.create({
         var div = new Element('DIV');
 
         this.opts.header.each(function(h) {
-            var tmp = this.div_temp.clone().insert(h.html ? h.html : '&nbsp;');
+            var tmp = new Element('DIV').insert(h.html ? h.html : '&nbsp;');
 
             if (h['class']) {
                 tmp.addClassName(h['class']);
@@ -84,6 +80,8 @@ var Horde_Tree = Class.create({
             if (h.align) {
                 tmp.setStyle({ textAlign: h.align });
             }
+
+            div.appendChild(tmp);
         }, this);
 
         this.output.appendChild(div);
@@ -127,15 +125,15 @@ var Horde_Tree = Class.create({
         // any given cell of content.
         if (node.extra && node.extra[0]) {
             node.extra[0].each(function(n) {
-                div.insert(this._divWidth(this.div_temp.clone().update(n), column++));
+                div.insert(this._divWidth(new Element('DIV').update(n), column++));
             }, this);
         }
 
         for (; column < this.opts.extraColsLeft; ++column) {
-            div.insert(this._divWidth(this.div_temp.clone().update('&nbsp;'), column));
+            div.insert(this._divWidth(new Element('DIV').update('&nbsp;'), column));
         }
 
-        div.insert(this._divWidth(this.div_temp.clone(), column));
+        div.insert(this._divWidth(new Element('DIV'), column));
 
         tmp = document.createDocumentFragment();
         for (i = Number(this.renderStatic); i < node.indent; ++i) {
@@ -201,12 +199,12 @@ var Horde_Tree = Class.create({
 
         if (node.extra && node.extra[1]) {
             node.extra[1].each(function(n) {
-                div.insert(this._divWidth(this.div_temp.clone().update(n), column++));
+                div.insert(this._divWidth(new Element('DIV').update(n), column++));
             }, this);
         }
 
         for (; column < this.opts.extraColsRight; ++column) {
-            div.insert(this._divWidth(this.div_temp.clone().update('&nbsp;'), column));
+            div.insert(this._divWidth(new Element('DIV').update('&nbsp;'), column));
         }
 
         p.appendChild(div);
index ef9ff58..8a0938c 100644 (file)
@@ -7,7 +7,7 @@
 
 var HordeSidebar = {
     // Variables set in services/sidebar.php:
-    // domain, path, refresh, rtl, tree, url, width
+    // domain, path, refresh, tree, url, width
 
     toggleSidebar: function()
     {
@@ -49,14 +49,19 @@ var HordeSidebar = {
 
     setMargin: function(expanded)
     {
-        var margin = expanded
+        var hb = $('horde_body'),
+            margin = expanded
             ? this.width
             : $('hiddenSidebar').down().getWidth();
 
-        if (this.rtl) {
-            $('horde_body').setStyle({ marginRight: margin + 'px' });
-        } else {
-            $('horde_body').setStyle({ marginLeft: margin + 'px' });
+        switch ($(document.body).getStyle('direction')) {
+        case 'ltr':
+            hb.setStyle({ marginLeft: margin + 'px' });
+            break;
+
+        case 'rtl':
+            hb.setStyle({ marginRight: margin + 'px' });
+            break;
         }
     },
 
index 8268df8..0fb0489 100644 (file)
@@ -42,7 +42,6 @@ if (!Horde_Util::getFormData('ajaxui') &&
         'HordeSidebar.domain = ' . Horde_Serialize::serialize($conf['cookie']['domain'], Horde_Serialize::JSON, $charset),
         'HordeSidebar.path = ' . Horde_Serialize::serialize($conf['cookie']['path'], Horde_Serialize::JSON, $charset),
         'HordeSidebar.refresh = ' . intval($prefs->getValue('menu_refresh_time')),
-        'HordeSidebar.rtl = ' . $rtl,
         'HordeSidebar.url = ' . Horde_Serialize::serialize(strval($ajax_url), Horde_Serialize::JSON, $charset),
         'HordeSidebar.width = ' . $width
     ));
index 0994268..5f7b044 100644 (file)
@@ -1,6 +1,6 @@
 <div class="sidebar" style="width:<?php echo $prefs->getValue('sidebar_width') ?>px">
  <div id="expandedSidebar"<?php if (!$show_sidebar): ?> style="display:none"<?php endif; ?>>
-  <span id="expandButton" class="rightFloat"><?php echo Horde::img('hide_panel.png', null, array('title' => _("Collapse Sidebar"))) ?></span>
+  <span id="expandButton"><?php echo Horde::img('hide_panel.png', null, array('title' => _("Collapse Sidebar"))) ?></span>
   <div id="sidebarPanel">
    <?php $tree->renderTree() ?>
   </div>
index 4084cad..66f50e7 100644 (file)
@@ -83,6 +83,9 @@ option {
     -webkit-border-bottom-right-radius: 0;
     -webkit-border-bottom-left-radius: 15px;
 }
+#expandedSidebar #expandButton {
+    float: left;
+}
 
 /* Tab styles. */
 .tabset {
index f2f071f..335f5e8 100644 (file)
@@ -387,9 +387,9 @@ div.nicetitle {
     padding-right: 5px;
 }
 .treeRow {
-    overflow: hidden;
-    min-height: 20px;
     clear: both;
+    min-height: 20px;
+    overflow: hidden;
 }
 .treeToggle {
     cursor: pointer;
@@ -533,6 +533,9 @@ span.treeImg16 {
 #expandedSidebar {
     overflow: hidden;
 }
+#expandedSidebar #expandButton {
+    float: right;
+}
 
 #hiddenSidebar img {
     padding-right: 2px;