AJAX-Framework in Joomla?

For Joomla! 1.0 Coding related discussions.
User avatar
Aristocrat
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Aug 18, 2005 5:50 am
Location: Vancouver, BC, Canada
Contact:

Re: AJAX-Framework in Joomla?

Post by Aristocrat » Tue Feb 14, 2006 6:12 pm

I've been playing with XAJAX in Joomla and liked it very much. I am working towards rebuilding on of the administration interfaces in AJAX. Let's see how it goes. I need to develop an easy to use design pattern.

So is XAJAX going to become Joomla's AJAX library?



Hey! Yahoo just released an AJAX API today ( http://developer.yahoo.net/yui/ ).

I've been looking at the examples and it is pretty neat actually. Although I'm not sure how committed Yahoo is in keeping and maintaining it. One good thing about open source communities is that once established it becomes a reliable source of support a community doesn't die as easily. What if Yahoo decides to discontinue supporting and providing APIs.

What are you're thoughts on that?

Rastin
Rastin Mehr - Founder/Web Application Architect
http://www.rmdstudio.com - Social People Building Social Web Solutions ™
http://www.Anahitapolis.com - The Anahita Social Engine ™ project

 
User avatar
cozimek
Joomla! Guru
Joomla! Guru
Posts: 593
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC & San Francisco, CA
Contact:

Re: AJAX-Framework in Joomla?

Post by cozimek » Tue Feb 14, 2006 6:18 pm

Rastin,

This is really interesting to hear about your work on the administrator.  Things that I find most frustrating include items like moving menu items up and down in the memu item lists (reload after every movement of ONE position...ugh).  Some things just really lend themselves to AJAX like that, but not everything.

What have you completed thus far?  How has the XAJAX been working for you?  Pretty easy?

I don't think we're anywhere near picking one to stick with here.

-Ryan
Soapbox Engage - "Empowering the missions of non-profits through technology"
www.soapboxengage.com
Twittering at www.twitter.com/cozimek (@cozimek)

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6569
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: AJAX-Framework in Joomla?

Post by Jinx » Tue Feb 14, 2006 7:18 pm

Hi Rastin,

We haven't settled on any library yet, we are just playing around and looking to what suits us best. Looking forward to your work on the integration of AJAX into the administrator. Let me know how it goes :)

Johan
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
Aristocrat
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Aug 18, 2005 5:50 am
Location: Vancouver, BC, Canada
Contact:

Re: AJAX-Framework in Joomla?

Post by Aristocrat » Tue Feb 14, 2006 7:53 pm

Oh thanks ... you guys are wonderful.

Well I have just started few days ago. I am building the 2.0 version of the eLearning Application I built in Mambo last year www.PremierGo.com for my Fulltime employer www.Premier.us we served thousands of students and teachers last year, and now I am going to build the new version on Joomla, and AJAX could make things a lot smoother for our end users.

When I look for an Open source solutions I look at factors such as:

1. They practice good software engineering practices, and design patterns
2. There is a large enough committed community behind the project

For instance Joomla is a state of art Open Source IMHO.

I've been looking at XAJAX, and Prototype ( http://prototype.conio.net ). The positive side about Prototype is that it is being used in other projects such as Ruby On Rails, script.aculo.us, Rico, and Behaviour. That means it has grown roots.

XAJAX needs significantly less Javascript coding, and most of the work is done through php.

So there are pros and cons, and in the end I like to be more aligned with what Joomla core team picks for the application.

What I like to be able to accomplish is a good design pattern that fits the Model View Control pattern favored in Joomla 1.1.* perhaps by introducing a Command Object that recieves the user id, variables, methods, then attempts to create the approapriate ajax objects and create the screen for the user.

I'll be working on AJAX on Joomla Administration side and keep you guys posted. If I could come up with something within the next 2 weeks for my eLearning project that would be great, if not I'll be focusing on it for the next few month during the weekends and free R&D time.

Either way I think it is time to introduce Ajax, and Joomla to each other :)

Rastin
Last edited by Aristocrat on Tue Feb 14, 2006 7:56 pm, edited 1 time in total.
Rastin Mehr - Founder/Web Application Architect
http://www.rmdstudio.com - Social People Building Social Web Solutions ™
http://www.Anahitapolis.com - The Anahita Social Engine ™ project

User avatar
cozimek
Joomla! Guru
Joomla! Guru
Posts: 593
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC & San Francisco, CA
Contact:

Re: AJAX-Framework in Joomla?

