From 58acfe8b40d3417e7b1a5ffd868a52509d053558 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Wed, 20 Aug 2008 23:19:28 +0200 Subject: [PATCH] Improves education's form display (Finaly closes #209) --- htdocs/javascript/profile.js | 18 ++++++--- include/education.func.inc.php | 8 ++-- modules/profile.php | 3 +- templates/profile/edu.tpl | 68 +++++++++++++++++++++------------ templates/profile/general.tpl | 39 +++++++++---------- upgrade/fusionax-0.0.1/06_education.sql | 2 +- 6 files changed, 81 insertions(+), 57 deletions(-) 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 .= '