We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31961
    • 23 Posts
    embarrassingly i left them in there! doh!

    really glad this plugin is working again - makes the manager so easier to work with.

    thanks!
      • 5340
      • 1,624 Posts
      it says it in the installation instructions smiley
        • 9941
        • 65 Posts
        I’m getting an error:

        $("ta").getParent is not a function...

        just FYI in ModX 9.6.2
          • 9941
          • 65 Posts
          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....
            • 7231
            • 4,205 Posts
            Someone reported this recently as well. Please let us know when you have a jQuery version grin
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 9941
              • 65 Posts
              Here is a JQuery version of this.... ;-p


              /**
               * @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);
                      }
                  }
              }
              
                • 5340
                • 1,624 Posts
                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
                  • 9941
                  • 65 Posts
                  Oh also, I was getting errors with a "packed" version of Jquery, so YMMV but be warned... I’m using the minified version instead.... seems that there were conflicts with a MooTools function or some such wierdness.

                  Finally I used the hide() shortcut, rather than setting css display: none (but it does the same thing... if you inspect the code you’ll see).

                  Enjoy.

                    • 5340
                    • 1,624 Posts
                    Also,

                    Since mootools is used by the modx manager shouldn’t ManagerManager come with a no conflict jquery version?
                      • 9941
                      • 65 Posts
                      Quote from: xpix at Dec 18, 2008, 01:16 PM

                      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


                      Yes you can do it in MM if you specify template IDs in the config but this is much nicer as it just does it automatically for you and you don’t have to create extra configs based on templates.

                      Personally I use MM for hiding things based on user role not template, so to each his/her own.