[reledit] there is nothing to escape, also cleanup lzone for attributes stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 09 Jul 2009 12:14:02 +0200
branchstable
changeset 2345 16e3d0e47ee6
parent 2344 22b5ea0679ed
child 2346 d0026f2c6a81
[reledit] there is nothing to escape, also cleanup lzone for attributes
web/data/cubicweb.edition.js
web/views/basecontrollers.py
web/views/editforms.py
--- a/web/data/cubicweb.edition.js	Thu Jul 09 12:06:14 2009 +0200
+++ b/web/data/cubicweb.edition.js	Thu Jul 09 12:14:02 2009 +0200
@@ -454,8 +454,7 @@
  * @param eid : the eid of the entity being edited
  * @param reload: boolean to reload page if true (when changing URL dependant data)
  */
-function inlineValidateAttributeForm(formid, rtype, eid, divid, reload,
-                                     default_value, lzone) {
+function inlineValidateAttributeForm(formid, rtype, eid, divid, reload, default_value) {
     try {
 	var form = getNode(formid);
 	if (typeof FCKeditorAPI != "undefined") {
@@ -468,7 +467,7 @@
 	}
 	var zipped = formContents(form);
 	var d = asyncRemoteExec('edit_field', 'apply', zipped[0], zipped[1],
-                                rtype, eid, default_value, lzone);
+                                rtype, eid, default_value);
     } catch (ex) {
 	log('got exception', ex);
 	return false;
@@ -496,14 +495,14 @@
 }
 
 function inlineValidateRelationForm(formid, rtype, role, eid, divid, reload, vid,
-                                    default_value, escape, lzone) {
+                                    default_value, lzone) {
     try {
 	var form = getNode(formid);
         var relname = rtype + ':' + eid;
         var newtarget = jQuery('[name=' + relname + ']').val();
 	var zipped = formContents(form);
 	var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, role,
-                                eid, vid, default_value, escape, lzone);
+                                eid, vid, default_value, lzone);
     } catch (ex) {
 	log('got exception', ex);
 	return false;
--- a/web/views/basecontrollers.py	Thu Jul 09 12:06:14 2009 +0200
+++ b/web/views/basecontrollers.py	Thu Jul 09 12:14:02 2009 +0200
@@ -388,7 +388,7 @@
         return _validate_form(self.req, self.vreg)
 
     @jsonize
-    def js_edit_field(self, action, names, values, rtype, eid, default, lzone):
+    def js_edit_field(self, action, names, values, rtype, eid, default):
         success, args = self.validate_form(action, names, values)
         if success:
             # Any X,N where we don't seem to use N is an optimisation
@@ -397,21 +397,19 @@
                                     {'x': eid}, 'x')
             entity = rset.get_entity(0, 0)
             value = entity.printable_value(rtype) or default
-            return (success, args, lzone + value)
+            return (success, args, value)
         else:
             return (success, args, None)
 
     @jsonize
     def js_edit_relation(self, action, names, values, rtype,
-                         role, eid, vid, default, escape, lzone):
+                         role, eid, vid, default, lzone):
         success, args = self.validate_form(action, names, values)
         if success:
             entity = self.req.eid_rset(eid).get_entity(0, 0)
             rset = entity.related(rtype, role)
             if rset:
                 output = self.view(vid, rset)
-                if escape == 'True':
-                    output = xml_escape(output)
             else:
                 output = default
             return (success, args, lzone + output)
--- a/web/views/editforms.py	Thu Jul 09 12:06:14 2009 +0200
+++ b/web/views/editforms.py	Thu Jul 09 12:14:02 2009 +0200
@@ -107,7 +107,6 @@
     def cell_call(self, row, col, rtype=None, role='subject',
                   reload=False,      # controls reloading the whole page after change
                   rvid=None,         # vid to be applied to other side of rtype
-                  escape=True,       # depending on the vid, will xml_escape or not
                   default=None,      # default value
                   landing_zone=None  # prepend value with a separate html element to click onto
                                      # (esp. needed when values are links)
@@ -131,8 +130,6 @@
                 rvid = self._compute_best_vid(entity, rtype, role)
             rset = entity.related(rtype, role)
             candidate = self.view(rvid, rset, 'null')
-            if candidate and escape:
-                value = xml_escape(candidate)
             value = candidate or default
             if role == 'subject'and not rschema.has_perm(self.req, 'add',
                                                          fromeid=entity.eid):
@@ -141,7 +138,7 @@
                                                            toeid=entity.eid):
                 return self.w(value)
             form = self._build_relation_form(entity, value, rtype, role, reload, row, col,
-                                             rvid, default, escape, landing_zone)
+                                             rvid, default, landing_zone)
         renderer = self.vreg.select_object('formrenderers', 'base', self.req,
                                       entity=entity,
                                       display_label=False, display_help=False,
@@ -151,16 +148,16 @@
         self.w(form.form_render(renderer=renderer))
 
     def _build_relation_form(self, entity, value, rtype, role, row, col, reload, rvid,
-                             default, escape, lzone):
+                             default, lzone):
         lzone = lzone or self._defaultlandingzone % self.req._(self._landingzonemsg)
         value = lzone + value
         divid = 'd%s' % make_uid('%s-%s' % (rtype, entity.eid))
         event_data = {'divid' : divid, 'eid' : entity.eid, 'rtype' : rtype, 'vid' : rvid,
                       'reload' : reload, 'default' : default, 'role' : role,
-                      'escape' : escape, 'lzone' : lzone}
+                      'lzone' : lzone}
         onsubmit = ("return inlineValidateRelationForm('%(divid)s-form', '%(rtype)s', "
                     "'%(role)s', '%(eid)s', '%(divid)s', %(reload)s, '%(vid)s', "
-                    "'%(default)s', '%(escape)s', '%(lzone)s');"
+                    "'%(default)s', '%(lzone)s');"
                     % event_data)
         cancelclick = "cancelInlineEdit(%s,\'%s\',\'%s\')" % (
             entity.eid, rtype, divid)