Commit 4123f6254886d6358da0d29021599e676e63f270
1 parent
df4313d2
update to make initialisation work completely from the client-side (less
server-side initialisation). git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3789 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
12 additions
and
6 deletions
presentation/lookAndFeel/knowledgeTree/js/conditional_complex_edit.js
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | * Perform various and sundry operations on the edit-page. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +var targeturl = 'ajaxComplexConditionals.php'; | |
| 7 | + | |
| 6 | 8 | // returns the td element representing the row, for use as Parent. |
| 7 | 9 | function getColumnForField(field_id) { |
| 8 | 10 | return getElement('md_'+field_id); |
| ... | ... | @@ -190,7 +192,7 @@ function getPOSTRequest(fullurl) { |
| 190 | 192 | // updates the item list for a given field to the items which are "free". |
| 191 | 193 | function updateItemListForField(field_id) { |
| 192 | 194 | var action = 'getItemList'; |
| 193 | - var targeturl = 'test_getItemList.xml'; | |
| 195 | + | |
| 194 | 196 | |
| 195 | 197 | simpleLog('DEBUG','initiating item list update on field '+field_id); |
| 196 | 198 | |
| ... | ... | @@ -226,7 +228,6 @@ function updateItemListForField(field_id) { |
| 226 | 228 | // updates the available behaviours for a given field. |
| 227 | 229 | function updateBehaviourListsForField(field_id) { |
| 228 | 230 | var action = 'getBehaviourList'; |
| 229 | - var targeturl = 'test_getBehaviourList.xml'; | |
| 230 | 231 | |
| 231 | 232 | simpleLog('DEBUG','initiating behaviour list update on field '+field_id); |
| 232 | 233 | |
| ... | ... | @@ -268,7 +269,7 @@ function updateBehaviourListsForField(field_id) { |
| 268 | 269 | function updateActiveFields() { |
| 269 | 270 | simpleLog('DEBUG','initiating active field update.'); |
| 270 | 271 | var action = 'getActiveFields'; |
| 271 | - var targeturl = 'test_getActiveFields.xml'; | |
| 272 | + | |
| 272 | 273 | |
| 273 | 274 | var formKeys = Array(); |
| 274 | 275 | var formValues = Array(); |
| ... | ... | @@ -293,12 +294,13 @@ function updateActiveFields() { |
| 293 | 294 | deferred.addCallback(do_updateActiveFields); |
| 294 | 295 | deferred.addErrback(handleError); |
| 295 | 296 | |
| 297 | + | |
| 296 | 298 | } |
| 297 | 299 | |
| 298 | 300 | // creates a new behaviour, and adds the appropriate metadata fields to it. |
| 299 | 301 | function createBehaviourAndAssign(field_id, values, behaviour_name) { |
| 300 | 302 | var action = 'createBehaviourAndAssign'; |
| 301 | - var targeturl = 'test_create.xml'; | |
| 303 | + | |
| 302 | 304 | |
| 303 | 305 | simpleLog('DEBUG','initiating behaviour creation on field '+field_id); |
| 304 | 306 | |
| ... | ... | @@ -340,7 +342,7 @@ function createBehaviourAndAssign(field_id, values, behaviour_name) { |
| 340 | 342 | // variant of createBehaviourAndAssign that uses an existing behaviour. |
| 341 | 343 | function useBehaviourAndAssign(field_id, values, behaviour_id) { |
| 342 | 344 | var action='useBehaviourAndAssign'; |
| 343 | - var targeturl='test_use.xml'; | |
| 345 | + | |
| 344 | 346 | |
| 345 | 347 | simpleLog('DEBUG','initiating behaviour creation on field '+field_id); |
| 346 | 348 | |
| ... | ... | @@ -416,9 +418,13 @@ function do_updateActiveFields (req) { |
| 416 | 418 | // so we delete items that match, and when we're done, we set everything else to "inactive". |
| 417 | 419 | var response_active_list = xmldoc.getElementsByTagName('field'); |
| 418 | 420 | for (var i=0; i<response_active_list.length; i++) { |
| 419 | - var td_id = "md_"+response_active_list[i].getAttribute('value'); | |
| 421 | + var field_id = response_active_list[i].getAttribute('value'); | |
| 422 | + var td_id = "md_"+field_id; | |
| 423 | + | |
| 420 | 424 | if (potential_fields[td_id]) { |
| 421 | 425 | setElementClass(potential_fields[td_id], 'active'); |
| 426 | + updateBehaviourListsForField(field_id); | |
| 427 | + updateItemListForField(field_id); | |
| 422 | 428 | delete potential_fields[td_id]; |
| 423 | 429 | simpleLog('DEBUG','activating '+td_id); |
| 424 | 430 | } else { | ... | ... |