# HG changeset patch
# User Dan
# Date 1198122940 18000
# Node ID ab66d6d1f1f4994b607658cd6605f5ce1e5a7bfc
# Parent 474f8be559435acbde533646cef5fab189ad541e# Parent e17cc42d77cf55fb2a9a08f97c11e48318cc2a36
Redid merge, the previous one had a few problems
diff -r e17cc42d77cf -r ab66d6d1f1f4 ajax.php
--- a/ajax.php Wed Dec 19 17:15:48 2007 -0500
+++ b/ajax.php Wed Dec 19 22:55:40 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0.3 (Dyrad)
+ * Version 1.1.1
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r e17cc42d77cf -r ab66d6d1f1f4 includes/clientside/static/acl.js
--- a/includes/clientside/static/acl.js Wed Dec 19 17:15:48 2007 -0500
+++ b/includes/clientside/static/acl.js Wed Dec 19 22:55:40 2007 -0500
@@ -27,17 +27,6 @@
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
if(ajax.readyState == 4)
{
- var response = String(ajax.responseText + '');
- if ( response.substr(0, 1) != '{' )
- {
- handle_invalid_json(ajax.responseText);
- return false;
- }
- try {
- data = parseJSON(ajax.responseText);
- } catch(e) {
- handle_invalid_json(ajax.responseText);
- }
__aclBuildWizardWindow();
groups = parseJSON(ajax.responseText);
if ( groups.mode == 'error' )
@@ -70,7 +59,7 @@
{
document.getElementById(aclManagerID+'_main').innerHTML = '';
document.getElementById(aclManagerID + '_back').style.display = 'none';
- document.getElementById(aclManagerID + '_next').value = 'Next >';
+ document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
groups = parseJSON(ajax.responseText);
if ( groups.mode == 'error' )
{
@@ -115,13 +104,13 @@
grpb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'block'; document.getElementById('enACL_usrbox_'+seed).style.display = 'none'; };
lbl = document.createElement('label');
lbl.appendChild(grpb);
- lbl.appendChild(document.createTextNode('A usergroup'));
+ lbl.appendChild(document.createTextNode($lang.get('acl_radio_usergroup')));
lbl.style.display = 'block';
span.appendChild(grpsel);
anoninfo = document.createElement('div');
anoninfo.className = 'info-box-mini';
- anoninfo.appendChild(document.createTextNode('To edit permissions for guests, select "a specific user", and enter Anonymous as the username.'));
+ anoninfo.appendChild(document.createTextNode($lang.get('acl_msg_guest_howto')));
span.appendChild(document.createElement('br'));
span.appendChild(anoninfo);
@@ -133,7 +122,7 @@
usrb.onclick = function() { seed = this.className; document.getElementById('enACL_grpbox_'+seed).style.display = 'none'; document.getElementById('enACL_usrbox_'+seed).style.display = 'block'; };
lbl2 = document.createElement('label');
lbl2.appendChild(usrb);
- lbl2.appendChild(document.createTextNode('A specific user'));
+ lbl2.appendChild(document.createTextNode($lang.get('acl_radio_user')));
lbl2.style.display = 'block';
usrsel = document.createElement('input');
@@ -178,21 +167,21 @@
lblPage = document.createElement('label');
lblPage.style.display = 'block';
lblPage.appendChild(scopeRadioPage);
- lblPage.appendChild(document.createTextNode('Only this page'));
+ lblPage.appendChild(document.createTextNode($lang.get('acl_radio_scope_thispage')));
lblGlobal = document.createElement('label');
lblGlobal.style.display = 'block';
lblGlobal.appendChild(scopeRadioGlobal);
- lblGlobal.appendChild(document.createTextNode('The entire website'));
+ lblGlobal.appendChild(document.createTextNode($lang.get('acl_radio_scope_wholesite')));
lblGroup = document.createElement('label');
lblGroup.style.display = 'block';
lblGroup.appendChild(scopeRadioGroup);
- lblGroup.appendChild(document.createTextNode('A group of pages'));
+ lblGroup.appendChild(document.createTextNode($lang.get('acl_radio_scope_pagegroup')));
scopediv1.appendChild(lblPage);
scopediv2.appendChild(lblGroup);
scopediv3.appendChild(lblGlobal);
scopedesc = document.createElement('p');
- scopedesc.appendChild(document.createTextNode('What should this access rule control?'));
+ scopedesc.appendChild(document.createTextNode($lang.get('acl_lbl_scope')));
scopePGrp = document.createElement('select');
scopePGrp.style.marginLeft = '13px';
@@ -230,10 +219,10 @@
container.style.paddingTop = '50px';
head = document.createElement('h2');
- head.appendChild(document.createTextNode('Manage page access'));
+ head.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_title')));
desc = document.createElement('p');
- desc.appendChild(document.createTextNode('Please select who should be affected by this access rule.'));
+ desc.appendChild(document.createTextNode($lang.get('acl_lbl_welcome_body')));
container.appendChild(head);
container.appendChild(desc);
@@ -318,16 +307,10 @@
ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
if(ajax.readyState == 4)
{
- var response = String(ajax.responseText + '');
- if ( response.substr(0, 1) != '{' )
- {
- handle_invalid_json(ajax.responseText);
- return false;
- }
try {
data = parseJSON(ajax.responseText);
} catch(e) {
- handle_invalid_json(ajax.responseText);
+ aclDebug(e+"\n\nResponse:\n"+ajax.responseText);
}
aclDataCache = data;
switch(data.mode)
@@ -336,11 +319,14 @@
// Build the ACL edit form
// try {
- act_desc = ( data.type == 'new' ) ? 'Create access rule' : 'Editing permissions';
- target_type_t = ( data.target_type == 1 ) ? 'group' : 'user';
- target_name_t = data.target_name;
- var scope_type = ( data.page_id == false && data.namespace == false ) ? 'this entire site' : ( data.namespace == '__PageGroup' ) ? 'this group of pages' : 'this page';
- html = '
'+act_desc+' This panel allows you to edit what the '+target_type_t+' "'+target_name_t+' " can do on ' + scope_type + ' . Unless you set a permission to "Deny", these permissions may be overridden by other rules.
';
+
+ var act_desc = ( data.type == 'new' ) ? $lang.get('acl_lbl_editwin_title_create') : $lang.get('acl_lbl_editwin_title_edit');
+ var target_type_t = ( data.target_type == 1 ) ? $lang.get('acl_target_type_group') : $lang.get('acl_target_type_user');
+ var target_name_t = data.target_name;
+ var scope_type = ( data.page_id == false && data.namespace == false ) ? $lang.get('acl_scope_type_wholesite') : ( data.namespace == '__PageGroup' ) ? $lang.get('acl_scope_type_pagegroup') : $lang.get('acl_scope_type_thispage');
+
+ html = ''+act_desc+' ';
+ html += '' + $lang.get('acl_lbl_editwin_body', { target_type: target_type_t, target: target_name_t, scope_type: scope_type }) + '
';
parser = new templateParser(data.template.acl_field_begin);
html += parser.run();
@@ -352,7 +338,14 @@
cls = ( cls == 'row1' ) ? 'row2' : 'row1';
p = new templateParser(data.template.acl_field_item);
vars = new Object();
- vars['FIELD_DESC'] = data.acl_descs[i];
+ if ( data.acl_descs[i].match(/^([a-z0-9_]+)$/) )
+ {
+ vars['FIELD_DESC'] = $lang.get(data.acl_descs[i]);
+ }
+ else
+ {
+ vars['FIELD_DESC'] = data.acl_descs[i];
+ }
vars['FIELD_DENY_CHECKED'] = '';
vars['FIELD_DISALLOW_CHECKED'] = '';
vars['FIELD_WIKIMODE_CHECKED'] = '';
@@ -384,7 +377,7 @@
html += parser.run();
if(data.type == 'edit')
- html += 'Delete this rule
';
+ html += '' + $lang.get('acl_lbl_deleterule') + '
';
var main = document.getElementById(aclManagerID + '_main');
main.innerHTML = html;
@@ -400,7 +393,7 @@
aclPermList = array_keys(data.acl_types);
document.getElementById(aclManagerID + '_back').style.display = 'inline';
- document.getElementById(aclManagerID + '_next').value = 'Save Changes';
+ document.getElementById(aclManagerID + '_next').value = $lang.get('etc_save_changes');
// } catch(e) { alert(e); aclDebug(ajax.responseText); }
@@ -410,24 +403,24 @@
note.className = 'info-box';
note.style.marginLeft = '0';
var b = document.createElement('b');
- b.appendChild(document.createTextNode('Permissions updated'));
+ b.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_title')));
note.appendChild(b);
note.appendChild(document.createElement('br'));
- note.appendChild(document.createTextNode('The permissions for '+data.target_name+' on this page have been updated successfully. If you changed permissions that affect your user account, you may not see changes until you reload the page.'));
+ note.appendChild(document.createTextNode($lang.get('acl_lbl_save_success_body', { target_name: data.target_name })));
note.appendChild(document.createElement('br'));
var a = document.createElement('a');
a.href = 'javascript:void(0);';
a.onclick = function() { this.parentNode.parentNode.removeChild(this.parentNode); return false; };
- a.appendChild(document.createTextNode('[ dismiss :'));
+ a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
note.appendChild(a);
var a2 = document.createElement('a');
a2.href = 'javascript:void(0);';
a2.onclick = function() { killACLManager(); return false; };
- a2.appendChild(document.createTextNode(': close manager ]'));
+ a2.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
note.appendChild(a2);
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
if(!document.getElementById(aclManagerID+'_deletelnk'))
- document.getElementById(aclManagerID + '_main').innerHTML += 'Delete this rule
';
+ document.getElementById(aclManagerID + '_main').innerHTML += '' + $lang.get('acl_lbl_deleterule') + '
';
//fadeInfoBoxes();
document.getElementById(aclManagerID+'_main').scrollTop = 0;
@@ -445,7 +438,7 @@
{
document.getElementById(aclManagerID+'_main').innerHTML = '';
document.getElementById(aclManagerID + '_back').style.display = 'none';
- document.getElementById(aclManagerID + '_next').value = 'Next >';
+ document.getElementById(aclManagerID + '_next').value = $lang.get('etc_wizard_next');
var thispage = strToPageID(title);
groups.page_id = thispage[0];
groups.namespace = thispage[1];
@@ -458,20 +451,20 @@
note.style.width = '558px';
note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000);
b = document.createElement('b');
- b.appendChild(document.createTextNode('Entry deleted'));
+ b.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title')));
note.appendChild(b);
note.appendChild(document.createElement('br'));
- note.appendChild(document.createTextNode('The access rules for '+aclDataCache.target_name+' on this page have been deleted.'));
+ note.appendChild(document.createTextNode($lang.get('acl_lbl_delete_success_title', { target_name: aclDataCache.target_name })));
note.appendChild(document.createElement('br'));
a = document.createElement('a');
a.href = '#';
a.onclick = function() { opacity(this.parentNode.id, 100, 0, 1000); setTimeout('var div = document.getElementById("' + this.parentNode.id + '"); div.parentNode.removeChild(div);', 1100); return false; };
- a.appendChild(document.createTextNode('[ dismiss :'));
+ a.appendChild(document.createTextNode('[ ' + $lang.get('acl_btn_success_dismiss') + ' :'));
note.appendChild(a);
a = document.createElement('a');
a.href = '#';
a.onclick = function() { killACLManager(); return false; };
- a.appendChild(document.createTextNode(': close manager ]'));
+ a.appendChild(document.createTextNode(': ' + $lang.get('acl_btn_success_close') + ' ]'));
note.appendChild(a);
document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
//fadeInfoBoxes();
@@ -487,7 +480,7 @@
aclDebug(data.text);
break;
default:
- handle_invalid_json(ajax.responseText);
+ alert("Invalid JSON response from server\nMode: "+data.mode+"\nJSON string: "+ajax.responseText);
break;
}
}
@@ -559,7 +552,7 @@
back = document.createElement('input');
back.type = 'button';
- back.value = '< Back';
+ back.value = $lang.get('etc_wizard_back');
back.style.fontWeight = 'normal';
back.onclick = function() { ajaxACLSwitchToSelector(); return false; };
back.style.display = 'none';
@@ -567,14 +560,14 @@
saver = document.createElement('input');
saver.type = 'submit';
- saver.value = 'Next >';
+ saver.value = $lang.get('etc_wizard_next');
saver.style.fontWeight = 'bold';
saver.id = aclManagerID + '_next';
closer = document.createElement('input');
closer.type = 'button';
- closer.value = 'Cancel Changes';
- closer.onclick = function() { if(!confirm('Do you really want to close the ACL manager?')) return false; killACLManager(); return false; }
+ closer.value = $lang.get('etc_cancel_changes');
+ closer.onclick = function() { if(!confirm($lang.get('acl_msg_closeacl_confirm'))) return false; killACLManager(); return false; }
spacer1 = document.createTextNode(' ');
spacer2 = document.createTextNode(' ');
@@ -641,7 +634,7 @@
var target_type = parseInt(getRadioState(thefrm, 'target_type', ['1', '2']));
if(isNaN(target_type))
{
- alert('Please select a target type.');
+ alert($lang.get('acl_err_pleaseselect_targettype'));
return false;
}
target_id = ( target_type == 1 ) ? parseInt(thefrm.group_id.value) : thefrm.username.value;
@@ -683,7 +676,7 @@
}
if(target_id == '')
{
- alert('Please enter a username.');
+ alert($lang.get('acl_err_pleaseselect_username'));
return false;
}
__aclJSONSubmitAjaxHandler(obj);
diff -r e17cc42d77cf -r ab66d6d1f1f4 includes/clientside/static/ajax.js
--- a/includes/clientside/static/ajax.js Wed Dec 19 17:15:48 2007 -0500
+++ b/includes/clientside/static/ajax.js Wed Dec 19 22:55:40 2007 -0500
@@ -146,7 +146,7 @@
if(ajax.readyState == 4) {
unsetAjaxLoading();
if(edit_open) {
- c=confirm('Do you really want to revert your changes?');
+ c=confirm($lang.get('editor_msg_revert_confirm'));
if(!c) return;
}
edit_open = true;
@@ -157,18 +157,18 @@
// Allow the textarea grippifier to re-create the resizer control on the textarea
grippied_textareas.pop(in_array('ajaxEditArea', grippied_textareas));
}
- disableUnload('If you do, any changes that you have made to this page will be lost.');
+ disableUnload($lang.get('editor_msg_unload'));
var switcher = ( readCookie('enano_editor_mode') == 'tinymce' ) ?
- 'wikitext editor | graphical editor' :
- 'wikitext editor | graphical editor ' ;
+ '' + $lang.get('editor_btn_wikitext') + ' | ' + $lang.get('editor_btn_graphical') :
+ $lang.get('editor_btn_wikitext') + ' | ' + $lang.get('editor_btn_graphical') + ' ' ;
document.getElementById('ajaxEditContainer').innerHTML = '\
\
' + switcher + ' \
';
@@ -185,14 +185,14 @@
{
$('ajaxEditArea').switchToMCE();
createCookie('enano_editor_mode', 'tinymce', 365);
- $('switcher').object.innerHTML = 'wikitext editor | graphical editor';
+ $('switcher').object.innerHTML = '' + $lang.get('editor_btn_wikitext') + ' | ' + $lang.get('editor_btn_graphical');
}
function setEditorText()
{
$('ajaxEditArea').destroyMCE();
createCookie('enano_editor_mode', 'text', 365);
- $('switcher').object.innerHTML = 'wikitext editor | graphical editor ';
+ $('switcher').object.innerHTML = $lang.get('editor_btn_wikitext') + ' | ' + $lang.get('editor_btn_graphical') + ' ';
}
function ajaxViewSource()
@@ -204,11 +204,7 @@
ajaxGet(stdAjaxPrefix+'&_mode=getsource', function() {
if(ajax.readyState == 4) {
unsetAjaxLoading();
- if(edit_open) {
- c=confirm('Do you really want to revert your changes?');
- if(!c) return;
- }
- edit_open = true;
+ edit_open = false;
selectButtonMajor('article');
selectButtonMinor('edit');
if(in_array('ajaxEditArea', grippied_textareas))
@@ -219,7 +215,7 @@
document.getElementById('ajaxEditContainer').innerHTML = '\
\
'+ajax.responseText+' \
- close viewer \
+ ' + $lang.get('editor_btn_closeviewer') + ' \
';
initTextareas();
}
@@ -269,7 +265,7 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- c = confirm('Do you really want to discard your changes?');
+ c = confirm($lang.get('editor_msg_discard_confirm'));
if(!c) return;
ajaxReset();
}
@@ -279,6 +275,9 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
+ var ns_id = strToPageID(title);
+ if ( ns_id[1] == 'Special' || ns_id[1] == 'Admin' )
+ return false;
enableUnload();
setAjaxLoading();
ajaxGet(stdAjaxPrefix+'&_mode=getpage&noheaders', function() {
@@ -301,7 +300,7 @@
if(shift) {
r = 'NO_REASON';
} else {
- r = prompt('Reason for (un)protecting:');
+ r = prompt($lang.get('ajax_protect_prompt_reason'));
if(!r || r=='') return;
}
setAjaxLoading();
@@ -323,7 +322,7 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- r = prompt('What title should this page be renamed to?\nNote: This does not and will never change the URL of this page, that must be done from the admin panel.');
+ r = prompt($lang.get('ajax_rename_prompt'));
if(!r || r=='') return;
setAjaxLoading();
ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+ajaxEscape(r), function() {
@@ -353,12 +352,12 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- var reason = prompt('Please enter your reason for deleting this page.');
+ var reason = prompt($lang.get('ajax_delete_prompt_reason'));
if ( !reason || reason == '' )
{
return false;
}
- c = confirm('You are about to REVERSIBLY delete this page. Do you REALLY want to do this?\n\n(Comments and categorization data, as well as any attached files, will be permanently lost)');
+ c = confirm($lang.get('ajax_delete_confirm'));
if(!c)
{
return;
@@ -378,7 +377,7 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- c = confirm('Are you sure that you want to vote that this page be deleted?');
+ c = confirm($lang.get('ajax_delvote_confirm'));
if(!c) return;
setAjaxLoading();
ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() {
@@ -394,7 +393,7 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- c = confirm('This will reset the number of votes against this page to zero. Do you really want to do this?');
+ c = confirm($lang.get('ajax_delvote_reset_confirm'));
if(!c) return;
setAjaxLoading();
ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() {
@@ -532,9 +531,9 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- c = confirm('You are about to DESTROY all log entries for this page. As opposed to (example) deleting this page, this action is completely IRREVERSIBLE and should not be used except in dire circumstances. Do you REALLY want to do this?');
+ c = confirm($lang.get('ajax_clearlogs_confirm'));
if(!c) return;
- c = confirm('You\'re ABSOLUTELY sure???');
+ c = confirm($lang.get('ajax_clearlogs_confirm_nag'));
if(!c) return;
setAjaxLoading();
ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() {
@@ -638,13 +637,13 @@
if ( KILL_SWITCH )
return true;
var inner_html = '';
- inner_html += 'Theme: ';
+ inner_html += '' + $lang.get('ajax_changestyle_lbl_theme') + ' ';
inner_html += ' ';
- inner_html += ' [Select] ';
+ inner_html += ' ' + $lang.get('ajax_changestyle_select') + ' ';
inner_html += ENANO_THEME_LIST;
inner_html += ' ';
inner_html += '
';
- var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, 'Change your theme', inner_html);
+ var chtheme_mb = new messagebox(MB_OKCANCEL|MB_ICONQUESTION, $lang.get('ajax_changestyle_title'), inner_html);
chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete;
}
@@ -689,7 +688,7 @@
var p_parent = document.createElement('p');
var label = document.createElement('label');
p_parent.id = 'chtheme_sel_style_parent';
- label.appendChild(document.createTextNode('Style: '));
+ label.appendChild(document.createTextNode($lang.get('ajax_changestyle_lbl_style') + ' '));
var select = document.createElement('select');
select.id = 'chtheme_sel_style';
for ( var i in options )
@@ -718,7 +717,7 @@
var style = $('chtheme_sel_style');
if ( !theme.object || !style.object )
{
- alert('Please select a theme from the list.');
+ alert($lang.get('ajax_changestyle_pleaseselect_theme'));
return true;
}
var theme_id = theme.object.value;
@@ -742,7 +741,7 @@
{
if ( ajax.responseText == 'GOOD' )
{
- var c = confirm('Your theme preference has been changed.\nWould you like to reload the page now to see the changes?');
+ var c = confirm($lang.get('ajax_changestyle_success'));
if ( c )
window.location.reload();
}
@@ -951,7 +950,7 @@
// IE <6 pseudo-compatibility
if ( KILL_SWITCH )
return true;
- if ( !confirm('Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.') )
+ if ( !confirm($lang.get('ajax_killphp_confirm')) )
return false;
var $killdiv = $dynano('php_killer');
if ( !$killdiv.object )
@@ -972,7 +971,7 @@
var newdiv = document.createElement('div');
// newdiv.style = $killdiv.object.style;
newdiv.className = $killdiv.object.className;
- newdiv.innerHTML = ' Embedded PHP in pages has been disabled.';
+ newdiv.innerHTML = ' ' + $lang.get('ajax_killphp_success');
$killdiv.object.parentNode.appendChild(newdiv);
$killdiv.object.parentNode.removeChild($killdiv.object);
}
@@ -1009,14 +1008,14 @@
if ( !catbox )
return false;
var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
- linkbox.firstChild.nodeValue = 'show page categorization';
+ linkbox.firstChild.nodeValue = $lang.get('catedit_catbox_link_showcategorization');
linkbox.onclick = function() { ajaxTagToCat(); return false; };
catHTMLBuf = catbox.innerHTML;
catbox.innerHTML = '';
- catbox.appendChild(document.createTextNode('Page tags: '));
+ catbox.appendChild(document.createTextNode($lang.get('tags_lbl_page_tags')+' '));
if ( json.tags.length < 1 )
{
- catbox.appendChild(document.createTextNode('No tags on this page'));
+ catbox.appendChild(document.createTextNode($lang.get('tags_lbl_no_tags')));
}
for ( var i = 0; i < json.tags.length; i++ )
{
@@ -1040,7 +1039,7 @@
var addlink = document.createElement('a');
addlink.href = '#';
addlink.onclick = function() { try { ajaxAddTagStage1(); } catch(e) { }; return false; };
- addlink.appendChild(document.createTextNode('(add a tag)'));
+ addlink.appendChild(document.createTextNode($lang.get('tags_btn_add_tag')));
catbox.appendChild(addlink);
}
}
@@ -1059,7 +1058,7 @@
var addlink = document.createElement('a');
addlink.href = '#';
addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; };
- addlink.appendChild(document.createTextNode('+ Add'));
+ addlink.appendChild(document.createTextNode($lang.get('tags_btn_add')));
text.type = 'text';
text.size = '15';
text.onkeyup = function(e)
@@ -1071,7 +1070,7 @@
}
adddiv.style.margin = '5px 0 0 0';
- adddiv.appendChild(document.createTextNode('Add a tag: '));
+ adddiv.appendChild(document.createTextNode($lang.get('tags_lbl_add_tag')+' '));
adddiv.appendChild(text);
adddiv.appendChild(document.createTextNode(' '));
adddiv.appendChild(addlink);
@@ -1113,7 +1112,7 @@
var node = parent.childNodes[1];
var insertafter = false;
var nukeafter = false;
- if ( node.nodeValue == 'No tags on this page' )
+ if ( node.nodeValue == $lang.get('tags_lbl_no_tags') )
{
nukeafter = true;
}
@@ -1154,12 +1153,12 @@
var writeNoTags = false;
if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' )
arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling);
- else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' )
+ else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' )
arrDelete.push(parentobj.nextSibling);
- if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == 'Page tags: ' &&
+ if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' &&
parentobj.nextSibling.nextSibling.firstChild )
- if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == '(add a tag)')
+ if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag'))
writeNoTags = true;
ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function()
@@ -1177,7 +1176,7 @@
}
if ( writeNoTags )
{
- var node1 = document.createTextNode('No tags on this page');
+ var node1 = document.createTextNode($lang.get('tags_lbl_no_tags'));
var node2 = document.createTextNode(' ');
insertAfter(parent, node1, parent.firstChild);
insertAfter(parent, node2, node1);
@@ -1200,7 +1199,7 @@
return false;
addtag_open = false;
var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
- linkbox.firstChild.nodeValue = 'show page tags';
+ linkbox.firstChild.nodeValue = $lang.get('tags_catbox_link');
linkbox.onclick = function() { ajaxCatToTag(); return false; };
catbox.innerHTML = catHTMLBuf;
catHTMLBuf = false;
@@ -1223,7 +1222,7 @@
if ( keepalive_interval )
clearInterval(keepalive_interval);
var span = document.getElementById('keepalivestat');
- span.firstChild.nodeValue = 'Turn on keep-alive';
+ span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
}
else
{
@@ -1231,7 +1230,7 @@
if ( !keepalive_interval )
keepalive_interval = setInterval('ajaxPingServer();', 600000);
var span = document.getElementById('keepalivestat');
- span.firstChild.nodeValue = 'Turn off keep-alive';
+ span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
ajaxPingServer();
}
}
@@ -1243,19 +1242,50 @@
if ( !keepalive_interval )
keepalive_interval = setInterval('ajaxPingServer();', 600000);
var span = document.getElementById('keepalivestat');
- span.firstChild.nodeValue = 'Turn off keep-alive';
+ span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
}
else
{
if ( keepalive_interval )
clearInterval(keepalive_interval);
var span = document.getElementById('keepalivestat');
- span.firstChild.nodeValue = 'Turn on keep-alive';
+ span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
}
};
function aboutKeepAlive()
{
- new messagebox(MB_OK|MB_ICONINFORMATION, 'About the keep-alive feature', 'Keep-alive is a new Enano feature that keeps your administrative session from timing out while you are using the administration panel. This feature can be useful if you are editing a large page or doing something in the administration interface that will take longer than 15 minutes. For security reasons, Enano mandates that high-privilege logins last only 15 minutes, with the time being reset each time a page is loaded (or, more specifically, each time the session API is started). The consequence of this is that if you are performing an action in the administration panel that takes more than 15 minutes, your session may be terminated. The keep-alive feature attempts to relieve this by sending a "ping" to the server every 10 minutes. Please note that keep-alive state is determined by a cookie. Thus, if you log out and then back in as a different administrator, keep-alive will use the same setting that was used when you were logged in as the first administrative user. In the same way, if you log into the administration panel under your account from another computer, keep-alive will be set to "off".For more information: Overview of Enano'+"'"+'s security model');
+ new messagebox(MB_OK|MB_ICONINFORMATION, $lang.get('user_keepalive_info_title'), $lang.get('user_keepalive_info_body'));
}
+function ajaxShowCaptcha(code)
+{
+ var mydiv = document.createElement('div');
+ mydiv.style.backgroundColor = '#FFFFFF';
+ mydiv.style.padding = '10px';
+ mydiv.style.position = 'absolute';
+ mydiv.style.top = '0px';
+ mydiv.id = 'autoCaptcha';
+ mydiv.style.zIndex = String( getHighestZ() + 1 );
+ var img = document.createElement('img');
+ img.onload = function()
+ {
+ if ( this.loaded )
+ return true;
+ var mydiv = document.getElementById('autoCaptcha');
+ var width = getWidth();
+ var divw = $(mydiv).Width();
+ var left = ( width / 2 ) - ( divw / 2 );
+ mydiv.style.left = left + 'px';
+ fly_in_top(mydiv, false, true);
+ this.loaded = true;
+ };
+ img.src = makeUrlNS('Special', 'Captcha/' + code);
+ img.onclick = function() { this.src = this.src + '/a'; };
+ img.style.cursor = 'pointer';
+ mydiv.appendChild(img);
+ domObjChangeOpac(0, mydiv);
+ var body = document.getElementsByTagName('body')[0];
+ body.appendChild(mydiv);
+}
+
diff -r e17cc42d77cf -r ab66d6d1f1f4 includes/clientside/static/comments.js
--- a/includes/clientside/static/comments.js Wed Dec 19 17:15:48 2007 -0500
+++ b/includes/clientside/static/comments.js Wed Dec 19 22:55:40 2007 -0500
@@ -48,7 +48,7 @@
annihiliateComment(response.id);
break;
case 'materialize':
- alert('Your comment has been posted. If it does not appear right away, it is probably awaiting approval.');
+ alert($lang.get('comment_msg_comment_posted'));
hideCommentForm();
materializeComment(response);
break;
@@ -70,36 +70,43 @@
// Header
- html += 'Article Comments ';
+ html += '' + $lang.get('comment_heading') + ' ';
- var ns = ( strToPageID(title)[1]=='Article' ) ? 'article' : ( strToPageID(title)[1].toLowerCase() ) + ' page';
+ var ns = ENANO_PAGE_TYPE;
// Counters
if ( data.auth_mod_comments )
{
var cnt = ( data.auth_mod_comments ) ? data.count_total : data.count_appr;
- if ( cnt == 0 ) cnt = 'no';
- var s = ( cnt == 1 ) ? '' : 's';
- var is = ( cnt == 1 ) ? 'is' : 'are';
- html += "';
}
else
{
var cnt = data.count_appr;
- if ( cnt == 0 ) cnt = 'no';
- var s = ( cnt == 1 ) ? '' : 's';
- var is = ( cnt == 1 ) ? 'is' : 'are';
- html += "';
}
@@ -118,28 +125,28 @@
// Posting form
- html += 'Got something to say? ';
- html += 'If you have comments or suggestions on this article, you can shout it out here.';
+ html += '
' + $lang.get('comment_postform_title') + ' ';
+ html += '' + $lang.get('comment_postform_blurb');
if ( data.approval_needed )
- html+=' Before your post will be visible to the public, a moderator will have to approve it.';
- html += '
';
+ html+=' ' + $lang.get('comment_postform_blurb_unapp');
+ html += '
';
html += '';
@@ -171,7 +178,7 @@
tplvars.SIGNATURE = this_comment.signature;
if ( this_comment.approved != '1' )
- tplvars.SUBJECT += ' (Unapproved) ';
+ tplvars.SUBJECT += ' ' + $lang.get('comment_msg_note_unapp') + ' ';
// Name
tplvars.NAME = this_comment.name;
@@ -179,29 +186,29 @@
tplvars.NAME = '' + this_comment.name + ' ';
// User level
- tplvars.USER_LEVEL = 'Guest';
- if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = 'Member';
- if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = 'Moderator';
- if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = 'Administrator';
-
+ tplvars.USER_LEVEL = $lang.get('user_type_guest');
+ if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
+ if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
+ if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
+
// Send PM link
- tplvars.SEND_PM_LINK=(this_comment.user_id>1 && data.logged_in)?'Send private message ':'';
+ tplvars.SEND_PM_LINK=(this_comment.user_id>1)?'' + $lang.get('comment_btn_send_privmsg') + ' ':'';
// Add buddy link
- tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1 && data.logged_in && this_comment.is_buddy != 1)?'Add to buddy list ':'';
+ tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1)?'' + $lang.get('comment_btn_add_buddy') + ' ':'';
// Edit link
- tplvars.EDIT_LINK='edit ';
+ tplvars.EDIT_LINK='' + $lang.get('comment_btn_edit') + ' ';
// Delete link
- tplvars.DELETE_LINK='delete ';
+ tplvars.DELETE_LINK='' + $lang.get('comment_btn_delete') + ' ';
// Moderation: (Un)approve link
- var appr = ( this_comment.approved == 1 ) ? 'Unapprove' : 'Approve';
+ var appr = ( this_comment.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
tplvars.MOD_APPROVE_LINK='';
// Moderation: Delete post link
- tplvars.MOD_DELETE_LINK='Delete ';
+ tplvars.MOD_DELETE_LINK='' + $lang.get('comment_btn_mod_delete') + ' ';
var tplbool = new Object();
@@ -212,9 +219,9 @@
tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 );
if ( tplbool.is_friend )
- tplvars.USER_LEVEL += 'On your friend list ';
+ tplvars.USER_LEVEL += '' + $lang.get('comment_on_friend_list') + ' ';
else if ( tplbool.is_foe )
- tplvars.USER_LEVEL += 'On your foe list ';
+ tplvars.USER_LEVEL += '' + $lang.get('comment_on_foe_list') + ' ';
parser.assign_vars(tplvars);
parser.assign_bool(tplbool);
@@ -255,7 +262,7 @@
cmt.appendChild(ta);
link.style.fontWeight = 'bold';
- link.innerHTML = 'save';
+ link.innerHTML = $lang.get('comment_btn_save');
link.onclick = function() { var id = this.id.substr(this.id.indexOf('_')+1); saveComment(id, this); return false; };
}
@@ -273,7 +280,7 @@
'subj' : subj
};
link.style.fontWeight = 'normal';
- link.innerHTML = 'edit';
+ link.innerHTML = $lang.get('comment_btn_edit');
link.onclick = function() { var id = this.id.substr(this.id.indexOf('_')+1); editComment(id, this); return false; };
ajaxComments(req);
}
@@ -282,7 +289,7 @@
{
if ( !shift )
{
- var c = confirm('Do you really want to delete this comment?');
+ var c = confirm($lang.get('comment_msg_delete_confirm'));
if(!c)
return false;
}
@@ -340,36 +347,17 @@
}
if ( data.approved && data.approved != '1' )
{
- document.getElementById('subject_' + data.id).innerHTML += ' (Unapproved) ';
+ document.getElementById('subject_' + data.id).innerHTML += ' ' + $lang.get('comment_msg_note_unapp') + ' ';
}
if ( data.approved && ( typeof(data.approve_updated) == 'string' && data.approve_updated == 'yes' ) )
{
- var appr = ( data.approved == '1' ) ? 'Unapprove' : 'Approve';
+ var appr = ( data.approved == '1' ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
document.getElementById('comment_approve_'+data.id).innerHTML = appr;
- // Update approval status
- var p = document.getElementById('comment_status');
- var count = p.firstChild.nodeValue.split(' ')[2];
-
- if ( p.firstChild.nextSibling )
- {
- var span = p.firstChild.nextSibling;
- var is = ( data.approved == '1' ) ? -1 : 1;
- var n_unapp = parseInt(span.firstChild.nodeValue.split(' ')[0]) + is;
- n_unapp = n_unapp + '';
- }
+ if ( data.approved == '1' )
+ comment_decrement_unapproval();
else
- {
- var span = document.createElement('span');
- p.innerHTML += ' ';
- span.innerHTML = ' ';
- span.style.color = '#D84308';
- var n_unapp = '1';
- p.appendChild(span);
- }
- span.innerHTML = n_unapp + ' of those are unapproved.';
- if ( n_unapp == '0' )
- p.removeChild(span);
+ comment_increment_unapproval();
}
if ( data.text )
{
@@ -396,41 +384,24 @@
// Does the actual DOM object removal
function annihiliateComment(id) // Did I spell that right?
{
- // Approved?
- var p = document.getElementById('comment_status');
-
+ var approved = true;
if(document.getElementById('comment_approve_'+id))
{
var appr = document.getElementById('comment_approve_'+id).firstChild.nodeValue;
- if ( p.firstChild.nextSibling && appr == 'Approve' )
+ if ( appr == $lang.get('comment_btn_mod_approve') )
{
- var span = p.firstChild.nextSibling;
- var t = span.firstChild.nodeValue;
- var n_unapp = ( parseInt(t.split(' ')[0]) ) - 1;
- if ( n_unapp == 0 )
- p.removeChild(span);
- else
- span.firstChild.nodeValue = n_unapp + t.substr(t.indexOf(' '));
+ approved = false;
}
}
var div = document.getElementById('comment_holder_'+id);
div.parentNode.removeChild(div);
- var t = p.firstChild.nodeValue.split(' ');
- t[2] = ( parseInt(t[2]) - 1 ) + '';
- delete(t.toJSONString);
- if ( t[2] == '1' )
+
+ // update approval status
+ if ( document.getElementById('comment_count_unapp_inner') && !approved )
{
- t[1] = 'is';
- t[3] = 'comment';
+ comment_decrement_unapproval();
}
- else
- {
- t[1] = 'are';
- t[3] = 'comments';
- }
- t = implode(' ', t);
- p.firstChild.nodeValue = t;
}
function materializeComment(data)
@@ -465,32 +436,32 @@
tplvars.NAME = '' + data.name + ' ';
if ( data.approved != '1' )
- tplvars.SUBJECT += ' (Unapproved) ';
+ tplvars.SUBJECT += ' ' + $lang.get('comment_msg_note_unapp') + ' ';
// User level
- tplvars.USER_LEVEL = 'Guest';
- if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = 'Member';
- if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = 'Moderator';
- if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = 'Administrator';
+ tplvars.USER_LEVEL = $lang.get('user_type_guest');
+ if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
+ if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
+ if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
// Send PM link
- tplvars.SEND_PM_LINK=(data.user_id>1)?'Send private message ':'';
+ tplvars.SEND_PM_LINK=(data.user_id>1)?'' + $lang.get('comment_btn_send_privmsg') + ' ':'';
// Add buddy link
- tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'Add to buddy list ':'';
+ tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'' + $lang.get('comment_btn_add_buddy') + ' ':'';
// Edit link
- tplvars.EDIT_LINK='edit ';
+ tplvars.EDIT_LINK='' + $lang.get('comment_btn_edit') + ' ';
// Delete link
- tplvars.DELETE_LINK='delete ';
+ tplvars.DELETE_LINK='' + $lang.get('comment_btn_delete') + ' ';
// Moderation: (Un)approve link
- var appr = ( data.approved == 1 ) ? 'Unapprove' : 'Approve';
+ var appr = ( data.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
tplvars.MOD_APPROVE_LINK='';
// Moderation: Delete post link
- tplvars.MOD_DELETE_LINK='Delete ';
+ tplvars.MOD_DELETE_LINK='' + $lang.get('comment_btn_mod_delete') + ' ';
var tplbool = new Object();
@@ -519,50 +490,80 @@
document.getElementById('comment_source_'+i).value = data.comment_source;
- var p = document.getElementById('comment_status');
- var t = p.firstChild.nodeValue.split(' ');
- var n = ( isNaN(parseInt(t[2])) ) ? 0 : parseInt(t[2]);
- t[2] = ( n + 1 ) + '';
- delete(t.toJSONString);
- if ( t[2] == '1' )
- {
- t[1] = 'is';
- t[3] = 'comment';
+ var cnt = document.getElementById('comment_count_inner').innerHTML;
+ cnt = parseInt(cnt);
+ if ( isNaN(cnt) )
+ cnt = 0;
+
+ var subst = {
+ num_comments: cnt,
+ page_type: ENANO_PAGE_TYPE
}
- else
- {
- t[1] = 'are';
- t[3] = 'comments';
- }
- t = implode(' ', t);
- p.firstChild.nodeValue = t;
+
+ var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) );
+
+ document.getElementById('comment_status').firstChild.innerHTML = count_msg;
if(document.getElementById('comment_approve_'+i))
{
- var appr = document.getElementById('comment_approve_'+i).firstChild.nodeValue;
- if ( p.firstChild.nextSibling && appr == 'Approve' )
+ var is_unappr = document.getElementById('comment_approve_'+i).firstChild.nodeValue;
+ is_unappr = ( is_unappr == $lang.get('comment_btn_mod_approve') );
+ if ( is_unappr )
{
- var span = p.firstChild.nextSibling;
- var t = span.firstChild.nodeValue;
- var n_unapp = ( parseInt(t.split(' ')[0]) ) - 1;
- if ( n_unapp == 0 )
- p.removeChild(span);
- else
- span.firstChild.nodeValue = n_unapp + t.substr(t.indexOf(' '));
- }
- else if ( appr == 'Approve' && !p.firstChild.nextSibling )
- {
- var span = document.createElement('span');
- p.innerHTML += ' ';
- span.innerHTML = '1 of those are unapproved.';
- span.style.color = '#D84308';
- var n_unapp = '1';
- p.appendChild(span);
+ comment_increment_unapproval();
}
}
}
+function comment_decrement_unapproval()
+{
+ if ( document.getElementById('comment_count_unapp_inner') )
+ {
+ var num_unapp = parseInt(document.getElementById('comment_count_unapp_inner').innerHTML);
+ if ( !isNaN(num_unapp) )
+ {
+ num_unapp = num_unapp - 1;
+ if ( num_unapp == 0 )
+ {
+ var p = document.getElementById('comment_status');
+ p.removeChild(p.childNodes[2]);
+ p.removeChild(p.childNodes[1]);
+ }
+ else
+ {
+ var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: num_unapp });
+ document.getElementById('comment_count_unapp_inner').parentNode.innerHTML = count_msg;
+ }
+ }
+ }
+}
+
+function comment_increment_unapproval()
+{
+ if ( document.getElementById('comment_count_unapp_inner') )
+ {
+ var num_unapp = parseInt(document.getElementById('comment_count_unapp_inner').innerHTML);
+ if ( isNaN(num_unapp) )
+ num_unapp = 0;
+ num_unapp = num_unapp + 1;
+ var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: num_unapp });
+ document.getElementById('comment_count_unapp_inner').parentNode.innerHTML = count_msg;
+ }
+ else
+ {
+ var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: 1 });
+ var status = document.getElementById('comment_status');
+ if ( !status.childNodes[1] )
+ status.appendChild(document.createTextNode(' '));
+ var span = document.createElement('span');
+ span.id = 'comment_status_unapp';
+ span.style.color = '#D84308';
+ span.innerHTML = count_msg;
+ status.appendChild(span);
+ }
+}
+
function htmlspecialchars(text)
{
text = text.replace(/ $data['lockout_threshold'])
+ $attempts = $data['lockout_threshold'];
+ $time_rem = $data.time_rem;
+ $s = ( $time_rem == 1 ) ? '' : $lang.get('meta_plural');
+
+ var subst = {
+ lockout_threshold: $data.lockout_threshold,
+ time_rem: $time_rem,
+ plural: $s,
+ captcha_blurb: ( $data.lockout_policy == 'captcha' ? $lang.get('user_err_locked_out_captcha_blurb') : '' )
+ }
+
+ $errstring = $lang.get('user_err_locked_out', subst);
+
+ break;
+ }
+ return $errstring;
+}
function ajaxPromptAdminAuth(call_on_ok, level)
{
@@ -313,13 +369,24 @@
level = USER_LEVEL_MEMBER;
ajax_auth_level_cache = level;
var loading_win = ' \
-
Fetching an encryption key...
\
-
Not working? Use the alternate login form .
\
+
' + $lang.get('user_login_ajax_fetching_key') + '
\
+
' + $lang.get('user_login_ajax_link_fullform', { link_full_form: makeUrlNS('Special', 'Login/' + title) }) + '
\
\
';
- var title = ( level > USER_LEVEL_MEMBER ) ? 'You are requesting a sensitive operation.' : 'Please enter your username and password to continue.';
+ var title = ( level > USER_LEVEL_MEMBER ) ? $lang.get('user_login_ajax_prompt_title_elev') : $lang.get('user_login_ajax_prompt_title');
ajax_auth_mb_cache = new messagebox(MB_OKCANCEL|MB_ICONLOCK, title, loading_win);
ajax_auth_mb_cache.onbeforeclick['OK'] = ajaxValidateLogin;
+ ajax_auth_mb_cache.onbeforeclick['Cancel'] = function()
+ {
+ if ( document.getElementById('autoCaptcha') )
+ {
+ var to = fly_out_top(document.getElementById('autoCaptcha'), false, true);
+ setTimeout(function() {
+ var d = document.getElementById('autoCaptcha');
+ d.parentNode.removeChild(d);
+ }, to);
+ }
+ }
ajaxAuthLoginInnerSetup();
}
@@ -340,6 +407,20 @@
return false;
}
response = parseJSON(response);
+ var disable_controls = false;
+ if ( response.locked_out && !ajax_auth_error_string )
+ {
+ response.error = 'locked_out';
+ ajax_auth_error_string = ajaxAuthErrorToString(response);
+ if ( response.lockout_policy == 'captcha' )
+ {
+ ajax_auth_show_captcha = response.captcha;
+ }
+ else
+ {
+ disable_controls = true;
+ }
+ }
var level = ajax_auth_level_cache;
var form_html = '';
var shown_error = false;
@@ -351,27 +432,41 @@
}
else if ( level > USER_LEVEL_MEMBER )
{
- form_html += 'Please re-enter your login details, to verify your identity. ';
+ form_html += $lang.get('user_login_ajax_prompt_body_elev') + ' ';
}
+ if ( ajax_auth_show_captcha )
+ {
+ var captcha_html = ' \
+ \
+ ' + $lang.get('user_login_field_captcha') + ': \
+ \
+ ';
+ }
+ else
+ {
+ var captcha_html = '';
+ }
+ var disableme = ( disable_controls ) ? 'disabled="disabled" ' : '';
form_html += ' \
\
\
@@ -403,8 +498,9 @@
$('ajaxlogin_user').object.focus();
}
}
- $('ajaxlogin_pass').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); };
- $('ajaxlogin_pass').object.onkeypress = function(e)
+ var enter_obj = ( ajax_auth_show_captcha ) ? 'ajaxlogin_captcha_code' : 'ajaxlogin_pass';
+ $(enter_obj).object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); };
+ $(enter_obj).object.onkeypress = function(e)
{
// Trigger a form submit when the password field is focused and the user presses enter
@@ -436,6 +532,11 @@
fader.start();
}
*/
+ if ( ajax_auth_show_captcha )
+ {
+ ajaxShowCaptcha(ajax_auth_show_captcha);
+ ajax_auth_show_captcha = false;
+ }
}
});
}
@@ -450,6 +551,15 @@
password = document.getElementById('ajaxlogin_pass').value;
auth_enabled = false;
+ if ( document.getElementById('autoCaptcha') )
+ {
+ var to = fly_out_top(document.getElementById('autoCaptcha'), false, true);
+ setTimeout(function() {
+ var d = document.getElementById('autoCaptcha');
+ d.parentNode.removeChild(d);
+ }, to);
+ }
+
disableJSONExts();
//
@@ -505,11 +615,17 @@
'level' : ajax_auth_level_cache
};
+ if ( document.getElementById('ajaxlogin_captcha_hash') )
+ {
+ json_data.captcha_hash = document.getElementById('ajaxlogin_captcha_hash').value;
+ json_data.captcha_code = document.getElementById('ajaxlogin_captcha_code').value;
+ }
+
json_data = toJSONString(json_data);
json_data = encodeURIComponent(json_data);
var loading_win = ' \
-
Logging in...
\
+
' + $lang.get('user_login_ajax_loggingin') + '
\
\
';
@@ -530,7 +646,7 @@
{
case 'success':
var success_win = ' \
-
Success.
\
+
' + $lang.get('user_login_success_short') + '
\
\
';
ajax_auth_mb_cache.updateContent(success_win);
@@ -552,18 +668,23 @@
}
break;
case 'error':
- if ( response.error == 'The username and/or password is incorrect.' )
+ if ( response.data.error == 'invalid_credentials' || response.data.error == 'locked_out' )
{
- ajax_auth_error_string = response.error;
+ ajax_auth_error_string = ajaxAuthErrorToString(response.data);
mb_current_obj.updateContent('');
document.getElementById('messageBox').style.backgroundColor = '#C0C0C0';
var mb_parent = document.getElementById('messageBox').parentNode;
new Spry.Effect.Shake(mb_parent, {duration: 1500}).start();
setTimeout("document.getElementById('messageBox').style.backgroundColor = '#FFF'; ajaxAuthLoginInnerSetup();", 2500);
+
+ if ( response.data.lockout_policy == 'captcha' && response.data.error == 'locked_out' )
+ {
+ ajax_auth_show_captcha = response.captcha;
+ }
}
else
{
- alert(response.error);
+ ajax_auth_error_string = ajaxAuthErrorToString(response.data);
ajaxAuthLoginInnerSetup();
}
break;
diff -r e17cc42d77cf -r ab66d6d1f1f4 includes/clientside/static/template-compiler.js
--- a/includes/clientside/static/template-compiler.js Wed Dec 19 17:15:48 2007 -0500
+++ b/includes/clientside/static/template-compiler.js Wed Dec 19 22:55:40 2007 -0500
@@ -54,6 +54,7 @@
code = code.replace(new RegExp(unescape('%0A'), 'g'), '\\n');
code = "'" + code + "'";
code = code.replace(/\{([A-z0-9_-]+)\}/ig, "' + this.tpl_strings['$1'] + '");
+ code = code.replace(/\{lang:([a-z0-9_]+)\}/g, "' + $lang.get('$1') + '");
code = code.replace(/\';
+ $title = $lang->get('pophelp_admin_embed_php_title');
+ $content = $lang->get('pophelp_admin_embed_php_body');
break;
case 'url_schemes':
- $title = 'URL schemes';
- $content = 'The URL scheme allows you to decide how the URLs to your Enano pages will look.
- The first option (Standard URLs) works on any web server. You should select it if your server doesn\'t run Apache, or
- if you are at all unsure of your server\'s configuration. With this scheme, URLs at your site will look like
- http://yoursite.com/path-to-enano/index.php/Main_Page .
- The second option, Small URLs, will be selected by default if Enano detects Apache. Small URLs are more friendly towards
- search engines, but they don\'t work on very many non-Apache servers, or if PHP is set up through CGI on your server. Many
- free and low-cost web hosts will configure PHP through CGI in order to keep your user account as the owner of any files that
- Enano generates. With this scheme, URLs at your site will look like http://yoursite.com/path-to-enano/index.php/Main_Page .
-
- The last option, Tiny URLs, is the most friendly URL scheme for search engines, because your URLs won\'t have any special characters
- at all in them. However, this only works if your webhost has configured Apache with support for mod_rewrite. Most of the time if your
- host supports this you will see a listing for it in their feature matrix. None of the popular Linux distributions (such as Ubuntu,
- Debian, Red Hat Enterprise Linux™, Fedora, openSUSE™, or CentOS) come with mod_rewrite enabled, so if you run a
- home-brew server, you should consult your distribution\'s documentation for enabling mod_rewrite before selecting this option.
- With this scheme, URLs at your site will look like http://yoursite.com/path-to-enano/Main_Page .
- ';
+ $title = $lang->get('pophelp_url_schemes_title');
+ $content = $lang->get('pophelp_url_schemes_body');
break;
default:
$title = 'Invalid topic';
$content = 'Invalid help topic.';
break;
}
+ $close_window = $lang->get('pophelp_btn_close_window');
echo <<
@@ -1072,34 +1051,48 @@
{$title}
{$content}
- Close window
+ {$close_window}