Post by cozimek » Tue Feb 14, 2006 8:01 pm

Rastin,

Great post, and I couldn't agree more.  I think that judicious use of AJAX is important, but let us not get caught up in the Web 2.0 hype!  I think that prototype is great because of it's wide fan base, but if XAJAX is easier to implement in PHP, then we might see a following move towards that route.

I wonder if there's any way to see which packages are getting used the most.  Also, at the end of the day, does it really matter?  Could we roll together our own package?  I'm no JS guru, so looking for ideas from you all.

Also, Rastin, what parts of the admin are you focusing on AJAXing?

Best,
Ryan
Soapbox Engage - "Empowering the missions of non-profits through technology"
www.soapboxengage.com
Twittering at www.twitter.com/cozimek (@cozimek)

User avatar
phlux0r
Joomla! Guru
Joomla! Guru
Posts: 812
Joined: Thu Feb 09, 2006 1:41 am
Location: Auckland, NZ
Contact:

Re: AJAX-Framework in Joomla?

Post by phlux0r » Tue Feb 14, 2006 9:26 pm

I've been reading the Ajax posts with great interest as I'm planning on using this technology for the admin of a component I'll be writing. Now, here are my thoughts on this.

There seems to be a debate on whether to use an available Ajax library or a 'homegrown' one in the upcoming core. One argument to use an available lib is that 3P developers could start using the same lib now, with Joomla 1.0.x and hopefully the rework later would not be too bad. But if the core team decides to roll their own Ajax lib, then 3P developers would have to wait for it to be released in order to comply with it. Maybe this isn't such a big issue but I still think it would be nice (for the impatient, itching to use Ajax now) if we had certainty as soon as it is possible.

Just an idea.

Robert

User avatar
cozimek
Joomla! Guru
Joomla! Guru
Posts: 593
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC & San Francisco, CA
Contact:

Re: AJAX-Framework in Joomla?

Post by cozimek » Tue Feb 14, 2006 9:31 pm

Robert,

Good point.  My point of view is that Joomla, like all volunteer projects, is slow and deliberative...kind of like the US Senate.  When it makes decisions, they are strong and have been made with deep thought.  I don't think that AJAX really has had the scrutiny needed at this point, however, since it's so easy to package up a library, like XAJAX, and install in a Joomla site, it would seem to me that the 3PD community should just start building without waiting for the core to make a decision.  I know that Phil Taylor, for instance, has been strong on using AJAX in his Knowledgebase component, and I wonder what library he uses.  Obviously, he hasn't waited for the core to make a decision, and I don't think other 3PDs should wait either.

The community of 3PDs and their choices for an AJAX library will help the core make a better decision on which path to go in the future.  But for now, we should, as the 3PD community, just stick out necks out there and start coding. =)

Best,
Ryan
Soapbox Engage - "Empowering the missions of non-profits through technology"
www.soapboxengage.com
Twittering at www.twitter.com/cozimek (@cozimek)

User avatar
Vimes
Joomla! Ace
Joomla! Ace
Posts: 1684
Joined: Fri Aug 19, 2005 12:14 am
Location: United Kingdom
Contact:

Re: AJAX-Framework in Joomla?

Post by Vimes » Tue Feb 14, 2006 9:38 pm

I've been experimenting with Ajax functionality from ajaxtoolbox.com for Jombox and the thing that bothers me is that you've got to effectively write a backdoor into you component to let axaj communicate with the server. A simple hook that allows components access to the server in a secure yet flexible way would be a great weight off my mind.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.

User avatar
cozimek
Joomla! Guru
Joomla! Guru
Posts: 593
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC & San Francisco, CA
Contact:

Re: AJAX-Framework in Joomla?

Post by cozimek » Tue Feb 14, 2006 9:45 pm

Vimes wrote: I've been experimenting with Ajax functionality from ajaxtoolbox.com for Jombox and the thing that bothers me is that you've got to effectively write a backdoor into you component to let axaj communicate with the server. A simple hook that allows components access to the server in a secure yet flexible way would be a great weight off my mind.
Vimes,

Could you provide us with a little example as to what you do to get backdoor setup in your component to let AJAX communicate with the server?

Best,
Ryan
Soapbox Engage - "Empowering the missions of non-profits through technology"
www.soapboxengage.com
Twittering at www.twitter.com/cozimek (@cozimek)

User avatar
Vimes
Joomla! Ace
Joomla! Ace
Posts: 1684
Joined: Fri Aug 19, 2005 12:14 am
Location: United Kingdom
Contact:

