Embedding & Integration

valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2004-12-16 18:47

Introduction:
----------------

Embedding & Integration of G2 means to embed G2 seamlessly into your homepage or other applications.
This is the place to find out about available G2 integrations / CMS modules, to announce related news, publish download and demo links and add documentation.

Overview of G2 Embedding & Integration
http://codex.gallery2.org/index.php/Gallery2:Embedding

List of Available Integrations:
http://codex.gallery2.org/index.php/Gallery2:Integration:Available_Integrations

G2 Integration Development Documentation
http://codex.gallery2.org/index.php/Gallery2:Embedding:Integration

Embedded URL Rewrite Setup
http://codex.gallery2.org/index.php/Gallery2:Modules:rewrite#URL_Rewrite_Embedded

For the visual integration and css problems, see this topic:
CSS problems/considerations when embedding G2

History (the road to our current solution):
For a short explanation why things are done in G2 integration as they are, take a look at this post. and for a little longer explanation, see the development topic CMS Integration (How to Customize G2 or Create a module? is even older, but obsolete) which describes the process of our decision making. The forum topic was the start of all integration discussions.

We are always open for new ideas, so don't hesitate posting yours. :)

AttachmentSize
sample_embedding_wrapper.zip1.52 KB
 
walkah
walkah's picture

Joined: 2004-03-11
Posts: 5
Posted: Tue, 2004-12-21 15:45

just thought i'd add that my drupal demo site is:
http://aurora.walkah.net/drupalgallery

 
Einstein
Einstein's picture

Joined: 2003-10-13
Posts: 105
Posted: Fri, 2004-12-31 17:02
 
Black-y
Black-y's picture

Joined: 2005-01-03
Posts: 5
Posted: Wed, 2005-01-05 10:25

I just finished a first running version for PostNuke

Project site:
http://www.hdtvtotal.com/pnGallery2.html

Demo site:
http://www.hdtvtotal.com/module-pnGallery2.html

It's based on valiants xaraya embedding code, so it's no hack, but instead tries to embed smoothly into PostNuke. And a usable release is not far away. :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7993
Posted: Thu, 2005-01-06 08:39

Sweet! Great work, Black-y!

 
spiderr

Joined: 2004-08-31
Posts: 1
Posted: Fri, 2005-01-07 16:34

I have gallery2 and TikiPro integrated together. Feel free to give it a test at:

http://clyde.tikipro.org/gallery2/

Any feedback would be great!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-16 22:52

updated list, added phpnuke.

@developers: please add your integration + a README to the cvs.

1. first checkout the cvs integration module:
cvs -d:ext:your_username@cvs.sourceforge.net:/cvsroot/gallery co integration
2. Create your directory
cd integration/gallery2/
mkdir yourIntegrationName (i.e. "mkdir drupal", or "mkdir postnuke")
add all your file
3. Add your directory to the cvs:
cvs add yourIntegrationName
4. Add all your files: copy your inegration files to
integration/gallery2/yourIntegrationName/.
5. Add them to the cvs (i.e. type "cvs add *" in all directories)
6. Commit the changes
cd integration/gallery2/yourIntegrationName/
cvs commit

And don't forget to add a short README to explain how to use your integration.
I guess we'll soon get nightly snapshots of the integrations on jpmullans site.

thanks

 
Black-y
Black-y's picture

Joined: 2005-01-03
Posts: 5
Posted: Mon, 2005-01-31 05:53

Okay, I got up a first running version for download:
http://www.hdtvtotal.com/PNphpBB2-viewtopic-t-380.html

I waited for this post here @menalto until I got the respond that it's also working on other sites than mine. :D And it seems to do:
http://pn.yourgoodtimes.com/index.php?module=pnGallery2&func=main

I'll add it to the CVS when it's more mature, because beside the admin user it doesn't do any Users/Groups sync until now, and parts of it are surely bad code, so please don't look too close at it. It will get better! :D Just wanted to feed the most hungry PostNukers out there. :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7993
Posted: Tue, 2005-02-01 05:02

That rocks! Great work, Black-y!

 
spartyguy

Joined: 2003-07-22
Posts: 9
Posted: Fri, 2005-02-04 16:10

Anyone have this working in Mambo yet?

 
Einstein
Einstein's picture

Joined: 2003-10-13
Posts: 105
Posted: Sun, 2005-02-13 20:49

