From bad31ae944f074dab12f7a6d1362775d8f2b18dd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 29 Oct 2005 02:26:52 +0200 Subject: JavaScript refactoring This patch addes a first go on a central javascript and CSS dispatcher which builds a single script from all needed scripts, does optimizing and caching. darcs-hash:20051029002652-7ad00-7558b569c2bf65f5e41820644580d97c62edd0d6.gz --- inc/init.php | 6 ++++-- inc/template.php | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 16 deletions(-) (limited to 'inc') diff --git a/inc/init.php b/inc/init.php index 108ed615c..41363f63d 100644 --- a/inc/init.php +++ b/inc/init.php @@ -46,8 +46,10 @@ @ini_set('arg_separator.output', '&'); // init session - session_name("DokuWiki"); - if (!headers_sent()) session_start(); + if (!headers_sent() && !defined(NOSESSION)){ + session_name("DokuWiki"); + session_start(); + } // kill magic quotes if (get_magic_quotes_gpc()) { diff --git a/inc/template.php b/inc/template.php index 0deeff32d..7401c3e62 100644 --- a/inc/template.php +++ b/inc/template.php @@ -195,7 +195,9 @@ function tpl_metaheaders(){ ptln('',$it); } - // include some JavaScript language strings +/* + + // include some JavaScript language strings #FIXME still needed? ptln('',$it); // load the default JavaScript files + ptln('',$it); ptln('',$it); ptln('',$it); - + ptln('',$it); // editing functions if($ACT=='edit' || $ACT=='preview'){ // add size control ptln('',$it); if($INFO['writable']){ @@ -243,21 +250,21 @@ function tpl_metaheaders(){ // add toolbar require_once(DOKU_INC.'inc/toolbar.php'); toolbar_JSdefines('toolbar'); - ptln("addEvent(window,'onload',function(){initToolbar('toolbar','wikitext',toolbar);});",$it+2); + ptln("addEvent(window,'load',function(){initToolbar('toolbar','wikitext',toolbar);});",$it+2); // add pageleave check - ptln("addEvent(window,'onload',function(){initChangeCheck('". + ptln("addEvent(window,'load',function(){initChangeCheck('". str_replace('\\\\n','\\n',addslashes($lang['notsavedyet']))."');});",$it); // add lock timer - ptln("addEvent(window,'onload',function(){init_locktimer(". + ptln("addEvent(window,'load',function(){init_locktimer(". ($conf['locktime']-60).",'". str_replace('\\\\n','\\n',addslashes($lang['willexpire']))."');});",$it); // add spellchecker if($conf['spellchecker']){ //init here - ptln("addEvent(window,'onload',function(){ ajax_spell.init('". + ptln("addEvent(window,'load',function(){ ajax_spell.init('". $lang['spell_start']."','". $lang['spell_stop']."','". $lang['spell_wait']."','". @@ -268,6 +275,14 @@ function tpl_metaheaders(){ ptln('',$it); } } +*/ + + $js_edit = ($ACT=='edit' || $ACT=='preview') ? 1 : 0; + $js_write = ($INFO['writable']) ? 1 : 0; + + ptln('',$it); + // plugin stylesheets and Scripts plugin_printCSSJS(); @@ -533,20 +548,17 @@ function tpl_actionlink($type,$pre='',$suf=''){ * * @author Andreas Gohr */ -function tpl_searchform(){ +function tpl_searchform($withajax=true){ global $lang; global $ACT; print ''; } -- cgit v1.2.3