Roundup Tracker - Issues

Issue 1064716

classification
Topics list doesn't work when there's only one topic
Type: Severity: normal
Components: Web interface Versions:
process
Status: closed fixed
:
: richard : mstarzyk, richard
Priority: normal :

Created on 2004-11-11 19:19 by anonymous, last changed 2005-01-04 01:04 by richard.

Messages
msg1525 Author: [hidden] (anonymous) Date: 2004-11-11 19:19
When there's only one topic defined, the topic list 
doesn't work. 
Let's say I have only one topic defined called "kuku". 
When I click the checkbox next to it, the preview 
textbox remains empty, instead of containing "kuku" as 
expected.
The same problem happens with the superseder list and 
the nosy list, since it's the same javascript that handles 
all of them.
msg1526 Author: [hidden] (mstarzyk) Date: 2004-12-15 20:43
Logged In: YES 
user_id=657380

When there are several checkboxes on the page, they are 
available as an array in javascript. When there is only 
one checkbox, then it is just a checkbox object. The 
current javascript assumes it is always an array, and that 
is why it does not work for one element. 
Here is a patch:

Index: templates/classic/html/help_controls.js
=====================================
==============================
RCS file: /cvsroot/roundup/roundup/templates/classic/
html/help_controls.js,v
retrieving revision 1.8
diff -u -r1.8 help_controls.js
--- templates/classic/html/help_controls.js	15 Oct 2004 
00:48:05 -0000	1.8
+++ templates/classic/html/help_controls.js	15 Dec 
2004 20:32:29 -0000
@@ -17,16 +17,30 @@
 function determineList() {
     // generate a comma-separated list of the checked 
items
     var list = new String('');
-    for (box=0; box < document.frm_help.check.length; 
box++) {
-        if (document.frm_help.check[box].checked) {
-            if (list.length == 0) {
-                separator = '';
-            }
-            else {
-                separator = ',';
+
+    // either a checkbox object or an array of checkboxes
+    var check = document.frm_help.check;
+
+    if ((check.length == undefined) && 
+        (check.checked != undefined)) {
+        // only one checkbox on page
+        if (check.checked) {
+            list = check.value;
+        }
+    }
+    else {
+        // array of checkboxes
+        for (box=0; box < check.length; box++) {
+            if (check[box].checked) {
+                if (list.length == 0) {
+                    separator = '';
+                }
+                else {
+                    separator = ',';
+                }
+                // we used to use an Array and push / join, 
but IE5.0 sux
+                list = list + separator + check[box].value;
             }
-            // we used to use an Array and push / join, but 
IE5.0 sux
-            list = list + separator + document.frm_help.
check[box].value;
         }
     }
     return list;  
msg1527 Author: [hidden] (mstarzyk) Date: 2004-12-15 21:16
Logged In: YES 
user_id=657380

When there are several checkboxes on the page, they are 
available as an array in javascript. When there is only 
one checkbox, then it is just a checkbox object. The 
current javascript assumes it is always an array, and that 
is why it does not work for one element. 
Here is a patch:

Index: templates/classic/html/help_controls.js
=====================================
==============================
RCS file: /cvsroot/roundup/roundup/templates/classic/
html/help_controls.js,v
retrieving revision 1.8
diff -u -r1.8 help_controls.js
--- templates/classic/html/help_controls.js	15 Oct 2004 
00:48:05 -0000	1.8
+++ templates/classic/html/help_controls.js	15 Dec 
2004 20:32:29 -0000
@@ -17,16 +17,30 @@
 function determineList() {
     // generate a comma-separated list of the checked 
items
     var list = new String('');
-    for (box=0; box < document.frm_help.check.length; 
box++) {
-        if (document.frm_help.check[box].checked) {
-            if (list.length == 0) {
-                separator = '';
-            }
-            else {
-                separator = ',';
+
+    // either a checkbox object or an array of checkboxes
+    var check = document.frm_help.check;
+
+    if ((check.length == undefined) && 
+        (check.checked != undefined)) {
+        // only one checkbox on page
+        if (check.checked) {
+            list = check.value;
+        }
+    }
+    else {
+        // array of checkboxes
+        for (box=0; box < check.length; box++) {
+            if (check[box].checked) {
+                if (list.length == 0) {
+                    separator = '';
+                }
+                else {
+                    separator = ',';
+                }
+                // we used to use an Array and push / join, 
but IE5.0 sux
+                list = list + separator + check[box].value;
             }
-            // we used to use an Array and push / join, but 
IE5.0 sux
-            list = list + separator + document.frm_help.
check[box].value;
         }
     }
     return list;  
msg1528 Author: [hidden] (richard) Date: 2005-01-04 01:04
Logged In: YES 
user_id=6405

Fixed, thanks.
History
Date User Action Args
2004-11-11 19:19:43anonymouscreate