We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23018
    • 353 Posts
    I have a small list of files I have to edit quite often and I want to add a couple of links to the manager main menu.

    I want to open those files inside the manager in the same way as clicking that file inside the files tree.

    The right target urls would look like this:

    http://example.com/manager/?a=40&file=assets/templates/project/css/project.css&wctx=mgr&source=1
    http://example.com/manager/?a=40&file=assets/templates/project/css/project.js&wctx=mgr&source=1
    ...

    The idea is to have a new menu entry with a couple of children:

    Files:
    * edit project.css
    * edit project.js
    * ...

    From what I have learned so far the right way to do this would be to add some new items to the manager (System -> Actions). I studied the manual http://rtfm.modx.com/display/revolution20/Actions+and+Menus an a couple of other articles, but I couldn't find out how to do that.

    Any advice?

    Regards, pepebe

      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Maybe a Dashboard widget would be better? You could make a custom Dashboard for your editor users.
        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
        • 23018
        • 353 Posts
        @Sottwell: Thank you for reminding me to look up the dashboard functions.

        Yes the Dashboard may be a solution Didn't think about it at all as my mind was already set on tweaking the manager menu. It is really easy to patch some custom functionality together with its widget system.

        As I still have to load the dashboard whenever I want to edit a file it is still not fast enough.

        I'm sure it can be done with manager actions and a custom manager menu.

        Regards,

        pepebe
          Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
          • 6629
          • 60 Posts
          Just an image, as i'm too lazy to type it all wink

            • 28042 ☆ A M B ☆
            • 24,524 Posts
            That's nice! And it works with CodeMirror, since it's a basic MODx file editor!
              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
              • 3749
              • 24,544 Posts
              Got it! I tried to do it with a new namespace and $modx->sendRedirect() in an index.php file, which created an endless loop.

              Turns out, it's much simpler than that.

              Edit your file in the Manager and from the browser's address bar, copy the parameters (the part from the first & to the end).

              From here on, this is all done on the right side in System -> Actions:

              Go to System -> Actions

              Right-click on the Top Menu and select "Create Menu"

              Put a Name in the key field

              Add a description (optional)

              Paste the parameters you copied before into the parameters field

              In the Action dropdown, select: core - system/file/edit

              Save.

              Repeat for any other files you want to edit from the Top Menu.

              That's it.

              If you want, you can create a "Files" Top Menu item with no Action. Then create a series of subitems under it by right-clicking on the Files item and selecting "Place Action Here." Follow the steps above for each subitem.

              Should be worth a blog post, right? [ed. note: BobRay last edited this post 13 years, 5 months ago.]
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 23018
                • 353 Posts
                Awesome. Thats exactly what I wanted.

                Thanks to all contributors. I believe this is an extremly useful technique.

                You can also use it for editing other important resources:

                * contact info
                * articles resources
                * chunks

                For resources that are deeply located in the tree it is especially useful.

                Spread the word!

                Thanks you!

                pepebe
                  Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                  • 6629
                  • 60 Posts
                  Another nice feature of this is, that you can predefine some document-values in the action.
                  Let's say i have two containers which get frequently updated by the site editor:

                  Container 1: News (id 11), subresources use template "News" (id 22)
                  Container 2: Links (id 33), subresources are Weblinks

                  To create documents in these containers, i use two menu items:
                  Container 1:
                  
                  Key:         Post News
                  Action:      core - resource/create
                  Parameters:  &class_key=modDocument&parent=11&context_key=web&template=22
                  
                  

                  Container 2:
                  
                  Key:         Create new Link
                  Action:      core - resource/create
                  Parameters:  &class_key=modWebLink&parent=33&context_key=web
                  
                  


                    • 23018
                    • 353 Posts
                    I@Dasltsch have only one word for this: AWESOME! Thank you.

                    As I seem to have the right people here, I want to play some more with this concept.

                    Is it possible to add and remove such actions with a plugin?

                    I'm talking about bookmarks.

                    Lets say I add a new property to all resources that I have to update quite often.

                    New resource property: Bookmarked: 0 | 1

                    (I don't know it it is possible, to move the Bookmarked checkbox to the resource tab)

                    Next we need a plugin triggered by onDocFromSave. If that resource was bookmarked it is added to the list. If it is not bookmarked, but in the list, it is removed from that list. If the resource is deleted, it is also removed from the list.

                    How much processing time could that cost?

                    The bookmarklist could look like this:

                    Bookmarks (Header)
                    ------------------------
                    * Resources (Subheader)
                    ** Resource 1,
                    ** Resource 2

                    * Chunks (Subheader)
                    ** Chunk 1

                    * Snippets (Subheader)
                    ** Snippet 1

                    * Files (Subheader)
                    ** File 1


                    My MODX Manager Fu is too limited to make this happen. Is anyone out there to build this?

                    Regards,

                    pepebe
                      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                      • 3749
                      • 24,544 Posts
                      Processing is cheap in OnDocFormSave, since it doesn't affect page loads in the front end. I doubt if you would notice the difference in saving time. I don't really understand your idea, though, because Resources don't have properties. I think you would have to either co-opt an unused resource field or use a TV. Maybe I'm misunderstanding you.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting