<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>delusionworld blog &#187; MooTools</title>
	<atom:link href="http://www.delusionworld.com/category/mootools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.delusionworld.com</link>
	<description>my MooTools, TYPO3 and FLOW3 experiences</description>
	<lastBuildDate>Sun, 01 Nov 2009 11:57:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>use MooTools in TYPO3 with MPR</title>
		<link>http://www.delusionworld.com/mootools/use-mootools-in-typo3-with-mpr/</link>
		<comments>http://www.delusionworld.com/mootools/use-mootools-in-typo3-with-mpr/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 22:23:54 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[TYPO3]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=128</guid>
		<description><![CDATA[Finally I can present you the combination of my two favorite Open Source Worlds. Meaning MooTools and TYPO3.
MPM comes with a nice TYPO3 Mod where you can look through all the currently installed MooTools Packages with Demos, Doku, Search&#8230; all you need to get it working quite fast 

So let&#8217;s talk about the reason&#8230; I [...]]]></description>
			<content:encoded><![CDATA[<p>Finally I can present you the combination of my two favorite Open Source Worlds. Meaning <strong>MooTools </strong>and <strong>TYPO3</strong>.</p>
<p>MPM comes with a nice TYPO3 Mod where you can look through all the currently installed MooTools Packages with Demos, Doku, Search&#8230; all you need to get it working quite fast <img src='http://www.delusionworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://www.delusionworld.com/wp-content/uploads/2009/07/MPRinTYPO3.png"><img src="http://www.delusionworld.com/wp-content/uploads/2009/07/MPRinTYPO3-300x189.png" alt="MPRinTYPO3" title="MPRinTYPO3" width="300" height="189" class="alignleft size-medium wp-image-138" style="border: 4px solid #eee;" /></a></p>
<p>So let&#8217;s talk about the <strong>reason</strong>&#8230; I mean I&#8217;m a pretty lazy guy. I don&#8217;t like to do stuff manually if there is any possibility to do it with some sort of automatism. And working on a big TYPO3 site with <strong>multiple MooTools Plugins</strong> can be quite a <strong>pain in the ass</strong>. Every Plugins has it&#8217;s <strong>own MooTools version</strong> and tries to include it. They (usually) don&#8217;t share a common library or don&#8217;t want to require other extensions. I can understand that but it makes my life sometimes harder&#8230; and that&#8217;s something I don&#8217;t like.</p>
<p>So here we come <strong>MPR </strong>as an <strong>TYPO3 extension</strong>. Using MooTools whenever you want to &#8211; no need to think about dependencies or graphics and that stuff.</p>
<div style="background: #eee; font-size: 10px; padding: 5px;">First I wanna say I don&#8217;t want to offend the authors of rgsmoothscroll &#8211; back then it was the best/only way to include MooTools stuff, but now with good use of MPR it could be much easier.</div>
<p>Let&#8217;s see a simple <strong>example</strong>. Maybe you know the extension <strong>rgsmoothscroll </strong>it gives you the smooth scrolling experience for anchor links within one page. It uses the Plugin SmoothScroll (now <strong>Fx.SmoothScroll</strong>) from MooTools More. You can seen an example of it at the <a href="http://mpm.mooforum.net/Mpm.php?mode=demo&#038;file=../mpr/More/Fx/Demos/Fx.SmoothScroll.html">MPR demo page</a> or in your TYPO3 BE Mod (see Screenshot above). Now let&#8217;s take a small look at some of the files in this extension<br />
<em>ext_localconf.php</em> [1 KB] &#8211; register plugin<br />
<em>ext_tables.php</em> [1 KB] &#8211; register statics<br />
<em>res/mootools-1.11.js</em> [21 KB] &#8211; compressed MooTools 1.11<br />
<em>static/constants.txt</em> [1 KB] &#8211; statics for transition, mode, duration, fps<br />
<em>static/setup.txt</em> [1 KB] &#8211; set options from constants and insert plugin on page.91<br />
<em>pi1/class.tx_rgsmoothscroll_pi1.php</em> [4 KB]</p>
<pre class="brush: javascript;">
// [...] could use EXT:t3mootools to build a costum core
// include necessary js
$header .=  '&lt;script type=&quot;text/javascript&quot; src=&quot;'.$this-&gt;getPath($this-&gt;conf['pathToMootools']).'&quot;&gt;&lt;/script&gt;';

$header .= '&lt;script type=&quot;text/javascript&quot;&gt;
	var Page = {
		initialize: function() {
			new SmoothScroll({
				transition: Fx.Transitions.'.$transition.',
				fps: '.intval($conf['fps']).',
				duration: '.intval($conf['duration']).'
			});
		}
	}
	window.addEvent(&quot;domready&quot;, Page.initialize);&lt;/script&gt;';

// include the js in the header
$GLOBALS['TSFE']-&gt;additionalHeaderData['rgsmoothscroll'] = $header;
</pre>
<p>So let&#8217;s explain this a little. First we need to <strong>get all the need JS</strong> this is a <strong>MooTools 1.11</strong> so if I want to use the <strong>MooTools 1.2</strong> features then I have a little problem as I would need to build my own MooTools version and I would need to check out what&#8217;s needed&#8230; it&#8217;s not real a problem but it&#8217;s rather <strong>cumbersome</strong>. I believe the <strong>extension </strong>itself <strong>should not need to care</strong> about the core or MooTools plugin. It should just say I need Smoothscroll and then use it. If the code get&#8217;s included on page render or loaded dynamically shouldn&#8217;t be it conserns. OK let&#8217;s go on &#8211; then we have the <strong>script block</strong> where it starts the <strong>SmoothScroll with all options</strong>. Again it work but it&#8217;s probably not the best way. I mean why give all options &#8211; they are <strong>already well set in the class</strong> itself and if there is another option added in the class you have to mirror it in your extension. Or let&#8217;s say an default value get&#8217;s changed because the funtion of the class is a little modified you would have to update the extension default also&#8230; <strong>doubling data isn&#8217;t good</strong> because you will always have to update at two places&#8230; So I believe options should only be set if you want it expliciply. By default it should use the class defaults and not it own default.</p>
<p>So now let&#8217;s give the &#8220;same&#8221; functionality but with the use of MPR.<br />
ext_localconf.php [1 KB]</p>
<pre class="brush: php;">
t3lib_extMgm::addTypoScript($_EXTKEY,'setup','
page.headerData.989 = TEXT
page.headerData.989.value (
	&lt;script type=&quot;text/javascript&quot;&gt;
		$require(\'Core/Utilities/DomReady.js\');
		$require(\'More/Fx/Fx.SmoothScroll.js\');

		window.addEvent(\'domready\', function() {
			new Fx.SmoothScroll();
		});
	&lt;/script&gt;
)
',43);
</pre>
<p>now what&#8217;s that just one file? yeah it&#8217;s all you need and in fact <strong>I wouldn&#8217;t create an extension for that</strong> but just for the sake of explaination. All we do is to add a script block somewhere on the page. In this block we say that we want to <strong>use </strong>the <strong>DomReady </strong>stuff and the <strong>SmoothScroll </strong>stuff. The we just start SmoothScroll with the default options. No need to care about any other js stuff. No need to include any core or any other css <strong>all </strong>the <strong>info</strong> is <strong>inside </strong>the &#8220;<strong>MooTools Packages</strong>&#8221; itself.<br />
One problem we have with this solution is that if you want to change some options for SmoothScroll you will have to rewrite the whole block&#8230; so I guess we need a <strong>different solution </strong>to the &#8220;<strong>map MooTools option into TS</strong>&#8221; problem&#8230; but more on this <strong>will follow</strong>&#8230;.</p>
<p>So now we see that with MPR it&#8217;s pretty simple to use plugins without even using any extension. Just write the script block prepare some html (if needed) and you are done. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/use-mootools-in-typo3-with-mpr/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>MPR has been split into MPR and MPM</title>
		<link>http://www.delusionworld.com/mootools/mpr-has-been-split-into-mpr-and-mpm/</link>
		<comments>http://www.delusionworld.com/mootools/mpr-has-been-split-into-mpr-and-mpm/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 21:52:19 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=123</guid>
		<description><![CDATA[It&#8217;s been quite a while. Honestly I didn&#8217;t had as much time for MooTools as I wanted. Nevertheless there has been some changes. The most important one is surely that MPR has been split into 2 separate Projects. It consists now of: 

MPR (MooTools Package Repository)
MPM (MooTools Package Manager)

The reason for this change lies in [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite a while. Honestly I didn&#8217;t had as much time for MooTools as I wanted. Nevertheless there has been some changes. The most important one is surely that MPR has been split into 2 separate Projects. It consists now of: </p>
<ul>
<li>MPR (MooTools Package Repository)</li>
<li>MPM (MooTools Package Manager)</li>
</ul>
<p>The reason for this change lies in the nature of a Package Repository. First you have the actual data (MPR), secondly you need some local Application to organize these data (MPM) and finally you need an online server (to be build) to store and order these files globally.</p>
<p>To reflect those changes the url got changed to: <a href="http://mpm.mooforum.net/Mpm.php">http://mpm.mooforum.net/Mpm.php</a></p>
<p>One other important reason for this change is that if you want to use MPR in an existing system like a CMS or a Blog System you most likely just want to write individual Manager for them (maybe based on MPM, but what if your CMS uses something else than PHP?) but MPR can always stay the same as it&#8217;s just the data. And by using a generic Package System you easily can distribute your Packages even between different Managers&#8230; (ok that&#8217;s a future dream but whatever who knows what the future brings.)</p>
<p>And what I&#8217;m currently doing is writing demos for MPR Mootools More as there are so many nice functions. I mean every time I look through the documentation or the code I find some nice new stuff. The only problem with that is by just looking at the text &#8211; it&#8217;s most of the time pretty hard to see what this code is really capable of. Without a good demo even the best code is nothing but just text to lazy people like me *hehe* I need some place to click around or see some stuff moving.</p>
<p>I mean a demo should show the most common usage of a function. I will try to do some blogging about my ongoing work&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/mpr-has-been-split-into-mpr-and-mpm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MooTools Plugin CanvasOverlay</title>
		<link>http://www.delusionworld.com/mootools/mootools-plugin-canvasoverlay/</link>
		<comments>http://www.delusionworld.com/mootools/mootools-plugin-canvasoverlay/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 11:18:59 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Imagemap]]></category>
		<category><![CDATA[MPR]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Repository]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=107</guid>
		<description><![CDATA[Uses canvas to dynamically create overlays (with fill, border, glow) for Images with imagemaps
MPR Demo
MPR Docu
it&#8217;s basically a jQuery port from:
http://davidlynch.org/js/maphilight/docs/
it doesn&#8217;t support IE as it doesn&#8217;t have canvas and I didn&#8217;t wanted to hack around with VML&#8230; :p
]]></description>
			<content:encoded><![CDATA[<p>Uses canvas to dynamically create overlays (with fill, border, glow) for Images with imagemaps</p>
<p><a href="http://mpr.mooforum.net/MprAdmin.php?mode=demo&#038;file=./Visual/CanvasOverlays/Demos/CanvasOverlays.html">MPR Demo</a><br />
<a href="http://mpr.mooforum.net/MprAdmin.php?mode=docu&#038;file=./Visual/CanvasOverlays/Docu/CanvasOverlays.md">MPR Docu</a></p>
<p>it&#8217;s basically a jQuery port from:<br />
<a href="http://davidlynch.org/js/maphilight/docs/">http://davidlynch.org/js/maphilight/docs/</a></p>
<p>it doesn&#8217;t support IE as it doesn&#8217;t have canvas and I didn&#8217;t wanted to hack around with VML&#8230; :p</p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/mootools-plugin-canvasoverlay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MPR Best Practice &#8211; Plugin MultiOverlays</title>
		<link>http://www.delusionworld.com/mootools/mpr-best-practice-plugin-multioverlays/</link>
		<comments>http://www.delusionworld.com/mootools/mpr-best-practice-plugin-multioverlays/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 13:04:44 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Milkbox]]></category>
		<category><![CDATA[MultiOverlays]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Repository]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=93</guid>
		<description><![CDATA[So now we have this local part of MPR to help us using MooTools Plugins. But howto create such Plugins and what should you use&#8230;
(bad) Examples
At first let me show you some examples why it&#8217;s not so easy currently to work with MooTools. I think the main reason is that it&#8217;s pretty hard to use [...]]]></description>
			<content:encoded><![CDATA[<p>So now we have this local part of MPR to help us using MooTools Plugins. But <strong>howto create</strong> such Plugins and what should you use&#8230;</p>
<h2>(bad) Examples</h2>
<p>At first let me show you some examples why it&#8217;s not so easy currently to work with MooTools. I think the main reason is that <strong>it&#8217;s pretty hard to use multiple files</strong> (js, css, img&#8230;) so people <strong>try to do everything in ONE file</strong>.</p>
<h3>Example <a href="http://mpr.mooforum.net/MprAdmin.php?mode=demo&#038;file=./Galleries/Milkbox/Demos/Milkbox.html">Milkbox</a>:</h3>
<p>Whenever you add it you will <strong>automatically add an Event to domready</strong> to create a milkbox with the default params&#8230; But what if I don&#8217;t want to use it on a page, I <strong>can&#8217;t easily disable it</strong> as I would <strong>need to edit the file</strong>.<br />
[don't get me wrong - milkbox is cool, I'm just saying it might be even better this way...]<br />
It would be nicer if separate in more files:</p>
<ul>
<li>Milkbox.js // class Milkbox &#8211; with the milkbox effect</li>
<li>Milkboxes.js // class Milkboxes &#8211; create multiple Milkboxes and has the logic for &#8220;galleries&#8221;</li>
<li>AutoMilkboxes.js // will require Milkboxes and will add it&#8217;s creation to the domready event</li>
</ul>
<p>With that now we can decide what we want to include. For the <strong>&#8220;basic&#8221; user</strong> its just $require( AutoMilkbox ); and people who know can decide if they either want one or multiple milkboxes. However as I said above <strong>using 3 files for one plugin</strong> without MPR is pretty inconvenient so people don&#8217;t do it. [and by inconvenient I mean <strong>it's freaking crazy</strong> to use 3 script tags for one little plugin - no no no; and yeah we all don't want to build our own script.json for each plugin... (little side kick to the devs..) :p]<br />
<strong>Now you can, just use MPR <img src='http://www.delusionworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<h3>Example <a href="http://www.clientcide.com/wiki/cnet-libraries/07-ui/11-waiter">clientcide Waiter</a>:</h3>
<p>[again, the waiter is cool, but it might be better this way]<br />
As you can see in it&#8217;s docs there if you have this &#8221; baseHref: &#8216;&#8230;&#8217; &#8221; which means that if you use the class the <strong>image will be by default loaded</strong> from this location: <a href="http://www.cnet.com/html/rb/assets/global/waiter/waiter.gif">http://www.cnet.com/html/rb/assets/global/waiter/waiter.gif</a> I think this is another &#8220;hack&#8221; around the <strong>MooTools policy</strong> &#8220;<em>don&#8217;t use more than one file in your Plugin</em>&#8221; *<em>hehe</em> offending people here&#8230;*.<br />
I mean what happens if this file gets forgotten? server upgrade &#8211; do we still need this waiter.gif? no, just delete it&#8230; :p ok that might be not the actual process but there is surely the<strong> possibility</strong> that <strong>this file will just vanish</strong> without a notice&#8230; why not deliver the file with the Plugin?<br />
It would gives me again a few benefits</p>
<ul>
<li>I can easily replace the image to my own (no need to change any js/css; just replace the file)</li>
<li>I can define/override the url in my css (if uses as background image) so again no need to change any javascript</li>
<li>What if I have multiple image files? I mean if I have a Plugin that uses some images from the cnet server; some from the plugin server; and some from my own server.. pretty hard to maintain right?</li>
</ul>
<h2>use of MPR within the Plugin <a href="http://mpr.mooforum.net/MprAdmin.php?mode=demo&#038;file=./Visual/MultiOverlays/Demos/MultiOverlays.html">MultiOverlays</a></h2>
<p>So now let&#8217;s take a closer look at a Plugin and a way I think it should be done. </p>
<h3>File MultiOverlay.js</h3>
<pre class="brush: javascript;">
$require(MPR.path + 'Core/Fx.Tween/Fx.Tween.js');
$require(MPR.path + 'More/Class.Occlude/Class.Occlude.js');
var MultiOverlay = new Class({
  ...
});
</pre>
<p>ok, here we define the <strong>requirements and the logic</strong> for one MultiOverlay. now if you want to use it I need to use it with an id and create the Class instance myself. If you know how it&#8217;s easy&#8230;</p>
<pre class="brush: javascript;">var myMultiOverlay = new MultiOverlay( $('imageWithId') );</pre>
<h3>File MultiOverlays.js</h3>
<p>this file is so short I will post it&#8217;s full code here&#8230;</p>
<pre class="brush: javascript;">
$require(MPR.path + 'Visual/MultiOverlays/MultiOverlay.js');
var MultiOverlays = new Class({
	multiOverlays: [],
	initialize: function(elements, options) {
		$$(elements).each( function(el) {
			this.multiOverlays.include( new MultiOverlay(el, options) );
		}, this);
	},
	getMultiOverlays: function() {
		return this.multiOverlays;
	}
});
</pre>
<p>So what do we get here, it just gives you the possibility to create <strong>Multiple MultiOverlay(s)</strong>&#8230; So now you can give the image(s) a class and for each image it will create a MultiOverlay instance which get&#8217;s saved in an array (if you may need it any time later&#8230;)</p>
<h3>File AutoMultiOverlays.js</h3>
<p>again such a short file&#8230; here is it&#8217;s code&#8230;</p>
<pre class="brush: javascript;">
$require(MPR.path + 'Visual/MultiOverlays/MultiOverlays.js');
var Auto = Auto || {};
window.addEvent('domready', function() {
	Auto.MultiOverlays = new MultiOverlays( '.MultiOverlay' );
});
</pre>
<p>basically it just creates a <strong>new MultiOverlays</strong> with a <strong>hard coded &#8220;default&#8221; value</strong>&#8230; so if you require this file you don&#8217;t need to write any javascript code at all, just give the CSS-class to your images and your done! <strong>It&#8217;s the easiest way you can do it&#8230; </strong>[here the value get's saved in the Auto variable as I might still want to use it later... the Auto variable is globally here]</p>
<h3>So why all this files?</h3>
<p>As I said above I think it&#8217;s vital to <strong>separate logic</strong> to where it belongs. And for me that means if I want to have a single MultiOverlay I should be able to. So the logic for Multiple MultiOverlays shouldn&#8217;t be in it, as it&#8217;s just more stuff I don&#8217;t need&#8230; :p<br />
And while we are at it, now that we need a Folder for it let&#8217;s add the <a href="http://mpr.mooforum.net/MprAdmin.php?mode=docu&#038;file=./Visual/MultiOverlays/Docu/MultiOverlays.md">Docu</a>. So now we got <strong>demos, docu, Resources</strong>(css, images) all in a single <a href="http://mpr.mooforum.net/MprAdmin.php?mode=zip&#038;file=Visual/MultiOverlays">Plugin Zip file</a>.<br />
It&#8217;s just <strong>easy to send</strong> it to someone and <strong>he get&#8217;s everything</strong> &#8211; I don&#8217;t need to explain what css image files he has to manually include&#8230; If you have a local MPR you can just <strong>install it in the admin area</strong>&#8230;.  (talking about easy&#8230; <img src='http://www.delusionworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>What do you want to hear next? more MPR best Pratice?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/mpr-best-practice-plugin-multioverlays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MPR</title>
		<link>http://www.delusionworld.com/mootools/mpr/</link>
		<comments>http://www.delusionworld.com/mootools/mpr/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 11:25:01 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[MPR]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Repository]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=87</guid>
		<description><![CDATA[I now finally have finished my first alpha for the local part of MPR. It should help you to use, create and share MooTools Plugins. For that it uses a well defined folder structure with defined filenames.
I guess I will create a screencast in the near feature&#8230;
for now just check out the demo:
http://mpr.mooforum.net/
(make sure to [...]]]></description>
			<content:encoded><![CDATA[<p>I now finally have finished my first alpha for the local part of MPR. It should help you to use, create and share MooTools Plugins. For that it uses a well defined folder structure with defined filenames.<br />
I guess I will create a screencast in the near feature&#8230;</p>
<p>for now just check out the demo:<br />
<a href="http://mpr.mooforum.net/">http://mpr.mooforum.net/</a><br />
(make sure to check out the search at the top right!) [no more missing search for docs... <img src='http://www.delusionworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ]</p>
<p>if you&#8217;re interested check out the git project:<br />
<a href="http://github.com/daKmoR/mpr/tree/master">http://github.com/daKmoR/mpr/tree/master</a></p>
<p>I will try to port quite some plugins to MPR (usually it only means finding out the requirements and probably writing some docs/specs&#8230;). With that I guess it should be much easier to use multiple plugins.</p>
<p>If you have a Plugin you want to be integrated just send me the zip file.<br />
If you want to see your Plugin inside MPR but you don&#8217;t know how &#8211; just let me know and I will try to help&#8230;</p>
<p>If you want to know more about MPR you can see/read stuff here:<br />
<a href="http://www.delusionworld.com/mootools/mpr-preparation-part-1/">http://www.delusionworld.com/mootools/mpr-preparation-part-1/</a><br />
<a href="http://www.delusionworld.com/mootools/mpr-preparation-part-2/">http://www.delusionworld.com/mootools/mpr-preparation-part-2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/mpr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>General MooTools UI</title>
		<link>http://www.delusionworld.com/mootools/general-mootools-ui/</link>
		<comments>http://www.delusionworld.com/mootools/general-mootools-ui/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 13:41:46 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[progressive Enhancement]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=65</guid>
		<description><![CDATA[While I was trying to fully utilize progressive Enhancement I had another idea. Why not separate functionality and layout even while writing javascript/MooTools. That way it would be far easier to create different layouts for the same functionality without the need to reproduce code. Again let&#8217;s just look at an example:
simple tabs (my favorite example&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>While I was trying to fully utilize progressive Enhancement I had another idea. Why not <strong>separate functionality and layout</strong> even while writing javascript/MooTools. That way it would be far easier to <strong>create different layouts for the same functionality</strong> without the need to reproduce code. Again let&#8217;s just look at an example:<br />
<a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-tabs.html">simple tabs</a> (my favorite example&#8230; :p)</p>
<pre class="brush: js;">
var myTabs = new FlowTabs.inline( $$('.FlowTabs &gt; h4'), $$('.FlowTabs &gt; div') );
</pre>
<p><em>If you look at the source you will find an &#8220;$require(&#8230;);&#8221; it&#8217;s just the same as including the file directly with script or link tag.</em> You can find more info about that in my previous posts about MPR. So what do we get with this code &#8211; <strong>It just gives us the functionality</strong> and looks pretty shitty, as only the necessary things are defined. Now let&#8217;s take at an example where we use the UI. <a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-ui-tabs.html">simple ui tabs</a></p>
<pre class="brush: js;">
UI.render('Plain');
</pre>
<p>So it looks now a little bit nicer, but that can all be done with CSS &#8211; and you are right as if we look at the source of the UI.Plain.Tabs it does nothing &#8211; it <strong>just includes 2 css files</strong>&#8230;.</p>
<pre class="brush: js;">
$require(MPR.path + 'Ui/Plain/Plain.js');

$require(MPR.path + 'Snippets/Css/Resources/clearfix.css');
$require(MPR.path + 'Ui/Plain/Resources/Plain.Tabs.css');

Ui.Plain.Tabs = new Class({
	Implements: [Options],
	options: {
	},

	initialize: function(options) {
		this.setOptions(options);
	}
});
</pre>
<p>How boring is that?!?! Seems like we <strong>need a little more complicated example</strong>. I guess most of you know the MochaUI &#8211; how about adopting some style from it&#8230;</p>
<h2>MochaUI Tabs</h2>
<p><a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-ui-tabs-mocha.html">mocha ui tabs</a></p>
<pre class="brush: js;">
$require(MPR.path + 'Ui/Mocha/Mocha.Tabs.js');
UI.render('Mocha');
</pre>
<p>only those 2 lines changed &#8211; we now load a different UI class and render a different theme called &#8216;Mocha&#8217;&#8230; so let&#8217;s look at it&#8217;s functions</p>
<pre class="brush: js;">
initialize: function(tabs, options) {
	this.setOptions(options);
	this.attach(tabs);
},

attach: function(tabs) {
	if ( $type(tabs) == 'string' ) tabs = $$(tabs);
	if ( $type(tabs) == 'element' ) tabs = [tabs];

	tabs.each( function(el) {
		var inside = new Element('span', { html: el.get('html') } );
		el.empty();
		el.grab(inside);
	}, this);
}
</pre>
<p>It&#8217;s again not really funny as it <strong>just creates an span inside every tab</strong> &#8211; we could have easily put this inside the &#8220;original&#8221; Tab Class. However what if the<strong> problem is a little bit more complex</strong> and the <strong>layout is also quite heavy on it&#8217;s own</strong>. Wouldn&#8217;t it be nice to separate these problems&#8230; Yeah I guess with just words you won&#8217;t believe me. So I will show you something more complex afterward.<br />
But for now <strong>let&#8217;s find out how the UI knows what theme to render and with which parameters</strong>. For that we need to look at the FlowTabs.inline.js file&#8230; at the bottom you will find:</p>
<pre class="brush: js;">
if ( typeof(UI) !== 'undefined' ) UI.registerClass({ 'Tabs': { 'param': '.ui-tab', 'name': 'FlowTabs.inline' } });
</pre>
<p>So what this does is basically it <strong>registers the FlowTabs Class as a Tabs Class</strong> with it&#8217;s default parameter and it&#8217;s name&#8230; Now when the UI is rendered it calls UI.<em>theme</em>.Tabs(<em>param</em>) and that&#8217;s exactly what we created earlier: &#8220;Ui.Mocha.Tabs = new Class({&#8221;</p>
<p>So let&#8217;s <strong>summaries this a little</strong>&#8230; until now it works like:</p>
<ul>
<li>create all Tabs + Content</li>
<li>call the UI Class that will look for predefined classes and it will modify the layout accordingly</li>
</ul>
<p>That&#8217;s pretty straight forward and in many situations this will work pretty well. <strong>However what about dynamically created tabs</strong> after the initial creation. I don&#8217;t know maybe loading with ajax or as a user populates some fields&#8230; So my FlowTabs class my support creating these Tabs on the fly but I somehow need to tell the UI that new Tabs are created and they need to be styled.</p>
<p>So now how do we do that:<br />
FlowTabs.inline.js in the attach function (creating of the tabs) we just fire an Event and give it some things to work with:</p>
<pre class="brush: js;">
this.fireEvent('onUiAttach', [el, j-1, content[i], this.tabsContainer]);
</pre>
<p>now what we need to do is use this onUiAttach Event. For that we just define this.options.refactor</p>
<pre class="brush: js;">
Ui.Mocha.Tabs = new Class({
	Implements: [Options],
	options: {
		refactor: {
			options: {
				onUiAttach: function(el, i) {
					if ( (typeof(UI) !== 'undefined') &amp;&amp; ( typeof(UI.Uis.Tabs) !== 'undefined' ) ) {
						UI.Uis.Tabs.attach( $(el) );
					}
				}
			}
		}
	},
</pre>
<p>If this is provided the <strong>UI will either refactor the class</strong> (if it hasn&#8217;t been instantiated) or it <strong>will set it options</strong> if the class has already been instantiated. [This doesn't seem to work currently - so note at the end]  To detect that we have another function in FlowTabs.inline that will be called on initialize:</p>
<pre class="brush: js;">
registerUi: function() {
	if ( typeof(UI) !== 'undefined' )
		UI.registerClass({ 'Tabs': { 'param': '.' + this.options.ui.tab['class'], 'name': 'FlowTabs.inline', 'class': this } });
}
</pre>
<p>it&#8217;s <strong>basically the same as the registration above</strong>, only that we now get the param from the option &#8211; this will help for example if we want to change the classes of the tabs; with that we don&#8217;t need to change them on the Tab creation script and on the Tab UI script&#8230; it will be automatically updated on the UI script. <strong>And we give the ui as &#8216;class&#8217; this</strong> (that&#8217;s pretty important!).</p>
<p>So now with all that it doesn&#8217;t matter when the UI [UI.render('Mocha');] is called as:</p>
<ul>
<li>If you call it at the beginning before all the tabs are created it basically does nothing except that it refactors every Class that it might need. So these classes then automatically do the right thing when the Event onUiAttach is fired.</li>
<li>If you call it at the end it will create all the necessary layout and set the options for every Class that&#8217;s registered so further elements that get attached get the layout automatically.</li>
</ul>
<p>I still prefer to call the UI at the and as it might need a little bit less performance. [so also note at the end]</p>
<h2>FlowWindows</h2>
<p>So now <strong>let&#8217;s go for an more complex example</strong>. Let&#8217;s talk about windows&#8230; I think there are quite a few implementations out there&#8230; MochaUI for example &#8211; it&#8217;s Window Class is really cool. However it&#8217;s also really really big. So what if I just want a little div to resize and drag around. <strong>I think functionality and UI should be separated</strong>. I mean now I needed to write my own class as I didn&#8217;t &#8220;wanted&#8221; to use a complex layout as MochaUI&#8230;. the functionality would be great but <strong>you can&#8217;t get MochaUI Window without the Layout</strong>&#8230;<br />
So basically that&#8217;s what I came up: <a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-windows.html">simple windows</a>. (I looked up some things at MochaUI window so it wasn&#8217;t that hard&#8230; :p)</p>
<p>If you look at it you see:</p>
<pre class="brush: js;">
$require(MPR.path + 'Windows/FlowWindows/FlowWindows.js');
[...]
var myWindows = new FlowWindows( $$('.FlowWindow &gt; h3')[0], $$('.FlowWindow &gt; div')[0] );
myWindows.attach( $$('.FlowWindow &gt; h3')[0], $$('.FlowWindow &gt; div')[0] );
</pre>
<p>So this just creates all the divs needed for all the handlers to resize, the header, the controlls&#8230; <strong>all you need for a nice window</strong>&#8230; but it&#8217;s ugly. yeah sure it&#8217;s<strong> just for functionality</strong> no UI at all. Now let&#8217;s get some UI &#8211; <a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-ui-windows.html">the plain UI</a> is not really something special (again no change with js &#8211; just css). To use it &#8211; there are just some small differences&#8230;</p>
<pre class="brush: js;">
$require(MPR.path + 'Ui/Plain/Plain.Full.js');
[...]
UI.render('Plain');
</pre>
<p>we include <strong>Plain.Full which will give me all available UI elements of Plain</strong> &#8211; currently Tabs and Windows. In the end we just need to start UI.render &#8230;</p>
<p>So now comes the nice stuff, if I want to just change the style of the Tabs and the Windows I <strong>don&#8217;t need to change any of the Functionality Classes</strong>. I just need to change the UI with:</p>
<pre class="brush: js;">
$require(MPR.path + 'Ui/Mocha/Mocha.Full.js');
[...]
UI.render('Mocha');
</pre>
<p>and we get <a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-ui-windows-mocha.html">Mocha Layout</a> for Tabs and Windows.</p>
<p>The<strong> Mocha.Windows is a little bit more complicated</strong> as it needed a Canvas which gets updated on every size change. But in the end it&#8217;s really flexible and the best thing is if you want to change the functionality you don&#8217;t have to think (to much) about they layout. Moreover this also works the other way around. It&#8217;s far easiere to create just the layout for a specific structure than to create all the functionality&#8230;</p>
<p>one other thing that might come in handy is that you can start the UI without any functionality classes&#8230;.<a href="http://www.delusionworld.com/files/general-mootools-ui/mootools-ui-only-mocha.html">Mocha UI only</a>. The html markup has to be created accordingly by a server scripting language or so&#8230; Starting the UI is again pretty simple</p>
<pre class="brush: js;">
$require(MPR.path + 'Ui/Mocha/Mocha.Full.js');
window.addEvent('domready', function() {

	//say we want to use the WindowsUI and the TabsUI
	UI.render('Mocha', {
		'Windows': {
			'param': '.ui-window'
		},
		'Tabs': {
			'param': '.ui-tab'
		}
	});

});
</pre>
<p>I currently can only think of one rule you need to follow (maybe I get some more ofer time&#8230;):</p>
<ul>
<li>include the UI classes always after the functionality classes</li>
</ul>
<p>Limitation:</p>
<ul>
<li>the setOptions method (if the UI is called at the end) only support options while with refactor you can override and define new functions.
</ul>
<h2>Note at the end:</h2>
<p>The setOptions doesn&#8217;t seem to work for subclasses if&#8230; yeah right if I knew that I would fix it, but for now the UI should be called at the top if you need some complex update functions like for MochaUI Window (for all the other stuff it also works at the end) [I guess the problem lies somewhere in between <a href="http://www.delusionworld.com/files/MPR/Ui/Ui.js">the UI - fireEvent('onUiInit');</a> and <a href="http://www.delusionworld.com/files/MPR/Ui/Mocha/Mocha.Windows.js">the UI.Mocha - this.options.refactor.options.onUiInit</a>. If you catch any error - I'm open for suggestions...]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/general-mootools-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MPR Preparation Part 2</title>
		<link>http://www.delusionworld.com/mootools/mpr-preparation-part-2/</link>
		<comments>http://www.delusionworld.com/mootools/mpr-preparation-part-2/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 00:38:13 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Screencast]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=16</guid>
		<description><![CDATA[As I promised here is the script to use your MooTools Plugin Repository even more sufficient. It&#8217;s all about easy handling. I want to use all the Plugin I have without including a lot of script, css tags in my header. With this php code it&#8217;s really easy to do it.
First pls see the Screencast [...]]]></description>
			<content:encoded><![CDATA[<p>As I promised here is the script to use your MooTools Plugin Repository even more sufficient. It&#8217;s all about easy handling. I want to use all the Plugin I have without including a lot of script, css tags in my header. With this php code it&#8217;s really easy to do it.</p>
<p>First pls see the Screencast <a href="http://screencast.com/t/gNj3SHhW">MPR Preparation Part 2</a>.</p>
<p>Here you can see how I like to work &#8211; never write to much code. So by using autoload and the php file you don&#8217;t need to care about any javascript or css. Once you are done with your work &#8211; you can easily just save the content you get from the php script and upload it, so you don&#8217;t need to autocreate this on your server &#8211; just upload ONE javascript file and ONE css file and you it will contain all your plugins relevant code (except for the images :p).</p>
<p>My next plans:</p>
<ul>
<li>create a demo page where you can just write js/html/css code and don&#8217;t need to worry about file inclusion (a little playground)</li>
<li>include a cache for the php script</li>
<li>include a lot more plugins</li>
<li>some other improvements for the script (find base tag, auto identify if the script is also used for css, &#8230;)</li>
</ul>
<p>If you wanna try the things you have seen in the Screencast just download <a href="http://www.delusionworld.com/wp-content/uploads/2009/02/mprpreperationpart2.zip">MPR.Preparation.Part2</a> extract it to a webserver (with php and curl) and look at the MPR.html.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/mpr-preparation-part-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MPR Preparation Part 1</title>
		<link>http://www.delusionworld.com/mootools/mpr-preparation-part-1/</link>
		<comments>http://www.delusionworld.com/mootools/mpr-preparation-part-1/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 10:54:27 +0000</pubDate>
		<dc:creator>daKmoR</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Screencast]]></category>

		<guid isPermaLink="false">http://www.delusionworld.com/?p=9</guid>
		<description><![CDATA[Some Time ago I had an idea on how to make using MooTools evan easier. Basically it&#8217;s about using a &#8220;convention&#8221; for Plugins (directory structur) and intraducing an function to autoload Code that&#8217;s mandatory.
This is about developing locally and not using it on the public server. For general use I will provide a Script that [...]]]></description>
			<content:encoded><![CDATA[<p>Some Time ago I had an idea on how to make using MooTools evan easier. Basically it&#8217;s about using a &#8220;convention&#8221; for Plugins (directory structur) and intraducing an function to autoload Code that&#8217;s mandatory.</p>
<p>This is about developing locally and not using it on the public server. For general use I will provide a Script that automatically generates ONE MooTools File to be included within you page.</p>
<p>To see how a local MooTools Plugin Repository could help you while developing you can see a short <a href="http://www.screencast.com/users/daKmoR/folders/Jing/media/0653e165-c2ef-4b0b-a176-c04891df8227">screencast</a>.</p>
<p>For more Information you can see the original Post on <a href="http://www.mooforum.net/general12/idea-easy-plugin-respository-t1085.html">MooForum</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.delusionworld.com/mootools/mpr-preparation-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