phpBB 2.1.x (latest development version)
State: alpha
Download: http://devarea.mtb-o.net/code/
Thread: http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=25068
Contact: Einstein

 
istoreparts

Joined: 2005-02-10
Posts: 4
Posted: Thu, 2005-02-17 03:33

## includes/ucp/ucp_profile.php
## includes/ucp/ucp_register.php

where are those files in phpbb2?

im running version 2.0.11 right now and gallery v1.4.4-pl6

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-02-17 08:14

istoreparts, it's written in bold letters: phpbb version 2.1, which is the development version of 3.0 (formerly 2.2). Which is a whole new version of phpbb and you can't expect the G2 mod to be compatible with earlier versions (<2.1).

Second, you write you're using gallery 1.x. This forum is about gallery 2.x. There is a phpbb 2.0.x + gallery 1.x integration. see http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewforum&f=16

 
felipe

Joined: 2004-05-29
Posts: 9
Posted: Thu, 2005-02-17 10:18

Wordpress integration?

 
jotajota

Joined: 2002-10-08
Posts: 4
Posted: Sun, 2005-02-20 20:07

I must be thick today, but I cannot find the integration/gallery2 stuff at sourceforge. Care to give me a clue as it's obvious I totally lack one? :)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-02-20 20:21

Currently, the only way to get is, by using cvs

on a linux box:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gallery login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gallery co integration

on a windows box, use wincvs.

probably, we should add the integration package to the nightly snapshots page...

 
VIPixel

Joined: 2004-09-26
Posts: 3
Posted: Tue, 2005-02-22 15:07
valiant wrote:
probably, we should add the integration package to the nightly snapshots page...

yea we should have nightly snapshot coz sf's cvs sometimes drive me crazy!!

-bash-2.05b$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gallery login
Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/gallery
CVS password:
cvs [login aborted]: unrecognized auth response from cvs.sourceforge.net: M -!- Client or Ser-bash-2.05b$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gallery login
Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/gallery login
CVS password:

cvs [login aborted]: unrecognized auth response from cvs.sourceforge.net: M -!- Client or Server timeout occurred!
 
yelvington

Joined: 2003-08-07
Posts: 14
Posted: Sun, 2005-02-27 03:42

I have installed G2 with Drupal using Walkah's module. However, there does not seem to be any interoperation with the Drupal authentication system -- which is actually the important part. Am I missing something? I don't want my users to be asked to register when they've already registered for the base site (Drupal).

 
Hexen

Joined: 2005-02-28
Posts: 4
Posted: Mon, 2005-02-28 12:51

Hi,

There is any plans for integrate v.2 with WordPress 1.5 and up (www.wordpress.org) ?

Thank you for any comment about this subject.
Hexen

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Mon, 2005-02-28 12:55

Hexen, currently noone has really started on something for Wordpress, but i'd be very suprised if something doesn't get started soonish. I use WP myself, so I have a big interest in it, and several members of the wordpress communtiy has voiced an interest in doing something with WP and G2.

I bet something will turn up, just not sure how/when yet. :)

 
Hexen

Joined: 2005-02-28
Posts: 4
Posted: Mon, 2005-02-28 12:59

mmm... I would love to se that, there is any newsletter to keep me update on this ?

Thank you for your quick responce!

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Mon, 2005-02-28 13:08

Hexen, subcribe to this thread I guess. :-)

 
genner
genner's picture

Joined: 2005-03-01
Posts: 22
Posted: Tue, 2005-03-01 04:33

Embedding and integrating of G2 and Moodle?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-03-01 09:19

please don't ask your question in multiple topics, thanks.

 
yonie

Joined: 2005-02-21
Posts: 9
Posted: Tue, 2005-03-01 19:23

gallery2 (today's nightly) running embedded in our own community-software, at:

http://forum.brz.nu/

i also have a question. at this moment, gallery2 is only running as guest user, and i have to log in seperately (using main.php) to actually upload some files or manage the pages.

is there some documentation known on how exactly our user database is expected to be tied to the gallery's user database? i've read EMBEDDING (and i know its alpha :D), but its not very clear on what to do exactly.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-03-01 19:32

no there are no detailed docs, not yet. sorry. coming not so soon, but coming.

 
yonie

Joined: 2005-02-21
Posts: 9
Posted: Tue, 2005-03-01 19:36

ok i will try and find out a bit myself then :) thanks anyway!

 
genner
genner's picture

