* new account.login view for tibiacom template

* added new indicator icons for create account, create character and change character name
* attempt to fix incorrect views counter behavior (its resetting to 0 in some cases)
* moved check_* functions to class Validator
* from now all validators ajax requests will fire onblur instead of onkeyup
* ajax requests returns now json instead of xml
* added 404 response when file is not found
* fixed gallery
This commit is contained in:
slawkens
2017-10-16 16:49:35 +02:00
parent dd572b00d0
commit 4daaa67710
263 changed files with 886 additions and 539 deletions

View File

@@ -34,9 +34,11 @@ To change a name of character select player and choose a new name.<br/>
<tr>
<td class="LabelV" ><span>New Name:</span></td>
<td>
<input type="text" name="name" id="name" onkeyup="checkName();" size="25" maxlength="25" >
<input type="text" name="name" id="character_name" size="25" maxlength="25" >
<img id="character_indicator" src="images/global/general/{% if not save or errors|length > 0 %}n{% endif %}ok.gif" />
<br/>
<font size="1" face="verdana,arial,helvetica">
<div id="name_check">Please enter your character name.</div>
<div id="character_error">Please enter your character name.</div>
</font>
</td>
</tr>

View File

@@ -26,25 +26,21 @@ Also you have to agree to the terms presented below. If you have done so, your a
<span{% if errors.account[0] is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
</td>
<td>
<input type="text" name="account" id="account_input" onkeyup="checkAccount();" size="30" maxlength="{% if constant('USE_ACCOUNT_NAME') %}30{% else %}10{% endif %}" value="{{ account }}" autofocus/>
<small id="acc_check"></small>
<input type="text" name="account" id="account_input" size="30" maxlength="{% if constant('USE_ACCOUNT_NAME') %}30{% else %}10{% endif %}" value="{{ account }}" autofocus/>
<img id="account_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" />
</td>
</tr>
{% if errors.account is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.account }}</span></td></tr>
{% endif %}
<tr><td></td><td><span id="account_error" class="FormFieldError">{% if errors.account is defined %}{{ errors.account }}{% endif %}</span></td></tr>
<tr>
<td class="LabelV" >
<span{% if errors.email[0] is defined %} class="red"{% endif %}>Email Address:</span>
</td>
<td style="width:100%;" >
<input type="text" name="email" id="email" onkeyup="checkEmail();" size="30" maxlength="50" value="{{ email }}" />
<small id="email_check"></small>
<input type="text" name="email" id="email" size="30" maxlength="50" value="{{ email }}" />
<img id="email_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" />
</td>
</tr>
{% if errors.email is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.email }}</span></td></tr>
{% endif %}
<tr><td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td></tr>
{% if config.account_country %}
<tr>
<td class="LabelV" >
@@ -57,27 +53,6 @@ Also you have to agree to the terms presented below. If you have done so, your a
{% endfor %}
</select>
<img src="" id="account_country_img"/>
<script>
function updateFlag()
{
var img = $('#account_country_img');
var country = $('#account_country :selected').val();
if(country.length) {
img.attr('src', 'images/flags/' + country + '.gif');
img.show();
}
else {
img.hide();
}
}
$(function() {
updateFlag();
$('#account_country').change(function() {
updateFlag();
});
});
</script>
</td>
</tr>
{% if errors.country is defined %}
@@ -89,23 +64,21 @@ Also you have to agree to the terms presented below. If you have done so, your a
<span{% if errors.password[0] is defined %} class="red"{% endif %}>Password:</span>
</td>
<td>
<input type="password" name="password" value="" size="30" maxlength="50" />
<input type="password" name="password" id="password" value="" size="30" maxlength="50" />
<img id="password_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" />
</td>
</tr>
{% if errors.password is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.password }}</span></td></tr>
{% endif %}
<tr><td></td><td><span id="password_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
<tr>
<td class="LabelV" >
<span{% if errors.password[0] is defined %} class="red"{% endif %}>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" value="" size="30" maxlength="50" />
<input type="password" name="password2" id="password2" value="" size="30" maxlength="50" />
<img id="password2_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" />
</td>
</tr>
{% if errors.password is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.password }}</span></td></tr>
{% endif %}
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
{% if config.recaptcha_enabled %}
<tr>
<td class="LabelV" >

View File

