Mercurial > p > roundup > code
changeset 1900:db187e5cabc6 maint-0.6
backport from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 06 Nov 2003 07:19:17 +0000 |
| parents | b3f63a0615db |
| children | 5c6f3da9856f |
| files | CHANGES.txt templates/classic/html/help_controls.js |
| diffstat | 2 files changed, 37 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Tue Nov 04 12:39:54 2003 +0000 +++ b/CHANGES.txt Thu Nov 06 07:19:17 2003 +0000 @@ -8,6 +8,7 @@ - added script to help migrating queries from pre-0.6 trackers - Fixed "documentation" of getnodeids in roundup.hyperdb - added flush() to DevNull (sf bug #835365) +- fixed javascript for help window for only one checkbox case - Date arithmetic was utterly broken, and has been for a long time. Date +/- Interval now works, and Date - Date also works (produces an Interval.
--- a/templates/classic/html/help_controls.js Tue Nov 04 12:39:54 2003 +0000 +++ b/templates/classic/html/help_controls.js Thu Nov 06 07:19:17 2003 +0000 @@ -51,29 +51,34 @@ return temp; } +function determineList() { + // generate a comma-separated list of the checked items + if (document.frm_help.check==undefined) { return; } + var list = new Array(); + if (document.frm_help.check.length==undefined) { + if (document.frm_help.check.checked) { + list.push(document.frm_help.check.value); + } + } else { + for (box=0; box < document.frm_help.check.length; box++) { + if (document.frm_help.check[box].checked) { + list.push(document.frm_help.check[box].value); + } + } + } + return new String(list.join(',')); +} + function updateList() { // write back to opener window if (document.frm_help.check==undefined) { return; } - var list = new Array(); - for (box=0; box < document.frm_help.check.length; box++) { - if (document.frm_help.check[box].checked) { - list.push(document.frm_help.check[box].value); - } - } - window.opener.document.itemSynopsis[field].value = list.join(","); + window.opener.document.itemSynopsis[field].value = determineList(); } function updatePreview() { - // add new checkbox selections to preview + // update the preview box if (document.frm_help.check==undefined) { return; } - var list = new Array(); - for (box=0; box < document.frm_help.check.length; box++) { - if (document.frm_help.check[box].checked) { - list.push(document.frm_help.check[box].value); - } - } - listString = new String(list.join(',')); - writePreview(listString); + writePreview(determineList()); } function clearList() { @@ -89,7 +94,18 @@ if (document.frm_help.check==undefined) { return; } var to_check; var list = vals.split(","); - for (box=0; box < document.frm_help.check.length; box++) { + if (document.frm_help.check.length==undefined) { + check = document.frm_help.check; + to_check = false; + for (val in list) { + if (check.value==trim(list[val])) { + to_check = true; + break; + } + } + check.checked = to_check; + } else { + for (box=0; box < document.frm_help.check.length; box++) { check = document.frm_help.check[box]; to_check = false; for (val in list) { @@ -99,26 +115,15 @@ } } check.checked = to_check; + } } } function resetList() { // reset preview and check boxes to initial values if (document.frm_help.check==undefined) { return; } - var to_check; - var list = original_field.split(','); - writePreview(list); - for (box=0; box < document.frm_help.check.length; box++) { - check = document.frm_help.check[box]; - to_check = false; - for (val in list) { - if (check.value==trim(list[val])) { - to_check = true; - break; - } - } - check.checked = to_check; - } + writePreview(original_field); + reviseList(original_field); } function writePreview(val) {
