Technical documentation of the Gallery2 integration module for Xaraya.
The gallery2 module provides create, update, delete API hooks and a search GUI hook. The API hooks are only provided for the roles module as they are used for the user/group management synchronization with G2.
All hooks should be activated, always. And thus, they are activated automatically during gallery2 module installation. If these hooks are not active, to activate them, go to Admin panel -> Modules -> Configure Hooks and click on the gallery2 link. Select the roles module to enable the user/group synchronization functionality .
Xaraya is responsible for the authentication and forwards the authenticated user to G2. Both, xaraya and G2, still have their own session management and cookies. The only difference is that G2 checks if there is already a xaraya session before it creates a session for the same user.
Both applications still have their own user-/group management. But G2 is not allowed to initiate a change. Everytime you create, update or delete a role (user/group) in xaraya, the gallery2 module instantaneously creates, updates or deletes the user/group in G2. Same for group memberships. If you delete a user in xaraya, the G2 user receives a random password. That leaves the possibility to recall this role in xaraya. If you purge the role, it gets deleted in G2 too.
The initial user and group synchronization, that is the import of G2 users/groups into xaraya and the export/update of xaraya roles to G2, is based on the unique role name / G2 userName / groupName. There are 3 special groups and 1 special user that are mapped internally:
The import / export of G2 users/groups and xaraya roles happens right after you hit "Update Config" in the Modify Config view, but only if the config parameters you supplied are valid.
If there are conflicts, that is, if there exist xaraya roles and G2 users / groups with the same unique username before the initial synchronization, we update the G2 user data with the data we get from xaraya.
We also drop pending users from G2. If they haven't yet registered with xaraya, the eventually will notice the change and sign up. :)
All subsequent synchronizations (login, logout, create, update, delete role) are based on a xaraya uid to G2 entityId mapping.
You can manage G2 permissions in G2 and not with the roles / privileges modules of xaraya. But all xaraya user groups exist in G2 too. So just assign permissions to the default user group / admin group / everybody group in G2 and all registered users / administrators / everybody will have these permissions.
For more information, check the Gallery 2 documentation for permission management.
No HTML frames are used. G2 generates the resulting HTML without the ...section and the and tags and returns it to our wrapper module. Then we put everything into an almost empty xaraya template. G2 returns the javascript, css and the page title too and we include everything in the created xaraya page.
If you want to customize the look, you can start by choosing one of the existing G2 themes. You can then customize the G2 templates, theme and stylesheets for detailled adjustments. G2 uses smarty as its templating engine, so perhaps you already know everything to create your very own look and feel of G2.
TODO: We will dynamically send all available menu links from G2 to xaraya, the goal is to have only the one and only xaraya menu.
TODO: We will add a search hook therewith you can search for G2 items, comments, ... from xaraya.
We configure G2 to run all requests through xaraya. The xaraya core sees that the request is intended for the gallery2 module and the gallery2 module passes the request to G2 itself.
The only exception are the download links/requests. G2 features an image firewall. Unlike ordinary gallery scripts, there's no way you can download any images from G2 than through the application. The developers of G2 spent a lot of effort in trying to reduce the time needed to process download requests. If all these download requests would run through the xaraya core before G2 received them, it'd be bloody slow. That's why all download links/requests go directly to G2, bypassing xaraya.
For now, xaraya short urls are not supported by this module. But you can activate the G2 Url rewrite module which generates also very nice URLs.
Xaraya and G2 manage language settings the same way. There's a site wide language default, a user language setting and a language setting per session. A base module updateconfig hook synchronizes the site default language with G2 and on each request we hand over the current language setting of the active xaraya user to G2. If G2 has the language lang_COUNTRY installed, it sets the language accordingly, if not, it tries the fallback lang_ANYOTHERCOUNTRY, if that fails, it uses the old language setting.