No more references to platal_baseurl (url $.plURL() instead).
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 23 Jan 2011 14:03:50 +0000 (15:03 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 23 Jan 2011 14:16:59 +0000 (15:16 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
12 files changed:
classes/jobterms.php
core
htdocs/javascript/jobtermstree.js
htdocs/javascript/profile.js
htdocs/javascript/xorg.js
templates/emails/send.tpl
templates/gadgets/ig-skin.tpl
templates/profile/jobs.job.tpl
templates/profile/mentor.tpl
templates/profile/profile.tpl
templates/search/adv.form.tpl
templates/search/referent.tpl

index ae5c758..85f3a07 100644 (file)
@@ -117,9 +117,9 @@ class JobTerms {
         return '$("'.addslashes($domElement).'").jstree({
             "core" : {"strings":{"loading":"Chargement ..."}},
             "plugins" : ["themes","json_data"],
-            "themes" : { "url" : platal_baseurl + "css/jstree.css" },
+            "themes" : { "url" : $.plURL("css/jstree.css") },
             "json_data" : { "ajax" : {
-                "url" : platal_baseurl + "'.addslashes($platalpage).'",
+                "url" : $.plURL("'.addslashes($platalpage).'"),
                 "data" : function(nod) {
                     var jtid = 0;
                     if (nod != -1) {
diff --git a/core b/core
index 5f6b3a2..c6e84b6 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 5f6b3a28efe41c038f349fb0b281d9637f7078de
+Subproject commit c6e84b6d8243fd19b8d767c244be789ab45d7401
index 936f430..46266fc 100644 (file)
@@ -37,9 +37,9 @@ function createJobTermsTree(domElement, platalpage, treeid, clickFunc, text_filt
     $(domElement).jstree({
         "core" : {"strings":{"loading":"Chargement ..."}},
         "plugins" : ["themes","json_data"],
-        "themes" : { "url" : platal_baseurl + "css/jstree.css" },
+        "themes" : { "url" : $.plURL("css/jstree.css") },
         "json_data" : { "ajax" : {
-            "url" : platal_baseurl + platalpage,
+            "url" : $.plURL(platalpage),
             "data" : function(nod) {
                 var jtid = 0;
                 if (nod != -1) {
index ff6c312..f0ca309 100644 (file)
@@ -211,7 +211,7 @@ function addEdu()
     i++;
     $('#edu_add').addClass(prefix + i);
     i--;
-    $.get(platal_baseurl + 'profile/ajax/edu/' + i + '/' + class_parity,
+    $.xget('profile/ajax/edu/' + i + '/' + class_parity,
           function(data) {
               $('#edu_add').before(data);
               prepareType(i);
@@ -489,7 +489,7 @@ function makeAddProcess(id)
 function addMedal()
 {
     var id = $('#medals').find('[name=medal_sel]').val();
-    $.get(platal_baseurl + 'profile/ajax/medal/' + id, makeAddProcess(id));
+    $.xget('profile/ajax/medal/' + id, makeAddProcess(id));
 }
 
 function removeMedal(id)
@@ -532,7 +532,7 @@ function addJob()
     while ($('#jobs_' + i).length != 0) {
         ++i;
     }
-    $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i));
+    $.xget('profile/ajax/job/' + i, makeAddJob(i));
 }
 
 function addEntreprise(id)
@@ -673,7 +673,7 @@ function addSkill(cat)
 {
     var val  = $('#' + cat + '_table').find('[name=' + cat + '_sel]').val();
     var text = $('#' + cat + '_table').find('[name=' + cat + '_sel] :selected').text();
-    $.get(platal_baseurl + 'profile/ajax/skill/' + cat + '/' + val,
+    $.xget('profile/ajax/skill/' + cat + '/' + val,
           function(data) {
               $('#' + cat).append(data);
               $('#' + cat + '_' + val + '_title').text(text);
@@ -703,7 +703,7 @@ function registerEnterpriseAutocomplete(id)
     $(".enterpriseName").each(
       function() {
         if (id == -1 || this.name == "jobs[" + id + "][name]") {
-            $(this).autocomplete(platal_baseurl + "search/autocomplete/entreprise",
+            $(this).autocomplete($.plURL("search/autocomplete/entreprise"),
                                  {
                                      selectOnly:1,
                                      field:this.name,
@@ -716,7 +716,7 @@ function registerEnterpriseAutocomplete(id)
     $(".sectorName").each(
       function() {
         if (id == -1 || this.name == "jobs[" + id + "][subSubSectorName]") {
-            $(this).autocomplete(platal_baseurl + "search/autocomplete/subSubSector",
+            $(this).autocomplete($.plURL("search/autocomplete/subSubSector"),
                                  {
                                      selectOnly:1,
                                      field:this.name,
index 94d8a1e..178c39e 100644 (file)
@@ -157,35 +157,39 @@ function goodiesPopup(node, goodies) {
 function auto_links() {
     var url  = document.URL;
     var fqdn = url.replace(/^https?:\/\/([^\/]*)\/.*$/,'$1');
-    var light = (url.indexOf('display=light') > url.indexOf('?'));
-    var resource_page = (url.indexOf('rss') > -1 || url.indexOf('ical') > -1);
+    var light = url.indexOf('display=light') > url.indexOf('?');
+    var resource_page = url.contains('rss') || url.contains('ical');
 
     $("a,link").each(function(i) {
         var node = $(this);
         var href = this.href;
+        var matches;
+        var rss;
+        var ical;
+
         if(!href || node.hasClass('xdx')
-           || href.indexOf('mailto:') > -1 || href.indexOf('javascript:') > -1) {
+           || href.startsWith('mailto:') || href.startsWith('javascript:')) {
             return;
         }
-        if ((href.indexOf(fqdn) < 0 && this.className.indexOf('popup') < 0) || node.hasClass('popup')) {
+        if ((!href.contains(fqdn) && !this.className.contains('popup')) || node.hasClass('popup')) {
             node.click(function () {
                 window.open(href);
                 return false;
             });
         }
-        if (href.indexOf(fqdn) > -1 && light) {
+        if (href.contains(fqdn) && light) {
             href = href.replace(/([^\#\?]*)\??([^\#]*)(\#.*)?/, "$1?display=light&$2$3");
             this.href = href;
         }
-        var rss  = href.indexOf('rss') > -1;
-        var ical = href.indexOf('ical') > -1;
+        rss  = href.contains('rss');
+        ical = href.contains('ical');
         if (rss || ical) {
-            if (href.indexOf('http') < 0) {
+            if (!href.startsWith('http')) {
                 href = 'http://' + fqdn + '/' + href;
             }
         }
         if (this.nodeName.toLowerCase() == 'a' && !resource_page) {
-            if (rss && href.indexOf('prefs/rss') < 0 &&  (href.indexOf('xml') > -1 || href.indexOf('hash'))) {
+            if (rss && !href.contains('prefs/rss') && (href.contains('xml') || href.contains('hash'))) {
                 goodiesPopup(this, __goodies_rss);
             } else if (ical) {
                 goodiesPopup(this, __goodies_ical);
index 24189b2..1434bc5 100644 (file)
@@ -65,7 +65,7 @@
     for (var i = 0 ; i < form['cc_contacts[]'].length ; ++i) {
       ccc += form['cc_contacts[]'].options[i].value + ";";
     }
-    $.post(platal_baseurl + "emails/send",
+    $.xpost("emails/send",
            { save: true,
              token: '{xsrf_token}',
              from: form.from.value,
index 12cc8fe..6349484 100644 (file)
@@ -24,8 +24,8 @@
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <link rel="stylesheet" type="text/css" href="css/base.css" media="all"/>
     <link rel="stylesheet" type="text/css" href="css/igoogle.css" media="all"/>
-    <script type="text/javascript">var platal_baseurl = "{$globals->baseurl}/";</script>
-    {javascript name=jquery}
+    {javascript name=jquery.xorg}
+    {javascript name=core}
     {javascript name=xorg}
     {javascript name=igoogle}
   </head>
index a39bec9..b1dade3 100644 (file)
           {foreach from=$job.terms item=term}
           addJobTerm("{$i}", "{$term.jtid}", "{$term.full_name|replace:'"':'\\"'}");
           {/foreach}
-          $('#jobs_{$i} .term_search').autocomplete(platal_baseurl + 'profile/jobterms',
+          $('#jobs_{$i} .term_search').autocomplete($.plURL('profile/jobterms'),
             {ldelim}
               "formatItem" : displayJobTerm,
               "extraParams" : {ldelim} "jobid" : "{$i}" {rdelim},
index 5fc41e3..2d942ef 100644 (file)
         {foreach from=$terms item=term}
         addJobTerm(-1, "{$term.jtid}", "{$term.full_name|replace:'"':'\\"'}");
         {/foreach}
-        $('.term_search').autocomplete(platal_baseurl + 'profile/jobterms',
+        $('.term_search').autocomplete($.plURL('profile/jobterms'),
           {ldelim}
             "formatItem" : displayJobTerm,
             "extraParams" : {ldelim} "jobid" : "-1" {rdelim},
index da935a0..2df497b 100644 (file)
@@ -24,7 +24,7 @@
 <script type="text/javascript">//<![CDATA[
 function chgMainWinLoc(strPage)
 {
-  strPage = platal_baseurl + strPage;
+  strPage = $.plURL(strPage);
   if (parent.opener) {
     try {
       parent.opener.document.location = strPage;
index 985e6eb..ecc0301 100644 (file)
 {/if}
 
 <script type="text/javascript">// <!--
-  var baseurl = platal_baseurl + "search/";
+  var baseurl = $.plURL("search/");
   {literal}
-  String.prototype.htmlEntities = function () {
-    return this.replace(/&/g,'&amp;').replace(new RegExp('<','g'),'&lt;').replace(/>/g,'&gt;');
-  };
+
   // display an autocomplete row : blabla (nb of found matches)
   function make_format_autocomplete(block) {
     return function(row) {
index 40559e6..f11a265 100644 (file)
@@ -37,7 +37,7 @@ Actuellement, {$mentors_number} mentors et référents se sont déclarés sur {#
 {javascript name=jobtermstree}
 <script type="text/javascript">//<![CDATA[
 
-var baseurl = platal_baseurl + "referent/";
+var baseurl = $.plURL("referent/");
 {literal}
 
 /** Hides or display tree of all job terms */
@@ -81,7 +81,7 @@ function updateJobTerm(jtid, country)
   $('#jobterm').val(jtid);
   $('#country_chg').closest('tr').show();
   $('#keywords').show();
-  $('#country_chg').load(platal_baseurl + 'search/referent/countries/' + jtid, function(response, status, xhr) {
+  $('#country_chg').load($.plURL('search/referent/countries/' + jtid), function(response, status, xhr) {
     if (country) {
       if (status != "error") {
         $('#country_chg select').val(country);