Topic: extensions of xajaxIncludePlugin

Hi,

are there plans to make it possible to plugin user extended versions of xajaxIncludePlugin in a way it can be done with xajaxResponsePlugin extension? The reason for my question is, that I would like to inject some more js script when calling $xajax->printJavascript($sPath);

I'm thinking of an internal plugin manager array just like you did it for the ResponsePlugin. Calls to getJavascriptInclude() and getJavascriptConfig() could simply loop the array?

What do you think? Is it applicable? Do I miss something?

Thanks,
Ralf

Re: extensions of xajaxIncludePlugin

For the time being I think I can use:

    class myIncludePlugin extends xajaxDefaultIncludePlugin
    {
         function getJavascriptInclude($sJsURI='', $aJsFiles=array())
         {
             $html = parent::getJavascriptInclude($sJsURI, $aJsFiles);
             
            $defer = '';
            if (true === $this->_objXajax->getFlag('scriptDeferral'))
                $defer = 'defer ';
                
            $html .= "\t\t<script type='text/javascript' " . $defer . "charset='UTF-8'>\n";
            $html .= "\t\t/* <![CDATA[ */\n";
            $html .= "\n\t\t alert('my include');\n";
            $html .= "\t\t/* ]]> */\n";
            $html .= "\t\t</script>\n";
            return $html;
         }
    }

       function myInit()
       { 
           $pluginManager =& xajaxPluginManager::getInstance();
           $pluginManager->registerIncludePlugin(new myIncludePlugin());
       }

    $xajax = new xajax();
      myInit();  

....

Re: extensions of xajaxIncludePlugin

I'm just working on a similar feature.
I'd like to substitute the xajax javascript code in the header with a
<script src="xajax_declare.js"></script>
in order to better separate presentation and application logic.
At the present I've resolved with a simple hack of xajaxDefaultIncludePlugin
but I would like to implements it in the "right" way.

A solution is to extend the xajax class just to use a different include plugin,
but this seems to cumbersome to me (I think that a plugin has just to be plugged in).

I didn't find a clever way to accomplish this task, substitute the xajaxDefaultIncludePlugin.
Can be someone of help?

Eineki

Re: extensions of xajaxIncludePlugin

@Eineki
What about the workaround extending the xajaxDefaultIncludePlugin as I proposed above?
Isn't that applicable in your case?
ralf

Re: extensions of xajaxIncludePlugin

@CtC
What do you think about external supplied IncludePlugins? I would very much appreciate to get your opinion as a core developer.
Thank you!
Ralf

Re: extensions of xajaxIncludePlugin

@ralf
It works smile, I would prefer ther was a builtin method in the ajax object
(at the present you have to dig into the code to discover that the xajaxpluginmanager class
is a singleton used by xajax class).

Eineki

Re: extensions of xajaxIncludePlugin

@CtC

Now that you are back, I try it again wink.

Please have a look at my initial post.
What do you think about external supplied IncludePlugins? I would very much appreciate to get your opinion as a core developer.
Thank you!
Ralf

Re: extensions of xajaxIncludePlugin

Yes, I think the include plugin idea is valid and I believe that was the intent with the current design.  I'll have to take a closer look to see if it is already possible.

// Joe

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct