18
Hi all;
Here is some instructions, wish help you to configure what is going on at all:
The main script is called ajaxer.js containing all the necessary code. It then uses RICO(openrico.org) based on prototype.js to make the Ajax calls and drag and drop facilities with some JavaScript effects.
XoopsDragAndDropDraggable.js , XoopsDragAndDropDropzone.js and XoopsDragAndDropManager.js contain are RICO’s extended objects for ricoDraggable, ricoDropDropzone and ricoDragAndDropManager, created to do the drag and drop part of blocks.
This is a XOOPS hack, these files has been changed:
1) header.php
2) class/theme_blocks.php
3) class/xoopsblock.php
4) include/functions.php
5) modules/system/templates/system_redirect.html
And the theme: ajaxedxoops which contains the scripts, and a change in theme.html which out puts an xml required by RICO to map the sent data to some objects in ajaxer.js, for page(module/core) the object is: page_obj and for blocks: block_obj, there is also a page_hisotry_obj object which is responsible to make page and blocks cache and track them.
How it works?
1) first when the page is loaded some JavaScript functions will start to work:
a. createJavascriptMirror
creates the page_blocks_handler object and calls createDraggableBlocks methis on it to make the dragable blocks.
b. sanitizeATags
called when ever we need to make a tags call RICO functions
1- create and attach proper onClick attribute
2- remove the href
3- some criteria should exict as we need some links not changed (ex. xoops_url/admin.php)
c. sanitizeFormTags
called when ever we need to make form tags call rico functions
d. roundElements
this function will be called on page load, to make blocks title and content divs rounded.
e. createDropZones
it is a good idea to make diferent drop zones for each block side, so that left and right blocks could be changed while center blocks could change places judt in center part of the page.
2) So now all a tags will call needed functions to load the page via Ajax when a link is clicked it will send the request to server, then in header.php we will see if the page is requested for Ajax content, if so we will omit the block part, if the request is sent to get left or right blocks then we send them and exit the script so that module code do not run. so is for forms,
3) In theme.html again we check if the request is for a page or block, then we send the proper xml to the browser.
4) When the browser gets the response it will map it to the proper JavaScript object and calls sanitizeATags and sanitizeFormTags again to make the new data act Ajaxy too.
This job is not complete and needs much more work. Any suggestion and idea is welcome.
@Giba
Thanks for your comment, you are completely right about it, I am working on it a little more to make what you mean, we should not load the parts(blocks) that are already loaded, we need that comparation you mentioned, I think we can send the block ids already loaded to the page and make server know what we have, then server could send us the proper block data, I wish I have got what you meant! if I am wrong please correct me, thanks.