Changeset 363 for dev/mods

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

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

Location:
dev/mods
Files:
3 added
1 removed
3 modified

Legend:

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

    r259 r363  
    1 <? 
     1<?php 
    22$xajax->registerFunction("postMail"); 
    33 
    4 function postMail($arry){ 
     4function postMail($arry) 
     5{ 
    56        // this function handles the posting of mail 
    67        $objResponse = new xajaxResponse(); 
    78        $newContent = "response:" .$arry[killmail] ; 
    8         $objResponse->Assign("kill-response","innerHTML", $newContent); 
     9        $objResponse->Assign("kill-response", "innerHTML", $newContent); 
     10 
    911        return $objResponse; 
    1012} 
    11  
    12 ?> 
  • 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} 
  • dev/mods/xajax/post.php

    r259 r363  
    66$kb = new Killboard(KB_SITE); 
    77 
     8event::register('page_assembleheader', 'mod_xajax_page::patchMeUp'); 
     9class mod_xajax_page 
     10{ 
     11    function patchMeUp($obj) 
     12    { 
     13        $obj->addHeader('<style> 
     14            #loading { 
     15            /*Yes I know I am up here above the title and really, you can validate my ass mind your own business */ 
     16            /*You fucking bastard were just too lazy to lookup how to do callbacks!*/ 
     17            background: black;  color: white; 
     18            padding: 20px;      border: 2px solid green; 
     19            display: none; /* hidden */ 
     20            position: absolute; left: 50%; 
     21            margin-left: -100px; 
     22            top: 25%;   width: 200px; 
     23            font-weight: bold;  font-size: large; 
     24            } 
     25            </style> 
     26            '); 
     27        $obj->addBody('<div id="loading"><img src="mods/xajax/img/loading.gif" alt="" /> Loading...</div>'); 
     28        $obj->addBody("<script> 
     29           xajax.callback.global.onRequest = function() {xajax.$('loading').style.display = 'block';} 
     30           xajax.callback.global.beforeResponseProcessing = function() {xajax.$('loading').style.display='none';} 
     31           </script>"); 
     32    } 
     33} 
    834/* Setup xajax script */ 
    9 $patch_script = $xajax->getJavascript("mods/".$mod."/"); 
    10 $patch_script .= "<script> 
    11                                         xajax.callback.global.onRequest = function() {xajax.$('loading').style.display = 'block';} 
    12                                         xajax.callback.global.beforeResponseProcessing = function() {xajax.$('loading').style.display='none';} 
    13                                 </script>"; 
    14                                  
    15 $page->setPatch_script($patch_script); 
    16 /* Setup xajax script */ 
    17  
     35mod_xajax::xajax(); 
    1836 
    1937if (!config::get('post_forbid')) 
     
    4058    $html .= "</form>"; 
    4159        $html .= "<input id=submit type=\"submit\" onclick=\"xajax_postMail(xajax.getFormValues('postform')); return false;\" \" value=\"Process !\"/>"; 
    42      
     60 
    4361} 
    4462else