447 * @param formid : the dom id of the form used |
447 * @param formid : the dom id of the form used |
448 * @param rtype : the attribute being edited |
448 * @param rtype : the attribute being edited |
449 * @param eid : the eid of the entity being edited |
449 * @param eid : the eid of the entity being edited |
450 * @param reload: boolean to reload page if true (when changing URL dependant data) |
450 * @param reload: boolean to reload page if true (when changing URL dependant data) |
451 */ |
451 */ |
452 function inlineValidateAttributeForm(formid, rtype, eid, divid, reload) { |
452 function inlineValidateAttributeForm(formid, rtype, eid, divid, reload, default_value) { |
453 try { |
453 try { |
454 var form = getNode(formid); |
454 var form = getNode(formid); |
455 if (typeof FCKeditorAPI != "undefined") { |
455 if (typeof FCKeditorAPI != "undefined") { |
456 for ( var name in FCKeditorAPI.__Instances ) { |
456 for ( var name in FCKeditorAPI.__Instances ) { |
457 var oEditor = FCKeditorAPI.__Instances[name] ; |
457 var oEditor = FCKeditorAPI.__Instances[name] ; |
459 oEditor.UpdateLinkedField(); |
459 oEditor.UpdateLinkedField(); |
460 } |
460 } |
461 } |
461 } |
462 } |
462 } |
463 var zipped = formContents(form); |
463 var zipped = formContents(form); |
464 var d = asyncRemoteExec('edit_field', 'apply', zipped[0], zipped[1], rtype, eid); |
464 var d = asyncRemoteExec('edit_field', 'apply', zipped[0], zipped[1], |
|
465 rtype, eid, default_value); |
465 } catch (ex) { |
466 } catch (ex) { |
466 log('got exception', ex); |
467 log('got exception', ex); |
467 return false; |
468 return false; |
468 } |
469 } |
469 d.addCallback(function (result, req) { |
470 d.addCallback(function (result, req) { |
486 return false; |
487 return false; |
487 }); |
488 }); |
488 return false; |
489 return false; |
489 } |
490 } |
490 |
491 |
491 function inlineValidateRelationForm(formid, rtype, eid, divid, vid) { |
492 function inlineValidateRelationForm(formid, rtype, role, eid, divid, vid, default_value) { |
492 try { |
493 try { |
493 var form = getNode(formid); |
494 var form = getNode(formid); |
|
495 var relname = rtype + ':' + eid; |
|
496 var newtarget = jQuery('[name=' + relname + ']').val(); |
494 var zipped = formContents(form); |
497 var zipped = formContents(form); |
495 var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, eid, vid); |
498 var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, role, |
|
499 eid, vid, default_value); |
496 } catch (ex) { |
500 } catch (ex) { |
497 log('got exception', ex); |
501 log('got exception', ex); |
498 return false; |
502 return false; |
499 } |
503 } |
500 d.addCallback(function (result, req) { |
504 d.addCallback(function (result, req) { |
504 // switch inline form off only if no error |
508 // switch inline form off only if no error |
505 if (result[0]) { |
509 if (result[0]) { |
506 // hide global error messages |
510 // hide global error messages |
507 jQuery('div.errorMessage').remove(); |
511 jQuery('div.errorMessage').remove(); |
508 jQuery('#appMsg').hide(); |
512 jQuery('#appMsg').hide(); |
|
513 var inputname = 'edit' + role[0] + '-' + relname; |
|
514 jQuery('input[name=' + inputname + ']').val(newtarget); |
509 cancelInlineEdit(eid, rtype, divid); |
515 cancelInlineEdit(eid, rtype, divid); |
510 } |
516 } |
511 return false; |
517 return false; |
512 }); |
518 }); |
513 return false; |
519 return false; |