No more references to platal_baseurl (url $.plURL() instead).
[platal.git] / htdocs / javascript / profile.js
index a173e4b..f0ca309 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -77,10 +77,12 @@ function addSearchName(isFemale)
     while ($('#search_name_' + i).length != 0) {
         i++;
     }
-    Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i + '/' + isFemale, function(data){
-        $('#searchname').before(data);
-        changeNameFlag(i);
-    });
+    $('#search_name_' + i)
+        .updateHtml('profile/ajax/searchname/' + i + '/' + isFemale,
+                    function(data) {
+                        $('#searchname').before(data);
+                        changeNameFlag(i);
+                    });
 }
 
 function removeSearchName(i, isFemale)
@@ -117,11 +119,12 @@ function updateNameDisplay(isFemale)
             searchnames += $('#search_name_' + i).find(':text').val() + ';;';
         }
     }
-    Ajax.update_html(null, 'profile/ajax/buildnames/' + searchnames + '/' + isFemale, function(data){
-        var name = data.split(';');
-        $('#public_name').html(name[0]);
-        $('#private_name').html(name[0] + name[1]);
-    });
+    $.xget('profile/ajax/buildnames/' + searchnames + '/' + isFemale,
+           function(data){
+               var name = data.split(';');
+               $('#public_name').html(name[0]);
+               $('#private_name').html(name[0] + name[1]);
+           });
 }
 
 function toggleParticle(id)
@@ -208,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);
@@ -321,7 +324,8 @@ function addAddress()
         i++;
     }
     $('#add_address').before('<div id="addresses_' + i + '_cont"></div>');
-    Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress());
+    $('#addresses_' + i + '_cont').updateHtml('profile/ajax/address/' + i,
+                                              checkCurrentAddress());
 }
 
 function addressChanged(prefid)
@@ -353,7 +357,7 @@ function addTel(prefid, prefname, subField, mainField, mainId)
         i++;
     }
     $('#' + prefix + 'add').before('<div id="' + prefix + i + '" style="clear: both; padding-top: 4px; padding-bottom: 4px"></div>');
-    Ajax.update_html(prefix + i, 'profile/ajax/tel/' + prefid + '/' + prefname + '/' + i + '/' + subField + '/' + mainField + '/' + mainId);
+    $('#' + prefix + i).updateHtml('profile/ajax/tel/' + prefid + '/' + prefname + '/' + i + '/' + subField + '/' + mainField + '/' + mainId);
 }
 
 function removeTel(prefname, prefid, id)
@@ -485,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)
@@ -528,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)
@@ -634,6 +638,8 @@ function selectJobTerm(li)
  */
 function toggleJobTermsTree(jobid, textfilter)
 {
+    $('#term_tree_comment').toggle();
+
     var treepath;
     if (jobid < 0) {
         treepath = '';
@@ -667,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);
@@ -697,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,
@@ -710,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,