@@ -1,28 +1,60 @@
<script type="text/javascript">
eventId = 0;
lastSend = 0;
var eventId = 0;
var lastSend = 0;
$(function() {
$('#createaccount').submit(function () {
return validate_form(this);
});
updateFlag();
$('#account_country').change(function() {
updateFlag();
});
$('#account_input').blur(function() {
checkAccount();
});
$('#email').blur(function() {
checkEmail();
});
$('#password').blur(function() {
checkPassword();
});
$('#password2').blur(function() {
checkPassword();
});
});
function updateFlag()
{
var img = $('#account_country_img');
var country = $('#account_country :selected').val();
if(country.length) {
img.attr('src', 'images/flags/' + country + '.gif');
img.show();
}
else {
img.hide();
}
}
function checkAccount()
{
if(eventId != 0)
{
clearInterval(eventId);
clearInterval(eventId)
eventId = 0;
}
if(document.getElementById("account_input").value == "")
{
document.getElementById("acc_check").innerHTML = '<b><font color="red">Please enter account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}.</font></b>';
$('#account_error').html('Please enter account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}.');
$('#account_indicator').attr('src', 'images/global/general/nok.gif');
return;
}
// anti flood
//anti flood
var date = new Date;
var timeNow = parseInt(date.getTime());
@@ -30,17 +62,26 @@
{
if(timeNow - lastSend < 1100)
{
eventId = setInterval('checkAccount()', 1100);
eventId = setInterval('checkAccount()', 1100)
return;
}
}
var account = document.getElementById("account_input").value;
$.get("tools/validate.php", { account: account, uid: Math.random() },
$.getJSON("tools/validate.php", { account: account, uid: Math.random() },
function(data){
document.getElementById("acc_check").innerHTML = data;
lastSend = timeNow;
});
if(data.hasOwnProperty('success')) {
$('#account_error').html ('');
$('#account_indicator').attr('src', 'images/global/general/ok.gif');
}
else if(data.hasOwnProperty('error')) {
$('#account_error').html(data.error);
$('#account_indicator').attr('src', 'images/global/general/nok.gif');
}
}
);
lastSend = timeNow;
}
function checkEmail()
@@ -53,13 +94,14 @@
if(document.getElementById("email").value == "")
{
document.getElementById("email_check").innerHTML = '<b><font color="red">Please enter e-mail.</font></b>';
$('#email_error').html('Please enter e-mail.');
$('#email_indicator').attr('src', 'images/global/general/nok.gif');
return;
}
//anti flood
var date = new Date;
vartimeNow = parseInt(date.getTime());
var timeNow = parseInt(date.getTime());
if(lastSend != 0)
{
@@ -71,11 +113,77 @@
}
var email = document.getElementById("email").value;
$.get("tools/validate.php", { email: email, uid: Math.random() },
$.getJSON("tools/validate.php", { email: email, uid: Math.random() },
function(data){
document.getElementById("email_check").innerHTML = data;
lastSend = timeNow;
});
if(data.hasOwnProperty('success')) {
$('#email_error').html ('');
$('#email_indicator').attr('src', 'images/global/general/ok.gif');
}
else if(data.hasOwnProperty('error')) {
$('#email_error').html(data.error);
$('#email_indicator').attr('src', 'images/global/general/nok.gif');
}
}
);
lastSend = timeNow;
}
function checkPassword()
{
if(eventId != 0)
{
clearInterval(eventId)
eventId = 0;
}
if(document.getElementById("password").value == "")
{
$('#password_error').html('Please enter the password for your new account.');
$('#password_indicator').attr('src', 'images/global/general/nok.gif');
return;
}
if(document.getElementById("password2").value == "")
{
$('#password2_error').html('Please enter the password again!');
$('#password2_indicator').attr('src', 'images/global/general/nok.gif');
return;
}
//anti flood
var date = new Date;
var timeNow = parseInt(date.getTime());
if(lastSend != 0)
{
if(timeNow - lastSend < 1100)
{
eventId = setInterval('checkPassword()', 1100)
return;
}
}
var password = document.getElementById("password").value;
var password2 = document.getElementById("password2").value;
$.getJSON("tools/validate.php", { password: password, password2: password2, uid: Math.random() },
function(data){
if(data.hasOwnProperty('success')) {
$('#password_error').html ('');
$('#password2_error').html ('');
$('#password_indicator').attr('src', 'images/global/general/ok.gif');
$('#password2_indicator').attr('src', 'images/global/general/ok.gif');
}
else if(data.hasOwnProperty('error')) {
$('#password_error').html(data.error);
$('#password2_error').html(data.error);
$('#password_indicator').attr('src', 'images/global/general/nok.gif');
$('#password2_indicator').attr('src', 'images/global/general/nok.gif');
}
}
);
lastSend = timeNow;
}
function validate_required(field,alerttxt)

