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
-
☆ A M B ☆
- 24,524 Posts
Maybe a Dashboard widget would be better? You could make a custom Dashboard for your editor users.
@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
-
☆ A M B ☆
- 24,524 Posts
That's nice! And it works with CodeMirror, since it's a basic MODx file editor!
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.]
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
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
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.