Code

Added a smarty function 'factory' which can be used the generate HTML content, e...
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Apr 2010 07:56:20 +0000 (07:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Apr 2010 07:56:20 +0000 (07:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17920 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/ihtml/themes/default/login.tpl
gosa-core/include/smarty/plugins/function.factory.php [new file with mode: 0644]

index 1dc7ceacf5bef6ac2c82895e185112f244da5337..795dd6d9fae5a5ea9cf239301270bb9ae25eb89f 100644 (file)
        <div class='login-element-container'>
         <div class='login-label'><label for='password'>{t}Password{/t}</label></div>
         <div class='login-input'>
-         <input type='password' name='password' id='password' maxlength='40' value=''
-                title='{t}Password{/t}' onFocus="nextfield= 'login';" onKeyPress= "
-               if (capslock(event)){
-                 $('password').style.backgroundImage = 'url(images/caps.png)'
-              } else {
-                 $('password').style.backgroundImage= ''
-              }"/>
+         {factory type='password' name='password' id='password' maxlength='40' onfocus="nextfield= 'login'"}
         </div>
         <div class="clear"></div>
        </div>
diff --git a/gosa-core/include/smarty/plugins/function.factory.php b/gosa-core/include/smarty/plugins/function.factory.php
new file mode 100644 (file)
index 0000000..7156feb
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+function smarty_function_factory($params, &$smarty)
+{
+
+    // Capture params
+    foreach(array('type','id','name','title','value','maxlength',
+                'onfocus','onclick') as $var){
+        $$var = (isset($params[$var]))? $params[$var] : "";
+        $tmp  = "{$var}Ready";
+        $$tmp = (isset($params[$var]))? "{$var}=\"{$params[$var]}\"" : "";
+    }
+
+    $str = "";
+    switch($type){
+
+        // Generate a password input field, with CapsLock detection.
+        case 'password' : 
+            $str .= "<input {$nameReady} {$idReady} {$valueReady} {$maxlengthReady}
+            {$titleReady} {$onfocusReady} type='password'
+            onkeypress=\"
+                if (capslock(event)){
+                    $('password').style.backgroundImage = 'url(images/caps.png)'
+                } else {
+                    $('password').style.backgroundImage= ''
+                }\">";
+    }
+    return($str);
+}
+  
+?>