From: Stéphane Jacob Date: Wed, 20 Aug 2008 21:19:28 +0000 (+0200) Subject: Improves education's form display (Finaly closes #209) X-Git-Tag: xorg/1.0.0~332^2~529 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=58acfe8b40d3417e7b1a5ffd868a52509d053558;p=platal.git Improves education's form display (Finaly closes #209) --- diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index a12868f..4b3c470 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -26,7 +26,7 @@ function wizPage_onLoad(id) case 'general': var i = 0; var prefix = 'edu_'; - while (document.getElementById(prefix + i) != null) { + while ($('.' + prefix + i).length != 0) { i++; } for (var j = 0; j < i; j++) { @@ -274,20 +274,26 @@ function addEdu() { var i = 0; var prefix = 'edu_'; - while (document.getElementById(prefix + i) != null) { + var class_parity; + + while ($('.' + prefix + i).length != 0) { i++; } - $('#edu_add').before('
'); - $.get(platal_baseurl + 'profile/ajax/edu/' + i, + if (i % 2) { + class_parity = 'pair'; + } else { + class_parity = 'impair'; + } + $.get(platal_baseurl + 'profile/ajax/edu/' + i + '/' + class_parity, function(data) { - $("#" + prefix + i).html(data); + $('#edu_add').before(data); prepareType(i); }); } function removeEdu(id) { - $('#' + id).remove(); + $('.' + id).remove(); } function addTel(prefid, prefname) diff --git a/include/education.func.inc.php b/include/education.func.inc.php index e1b5144..2cca09b 100644 --- a/include/education.func.inc.php +++ b/include/education.func.inc.php @@ -19,15 +19,15 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function education_options($current=0) +function education_options($current = 0) { - $html = ''; + $html = ''; $res = XDB::iterator("SELECT * FROM profile_education_enum ORDER BY name"); while ($arr_edu = $res->next()) { $html .= '