From: Florent Bruneau Date: Sat, 8 Jan 2011 11:46:12 +0000 (+0100) Subject: Merge close_on_esc.js into xorg.js. X-Git-Tag: xorg/1.1.0~212 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0c9edc89377266444fa06b77104dc5781eae1698;p=platal.git Merge close_on_esc.js into xorg.js. Signed-off-by: Florent Bruneau --- diff --git a/htdocs/javascript/close_on_esc.js b/htdocs/javascript/close_on_esc.js deleted file mode 100644 index fa54f33..0000000 --- a/htdocs/javascript/close_on_esc.js +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2003-2011 Polytechnique.org * - * http://opensource.polytechnique.org/ * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software * - * Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - ***************************************************************************/ - -$(window).keydown( - function(e) { - if (e.keyCode == 27) { - window.close(); - } - }); - -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index 192d1ca..7b49f17 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -414,6 +414,14 @@ function checkPassword(box, okLabel) { xpost: function(source, data, onSuccess, onError, type) { return $.xajax(source, 'POST', data, onSuccess, onError, type); + }, + + closeOnEsc: function() { + return $(window).keydown(function (e) { + if (e.keyCode == 27) { + window.close(); + } + }); } }); diff --git a/modules/profile.php b/modules/profile.php index ff99fee..98c94f3 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -293,7 +293,6 @@ class ProfileModule extends PLModule $page->assign('view', $view); $page->assign('logged', S::logged()); - $page->addJsLink('close_on_esc.js'); header('Last-Modified: ' . date('r', strtotime($profile->last_change))); } @@ -524,8 +523,6 @@ class ProfileModule extends PLModule LEFT JOIN geoloc_countries AS gc ON (m.country = gc.iso_3166_1_a2) WHERE pid = {?}", $pf->id()); $page->assign('pays', $res->fetchColumn()); - - $page->addJsLink('close_on_esc.js'); } function handler_ref_country(&$page) diff --git a/templates/profile/fiche_referent.tpl b/templates/profile/fiche_referent.tpl index 922f938..18313db 100644 --- a/templates/profile/fiche_referent.tpl +++ b/templates/profile/fiche_referent.tpl @@ -20,6 +20,10 @@ {* *} {**************************************************************************} + + {assign var=terms value=$profile->getMentoringTerms()} {assign var=countries value=$profile->getMentoringCountries()}
diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index 967bf7e..da935a0 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -36,6 +36,9 @@ function chgMainWinLoc(strPage) document.location = strPage; } } + +$($.closeOnEsc); + //]]> {/literal}