After hours of reading, learning javascript, mootools, firebugging, wiresharking, ddd, gdb it works. It's exactly what I wanted but what a way to learn it. Anyways below is what I used to get a working controller demo working.
First the apache configuration. I got this from someones post, something about APE on ubuntu, see
http://www.blogger.com/post-create.g?blogID=1847386878976174462.
Here's my apache config:
create
/etc/apache2/sites-available/ape.confContents:
<VirtualHost *:80> ServerName ape.ape-test.local ServerAlias *.ape.ape-test.local ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:6969/ ProxyPassReverse / http://localhost:6969/ </VirtualHost>Then run the following to enable the config
sudo a2ensite ape.confThen restart apache
sudo /etc/init.d/apache2 restartPut the demo into a directory served by apache, loading the script is another missing part.
demo.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr" lang="en"><head> </head><body> <script type="text/javaScript" src="../../Clients/mootools-core.js"></script> <script type="text/javaScript" src="../../Clients/MooTools.js"></script> <script type="text/javaScript" src="../config.js"></script> <script type="text/javaScript" src="demo.js"></script> <script type="text/javaScript"> var client = new APE.Client(); var debug=true; client.load({ identifier: 'mailnotif', channel: 'testchannel', complete: function(ape){ var ape_c = new APE.Controller(ape, {container: $('ape_master_container')}); }, 'scripts': APE.Config.scripts //Scripts to load for APE JSF }); </script> To try this demo, you need : <ul> <li>mod controller on APE server enabled</li> <li>mod chat on APE server disabled</li> <li>Set your APE server adresse in the controller/test.php</li> </ul> Then load this page and go to <a href="./test.php" target="_blank">controller/test.php</a> and you will see a message appear here. <br/> <br/> <div id="ape_master_container" style="border:1px solid #000;padding:10px;background:#CCC;"></div> <div id="debug"></div> </body></html>My demo.js, the join is the important missing part. It creates the channel.
APE.Controller = new Class({ Implements: [APE.Client, Options], options:{ container: null, logs_limit: 10 }, initialize: function(core, options){ this.core = core; this.setOptions(options); this.options.container = $(this.options.container) || document.body; this.els = {}; this.onRaw('mailnotif', this.raw_data); this.core.start(); // this.core.join('testchannel') }, init: function() { this.core.join('testchannel'); }, raw_data: function(raw, pipe){ new Element('div', { 'class': 'css_class', 'html': decodeURIComponent(raw.datas.value) }).inject(this.options.container); }});The ../config.js, the inclusion of mootools-core was missing as it defined the 'Class'. Also why the f*** is there 2 mootools-core? One in the Source directory and the other in Client, and they are different! Why not follow the common sense rule of using different names?
APE.Config.baseUrl = 'http://ape-test.local/jpscc/APE_JSF/Source'; //APE JSF APE.Config.domain = 'ape-test.local'; //Your domain, must be the same than the domain in aped.conf of your serverAPE.Config.server = 'ape.ape-test.local'; //APE server URL//Scripts to load for APE JSF(function(){ for (var i = 0; i < arguments.length; i++) APE.Config.scripts.push(APE.Config.baseUrl + '/' + arguments[i] + '.js');})('mootools-core','Core/Events', 'Pipe/Pipe', 'Pipe/PipeProxy', 'Pipe/PipeMulti', 'Pipe/PipeSingle', 'Core/Core', 'Core/Utility','Core/Session');the /etc/hosts
127.0.0.1 localhost127.0.1.1 ubuntu# The following lines are desirable for IPv6 capable hosts::1 ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allroutersff02::3 ip6-allhosts127.0.0.1 0.ape.ape-test.local127.0.0.1 1.ape.ape-test.local127.0.0.1 2.ape.ape-test.local127.0.0.1 3.ape.ape-test.local127.0.0.1 4.ape.ape-test.local127.0.0.1 5.ape.ape-test.local127.0.0.1 6.ape.ape-test.local127.0.0.1 7.ape.ape-test.local127.0.0.1 8.ape.ape-test.local127.0.0.1 9.ape.ape-test.local127.0.0.1 10.ape.ape-test.local127.0.0.1 11.ape.ape-test.local127.0.0.1 12.ape.ape-test.local127.0.0.1 13.ape.ape-test.local127.0.0.1 14.ape.ape-test.local127.0.0.1 15.ape.ape-test.local127.0.0.1 *.ape.ape-test.local127.0.0.1 ape.ape-test.local127.0.0.1 ape-test.localFinally test.php
<?php$ape_server = 'http://0.ape.ape-test.local';file_get_contents($ape_server.'/?control&testpwd&testchannel&POSTMSG&mailnotif&testmsg&anticache');echo 'Message sent!';?>Or if you prefer:
wget -c "http://0.ape.ape-test.local//?control&testpwd&testchannel&POSTMSG&mailnotif&hello_there&anticache"There, that should work if I didn't miss anything. Phew all this just to scroll output from the console into a web page. APE doco and demo sucks but hope this helps you.