Re: AJAX-Framework in Joomla?

Post by Vimes » Tue Feb 14, 2006 9:51 pm

I haven't had time to work on this for a few weeks, so this is by no means complete, or even well written. At the moment it's just proof of concept stuff for me. Below is some of the request handling file that gets called by the ajax in the patTemplate file:

Code: Select all


define( '_VALID_MOS', 1 );

// Handle ajax requests from the booking form
$abspath="/home/portal/public_html/aa/";

include_once( $abspath.'/globals.php' );
require_once( $abspath.'/configuration.php' );
require_once( $abspath.'/includes/joomla.php' );

$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
$sessioncookie  = mosGetParam( $_COOKIE, $sessionCookieName, null );
if( empty($_COOKIE['sessioncookie'])) 
	{
	$_COOKIE['sessioncookie'] = $sessioncookie;
	}
elseif( $_COOKIE['sessioncookie'] != $sessioncookie ) 
	{           
		$_COOKIE['sessioncookie'] = $sessioncookie;
	}
$cook = $_COOKIE['sessioncookie']; 
$cryptSessionID=md5($cook . $_SERVER['REMOTE_ADDR']);
$clientIP=$_SERVER['REMOTE_ADDR'];
$AjaxRequestUniqueId	= mosGetParam( $_GET, 'AjaxRequestUniqueId', null );
ajaudit($cryptSessionID,$AjaxRequestUniqueId,$clientIP);
$request= mosGetParam( $_GET, 'request', false );

//var_dump($request);

switch ($request)
	{
	case 'serviceID':
		//var_dump($_GET);
		$serviceid				= mosGetParam( $_GET, 'serviceid', null );
		$checked				= mosGetParam( $_GET, 'checked', null );
		if ($checked=="true") 
			{
			//echo $serviceid;
			$validDates=getServiceAvailabilityDates($serviceid);
			$allSlots=getServiceAvailabilityTimes($validDates,$serviceid);
			$validSlots=checkSlotAvailability($allSlots,$serviceid);
			}
		else
			$checked;
	break;
	default:
		//
	break;
	}
	

exit;


As you can see, there's nothing really to authenticate that the caller is actually the ajax script, so there's a function ajaudit which will log what was done, when and from what IP (easily spoofed, I know). I'm not convinced that all of this is particularly secure, so it's not actually going to get used, as is.
Last edited by Vimes on Tue Feb 14, 2006 9:55 pm, edited 1 time in total.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.

unclepete
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 105
Joined: Sun Aug 28, 2005 8:50 am

Re: AJAX-Framework in Joomla?

Post by unclepete » Tue Feb 14, 2006 9:57 pm

phlux0r wrote: I've been reading the Ajax posts with great interest as I'm planning on using this technology for the admin of a component I'll be writing. Now, here are my thoughts on this.

There seems to be a debate on whether to use an available Ajax library or a 'homegrown' one in the upcoming core. One argument to use an available lib is that 3P developers could start using the same lib now, with Joomla 1.0.x and hopefully the rework later would not be too bad. But if the core team decides to roll their own Ajax lib, then 3P developers would have to wait for it to be released in order to comply with it. Maybe this isn't such a big issue but I still think it would be nice (for the impatient, itching to use Ajax now) if we had certainty as soon as it is possible.

Just an idea.

Robert
I agree with Robert on the choice of AJAX library (or any external library used in Joomla!). While it is easy to "bundle up a library", I don't like the idea of several libraries being installed on my Joomla! implementation all doing the same thing because of possible conflicts and inconsistencies.

If the core team could choose an approach that will be used, even if work hasn't started, then the community will be much better off by having a consistent product with a smaller footprint.

Pete

User avatar
Vimes
Joomla! Ace
Joomla! Ace
Posts: 1684
Joined: Fri Aug 19, 2005 12:14 am
Location: United Kingdom
Contact:

Re: AJAX-Framework in Joomla?

Post by Vimes » Tue Feb 14, 2006 10:01 pm

OTOH, you don't want them rushing in, making a rash decision for which they'll be lambasted evermore.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1217
Joined: Sat Aug 20, 2005 12:32 pm
Location: Jersey, Channel Islands
Contact:

Re: AJAX-Framework in Joomla?

Post by PhilTaylor-Prazgod » Tue Feb 14, 2006 10:03 pm

cozimek wrote: Robert,

