Moodle Integration with Gallery2 2.2.3

naquadah

Joined: 2007-10-10
Posts: 3
Posted: Thu, 2007-10-11 00:21

Ok, so we got gallery2 2.1.2 embedded in moodle, but then the gallery2 api got upgraded and I am getting the following errors

Quote:
Error
Item not found.

Back to the Gallery

Error Detail -
Error (ERROR_MISSING_OBJECT) : Missing object for 17
in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 2075 (GalleryCoreApi::error)
in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 98 (GalleryStorageExtras::_identifyEntities)
in modules/core/classes/GalleryStorage.class at line 298 (GalleryStorageExtras::loadEntities)
in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 71 (GalleryStorage::loadEntities)
in modules/core/classes/GalleryCoreApi.class at line 2259 (GalleryEntityHelper_simple::loadEntitiesById)
in modules/core/classes/GalleryView.class at line 359 (GalleryCoreApi::loadEntitiesById)
in modules/core/ShowItem.inc at line 133 (GalleryView::getItem)
in modules/core/classes/GalleryView.class at line 393 (ShowItemView::getItem)
in modules/core/classes/GalleryView.class at line 267 (GalleryView::loadThemeAndParameters)
in main.php at line 441 (GalleryView::doLoadTemplate)
in main.php at line 94
in modules/core/classes/GalleryEmbed.class at line 179
in /home/train/web/public/doug/mod/gallery/view.php at line 102 (GalleryEmbed::handleRequest)
System Information
Gallery version 2.2.3
PHP version 5.2.1 apache2handler
Webserver Apache
Database mysqlt 5.0.37-log
Toolkits Gd
Operating system SunOS z13941AA.textdrive.com 5.11 snv_67 i86pc
Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)

I am not sure what has changed, in the versions, and what specifically changed in the API calls, but here is what my gallery init function looks like

Quote:
function gallery_init($cmid = 0) {
global $CFG, $USER;

require_once(gallery_get_embedpath());

$initparams = array('embedUri' => 'view.php?id='.$cmid,
'g2Uri' => $CFG->gallery_g2uri,
'loginRedirect' => $CFG->wwwroot.'/login/index.php',
'activeUserId' => $USER->id,
'fullInit' => true);
// $initparams = array();
$ret = GalleryEmbed::init($initparams);

if ($ret && $ret && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
// user mapping has gone bonkers - map the user
gallery_map_user_to_gallery();

// try again after user mapping
$ret = GalleryEmbed::init($initparams);
if ($ret) {
error('User mapping failed twice<br /><br />'.$ret->getAsHtml());
}
} else {
// user map successful

// update user to make sure everything is in sync
$ret = GalleryEmbed::updateUser($USER->id, array('username' => $USER->username,
'email' => $USER->email,
'fullname' => $USER->firstname.' '.$USER->lastname,
'language' => gallery_moodle_to_gallery_language(),
'hashedpassword' => $USER->password,
'hashmethod' => 'md5'));
if ($ret) {
error('Gallery User update failed <br />'.$ret->getAsHtml());
}
}

gallery_r();
return true;
}

I am not sure what I need to change, but I appreciate the help. The version of moodle that I am working with is moodle 1.82 and here is a tar of the complete code that was written.

http://train.mroomsdev.com/doug/gallery.rar

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2007-10-17 11:21
 
naquadah

Joined: 2007-10-10
Posts: 3
Posted: Wed, 2007-10-17 20:50

I have already checked out those pages. The code is fine, and it works on windows machines but it does not work in Linux systems. I don't know why though.

 
naquadah

Joined: 2007-10-10
Posts: 3
Posted: Fri, 2007-10-26 01:20

I am still wondering if there is anyone else that would know why this code would work fine in a Windows hosted environment, but not in a linux one. I have had a few people review the code and the 1 bug has been fixed, but it still does not work correctly in Linux. It seems that there is a path error or a database error that I have been unable to figure out.