--- a/web/data/cubicweb.edition.js Wed Jul 08 20:30:50 2009 +0200
+++ b/web/data/cubicweb.edition.js Wed Jul 08 20:50:54 2009 +0200
@@ -495,7 +495,7 @@
return false;
}
-function inlineValidateRelationForm(formid, rtype, role, eid, divid, vid,
+function inlineValidateRelationForm(formid, rtype, role, eid, divid, reload, vid,
default_value, escape, lzone) {
try {
var form = getNode(formid);
@@ -509,17 +509,21 @@
return false;
}
d.addCallback(function (result, req) {
- handleFormValidationResponse(formid, noop, noop, result);
- var fieldview = getNode(divid);
- fieldview.innerHTML = result[2];
- // switch inline form off only if no error
- if (result[0]) {
- // hide global error messages
- jQuery('div.errorMessage').remove();
- jQuery('#appMsg').hide();
- var inputname = 'edit' + role[0] + '-' + relname;
- jQuery('input[name=' + inputname + ']').val(newtarget);
- cancelInlineEdit(eid, rtype, divid);
+ if (reload) {
+ document.location.href = result[1];
+ } else {
+ handleFormValidationResponse(formid, noop, noop, result);
+ var fieldview = getNode(divid);
+ fieldview.innerHTML = result[2];
+ // switch inline form off only if no error
+ if (result[0]) {
+ // hide global error messages
+ jQuery('div.errorMessage').remove();
+ jQuery('#appMsg').hide();
+ var inputname = 'edit' + role[0] + '-' + relname;
+ jQuery('input[name=' + inputname + ']').val(newtarget);
+ cancelInlineEdit(eid, rtype, divid);
+ }
}
return false;
});
--- a/web/views/editforms.py Wed Jul 08 20:30:50 2009 +0200
+++ b/web/views/editforms.py Wed Jul 08 20:50:54 2009 +0200
@@ -91,7 +91,7 @@
# FIXME editableField class could be toggleable from userprefs
_ondblclick = "showInlineEditionForm(%(eid)s, '%(rtype)s', '%(divid)s')"
- _defaultlandingzone = u'<img title="%s" class="needsvalidation" src="data/file.gif"/>'
+ _defaultlandingzone = u'<img title="%s" src="data/file.gif"/>'
_landingzonemsg = _('double click to edit this field')
# default relation vids according to cardinality
_one_rvid = 'incontext'
@@ -140,7 +140,7 @@
elif role == 'object' and not rschema.has_perm(self.req, 'add',
toeid=entity.eid):
return self.w(value)
- form = self._build_relation_form(entity, value, rtype, role, row, col,
+ form = self._build_relation_form(entity, value, rtype, role, reload, row, col,
rvid, default, escape, landing_zone)
renderer = self.vreg.select_object('formrenderers', 'base', self.req,
entity=entity,
@@ -150,14 +150,17 @@
display_progress_div=False)
self.w(form.form_render(renderer=renderer))
- def _build_relation_form(self, entity, value, rtype, role, row, col, rvid, default, escape, lzone):
+ def _build_relation_form(self, entity, value, rtype, role, row, col, reload, rvid,
+ default, escape, 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,
- 'default' : default, 'role' : role, 'escape' : escape, 'lzone' : lzone}
+ 'reload' : reload, 'default' : default, 'role' : role,
+ 'escape' : escape, 'lzone' : lzone}
onsubmit = ("return inlineValidateRelationForm('%(divid)s-form', '%(rtype)s', "
- "'%(role)s', '%(eid)s', '%(divid)s', '%(vid)s', '%(default)s', '%(escape)s', '%(lzone)s');"
+ "'%(role)s', '%(eid)s', '%(divid)s', '%(reload)s', '%(vid)s', "
+ "'%(default)s', '%(escape)s', '%(lzone)s');"
% event_data)
cancelclick = "cancelInlineEdit(%s,\'%s\',\'%s\')" % (
entity.eid, rtype, divid)