Good point.  My point of view is that Joomla, like all volunteer projects, is slow and deliberative...kind of like the US Senate.  When it makes decisions, they are strong and have been made with deep thought.  I don't think that AJAX really has had the scrutiny needed at this point, however, since it's so easy to package up a library, like XAJAX, and install in a Joomla site, it would seem to me that the 3PD community should just start building without waiting for the core to make a decision.  I know that Phil Taylor, for instance, has been strong on using AJAX in his Knowledgebase component, and I wonder what library he uses.  Obviously, he hasn't waited for the core to make a decision, and I don't think other 3PDs should wait either.

The community of 3PDs and their choices for an AJAX library will help the core make a better decision on which path to go in the future.  But for now, we should, as the 3PD community, just stick out necks out there and start coding. =)

Best,
Ryan
mosKnowledgebase uses xAJAX for all the ajax stuff, prototype for some things and scripuloious for the fancy graphics.

mosKnowledgebas has already got great support for re-ordering, publish/unpublish, delete, filter, page navigaton/pagination, apply and a whole host of other functions that are generic for lists of content/articles.

One problem with adding AJAX to Joomla is that it needs to be done in such a way that it is extensible by 3PD easily.  at the moment none of the ajax solutions presented in this tread (including xajax) provide a way to do this simply.

The problem with the Core of Joomla playing catchup is that it affects excellent work done by 3PD - for example, phpMailer was first included in Phil-a-form well before it was added to Joomla/Mambo core (By me !) and when I added it to the core of mambo I had to go back and rewrite whole parts Phil-a-form. 

Plugin editors are another issue, when a 3PD Component works perfectly and then the user installs a buggy JS editor and blames the 3PD when it doesnt work in their component. 

another example is Mambots, were specifically created to provide ComboMAX an interface to the content item (Thats right, without my 3PD work mambots may have not come!),

What ever work is done with AJAX should be extensible completly by 3PD in order to not be a pain in the backside.  xAJAX has a printjavascript function that has to be called only once and prints JS for all the function calls, if Joomla has already done this before 3PD Components add their functions then xAJAX cannot be extended by 3PD.

The whole AJAX in Joomla Core is not a topic or subject to be taken lightly - it needs VERY CAREFUL thought and needs to have INDEPTH CONSULTATION with 3PD and others ALREADY USING this technology DAILY on how best to implement it correctly in order that you are adding value to Joomla and not simple closing doors to developers. (Like J1.1 has, closed doors, as none of my 10 top selling components work on J1.1. and need to be rewritten completly!)

I wish this thread was limited to those with REAL world experience in using AJAX technologies rather than well meaning developers, too much hype is a bad thing - its ok to say "lets implment ajax cause it will be great" and its another to sit down and plan an implmentation that provides real value for Joomla

Security is also a major concern of mine, Vimes has already posted above and alluded to his script doesnt check a user - wheas my mosKnowledgebase runs al AJAX requests through the full and complete session/user managerment of Joomla, therefre ensuring that they have the right rights ad session to process ajax requests in the background - everything is run through index.php rather than calling an independant ajax server file. - SECURITY LIKE THIS  IS A MUST FOR ANY AJAX IMPLMENTATION - and there is a lot of articles written on ajax security
Last edited by PhilTaylor-Prazgod on Tue Feb 14, 2006 10:13 pm, edited 1 time in total.
Phil Taylor
Founder, Lead Developer
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/ - My Twitter Streams

User avatar
Aristocrat
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Aug 18, 2005 5:50 am
Location: Vancouver, BC, Canada
Contact:

Re: AJAX-Framework in Joomla?

Post by Aristocrat » Tue Feb 14, 2006 10:04 pm

Hi Ryan,

ability to ( list(filter)/edit/publish(activate)/unpublish(deactivate)/delete/updateOrder ) an entity. An entity could be anything ( school, classroom, a user )

In fact that's what Joomla's back-end is. It is mainly a List Management area.

So once I come up with a reproducible approach for this list management many of the joomla component can be done in Ajax. Or at least the components I built!

Rastin
cozimek wrote:
Also, Rastin, what parts of the admin are you focusing on AJAXing?

Best,
Ryan
Rastin Mehr - Founder/Web Application Architect
http://www.rmdstudio.com - Social People Building Social Web Solutions ™
http://www.Anahitapolis.com - The Anahita Social Engine ™ project

User avatar
phlux0r
Joomla! Guru
Joomla! Guru
Posts: 812
Joined: Thu Feb 09, 2006 1:41 am
Location: Auckland, NZ
Contact:

