Changeset 25928


Ignore:
Timestamp:
12/12/13 10:51:47 (6 years ago)
Author:
plg
Message:

feature 1668: hide "delete" link for protected users, hide "change username" and "email address" for guest

Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/user_list.tpl

    r25844 r25928  
    2525var pwg_token = "{$PWG_TOKEN}"; 
    2626 
     27var protectedUsers = [{$protected_users}]; 
     28var guestUser = {$guest_user}; 
     29 
    2730var truefalse = { 
    2831  true:"{'Yes'|translate}", 
     
    145148          var userDetails = '<form>'; 
    146149          userDetails += '<div class="userActions">'; 
    147           userDetails += '<span class="changePasswordDone infos" style="display:none">&#x2714; {/literal}{'Password updated'|translate|escape:javascript}{literal}</span>'; 
    148           userDetails += '<span class="changePassword" style="display:none">{/literal}{'New password'|translate}{literal} <input type="text"> <a href="#" class="buttonLike updatePassword"><img src="themes/default/images/ajax-loader-small.gif" style="margin-bottom:-1px;margin-left:1px;display:none;"><span class="text">{/literal}{'Submit'|translate|escape:javascript}{literal}</span></a> <a href="#" class="cancel">{/literal}{'Cancel'|translate|escape:javascript}{literal}</a></span>'; 
    149           userDetails += '<a class="icon-key changePasswordOpen" href="#">{/literal}{'Change password'|translate|escape:javascript}{literal}</a>'; 
    150           userDetails += '<br><a target="_blank" href="admin.php?page=user_perm&amp;user_id='+userId+'" class="icon-lock">{/literal}{'Permissions'|translate|escape:javascript}{literal}</a>'; 
    151           userDetails += '<br><span class="userDelete"><img class="loading" src="themes/default/images/ajax-loader-small.gif" style="display:none;"><a href="#" class="icon-trash" data-user_id="'+userId+'">{/literal}{'Delete'|translate|escape:javascript}{literal}</a></span>'; 
     150 
     151          if (parseInt(userId) != guestUser) { 
     152            userDetails += '<span class="changePasswordDone infos" style="display:none">&#x2714; {/literal}{'Password updated'|translate|escape:javascript}{literal}</span>'; 
     153            userDetails += '<span class="changePassword" style="display:none">{/literal}{'New password'|translate}{literal} <input type="text"> <a href="#" class="buttonLike updatePassword"><img src="themes/default/images/ajax-loader-small.gif" style="margin-bottom:-1px;margin-left:1px;display:none;"><span class="text">{/literal}{'Submit'|translate|escape:javascript}{literal}</span></a> <a href="#" class="cancel">{/literal}{'Cancel'|translate|escape:javascript}{literal}</a></span>'; 
     154            userDetails += '<a class="icon-key changePasswordOpen" href="#">{/literal}{'Change password'|translate|escape:javascript}{literal}</a>'; 
     155            userDetails += '<br>'; 
     156          } 
     157 
     158          userDetails += '<a target="_blank" href="admin.php?page=user_perm&amp;user_id='+userId+'" class="icon-lock">{/literal}{'Permissions'|translate|escape:javascript}{literal}</a>'; 
     159 
     160          if (protectedUsers.indexOf(parseInt(userId)) == -1) { 
     161            userDetails += '<br><span class="userDelete"><img class="loading" src="themes/default/images/ajax-loader-small.gif" style="display:none;"><a href="#" class="icon-trash" data-user_id="'+userId+'">{/literal}{'Delete'|translate|escape:javascript}{literal}</a></span>'; 
     162          } 
     163 
    152164          userDetails += '</div>'; 
    153165 
    154           userDetails += '<span class="changeUsernameOpen"><strong class="username">'+user.username+'</strong> <a href="#" class="icon-pencil">{/literal}{'Change username'|translate|escape:javascript}{literal}</a></span>'; 
    155           userDetails += '<span class="changeUsername" style="display:none">'; 
    156           userDetails += '<input type="text"> <a href="#" class="buttonLike updateUsername"><img src="themes/default/images/ajax-loader-small.gif" style="margin-bottom:-1px;margin-left:1px;display:none;"><span class="text">{/literal}{'Submit'|translate}{literal}</span></a> <a href="#" class="cancel">{/literal}{'Cancel'|translate|escape:javascript}{literal}</a>'; 
     166          userDetails += '<span class="changeUsernameOpen"><strong class="username">'+user.username+'</strong>'; 
     167 
     168          if (parseInt(userId) != guestUser) { 
     169            userDetails += ' <a href="#" class="icon-pencil">{/literal}{'Change username'|translate|escape:javascript}{literal}</a></span>'; 
     170            userDetails += '<span class="changeUsername" style="display:none">'; 
     171            userDetails += '<input type="text"> <a href="#" class="buttonLike updateUsername"><img src="themes/default/images/ajax-loader-small.gif" style="margin-bottom:-1px;margin-left:1px;display:none;"><span class="text">{/literal}{'Submit'|translate}{literal}</span></a> <a href="#" class="cancel">{/literal}{'Cancel'|translate|escape:javascript}{literal}</a>'; 
     172          } 
     173 
    157174          userDetails += '</span>'; 
    158175 
     
    171188 
    172189          userDetails += '<div class="userProperty"><strong>{/literal}{'Email address'|translate}{literal}</strong>'; 
    173           userDetails += '<br><input name="email" type="text" value="'+ (user.email||'') +'"></div>'; 
     190          userDetails += '<br>'; 
     191          if (parseInt(userId) != guestUser) { 
     192            userDetails += '<input name="email" type="text" value="'+ (user.email||'') +'">'; 
     193          } 
     194          else { 
     195            userDetails += '{/literal}{'N/A'|translate}{literal}'; 
     196          } 
     197          userDetails += '</div>'; 
    174198 
    175199          userDetails += '<div class="userProperty"><strong>{/literal}{'Status'|translate}{literal}</strong>'; 
  • trunk/admin/user_list.php

    r25282 r25928  
    9191  ); 
    9292 
    93 // echo '<pre>'; print_r($users); echo '</pre>'; 
     93$default_user = get_default_user_info(true); 
    9494 
    95 $default_user = get_default_user_info(true); 
     95$protected_users = array( 
     96  $user['id'], 
     97  $conf['guest_id'], 
     98  $conf['default_user_id'], 
     99  $conf['webmaster_id'], 
     100  ); 
    96101 
    97102$template->assign( 
     
    105110    'language_selected' => get_default_language(), 
    106111    'association_options' => $groups, 
     112    'protected_users' => implode(',', array_unique($protected_users)), 
     113    'guest_user' => $conf['guest_id'], 
    107114    ) 
    108115  ); 
Note: See TracChangeset for help on using the changeset viewer.