Merge close_on_esc.js into xorg.js.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 8 Jan 2011 11:46:12 +0000 (12:46 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 8 Jan 2011 15:22:08 +0000 (16:22 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
htdocs/javascript/close_on_esc.js [deleted file]
htdocs/javascript/xorg.js
modules/profile.php
templates/profile/fiche_referent.tpl
templates/profile/profile.tpl

diff --git a/htdocs/javascript/close_on_esc.js b/htdocs/javascript/close_on_esc.js
deleted file mode 100644 (file)
index fa54f33..0000000
+++ /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:
index 192d1ca..7b49f17 100644 (file)
@@ -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();
+                }
+            });
         }
     });
 
index ff99fee..98c94f3 100644 (file)
@@ -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)
index 922f938..18313db 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
+<script type="text/javascript">
+  $($.closeOnEsc);
+</script>
+
 {assign var=terms value=$profile->getMentoringTerms()}
 {assign var=countries value=$profile->getMentoringCountries()}
 <div id="fiche">
index 967bf7e..da935a0 100644 (file)
@@ -36,6 +36,9 @@ function chgMainWinLoc(strPage)
     document.location = strPage;
   }
 }
+
+$($.closeOnEsc);
+
 //]]></script>
 {/literal}