We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36602
    • 8 Posts
    The widget that shows the users most latest edits and creations is exactly what I need, but I'd also like it to include everything that other people have edited and/or created, but only from certain parents.

    I have no qualification in PHP.

    This is the code that generates the widgets that shows the recent resources the user has edited:
    <?php
    /**
     * @package modx
     * @subpackage dashboard
     */
    /**
     * Renders a grid of recently edited resources by the active user
     * 
     * @package modx
     * @subpackage dashboard
     */
    class modDashboardWidgetRecentlyEditedResources extends modDashboardWidgetInterface {
        public function render() {
            $this->modx->controller->addHtml('<script type="text/javascript">Ext.onReady(function() {
        MODx.load({
            xtype: "modx-grid-user-recent-resource"
            ,parent: "'.$this->modx->user->get('id').'"
            ,renderTo: "modx-grid-user-recent-resource"
        });
    });</script>');
    
            return $this->getFileChunk('dashboard/recentlyeditedresources.tpl');
        }
    }
    return 'modDashboardWidgetRecentlyEditedResources';

    It's fairly simple so I'm lead to believe that I could achieve what I want with little modification? If someone could help me out with this I'd be really thankful.
      • 27106
      • 147 Posts
      This is sadly beyond my current abilities too, but it would markedly increase the value of the dashboard for anyone who has less-skilled users editing content.
        David Walker
        Principal, Shorewalker DMS
        Phone: 03 8899 7790
        Mobile: 0407 133 020
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        This isn't so much a PHP question as it is a question for Ext JS... curious +1...
          • 3749
          • 24,544 Posts
          I can't find the code, but it should just take a minor tweak to the criteria in the code that gets the resources.


          ---------------------------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
          MODX info for everyone: http://bobsguides.com/modx.html
            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
            • 9207 ☆ A M B ☆
            • 2,475 Posts
            I think the code that does that is inside this file:
            ./manager/assets/modext/widgets/security/modx.grid.user.recent.resource.js

            So yeah, it's a Ext JS thing... the
            xtype: "modx-grid-user-recent-resource"
            bit corresponds to that particular Javascript file, which in turn defines the columns and such. That JS file is loaded by the ./manager/controllers/default/welcome.class.php

            $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/security/modx.grid.user.recent.resource.js');
            

            So the question is how to pass a similar JS construct an argument about page parents instead of the current user.
              • 37747
              • 50 Posts
              Nobody figured this out yet? I would love to see this as well.
                • 4172
                • 5,888 Posts
                does it need to be a dashboard-widget or would a CMP (Custom Manager Page) do it, too?
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 9207 ☆ A M B ☆
                  • 2,475 Posts
                  I've been adding some pages to the docs: http://rtfm.modx.com/display/revolution20/MODExt+Tutorials

                  But I confess, the lack of docs on manager controllers and built in "models" is frustrating.
                    • 37747
                    • 50 Posts
                    @Bruno17 - It would really have to be a dashboard widget. It's for a blog that I am building and my intention is that the blog editors really don't need to use the resource tree at all. They log in and on the dashboard all they see is a "Create blog post" button (this I added already) and a list of all the recently edited resources.

                    @Everett - Great work but I don't think I will be able to spend much time studying this stuff unfortunately.

                    The reason I want to do this in the first place is because of the inability to change the order of resources in the resource tree, although there is an option to do so I have never been able to get the resources in order of last published. For a blog that might have hundreds of posts this is very inconvenient. I have seen other solutions that create folders by year/month but I don't think this is ideal as it creates more clutter.
                      • 37747
                      • 50 Posts
                      @Bruno17 - Although this comment from you sounds interesting:
                      some times ago I made a CMP on basis of xdbedit to manage thousands of news in custom-tables.
                      its easy to filter and search on different criterias also by month, year, category, context or what not.
                      From here: https://forums.modx.com/thread/25134/better-date-based-resource-management#dis-post-128950

                      Do you have some demo/tutorial about this somewhere?