Show
Ignore:
Timestamp:
12/14/08 22:48:14 (13 years ago)
Author:
exi
Message:

Commit of the reworked ajax mod
Preview of the new ajcron mod (80% done)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/mods/xajax/init.php

    r278 r363  
    22// common/includes/class.page.php 
    33// templates/index.tpl 
    4 // you should not change anything in this file but the image generator / whatever bypass change the functions.php  
    5 $mod = 'xajax'; 
    6 if ($page != "thumb" && $page !="mapview" && $page!="sig"){ // bypass some of the image generators.. 
    7         require_once("mods/".$mod."/xajax_core/xajax.inc.php"); // initialize xajax 
    8         $xajax = new xajax(); // Create xajax object 
    9         //$xajax->setFlag('debug',true); 
    10          $xajax->processRequest();  
    11         require_once("mods/".$mod."/functions.php"); // require functions. 
    12         $xajax->processRequest(); 
    13         require_once("mods/".$mod."/loading.php"); // Setup scripts and html 
    14          
     4// you should not change anything in this file but the image generator / whatever bypass change the functions.php 
     5 
     6// bypass some of the image generators.. 
     7if ($page != "thumb" && $page != "mapview" && $page != "sig") 
     8{ 
     9        require_once('mods/xajax/xajax_core/xajax.inc.php'); 
     10    $xajax = new xajax(); 
     11        require_once('mods/xajax/functions.php'); 
     12    event::register('page_assembleheader', 'mod_xajax::insertHTML'); 
     13 
     14    // if mods depend on xajax they can register to mod_xajax_initialised 
     15    // it gets called after all mods have been initialized 
     16    event::register('mods_initialised', 'mod_xajax::lateProcess'); 
    1517} 
    1618 
    17 ?> 
     19class mod_xajax 
     20{ 
     21    function xajax() 
     22    { 
     23        global $mod_xajax_enable; 
     24        $mod_xajax_enable = true; 
     25    } 
     26 
     27    // on page assembly look wether xajax is needed or not 
     28        function insertHTML($obj) 
     29    { 
     30            global $mod_xajax_enable; 
     31            if (!isset($mod_xajax_enable)) 
     32            { 
     33                return; 
     34            } 
     35 
     36            global $xajax; 
     37        $obj->addBody($xajax->getJavascript("mods/xajax/")); 
     38    } 
     39 
     40    function lateProcess() 
     41    { 
     42        // let all mods know we're here so they can register their functions 
     43        event::call('mod_xajax_initialised', $this); 
     44 
     45        // now process all xajax calls 
     46        global $xajax; 
     47        $xajax->processRequest(); 
     48    } 
     49}