Changeset 27322


Ignore:
Timestamp:
Feb 10, 2014, 11:20:27 PM (10 years ago)
Author:
LucMorizur
Message:

Add tooltips where needed
Remove obsolete comment

Location:
extensions/LCAS/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/include/functions.inc.php

    r10549 r27322  
    284284
    285285/**
    286  * Function called from main.inc.php - For test on username case sensitivity
    287  * Have to be deleted before first release build
     286 * Function called from main.inc.php
    288287 *
    289288 * @param : $username typed in by user for identification
  • extensions/LCAS/trunk/main.inc.php

    r27296 r27322  
    5858function LCAS_InitPage()
    5959{
    60   global $conf;
     60  global $template, $conf, $lang;
    6161
    6262  $conf_LCAS = unserialize($conf['LoginCaseAccentsSensitivity']);
     
    6666  if ($conf_LCAS[0] != '0') $conf['insensitive_case_logon'] = false;
    6767
    68   $s = script_basename();
    69   // Add tooltips on register page
    70   if ($s == 'register') {
    71     $template->assign(array(
    72       'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
    73       'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'],
    74     ));
    75     $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register');
     68  $p = '';
     69
     70  switch (script_basename()) {
     71
     72    case 'register':
     73      $template->assign(array(
     74        'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
     75        'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'],
     76      ));
     77      $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register');
     78    break;
     79
     80    case 'identification':
     81      $p = 'username';
     82      $template->assign(array(
     83        'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
     84        'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'],
     85      ));
     86      $template->set_prefilter('identification', 'LCAS_add_tooltips_prefilter_identification');
     87    break;
     88
     89    case 'password':
     90      $p = 'username_or_email';
     91      $template->assign(array(
     92        'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
     93      ));
     94      $template->set_prefilter('password', 'LCAS_add_tooltips_prefilter_password');
     95    break;
     96
     97    default: return false;
    7698  }
    77   else if ($s == 'identification') $p = 'username';
    78   else if ($s == 'password') $p = 'username_or_email';
    79   else return false;
    80   if (isset($_POST[$p]) and isset($conf_LCAS[0])) {
     99
     100  if (($p != '') and isset($_POST[$p]) and isset($conf_LCAS[0])) {
    81101    $new_username = LCAS_SearchCaseUsername($_POST[$p],$conf_LCAS[0]);
    82102    $_POST[$p] = $new_username == '' ? $_POST[$p] : $new_username;
     
    84104}
    85105
     106function LCAS_add_tooltips_prefilter_password($content, &$smarty) {
     107  $search = '<label>
     108      {\'Username or email\'';
     109  $replacement = '<label title="{$LCAS_username_tooltip}">
     110      {\'Username or email\'';
     111  $content = str_replace($search, $replacement, $content);
     112  $search = 'name="username_or_email"';
     113  $replacement = 'name="username_or_email" title="{$LCAS_username_tooltip}"';
     114  $content = str_replace($search, $replacement, $content);
     115  return $content;
     116}
     117
    86118function LCAS_add_tooltips_prefilter_register($content, &$smarty) {
    87119  $search = 'for="login"';
     
    102134  $search = 'name="password_conf"';
    103135  $replacement = 'name="password_conf" title="{$LCAS_password_tooltip}"';
     136  $content = str_replace($search, $replacement, $content);
     137  return $content;
     138}
     139
     140function LCAS_add_tooltips_prefilter_identification($content, &$smarty) {
     141  $search = 'for="username"';
     142  $replacement = 'for="username" title="{$LCAS_username_tooltip}"';
     143  $content = str_replace($search, $replacement, $content);
     144  $search = 'name="username"';
     145  $replacement = 'name="username" title="{$LCAS_username_tooltip}"';
     146  $content = str_replace($search, $replacement, $content);
     147  $search = 'for="password"';
     148  $replacement = 'for="password" title="{$LCAS_password_tooltip}"';
     149  $content = str_replace($search, $replacement, $content);
     150  $search = 'name="password"';
     151  $replacement = 'name="password" title="{$LCAS_password_tooltip}"';
    104152  $content = str_replace($search, $replacement, $content);
    105153  return $content;
Note: See TracChangeset for help on using the changeset viewer.