web/data/cubicweb.edition.js
changeset 5937 82cac9383dd8
parent 5936 98ac4000e820
child 6043 bfe13118b5aa
equal deleted inserted replaced
5936:98ac4000e820 5937:82cac9383dd8
    46     cw.utils.nodeWalkDepthFirst(form, function(elem) {
    46     cw.utils.nodeWalkDepthFirst(form, function(elem) {
    47         var tagName = elem.tagName.toUpperCase();
    47         var tagName = elem.tagName.toUpperCase();
    48         if ($.inArray(tagName, inputTypes)) {
    48         if ($.inArray(tagName, inputTypes)) {
    49             if (jQuery(elem).attr('tabindex') != null) {
    49             if (jQuery(elem).attr('tabindex') != null) {
    50                 tabindex += 1;
    50                 tabindex += 1;
    51 		jQuery(elem).attr('tabindex', tabindex);
    51                 jQuery(elem).attr('tabindex', tabindex);
    52             }
    52             }
    53             return null;
    53             return null;
    54         }
    54         }
    55         return jQuery.grep(elem.childNodes, isElementNode);
    55         return jQuery.grep(elem.childNodes, isElementNode);
    56     });
    56     });
   168         return;
   168         return;
   169     }
   169     }
   170     // add hidden parameter
   170     // add hidden parameter
   171     var entityForm = jQuery('#entityForm');
   171     var entityForm = jQuery('#entityForm');
   172     var oid = optionNode.id.substring(2); // option id is prefixed by "id"
   172     var oid = optionNode.id.substring(2); // option id is prefixed by "id"
   173     remoteExec('add_pending_inserts', [oid.split(':')]);
   173     loadRemote('json', ajaxFuncArgs('add_pending_inserts', null,
       
   174                                     [oid.split(':')]), 'GET', true);
   174     var selectNode = optionNode.parentNode;
   175     var selectNode = optionNode.parentNode;
   175     // remove option node
   176     // remove option node
   176     selectNode.removeChild(optionNode);
   177     selectNode.removeChild(optionNode);
   177     // add line in table
   178     // add line in table
   178     if (cell) {
   179     if (cell) {
   206             },
   207             },
   207             entityView);
   208             entityView);
   208         }
   209         }
   209     }
   210     }
   210     elementId = elementId.substring(2, elementId.length);
   211     elementId = elementId.substring(2, elementId.length);
   211     remoteExec('remove_pending_insert', elementId.split(':'));
   212     loadRemote('json', ajaxFuncArgs('remove_pending_inserts', null,
       
   213                                     elementId.split(':')), 'GET', true);
   212 }
   214 }
   213 
   215 
   214 /**
   216 /**
   215  * .. function:: buildPendingDeleteHandle(elementId, eid)
   217  * .. function:: buildPendingDeleteHandle(elementId, eid)
   216  *
   218  *
   335  *
   337  *
   336  * removes the part of the form used to edit an inlined entity
   338  * removes the part of the form used to edit an inlined entity
   337  */
   339  */
   338 function removeInlineForm(peid, rtype, role, eid, showaddnewlink) {
   340 function removeInlineForm(peid, rtype, role, eid, showaddnewlink) {
   339     cw.jqNode(['div', peid, rtype, eid].join('-')).slideUp('fast', function() {
   341     cw.jqNode(['div', peid, rtype, eid].join('-')).slideUp('fast', function() {
   340 	    $(this).remove();
   342             $(this).remove();
   341 	    updateInlinedEntitiesCounters(rtype, role);
   343             updateInlinedEntitiesCounters(rtype, role);
   342     });
   344     });
   343     if (showaddnewlink) {
   345     if (showaddnewlink) {
   344         toggleVisibility(showaddnewlink);
   346         toggleVisibility(showaddnewlink);
   345     }
   347     }
   346 }
   348 }
   467     _clearPreviousErrors(formid);
   469     _clearPreviousErrors(formid);
   468     var descr = result[1];
   470     var descr = result[1];
   469     var errmsg;
   471     var errmsg;
   470     // Unknown structure
   472     // Unknown structure
   471     if ( !cw.utils.isArrayLike(descr) || descr.length != 2 ) {
   473     if ( !cw.utils.isArrayLike(descr) || descr.length != 2 ) {
   472 	errmsg = descr;
   474         errmsg = descr;
   473     } else {
   475     } else {
   474 	_displayValidationerrors(formid, descr[0], descr[1]);
   476         _displayValidationerrors(formid, descr[0], descr[1]);
   475 	errmsg = _('please correct errors below');
   477         errmsg = _('please correct errors below');
   476     }
   478     }
   477     updateMessage(errmsg);
   479     updateMessage(errmsg);
   478     // ensure the browser does not scroll down
   480     // ensure the browser does not scroll down
   479     document.location.hash = '#header';
   481     document.location.hash = '#header';
   480     return false;
   482     return false;