| [sfGallery2] New Plugin [message #27126] |
Sat, 12 May 2007 11:17  |
nervo Messages: 13 Registered: May 2007 |
Junior Member |
|
|
Gallery2 (http://gallery.menalto.com/) is a great photo album organizer written in PHP, rely on SQL databases.
It can works standalone, or in embedded mode.
This plugin intends to implement embedded gallery2 in a symfony project.
Instruction :
1) Get gallery2 (prefer minimal install, and grow it up with modules)
2) copy /gallery2 directory to your [symfony]/web directory
3) go to "http://yoursite/gallery2/install/index.php".
4) Follow install instructions.
I recommand to choose [symfony]/data/g2data as your data directory.
Now you can test gallery2 in standalone mode, by going to "http://yoursite/gallery2/main.php".
Next step.
Install the sfGallery2 plugin, and configure your app.yml:
all:
gallery2:
dir: %SF_WEB_DIR%/gallery2
uri: /gallery2/
embed_uri: /gallery
login: 0
login_redirect: /login
show_sidebar_blocks: 1
map_mode: 0
map_user: user
map_admin: admin
descriptions:
dir = your gallery2 local directory
uri = your gallery2 web server directory
embed_uri = the uri by which users can access your embed gallery. (additionaly, the plugin create a new route for it)
login = show the "connection" link [0|1]
login_redirect = if show connection link, where does he go ?
show_sidebar_blocks = show the sidebar (=>gallery2 contextual menu) [0|1]
Map Mode is the big deal of this plugin.
Gallery2 comes with its own user/group/permissions system, that you can synchronize with yours. But in most of the case, you just need one anonymous access for visitors, one user access (the same for all users), and one admin access (the same for all admins).
Here come the map_mode.
Set your value :
0 : Visitors only.
All visitors are guest in embedded mode. Users and administrators have to access gallery2 in standard mode.
1 : Simple User.
All authenticated symfony users are mapped to the same gallery2 user (whose can be admin).
The rests are guests.
For instance, you can create this user in gallery2 standard mode, then, just set "map_user" to his name.
2 : Simple Admin. (sfGuard only)
Authenticated symfony users are mapped the same gallery2 user (see mode 1).
Symfony SuperAdmins are mapped to the same gallery2 admin (see mode 1 too, except that you have to set "map_admin" instead of "map_user")
(note : althougy superadmin is not yet completely implemented in sfGuard, you can manually set the "is_super_admin" flag to 1 in the "sf_guard_user" database table).
Finally, you can disable gallery2 standard mode.
Go to your /gallery2/config.php file, and change
$gallery->setConfig('mode.embed.only', false);
to:
$gallery->setConfig('mode.embed.only', '/gallery');
The code is still a little bit dirty, it sure miss functionnalities, but, anyway, it works, and i'm waiting your comments 
PS : I'm not sure if i have to call this plugin "sfGallery2" or "sfGallery2Plugin"... Anybody ???
|
|
|
|
|
|
|
| Re: [sfGallery2] New Plugin [message #55442 is a reply to message #27126 ] |
Thu, 03 July 2008 19:56   |
|
Hi,
it would be a real deal if it'll work.
I'll get a 404 error.
followed exactly your wiki instructions.
any ideas what i've done wrong?
best regards
rome
|
|
|
| Re: [sfGallery2] New Plugin [message #55624 is a reply to message #55442 ] |
Mon, 07 July 2008 16:27   |
|
i hadn't enabled the sfGallery2Plugin module...
now it works
but i have another problem. why does the UI look so poor?
it is the embed mode of gallery?
i'm using a special theme... it is totally ignored.
is it possible to make gallery look normal?
best regards
|
|
|
|
| Re: [sfGallery2] New Plugin [message #57031 is a reply to message #55843 ] |
Fri, 25 July 2008 16:25   |
|
hi,
probably, i can't give you an url because it is just on my local machine.
the next month i'm very busy but then i'll go back to my private project where i use your plugin.
maybe then we can look at this problem.
thx for your interest.
best regards
rome
ps: i'm a symfony beginner so i don't have any suggestions by now
|
|
|
|
| Re: [sfGallery2] New Plugin [message #57761 is a reply to message #57741 ] |
Mon, 04 August 2008 12:19   |
|
first, why do you have a double slash in your
embed_uri: /symfony_project_foldername/web//gallery2/??
i'm not an expert but try for
uri: /gallery2/
embed_uri: /gallery (here your desired uri extension)
add a blank between the modules:
enabled_modules: [default, sfGallery2Plugin]
|
|
|
|
|
|
| Re: [sfGallery2] New Plugin [message #57783 is a reply to message #57782 ] |
Mon, 04 August 2008 14:23   |
|
razemon-
I'm not familiar with the plugin, but it looks like there is a version specific for Symfony 1.1. It's installed via:
php symfony plugin:install sfGallery2Plugin --release=1.0.1
Is this how you installed the plugin? If not, give this a try. If it still doesn't work, then the plugin may have problems with SF 1.1 that we can walk through. My guess, however is that the above will work.
-Ryan
Ryan Weaver
http://www.sympalphp.org
http://www.thatsquality.com
@weaverryan
|
|
|
|
| Re: [sfGallery2] New Plugin [message #57787 is a reply to message #57785 ] |
Mon, 04 August 2008 14:45   |
|
razamemon-
You're absolutely right - the plugin does NOT work for Symfony 1.1, even though it says that it does.
There may be other changes, but here's how to solve the routing issue correctly.
config.php - replace everything with with the following:
<?php
$this->dispatcher->connect('routing.load_configuration', array('sfGallery2Routing', 'listenToRoutingLoadConfigurationEvent'));
Now, create the directory /plugins/sfGallery2Plugin/lib - meaning, basically create a lib folder inside your sfGallery2Plugin folder. Next, create a file inside that folder called sfGallery2Routing.class.php. Put the following contents in it:
<?php
class sfGallery2Routing
{
/**
* Listens to the routing.load_configuration event.
*
* @param sfEvent An sfEvent instance
*/
static public function listenToRoutingLoadConfigurationEvent(sfEvent $event)
{
$r = $event->getSubject();
$embed_uri = sfConfig::get('app_gallery2_embed_uri');
// preprend our routes
$r->prependRoute('sf_gallery2_plugin', $embed_uri.'/:action', array('module' => 'sfGallery2Plugin', 'action' => 'index'));
}
}
This is the preferred method to prepend routing in plugins for Symfony 1.1. The above is not tested, so I may have a typo - let me know if you run into problems.
As I said before, this may not be the only issue with this plugin for Symfony 1.1. In fact, glancing through the plugin's actions.class.php file, there is a call to the constant SF_ENVIRONMENT. This is dead in 1.1 and should be changed to:
sfConfig::get('sf_environment')
Ryan Weaver
http://www.sympalphp.org
http://www.thatsquality.com
@weaverryan
|
|
|
|
|
|
|
|
| Re: [sfGallery2] New Plugin [message #62459 is a reply to message #27126 ] |
Mon, 06 October 2008 16:47   |
germaino_0 Messages: 15 Registered: October 2008 |
Junior Member |
|
|
hello.
I'd like to install the plugin , but it gives me this error:

I notice the "...cache\\/package.xml" part.
package.xml is present in the cache folder, but this path is messed up, isn't it ?
what can I do about this?
I am running symfony 1.0 on Windows.
[Updated on: Mon, 06 October 2008 16:48]
|
|
|
|
| Re: [sfGallery2] New Plugin [message #62499 is a reply to message #27126 ] |
Tue, 07 October 2008 10:57  |
germaino_0 Messages: 15 Registered: October 2008 |
Junior Member |
|
|
I am using 1.0 (on Windows)...
also... I tried to install other plugins for the sake of testing. I tried the assetsLibrary plugin install, it worked.
|
|
|