We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32847
    • 171 Posts
    It’s a great plugin wink

    Just a small change, for Summary, it seems to be a textarea so

    // Change the "Summary (Introtext)" to "Summary"
    $("inputtextarea[@name=introtext]").parents("td").prev("td").children("span.warning").empty().prepend("Summary / Teaser");
      • 7923
      • 4,213 Posts
      This should be added to the resource repository if it’s working alright..


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 30223
        • 1,010 Posts
        Quote from: sderuiter at Feb 20, 2007, 02:21 PM

        Could it be the case that this plugin works only on saved documents and not on new documents? The plugin gets loaded with OnDocFormRender with saved documents. However, when I create a new document, it doesn’t get loaded. Is there a separate event that is triggered for newly created documents?

        Thanks.

        The plugin checks if a valid template is set. If the template is set to [blank] this test fails and thus the plugin doesn’t do anything. Is your default template set to [blank] perhaps?
          • 27376
          • 576 Posts
          Excellent Plugin! This is just what I need to satisfy some of my clients as well!

          One issue, you should use [tt]$modx->config[’rb_base_url’][/tt] instead of ’/assets/’ since the latter will only work on sites where MODx is installed in the root folder.
            • 29635
            • 361 Posts
            Good point, sirlancelot.
            I’ll fix that and the other issues that have been brought up, then post in the repository. I’m really glad that this is useful to more people than just me.
              Need MODx Ecommerce? Try FoxyCart!
              • 26482
              • 138 Posts
              Quote from: TobyL at Feb 20, 2007, 05:36 PM

              The plugin checks if a valid template is set. If the template is set to [blank] this test fails and thus the plugin doesn’t do anything. Is your default template set to [blank] perhaps?

              No. A new document gets loaded with the correct (not blank) template pre-specified. Thanks.
                • 30223
                • 1,010 Posts
                Quote from: sderuiter at Feb 21, 2007, 03:22 AM

                No. A new document gets loaded with the correct (not blank) template pre-specified. Thanks.

                You are right,.. I’ve now noticed the same thing. The fun thing is to change the template as soon as you’ve started a new document. You’ll notice that when the page refreshes suddenly the fields are hidden as expected. It turns out that the $content[’template’] isn’t initialized to any value when you start a new document (when changing the template $content[’template’] get’s it’s value from a POST variable).

                Luckily a small change to the code can bring relieve. Besides the $content var there’s also a $default_template which happens to hold the id of the default template. Just what we need. So changing the first few lines of code of the plugin to this should improve things a little:

                <?php
                // Set variables
                global $content,$default_template;
                $template = isset($content['template']) ? $content['template'] : $default_template;
                ?>
                


                edit: Come to think of this, why is there a test for a template value at all? Other then making sure that the plugin only activates when you’re adding or editing a document instead of any of the other manager functions I can see no reason.. If that is the case it would be just as simple to look for the correct action:
                <?php
                if (($e->name == 'OnDocFormRender' && ($_REQUEST['a']==27 ||  $_REQUEST['a']==4) ){
                //----//
                }
                ?>
                
                  • 30223
                  • 1,010 Posts
                  Quote from: sirlancelot at Feb 20, 2007, 06:13 PM

                  One issue, you should use [tt]$modx->config[’rb_base_url’][/tt] instead of ’/assets/’ since the latter will only work on sites where MODx is installed in the root folder.

                  Should that not be [tt]$modx->config[’base_url’][/tt] ?? [tt]$modx->config[’rb_base_url’][/tt] is for the resource browser (is it not?) and that not is necessarily the same!
                    • 26482
                    • 138 Posts
                    Quote from: TobyL at Feb 21, 2007, 07:26 AM

                    Luckily a small change to the code can bring relieve. Besides the $content var there’s also a $default_template which happens to hold the id of the default template. Just what we need. So changing the first few lines of code of the plugin to this should improve things a little:

                    <?php
                    // Set variables
                    global $content,$default_template;
                    $template = isset($content['template']) ? $content['template'] : $default_template;
                    ?>
                    


                    Done. Works. Thank you!
                      • 27376
                      • 576 Posts
                      Quote from: TobyL at Feb 21, 2007, 07:45 AM

                      Should that not be [tt]$modx->config[’base_url’][/tt] ?? [tt]$modx->config[’rb_base_url’][/tt] is for the resource browser (is it not?) and that not is necessarily the same!
                      I thought it was the same seeing as the plugin is a "Resource" :-/ I hope I don’t have to rewrite all my scripts to fix this huh