web/data/cubicweb.edition.js
changeset 2483 6e328fcc276c
parent 2458 4d114865098f
child 2490 b0771c03f531
equal deleted inserted replaced
2472:a459a6ab78d0 2483:6e328fcc276c
   451  * called by reledit forms to submit changes
   451  * called by reledit forms to submit changes
   452  * @param formid : the dom id of the form used
   452  * @param formid : the dom id of the form used
   453  * @param rtype : the attribute being edited
   453  * @param rtype : the attribute being edited
   454  * @param eid : the eid of the entity being edited
   454  * @param eid : the eid of the entity being edited
   455  * @param reload: boolean to reload page if true (when changing URL dependant data)
   455  * @param reload: boolean to reload page if true (when changing URL dependant data)
       
   456  * @param default_value : value if the field is empty
       
   457  * @param lzone : html fragment (string) for a clic-zone triggering actual edition
   456  */
   458  */
   457 function inlineValidateAttributeForm(rtype, eid, divid, reload, default_value) {
   459 function inlineValidateAttributeForm(rtype, eid, divid, reload, default_value) {
   458     try {
   460     try {
   459 	var form = getNode(divid+'-form');
   461 	var form = getNode(divid+'-form');
   460 	if (typeof FCKeditorAPI != "undefined") {
   462 	if (typeof FCKeditorAPI != "undefined") {
   475     d.addCallback(function (result, req) {
   477     d.addCallback(function (result, req) {
   476         handleFormValidationResponse(divid+'-form', noop, noop, result);
   478         handleFormValidationResponse(divid+'-form', noop, noop, result);
   477 	if (reload) {
   479 	if (reload) {
   478 	    document.location.href = result[1];
   480 	    document.location.href = result[1];
   479 	} else {
   481 	} else {
   480 	    var fieldview = getNode(divid);
   482 	    var fieldview = getNode('value-' + divid);
   481 	    // XXX using innerHTML is very fragile and won't work if
   483 	    // XXX using innerHTML is very fragile and won't work if
   482 	    // we mix XHTML and HTML
   484 	    // we mix XHTML and HTML
   483 	    fieldview.innerHTML = result[2];
   485 	    fieldview.innerHTML = result[2];
   484 	    // switch inline form off only if no error
   486 	    // switch inline form off only if no error
   485 	    if (result[0]) {
   487 	    if (result[0]) {
   512           document.location.href = result[1];
   514           document.location.href = result[1];
   513         } else {
   515         } else {
   514 	  if (result[0]) {
   516 	  if (result[0]) {
   515             var d = asyncRemoteExec('reledit_form', eid, rtype, role, default_value, lzone);
   517             var d = asyncRemoteExec('reledit_form', eid, rtype, role, default_value, lzone);
   516             d.addCallback(function (result) {
   518             d.addCallback(function (result) {
       
   519               // XXX brittle ... replace with loadxhtml
   517               jQuery('#'+divid+'-reledit').replaceWith(result);
   520               jQuery('#'+divid+'-reledit').replaceWith(result);
   518             });
   521             });
   519           }
   522           }
   520 	}
   523 	}
   521         return false;
   524         return false;