Simplify javascript.
[platal.git] / plugins / compiler.checkpasswd.php
index dbfbc71..d396b23 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
-require_once 'platal.inc.php';
 
 function smarty_compiler_checkpasswd($tag_attrs, &$compiler)
 {
     extract($compiler->_parse_attrs($tag_attrs));
     if (!isset($width)) {
-      $width = '250px';
+      $width = '230px';
     }
-    if (!isset($id)) {
-      $id = "newpassword";
+    if (!isset($prompt)) {
+      $prompt = "'nouveau'";
+    }
+    if (!isset($submit)) {
+      $submit = "'submitn'";
+    }
+    if (!isset($text)) {
+      $text = "'Changer'";
     }
 
-    return '?><script type="text/javascript" src="javascript/jquery.js" ></script>
+    return '?><script type="text/javascript" src="' . pl_static_content_path("javascript/", "jquery.color.js") . '" ></script>
               <script type="text/javascript">//<![CDATA[
-                $(":input[@name=' . $id . ']").keyup(function(event) { checkPassword(event.target); });
+                var passwordprompt_name = '.  $prompt . ';
+                var passwordprompt_submit = ' . $submit . ';
+                $(":input[name=' . $prompt . ']").keyup(function(event) { checkPassword(event.target, ' . $text . '); });
+                $(function() {
+                  checkPassword($(":input[name=' . $prompt . ']").get(0), ' . $text . ');
+                });
               //]]></script>
-              <div style="border: 1px solid white; width: ' . $width . '; height: 7px; background-color: #444">
-                <div id="passwords_measure" style="height: 100%; background-color: red; width: 0px"></div>
+              <div>
+                <div style="border: 1px solid white; width: ' . $width . '; height: 7px; background-color: #444; margin-top: 4px; float: left">
+                  <div id="passwords_measure" style="height: 100%; background-color: red; width: 0px"></div>
+                </div>
+                <a href="Xorg/MDP?display=light" style="display: block; float: left; margin-left: 4px;" class="popup_600x800">
+                  <img src="images/icons/information.gif" alt="Aide" title="Comment construire un mot de passe fort..." />
+                </a>
               </div><?php';
 }