symfony
symfony forum
Home » plugins » General plug-ins » [sfGallery2] New Plugin
[sfGallery2] New Plugin [message #27126] Sat, 12 May 2007 11:17 Go to next message
nervo  is currently offline 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 Smile

PS : I'm not sure if i have to call this plugin "sfGallery2" or "sfGallery2Plugin"... Anybody ???

Re: [sfGallery2] New Plugin [message #27185 is a reply to message #27126 ] Mon, 14 May 2007 15:08 Go to previous messageGo to next message
mikenolan  is currently offline mikenolan
Messages: 403
Registered: October 2006
Location: Lancashire, UK
Faithful Member
nervo wrote on Sat, 12 May 2007 10:17

PS : I'm not sure if i have to call this plugin "sfGallery2" or "sfGallery2Plugin"... Anybody ???


I think the preference is sfGallery2Plugin.
Re: [sfGallery2] New Plugin [message #28037 is a reply to message #27126 ] Thu, 24 May 2007 12:52 Go to previous messageGo to next message
nervo  is currently offline nervo
Messages: 13
Registered: May 2007
Junior Member
Ok, the plugin is now accessible on the wiki Smile

http://trac.symfony-project.com/trac/wiki/sfGallery2Plugin

Re: [sfGallery2] New Plugin [message #28039 is a reply to message #28037 ] Thu, 24 May 2007 13:12 Go to previous messageGo to next message
mikenolan  is currently offline mikenolan
Messages: 403
Registered: October 2006
Location: Lancashire, UK
Faithful Member
Looks good! Any chance of a demo link if you have a publicly available URL?
Re: [sfGallery2] New Plugin [message #28050 is a reply to message #28039 ] Thu, 24 May 2007 14:02 Go to previous messageGo to next message
nervo  is currently offline nervo
Messages: 13
Registered: May 2007
Junior Member
Unfortunately, the website i wrote this plugin for, is still in beta stage, with admin/admin and test/test accounts Smile

Maybe i can make an another demo-dedicated one...

Is there an official symfony host for this kind of things ?
Re: [sfGallery2] New Plugin [message #55442 is a reply to message #27126 ] Thu, 03 July 2008 19:56 Go to previous messageGo to next message
el_kapitano  is currently offline el_kapitano
Messages: 6
Registered: June 2008
Location: Germany
Junior Member

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 Go to previous messageGo to next message
el_kapitano  is currently offline el_kapitano
Messages: 6
Registered: June 2008
Location: Germany
Junior Member

i hadn't enabled the sfGallery2Plugin module...
now it works Shocked Shocked
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 #55843 is a reply to message #55624 ] Wed, 09 July 2008 20:49 Go to previous messageGo to next message
nervo  is currently offline nervo
Messages: 13
Registered: May 2007
Junior Member
Hello,

hmmm, can you give me an url to looking for the problem ?

It's been a long time since i didn't touch this plugin... Maybe i should update it. Have you got some suggestions ?
Re: [sfGallery2] New Plugin [message #57031 is a reply to message #55843 ] Fri, 25 July 2008 16:25 Go to previous messageGo to next message
el_kapitano  is currently offline el_kapitano
Messages: 6
Registered: June 2008
Location: Germany
Junior Member

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 #57741 is a reply to message #57031 ] Mon, 04 August 2008 08:54 Go to previous messageGo to next message
razamemon  is currently offline razamemon
Messages: 7
Registered: August 2008
Location: Karachi
Junior Member
Hello Guys,

Can you help me to configure gallery2 with symfony.

i have create new project in symfony, placed gallery2 in web folder can configured it.

than installed gallery2 plugin

and customized app.yml

all:
gallery2:
dir: %SF_WEB_DIR%/gallery2
uri: http://localhost/symfony_project_foldername/web/gallery2/
embed_uri: /symfony_project_foldername/web//gallery2/
login: 0
login_redirect: /login
show_sidebar_blocks: 1
map_mode: 0
map_user: user
map_admin: admin


than i configured setting.yml and added these two lines

enabled_modules: [default,sfGallery2Plugin]
logging_enabled: on

but when i tried to run the project like this
http://localhost/symfony_project_name/web/frontend_dev.php

getting this error

Fatal error: Call to undefined method sfRouting::getinstance() in C:\xampp\htdocs\symofony_project_name\plugins\sfGallery2Plug in\config\config.php on line 6

can any body help, i have to figure it out.

Thanks in Advance
Re: [sfGallery2] New Plugin [message #57761 is a reply to message #57741 ] Mon, 04 August 2008 12:19 Go to previous messageGo to next message
el_kapitano  is currently offline el_kapitano
Messages: 6
Registered: June 2008
Location: Germany
Junior Member

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 #57776 is a reply to message #57761 ] Mon, 04 August 2008 13:48 Go to previous messageGo to next message
razamemon  is currently offline razamemon
Messages: 7
Registered: August 2008
Location: Karachi
Junior Member
thanks for the reply, there was only one slash in the app.yml file, it was only mistake in posting.

i have added space in setting.yml file but still getting same error

Fatal error: Call to undefined method sfRouting::getinstance() in C:\xampp\htdocs\memat2_new_\plugins\sfGallery2Plugin\config\ config.php on line 6

Thanks in advance.
Re: [sfGallery2] New Plugin [message #57779 is a reply to message #57776 ] Mon, 04 August 2008 14:08 Go to previous messageGo to next message
weaverryan  is currently offline weaverryan
Messages: 781
Registered: November 2007
Location: Nashville, TN
Faithful Member

Just a shot in the dark here, are you using Symfony 1.1 razamemom?

In Sf 1.1, sfRouting is now a factory instead of a singleton:

sfContext::getInstance()->getRouting()


Ryan Weaver
http://www.sympalphp.org
http://www.thatsquality.com
@weaverryan
Re: [sfGallery2] New Plugin [message #57782 is a reply to message #57779 ] Mon, 04 August 2008 14:16 Go to previous messageGo to next message
razamemon  is currently offline razamemon
Messages: 7
Registered: August 2008
Location: Karachi
Junior Member
yes i am using symfony 1.1.

can you please tell me where to make changes

in plugin config file

thanks in advance
Re: [sfGallery2] New Plugin [message #57783 is a reply to message #57782 ] Mon, 04 August 2008 14:23 Go to previous messageGo to next message
weaverryan  is currently offline weaverryan
Messages: 781
Registered: November 2007
Location: Nashville, TN
Faithful Member

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 #57785 is a reply to message #57783 ] Mon, 04 August 2008 14:29 Go to previous messageGo to next message
razamemon  is currently offline razamemon
Messages: 7
Registered: August 2008
Location: Karachi
Junior Member
i am trying to install the plugin but getting error

C:\xampp\htdocs\memat2_new_>php symfony plugin:install sfGallery2Plugin --releas
e=1.0.1
>> plugin installing plugin "sfGallery2Plugin"
>> sfPearFrontendPlugin downloading sfGallery2Plugin-1.0.1.tgz ...
>> sfPearFrontendPlugin Starting to download sfGallery2Plugin-1.0.1.tgz (4,759 b
ytes)
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin ...done: 4,759 bytes
>> sfPearFrontendPlugin Skipping package "symfony/sfGallery2Plugin", already ins
talled
>> sfPearFrontendPlugin as version 1.0.1
>> sfPearFrontendPlugin downloading symfony-1.1.1.tgz ...
>> sfPearFrontendPlugin Starting to download symfony-1.1.1.tgz (2,131,490 bytes)

>> sfPearFrontendPlugin ...done: 2,131,490 bytes




Installation of "sfGallery2Plugin" plugin failed: pear.symfony-project.com/sym
fony not installed



when i checked which plugin are installed getting this list.

Installed plugins:
sfGallery2Plugin 1.0.1-stable # pear.symfony-proje
ct.com (symfony)
symfony 1.1.0-stable # pear.symfony-proje
ct.com (symfony)

please help me out i have to complete this by today
thanks in advance
Re: [sfGallery2] New Plugin [message #57787 is a reply to message #57785 ] Mon, 04 August 2008 14:45 Go to previous messageGo to next message
weaverryan  is currently offline weaverryan
Messages: 781
Registered: November 2007
Location: Nashville, TN
Faithful Member

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 #57791 is a reply to message #57787 ] Mon, 04 August 2008 14:58 Go to previous messageGo to next message
razamemon  is currently offline razamemon
Messages: 7
Registered: August 2008
Location: Karachi
Junior Member
thank you so much it worked

can you please help me to use gallery2 in my symfony module.

is there any tutorial available to take care of this

thanks in advance
Re: [sfGallery2] New Plugin [message #57794 is a reply to message #57791 ] Mon, 04 August 2008 15:10 Go to previous messageGo to next message
weaverryan  is currently offline weaverryan
Messages: 781
Registered: November 2007
Location: Nashville, TN
Faithful Member

razememon-

This is the best resource I know of - again, I don't know anything about this plugin specifically:

http://www.symfony-project.org/plugins/sfGallery2Plugin/1_0_ 1?tab=plugin_readme

-ryan


Ryan Weaver
http://www.sympalphp.org
http://www.thatsquality.com
@weaverryan
Re: [sfGallery2] New Plugin [message #57799 is a reply to message #57794 ] Mon, 04 August 2008 15:18 Go to previous messageGo to next message
razamemon  is currently offline razamemon
Messages: 7
Registered: August 2008
Location: Karachi
Junior Member
thanks ryan-
Re: [sfGallery2] New Plugin [message #57849 is a reply to message #57799 ] Mon, 04 August 2008 20:55 Go to previous messageGo to next message
nervo  is currently offline nervo
Messages: 13
Registered: May 2007
Junior Member
Hi,

i'm the author of this plugin. I planned to update it to be compatible with symfony 1.1 (especially this routing problem), but i did'nt have so many times last days...
Anyway. I will have a look on it tomorow.
Re: [sfGallery2] New Plugin [message #57989 is a reply to message #27126 ] Wed, 06 August 2008 00:19 Go to previous messageGo to next message
nervo  is currently offline nervo
Messages: 13
Registered: May 2007
Junior Member
Ok, dudes, i have just submit two new versions of sfGallery2Plugin :

- 1.0.2 : correct some informations, due to new plugins system
- 2.0.0 : compatible with symfony 1.1

I have also removed the old versions which declared themselves as compatible with symfony 1.1 and 1.2

Feel free to test !

If you're interested in enhancing this plugin, just call me, with the new plugins system, we can easily add collaborators.
Re: [sfGallery2] New Plugin [message #62459 is a reply to message #27126 ] Mon, 06 October 2008 16:47 Go to previous messageGo to next message
germaino_0  is currently offline germaino_0
Messages: 15
Registered: October 2008
Junior Member
hello.

I'd like to install the plugin , but it gives me this error:

index.php/fa/932/0/

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 #62474 is a reply to message #62459 ] Mon, 06 October 2008 21:53 Go to previous messageGo to next message
nervo  is currently offline nervo
Messages: 13
Registered: May 2007
Junior Member
Which version of symfony do you use ?
If 1.1, then you have to install the version 2.0 of the plugin
Re: [sfGallery2] New Plugin [message #62499 is a reply to message #27126 ] Tue, 07 October 2008 10:57 Go to previous message
germaino_0  is currently offline 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.
Previous Topic:Admin Generator Pulldown-Menu
Next Topic:Access User Session to sfAmfPlugin service
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software