view slideshow link not working g2Uri not being read?

lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 00:09

I have G2 embedded in joomla and everything seems to be working fine, but for some reason the view sideshow is not working - there seems to be a problem with the url - ie g2Uri not being read by the system when it is loading the rss for the slideshow. for example here is the link for the view slideshow link:

http://localhost:8888/svn_joomla/trunk/index.php?option=com_helloworld&g2_view=slideshow.Slideshow&g2_itemId=15

this is fine, but when I click on it and look in firebug I see another link loaded (i htink with ajax):

http://localhost:8888/index.php?option=com_helloworld&g2_view=slideshow.SlideshowMediaRss&g2_itemId=15
error: PicLens Lite could not load the RSS Feed: http://localhost:8888/index.php?option=com_helloworld&g2_view=slideshow.SlideshowMediaRss&g2_itemId=15

notice it is cutting off the sub directories? I am sure I have it configured properly because notihing else would work if it wasn't...

so it seems like something is not picking up g2Uri...

I have searched a lot here to find the issue, but no go :(

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-10-07 00:17
 
lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 00:55

thanks -

I got it to work in an ugly way by find and replace the links,

foreach($head[2] as $k=>$v){
$head[2][$k] = str_replace('http://localhost:8888/', JURI::base(), $head[2][$k]);
}

well at least I got the viewer to work, but not the links in the rss feed are also messed up:

I have also noticed that the same is happening for media links here:

http://localhost:8888/svn_joomla/trunk/index.php?option=com_helloworld&g2_view=slideshow.SlideshowMediaRss&g2_itemId=7

the media link comes up like this:

http://localhost:8888/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=15&g2_serialNumber=1

here is my config file - it looks fine to me...:

Quote:
<?php
/*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2008 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/

/*
* When display_errors is enabled, PHP errors are printed to the output.
* For production web sites, you're strongly encouraged to turn this feature off,
* and use error logging instead.
* During development, you should set the value to true to ensure that you notice
* PHP warnings and notices that are not covered in unit tests (e.g. template issues).
*/
@ini_set('display_errors', 0);

/*
* Prevent direct access to config.php.
*/
if (!isset($gallery) || !method_exists($gallery, 'setConfig')) {
exit;
}

/*
* As a security precaution, we limit access to Gallery's test suite
* to those people who know the password, below. Example:
*
* $gallery->setConfig('setup.password', 'A PASSWORD');
*
* Choose something random and enter it in plain text. You don't have to
* remember it because you can always refer to this file. You'll only be asked
* for this password when you run Gallery's lib/tools code. We don't provide a
* default password because we want you to choose one of your own (which
* lessens the chance that you'll get hacked).
*/
$gallery->setConfig('setup.password', '**');

/*
* In order for Gallery to manage your data, you must provide it with
* a directory that it can write to. Gallery is a webserver application,
* so the directory that you create must be writeable by the
* webserver, not just by you.
*
* Create an empty directory anywhere you please. Gallery will fill this
* directory with its own files (that you shouldn't mess with). This directory
* can be anywhere on your filesystem. For security purposes, it's better
* if the directory is not accessible via your webserver (ie, it should
* not be in your DocumentRoot). If you *do* make it available via your
* web server then you probably won't have any security for your data files.
*
* Don't make this the same as your gallery directory!
*/
$gallery->setConfig('data.gallery.base', '/Applications/MAMP/htdocs/svn_joomla/trunk/gallery2/g2data/');

/*
* Gallery can store its data in multiple different back ends. Currently we
* support MySQL, PostgreSQL and Oracle. Enter the hostname where your
* database lives, and the username and password you use to connect to it.
*
* You must specify the name of a database that already exists. Gallery will
* not create the database for you, because it's very difficult to do that in
* a reliable, database-neutral fashion. The user that you use should have
* the following permissions:
*
* SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER
*
* You must specify a table and column prefix. This is a few characters that
* is prepended to any table or column name to avoid conflicting with reserved
* words in the database or other tables you have in the same database. In
* fact, it's fine to let Gallery uses the same database as other applications
* (including other instances of Gallery itself); the prefix is enough
* to distinguish Gallery's tables from other applications.
*
* We provide some reasonable default prefixes below. If you modify these
* after Gallery has created its various tables, it will stop working until
* you modify it back.
*
* The possible database types are:
* mysqlt MySQL (3.23.34a and newer)
* mysqli MySQL (4.1 and newer) with PHP mysqli extension
* mysql Older MySQL (no transactions)
* postgres7 PostgreSQL 7.x and newer
* postgres PostgreSQL 6.x (not tested)
* oci8po Oracle 9i and newer
* db2 IBM DB2 9 and newer
* ado_mssql Microsoft SQL Server (2005 and newer)
*/
$storeConfig['type'] = 'mysqli';
$storeConfig['hostname'] = 'localhost';
$storeConfig['database'] = 'Joomla_156';
$storeConfig['username'] = 'root';
$storeConfig['password'] = 'root';
$storeConfig['schema'] = '';
$storeConfig['tablePrefix'] = 'jos_g2_';
$storeConfig['columnPrefix'] = 'g_';
$storeConfig['usePersistentConnections'] = false;
$gallery->setConfig('storage.config', $storeConfig);

/*
* Put Gallery into debug mode. Useful for tracking down problems with the
* application. Not a good idea to leave it this way, though. Possible debug
* choices are: 'buffered', 'logged', 'immediate' or false. Don't forget to
* use the quotes for any value but false!
*
* If you choose 'immediate', you'll see debugging information as soon as
* Gallery generates it. This can be useful at times, but it'll screw up some
* parts of the application flow.
*
* If you choose 'buffered', Gallery will display debug information in a table
* as part of the application. You won't necessarily get *all* the debug
* information but the application should work normally.
*
* If you choose 'logged', you must also specify:
* $gallery->setDebugLogFile('/path/to/writeable/file');
* and all debug output will get printed into that file. You'll get all the
* debug output and the application will work normally.
*
* For best debugging output use this line:
*
* $gallery->setDebug('buffered');
*
*/
$gallery->setDebug(false);

/*
* Profiling mode. You can enable profiling for different parts of G2 to get an
* idea of what's fast and slow. Right now the only options are to enable SQL
* profiling:
*
* $gallery->setProfile(array('sql'));
*
*/
$gallery->setProfile(false);

/*
* Maintenance mode. You can disable access to the site for anyone but
* site administrators by setting this flag. Set value below to:
* true (without quotes) - to use a basic notification page; themed
* view with admin login link when codebase is up to date, but a
* plain unstyled page when codebase has been updated but upgrader
* has not yet been run.
* url (with quotes) - provide a url where requests are redirected in
* either case described above. Example: '/maintenance.html'
* false (without quotes) - maintenance mode off
*/
$gallery->setConfig('mode.maintenance', false);

/*
* Embedded mode. You can disable direct access to main.php (standalone G2)
* by setting this flag. Set value below to:
* true (without quotes) - block direct requests
* url (with quotes) - redirect requests to this url
* false (without quotes) - allow direct requests
*/
$gallery->setConfig('mode.embed.only', false);

/*
* Allow a particular IP address to access the session (it still must know the
* session id) even though it doesn't match the address/user agent that created
* the session. Put the address of validator.w3.org ('133.27.228.132') here to allow
* validation of non-public Gallery pages from the links at the bottom of the page.
*/
$gallery->setConfig('allowSessionAccess', false);

/*
* URL of Gallery codebase; required only for multisite install.
*/
$gallery->setConfig('galleryBaseUrl', '');

/*
* This setting can be used to override Gallery's auto-detection of the domain-name,
* protocol (http/https), URL path, and of the file & query string.
* Most users can leave this empty. If the server is misconfigured or for very special
* setups, this setting can be quite handy.
* Examples (the positions of the slashes ('/') are important):
* override the path: $gallery->setConfig('baseUri', '/another/path/');
* override the host + path: $gallery->setConfig('baseUri', 'example.com/gallery2/');
* override the protocol + host + path + file:
* $gallery->setConfig('baseUri', 'https://example.com:8080/gallery2/index.php');
*/
$gallery->setConfig('baseUri', 'http://localhost:8888/svn_joomla/trunk/gallery2/main.php');
?>

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-10-07 00:57
 
lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 00:57

oh and here is my ret setupt

Quote:
$ret = GalleryEmbed::init(array( 'embedUri' => '/index.php?option=com_helloworld', 'g2Uri' => '/gallery2/', 'loginRedirect' => '/gallery2/', 'activeUserId' => ''));

 
lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 01:00

just installed then, didn't make nay difference

 
lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 01:34

well this has got me stumped, everything is right, yet the rss for the slidehow is giving the wrong url - anyone can tell me where this url comes from? cause it aint coming from $gallery->setConfig('baseUri', JURI::base()); thanks!

 
lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 02:24

Well i have to give up on that module - this is a bug, I am pretty sure of it, basically I have delved into the code and got as far as this:

Quote:
/**
* Return the base directory of all generated URLs. Eg, if the URL is:
* http://example.com/gallery2/main.php
* Then we return:
* http://example.com/gallery2/
*
* Usually, it's the same as the URL directory of the current request URL, unless we're using
* short URLs. Also, the base URL can be overridden
*
* @param boolean $forceDirect (optional) if true, ensure Gallery base URL is returned
* (different when embedded)
* @return string the base URL directory
*/
function getCurrentUrlDir($forceDirect=false) {

this is what is causing the problem, nameley from the g->url calls

<media:thumbnail url="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$i.thumbnail.id`" arg3="serialNumber=`$i.thumbnail.serialNumber`" forceFullUrl=true}" {if !empty($i.thumbnail.height)}height="{$i.thumbnail.height}" width="{$i.thumbnail.width}"{/if} type="{$i.thumbnail.mimeType}"/>

I can change the above function's output and it works for the rss page - but then it breaks everything else... so you have something that works for every other module but the slideshow... bug I say and a waste of hours of my time :(

Thanks.

 
lobos

Joined: 2004-11-24
Posts: 14
Posted: Wed, 2009-10-07 02:49

not a bug - now I am embarrassed!!!! sorry - it was all to do with my config

first I was doing it like this:

Quote:
$ret = GalleryEmbed::init(array( 'embedUri' => '/index.php?option=com_helloworld', 'g2Uri' => '/gallery2/', 'loginRedirect' => '/gallery2/', 'activeUserId' => ''));

so it didn't have the full url...

fixed once I added the full url

Quote:
$ret = GalleryEmbed::init(array( 'embedUri' => JURI::base().'index.php?option=com_helloworld', 'g2Uri' => JURI::base().'gallery2/', 'loginRedirect' => '/gallery2/', 'activeUserId' => ''));

oops... sorry for my outbursts...

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-10-07 03:01

Read what this guy has to say about joomla which is very close to my personal opinion.
And I know of 2 joomla/gallery2 integrations both of which appear broken.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2