Changeset 25483 for trunk/admin
- Timestamp:
- Nov 14, 2013, 2:41:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/user_list.tpl
r25479 r25483 112 112 var userDetails = '<form>'; 113 113 userDetails += '<div class="userActions">'; 114 userDetails += '<a class="icon-key" href="#">Change password</a>'; 114 userDetails += '<span class="changePasswordDone infos" style="display:none">✔ Password updated</span>'; 115 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}{literal}</span></a> <a href="#" class="cancel">Cancel</a></span>'; 116 userDetails += '<a class="icon-key changePasswordOpen" href="#">Change password</a>'; 115 117 userDetails += '<br><a target="_blank" href="admin.php?page=user_perm&user_id='+userId+'" class="icon-lock">Permissions</a>'; 116 118 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+'">Delete</a></span>'; 117 119 userDetails += '</div>'; 118 userDetails += '<strong class="username">'+user.username+'</strong> <span class="icon-pencil"></span>'; 119 userDetails += '<br><br>'; 120 121 userDetails += '<span class="changeUsernameOpen"><strong class="username">'+user.username+'</strong> <a href="#" class="icon-pencil">Change username</a></span>'; 122 userDetails += '<span class="changeUsername" style="display:none">'; 123 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">Cancel</a>'; 124 userDetails += '</span>'; 125 126 userDetails += '<div class="userStats">'; 120 127 userDetails += sprintf(registeredOn_pattern, user.registration_date_string, user.registration_date_since); 121 128 … … 124 131 } 125 132 133 userDetails += '</div>'; 126 134 userDetails += '<div class="userPropertiesContainer">'; 127 135 userDetails += '<input type="hidden" name="user_id" value="'+user.id+'">'; … … 227 235 userDetails += '<div style="clear:both"></div></div>'; 228 236 229 userDetails += '<span class="infos " style="display:none">✔ User '+user.username+' updated</span>';237 userDetails += '<span class="infos propertiesUpdateDone" style="display:none">✔ User '+user.username+' updated</span>'; 230 238 userDetails += '<input type="submit" value="{/literal}{'Update user'|translate}{literal}" style="display:none;" data-user_id="'+userId+'">'; 231 239 userDetails += '<img class="submitWait" src="themes/default/images/ajax-loader-small.gif" style="display:none">' … … 247 255 } 248 256 257 /* change password */ 258 jQuery(document).on('click', '.changePasswordOpen', function() { 259 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 260 261 jQuery(this).hide(); 262 jQuery('#user'+userId+' .changePasswordDone').hide(); 263 jQuery('#user'+userId+' .changePassword').show(); 264 jQuery('#user'+userId+' .changePassword input[type=text]').focus(); 265 266 return false; 267 }); 268 269 jQuery(document).on('click', '.changePassword a.updatePassword', function() { 270 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 271 272 jQuery('#user'+userId+' .changePassword a .text').hide(); 273 jQuery('#user'+userId+' .changePassword a img').show(); 274 275 jQuery.ajax({ 276 url: "ws.php?format=json&method=pwg.users.setInfo", 277 type:"POST", 278 data: { 279 user_id:userId, 280 password: jQuery('#user'+userId+' .changePassword input[type=text]').val() 281 }, 282 beforeSend: function() { 283 jQuery('#user'+userId+' .changePassword input[type=text]').val(""); 284 }, 285 success:function(data) { 286 jQuery('#user'+userId+' .changePassword a .text').show(); 287 jQuery('#user'+userId+' .changePassword a img').hide(); 288 jQuery('#user'+userId+' .changePassword').hide(); 289 jQuery('#user'+userId+' .changePasswordOpen').show(); 290 jQuery('#user'+userId+' .changePasswordDone').show(); 291 }, 292 error:function(XMLHttpRequest, textStatus, errorThrows) { 293 } 294 }); 295 296 return false; 297 }); 298 299 jQuery(document).on('click', '.changePassword a.cancel', function() { 300 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 301 302 jQuery('#user'+userId+' .changePassword').hide(); 303 jQuery('#user'+userId+' .changePasswordOpen').show(); 304 305 return false; 306 }); 307 308 /* change username */ 309 jQuery(document).on('click', '.changeUsernameOpen a', function() { 310 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 311 var username = jQuery('#user'+userId+' .username').html(); 312 313 jQuery('#user'+userId+' .changeUsernameOpen').hide(); 314 jQuery('#user'+userId+' .changeUsername').show(); 315 jQuery('#user'+userId+' .changeUsername input[type=text]').val(username).focus(); 316 317 return false; 318 }); 319 320 jQuery(document).on('click', 'a.updateUsername', function() { 321 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 322 323 jQuery('#user'+userId+' .changeUsername a .text').hide(); 324 jQuery('#user'+userId+' .changeUsername a img').show(); 325 326 jQuery.ajax({ 327 url: "ws.php?format=json&method=pwg.users.setInfo", 328 type:"POST", 329 data: { 330 user_id:userId, 331 username: jQuery('#user'+userId+' .changeUsername input[type=text]').val() 332 }, 333 success:function(data) { 334 jQuery('#user'+userId+' .changeUsername a .text').show(); 335 jQuery('#user'+userId+' .changeUsername a img').hide(); 336 jQuery('#user'+userId+' .changeUsername').hide(); 337 jQuery('#user'+userId+' .changeUsernameOpen').show(); 338 339 var data = jQuery.parseJSON(data); 340 jQuery('#user'+userId+' .username').html(data.result.users[0].username); 341 }, 342 error:function(XMLHttpRequest, textStatus, errorThrows) { 343 } 344 }); 345 346 return false; 347 }); 348 349 jQuery(document).on('click', '.changeUsername a.cancel', function() { 350 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 351 352 jQuery('#user'+userId+' .changeUsername').hide(); 353 jQuery('#user'+userId+' .changeUsernameOpen').show(); 354 355 return false; 356 }); 357 358 /* display the "save" button when a field changes */ 249 359 jQuery(document).on('change', '.userProperties input, .userProperties select', function() { 250 360 var userId = jQuery(this).parentsUntil('form').parent().find('input[name=user_id]').val(); 251 361 252 362 jQuery('#user'+userId+' input[type=submit]').show(); 253 jQuery('#user'+userId+' .infos').hide(); 254 }); 255 363 jQuery('#user'+userId+' .propertiesUpdateDone').hide(); 364 }); 365 366 /* delete user */ 256 367 jQuery(document).on('click', '.userDelete a', function() { 257 368 if (!confirm("{/literal}{'Are you sure?'|translate|escape:javascript}{literal}")) { … … 319 430 jQuery('#user'+userId+' .submitWait').hide(); 320 431 jQuery('#user'+userId+' input[type=submit]').hide(); 321 jQuery('#user'+userId+' . infos').show();432 jQuery('#user'+userId+' .propertiesUpdateDone').show(); 322 433 }, 323 434 error:function(XMLHttpRequest, textStatus, errorThrows) { … … 624 735 #applyActionBlock .actionButtons {margin-left:0;} 625 736 span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border-radius:5px;} 737 738 .userStats {margin-top:10px;} 626 739 </style> 627 740 {/literal}
Note: See TracChangeset
for help on using the changeset viewer.