Mambo and G2 embedding
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
edit by valiant: Over the week-end I dedicated some time to find a way to embed G2 into Mambo 4.5.1 (latest version). I started from the embedding component for Gallery 1 and some other code I found here (php-nuke integration). So first and foremost, thanks to the people who created that code. I merely adapted it Attached you will find the component which you should install in Mambo using the admin and create a suitable menu link to it. You will also have to provide the following values for the component. 1) The full absolute path to the gallery installation I installed the component on my site here There are still some thing going wrong like the displaying of the gallery (CSS issue?) Also, there is no real integration now (just embedding). I really hope that this can be the starting point for more advanced php goeroes since I'm a VERY beginner in PHP. Kind regards,
|
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
DrBob, great news! I hope you find some help in the mambo forums to get actual integration (user management) working. In the Embedding & Integration sticky topic and on http://sf.net/projects/gallery/ -> integration/gallery2/ you'll find integrations for xaraya, postnuke, phpnuke, drupal, ... this could make further development easier for a mambo integration. |
||||
artemido
![]()
Joined: 2005-02-08
Posts: 24 |
![]() |
|||
wow... thanks for the work on this... really solved a quest I've been working on for a while now... :D that said, I'm really looking forward to more in-depth integration of the products to include things like pass-through authentication and back-end configuration, etc... :D Can't wait! |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
Ok, as written in my previous post, I had some issues with the gallery layout. I just re-installed everything using MSAS (Mambo Stand-Alone-Server) with todays Gallery G2 build, and now everything is ok I'll apply the same changes to my live site later tonight so you can all check it out. I also made a small module for Mambo so you can display the G2 sidebar (attached below). Testing on MSAS did not show any errors but when trying it on my live site, I noticed some things are not going like they should. So use at your own risk :wink: Valiant, Regarding further integration, I really hope that I gave the kick-of for other people to start working on this (I made some posts on 2 Mambo forums) I am just not proficient enough to start on a real integration (users sync, etc). Kind regards, |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
I just finished an update of the Mambo Component.
I think that this more or less finished "embedding" Gallery (no integration). For the ZIP file itself, please see the very first post in this thread.[/] |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
cool. Are you sure you don't want to integrate users too? ;) |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
Valiant, Yes I'm sure First of all, the current embedding does have its errors and I can't seem to fix them. From the embedded gallery, it's impossible to to any actions besides browsing through the images (like uploading, etc). Also, the module I created for displaying G2's sidebar only works the first time it's loaded. (also, Mambo reacts strange when I assign that module only to the Gallery component link) And last but not least, I've been taking a look at possible ways to implement user synchronisation and I simply have to admit that I don't know enough about Mambo (and what Mambo does in the background) All these points could be tackled by a developer who has more knowledge about Mambo itself. I made some reference post on two Mambo forums but until now, I received no response whatsoever. Lets just hope somebody turns up the next couple of days :-? |
||||
g5
Joined: 2005-02-03
Posts: 18 |
![]() |
|||
Hi Dr. Bob, Implemented G2 in Mambo 4.5.1b, using Gallery G2.2005-02-09-09-37-20.zip. All looks good so far, however for some reason, the images are just not appearing. Did you run into such problems? Stand-alone, the images appear, however when embedded in Mambo, they do not? SA = http://thebrennans.ca/gallery2/ Any suggestions as to what i should look for? Do you think the fact that i located my image folder outside of the root have anything to do with this? BTW, fantastic job on this... Can't wait to see where G2 takes us!!! Cheers, |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
g5, most probable cause is that the relative path to the gallery is not correct. In your case, this should be /gallery2/ The location of the g2data folder itself does not have any influence on the embedding. Kind regards, |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
g5, DrBob is absolutely with his indications. Only that the relative path shouldn't start with a slash ('/'), it's just "gallery/" without the quotes. |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
I just found out how to solve the first of two issues with the Mambo module for displaying the gallery sidebar In Mambo, you can define when to display a certain module. This is done by linking the module to a link defined in the menu using the admin pages. Issue 1: Mambo apparently needs an extra variable named Itemid to keep track of when a module should be shown or not. This variable should be added to the gallery's embeduri. I don't know how to dynamically fetch the correct value for this variable so I just added it manually in the admin. The correct value can be seen in the URL when you click on the link in the menu (in my case this would be &Itemid=56 ). Look it up for your site and just add it to the embedUri (in my case I end up with index.php?option=com_gallery2&Itemid=56) Issue 2: Using httpwatch (great tool BTW), I noticed that the relative path is not correct anymore. Ex: first time the link to the random image is http://[domain]/gallery/etc... subsequent link it changes to http://[domain]/mambo/gallery/etc... I really don't have a clue why and how this is changed. |
||||
artemido
![]()
Joined: 2005-02-08
Posts: 24 |
![]() |
|||
fixed one minor issue with the embedded forum that had been bugging me. In my implementation anyway, I was having problems with the nested tables being more narrow than the rest of the available space. To fix it, I simply went to < mambo_root >/gallery/themes/mambo_dark/styles/theme.css and added the last line to the css entry shown here: #gsAlbumContents, #gsAdminContents, #gsOtherContents { border-top: 1px solid #000000; border-left: 1px solid #000000; background-color: #333; width: 100%; } and voila, the problem goes away... :D Hope this helps... |
||||
edoumenc
Joined: 2005-02-12
Posts: 1 |
![]() |
|||
hi, i installed "com_gallery2" and "Mod_g2_sidebar" but i have an error. And in administrator interface this error message : Can you help me ?? |
||||
artemido
![]()
Joined: 2005-02-08
Posts: 24 |
![]() |
|||
drbob: I'm working on a customization to your integration that forces full-sized images to pop-up in a new window without the mambo toolbars, etc. This is as simple as telling mambo to use index2.php instead of index.php, so I've made a number of changes to the scripts you provided to allow for a detachUri parameter (as of now, the admin scripts capture and display the param and I added a row to the mos_gallery2 table for it, so that part is working...). I'm well on my way to making this thing work, with one exception. I can't figure out how to tell gallery2.php to use the detachUri instead of the embedUri and was hoping you could provide some insight... As of now, I've updated gallery2.php as follows: if ( the linky thing somehow tells you its detached ) { print '<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">' . "\n<tr><td>\n"; require_once(MOS_GALLERY2_PARAMS_PATH . 'embed.php'); $ret = GalleryEmbed::init(array( 'detachUri' => MOS_GALLERY2_PARAMS_DETACHURI, 'relativeG2Path' => MOS_GALLERY2_PARAMS_RELATIVEG2PATH, 'loginRedirect' => MOS_GALLERY2_PARAMS_LOGINREDIRECT, 'activeUserId' => '0')); } else { print '<table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane">' . "\n<tr><td>\n"; require_once(MOS_GALLERY2_PARAMS_PATH . 'embed.php'); $ret = GalleryEmbed::init(array( 'embedUri' => MOS_GALLERY2_PARAMS_EMBEDURI, 'relativeG2Path' => MOS_GALLERY2_PARAMS_RELATIVEG2PATH, 'loginRedirect' => MOS_GALLERY2_PARAMS_LOGINREDIRECT, 'activeUserId' => '0')); } Obviously, there's duplication of the code earlier in the script that retrieves the param, etc. So tell me, Dr. Bob, how do I go about telling the script that it should execute the first block of code and not the latter? |
||||
artemido
![]()
Joined: 2005-02-08
Posts: 24 |
![]() |
|||
in going through this, I think I've determined that the best to call the correct block of code is to set a session variable. so I'm working towards that... this got me to thinking that it might be possible to do some kind of mambo session token grabbing for current user ID whose name could be found in the mambo user table (SELECT `id` FROM `mos_users` WHERE `username` = whatever;) and then mapping that username over to the g2 user store to permit SSO from mambo into g2. Obviously, it's not perfect and doesn't address the issue of having to create two user accounts, but it might be something... |
||||
chua85
Joined: 2005-02-03
Posts: 7 |
![]() |
|||
"isDone is not defined, something very bad must have happened." My admin component is working fine tho. |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
strange... Before testing the embedding, please make sure you installed Gallery G2 correctly and verify it's working in the stand-alone setting. If that is the case, the only reason I see for that error would be that the absolute path is not correct (or maybe access rights) . I'm sorry but I cannot provide more help than this |
||||
drumicube
Joined: 2005-01-07
Posts: 32 |
![]() |
|||
Hi DrBob, i'm the guy involves in the php-nuke module. That's why i would like to improve my mod by adding control tests to check params entered by the end user, and also more information on how it works. Why not sharing this together, our job are quite similar no ? cheers. |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
Drumicube, I would be more than willing to join forces so we can tackle these issues but again I must confess that I'm not that great in writing php code. Simply put, don't ask me to code something from scratch, I only can adapt existing code (that's why I'm still hoping to find somebody with php & Mambo experience) Regarding the above error. I think it is mainly caused by a wrong absolute path. Is there a way to dynamically search for the path where G2 is installed (maybe by checking G2's DB or something) ? Regards. |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
I tried to start with the user integration for Mambo and found the following: When visiting a mambo site, a cookie is created with the following variables:
Using some procedures from Mambo, retrieving the current userID/username should not be that difficult. Any hints on how to proceed are welcome In my embedding component, as a test, I hardcoded the activeUserID to '5' (that's the admin ID of gallery) but now I receive the below error : Error (ERROR_MISSING_OBJECT) : 5 GalleryUser in w:\www\gallery\modules\core\classes\helpers\GalleryEntityHelper_simple.class at line 137 (gallerystatus::error) in w:\www\gallery\modules\core\classes\GalleryCoreApi.class at line 2157 (galleryentityhelper_simple::loadentitybyexternalid) in w:\www\gallery\embed.php at line 155 (gallerycoreapi::loadentitybyexternalid) in w:\www\gallery\embed.php at line 72 (galleryembed::checkactiveuser) in W:\www\Mambo451\components\com_gallery2\gallery2.php at line 69 (galleryembed::init) in W:\www\Mambo451\index.php at line 180 What is happening here ? Also, I enabled the login for the embedded gallery. I can use this to login as the admin. The first page is displayed correctly (so with all the admin options) but as soon as I click on an admin link (add items), I receive a permission denied error. It seems that, somewhere along the way, my login info is lost. Regards, |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
Note the difference between externalId and entityId. Before you can use user ids in your integration, you have to map mambo to G2 user ids. At the moment, you have to use require_once(xarModGetVar('gallery2','g2.includepath') . '/modules/core/classes/ExternalIdMap.c lass'); $ret = ExternalIdMap::addMapEntry(array('externalId' => $externalId, 'entityType' => $entityTyp e, 'entityId' => $entityId)); But in 1,2 days you can use GalleryEmbed::addExternalMapEntry(,,). Once you have mapped the gallery admin (entityId = 5) to a corresponding user in mambo (i.e. externalId = mambo user id of admin = 3 (?)), you can use it in GalleryEmbed::init('activeUserId' = $mamboUserId, ...); |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
valiant, thanks for the quick anwser. As a test, I just manually inserted the mapping in the DB. This leads me to think that somewhere on the way, some data is lost (session/cookie ??). Error (ERROR_PERMISSION_DENIED) : in w:\www\gallery\modules\core\classes\helpers\GalleryUserHelper_medium.class at line 207 (gallerystatus::error) in w:\www\gallery\modules\core\classes\GalleryCoreApi.class at line 440 (galleryuserhelper_medium::assertsiteadministrator) in w:\www\gallery\modules\core\SiteAdmin.inc at line 46 (gallerycoreapi::assertuserissiteadministrator) in w:\www\gallery\modules\core\classes\GalleryView.class at line 246 (siteadminview::loadtemplate) in w:\www\gallery\main.php at line 257 (siteadminview::doloadtemplate) in w:\www\gallery\main.php at line 46 in w:\www\gallery\embed.php at line 126 in W:\www\Mambo451\modules\mod_galleryside.php at line 66 (galleryembed::handlerequest) in W:\www\Mambo451\includes\frontend.html.php at line 191 in W:\www\Mambo451\includes\frontend.php at line 135 (modules_html::module2) in W:\www\Mambo451\templates\symbiosys_v2\index.php at line 43 in W:\www\Mambo451\index.php at line 202 |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
I have no clue how mambo works. could you give some information: |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
Mambo has been installed in the [site root]/mambo451 folder The relative URL I'm using is "../gallery" This is an example of the link with this issue: Below is the code I'm using for the embedding require_once(MOS_GALLERY2_PARAMS_PATH . 'embed.php'); $ret = GalleryEmbed::init(array( 'embedUri' => MOS_GALLERY2_PARAMS_EMBEDURI, 'relativeG2Path' => MOS_GALLERY2_PARAMS_RELATIVEG2PATH, 'loginRedirect' => MOS_GALLERY2_PARAMS_LOGINREDIRECT, 'activeUserId' => '62')); |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
Seems to be ok. Do you use a second G2 component where the activeUserId is also set? I guess so. |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
valiant, Indeed... stupid me.. I totally forgot about the module that displays the sidebar. I also hardcoded it there and now the admin part works correctly So.. what should I do next then ? Kind regards, |
||||
KAC
Joined: 2004-12-01
Posts: 164 |
![]() |
|||
This is great. I've been waiting for this. Is there a nOOb tutorial on how to install this? I currently have Gallery2 installed as stand alone and it's working just fine. Is it possible to leave that the way it is and just install Mambo over it (to sorta-speak) and have it point to my current gallery install or does this require that I do a fresh install of both Mambo and Gallery? I'd love to have a nOOb tut. |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
KAC, it's too early to install it. You'd have to download the newest mod files again and again. I'd wait a week or two. But you could help by finding a mambo developer who likes the idea if G2 in mambo and would help with a few things. |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
DrBob, I'll document the steps to synchronize the userbase of G2 and mambo... |
||||
gsbe
![]()
Joined: 2004-01-27
Posts: 33 |
![]() |
|||
This looks like great fun! Thanks for working on this. Does this mean that G2 doesn't have plans to support Mambo natively as with 1.4.x? |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
Valiant, thanks for the info. I've been thinking on what I should do next for the user integration. Basically the following should be done: If "person x" visits the embedded gallery then If "person x" has a Mambo_UID then if Mambo_UID has a ExternalMapEntry then User exists already so set activeUserId = Mambo_UID Else user does not yet exist Get mambo user details & create user in g2 userDB Create ExternalMapEntry set activeUserId = Mambo_UID End if Else set activeUserId = "0" End if End If
One issue remaining is how to map the correct mambo-user to the gallery admin user. I think it best that this mapping is done in the back-end by the administrator. Simply show a list of all mambo users and select the one you want to map to the gallery admin user manually. Issues & questions :
I again made a post on a mambo forum asking for help in this. I really hope somebody shows up Kind regards, |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
DrBob wrote:
I've been thinking on what I should do next for the user integration. Basically the following should be done: Your code would check all these things on every request of a G2 page. But we have to keep performance in mind. And you don't have to check if a user is already mapped on each request (well, you will have to if mambo doesn't allow hooks into the create user function). DrBob wrote:
One issue remaining is how to map the correct mambo-user to the gallery admin user. that could be done. I'd do it a little different (as I did it in xaraya). When installing the module, the existing G2 and existing mambo users have to be mapped. (map admin to admin, anonymous to anonymous, ...). There will be some mambo users that don't exist in G2. You'll have to create them in G2. And there may be some users in G2 that don't exist in mambo, create them in mambo and create a mapping. DrBob wrote:
How do I check if a mapping already exists for a mambo-user? Query the ExternalIdMap for the mambo user id (= externalId). DrBob wrote:
When I use GalleryEmbed::createUser(), do I still have to create the mapping myself? No, GalleryEmbed::create/update/deleteUser manage the externalId map. DrBob wrote:
How to handle updates & deletion of users in mambo (help needed from mambo developer)? Exactly. This is the right approach. If mambo allows something like "hook into create, update, delete user functions" then do it. If that is not possible, we will have to find other ways (difficult for update and delete, but quite easy for create). |
||||
Caymill
Joined: 2004-11-09
Posts: 4 |
![]() |
|||
Only a short hello to say: nice work! We are running a G1x on an xhtml/css validating Mambo 4.51b site, well not the Gallery part though. We have a lot of pictures and videos already online (~2800 files and 118 albums), and there will be more. We would be very interested to work with G2. My personal main interest would be to integrate the multi-language operations, a basic xhtml/css validation and the naturally the native database support. We have also a mirror install available of our site, where we can experiment with these things. |
||||
DrBob
![]()
Joined: 2005-01-09
Posts: 20 |
![]() |
|||
Good news A few days I was contacted by Mr_Jinx, one of the developers of Docman for Mambo. He will take a further look into the integration of G2 into Mambo. According to him there are no direct hooks in Mambo for the user creation/update/delete but through a certain way, it should be possible. So a big thanks to Mr_Jinx Kind regards, |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
perhaps special mambots? who knows... but these are definitely very good news! |
||||
QuintenU
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
Just a quick message to say that I've successfully embedded G2 (CVS version) into Mambo 4.5.2 using the com_gallery2 component. Not sure what the embedUri should be though. User integration does not work (but reading the above, that was expected ;)). Excellent work DrBob! |
||||
mx3
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
hi, i realise you're very busy and this kind of request is a annoying but can you help me understand this error please? Fatal error: Undefined class name 'galleryembed' in ../public_html/directory/components/com_gallery2/gallery2.php on line 65 many thanks for the work you've done so far ...this will be a powerful engine |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
seems like embed.php wasn't included -> path to g2 is wrong. |
||||
mx3
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
thanks valient i am completely stuck ...i have tried absolutely everything i can think of but just can not embed g2 into mambo, keep getting the same error as previous post full path to g2 http://subdomain.somewhere.com/G2/ where 'G2' is the installation dir for g2, first child of subdomain (root dir for mambo) ie.'home/user/public_html/subdomain' linux/apache if anyone could help i'd appreciate it |
||||
mx3
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
delete please |
||||
gsbe
![]()
Joined: 2004-01-27
Posts: 33 |
![]() |
|||
Not to be a pain, but I am still wondering: Does this mean that G2 doesn't have plans to support Mambo natively as with 1.4.x? |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
gsbe, yes and no. Integrations are a little different in G2 than in G1. G2 doesn't have any integration built-in, but it has an interface and an API which should be generic enough to work with all kinds of other applications (custom websites, CMS, forums, ...). Then there are people like me or DrBob and lots of others who write a specific integration for a specific application. For CMS as mambo or xaraya, these integrations are mostly "modules" as mambo is modular. So, once DrBob is finished with the mambo integration, you can download his integration code and G2, and it is as if G2 had a built-in mambo integration. |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
mx3, i'm quite sure your G2 version is too old (g2 alpha 4). please check if it works with the current nightly snapshot (you get these up to date version from downloads -> jesse mullans nightly snapshots page -> current.gallery2.tar.gz). |
||||
mx3
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
success! ... G2 alpha 4 vs 17 embeds ...doesn't look pretty but embeds! |
||||
mx3
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
Check G2 standalone (SA) up to date and functioning. com_gallery2.zip config: NB: If you encounter problems with G2 login or 'permission denied' remove cookies, try setting firefox/client to session only ...clear cache etc This post is for users like me for which this is new ground! |
||||
Rejay
Joined: 2005-02-01
Posts: 7 |
![]() |
|||
Hi Guys, cu, |
||||
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
|||
Rejay, good news indeed. G2 is successfully integrated in the xaraya and the postnuke CMS, including user and auth/session management, i.e. the general problems are solved, probably your devs could adapt some code from there. But everything that is special to mambo has to be developed. Good luck! |
||||
artemido
![]()
Joined: 2005-02-08
Posts: 24 |
![]() |
|||
how close are we to finishing up the final integration points? Also, where does one go to download the latest iteration of the development you guys are doing? I'm essentially running DrBob's second rev of the integration with some small hacks that I've added here and there specifically for my site... I got distracted from stuff that I was doing in terms of user integration and full page pop-ups, so I haven't made any progress there myself. Thanks for all the work, guys... looks like it's going in the right direction |
||||
funky
Joined: 2005-02-28
Posts: 1 |
![]() |
|||
edoumenc wrote:
hi, i installed "com_gallery2" and "Mod_g2_sidebar" but i have an error. Hi |
||||
mx3
Joined: 2005-02-23
Posts: 6 |
![]() |
|||
hi funky, check your paths again carefully, if both installations are functioning the fault probably lies with the path config ...see previous forum page for an example |
||||
falgon
Joined: 2005-03-02
Posts: 1 |
![]() |
|||
funky wrote:
I am experiencing the same problem and am positive that gallery component paths are correct (I have double and triple checked these). My Mambo install is located in /var/www/localhost/htdocs/tristenlopez.com and gallery2 is installed in /var/www/localhost/htdocs/tristenlopez.com/gallery2 and I have located the gallery content folder at /var/www/localhost/htdocs/tristenlopez.com/images/stories/albums . |
||||