Re: AJAX-Framework in Joomla?

Post by phlux0r » Tue Feb 14, 2006 10:13 pm

Ryan,
thanks for your reply and opinion. I too am confident that the Joomla team will make a thoughtful decision concerning Ajax, I guess that's why no one has jumped the gun yet and made a statement :).
cozimek wrote: The community of 3PDs and their choices for an AJAX library will help the core make a better decision on which path to go in the future.  But for now, we should, as the 3PD community, just stick out necks out there and start coding. =)
Ok, you have a point. I'm slowly trawling the 1.1 forum and gathering information on dev.joomla.org so I can make decisions based on the current developments. BTW, I just read a post by hackwar in the 1.1 forum that he reckons one (sh/c)ould start developing stuff with 1.1 alpha2 already. It's encouraging...

... just reading the follow-up posts while typing this. Phil's post has put another light onto this Ajax thing. It seems that Ajax support is definitely non-trivial and will depend on the actual implementation. In other words, one must proceed at his/her own peril.

Regards, Robert

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6569
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: AJAX-Framework in Joomla?

Post by Jinx » Tue Feb 14, 2006 10:21 pm

Hi guys,

AJAX has become a real hype indeed and is misunderstood by many. AJAX is not a thing u can smash into your code and expect magic will happen. AJAX is bascially a name for two technologies, DHTML (behavior library like moo.fx used in the Jooma 1.1  installation) and XMLlHTTPRequest object wrappers (like XAJAX used in the Joomla! 1.1 installation).  Both technologies have been out there for a long time, it's only since a year that peopla have been building 'sexy' applications with them and they have hit off into a hype.

As Phil clearly points out an implementation on the framework level isn't that easy. It seems the challenge lies in finding a KISS approach that works for Joomla! Not very easy taken the difference in skills levels between 3P developers especially when u add javascript to the mix things can get very interesting.

Once 1.1 hits beta I will be able to set some time apart and start a proof of concept project for an Joomla AJAX implementation. In the mean time please experiment with it and provide feedback. As Ryan states, that is how opensource works it's magic, don't wait until 'the core' makes it move, help them to make it by providing usefull feedback and guidance.

Enough, opensource pet talk  here are some resources u can start with : http://ajaxian.com/resources/

And these are the project i'm currently tracking  :

- http://wiki.xoad.org/index.php?title=Wiki_Home
- http://xajaxproject.org/
- http://dojotoolkit.org/

DOJO seems to be very promosing and getting wide support. It is being implemented in various opensource frameworks and CMS's. Certainly keeping my eye on that one.

I'll try to write up a blog post next week about my AJAX adventures for Joomla! In the mean time I Hope this helps.

Johan
Last edited by Jinx on Tue Feb 14, 2006 10:36 pm, edited 1 time in total.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1217
Joined: Sat Aug 20, 2005 12:32 pm
Location: Jersey, Channel Islands
Contact:

Re: AJAX-Framework in Joomla?

Post by PhilTaylor-Prazgod » Tue Feb 14, 2006 10:32 pm

Another very important point is that a lot of what people think is AJAX is actually just clever Javascript

For example, DOJO,
http://archive.dojotoolkit.org/nightly/ ... _wipe.html

That is an example of Javascript and not AJAX,

real AJAX is about sending XML to a server and receiving a reply, not about fancy things at all, that is javascript effects not AJAX.

AJAX should be used when you need to send and receive data from the server, like updating the publish/unpublish flag on content - and THEN  clever Javascript changes the content items X to a Tick, or in the case of deleting, removes the row in the table, or in the case of resetting hits, sets the hits span.innerHTML to 0

There is a misunderstanding around the web that AJAX and Javascript effects/DOM Manipulation are the same thing - they are not. 

Although you can use JS in AJAX to manipulate DOM and provide effects that is simply JS

from wikipedia:
The Ajax technique uses a combination of:

    * XHTML (or HTML) and CSS for marking up and styling information.
    * The DOM accessed with a client-side scripting language, especially ECMAScript implementations like JavaScript and JScript, to dynamically display and interact with the information presented
    * The XMLHttpRequest object to exchange data asynchronously with the web server. In some Ajax frameworks and in some situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server.
    * XML is commonly used as the format for transfering data, although any format will work, including preformatted HTML, plain text, JSON and even EBML.
A lot of libraries concentrate on JUST the AJAX stuff and leave the EFFECTs and DOM Manipulation to the developers own hand coded JS

