# HG changeset patch # User Dan # Date 1214515893 14400 # Node ID 35e91d16ecf5453bddc213678bea35770b0547d4 # Parent 04a6ea3da279e011dea92f75701f245736e50579 Fixed javascript ACL manager and captcha not showing on ajax login lockout_captcha event diff -r 04a6ea3da279 -r 35e91d16ecf5 includes/clientside/static/acl.js --- a/includes/clientside/static/acl.js Thu Jun 26 17:01:42 2008 -0400 +++ b/includes/clientside/static/acl.js Thu Jun 26 17:31:33 2008 -0400 @@ -8,6 +8,7 @@ { if(IE) return true; + load_component('messagebox'); load_component('fadefilter'); load_component('template-compiler'); diff -r 04a6ea3da279 -r 35e91d16ecf5 includes/clientside/static/ajax.js --- a/includes/clientside/static/ajax.js Thu Jun 26 17:01:42 2008 -0400 +++ b/includes/clientside/static/ajax.js Thu Jun 26 17:31:33 2008 -0400 @@ -1041,37 +1041,6 @@ new MessageBox(MB_OK|MB_ICONINFORMATION, $lang.get('user_keepalive_info_title'), $lang.get('user_keepalive_info_body')); } -window.ajaxShowCaptcha = function(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 = $dynano(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); -} - window.ajaxUpdateCheck = function(targetelement) { if ( !document.getElementById(targetelement) ) diff -r 04a6ea3da279 -r 35e91d16ecf5 includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Thu Jun 26 17:01:42 2008 -0400 +++ b/includes/clientside/static/enano-lib-basic.js Thu Jun 26 17:31:33 2008 -0400 @@ -198,10 +198,9 @@ var loaded_components = {}; function load_component(file) { - if ( !file.match(/\.js$/) ) - file = file + '.js'; + file = file.replace(/\.js$/, ''); - console.info('Loading component %s via AJAX', file.replace(/\.js$/, '')); + console.info('Loading component %s via AJAX', file); if ( loaded_components[file] ) { @@ -214,6 +213,7 @@ // get an XHR instance var ajax = ajaxMakeXHR(); + file = file + '.js'; var uri = scriptPath + '/includes/clientside/static/' + file; ajax.open('GET', uri, false); ajax.send(null); @@ -420,7 +420,7 @@ arglist[arglist.length] = 'arguments['+i+']'; } arglist = implode(', ', arglist); - eval(funcname + '(' + arglist + ');'); + return eval(funcname + '(' + arglist + ');'); } } @@ -451,6 +451,7 @@ unselectAllButtonsMinor: 'toolbar.js', darken: 'fadefilter.js', enlighten: 'fadefilter.js', + autofill_onload: 'autofill.js', } var placeholder_instances = {}; diff -r 04a6ea3da279 -r 35e91d16ecf5 includes/clientside/static/login.js --- a/includes/clientside/static/login.js Thu Jun 26 17:01:42 2008 -0400 +++ b/includes/clientside/static/login.js Thu Jun 26 17:31:33 2008 -0400 @@ -874,6 +874,37 @@ } } +window.ajaxShowCaptcha = function(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 = $dynano(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); +} + window.ajaxInitLogout = function() { load_component('messagebox'); diff -r 04a6ea3da279 -r 35e91d16ecf5 includes/template.php --- a/includes/template.php Thu Jun 26 17:01:42 2008 -0400 +++ b/includes/template.php Thu Jun 26 17:31:33 2008 -0400 @@ -909,7 +909,7 @@ if ( !$paths->anonymous_page && $session->check_acl_scope('edit_acl', $local_namespace) && ( $perms->get_permissions('edit_acl') || ( defined('ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL') && $session->user_level >= USER_LEVEL_ADMIN ) ) ) { $menubtn->assign_vars(array( - 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"', + 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { var s = ajaxOpenACLManager(); console.debug(s); return false; }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"', 'HREF' => makeUrl($local_page, 'do=aclmanager', true), 'TEXT' => $lang->get('onpage_btn_acl'), ));