[javascript] fix some javascript errors and remove some deprecation warnings
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 06 Jul 2010 17:15:25 +0200
changeset 5909 9af8ac182f53
parent 5908 91c61feb5bc8
child 5910 432c657ebfec
[javascript] fix some javascript errors and remove some deprecation warnings
web/data/cubicweb.ajax.js
web/data/cubicweb.edition.js
web/data/cubicweb.widgets.js
web/formwidgets.py
--- a/web/data/cubicweb.ajax.js	Tue Jul 06 17:11:44 2010 +0200
+++ b/web/data/cubicweb.ajax.js	Tue Jul 06 17:15:25 2010 +0200
@@ -567,7 +567,7 @@
         rql = rql || '';
         nodeid = nodeid || (compid + 'Component');
         extraargs = extraargs || {};
-        var node = jqNode(nodeid);
+        var node = cw.jqNode(nodeid);
         return node.loadxhtml('json', ajaxFuncArgs('component', null, compid,
                                                    rql, registry, extraargs));
     }
--- a/web/data/cubicweb.edition.js	Tue Jul 06 17:11:44 2010 +0200
+++ b/web/data/cubicweb.edition.js	Tue Jul 06 17:15:25 2010 +0200
@@ -45,7 +45,7 @@
     var tabindex = (start == null) ? 15: start;
     cw.utils.nodeWalkDepthFirst(form, function(elem) {
         var tagName = elem.tagName.toUpperCase();
-        if (inputTypes.contains(tagName)) {
+        if ($.inArray(tagName, inputTypes)) {
             if (jQuery(elem).attr('tabindex') != null) {
                 tabindex += 1;
 		jQuery(elem).attr('tabindex', tabindex);
@@ -309,7 +309,7 @@
     var d = loadRemote('json', args);
     d.addCallback(function(response) {
         var dom = getDomFromResponse(response);
-        preprocessAjaxLoad(null, dom);
+        loadAjaxHtmlHead(dom);
         var form = jQuery(dom);
         form.css('display', 'none');
         form.insertBefore(insertBefore).slideDown('fast');
@@ -323,7 +323,7 @@
             //       to set encoding too.
             form.closest('form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
         }
-        postAjaxLoad(dom);
+        _postAjaxLoad(dom);
     });
     d.addErrback(function(xxx) {
         log('xxx =', xxx);
--- a/web/data/cubicweb.widgets.js	Tue Jul 06 17:11:44 2010 +0200
+++ b/web/data/cubicweb.widgets.js	Tue Jul 06 17:15:25 2010 +0200
@@ -355,7 +355,7 @@
         var variableRegexp = /%\((\w+)\)s/g;
         // emulates rgx.findAll()
         while (group = variableRegexp.exec(text)) {
-            if (!self.variables.contains(group[1])) {
+            if (!$.inArray(group[1], self.variables)) {
                 unknownVariables.push(group[1]);
             }
             it++;
--- a/web/formwidgets.py	Tue Jul 06 17:11:44 2010 +0200
+++ b/web/formwidgets.py	Tue Jul 06 17:15:25 2010 +0200
@@ -570,7 +570,7 @@
         # XXX find a way to understand every format
         fmt = req.property_value('ui.date-format')
         fmt = fmt.replace('%Y', 'yy').replace('%m', 'mm').replace('%d', 'dd')
-        req.add_onload(u'jqNode("%s").datepicker('
+        req.add_onload(u'cw.jqNode("%s").datepicker('
                        '{buttonImage: "%s", dateFormat: "%s", firstDay: 1,'
                        ' showOn: "button", buttonImageOnly: true})' % (
                            domid, req.uiprops['CALENDAR_ICON'], fmt))
@@ -598,7 +598,7 @@
     def _render(self, form, field, renderer):
         req = form._cw
         domid = field.dom_id(form, self.suffix)
-        req.add_onload(u'jqNode("%s").timePicker({selectedTime: "%s", step: %s, separator: "%s"})' % (
+        req.add_onload(u'cw.jqNode("%s").timePicker({selectedTime: "%s", step: %s, separator: "%s"})' % (
             domid, self.timestr, self.timesteps, self.separator))
         if self.timestr is None:
             value = self.values(form, field)[0]