# HG changeset patch # User Dan # Date 1204516343 18000 # Node ID 518bc2b214f1aaebf7f12d29a057d9bb0bd21769 # Parent bc4b58034f4df453f04e81ead78deb563120e90b Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea) diff -r bc4b58034f4d -r 518bc2b214f1 includes/clientside/static/editor.js --- a/includes/clientside/static/editor.js Sun Mar 02 19:32:19 2008 -0500 +++ b/includes/clientside/static/editor.js Sun Mar 02 22:52:23 2008 -0500 @@ -122,10 +122,35 @@ } // Destroy existing contents of page container - var edcon = document.getElementById('ajaxEditContainer'); - for ( var i = edcon.childNodes.length - 1; i >= 0; i-- ) + if ( editor_use_modal_window ) { - edcon.removeChild(edcon.childNodes[i]); + darken(true); + // Build a div with 80% width, centered, and 10px from the top of the window + var edcon = document.createElement('div'); + edcon.style.position = 'absolute'; + edcon.style.backgroundColor = '#FFFFFF'; + edcon.style.padding = '10px'; + edcon.style.width = '80%'; + edcon.id = 'ajaxEditContainerModal'; + + // Positioning + var top = getScrollOffset() + 10; + var left = ( getWidth() / 10 ) - 10; // 10% of window width on either side - 10px for padding = perfect centering effect + edcon.style.top = String(top) + 'px'; + edcon.style.left = String(left) + 'px'; + var body = document.getElementsByTagName('body')[0]; + + // Set opacity to 0 + domObjChangeOpac(0, edcon); + body.appendChild(edcon); + } + else + { + var edcon = document.getElementById('ajaxEditContainer'); + for ( var i = edcon.childNodes.length - 1; i >= 0; i-- ) + { + edcon.removeChild(edcon.childNodes[i]); + } } var content = response.src; @@ -519,10 +544,30 @@ } } + // if we're using the modal window, fade it in + if ( editor_use_modal_window ) + { + domOpacity(edcon, 0, 100, 500); + } + // Autosave every 5 minutes (m * s * ms) setInterval('ajaxPerformAutosave();', ( 5 * 60 * 1000 )); } +function ajaxEditorDestroyModalWindow() +{ + if ( editor_use_modal_window ) + { + var edcon = document.getElementById('ajaxEditContainerModal'); + var body = document.getElementsByTagName('body')[0]; + if ( edcon ) + { + body.removeChild(edcon); + enlighten(true); + } + } +} + function ajaxEditorSave(is_draft) { if ( !is_draft ) @@ -661,6 +706,7 @@ selectButtonMajor('article'); unselectAllButtonsMinor(); + ajaxEditorDestroyModalWindow(); document.getElementById('ajaxEditContainer').innerHTML = '
' + ajax.responseText; opacity('ajaxEditContainer', 0, 100, 1000); } @@ -766,6 +812,7 @@ mb.onclick['Yes'] = function() { setAjaxLoading(); + ajaxEditorDestroyModalWindow(); editor_open = false; enableUnload(); setTimeout('ajaxReset();', 750); diff -r bc4b58034f4d -r 518bc2b214f1 includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Sun Mar 02 19:32:19 2008 -0500 +++ b/includes/clientside/static/enano-lib-basic.js Sun Mar 02 22:52:23 2008 -0500 @@ -119,6 +119,7 @@ var startheight = false; var do_width = false; var ajax_load_icon = scriptPath + '/images/loading.gif'; +var editor_use_modal_window = false; // You have an NSIS coder in your midst... var MB_OK = 1; diff -r bc4b58034f4d -r 518bc2b214f1 includes/clientside/static/faders.js --- a/includes/clientside/static/faders.js Sun Mar 02 19:32:19 2008 -0500 +++ b/includes/clientside/static/faders.js Sun Mar 02 22:52:23 2008 -0500 @@ -6,14 +6,14 @@ nofade = true; if(document.getElementById('specialLayer_darkener')) { - document.getElementById('specialLayer_darkener').style.display = 'block'; if(nofade) { - document.getElementById('specialLayer_darkener').style.opacity = '0.7'; - document.getElementById('specialLayer_darkener').style.filter = 'alpha(opacity=70)'; + changeOpac(70, 'specialLayer_darkener'); + document.getElementById('specialLayer_darkener').style.display = 'block'; } else { + document.getElementById('specialLayer_darkener').style.display = 'block'; opacity('specialLayer_darkener', 0, 70, 1000); } } else { @@ -97,12 +97,21 @@ */ var mb_current_obj; +var mb_previously_had_darkener = false; function messagebox(type, title, message) { var y = getScrollOffset(); - if(document.getElementById('messageBox')) return; - darken(true); + + // Prevent multiple instances + if ( document.getElementById('messageBox') ) + return; + + if ( document.getElementById('specialLayer_darkener') ) + if ( document.getElementById('specialLayer_darkener').style.display == 'block' ) + mb_previously_had_darkener = true; + if ( !mb_previously_had_darkener ) + darken(true); if ( aclDisableTransitionFX ) { document.getElementById('specialLayer_darkener').style.zIndex = '5'; @@ -291,7 +300,8 @@ var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); - enlighten(true); + if ( !mb_previously_had_darkener ) + enlighten(true); }; //domObjChangeOpac(0, mydiv); @@ -339,12 +349,13 @@ var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); - enlighten(true); + if ( !mb_previously_had_darkener ) + enlighten(true); } else { var to = fly_out_top(maindiv, true, false); - setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); enlighten(true);", to); + setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); if ( !mb_previously_had_darkener ) enlighten(true);", to); } if(typeof mb.onclick[val] == 'function') { diff -r bc4b58034f4d -r 518bc2b214f1 includes/functions.php --- a/includes/functions.php Sun Mar 02 19:32:19 2008 -0500 +++ b/includes/functions.php Sun Mar 02 22:52:23 2008 -0500 @@ -293,7 +293,7 @@ $idata = RenderMan::strToPageID($page_id); $page_id_key = $paths->nslist[ $idata[1] ] . $idata[0]; $page_id_key = sanitize_page_id($page_id_key); - $page_data = $paths->pages[$page_id_key]; + $page_data = @$paths->pages[$page_id_key]; $title = ( isset($page_data['name']) ) ? ( ( $page_data['namespace'] == 'Article' || !$show_ns ) ? '' : diff -r bc4b58034f4d -r 518bc2b214f1 includes/pageprocess.php --- a/includes/pageprocess.php Sun Mar 02 19:32:19 2008 -0500 +++ b/includes/pageprocess.php Sun Mar 02 22:52:23 2008 -0500 @@ -1694,20 +1694,51 @@ function do_breadcrumbs() { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; + if ( strpos($this->text_cache, '__NOBREADCRUMBS__') !== false ) return false; + + $mode = getConfig('breadcrumb_mode'); + + if ( $mode == 'never' ) + // Breadcrumbs are disabled + return true; + + // Minimum depth for breadcrumb display + $threshold = ( $mode == 'always' ) ? 0 : 1; + $breadcrumb_data = explode('/', $this->page_id); - if ( count($breadcrumb_data) > 1 ) + if ( count($breadcrumb_data) > $threshold ) { + // If we're not on a subpage of the main page, add "Home" to the list + $show_home = false; + if ( $mode == 'always' ) + { + $show_home = true; + } echo '