I use a combination of xAJAX (For AJAX calls and DOM manipulation ONLY) and scriptilious (For the EFFECTS ONLY)

The reason i use xAJAX is that it allows BOTH AJAX function calling AND Dom manipulation, for example changing div.innerHTML values
Last edited by PhilTaylor-Prazgod on Tue Feb 14, 2006 10:35 pm, edited 1 time in total.
Phil Taylor
Founder, Lead Developer
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/ - My Twitter Streams

User avatar
cozimek
Joomla! Guru
Joomla! Guru
Posts: 593
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC & San Francisco, CA
Contact:

Re: AJAX-Framework in Joomla?

Post by cozimek » Tue Feb 14, 2006 11:48 pm

PhilTaylor-Prazgod wrote: I wish this thread was limited to those with REAL world experience in using AJAX technologies rather than well meaning developers, too much hype is a bad thing - its ok to say "lets implment ajax cause it will be great" and its another to sit down and plan an implmentation that provides real value for Joomla
Phil,

You're right, not all of us have your skillsets.  So, why not step up and just start your own thread for experts only?  You are a self-proclaimed catalyst for other Joomla core code, why not here?

-Ryan
Soapbox Engage - "Empowering the missions of non-profits through technology"
www.soapboxengage.com
Twittering at www.twitter.com/cozimek (@cozimek)

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1217
Joined: Sat Aug 20, 2005 12:32 pm
Location: Jersey, Channel Islands
Contact:

Re: AJAX-Framework in Joomla?

Post by PhilTaylor-Prazgod » Wed Feb 15, 2006 12:00 am

My time for writing core code is over.

My involvement in the core is not going to happen again as it raises all kinds of flames from people saying things like "Joomla core doesnt have commenting because core developer Phil Taylor sells a commercial commenting solution" - they say it currently about Emir Saka and SEF and those that have been around the Joomla/mambo community long enough will remember all the hassle I had over peoples "perceived" conflict of interests, although those close to the truth knew there was never any conflict of interest.  Many commercial developers make a living off open source. I bought my house selling Joomla Components, I bought my car and got married,  and next year I will have a baby - all financed by PHP development

The Bible says to stay "beyond reproach in everything" and this is a good tip - I dont want the core team fighting battles because of my involvement - I am happy to consult to the team (For free) and to provide as much advice from my experience as I can - but I dont think the core team need a trouble-magnet like myself writing code for them (Well not publically anyway)

For this reason, and this reason alone I have had NO INVOLVEMENT in the decisions made in J1.1, I have not been on the 3PD Advice team and I have given no input from my experience to te new J1.1 Development team. Its just not worth the flames, hassle, abusive emails and bad publicity. Not everyone on the internet are as nice as the guys in this thread :-)

Also you have to be "asked" to join the core team - I will never be "asked" for many reasons, including the one I have given.
Phil Taylor
Founder, Lead Developer
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/ - My Twitter Streams

User avatar
pollen8
Joomla! Explorer
Joomla! Explorer
Posts: 350
Joined: Wed Aug 17, 2005 10:32 pm
Location: la Rochelle - France
Contact:

Re: AJAX-Framework in Joomla?

Post by pollen8 » Wed Feb 15, 2006 8:31 am

Yahoo have just released a series of javascript widgets and ui tools -
http://developer.yahoo.net/yui/

Also can I add a comment on xajax 2 - in that now rather than simply being able to call php functions from javascript you can now call methods in objects, which streamlines greatly the iteraction between your php and javascript code.
aka

User avatar
Aristocrat
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Aug 18, 2005 5:50 am
Location: Vancouver, BC, Canada
Contact:

Re: AJAX-Framework in Joomla?

Post by Aristocrat » Wed Feb 15, 2006 7:37 pm

well xajax says that you need to call the $xajax->printJavascript()
in the head tags, but yesterday that I did 3 examples in Joomla I called that function on the beginning of the com_testing file and it worked fine !

I mean as long as it is before the GUI is formed, and a function at the end of the GUI can be called to initiate the GUI for the first time that screen loads.


It may sound silly and basic to ask this question. Why shouldn't we not be able to output the javascript in the body tag, and not necessarily in the head tag.

On the other hand I think Joomla 1.1.* has the right functions to declare javascript in the header tags.

Rastin

pollen8 wrote:
I'm pretty sure it was to do with being unable to add the correct code into the administrations site's head...?

