Gallery2:Modules:joomg2 - Gallery Codex
Personal tools

Gallery2:Modules:joomg2

From Gallery Codex

JoomG2: Joomla! Integration Module
Integrates Gallery2 and Joomla! CMS
Author: Dayo Akanji
Download the module files here.
Visit the Support Site for enquiries and support requests.

Requirements

  • Gallery 2.3.0+
  • Joomla! 1.5 or 2.5
  • PHP 5.0.4+
  • Both Gallery2 and Joomla! must be installed under the same document root.


Description

The JoomG2 Module allows users to organise their photos and other multimedia files in Gallery2 while managing other content using Jooma!.

  • The module runs within the Gallery2 Framework resulting in a single set of normal Gallery2 URLs. This removes the usual setup of having a separate gallery address from the embedded address. Users can now maintain search engine rankings and can provide direct links to gallery pages.
  • The module is called just before output is displayed after all the normal Gallery2 process have been run (using a new manually added event) . It then connects to Joomla! and retrieves Joomla! html output which is then wrapped around the Gallery2 html and this combined output is then displayed.
    A benefit of this is that by using the Gallery2 caching system, previously cached pages can be sent to the user before the module is called resulting in faster speeds and lower resource usage.

Other features are:

  • The Joomla! and Gallery2 folders can be located at any offset relative to the other as long as they lie under the same document root.
  • Unified login from Joomla! (users logged into Joomla are automatically logged into Gallery2).
  • Unified registration via Joomla!
  • Auto points Gallery2 login, logout, account settings and registration links to Joomla! when user integration is activated

Package Contents:

The package comes in two folders as follows:

  • Gallery2: Contains the following files to be installed in gallery2
    • joomg2.zip: This contains the Gallery module files.
    • lib.zip: This contains required additional code.
  • Joomla: Contains the following files files to be installed in Joomla!
    • com_joomg2.zip: This contains the Joomla! component files.
    • gallery2_auth.zip: This contains the Gallery2 Authentication Plugin that logs users into Joomla! if registered in Gallery2.

The files for Joomla! are packaged for different versions as follows:

  • Joomla! 1.5 -> Set_01
  • Joomla! 2.5 -> Set_02

Notes

  • Install and post bug notifications to the support site. Subscribe to the announcement forum there to receive notifications. You can also subscribe to the forum post here but this may generate additional emails.
  • Carry out the following steps to upgrade from module version <= 0.9.2:
    • Deactivate, uninstall and delete the module from the gallery2 admin interface
    • Delete the lines added for the "Gallery::BeforeProcess" and "Gallery::BeforeOutput" events in main.php if present
    • Delete the "gallery2/lib/events/Gallery_BeforeProcess.event" and "gallery2/lib/events/Gallery::BeforeOutput" files if present
    • Follow the installation guide below
  • Implement the Gallery 2 Performance Tips to improve performance. Similar issues should also be considered on the Joomla! side.
  • Version 0.9.0+ no longer bypasses the G2 caching system and no longer require the RefineHTML Module.
    The module cannot be activated while either of the RefineHTMl or G2Drupal modules are active
  • Make sure you have the Site Administrator registered with the same details on both applications before activating the plugin.
  • The Gallery2 session is subordinate to the Joomla! session. If a user is not logged into Joomla!, they will be logged out of Gallery2 by the module. Similarly, they will be logged into Gallery2 by the module if logged into Joomla!.
  • You can create a full community site by using a similar Fudla Bridge for FUDforum written by the same author.

Installation

Important

  • Make sure you have read and applied the instructions in the "Notes" section above if upgrading from module version <= 0.9.2.

Joomla!

  • Make sure the Joomla! Administrator has the same User Name, Full Name and Email as the Gallery2 Administrator.
  • Install the Joomg2 component (com_joomg2.zip).
    This component does not need any configuration after installation
  • Install, configure and enable the Gallery2 Authentication Plugin (gallery2_auth.zip).
    You will need to provide the full server path to the Gallery2 folder
    Make sure the component is enabled and configured after installation
  • Create a menu item as an external url pointing to your gallery2 installation from the Joomla! Administration interface.
    Note down the Id of the menu item as it will be needed when installing the Gallery2 module later
    Also, make sure the url contains the scheme, "http(s)"

Gallery2

  • Make sure the Gallery2 Administrator has the same User Name, Full Name and Email as the Joomla! Administrator.
  • Make sure the elements required to the installed in Joomla! have been completed.
  • Make sure both the RefineHTML and G2Drupal modules are not active
  • Unpack lib.zip into the main gallery2 folder so that the contents are in "gallery2/lib/xyz"
  • Around Line 526 of gallery2/main.php is ...

/*
* Session: Find out whether we need to send a cookie & need a new session (only if
* we don't have one yet)
*/
$session =& $gallery->getSession();
$ret = $session->start();
if ($ret) {
return array($ret, null);
}

list ($ret, $shouldCache) = GalleryDataCache::shouldCache('write', 'full');
if ($ret) {
return array($ret, null);
}

if ($embedded) {
$html = $theme->splitHtml($html, $results);
}


Add the following lines above "if ($embedded) {":

/* Added Event: BeforeOutput */
include(dirname(__FILE__) . '/lib/events/Gallery_BeforeOutput.event');


To give:

/*
* Session: Find out whether we need to send a cookie & need a new session (only if
* we don't have one yet)
*/
$session =& $gallery->getSession();
$ret = $session->start();
if ($ret) {
return array($ret, null);
}

list ($ret, $shouldCache) = GalleryDataCache::shouldCache('write', 'full');
if ($ret) {
return array($ret, null);
}

/* Added Event: BeforeOutput */
include(dirname(__FILE__) . '/lib/events/Gallery_BeforeOutput.event');

if ($embedded) {
$html = $theme->splitHtml($html, $results);
}

  • Unpack the module file (joomg2.zip) to the "gallery2/modules/" folder.
  • Install, configure and activate.
    You will need the Id of Joomla External Menu item from earlier


Troubleshooting

advertisements