Joined: 2005-03-01
Posts: 22
Posted: Wed, 2005-03-02 00:29

same goes here, its kinda blurry

 
premedios

Joined: 2005-03-03
Posts: 1
Posted: Thu, 2005-03-03 21:44

Hi!

I need help. The mambo component version of gallery is complaining that it can't find embed.php. I checked the zip file I downloaded and it doesn't have that file :cry:

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-03-03 23:17

premedios, please refer to this http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=25979 topic for specific questions about the mambo integration. this topic here is rather for announcements and the like.
(answer to your question: embed.php is part of G2. if your mambo integration says it can't find embed.php, then either the path you specified is wrong/wrong format or your G2 version is really, really old.)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-03-10 00:04

After the recent UI/theming change, GalleryEmbed::parseHead(), i.e. the css styles, were broken. It's now fixed, you can update your embed.php from cvs now.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 573
Posted: Thu, 2005-03-10 13:00

i'm trying, but all the OSTG sites seem to be down... :( no /. no SF no thinkgeek :( :( :(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-03-11 08:18

updated the introduction in the first post with some links to existing discussions/explanations.

 
carla216

Joined: 2004-07-28
Posts: 5
Posted: Sat, 2005-03-19 18:58
jotajota wrote:
I must be thick today, but I cannot find the integration/gallery2 stuff at sourceforge. Care to give me a clue as it's obvious I totally lack one? :)

http://cvs.sourceforge.net/viewcvs.py/gallery/integration/gallery2/ :wink:

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-03-19 19:54

instructions on how to download the integrations can be found in the first post of this topic. nightly snapshots thereof will be soon available on jmullans snapshots page.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-03-21 10:36

Thanks to Jesse Mullan, there are now nightly snapshots available of the integrations.
See the first post of this topic.

 
Arnoldjw
Arnoldjw's picture

Joined: 2004-05-16
Posts: 54
Posted: Tue, 2005-03-29 23:35

I'm working on a Wordpress embed, and on creating a user
I get Undefined Class Name 'gallerycoreapi' in embed.php on line 249

checked the cvs, and still saw:
GalleryCoreApi::newFactoryInstance('GalleryEntity', 'GalleryUser'

Did I miss an include?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-03-30 01:26

did you call GalleryEmbed::init ?
see docs at top of embed.php

 
Arnoldjw
Arnoldjw's picture

Joined: 2004-05-16
Posts: 54
Posted: Thu, 2005-03-31 00:18

It helps if I read.
I commented out the init.

Thanks

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-04-02 00:26

GalleryEmbed API Change:

GalleryEmbed::init received a new parameter.
'embedPath' => url path to embedUri (example: '/', or '/cms/')

Until now, the urls that G2 generated were dependent on the current URL (REQUEST_URI), i.e. if you wanted to show a G2 imageblock in your website outside the embedded G2, i.e. in http://domain.com/some/path/index.php?module=other and your embedded G2 was at http://domain.com/some/path/index.php?module=gallery2, then you would have had these settings:
embedUri => 'index.php?module=gallery2
and the resulting urls would have looked like
http://domain.com/some/path/index.php?module=otherindex.php?module=gallery2?somehg2parameters
i.e. the urls would have been broken.

The fix until now was a hack. Manipulate $_SERVER['REQUEST_URI'] manually...

Now it is solved.

Call GalleryEmbed::init now like this...
GalleryEmbed::init('embedUri' => 'index.php?module=gallery2',
'embedPath' => '/some/path', 'activeUserId' => ...., ...,...)

You can still use GalleryEmbed::init like before (just omit embedPath), but I recommend using the new method with embedPath.

 
BF

Joined: 2005-03-30
Posts: 9
Posted: Sat, 2005-04-02 20:21

Cheers valiant, that works on mine.

How would I embed the 'Search the Gallery' search form, for example at the top or bottom of the page?

BF

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-04-02 20:36

Depends... is this search form only for G2 search or is it for syndicated search where you should be able to search your website and G2?

- Search only for G2 and only in G2 pages -> change the layout of G2, place the search form whereever you want to.

- Search only for G2, but the search form should be everywhere on your website -> depends, you could use GalleryEmbed or just the direct form submit url.

- Search G2 with the same search form as for the rest of the website -> use the GalleryEmbed:: search functions.

 
pkellum

Joined: 2005-04-13
Posts: 6
Posted: Fri, 2005-04-15 01:11

Can I recomend an optional parameter to createGroup in embed.php? It would be helpful to specify a group type when creating a group. Something like...

function createGroup($extGroupId, $groupName, $groupType=GROUP_NORMAL) {

This would make creating users on the fly easier for admin users and would only require changing two lines :)

Patrick

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-04-15 08:59

pkellum, Admin users in G2 are members of the EveryBody, All Users and the Administrators group.
All groups in G2 are of group_type GROUP_NORMAL. All but the 3 special groups GROUP_EVERYBODY, GROUP_ALL_USERS, GROUP_SITE_ADMINS. And there is only 1 group for each of the three special groups.
Do you intend to create a second admin group?? why?

Hm, I guess I see the problem. If one decides to not synchronize groups, just users - and that will be the default case - then one has to createUser, loadEntityByExternalId, and call a GalleryCoreApi method to add a user to the admin group.
Is that you problem?

 
pkellum

Joined: 2005-04-13
Posts: 6
Posted: Fri, 2005-04-15 10:41

I didn't know there wasa supposed to be only one entry for each of those groups. How do I go about adding a user to the admin group using the embed API? I'm not sure how I'm supposed to find the group ID for the admin group.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-04-15 11:02

The problem with the embed API, which is an extension to the G2 API, is that the group / membership functions are assuming you synchronize users AND groups with G2.
I guess the more common case is that only users are synchronized.
So you would like to have a function to add a externalId to a G2 group id.
Such a function does not exist at the moment.

So what you have to do at the moment is.
1. get the G2 user id (entityId) for a user (either by GalleryCoreApi::loadEntityByExternalId or by other means)
2. get the G2 group id (entityId) for the admin group:

list ($ret, $adminGroupId) = $module->getParameter('id.adminGroup');
	if ($ret->isError()) {
	    return $ret->wrap(__FILE__, __LINE__);
	}

3. add the user to the admin group:

$ret = GalleryCoreApi::addUserToGroup($userId, $adminGroupId);
if ($ret->isError()) {
	    return $ret->wrap(__FILE__, __LINE__);
	}
 
pkellum

Joined: 2005-04-13
Posts: 6
Posted: Fri, 2005-04-15 11:55

Thanks, that worked great! Also helped me learn a bit about how the API works (always a good thing :) )

That was one of the few remaining issues I had writing a module for PGV (a genealogy viewer).

Thanks!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-04-16 00:50

@Integration writers:
I'm chaning the return value of GalleryEmbed::parseHead($headHtml) in the next few days.
Until now, the javascript return value was an array and each entry was just the code, without the <script> tags.
I didn't capture script tags which don't have a code, but a src link for a linked js file.

It will be changed to:
javascript is again an array, but now each element contains the full script section, i.e. <script ....>...</script>.

And I use this occasion to start writing unit tests for GalleryEmbed, starting with a test for parseHead.

 
BF

Joined: 2005-03-30
Posts: 9
Posted: Sun, 2005-04-17 19:43

I am embedding Gallery through my custom page "mypage.php" and image links are routed through "mypage.php?..." as expected.

If I right click on an image and view its properties the location is of the form "gallery2/main.php?..."

Is this behaviour correct or should the image properties display "mypage.php?..." as well?

This is my configuration:
$ret = GalleryEmbed::init(array('embedUri' => 'mypage.php',
'embedPath' => '/myfolder/',
'relativeG2Path' => '../gallery2',
'loginRedirect' => '../index.php',
'activeUserId' => $uid));

BF

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-17 20:12

this is correct. all image urls (downloadItem urls) are routed through G2 directly for performance purposes. as permissions are handled through cookies, this works. everything fine as it is.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-04-19 21:56

GalleryEmbed API update:

GalleryEmbed::parseHead now captures all javascript tags (new: also the script tags with a src attribute, as it is used in the site admin -> maintenance view).
This required a change in the return value of ::parseHead. The javascript return value includes now the complete <script ..... </script> tag. Before it was just the string between <script ...>this string</script> tags.

And if you take a look at embed.php and wonder what happened to the GalleryEmbed class: it was moved to modules/core/classes/GalleryEmbed.class for various reasons.