/** * @name Hide Editor * @author Timon Reinhard <[email protected]> * Gildas <[email protected]> * * @license GNU General Public License * @version 0.3.3 - 12/11/08 * * @purpose Hides editor if active template contains no content var * Listens to event 'OnDocFormRender' * * @history [Gildas - 0.3.1 - 01/12/06] Replace setAttribute() by style.cssText for IE compatibility * [Gildas - 0.3.2 - 01/12/06] Add support for Template load via an "Include" snippet * [Xpix - 0.3.3 - 01/12/06] Changed it to use the default mootools.js(this should work for all versions. Works in IE6,IE7,Firefox) * * @install - Copy and paste the plugin code (without the begin/end PHP tags) * - Select the "OnDocFormRender" event * - If your templates are load via an "Include" snippet then add the folowing virtual parameter "content=true" * * @see http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html */ global $content; /* * Collect current MODx Event */ $e = &$modx->Event; /* * Check the Event and the document content */ if (($e->name == 'OnDocFormRender') && ($content['template'] > 0)) { /* * Load the document template */ if (($template = $modx->db->getValue("SELECT content FROM {$modx->db->config['table_prefix']}site_templates WHERE id = {$content['template']}")) !== false) { /* * Check for a "content" tag in the template */ if ((strpos($template, '[*content*]') === false) && (strpos($template, '[*#content*]') === false) && (strpos($template, 'content=true') === false)) { /* * Create the JS code to hide the "Document area" */ $output = '<!-- HideEditor Plugin -->'; //uncomment the line below if you just want to use JQuery version... if you have MM installed already then you don't need this. //$output.= '<script src=\'/assets/js/jquery/jquery-1.2.6.min.js\' type=\'text/javascript\' charset=\'utf-8\'></script>'; $output.= '<script type=\'text/javascript\'>'; $output.='$(document).ready(function() {'; $output.= '$(\'#ta\').parent().parent().hide();'; $output.= '$(\'#ta\').parent().parent().prev().hide();'; $output.= '});'; $output.= '</script>'; /* * Output the JS code */ $e->output($output); } } }
I think I found the issue but not sure, someone double check... "Do you have JQuery loading in the manager?" I have ManagerManager loaded which puts a link to JQuery in there and of course MooTools also uses the $() space, so there may be a conflict.
I’m going to simply rewrite the script to use JQuery for myself but this could be an issue for others....
Quote from: foniksonik at Dec 18, 2008, 12:44 PM
I think I found the issue but not sure, someone double check... "Do you have JQuery loading in the manager?" I have ManagerManager loaded which puts a link to JQuery in there and of course MooTools also uses the $() space, so there may be a conflict.
I’m going to simply rewrite the script to use JQuery for myself but this could be an issue for others....
I read somewhere that managerManager might do the same thing as hideEditor + the usual stuff. If true you don’t need hideEditor