* all JavaScript strings are marked with intl.translate()
This commit is contained in:
Jan Dittberner 2007-12-02 19:50:29 +00:00
parent 350df282d9
commit 5a707eda4d
4 changed files with 34 additions and 44 deletions

View file

@ -309,7 +309,8 @@ DAV.ACDB.prototype.search = function (searchString) {
}
},
error: function (xmlhttp) {
alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ db.uri);
alert(intl.translate("A HTTP error %s occured.\n%s",
[xmlhttp.status, db.uri]));
}
});
}, this.delay);

View file

@ -25,18 +25,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
function handleerror(xmldata) {
if ($('error', xmldata).size()) {
var msg = intl.translate('An error occured:\n');
$('error', xmldata).find('errormsg').each(function(i) {
msg += $(this).text();
});
alert(msg);
return true;
}
return false;
$('#content').show();
}
function updateDirectories(xmldata) {
var dirname = $('dirname', xmldata).text();
@ -74,7 +62,7 @@ function updateDirectories(xmldata) {
}
function getDirectoryForm(title, dirname, groups) {
return '<form action="#" id="dirform"><fieldset class="dynaform"><legend><img id="closer" src="images/x.png" width="16" height="16" alt="Schließen" /> ' + title + '</legend><div class="formelement"><label for="dirname">Verzeichnisname:</label><input type="text" name="dirname" id="input-dirname" value="' + dirname + '" /></div><div class="formelement"><label for="groups">Gruppen:</label><input type="text" name="groups" class="form-autocomplete" id="input-groups" value="' + groups + '" /><input type="hidden" class="autocomplete" id="input-groups-autocomplete" value="getgroups.php" /></div><div class="formactions"><input type="submit" name="submit" value="Absenden" /></div></div></fieldset></form>';
return '<form action="#" id="dirform"><fieldset class="dynaform"><legend><img id="closer" src="images/x.png" width="16" height="16" alt="' + intl.translate("close") + '" /> ' + title + '</legend><div class="formelement"><label for="dirname">' + intl.translate("Directory name:") + '</label><input type="text" name="dirname" id="input-dirname" value="' + dirname + '" /></div><div class="formelement"><label for="groups">' + intl.translate("Groups:") + '</label><input type="text" name="groups" class="form-autocomplete" id="input-groups" value="' + groups + '" /><input type="hidden" class="autocomplete" id="input-groups-autocomplete" value="getgroups.php" /></div><div class="formactions"><input type="submit" name="submit" value="' + intl.translate("Submit") + '" /></div></div></fieldset></form>';
}
function displaydirectoryeditor(title, dirname, groups) {
@ -89,7 +77,7 @@ function displaydirectoryeditor(title, dirname, groups) {
});
$('#dirform').submit(function() {
if (!this.dirname.value.match(/^[a-zA-Z0-9 -_.]+$/)) {
alert("Ungültiger Verzeichnisname.");
alert(intl.translate("Invalid directory name."));
this.dirname.focus();
return false;
}
@ -119,20 +107,20 @@ function editdirectory(dirname) {
var dirname, groups;
dirname = $("dirname:first", retval).text();
groups = $("groups:first", retval).text();
displaydirectoryeditor("Verzeichnisdaten bearbeiten",
displaydirectoryeditor(intl.translate("Edit directory data"),
dirname, groups);
}
});
}
function newdirectory() {
displaydirectoryeditor('Neues Verzeichnis anlegen', '', '');
displaydirectoryeditor(intl.translate("Create new directory"), '', '');
}
function deletedirectorydialog(dirname) {
$("#direditor").hide().empty();
var msg = 'Soll das Verzeichnis ' + dirname +
' wirklich gelöscht werden?';
var msg = intl.translate("Should the directory %s really get deleted?",
[dirname]);
if (confirm(msg) == true) {
$.post(
"directories.php",

View file

@ -49,3 +49,16 @@ DAV.encodeURIComponent = function (item, uri) {
item = encodeURIComponent(item).replace('%2F', '/');
return uri.indexOf('?q=') ? item : item.replace('%26', '%2526').replace('%23', '%2523');
};
function handleerror(xmldata) {
if ($('error', xmldata).size()) {
var msg = intl.translate("An error occured:\n");
$('error', xmldata).find('errormsg').each(function(i) {
msg += $(this).text();
});
alert(msg);
return true;
}
return false;
$('#content').show();
}

View file

@ -25,18 +25,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
function handleerror(xmldata) {
if ($('error', xmldata).size()) {
var msg = 'Es ist ein Fehler aufgetreten:\n';
$('error', xmldata).find('errormsg').each(function(i) {
msg += $(this).text();
});
alert(msg);
$('#content').show();
return true;
}
return false;
}
function updateusers(xmldata) {
var uid = $(xmldata).find('uid').text();
@ -44,9 +32,9 @@ function updateusers(xmldata) {
var firstname = $(xmldata).find('firstname').text();
var lastname = $(xmldata).find('lastname').text();
var loggedin = $(xmldata).find('loggedin').text();
var htmltext = '<td>' + username + '</td><td>' + lastname + ', ' + firstname + '</td><td><a id="edit' + uid + '" class="editlink" href="#" title="Die Daten dieses Nutzers bearbeiten"><img class="actionicon" src="images/edit.png" width="16" height="16" alt="bearbeiten"/></a>';
var htmltext = '<td>' + username + '</td><td>' + lastname + ', ' + firstname + '</td><td><a id="edit' + uid + '" class="editlink" href="#" title="' + intl.translate("Edit this user's data.") + '"><img class="actionicon" src="images/edit.png" width="16" height="16" alt="' + intl.translate("edit") + '"/></a>';
if (loggedin == '0') {
htmltext = htmltext + '<a id="delete' + uid + '" class="deletelink" href="#" title="Die Daten dieses Nutzers löschen"><img class="actionicon" src="images/delete.png" width="16" height="16" alt="löschen" /></a>';
htmltext = htmltext + '<a id="delete' + uid + '" class="deletelink" href="#" title="' + intl.translate("Delete this user's data.") + '"><img class="actionicon" src="images/delete.png" width="16" height="16" alt="' + intl.translate("delete") + '" /></a>';
}
htmltext = htmltext + '</td>';
$('#usertable').find('tr#uid' + uid).empty().append(htmltext);
@ -76,11 +64,11 @@ function updateusers(xmldata) {
function getEditUserForm(title, username, firstname, lastname, groups, userid) {
var retval;
retval = '<form action="#" id="userform"><fieldset class="dynaform"><legend><img id="closer" src="images/x.png" width="16" height="16" alt="Schließen" /> ' + title + '</legend><div class="formelement"><label for="input-username">Nutzername:</label><input id="input-username" type="text" name="username" value="' + username + '" ';
retval = '<form action="#" id="userform"><fieldset class="dynaform"><legend><img id="closer" src="images/x.png" width="16" height="16" alt="' + intl.translate("close") + '" /> ' + title + '</legend><div class="formelement"><label for="input-username">' + intl.translate("User name:") + '</label><input id="input-username" type="text" name="username" value="' + username + '" ';
if (userid != null) {
retval = retval + ' readonly="readonly"';
}
retval = retval + '/></div><div class="formelement"><label for="input-firstname">Vorname:</label><input id="input-firstname" type="text" name="firstname" value="' + firstname + '" /></div><div class="formelement"><label for="input-lastname">Nachname:</label><input id="input-lastname" type="text" name="lastname" value="' + lastname + '" /></div><div class="formelement"><label for="pwd1">Passwort:</label><input type="password" name="pwd1" /></div><div class="formelement"><label for="pwd2">Wiederholung:</label><input type="password" name="pwd2" /></div><div class="formelement"><label for="groups">Gruppen:</label><input type="text" name="groups" class="form-autocomplete" id="input-groups" value="' + groups + '" /><input type="hidden" class="autocomplete" id="input-groups-autocomplete" value="getgroups.php" /></div><div class="formactions"><input type="submit" name="submit" value="Absenden" /></div></fieldset></form>';
retval = retval + '/></div><div class="formelement"><label for="input-firstname">' + intl.translate("First name:") + '</label><input id="input-firstname" type="text" name="firstname" value="' + firstname + '" /></div><div class="formelement"><label for="input-lastname">' + intl.translate("Last name:") + '</label><input id="input-lastname" type="text" name="lastname" value="' + lastname + '" /></div><div class="formelement"><label for="pwd1">' + intl.translate("Password:") + '</label><input type="password" name="pwd1" /></div><div class="formelement"><label for="pwd2">' + intl.translate("Confirmation:") + '</label><input type="password" name="pwd2" /></div><div class="formelement"><label for="groups">' + intl.translate("Groups:") + '</label><input type="text" name="groups" class="form-autocomplete" id="input-groups" value="' + groups + '" /><input type="hidden" class="autocomplete" id="input-groups-autocomplete" value="getgroups.php" /></div><div class="formactions"><input type="submit" name="submit" value="' + intl.translate("Submit") + '" /></div></fieldset></form>';
return retval;
}
@ -97,25 +85,25 @@ function displayusereditor(title, userid, username, firstname, lastname, groups)
var params;
if (userid == null) {
if (!this.username.value.match(/^[a-zA-Z0-9]{2,}$/)) {
alert('Der Nutzername muss aus mindestens 2 Buchstaben oder Ziffern bestehen und darf keine sonstigen Zeichen enthalten.');
alert(intl.translate("The user name must consist of at least 2 letters or digits and no other characters!"));
this.username.focus();
return false;
}
}
if (userid == null || this.pwd1.value.length > 0) {
if (this.pwd1.value.length < 8) {
alert('Das Passwort muss mindestens 8 Zeichen lang sein!');
alert(intl.translate("The password must have a lenght of at least 8 characters!"));
this.pwd1.focus();
return false;
}
if (this.pwd1.value != this.pwd2.value) {
alert('Passwort und Wiederholung müssen übereinstimmen!');
alert(intl.translate("Password and confirmation have to match!"));
this.pwd2.focus();
return false;
}
}
if (!this.groups.value.match(/^([0-9a-zA-z]+[,\s]*)+$/)) {
alert('Die Gruppenangabe muss eine durch Kommata getrennte Liste von Gruppennamen, die aus Buchstaben und Ziffern zusammengesetzt sein können, sein.');
alert(intl.translate("The groups field has to be a comma separated list of group names which must consist of letters or digits!"));
this.groups.focus();
return false;
}
@ -149,8 +137,7 @@ function displayusereditor(title, userid, username, firstname, lastname, groups)
function deleteuserdialog(userid, username, firstname, lastname) {
$("#usereditor").hide().empty();
var msg = 'Soll der Nutzer ' + firstname + ' ' + lastname +
' mit dem Login ' + username + ' wirklich gelöscht werden?';
var msg = intl.translate("Should the user %s %s with the user name %s really get deleted?", [firstname, lastname, username]);
if (confirm(msg) == true) {
$.post(
"users.php",
@ -193,14 +180,15 @@ function edituser(userid) {
lastname = $("lastname:first", retval).text();
firstname = $("firstname:first", retval).text();
groups = $("groups:first", retval).text();
displayusereditor('Nutzerdaten bearbeiten', userid, username,
firstname, lastname, groups);
displayusereditor(intl.translate("Edit user data"),
userid, username, firstname, lastname,
groups);
}
});
}
function newuser() {
displayusereditor('Neuen Nutzer anlegen', null, '', '', '', '');
displayusereditor(intl.translate("Create new user"), null, '', '', '', '');
}
$(function() {