Changeset 9232


Ignore:
Timestamp:
Feb 15, 2011, 12:33:49 AM (9 years ago)
Author:
LucMorizur
Message:

Tooltips are showed in index and register pages, informing the user of current insensitivity

Location:
extensions/LCAS/trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/language/en_UK/plugin.lang.php

    r9206 r9232  
    4747$lang['submit'] = 'Save settings';
    4848
    49 $lang['LCAS_error'][1] = 'This username is already used.<br>Username is case insensitive (uppercase/lowercase; E = e ≠ É = é).';
    50 
    51 $lang['LCAS_error'][2] = 'This username is already used.<br>Username is accents insensitive (e = é ≠ E = É).';
    52 
    53 $lang['LCAS_error'][3] = 'This username is already used.<br>Username is case (uppercase/lowercase) and accents insensitive (E = e = É = é).';
    54 
    5549$lang['LCAS_MailText'] = 'Customizing email notification';
    5650
  • extensions/LCAS/trunk/language/fr_FR/plugin.lang.php

    r9229 r9232  
    5454$lang['submit'] = 'Sauvegarder les paramètres';
    5555
    56 $lang['LCAS_error'][1] = 'Ce nom d\'utilisateur est déjà pris.<br>Le nom d\'utilisateur est insensible à la casse (majuscules/minuscules&nbsp;; E = e ≠ É = é).';
    57 
    58 $lang['LCAS_error'][2] = 'Ce nom d\'utilisateur est déjà pris.<br>Le nom d\'utilisateur est insensible aux accents (e = é ≠ E = É).';
    59 
    60 $lang['LCAS_error'][3] = 'Ce nom d\'utilisateur est déjà pris.<br>Le nom d\'utilisateur est insensible à la casse (majuscules/minuscules) et aux accents (E = e = É = é).';
    61 
    6256$lang['LCAS_MailText'] = 'Personnalisation de la notification par email';
    6357
  • extensions/LCAS/trunk/main.inc.php

    r9229 r9232  
    2424
    2525load_language('plugin.lang', LCAS_PATH);
     26load_language('messages.lang', LCAS_PATH);
    2627
    2728$t = pwg_db_fetch_row(pwg_query('
     
    4546  $name = $plugin['name'];
    4647 
     48                                                                                                // to be removed in final version :
     49                                                                                                global $template;
     50                                                                                                $template->delete_compiled_templates();
     51 
    4752  array_push($menu,
    4853    array(
     
    5560}
    5661
     62function LCAS_add_tooltips_prefilter_register($content, &$smarty) {
     63  $search = 'for="login"';
     64  $replacement = 'for="login" title="{$LCAS_username_tooltip}"';
     65  $content = str_replace($search, $replacement, $content);
     66  $search = 'name="login"';
     67  $replacement = 'name="login" title="{$LCAS_username_tooltip}"';
     68  $content = str_replace($search, $replacement, $content);
     69  $search = 'for="password"';
     70  $replacement = 'for="password" title="{$LCAS_password_tooltip}"';
     71  $content = str_replace($search, $replacement, $content);
     72  $search = 'name="password"';
     73  $replacement = 'name="password" title="{$LCAS_password_tooltip}"';
     74  $content = str_replace($search, $replacement, $content);
     75  $search = 'for="password_conf"';
     76  $replacement = 'for="password_conf" title="{$LCAS_password_tooltip}"';
     77  $content = str_replace($search, $replacement, $content);
     78  $search = 'name="password_conf"';
     79  $replacement = 'name="password_conf" title="{$LCAS_password_tooltip}"';
     80  $content = str_replace($search, $replacement, $content);
     81  return $content;
     82}
     83
    5784// Check users identification
    5885add_event_handler('init', 'LCAS_InitPage');
     
    6087function LCAS_InitPage()
    6188{
    62   global $conf;
     89  global $template, $conf, $lang;
    6390
    6491  $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
     
    76103      $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    77104    }
     105  }
     106 
     107  // Add tooltips on register page
     108  if (script_basename() == 'register') {
     109    $template->assign(array(
     110      'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[1])],
     111      'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'],
     112    ));
     113    $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register');
    78114  }
    79115}
     
    99135  return $errors;
    100136}
     137
     138/**
     139 *
     140 * LCAS_add_tooltips()
     141 * add tooltips on username and password fields
     142 *
     143 * @param no parameter
     144 * @return no return value
     145 */
     146
     147add_event_handler('blockmanager_apply', 'LCAS_add_tooltips_index');
     148
     149function LCAS_add_tooltips_prefilter_index($content, &$smarty) {
     150  $search = 'for="username"';
     151  $replacement = 'for="username" title="{$LCAS_username_tooltip}"';
     152  $content = str_replace($search, $replacement, $content);
     153  $search = 'name="username"';
     154  $replacement = 'name="username" title="{$LCAS_username_tooltip}"';
     155  $content = str_replace($search, $replacement, $content);
     156  $search = 'for="password"';
     157  $replacement = 'for="password" title="{$LCAS_password_tooltip}"';
     158  $content = str_replace($search, $replacement, $content);
     159  $search = 'name="password"';
     160  $replacement = 'name="password" title="{$LCAS_password_tooltip}"';
     161  $content = str_replace($search, $replacement, $content);
     162  return $content;
     163}
     164
     165function LCAS_add_tooltips_index() {
     166  global $template, $conf, $lang;
     167 
     168  $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
     169 
     170  $template->assign(array(
     171    'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_index'][intval($conf_LCAS[1])],
     172    'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_index'],
     173  ));
     174  $template->set_prefilter('menubar', 'LCAS_add_tooltips_prefilter_index');
     175}
     176
    101177?>
Note: See TracChangeset for help on using the changeset viewer.