]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 505015: Selections are not persistent across submissions - Patch by Frédéric...
authorlpsolit%gmail.com <>
Wed, 19 Aug 2009 14:48:43 +0000 (14:48 +0000)
committerlpsolit%gmail.com <>
Wed, 19 Aug 2009 14:48:43 +0000 (14:48 +0000)
template/en/default/reports/create-chart.html.tmpl
template/en/default/reports/series-common.html.tmpl

index d911d03fd0890d82831067a8be3778e670992955..faf4c90d3b171550880710f36c7c9c5434f9d25e 100644 (file)
@@ -50,6 +50,7 @@ function subcatSelected() {
     i++;
   }
 
+  namewidget.disabled = false;
   namewidget.options[0].selected = true;
   
   checkNewState();
@@ -98,23 +99,16 @@ function subcatSelected() {
         <td>
           <noscript>
             <input type="submit" name="action-assemble" value="Update --&gt;"
-                   id="action-assemble">
+                   id="action-assemble2">
           </noscript>
         </td>
         
-        <td align="left">
-          <select name="name" id="name" style="width: 15em"
-                  size="5" multiple="multiple"
-                  [%+ "disabled=\"disabled\"" UNLESS name.keys.size %]>
-            [% FOREACH x = name.keys.sort %]
-              <option value="[% name.$x FILTER html %]">
-                [% x FILTER html %]</option>
-            [% END %]
-            [% UNLESS name.keys.size %]
-              <option value="" disabled="disabled"></option>
-            [% END %]
-          </select>
-        </td>
+        [% PROCESS series_select sel = { name => 'name',
+                                         size => 5,
+                                         multiple => 1,
+                                         # We want to use the series ID as value,
+                                         # not its name.
+                                         value_in_hash => 1 } %]
 
         <td align="center" valign="middle"> 
           <input type="submit" name="action-add" value="Add To List"
@@ -124,14 +118,6 @@ function subcatSelected() {
     [% END %]
   </table>
 
-  <script type="text/javascript">
-    document.chartform.category[0].selected = true;
-    document.chartform.subcategory.disabled = '';
-    document.chartform.name.disabled = '';
-    catSelected();
-    subcatSelected();
-  </script>
-
   <h3>List Of Data Sets To Plot</h3>
 
   [% IF chart.lines.size > 0 %]
index 35586cb478544f46c26d334278225afbb8812471..cecf288ec12a146ff4b230900009ffb1909087c2 100644 (file)
@@ -48,7 +48,6 @@ var series = {
 [% END %] 
 };
 
-[%# Should attempt to preserve selection across invocations @@@ %]
 [%# This function takes necessary action on selection of a category %]
 function catSelected() {
   var cat = document.chartform.category.value;
@@ -67,7 +66,8 @@ function catSelected() {
   [% IF newtext %]
     subcatwidget.options[i] = new Option("[% newtext FILTER js %]", "");
   [% END %]  
-  
+
+  subcatwidget.disabled = false;
   subcatwidget.options[0].selected = true;
   
   if (document.chartform.action[1]) {
@@ -100,11 +100,13 @@ function checkNewState() {
   <td align="left">
     <select name="[% sel.name %]" id="[% sel.name %]"
             size="[% sel.size %]" style="width: 15em"
+            [%+ 'multiple="multiple"' IF sel.multiple %]
             [%+ "disabled=\"disabled\"" UNLESS ${sel.name}.keys.size || newtext %]
             [%+ "onchange=\"$sel.onchange\"" IF sel.onchange %]>
       [% FOREACH x = ${sel.name}.keys.sort %]
-        <option value="[% x FILTER html %]"
-          [% " selected" IF default.${sel.name} == x %]>
+        [% value = sel.value_in_hash ? ${sel.name}.$x : x %]
+        <option value="[% value FILTER html %]"
+          [% " selected" IF default.${sel.name} == value %]>
           [% x FILTER html %]</option>
       [% END %]
       [% IF newtext %]