@sidebar:
got a css problem:
2 cases:
1. sidebar is in the same container as the bodyHtml (standalone G2 and embedded G2 admin views / search):
in this case we need the default css:
we got redefine these css classes if GalleryCapabilities::set('showSidebar', false); was called and the site we're displaying doesn't include the sidebar in the bodyHtml.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2004-12-12 15:32
Einstein, great news!
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-12-12 17:21
valiant, oh yeah totally forgot about that css change.. I added this in my xaruser/main.php.. $GLOBALS['xarTpl_additionalStyles'] .= '<style type="text/css"> #gsSidebar { float:none !important; width:100% !important; } </style>';
The !important will make it override a previous setting.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2004-12-12 17:48
mindless, but this css override is only wanted for non-admin views, i.e. in embedded G2 all admin views and the search view have the sidebar in the bodyHtml and if we override the standard G2 css in this case, it's screwed up too.
ah, sorry, so i'll check if sidebarHtml is empty, that will work.
edit: it works, thanks.
Einstein
Joined: 2003-10-13
Posts: 105
Posted: Sun, 2004-12-12 19:11
There is a parameter gallerySessionId in the init function. From where do I get the id?
And what's the format of activeLanguage?
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-12-12 19:19
Einstein, check docs/EMBEDDING.. gallerySessionId is only needed if you want to support cookieless browsing in your integration.
activeLanguage is a locale.. so "en" or "en_US" are the type of values you can use.
notice the urls. for showitem there's xaraya-0-9-10/index.php?module=baseindex.php?module=gallery2 instead of xaraya-0-9-10/index.php?module=gallery2
and the downloaditem is wrong too.
the problem is somewhere in GalleryTemplate::fetch(), GalleryUrlGenerator::generateUrl and GalleryUrlGenerator::getCurrent...
the code is use to generate the image block html:
function gallery2_imageblock_display($blockinfo)
{
if (!xarSecurityCheck('ReadGallery2', 1, 'Block', $blockinfo['title'])) {return;}
// first check if the module has been configured
if(!xarGallery2Helper::isConfigured()) {
return;
}
// init G2 if not already done so
if (!xarGallery2Helper::init(false, true)) {
return;
}
$params = array();
$params['blocks'] = 'randomImage'; // 'randomImage|recentImage|viewedImage|randomAlbum|recentAlbum|viewedAlbum|specificItem'
$params['heading'] = null; // 1 to get block header;
$params['itemId'] = null; // not a specific itemId
$params['show'] = 'title'; // 'title|date|views|owner|none';
// use the gallery API
global $gallery;
$moduleId = 'imageblock';
/* Load the module list */
list ($ret, $moduleStatus) = GalleryCoreApi::fetchPluginStatus('module');
if (!$ret->isSuccess()) {
$msg = xarML('G2 did not return a success status upon an imageblock request. Here is the error message from G2: <br /> [#(1)]', $ret->getAsHtml());
xarErrorSet(XAR_SYSTEM_EXCEPTION, 'FUNCTION_FAILED', new SystemException($msg));
return;
}
if (isset($moduleStatus[$moduleId]) && !empty($moduleStatus[$moduleId]['active'])) {
list ($ret, $module) = GalleryCoreApi::loadPlugin('module', $moduleId);
if (!$ret->isSuccess()) {
$msg = xarML('G2 did not return a success status upon an imageblock request. Here is the error message from G2: <br /> [#(1)]', $ret->getAsHtml());
xarErrorSet(XAR_SYSTEM_EXCEPTION, 'FUNCTION_FAILED', new SystemException($msg));
return;
}
}
/* Load the G2 templating engine */
GalleryCoreApi::requireOnce(xarModGetVar('gallery2','g2.includepath') . 'modules/core/classes/GalleryTemplate.class');
$template = new GalleryTemplate(dirname(__FILE__));
$template->setVariable('l10Domain', 'module_' . $moduleId);
// generate the imageblock
list ($ret, $tpl) = $module->_loadImageBlocks($template, $params);
if (!$ret->isSuccess()) {
$msg = xarML('G2 did not return a success status upon an imageblock request. Here is the error message from G2: <br /> [#(1)]', $ret->getAsHtml());
xarErrorSet(XAR_SYSTEM_EXCEPTION, 'FUNCTION_FAILED', new SystemException($msg));
return;
}
// render and get the imageblock html
list ($ret, $blockinfo['content']) = $template->fetch(xarModGetVar('gallery2','g2.includepath') . $tpl);
if (!$ret->isSuccess()) {
$msg = xarML('G2 did not return a success status upon an imageblock request. Here is the error message from G2: <br /> [#(1)]', $ret->getAsHtml());
xarErrorSet(XAR_SYSTEM_EXCEPTION, 'FUNCTION_FAILED', new SystemException($msg));
return;
}
return $blockinfo;
}
note: GalleryInitFirstPass etc. gets called in both cases.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-12-12 20:59
so can't you pass embedUri to match the current request?
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2004-12-12 21:09
well, i call GalleryEmbed::init() with the right params, embedUri, etc.
don't know why it doesn't work if the current http path is not ...index.php?module=gallery2...
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2004-12-12 23:49
mindless,
i have a problem with the imageblock.
if i call the above api methods with $params['blocks'] = 'randomAlbum'; or any other album related block, i get a "ERROR_BAD_PARAMETER" error if there is no subalbum in G2.
then i create a sub album in G2 and the above code doesn't produce any errors.
shouldn't it return "error_missing_object" or just html with "sorry, no albums available"?
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-12-12 23:54
first, summary of our irc discussion:
-- can pass a different embedUri which allows the regex to replace correctly, the then the generated url is wrong.. hack for now: modify $_SERVER['REQUEST_URI'] before calling G2 so it will build the correct urls (and set it back when done).. possible future solution: alter GalleryUrlGenerator so it analyzes $_SERVER stuff when it is constructed (instead of every time it is used, as it does now) and add optional param to constructor to override using $_SERVER and just give it the correct base url (or something like that...)
@imageblock
hm.. i think the imageblock on the G2 sidebar handles that (if i recall correctly).. please file a bug on sourceforge for this.. thx
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2004-12-13 22:03
i've added two methods to embed.php
GalleryEmbed::getImageBlock($params) returns array(Gallery status code, the html for an imageblock of your choice) similar to imageblock:External
GaleryEmbed::parseHead($headhtml) returns array(title, css links, javascript)
mindless, spiderr is making great progress with his tikipro integration, see his demo site here: http://clyde.tikipro.org/gallery2/index.php
notice the "photos" menu item at the top!
it's dynamic, without any changes to g2.
/*
my pieces of embed card are in tikipro/gallery2/
g2 source is pristing, and in tikipro/gallery2/gallery2/
inside my embed file tikipro/gallery2/index.php
*/
GalleryCapabilities::set('showSidebar', FALSE);
$g2data = GalleryEmbed::handleRequest();
$smarty->assign_by_ref( 'menuLinks', $g2data['layoutData']['itemLinks'] );
?>
/*
contents of tikipro/gallery2/templates/menu_gallery2.tpl
*/
{strip}
<ul>
{section loop=$menuLinks name=menu}
<li><a class="item" href="{$menuLinks[menu].url}">{tr}{$menuLinks[menu].text}{/tr}</a></li>
{/section}
</ul>
{/strip}
i really like this kind of menu, not that's it's javascript etc. but how easy you can get the links.
don't you think we should offer this kind of menu in embed.php too?
for item links etc.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Fri, 2004-12-17 21:48
Hi, when I want to install Gallery2 Module (from Nei.ch 17.12.2004) in Xaraya (CVS from 16.12.2004) I got the following error when I hit Update Config in the Gallery2 Module:
Function failed:
Could not create a xar role for a G2 group [Alle Benutzer] (All users)
Explanation:
The function was correct executed but the results where bad
Stapel:
at g2xarusergroupimportexport(xargallery2helper.php:1364)
at gallery2_admin_updateconfig(updateconfig.php:82)
Thanks in advance,
Danny
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2004-12-17 23:53
Danny, thanks a lot for your report, what I need are beta testers like you!
What exactly is special about your installation?
What are the steps to reproduce the error?
1. get newest xaraya cvs/bitkeeper version
2. get newest G2 cvs version
3. get the gallery2_xaraya_module from nei.ch from 17.12.2004
4. install xaraya and G2 without any special modules
5. switch site default language in xaraya to german
6. go to xaraya admin menu->Gallery2->config->update config
anything else, like changing the language in G2 or creating any group or renaming any group, creating users?
or if you could give me ssh access or admin phpmyadmin access or the like, that would help too.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2004-12-18 00:36
Danny, i tried to reproduce the error but failed, there was no error. what i did:
xaraya 0.9.11 is out, no need to get it from cvs:
1. get newest xaraya from xaraya.com, install with lang de-utf8
2. reinit G2, set language to german
3. use my current version of the gallery2_xaraya_module.
4. go to xaraya admin menu->Gallery2->config->update config
-> success
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2004-12-18 09:10
mindless, thanks for the "initsecondpass for non-handlerequest-requests" fix
it works.
i guess it got slower now (only the imageblock, which is a non-handlerequest-request), but perhaps it's just a subjective impression.
there's no "setActiveUser" method that is more lightweight than GalleryInitSecondPass(, right?
i'm calling ::init and ::done only once per http request, no matter how many imageblocks i request (static "isInitiated" flag and ::done called as a shutdownhandler).
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2004-12-18 21:42
What's on the todo list?
1. Better sidebar (system, item links, cart block) integration: perhaps spiderr could do this?
2. UI-less search API: mindless is working on it, right?
3. docs and a non-xaraya show case too.
Einstein
Joined: 2003-10-13
Posts: 105
Posted: Sun, 2004-12-19 01:33
Quote:
Pass in an empty string for anonymous/guest user
If you pass an empty string and the G2 session is "logged in" then G2 takes the logged in user as current. That's wrong in my opinion. If a empty string is set then it should force G2 to be in anonymous state.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-12-19 16:50
yes, that is wrong, and not what it does, AFAIK. See GalleryEmbed::checkActiveUser.
valiant, i'll get to the search api soon, yes.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Sun, 2004-12-19 17:34
Valiant, no problem, I'm used to be a Beta tester :lol:
I use Xaraya more than a year, so I'm used to get it with Bitkeeper. I solved my Gallery2 problem with creating all the users / groups Gallery2 wanted within Xaraya Roles Module. After that it works now and Gallery2 is synchronizing all my users.
There is still a problem with the sidebar not being showed when I'm within Xaraya as Xaraya Admin. But I will look after it.
It is a good Idea to show your development of the Gallery2 Module in a directory style.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Sun, 2004-12-19 18:09
Valiant, I have a small wish. My imageblock should be only visible when the user is logged in. Now it will shown a nasty looking error code.
In order to get rid of, I tried in Gallery2/Xartemplates/Blocks/Image.xd the following code but the error is still there when the User is not logged in:
<xar:if condition="xarUserIsLoggedIn()">
<p>
<xar:if condition="$configured eq 1">
#$imageblock#
<xar:else/>
<xar:mlstring>The module has not been configured yet.</xar:mlstring>
</xar:if>
</p>
</xar:if>
I'm I missing something? Where should the xarUserIsLoggedIn() be placed?
Thanks in advance,
Danny[/b]
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-12-19 19:34
valiant, I added searchScan() and search() to GalleryEmbed. These work similarly to the search module, ie a function to scan a few results from each available search module and a function to get pages of results from a specific module (not saying this is the best search interface, just matches how it works now..). I did not expose the search options via this interface (checkboxes for search descriptions, keywords, etc).. it just uses the defaults for options.
Try this out and see how it works.. then we can see if you need anything more from this search interface.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2004-12-19 21:33
@search:
mindless, ok, gonna try to make search wrapper in xaraya, it's definitely one of the hardest tasks to do in xaraya.
@imageblock: mindless, could you look into the errors we get from G2 when using GalleryEmbed::getImageBlock() when no images match the criteria?
the normal sidebar imageblock from G2 doesn't show any errors in this case, it just shows "no images yet" or something like that.
@Danny:
1. ok, now i don't know what caused the error but ok.
2. imageblock: no, i don't think that's the way to go in xaraya. xaraya first creates the content of imageblock and then parses the template. if you have a condition in the template, that won't work.
- what error do you get?
- you should make this condition on permission level. afaik i created a permission Gallery2ViewBlocks or something like that. perhaps i didn't. good point, i should add finer grained permissions.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2004-12-20 04:36
valiant, I fixed up GalleryEmbed::getImageBlock.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2004-12-20 08:43
thanks to fix my laziness!
gonna test it later this week.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Mon, 2004-12-20 11:12
I got the following error:
Privileges Error:
No Permission für ReadGallery2
Problem:
The operation you are attempting requires privileges that you do not have. Contact the systems/site administrator to request access.
It is really plaguing me. IMHO it would be better, when no error message is shown!
I asked in the Xaraya Dev Newsgroup for suppressing privilege errors and I got back the following message from Marc:
You can suppress the error message by setting the second parameter of a
security check to 0 (the default is 1). For example
if (xarSecurityCheck('AddRole',0)) {
<I execute only if the privilege is there>
}
Marc
Valiant, can you tell me how your privilege setting works for not showing an ImageBlock for AnonUsers? I want to hide my Imageblocks for all users which are not logged in.
I think I tried all possibilities but still have no success to suppress the ImageBlock. I have created for the Group "CasualAccess" an privilege called "DenyImageBlock". I tried it really with a lot of combinations, but the error message still was there.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2004-12-20 14:28
Danny, I will change my securityCheck to the above version with the second argument set to '0', that should solve it.
you can do it for yourself, go to xaraya/modules/gallery2/xarblocks/image.php and change the security check.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Mon, 2004-12-20 15:27
Valiant, you are the man. Changed 1 to 0 and now it works perfect without the bad error code.
Thanks for your help,
Danny
t3rmin
Joined: 2004-12-04
Posts: 5
Posted: Mon, 2004-12-20 23:53
walkah wrote:
t3rmin: I am indeed working on drupal + G2 integration. checkout my test site:
it's running drupal 4.5 & the latest (2004-12-09) CVS HEAD of gallery2. I will be making my drupal module available soon in the drupal contributions cvs repository.
Right on. I'll be looking forward to it (the module release). I did try out Xaraya (as well as several other CMS packages) and came back to Drupal. It fits what I want to do much better than anything else.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Tue, 2004-12-21 22:27
How can I get rid of the headlines in Imageblock and Most viewed block? I want only that the title will be shown, which I define within Xaraya.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2004-12-21 22:57
don't pass 'heading' key in the params array to getImageBlock.
see site admin for imageblock or phpdoc for getImageBlock in embed.php for info on imageblock params.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2004-12-22 00:15
Danny, i will make it optional = add it to the block instance configuration. but not before christmas. i'm working 24x7 on other things.
meanwhile you could go to the xarblocks/image.php and change the $params['heading'] = 0; or perhaps i wrote getImageBlock(array('heading' => 1, ..., just change the value to 0.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Wed, 2004-12-22 17:00
Valiant, no problem, take your time. Right now I have bigger problems. Starting yesterday I see no Thumbnails. I have all things done, uploaded newest CVS to the Server, double checked Netpbm settings, deleted all my Albums and reimported it again from Gallery 1, but without any success. Do you have any idea, what can else be done? Also in Standalone mode, and even when I login as admin I see no Thumbnails.
Danny
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2004-12-22 17:44
no thumbs, but in showitem views you see an image?
no idea. perhaps you should post this to the support forum.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2004-12-22 18:00
he already did.. further discussion of that problem will be in that topic.
Einstein
Joined: 2003-10-13
Posts: 105
Posted: Wed, 2004-12-22 22:55
Einstein wrote:
Quote:
Pass in an empty string for anonymous/guest user
If you pass an empty string and the G2 session is "logged in" then G2 takes the logged in user as current. That's wrong in my opinion. If a empty string is set then it should force G2 to be in anonymous state.
mindless wrote:
yes, that is wrong, and not what it does, AFAIK. See GalleryEmbed::checkActiveUser.
did you login as admin via main.php?
try logging out via main.php, then login and logout via embed.. see if that works. checkActiveUser() checks against a session variable that is only set when you login via embed.. if this turns out to be the problem maybe i'll see if i can do the check against a setting that is there however you logged in.
Einstein
Joined: 2003-10-13
Posts: 105
Posted: Thu, 2004-12-23 00:48
mindless wrote:
did you login as admin via main.php?
try logging out via main.php, then login and logout via embed.. see if that works. checkActiveUser() checks against a session variable that is only set when you login via embed.. if this turns out to be the problem maybe i'll see if i can do the check against a setting that is there however you logged in.
Your asumption was right. It was the main session that was still alive. It is a problem if you use gallery both embedded and the normal way.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2004-12-23 01:07
ok, i think this is an easy fix. when you login via main.php it doesn't put any external userid in the session.. when you then visit via embed.php it gets null from the session and compares to '' from the activeUserId param.. using == these are equal.. with === they will not be equal, so that first request from embed.php will always update the user in the G2 session and put the external id in the session.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2004-12-24 00:18
mindless, @search/searchScan:
what's the default way of doing a search? i guess searchScan, right?
things that would be nice:
- in the results array: not only the itemId, but a link to the showItem and downloadItem (for the thumbnail) too.
of course i could build them somehow, but i guess that's something all embedded apps have in common, all need a link to the search hits.
- offset and a maxresults (over all max, not per module max) for searchScan
what do you think?
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-12-24 00:29
you can add stuff in the results of GalleryEmbed::searchScan if you like...
as i mentioned, i implemented it the way the search module works now.. that's why you get per module results, not an overall count of results.
an offset of overall results is tricky because you don't know which module search to use just based on the offset..
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2004-12-26 21:51
mindless, I tried to write a xaraya search hook and this is the error i get from G2 (current cvs) when calling galleryembed::searchscan: Fatal error: Class gallerycoresearch: Cannot inherit from undefined class gallerysearchinterface_1_0 in /var/www/localhost/htdocs/gallery2/modules/core/classes/GalleryCoreSearch.class on line 34
I added the following line to the searchscan method, but it doesn't change anything, i still get the error.
list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'search');
Before calling searchscan, i call galleryembed::init if that helps.
IMO you should add a include_once ../../search/etc. or something in core/classes/GalleryCoreSearch.class
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2004-12-27 04:14
quite right.. i've added the require for the parent class.
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2004-12-27 10:15
I also had to add
require_once(dirname(__FILE__) . '/modules/search/classes/SearchUtilities.class');
to the searchScan method in embed.php.
Should I drop the loadplugin('module' 'search'); because it's loaded always anyway or commit the changed searchScan to cvs?
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2004-12-27 19:36
I added the require.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Wed, 2004-12-29 10:41
Valiant, may there be a small problem with the Xaraya integration? I have seen in my logs, that Xaraya complains about
user variable NavigationLocale not correct registered
What shows your logs, do you have also any errors? I have seen, that Variable NavigationLocale is used in xargallery2helper.php.
I have asked in the Newsgroup Xaraya.User for that problem. Mikespub responded:
There is a session variable called navigationLocale, but no user variable
like that. Did you try out any particular themes or modules lately, that
contains something like xarUserGetVar('navigationLocale') instead of
xarSessionGetVar('navigationLocale') ?
Thanks for your help,
Danny
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2004-12-29 12:07
Thanks! I may have used the wrong function, gonna look into that.
Danny
Joined: 2003-03-24
Posts: 90
Posted: Wed, 2004-12-29 12:59
Thanks for your help. Do you use also the variable name "timezone"? I ask because in my error log is also:
user variable timezone not correct registered
Danny
valiant
Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2004-12-29 14:42
no, i don't use / get / set anything related to "timezone".
Danny
Joined: 2003-03-24
Posts: 90
Posted: Thu, 2004-12-30 16:44
Hmm, strange thing. I got another error message:
Warning: Unknown(): Unable to call xarGallery2Helper::_done()() - function does not exist in Unknown on line 0
Warning: Unknown(): Unable to call xarGallery2Helper::_done()() - function does not exist in Unknown on line 0
Any clues? If there any new versions of your Gallery2 Modul I'm happy to test it.
Posts: 32509
@sidebar:
got a css problem:
2 cases:
1. sidebar is in the same container as the bodyHtml (standalone G2 and embedded G2 admin views / search):
in this case we need the default css:
2. case: sidebar and bodyHtml in different containers, only in g2 embedded.
in this case the "width: xx%" directives screw things up.
we just need:
we got redefine these css classes if GalleryCapabilities::set('showSidebar', false); was called and the site we're displaying doesn't include the sidebar in the bodyHtml.
Posts: 32509
Einstein, great news!
Posts: 8601
valiant, oh yeah totally forgot about that css change.. I added this in my xaruser/main.php..
$GLOBALS['xarTpl_additionalStyles'] .= '<style type="text/css"> #gsSidebar { float:none !important; width:100% !important; } </style>';
The !important will make it override a previous setting.
Posts: 32509
mindless, but this css override is only wanted for non-admin views, i.e. in embedded G2 all admin views and the search view have the sidebar in the bodyHtml and if we override the standard G2 css in this case, it's screwed up too.
ah, sorry, so i'll check if sidebarHtml is empty, that will work.
edit: it works, thanks.
Posts: 105
There is a parameter gallerySessionId in the init function. From where do I get the id?
And what's the format of activeLanguage?
Posts: 8601
Einstein, check docs/EMBEDDING.. gallerySessionId is only needed if you want to support cookieless browsing in your integration.
activeLanguage is a locale.. so "en" or "en_US" are the type of values you can use.
thanks for helping out with a new integration!
Posts: 32509
mindless, problemo:
the imageblock code i use to get the html for an imageblock works, if the current path is http://192.168.123.123/xaraya-0-9-10/index.php?module=gallery2
but it doesn't work if the current path is http://192.168.123.123/xaraya-0-9-10/index.php?module=base
(this is the path to another module in xaraya, the imageblock is shown in all modules)
notice the urls. for showitem there's xaraya-0-9-10/index.php?module=baseindex.php?module=gallery2 instead of xaraya-0-9-10/index.php?module=gallery2
and the downloaditem is wrong too.
the problem is somewhere in GalleryTemplate::fetch(), GalleryUrlGenerator::generateUrl and GalleryUrlGenerator::getCurrent...
the code is use to generate the image block html:
note: GalleryInitFirstPass etc. gets called in both cases.
Posts: 8601
so can't you pass embedUri to match the current request?
Posts: 32509
well, i call GalleryEmbed::init() with the right params, embedUri, etc.
don't know why it doesn't work if the current http path is not ...index.php?module=gallery2...
Posts: 32509
mindless,
i have a problem with the imageblock.
if i call the above api methods with $params['blocks'] = 'randomAlbum'; or any other album related block, i get a "ERROR_BAD_PARAMETER" error if there is no subalbum in G2.
then i create a sub album in G2 and the above code doesn't produce any errors.
shouldn't it return "error_missing_object" or just html with "sorry, no albums available"?
Posts: 8601
first, summary of our irc discussion:
-- can pass a different embedUri which allows the regex to replace correctly, the then the generated url is wrong.. hack for now: modify $_SERVER['REQUEST_URI'] before calling G2 so it will build the correct urls (and set it back when done).. possible future solution: alter GalleryUrlGenerator so it analyzes $_SERVER stuff when it is constructed (instead of every time it is used, as it does now) and add optional param to constructor to override using $_SERVER and just give it the correct base url (or something like that...)
@imageblock
hm.. i think the imageblock on the G2 sidebar handles that (if i recall correctly).. please file a bug on sourceforge for this.. thx
Posts: 32509
i've added two methods to embed.php
GalleryEmbed::getImageBlock($params) returns array(Gallery status code, the html for an imageblock of your choice) similar to imageblock:External
GaleryEmbed::parseHead($headhtml) returns array(title, css links, javascript)
mindless, spiderr is making great progress with his tikipro integration, see his demo site here: http://clyde.tikipro.org/gallery2/index.php
notice the "photos" menu item at the top!
it's dynamic, without any changes to g2.
here's how he does it (his code):
http://www.pastebin.com/129303
i really like this kind of menu, not that's it's javascript etc. but how easy you can get the links.
don't you think we should offer this kind of menu in embed.php too?
for item links etc.
Posts: 90
Hi, when I want to install Gallery2 Module (from Nei.ch 17.12.2004) in Xaraya (CVS from 16.12.2004) I got the following error when I hit Update Config in the Gallery2 Module:
Function failed:
Could not create a xar role for a G2 group [Alle Benutzer] (All users)
Explanation:
The function was correct executed but the results where bad
Stapel:
at g2xarusergroupimportexport(xargallery2helper.php:1364)
at gallery2_admin_updateconfig(updateconfig.php:82)
Thanks in advance,
Danny
Posts: 32509
Danny, thanks a lot for your report, what I need are beta testers like you!
What exactly is special about your installation?
What are the steps to reproduce the error?
1. get newest xaraya cvs/bitkeeper version
2. get newest G2 cvs version
3. get the gallery2_xaraya_module from nei.ch from 17.12.2004
4. install xaraya and G2 without any special modules
5. switch site default language in xaraya to german
6. go to xaraya admin menu->Gallery2->config->update config
anything else, like changing the language in G2 or creating any group or renaming any group, creating users?
or if you could give me ssh access or admin phpmyadmin access or the like, that would help too.
Posts: 32509
Danny, i tried to reproduce the error but failed, there was no error. what i did:
xaraya 0.9.11 is out, no need to get it from cvs:
1. get newest xaraya from xaraya.com, install with lang de-utf8
2. reinit G2, set language to german
3. use my current version of the gallery2_xaraya_module.
4. go to xaraya admin menu->Gallery2->config->update config
-> success
Posts: 32509
mindless, thanks for the "initsecondpass for non-handlerequest-requests" fix
it works.
i guess it got slower now (only the imageblock, which is a non-handlerequest-request), but perhaps it's just a subjective impression.
there's no "setActiveUser" method that is more lightweight than GalleryInitSecondPass(, right?
i'm calling ::init and ::done only once per http request, no matter how many imageblocks i request (static "isInitiated" flag and ::done called as a shutdownhandler).
Posts: 32509
What's on the todo list?
1. Better sidebar (system, item links, cart block) integration: perhaps spiderr could do this?
2. UI-less search API: mindless is working on it, right?
3. docs and a non-xaraya show case too.
Posts: 105
If you pass an empty string and the G2 session is "logged in" then G2 takes the logged in user as current. That's wrong in my opinion. If a empty string is set then it should force G2 to be in anonymous state.
Posts: 8601
yes, that is wrong, and not what it does, AFAIK. See GalleryEmbed::checkActiveUser.
valiant, i'll get to the search api soon, yes.
Posts: 90
Valiant, no problem, I'm used to be a Beta tester :lol:
I use Xaraya more than a year, so I'm used to get it with Bitkeeper. I solved my Gallery2 problem with creating all the users / groups Gallery2 wanted within Xaraya Roles Module. After that it works now and Gallery2 is synchronizing all my users.
There is still a problem with the sidebar not being showed when I'm within Xaraya as Xaraya Admin. But I will look after it.
It is a good Idea to show your development of the Gallery2 Module in a directory style.
Posts: 90
Valiant, I have a small wish. My imageblock should be only visible when the user is logged in. Now it will shown a nasty looking error code.
In order to get rid of, I tried in Gallery2/Xartemplates/Blocks/Image.xd the following code but the error is still there when the User is not logged in:
I'm I missing something? Where should the xarUserIsLoggedIn() be placed?
Thanks in advance,
Danny[/b]
Posts: 8601
valiant, I added searchScan() and search() to GalleryEmbed. These work similarly to the search module, ie a function to scan a few results from each available search module and a function to get pages of results from a specific module (not saying this is the best search interface, just matches how it works now..). I did not expose the search options via this interface (checkboxes for search descriptions, keywords, etc).. it just uses the defaults for options.
Try this out and see how it works.. then we can see if you need anything more from this search interface.
Posts: 32509
@search:
mindless, ok, gonna try to make search wrapper in xaraya, it's definitely one of the hardest tasks to do in xaraya.
@imageblock:
mindless, could you look into the errors we get from G2 when using GalleryEmbed::getImageBlock() when no images match the criteria?
the normal sidebar imageblock from G2 doesn't show any errors in this case, it just shows "no images yet" or something like that.
@Danny:
1. ok, now i don't know what caused the error but ok.
2. imageblock: no, i don't think that's the way to go in xaraya. xaraya first creates the content of imageblock and then parses the template. if you have a condition in the template, that won't work.
- what error do you get?
- you should make this condition on permission level. afaik i created a permission Gallery2ViewBlocks or something like that. perhaps i didn't. good point, i should add finer grained permissions.
Posts: 8601
valiant, I fixed up GalleryEmbed::getImageBlock.
Posts: 32509
thanks to fix my laziness!
gonna test it later this week.
Posts: 90
I got the following error:
It is really plaguing me. IMHO it would be better, when no error message is shown!
I asked in the Xaraya Dev Newsgroup for suppressing privilege errors and I got back the following message from Marc:
Valiant, can you tell me how your privilege setting works for not showing an ImageBlock for AnonUsers? I want to hide my Imageblocks for all users which are not logged in.
I think I tried all possibilities but still have no success to suppress the ImageBlock. I have created for the Group "CasualAccess" an privilege called "DenyImageBlock". I tried it really with a lot of combinations, but the error message still was there.
Posts: 32509
Danny, I will change my securityCheck to the above version with the second argument set to '0', that should solve it.
you can do it for yourself, go to xaraya/modules/gallery2/xarblocks/image.php and change the security check.
Posts: 90
Valiant, you are the man. Changed 1 to 0 and now it works perfect without the bad error code.
Thanks for your help,
Danny
Posts: 5
Right on. I'll be looking forward to it (the module release). I did try out Xaraya (as well as several other CMS packages) and came back to Drupal. It fits what I want to do much better than anything else.
Posts: 90
How can I get rid of the headlines in Imageblock and Most viewed block? I want only that the title will be shown, which I define within Xaraya.
Posts: 8601
don't pass 'heading' key in the params array to getImageBlock.
see site admin for imageblock or phpdoc for getImageBlock in embed.php for info on imageblock params.
Posts: 32509
Danny, i will make it optional = add it to the block instance configuration. but not before christmas. i'm working 24x7 on other things.
meanwhile you could go to the xarblocks/image.php and change the $params['heading'] = 0; or perhaps i wrote getImageBlock(array('heading' => 1, ..., just change the value to 0.
Posts: 90
Valiant, no problem, take your time. Right now I have bigger problems. Starting yesterday I see no Thumbnails. I have all things done, uploaded newest CVS to the Server, double checked Netpbm settings, deleted all my Albums and reimported it again from Gallery 1, but without any success. Do you have any idea, what can else be done? Also in Standalone mode, and even when I login as admin I see no Thumbnails.
Danny
Posts: 32509
no thumbs, but in showitem views you see an image?
no idea. perhaps you should post this to the support forum.
Posts: 8601
he already did.. further discussion of that problem will be in that topic.
Posts: 105
Hmm ... Here's proof: http://www.kimslotte.net/filer/Coding/Gallery2/
An empty String is passed.
Posts: 8601
did you login as admin via main.php?
try logging out via main.php, then login and logout via embed.. see if that works. checkActiveUser() checks against a session variable that is only set when you login via embed.. if this turns out to be the problem maybe i'll see if i can do the check against a setting that is there however you logged in.
Posts: 105
Your asumption was right. It was the main session that was still alive. It is a problem if you use gallery both embedded and the normal way.
Posts: 8601
ok, i think this is an easy fix. when you login via main.php it doesn't put any external userid in the session.. when you then visit via embed.php it gets null from the session and compares to '' from the activeUserId param.. using == these are equal.. with === they will not be equal, so that first request from embed.php will always update the user in the G2 session and put the external id in the session.
Posts: 32509
mindless, @search/searchScan:
what's the default way of doing a search? i guess searchScan, right?
things that would be nice:
- in the results array: not only the itemId, but a link to the showItem and downloadItem (for the thumbnail) too.
of course i could build them somehow, but i guess that's something all embedded apps have in common, all need a link to the search hits.
- offset and a maxresults (over all max, not per module max) for searchScan
what do you think?
Posts: 8601
you can add stuff in the results of GalleryEmbed::searchScan if you like...
as i mentioned, i implemented it the way the search module works now.. that's why you get per module results, not an overall count of results.
an offset of overall results is tricky because you don't know which module search to use just based on the offset..
Posts: 32509
mindless, I tried to write a xaraya search hook and this is the error i get from G2 (current cvs) when calling galleryembed::searchscan:
Fatal error: Class gallerycoresearch: Cannot inherit from undefined class gallerysearchinterface_1_0 in /var/www/localhost/htdocs/gallery2/modules/core/classes/GalleryCoreSearch.class on line 34
I added the following line to the searchscan method, but it doesn't change anything, i still get the error.
list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'search');
Before calling searchscan, i call galleryembed::init if that helps.
IMO you should add a include_once ../../search/etc. or something in core/classes/GalleryCoreSearch.class
Posts: 8601
quite right.. i've added the require for the parent class.
Posts: 32509
I also had to add
require_once(dirname(__FILE__) . '/modules/search/classes/SearchUtilities.class');
to the searchScan method in embed.php.
Should I drop the loadplugin('module' 'search'); because it's loaded always anyway or commit the changed searchScan to cvs?
Posts: 8601
I added the require.
Posts: 90
Valiant, may there be a small problem with the Xaraya integration? I have seen in my logs, that Xaraya complains about
user variable NavigationLocale not correct registered
What shows your logs, do you have also any errors? I have seen, that Variable NavigationLocale is used in xargallery2helper.php.
I have asked in the Newsgroup Xaraya.User for that problem. Mikespub responded:
There is a session variable called navigationLocale, but no user variable
like that. Did you try out any particular themes or modules lately, that
contains something like xarUserGetVar('navigationLocale') instead of
xarSessionGetVar('navigationLocale') ?
Thanks for your help,
Danny
Posts: 32509
Thanks! I may have used the wrong function, gonna look into that.
Posts: 90
Thanks for your help. Do you use also the variable name "timezone"? I ask because in my error log is also:
user variable timezone not correct registered
Danny
Posts: 32509
no, i don't use / get / set anything related to "timezone".
Posts: 90
Hmm, strange thing. I got another error message:
Warning: Unknown(): Unable to call xarGallery2Helper::_done()() - function does not exist in Unknown on line 0
Warning: Unknown(): Unable to call xarGallery2Helper::_done()() - function does not exist in Unknown on line 0
Any clues? If there any new versions of your Gallery2 Modul I'm happy to test it.