Gallery2:Modules:multiroot - Gallery Codex
Personal tools

Gallery2:Modules:multiroot

From Gallery Codex

Multiroot Module

Generates different entry-points to your Gallery providing a view on a part of your Gallery.

Description

This module assists in the creation of alternate guest views for a Gallery.

Multiroot allows you to create an alternate URL to view part of the Gallery. This configuration screen assists in setup and creation of a PHP file for the alternate URL. This module never activates and is not needed to use multiroot. There are two options:

Virtual root

This option defines a default album for this view and adjusts navigation links so that no parent albums above the default are shown. Both guests and logged in users accessing the alternate URL will see this effect. However, Gallery permissions are unchanged so modules like imageblock and search, or manually entered URLs, can lead visitors to items outside the default album. This option is easier to setup as it uses guest permissions already defined for your Gallery.

Alternate guest user

This option defines a new guest view with permissions defined for exactly what this view should display. Guests using the alternate URL cannot see any items outside those granted permission, by browsing or via any modules or URLs. Logged in users see whatever their permissions allow, whether accessing the normal or alternate URL. This option provides greater access control over the alternate view, but requires additional permissions setup.

Features

  • Configuration assistant to generate new views of parts of your Gallery
  • 2 modes:
    • Lead your visitors to a virtual root album where they can still escape to see the rest of your Gallery by using the imageblock or the search function.
    • Create an alternate guest user to jail your visitors in the sub-tree of the new root album you chose for them.
  • Compared to Gallery2:Multisite an admin can manage all albums in a single Gallery.

Usage

  1. Install the multiroot module. See Gallery2:Installing Additional Components.
  2. The multiroot module doesn't activate. That's how it's meant to be for this specific module.
  3. To create a new root / entry point for your Gallery:
    • Go to Site Admin -> Plugins
    • Click on multiroot -> configure
      • Enter a "URI for new guest view", using "URI for this Gallery" as a reference
        • For example, if "URI for this Gallery" is /gallery2/main.php, use something like /gallery2/newroot.php as the "URI for new guest view"
    • Follow the instructions to either create a virtual root or a alternate guest user and let the module generate the resulting code.
    • Copy the generated code into a .php file (e..g 'newroot.php') and put that file in your gallery2 folder.
    • If you created an alternate guest user, then removed permissions for the original guest user from albums in your alternate root, and now you can no longer see any images in your alternate root, then you need to edit the php file and change g2Uri to be the same as embedUri. (The plugin currently sets g2Uri to '/', which causes image URLs to be generated using the original root rather than the alternate root, meaning that the alternate guest user is used only for album permissions, and the original guest user is used to view the images themselves - the plugin should probably be changed to set g2Uri to be the same as embedUri by default)

Advanced

You can manually tweak the settings of your new entry point with these settings in your generated .php file (these are all optional):

 $gallery->setConfig('login', true); /* Specify whether to show a login link or not (defaults to true) */
 $gallery->setConfig('defaultAlbumId', 7682); /* Specify the album ID of the root album for that view (defaults to the normal root) */
 $gallery->setConfig('anonymousUserId', 11270); /* Specify the alternate guest user (defaults to the normal guest) */
 $gallery->setConfig('breadcrumbRootId', 7682); /* Specify what the root album for your breadcrumbs (navigation) */