Cheers
Rob
Rastin Mehr - Founder/Web Application Architect
http://www.rmdstudio.com - Social People Building Social Web Solutions ™
http://www.Anahitapolis.com - The Anahita Social Engine ™ project

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1217
Joined: Sat Aug 20, 2005 12:32 pm
Location: Jersey, Channel Islands
Contact:

Re: AJAX-Framework in Joomla?

Post by PhilTaylor-Prazgod » Wed Feb 15, 2006 7:49 pm

mosKnowledgebase calls the printjavascript in the body of the HTML DOM.  That is ok but what I was trying to say was think about this:

1. Joomla has xAJAX (Or another AJAX solution) It adds its functions and calls printjavascript
2. Component X loads in the bidy and repeats, adding functions and calling javascript

now you have a conflict - one will work and the other will not.

If xAJAX is used in Joomla...
What is needed is a registerFunction class like the mambots where instead of component X adding functions directory to $xajax object it adds them like mambots do to a functions array that J later uses to output the javascript for Joomla and All Components/modules that have registered functions as the page is generated.

The other problem then is inclusion of all the XAJAX server files (The files where the actual PHP functions are located)  xAJAX only allows you to specify ONE destination for te AJAX calls to go to - therefore again Joomla would need to have a way of routing incoming AJAX requests to either the Joomla AJAX PHP functions file or to a components/modules server file.
Phil Taylor
Founder, Lead Developer
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/ - My Twitter Streams

User avatar
pollen8
Joomla! Explorer
Joomla! Explorer
Posts: 350
Joined: Wed Aug 17, 2005 10:32 pm
Location: la Rochelle - France
Contact:

Re: AJAX-Framework in Joomla?

Post by pollen8 » Thu Feb 16, 2006 12:08 am

Aristocrat wrote: well xajax says that you need to call the $xajax->printJavascript()
in the head tags, but yesterday that I did 3 examples in Joomla I called that function on the beginning of the com_testing file and it worked fine !

Yeah - I got it working this week as well, so not sure why they say it has to go in the head :O
On the other hand I think Joomla 1.1.* has the right functions to declare javascript in the header tags.

Rastin

Yes, but when I wrote this 1.0 $mainframe->addcustomtag() wasn't working for the admin pages. I've not yet looked at it in 1.1 as I've been doing front end work only.
aka

User avatar
Aristocrat
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Aug 18, 2005 5:50 am
Location: Vancouver, BC, Canada
Contact:

Re: AJAX-Framework in Joomla?

Post by Aristocrat » Thu Feb 16, 2006 12:13 am

Well the API in 1.1.* looks different now. I think you need to look into the class document for that.

Rastin
Rastin Mehr - Founder/Web Application Architect
http://www.rmdstudio.com - Social People Building Social Web Solutions ™
http://www.Anahitapolis.com - The Anahita Social Engine ™ project

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6569
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: AJAX-Framework in Joomla?

Post by Jinx » Thu Feb 16, 2006 12:33 am

JDocument indeed. We have added full control f the page header. Methods :

- addScriptDeclaration
- addStyleDeclaration
- addStyleSheet
- addScript
- addHeadLink
- setMetaData
- unsetMetaData
- addCustomTag

U can have a look here to get an idea of the methods.

Have fun ;)
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
cozimek
Joomla! Guru
Joomla! Guru
Posts: 593
Joined: Thu Aug 18, 2005 1:27 pm
Location: Washington, DC & San Francisco, CA
Contact:

Re: AJAX-Framework in Joomla?

Post by cozimek » Thu Feb 16, 2006 12:43 am

Jinx wrote: JDocument indeed. We have added full control f the page header. Methods :
Jinx,

Holy flipping cow!  This is awesome!  I've really got to take a better look at JDocument.  I'm ready for this pinata full of goodies to break open for us developers in Joomla 1.1.

Best,
Ryan
Soapbox Engage - "Empowering the missions of non-profits through technology"
www.soapboxengage.com
Twittering at www.twitter.com/cozimek (@cozimek)

User avatar
pollen8
Joomla! Explorer
Joomla! Explorer
Posts: 350
Joined: Wed Aug 17, 2005 10:32 pm
Location: la Rochelle - France
Contact:

Re: AJAX-Framework in Joomla?

Post by pollen8 » Thu Feb 16, 2006 12:46 am

PhilTaylor-Prazgod wrote: mosKnowledgebase calls the printjavascript in the body of the HTML DOM.  That is ok but what I was trying to say was think about this:

