Quote from: Eol at Feb 18, 2011, 02:18 PM
Quote from: uxello at Feb 18, 2011, 12:30 PM
If I comment out the regClientStartupScript in MG and hardcode the scripts into my head section before the jQuery call and use QM in noconflict mode then it all works. Though I don’t really want to have these MG scripts in every page even when the gallery is not being edited.
Couldn’t you use ManagerManager MaxiGallery Backend plugin, with custom (hardcoded) HTML in manageOuterTpl?
It works when you disable QM+ for document ID where BackendManager is set up...
yes, a good thought, I have used this one one or two sites. It just seems overkill to solve a simple issue and some clients would not welcome the radical change in interface, though I will slowly be move all to use the backend plugin at some point. One thing I did not like about the backend plugin was the save buttons for both the gallery and then the resource itself. It is just a little confusing for some. So I am working on a variation of this with a popup modal window for the maxigallery using the ManagerManager backend plugin together with fancybox... but that is another story!
I have now come up with a plugin to move the mootools scripts to the top of the head if they are found. I added it to a maxigallery plugin I already had that deletes the gallery folder when resources are purged (written by Dimitri Hiverda). The code I have created is here if anyone wants it. Just add to a plugin with ’OnWebPagePrerender’ checked :
$e = $modx->Event;
if ($e->name == 'OnWebPagePrerender') {
if ($_SESSION['mgrInternalKey']) {
global $modx;
$output = $modx->documentOutput; // get the parsed document
$pattern='~\<script type=\"text\/javascript\" src=\".*js\/mooSortables.js\"\>\<\/script\>~';
if ( preg_match($pattern, $output, $matches)) {
$output=preg_replace($pattern, '', $output);
$output = preg_replace('~(<head>)~i', '\1'.$matches[0], $output);
}
$pattern='~\<script type=\"text\/javascript\" src=\".*js\/draggableReorder.js\"\>\<\/script\>~';
if ( preg_match($pattern, $output, $matches)) {
$output=preg_replace($pattern, '', $output);
$output = preg_replace('~(<head>)~i', '\1'.$matches[0], $output);
}
$modx->documentOutput = $output;
}
}