View File

@@ -7,7 +7,7 @@ In any case the name must not violate the naming conventions stated in the <a hr
{% endif %}
<br/><br/>
<form action="{{ getLink('account/character/create') }}" method="post">
<input type="hidden" name=savecharacter value="1">
<input type="hidden" name="save" value="1">
<div class="TableContainer">
<table class="Table3" cellpadding="0" cellspacing="0">
<div class="CaptionContainer">
@@ -45,9 +45,11 @@ In any case the name must not violate the naming conventions stated in the <a hr
</tr>
<tr class="Odd">
<td>
<input id="name" name="name" onkeyup="checkName();" value=" {{ name }}" size="25" maxlength="25" ><br/>
<input name="name" id="character_name" value="{{ name }}" size="25" maxlength="25" >
<img id="character_indicator" src="images/global/general/{% if not save or errors.name is defined %}n{% endif %}ok.gif" />
<br/>
<font size="1" face="verdana,arial,helvetica">
<div id="name_check">Please enter your character name.</div>
<div id="character_error">{% if not save or errors.name is defined %}Please enter your character name.{% endif %}</div>
</font>
</td>
<td>

View File

@@ -1,9 +1,9 @@
<div style="position: relative; height: 15px; width: 100%;">
{% if next is not null %}
<a style="float: right;" href="?subtopic=gallery&image={{ next }}" >next <img src="images/arrow_right.gif" width=15 height=11 border=0 ></a>
<a style="float: right;" href="{{ getLink('gallery') ~ '/' ~ next }}" >next <img src="images/arrow_right.gif" width=15 height=11 border=0 ></a>
{% endif %}
{% if previous is not null %}
<a style="position: absolute;" href="?subtopic=gallery&image={{ previous }}"><img src="images/arrow_left.gif" width=15 height=11 border=0 > previous</a>
<a style="position: absolute;" href="{{ getLink('gallery') ~ '/' ~ previous }}"><img src="images/arrow_left.gif" width=15 height=11 border=0 > previous</a>
{% endif %}
<div style="position: absolute; width: 80%; margin-left: 10%; margin-right: 10%; text-align: center;">
<a href="{{ getLink('gallery') }}" ><img src="images/arrow_up.gif" width=11 height=15 border=0 > back</a>

View File

@@ -1,33 +1,33 @@
Click on the image to enlarge.<br/><br/>
{% set i = 0 %}
{% for item in gallery %}
{% for image in images %}
{% set i = i + 1 %}
<table>
<tr>
<td style="height: 120px;" >
<a href="?subtopic=gallery&image={{ item.id }}" >
<img src="{{ item.thumb }}" border="0" />
<a href="{{ getLink('gallery') ~ '/' ~ image.id }}" >
<img src="{{ image.thumb }}" border="0" />
</a>
</td>
<td>{{ item.comment }}</td>
<td>{{ image.comment }}</td>
{% if canEdit %}
<td>
<a href="?subtopic=gallery&action=edit&id={{ item.id }}" title="Edit">
<a href="?subtopic=gallery&action=edit&id={{ image.id }}" title="Edit">
<img src="images/edit.png"/>Edit
</a>
<a id="delete" href="?subtopic=gallery&action=delete&id={{ item.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<a id="delete" href="?subtopic=gallery&action=delete&id={{ image.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete
</a>
<a href="?subtopic=gallery&action=hide&id={{ item.id }}" title="{% if item.hidden != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if item.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if item.hidden != 1 %}Hide{% else %}Show{% endif %}
<a href="?subtopic=gallery&action=hide&id={{ image.id }}" title="{% if image.hidden != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if image.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if image.hidden != 1 %}Hide{% else %}Show{% endif %}
</a>
{% if i != 1 %}
<a href="?subtopic=gallery&action=moveup&id={{ item.id }}" title="Move up">
<a href="?subtopic=gallery&action=moveup&id={{ image.id }}" title="Move up">
<img src="images/icons/arrow_up.gif"/>Move up
</a>
{% endif %}
{% if i != last %}
<a href="?subtopic=gallery&action=movedown&id={{ item.id }}" title="Move down">
<a href="?subtopic=gallery&action=movedown&id={{ image.id }}" title="Move down">
<img src="images/icons/arrow_down.gif"/>Move down
</a>
{% endif %}