web/data/cubicweb.edition.js
branchstable
changeset 3742 20f429eb5f46
parent 3545 242b07b6d820
child 3744 767b5d0cd3cc
--- a/web/data/cubicweb.edition.js	Mon Oct 19 20:26:22 2009 +0200
+++ b/web/data/cubicweb.edition.js	Mon Oct 19 20:33:30 2009 +0200
@@ -465,44 +465,6 @@
  * @param default_value : value if the field is empty
  * @param lzone : html fragment (string) for a clic-zone triggering actual edition
  */
-function inlineValidateAttributeForm(rtype, eid, divid, reload, default_value) {
-    try {
-	var form = getNode(divid+'-form');
-	if (typeof FCKeditorAPI != "undefined") {
-	    for ( var name in FCKeditorAPI.__Instances ) {
-		var oEditor = FCKeditorAPI.__Instances[name] ;
-		if ( oEditor.GetParentForm() == form ) {
-		    oEditor.UpdateLinkedField();
-		}
-	    }
-	}
-	var zipped = formContents(form);
-	var d = asyncRemoteExec('edit_field', 'apply', zipped[0], zipped[1],
-                                rtype, eid, default_value);
-    } catch (ex) {
-	log('got exception', ex);
-	return false;
-    }
-    d.addCallback(function (result, req) {
-        if (handleFormValidationResponse(divid+'-form', noop, noop, result)) {
-          if (reload) {
-	    document.location.href = result[1].split('?')[0];
-	  } else {
-	    var fieldview = getNode('value-' + divid);
-	    // XXX using innerHTML is very fragile and won't work if
-	    // we mix XHTML and HTML
-	    fieldview.innerHTML = result[2];
-	    // switch inline form off only if no error
-	    if (result[0]) {
-		// hide global error messages
-		hideInlineEdit(eid, rtype, divid);
-	    }
-	  }
-        }
-	return false;
-    });
-    return false;
-}
 
 function inlineValidateRelationForm(rtype, role, eid, divid, reload, vid,
                                     default_value, lzone) {
@@ -518,13 +480,12 @@
     d.addCallback(function (result, req) {
 	if (handleFormValidationResponse(divid+'-form', noop, noop, result)) {
           if (reload) {
-            document.location.href = result[1].split('?')[0];
+            document.location.reload();
           } else {
-            var d = asyncRemoteExec('reledit_form', eid, rtype, role, default_value, lzone);
-            d.addCallback(function (result) {
-              // XXX brittle ... replace with loadxhtml
-              jQuery('#'+divid+'-reledit').replaceWith(result);
-            });
+              var args = {fname: 'reledit_form', rtype: rtype, role: role, eid: eid, divid: divid,
+                          reload: reload, vid: vid, default_value: default_value, landing_zone: lzone};
+            log('DONE');
+              jQuery('#'+divid+'-reledit').parent().loadxhtml(JSON_BASE_URL, args, 'post');
           }
 	}
         return false;