We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    Well, after pecking at MaxiGallery for a while I finally stumbled upon what I needed...

    In building a community club site I wanted:

    * Gallery landing page with nice looking thumbnails that linked directly to sub galleries. I wanted the main Gallery landing page NOT to have the "Manage photos" button/link.

    * Each newly created sub gallery creates a link automatically in the main navigation via Wayfinder and Dropmenu.

    * I wanted to have Web Users login to the site via a custom WebLoginPE panel.

    * Once each Web User signed in then their own sub Gallery page would then display the "Manage photos" button/link, allowing them to upload their own photos from the front end (no access to the back end.)

    * Each Web User would only see the "Manage photos" button/link on THEIR OWN sub Gallery page ( and not on any of the other galleries.)


    ****

    I stumbled around in the dark for a while, banging my shins on the coffee table and getting way frustrated...

    But I think I have it all working now. All of this seems to work great using a local test area on my Mac using MAMP. There may be CSS issues with IE, but I have experience at fixing that...

    In case this will help other newbies these are the calls I used:

    I first created the Gallery Landing page and set it to be a Container. I then added sub Galleries by right clicking the Gallery page and clicking the "Create document here" function. Wayfinder then automatically creates the sub sub gallery navigation with links.

    The main Gallery landing page got this:

    [!MaxiGallery? &childgalleries_ids=`all` &display=`childgalleries`  &manageButtonTpl=`@CODE:`&order_by=`random` &pics_per_row=`3`!]

    Each sub Gallery page got this:

    [!MaxiGallery? &display=`embedded` &admin_webusers=`WebuserName` &embedtype=`slimbox` &pics_per_row=`3` &thumb_use_dropshadow=`1`!]

    I then added the individual Web Users and it all came together! Hopefully this will really work well once I take the site live and that I am not missing anything.

    I tried all kinds of combinations using web users, web groups, document groups, user links, permissions etc but I could not get it to work...

    I should thank Susan, RobRay and Doze for help and encouragement along the way!

    Cheers,

    Max
      • 7923
      • 4,213 Posts
      Yep, seems to be correctly setuped, atleast the MaxiGallery part, Good job!

      I don’t know what kind of site you are building, bu if you want to take it further, you can allow users create their own gallery documents also.. you could make it so that users can create the document with FDM or with your own snippet (using docmanager class) and make it so that the user name is put into some document data field that you are not using, eg. summary or long title or something.. and make the gallery documents have by default a call like this: [!MaxiGallery? &display=`embedded` &admin_webusers=`[[GetUserName]]` &embedtype=`slimbox` &pics_per_row=`3` &thumb_use_dropshadow=`1`!]. Then create that GetUserName snippet what would retrieve the content from the summary / long title field what holds the username that the gallery is for. That should work if you have many users and don’t want to manually create the gallery documents for each. Or you could make that as a plugin so that the gallery document is automatically created for example on first login, or something...


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 23299
        • 1,161 Posts
        Thanks Doze,

        A couple of weeks ago I would not have understood that at all. But reading it twice I get the main gist of what you are suggesting. I’ll take a look at that.

        For this particular site I think there will only be around ten or so users that will want a gallery. Maybe more if others like it. Adding them one at a time is no big deal. Once the page is set up they should be on their own. I would like to see if I can incorporate the ability to allow users to add a text block on their gallery pages: not just captions on the photos, but some writing that relates to the photos as a group. I would like all of this to be done from the front end. Overall if I can I want to keep these folks away from the back end Manager.

        Yesterday was a good day: I also got the whole Ditto and Jot thing working with Wayfinder adding the menu links nicely.

        I have enjoyed a rocky love-hate relationship with MODx as a fresh newbie. But its coming together now and I can really admire how this is all put together. I still have tons to learn: not really explored any TV creation yet. I am now pretty comfortable with creating templates, using the default TV’s and creating chunks wherever possible. Fortunately I know CSS pretty well, which is huge. I still have a long way to go with picking the right Snippet combos and customizing the calls.

        But its nice to feel like I am enjoying MODx rather than cursing it...

        Max
          • 24806
          • 43 Posts
          Heyho,

          I got the same problem. Nice to find an answer here but I do not know how to create a new document with that special maxigallery call with the username on creating a new user.
          @Doze: Perhaps you know how that works?! It should work somehow with the doc manager but how.

          regards,
          Max
            I love MODx
            • 7923
            • 4,213 Posts
            You need to create a snippet that retrieves the logged in user name and puts it to a hidden field in "doc manager" (what is that snippet btw?).

            E.g the snippet would be getWebUsername: <?php return $_SESSION[’webShortname’]; ?>

            And in your doc manager form template you would have a hidden field (some of the existing fields if they are unused, like summary field or a TV):

            <input type="hidden" name="summary" value="[!getWebUsername!]">

            Then use a MaxiGallery call like this in the gallery documents what get’s the user name via getField snippet:

            [!MaxiGallery? &display=`embedded` &admin_webusers=`[[getField? &field=`summary`]]` &embedtype=`slimbox` &pics_per_row=`3` &thumb_use_dropshadow=`1`!]

            If the doc manager snippet puts the webuser as the author of the document, you don’t need to do the getWebUsername at all, just retrieve the document author with getField to maxigallery.


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 24806
              • 43 Posts
              Hm, like I said in another topic, it works fine now - also with ajax - but there is one more problem. I get the gallery admin out of the longtitle of the document by the user id. If the user changes his username my snippet also returns the right, the new username, but MaxiGallery doesn’t let him be administrative anymore, that poor guy.
              Any idea? Or has the user not to be allowed to change his username?

              regards,
              Max
                I love MODx
                • 7923
                • 4,213 Posts
                Hmm.. shouldn’t be a problem.. Do you mean that the manage button doesn’t appear?

                When web user adds pictures, the web user ID is put to the owner field of the picture. That field is used to get the correct pictures for the web user if &manager_webusers parameter is used. If &admin_webusers parameter is used, all pictures are collected from the gallery to the manage pictures view.

                The right for the manage pictures button is checked from the $modx->getLoginUserName() function. That value is compared against the usernames that are set in &manager_webusers and &admin_webusers, eg:
                <?php
                
                if (($modx->getLoginUserName()!="" && in_array($modx->getLoginUserName(), $this->mgconfig['manager_webusers'])) || 
                    ($modx->getLoginUserName()!="" && in_array($modx->getLoginUserName(), $this->mgconfig['admin_webusers']))) {
                	return true;
                }
                


                So if your snippet returns the same value as $modx->getLoginUserName(), the manage pictures button should appear.


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."