web/data/cubicweb.ajax.js
changeset 9819 95902c0b991b
parent 9661 c170ec8a4525
child 9821 2077c8da1893
equal deleted inserted replaced
9818:e3d2012adcd0 9819:95902c0b991b
    86     }
    86     }
    87 
    87 
    88 });
    88 });
    89 
    89 
    90 var AJAX_PREFIX_URL = 'ajax';
    90 var AJAX_PREFIX_URL = 'ajax';
    91 var JSON_BASE_URL = baseuri() + 'json?';
    91 var JSON_BASE_URL = BASE_URL + 'json?';
    92 var AJAX_BASE_URL = baseuri() + AJAX_PREFIX_URL + '?';
    92 var AJAX_BASE_URL = BASE_URL + AJAX_PREFIX_URL + '?';
    93 
    93 
    94 
    94 
    95 jQuery.extend(cw.ajax, {
    95 jQuery.extend(cw.ajax, {
    96     /* variant of jquery evalScript with cache: true in ajax call */
    96     /* variant of jquery evalScript with cache: true in ajax call */
    97     _evalscript: function ( i, elem ) {
    97     _evalscript: function ( i, elem ) {
   120     /**
   120     /**
   121      * returns true if `url` is a mod_concat-like url
   121      * returns true if `url` is a mod_concat-like url
   122      * (e.g. http://..../data??resource1.js,resource2.js)
   122      * (e.g. http://..../data??resource1.js,resource2.js)
   123      */
   123      */
   124     _modconcatLikeUrl: function(url) {
   124     _modconcatLikeUrl: function(url) {
   125         var base = baseuri();
   125         var modconcat_rgx = new RegExp('(' + BASE_URL + 'data/([a-z0-9]+/)?)\\?\\?(.+)');
   126         if (!base.endswith('/')) { base += '/'; }
       
   127         var modconcat_rgx = new RegExp('(' + base + 'data/([a-z0-9]+/)?)\\?\\?(.+)');
       
   128         return modconcat_rgx.exec(url);
   126         return modconcat_rgx.exec(url);
   129     },
   127     },
   130 
   128 
   131     /**
   129     /**
   132      * decomposes a mod_concat-like url into its corresponding list of
   130      * decomposes a mod_concat-like url into its corresponding list of
   377  * and return a deferred whose callbacks args are decoded according to the
   375  * and return a deferred whose callbacks args are decoded according to the
   378  * Content-Type response header. `form` should be additional form params
   376  * Content-Type response header. `form` should be additional form params
   379  * dictionary, `reqtype` the HTTP request type (get 'GET' or 'POST').
   377  * dictionary, `reqtype` the HTTP request type (get 'GET' or 'POST').
   380  */
   378  */
   381 function loadRemote(url, form, reqtype, sync) {
   379 function loadRemote(url, form, reqtype, sync) {
   382     if (!url.toLowerCase().startswith(baseuri().toLowerCase())) {
   380     if (!url.toLowerCase().startswith(BASE_URL.toLowerCase())) {
   383         url = baseuri() + url;
   381         url = BASE_URL + url;
   384     }
   382     }
   385     if (!sync) {
   383     if (!sync) {
   386         var deferred = new Deferred();
   384         var deferred = new Deferred();
   387         jQuery.ajax({
   385         jQuery.ajax({
   388             url: url,
   386             url: url,
   590             this.setAttribute('cubicweb:type', 'fckeditor');
   588             this.setAttribute('cubicweb:type', 'fckeditor');
   591             if (typeof FCKeditor != "undefined") {
   589             if (typeof FCKeditor != "undefined") {
   592                 var fck = new FCKeditor(this.id);
   590                 var fck = new FCKeditor(this.id);
   593                 fck.Config['CustomConfigurationsPath'] = fckconfigpath;
   591                 fck.Config['CustomConfigurationsPath'] = fckconfigpath;
   594                 fck.Config['DefaultLanguage'] = fcklang;
   592                 fck.Config['DefaultLanguage'] = fcklang;
   595                 fck.BasePath = baseuri() + "fckeditor/";
   593                 fck.BasePath = BASE_URL + "fckeditor/";
   596                 fck.ReplaceTextarea();
   594                 fck.ReplaceTextarea();
   597             } else {
   595             } else {
   598                 cw.log('fckeditor could not be found.');
   596                 cw.log('fckeditor could not be found.');
   599             }
   597             }
   600         }
   598         }