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