We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    After learning from Jared Loman Creative (now there’s another great designer, it’s sheer pleasure to work with him on the sites he’s designed) to think a bit further outside the box than I usually do, I’ve taken Jot in a slightly different directions.

    For simple lists such as FAQs, employee bios, restaurant menus, anything where using resources and Ditto would just be overkill, but you still need some kind of input/management system, Jot works great. With just a couple niggly little shortcomings.

    So I hacked Jot a little bit (is a little bit hacked anything like a little bit pregnant?) to add a couple of missing features.

    I added two fields to the main jot_content table, ’category’ and ’position’.

    Let’s take ’category’ first. In a way, you can use the existing Jot tagid parameter to act as a category, but this totally separates items from each other. You can never mix-and-match items from these tagid categorizations. With this additional ’category’ field, and some additions to the core code, you can filter for one or multiple categories. With a select drop-down for categories in the form, you can assign a category to an item, so you only need the one Notes snippet call to create new items for all categories. And with the new &category=`cat1,cat2,cat3` parameter you can retrieve them easily.

    The ’position’ field was added so that you can use javascript drag-and-drop positioning scripts with Notes. I originally used a custom field for this, but custom fields are always stored as a string, which makes sorting by it when the value is a number problematic. 11 will come before 2 in such a case, unless you use convoluted queries to force the value into an integer. It was a lot easier to just add an integer field to the jot_content table. The ’parent’ field can be used in Jot, since it’s not used for anything (I presume it was originally intended to allow threaded comments, but I’ve been there, done that, and know how quickly the complications of that mushroom into unmanageable proportions!) but a proper, specific field is a better way to deal with it.

    So, I’ve been using it quite happily for some time now, and thought it best to share it here first, so whoever is interested can beat on it and get back to me with whatever they find wrong or whatever other features they think should be added.

    As for instructions, it’s Jot. Nothing at all about the functionality of Jot has been changed. Only the two new features have been added.

    There is a How-to text file included with code for adding a javascript drag/drop positioning script, as well as how to add an image browser/upload/insert into the form. With this, adding one of the myriad jquery galleries would make a very simple image management feature.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 7231
      • 4,205 Posts
      Very cool, thanks for posting this. I will try it out and let you know how it works for me. 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]
        • 26931
        • 2,314 Posts
        thanks for sharing! smiley
          • 20413
          • 2,877 Posts
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 17883
            • 1,039 Posts
            Sounds cool. How is it supposed to be used? As a kind of frontend content management? So priviliged web users can submit/edit/sort content that is displayed in lists?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It’s used EXACTLY like Jot (except for the category and position additions). Privileged web users can use it, or just logged-in Manager users. You need to specify a web group for editing permissions just to keep it from offering the form to everybody, but the web group you specify doesn’t have to really exist if you’re having manager users use it.

              Another way to use it would be to have an unpublished page for Managers to access with the form and the entire list, then on public pages call the snippet with the action property set to `comments` and filtered by category as desired.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 28100
                • 66 Posts
                This is really, cool ... I’ve been searching the forum and internet of something like this for the last 2 days. Having something like this which is near foolproof for site owners to add content so easily will be brilliant. smiley

                However I’m having a couple of problems, the first being the image browser is loading but the image is not being posted. I’m assuming I need to do something in relation to this:
                # The SetUrl function must have the id attribute of the input field 
                # to hold the image url.

                But I’m not sure what?


                The other problem is the JS for the dragable option doesn’t seem to be loading.

                • I created a new resource (no template) and added: [!saveOrder!]
                • Created a new snippet called saveOrder and added code
                • I’ve changed the $.post to the resource ID (in loadDragsort)

                The basic layout of that section of the webpage is:

                <div id="sortable">
                <ul id="one">
                <li id="1" class="notes-content">
                    <!-- Moderation Icon Section -->			 
                    <section class="notes-mod">
                    </section>	
                    <!-- End Moderation Icon Section -->
                    <h3 class="notes-subject">Subject text</h3>
                    <section class="notes-message">Message text</section>
                </li>
                <li id="3" class="notes-content">
                    <!-- Moderation Icon Section -->			 
                    <section class="notes-mod">
                    </section>	
                    <!-- End Moderation Icon Section -->
                    <h3 class="notes-subject">Subject text</h3>
                    <section class="notes-message">Message text</section>
                </li>
                </ul>
                <ul id="two">
                <li id="2" class="notes-content">
                    <!-- Moderation Icon Section -->			 
                    <section class="notes-mod">
                    </section>	
                    <!-- End Moderation Icon Section -->
                    <h3 class="notes-subject">Subject text</h3>
                    <section class="notes-message">Message text</section>
                </li>
                </ul>
                </div>


                Although it would be really cool to have the dragable option, the image function is exactly what I’ve been looking for so getting that to work would be super awesome. laugh
                  • 28100
                  • 66 Posts
                  *bump*

                  I’ve used the code as it was provided. I’d really like to have the image posting working but it isn’t happening and I’ve spent (literally) days searching the forums trying to find alternative solutions. If anyone has this working could you provide some pointers about what I should look at changing to get it working.

                  Many thanks!
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Can’t believe I missed this earlier Susan; very cool and thanks for sharing. Would make for a great FAQ manager with a few tweaks.
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 28100
                      • 66 Posts
                      OK well I got the drag feature working after I added the following to loadDragsort:
                      $modx->regClientStartupScript('assets/js/jquery-1.3.2.min.js');

                      The jquery.js had to be loaded before the dragsort.js else I got the errors that jQuery was undefined and "$" was not a valid function ... however I then had 2 jquery loads per page(or at least they were listed in the doc head).

                      But the resorted order doesn’t persist after page refresh.


                      And I still can’t get the images to be posted. Does the comments template need to be edited?