Location: PHPKode > scripts > ezStats for PlayStation Network > ezStats2_psn/admin/templates/adduser.html
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
		(function($) {
			$.extend({
				add_user: function() {
					// Daten aus Inputfeldern extrahieren
					var elements = $('#adduser input:not(:radio), #adduser input:radio:checked, #adduser select');
					if (elements.length) {
						var input = {};
						for (var i = 0; i < elements.length; i++) {
							input[elements.eq(i).attr('name')] = elements.eq(i).val();
						}
					} else input = "";
					
					// AJAX starten
					$.ajax({
						type:     "POST",
						url:      "action.php",
						dataType: "json",
						data: {
							input: input,
							sid: "$sid",
							action: $('#adduser .button').attr("href")
						},
						error: function(data) {
							if (data && data.responseText)
								$('aside').text("").html(data.responseText).fadeIn();
						},
						success: function(data) {
							// Ergebnis ausgeben
							if (data && data.message) {
								$('aside').stop(true, true).hide().text(data.message).fadeIn().delay(2000).fadeOut();
							}
							
							// Fokus setzen und Textfelder leeren
							if (data && data.success) {
								$('#username').val("").focus();
								$('#password').val("");
							} else {
								$('#username').focus();
							}
							
							// Spieleruebersicht aktualisieren, falls Funktion geladen wurde
							$.load_user();
						}
					});
				}
			});
		})(jQuery);
		
		$('#adduser .button').click(function(e) {
			e.preventDefault();
			$.add_user();
		});
	});
</script>


<section id="adduser">
	<h2>%add_user%</h2>
	<table class="noborder">
		<thead>
			<tr class="tleft">
				<th>%username%</th>
				<th>%password%</th>
				<th>%user_rights%</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td><input type="text" name="username" id="username" size="" value="" /></td>
				<td><input type="text" name="password" id="password" size="" value="" /></td>
				<td>
					<select name="adminpower" id="adminpower">
						<option value="1">%user_full_rights%</option>
						<option value="0">%user_manage_player_only%</option>
					</select>
				</td>
			</tr>
		</tbody>
	</table>
	<br/>
	<div class="tright"><a href="add_user" class="button">%add_user%</a></div>
</section>
Return current item: ezStats for PlayStation Network