1. Joomla has xAJAX (Or another AJAX solution) It adds its functions and calls printjavascript
2. Component X loads in the bidy and repeats, adding functions and calling javascript

now you have a conflict - one will work and the other will not.

If xAJAX is used in Joomla...
What is needed is a registerFunction class like the mambots where instead of component X adding functions directory to $xajax object it adds them like mambots do to a functions array that J later uses to output the javascript for Joomla and All Components/modules that have registered functions as the page is generated.

The other problem then is inclusion of all the XAJAX server files (The files where the actual PHP functions are located)  xAJAX only allows you to specify ONE destination for te AJAX calls to go to - therefore again Joomla would need to have a way of routing incoming AJAX requests to either the Joomla AJAX PHP functions file or to a components/modules server file.

All makes good sense Phil, and what your suggesting sounds like a good way forward.

have you see the  registerExternalFunction xajax function? I've not used it but this could be helpful in registering functions from different scripts.

I've also been able to create an xajax object in one class, pass that class's object to another object and attach events to the xajax object, e.g.

I have a shop object ($oShop), which contains my xajax object ($oXajax).

I then create a class for managing the display of a product ($oProductDisplay), within which I create a product object ($oProduct)

I pass $oShop to $oProductDisplay from within which i have this psudo code

Code: Select all

class productDisplay().....
function run(){
$this->_oShop->_oXajax->registerFunction(array("getStock", $oProduct, "x_getStockLevel"));
}
}
I *think* this demonstarates that you can pass an xajax object around, and register functions to it successfully, so the above example could be used to modify JDocument so you could register xajax functions via the JDocument object (yes Jinx I have been looking at it ;) in alls its glory :D)

So any component could do something like:

Code: Select all

$document = & $mainframe->getDocument();
$document->addXajaxFunction("getStock", $oProduct, "x_getStockLevel");
Rob
aka

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1217
Joined: Sat Aug 20, 2005 12:32 pm
Location: Jersey, Channel Islands
Contact:

Re: AJAX-Framework in Joomla?

Post by PhilTaylor-Prazgod » Thu Feb 16, 2006 12:51 am

Jinx wrote: JDocument indeed. We have added full control f the page header. Methods :

- addScriptDeclaration
- addStyleDeclaration
- addStyleSheet
- addScript
- addHeadLink
- setMetaData
- unsetMetaData
- addCustomTag

U can have a look here to get an idea of the methods.

Have fun ;)

Can you confirm if this applies to administrator as well as frontend ???

for too long things like this were implemented on the frontend and not the backend - therefore you could not manipulate head/title etc in admin - can you use Jdoc in admin (Not had time to read the api docs sorry)
Phil Taylor
Founder, Lead Developer
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/ - My Twitter Streams

User avatar
Aristocrat
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Aug 18, 2005 5:50 am
Location: Vancouver, BC, Canada
Contact:

Re: AJAX-Framework in Joomla?

Post by Aristocrat » Thu Feb 16, 2006 12:58 am

Oh it better be.

I think the API should be equally available to both front end and back-end. Two of the projects I've done in the last year, I recreated the Administration interface for the front end users as well.

Rastin
PhilTaylor-Prazgod wrote:
Can you confirm if this applies to administrator as well as frontend ???

for too long things like this were implemented on the frontend and not the backend - therefore you could not manipulate head/title etc in admin - can you use Jdoc in admin (Not had time to read the api docs sorry)
Rastin Mehr - Founder/Web Application Architect
http://www.rmdstudio.com - Social People Building Social Web Solutions ™
http://www.Anahitapolis.com - The Anahita Social Engine ™ project

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6569
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: AJAX-Framework in Joomla?

Post by Jinx » Thu Feb 16, 2006 1:12 am

If u guys would read the framework overview on the developer site u would know. For the lazy among u, here is an extract :

Joomla! 1.1 is a three tiered system. The bottom tier is the framework level and consists of the libraries and plugins (formerly known as mambots). The second tier is the application level and consists of the JApplication class. Currently there are three applications that ship with Joomla: JInstallation, JAdministrator and JSite. The application acts as the main controller for the page. The third tier is the extension level. This level is where all component, module, and template logic is executed and rendered.

See : http://dev.joomla.org/content/view/15/58/

This means that there is not difference between front and backend (they are called site and administrator now). Both are applications that are derived from the JApplication class and thus also make use of the full power of the framework. It's really that easy ;)
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

 

Locked

Return to “Joomla! 1.0 Coding”