We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    it would also be nice, if we could send an object_id with this media-stuff together with the source_id.
    This would make it easy to have object-specific or resource-specific dynamic mediasources.

    This hack is working for me for example:
    https://github.com/Bruno17/revolution/commit/b4704f23aa9a9ea973f29ba2361561ede56b7596

    Or should I play a bit with this stuff?
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 38290
      • 712 Posts
      Quote from: Bruno17 at Jun 25, 2013, 07:21 PM
      it would also be nice, if we could send an object_id with this media-stuff together with the source_id.
      This would make it easy to have object-specific or resource-specific dynamic mediasources.

      This hack is working for me for example:
      https://github.com/Bruno17/revolution/commit/b4704f23aa9a9ea973f29ba2361561ede56b7596

      Or should I play a bit with this stuff?

      Sounds really interesting but still trying to understand the use case or what something like that would look like. Not sure I follow how these mediasources would differ from typical ones.
        jpdevries
        • 4172
        • 5,888 Posts
        one example with resource-specific mediasources is this one:
        http://rtfm.modx.com/display/ADDON/MIGX.Use+resource-specific+media+source+and+multifile-uploader


        basepath and baseurl: [[migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]

        I have other configurations where I need object-specific-mediasources.
        for example, I have products and I want to have a image-directory for each product in a CMP.

        Then I use a snippet in the mediasource-pathes which figures the correct path for each product.

        For now I need to set a SESSION-var in my processor, which opens the update-window.
        This is not optimal.

        With my core-hack I linked above, I can send my object-id with each request in the file-browser and with image/file-TVs.

        This way I can get the object-id in a mediasource-snippet and can generate pathes like

        assets/productimages/PRODUCTID/

        I think it was my idea to make parsing snippet-tags possible in mediasource-pathes.
        Think most people don't know about this feature and how to use it.




          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 4172
          • 5,888 Posts
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 38290
            • 712 Posts
            Quote from: Bruno17 at Jun 25, 2013, 07:38 PM
            one example with resource-specific mediasources is this one:
            http://rtfm.modx.com/display/ADDON/MIGX.Use+resource-specific+media+source+and+multifile-uploader


            basepath and baseurl: [[migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]

            I have other configurations where I need object-specific-mediasources.
            for example, I have products and I want to have a image-directory for each product in a CMP.

            Sounds really useful to me. I will have to go through the tutorial, but it sounds like resource-specific media sources allow you to choose from locations other than a pre-defined media source and are meant to be used when editing Resources with Template Variables.



              jpdevries
              • 4172
              • 5,888 Posts
              in this case, when editing a resource we can get the resource-id from $_SERVER['HTTP_REFERER']

                      // We do this to read the &id param from an Ajax request
                      $parsedUrl = parse_url($_SERVER['HTTP_REFERER']);
                      parse_str($parsedUrl['query'], $parsedQuery);
              
                      if (isset($parsedQuery['amp;id'])) {
                          $docid = (int)$parsedQuery['amp;id'];
                      } elseif (isset($parsedQuery['id'])) {
                          $docid = (int)$parsedQuery['id'];
                      }


              but in other situations this is not possible.

              another example:

              I'm using this core-hack above in a MIGXdb-CMP where the client can edit user-specific images.
              Each user has his own media-directory and the client(admin) can load the modx-filebrowser, which opens to the user-files, when clicking a button in the user-grid.
              [ed. note: Bruno17 last edited this post 10 years, 10 months ago.]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 38290
                • 712 Posts
                Quote from: Bruno17 at Jun 25, 2013, 08:20 PM

                I'm using this core-hack above in a MIGXdb-CMP where the client can edit user-specific images.
                Each user has his own media-directory and the user can open the modx-filebrowser, which opens to the user-files, when clicking a button in the user-grid.

                Cool. I believe I've done something similar, but by creating the needed Media Source and setting a default media source setting for each user. If all you are doing is changing a path though, requiring creating a Media Source just for that does seem overkill. Which is one reason your solution sounds nice.
                  jpdevries
                  • 4172
                  • 5,888 Posts
                  we would had need to create 10000's of mediasources, if we wanted to have a mediasource for each user.
                  They have only access from frontend to their files with elFinder, which I have also bound to this dynamic mediasource.
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 46654
                    • 14 Posts
                    For me after using ModX in production for a few months would be:

                    1. Make/Adopt a more clear package management system that can be run in command prompt or in the modx install.
                    If I could throw up a gemfile/composer.json-esque file into a folder and scaffold my modx directory with a 'modx install' (or composer update) that updates all extras (and fresh install ModX) directly from github, I'd be the happiest camper; It would allow us to stay up to date without having to deploy a dev server for a bash script git fiasco to pull and relocate files.

                    My biggest complain with ModX is the inability to bootstrap it for instant setup, while also being able to version control the entire process through git (this includes chunks and snippets) before launch. It might not be everyone's workflow, but I believe a separation between web files and content is just as important as the separation between model and view.

                    I personally think there's a lot for all cms's/frameworks to learn from rails, but the biggest problem is everyone is trying to be so much LIKE rails they forget about what was good about their own platform. If the modx developers could figure out what are the most commonly used features, and develop ways to scaffold these features quickly without forcing styling and coding limitations like many of the current Extras do, things would be so much easier! This is a topic for another discussion of course tongue

                    With that said, and it might make me sound like a hypocrite, but I really love the package manager. Post deployment, I've definitely seen my fair share of use out of it. Keeping this is a must!

                    2. Rethink Extras. I have been tempted to contribute my custom extras, but it's really just too complicated to quickly deploy an additional set of features while being organized doing so! Many of the potential code for extras I write end up being so hacked/mashed into the Modx tree that It would take too long for me to reorganize and extract it into a package (while maintaining my normal busy workflow in and out of work). If new features felt like they were intended to be more modular, extracting potential extra packages would be more bearable. (For instance, if there was an extras menu that was populated by creating a 'new package' in modx that you could start scaffolding the CP and your view, that would be amazing.) Because of this it also makes it really hard to contribute to other peoples extra code because you usually end up having to look through many files to try to tie which chunk from a chunk belongs to which chunk that calls which snippet's chunk. Issue tracking on github for modx projects was a good start, but pulling directly from and scaffolding git repos (master or whichever branch we want) is a necessity.

                    At least some sort of default differentiation between site elements and feature elements would be good. We currently have folders for sorting, but it gets tangled pretty quickly. Chunks are too good! The idea of creating a new "modx extra", it be seperated from the site chunks, and an easier front-end development for related fields would be amazing.

                    3. I've been making great use out of migxdb; I really do think MIGXDB needs to be implemented into the core of 3 with a much better UX/UI (no offense bruno, I love you for your work.) I'm honestly using it more and more for every project because it can solve so many issues. If we could scaffold a MIGXDB with a custom CP faster using a GUI and a db model thats more flexible and automated, that would save so much time in development, and allow more rapid feature development for clients. Some other CMS's are implementing this as a "Gridfield", but they're rediculously hard to implement even for an intermediate programmer...

                    4. ExtJS. sad

                    Too long didn't read version:

                    1. Git based package management like composer/rubygems using json/gemfile type setup (can be used to install modx core files from repo).

                    2. Better direction on extras, making them more modular(file-side) and in a seperate, but visible location in modx for easier editing and development. If extras could automate use of migxdb for their purposes, the masses that hate manipulating SQL (including myself) would be more apt to write new extras. If i could think about databases like excel spreadsheets, and modify their properties like so, developing db-driven extras that dont have stringent requirements for datatypes (or even with them) would be cake.

                    3. Add MIGXDB/MIGXTV's (old migx) to CORE with enhance UX/UI for rapid developement of (detached-feeling) alien tables for non-cms tabular content.

                    4. ExtJS sad

                    Keep up the good work!
                    I hope to contribute in the future. (might take my hand at the 2.3 UI redevelopment.)
                    • Quote from: eein!! at Feb 21, 2014, 06:40 AM

                      3. I've been making great use out of migxdb; I really do think MIGXDB needs to be implemented into the core of 3 with a much better UX/UI (no offense bruno, I love you for your work.) I'm honestly using it more and more for every project because it can solve so many issues. If we could scaffold a MIGXDB with a custom CP faster using a GUI and a db model thats more flexible and automated, that would save so much time in development, and allow more rapid feature development for clients. Some other CMS's are implementing this as a "Gridfield", but they're rediculously hard to implement even for an intermediate programmer...

                      Couldn't agree more with this!! MIGX has been one of the best parts of MODX in terms of flexibility. Even non-programmers like myself can use it and use it well.
                        Woodlands Ad Agency
                        Our blog should NOT be read by anyone....EVER http://woodlandsadagency.com/blog/
                        ...Don't say we didn't warn you.