[Rt-commit] rt branch, 3.8-trunk, updated. a5989fe43196dfb5746f1eeaf8045a723d3827ea

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Sep 11 03:43:59 EDT 2009


The branch, 3.8-trunk has been updated
       via  a5989fe43196dfb5746f1eeaf8045a723d3827ea (commit)
       via  c42465fb0d8443905deef2a9c58718c0331980f2 (commit)
      from  e38bf1b92a7ba15f2aed08f4db40a8f1030708c5 (commit)

Summary of changes:
 share/html/Elements/EditCustomFieldSelect |    6 ++++
 share/html/NoAuth/js/cascaded.js          |   46 +++++++++++++++++++++++++----
 share/html/Widgets/ComboBox               |    8 ++++-
 3 files changed, 53 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit c42465fb0d8443905deef2a9c58718c0331980f2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 11 15:15:37 2009 +0800

    fix the z-index bug in ie7

diff --git a/share/html/Widgets/ComboBox b/share/html/Widgets/ComboBox
index 6a1b637..04f7b25 100644
--- a/share/html/Widgets/ComboBox
+++ b/share/html/Widgets/ComboBox
@@ -45,10 +45,16 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
+<%once>
+# the $z_index here is to fix wrong z-index bug in ie7
+my $z_index = 9999;
+</%once>
+%# reset $z_index. assuming at most 1000 comboboxx in one page
+% $z_index = 9999 if $z_index < 9000;
 <nobr>
 <script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/combobox.js"></script>
 
-<div id="<% $Name %>_Container" class="combobox <%$Class%>">
+<div id="<% $Name %>_Container" class="combobox <%$Class%>" style="z-index: <%$z_index--%>">
 <input name="<% $Name %>" id="<% $Name %>" class="combo-text" value="<% $Default || '' %>" type="text" <% $Size ? "size='$Size'" : '' |n %> autocomplete="off" />
 <br style="display: none" /><span id="<% $Name %>_Button" class="combo-button">&#9660;</span><select name="List-<% $Name %>" id="<% $Name %>_List" class="combo-list" onchange="ComboBox_SimpleAttach(this, this.form['<% $Name %>']); " size="<% $Rows %>">
 <option style="display: none" value="">-</option>

commit a5989fe43196dfb5746f1eeaf8045a723d3827ea
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 11 15:43:29 2009 +0800

    fix the bug that "all values in the category drop down are displayed even a category is selected" on non-firefox browsers

diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 2c98dcc..d02fe6b 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -71,6 +71,12 @@
         <option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option>
 %       $m->out($out);
       </select>
+%# this hidden select is to supply a full list of values,
+%# see filter_cascade() in js/cascaded.js
+      <select name="<%$id%>-Values-Complete" id="<%$id%>-Values-Complete" class="hidden">
+        <option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option>
+%       $m->out($out);
+      </select>
 <%ARGS>
 $Object => undef
 $CustomField => undef
diff --git a/share/html/NoAuth/js/cascaded.js b/share/html/NoAuth/js/cascaded.js
index 9baaf71..e3bdce7 100644
--- a/share/html/NoAuth/js/cascaded.js
+++ b/share/html/NoAuth/js/cascaded.js
@@ -47,15 +47,49 @@
 %# END BPS TAGGED BLOCK }}}
 function filter_cascade (id, val) {
     var select = document.getElementById(id);
+    var complete_select = document.getElementById(id + "-Complete" );
+
     if (!select) { return };
     var i;
     var children = select.childNodes;
-    for (i in children) {
-        if (!children[i].label) { continue };
-        if ( val == '' || children[i].label.substr(0, val.length) == val) {
-            show(children[i]);
-            continue;
+
+    if ( complete_select ) {
+        while (select.hasChildNodes()){
+            select.removeChild(select.firstChild);
+        }
+
+        var complete_children = complete_select.childNodes;
+
+        if ( val == '' ) {
+            // no category, let's clone all node
+            for (i in complete_children) {
+                if ( complete_children[i].cloneNode ) {
+                    new_option = complete_children[i].cloneNode(true);
+                    select.appendChild(new_option);
+                }
+            }
+        }
+        else {
+            for (i in complete_children) {
+                if (!complete_children[i].label ||
+                        complete_children[i].label.substr(0, val.length) == val ) {
+                    if ( complete_children[i].cloneNode ) {
+                        new_option = complete_children[i].cloneNode(true);
+                        select.appendChild(new_option);
+                    }
+                }
+            }
+        }
+    }
+    else {
+// for back compatibility
+        for (i in children) {
+            if (!children[i].label) { continue };
+            if ( val == '' || children[i].label.substr(0, val.length) == val) {
+                show(children[i]);
+                continue;
+            }
+            hide(children[i]);
         }
-        hide(children[i]);
     }
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list