We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33968
    • 863 Posts
    Apologies if these have been addressed already, but I've only recently been able to sink my teeth into Revo 2.2 and I have a couple of queries about Static Elements:

    1) If an element is marked as 'static' but some code is left in the snippet code field, is that ignored or does that override the static code? Or is it a fallback if the static element is unavailable?

    2) I marked a snippet as static, selected a media source I had created (pointing to core/components/ ) and then went to select the static file path from the Static File select box. I expected the browser to open in the core/components/ folder as set by my media source, but it actually opened at the root. I again selected my core/components/ media source from within the browser, selected my snippet, but noticed the full root path was selected rather than the path relative to the media source. The snippet did not run as it was prefixing the media source path, resulting in core/components/core/components/snippet/path. Am I looking at a bug? If not, I don't understand the point of the Media Source field if the file browser does not take the media source path into account...

    3) I used to configure some CMP panels with a minimum basePath (xtype: 'modx-combo-browser') so that they would always open at a specific minimum folder. For example, a currently logged in user could upload their images to their own folder in 'assets/uploads/user1/'. They would not be able to navigate below that folder. After upgrading to 2.2, all browser windows now ignore that and open in the root, so all users can see everything. I'm investigating but if anyone can suggest how to configure that I would appreciate it! [ed. note: okyanet last edited this post 14 years, 7 months ago.]
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: okyanet at Feb 03, 2012, 09:24 AM

      1) If an element is marked as 'static' but some code is left in the snippet code field, is that ignored or does that override the static code? Or is it a fallback if the static element is unavailable?
      If the file exists and is not empty, the element content is replaced from the file when changing it to static (or changing the file path or media source). If it does not exist (or is empty) and writable, the content will be written to the file. Static content is also updated from the file automatically when editing is initiated or the element is rendered (non-cacheable) by MODX.

      Quote from: okyanet at Feb 03, 2012, 09:24 AM

      2) I marked a snippet as static, selected a media source I had created (pointing to core/components/ ) and then went to select the static file path from the Static File select box. I expected the browser to open in the core/components/ folder as set by my media source, but it actually opened at the root. I again selected my core/components/ media source from within the browser, selected my snippet, but noticed the full root path was selected rather than the path relative to the media source. The snippet did not run as it was prefixing the media source path, resulting in core/components/core/components/snippet/path. Am I looking at a bug? If not, I don't understand the point of the Media Source field if the file browser does not take the media source path into account...
      Could be a bug, but I see mine being set relative.

      Quote from: okyanet at Feb 03, 2012, 09:24 AM

      3) I used to configure some CMP panels with a minimum basePath (xtype: 'modx-combo-browser') so that they would always open at a specific minimum folder. For example, a currently logged in user could upload their images to their own folder in 'assets/uploads/user1/'. They would not be able to navigate below that folder. After upgrading to 2.2, all browser windows now ignore that and open in the root, so all users can see everything. I'm investigating but if anyone can suggest how to configure that I would appreciate it!
      I believe the behavior was changed in 2.2 and you would need to define a media source for each unique path you want to limit the users to.
        • 33968
        • 863 Posts
        Hi Jason - thanks for clarifying those points smiley

        I'm going to get a number of my sites upgraded and will post a bug report if I still see the relative path issue. I'm otherwise really enjoying the new release and my clients are loving the dashboard widgets!
          • 34120
          • 236 Posts
          Hi Lucas, I'd me interested to know if you got the media sources working. I've managed to limit my users to the relevant folders but I can't get the file upload to work. The upload appears to work and doesn't throw up any errors but it seems no file is uploaded.

          Thanks
            • 33968
            • 863 Posts
            @bobwal - yes, I have them working but had to do a little hack to the core to limit the file browser to individual user folders. It was not going to be practical to create a media source for every user as there are too many!

            Have a look at this post for some code you can use to initialise the file browser:
            https://forums.modx.com/thread?thread=73966#dis-post-410712
            Use the second code example from my first post, where openTo is the relative path to the user's folder - although my problem is that they are able to see other user folders too. To prevent that I had to hack the core sad
              • 34120
              • 236 Posts
              Thanks for the reply Lucas,
              I think that might be a little involved for what I'm trying to do at the moment. It's always good to be aware of these things though. I'm only working with one user/media source. Initially I'm trying to get the default filesystem source to allow admin to upload to assets/images/ for example.

              Edit: So it was simply file upload limit of 1mb and my test image was just over that. A message on the uploader would be helpful here. [ed. note: bobwal last edited this post 14 years, 7 months ago.]