Commit e7267ea7674ed0c5887cea021eec80922ec08019
1 parent
1d3294e7
Make it possible to load initialiseConditionalFieldsets multiple times.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3862 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
15 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js
| ... | ... | @@ -71,6 +71,19 @@ The system works based on 3 concepts: |
| 71 | 71 | var conditional_usage_undostack = new Array(); |
| 72 | 72 | var conditional_usage_keys = new Array(); |
| 73 | 73 | |
| 74 | + | |
| 75 | +// sorry mom. | |
| 76 | +function checkStackForFieldset(fieldset) { | |
| 77 | + for (var i=0; i<conditional_usage_keys.length; i++) { | |
| 78 | + if (conditional_usage_keys[i] == fieldset) { | |
| 79 | + simpleLog('DEBUG','found undostack at keyindex '+i); | |
| 80 | + return true; | |
| 81 | + } | |
| 82 | + } | |
| 83 | + return false; | |
| 84 | +} | |
| 85 | + | |
| 86 | + | |
| 74 | 87 | // grow and go. |
| 75 | 88 | function getStackForFieldset(fieldset) { |
| 76 | 89 | for (var i=0; i<conditional_usage_keys.length; i++) { |
| ... | ... | @@ -323,12 +336,14 @@ function initialiseConditionalFieldsets() { |
| 323 | 336 | // triggers initial update - since this contains no "fixed" vars, it'll remove "unfixed" widgets |
| 324 | 337 | // and insert the initial (master) field. |
| 325 | 338 | for (var i=0; i<fieldsets.length; i++) { |
| 339 | + if (!checkStackForFieldset(fieldsets[i])) { | |
| 326 | 340 | var undo_button = INPUT({'type':'button','value':'undo'},null); |
| 327 | 341 | attachToElementEvent(undo_button,'click',partial(popStack, fieldsets[i])); |
| 328 | 342 | fieldsets[i].appendChild(undo_button); |
| 329 | 343 | // initialise the stack. |
| 330 | 344 | getStackForFieldset(fieldsets[i]); |
| 331 | 345 | updateFieldset(fieldsets[i]); |
| 346 | + } | |
| 332 | 347 | } |
| 333 | 348 | } |
| 334 | 349 | ... | ... |