Commit e65698fe authored by profix898's avatar profix898
Browse files

- Update HEAD to 5.x-2.0 release version

parent ccec940e
// $Id$
kiz_0987:
This gallery.module was based on original code by walkah. The gallery_filter part is almost
entirely based on work by MichelleC and Waldemar. The g2image application is by capt_kirk.
Thanks for all your efforts.
MichelleC (g2_filter):
This module would not exist without image_filter by Eric Scouten (http://drupal.org/node/9707). I started with that module and transformed it bit by bit into this module. While there's not a lot of original code left, I wouldn't have been able to do this without using image_filter as a template.
This module is dependent on Drupal (of course), Gallery 2, and the gallery.module (http://drupal.org/project/gallery) so thanks to everyone for all the work on those. Without them, this module would be useless. :)
\ No newline at end of file
<?php
/*
* $RCSfile$
*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2006 Bharat Mediratta
*
......@@ -464,4 +462,5 @@ class G2EmbedDiscoveryUtilities {
return true;
}
}
?>
\ No newline at end of file
?>
<?php
// $Id$
/**
* @version
* @package GalleryCore
* @author Kieran Parsons
*/
/**
* A collection of useful G2Embed related utilities to test that all the required
* parameters and modules are correctly configures
*
* @package GalleryCore
* @subpackage GalleryEmbed
* @static
*/
class G2EmbedTestUtilities {
/**
* Validate the Gallery2 Embed variables
*
* Returns false if any test failed
* @param $orig, $autodetect
* @return array($gallery_valid, $new, $results)
*/
function checkLocations($orig, $autodetect=true) {
$gallery_valid = 1;
// Normalise the G2 URI
$g2Uri = G2EmbedDiscoveryUtilities::normalizeG2Uri($orig['g2Uri']);
$new['g2Uri'] = $g2Uri;
if ($g2Uri != $orig['g2Uri']) {
$results['g2Uri']['title'] = G2EmbedTestUtilities::_trans('\'URI of Gallery2\' variable:');
$results['g2Uri']['advise'] = true;
$results['g2Uri']['notice'] = G2EmbedTestUtilities::_trans('%origG2Uri automatically updated to %g2Uri to adhere to Gallery2 requirements.',
array('%origG2Uri' => $orig['g2Uri'], '%g2Uri' => $g2Uri));
}
// Find the Gallery Directory and Embed URI
if ($autodetect) {
// Auto-Detect the G2 embed path
list ($success, $embedPhpPath, $errorString) =
G2EmbedDiscoveryUtilities::getG2EmbedPathByG2Uri($g2Uri);
if (!$success) {
// Something is wrong with the G2 URI given as the G2 embed path is not found
$results['g2Uri2']['title'] = G2EmbedTestUtilities::_trans('\'URI of Gallery2\' variable:');
$results['g2Uri2']['error'] = true;
$results['g2Uri2']['notice'] = $errorString;
$new['g2EmbedPath'] = rtrim($embedPhpPath, 'embed.php');
$gallery_valid = 0;
} else {
// G2 Embed Path is found OK
$results['g2Uri2']['title'] = G2EmbedTestUtilities::_trans('\'URI of Gallery2\' variable:');
$results['g2Uri2']['success'] = true;
$new['g2EmbedPath'] = rtrim($embedPhpPath, 'embed.php');
}
// Auto-Detect the Embed Application URI
$embedUri = G2EmbedTestUtilities::_autodetectEmbedUri();
// Normalise the Embed Application URI
$embedUri = G2EmbedDiscoveryUtilities::normalizeEmbedUri($embedUri);
$new['embedUri'] = $embedUri;
} else {
// Do not autodetect the variables, but check the manually entered ones.
$results['g2Uri2']['title'] = G2EmbedTestUtilities::_trans('\'URI of Gallery2\' variable:');
$results['g2Uri2']['advise'] = true;
$results['g2Uri2']['notice'] =
G2EmbedTestUtilities::_trans('Cannot fully check this when not in auto-detect mode.');
$embedPhpPath = $orig['g2EmbedPath'];
// Check path can be read, adding embed.php if needed
if (substr($embedPhpPath, -1) != '/') {
$embedPhpPath = $embedPhpPath . '/';
$results['g2EmbedPath']['title'] =
G2EmbedTestUtilities::_trans('\'Location of Gallery2\' variable:');
$results['g2EmbedPath']['advise'] = true;
$results['g2EmbedPath']['notice'] =
G2EmbedTestUtilities::_trans('%g2EmbedPath automatically updated to %embedPhpPath to adhere to Gallery2 requirements.',
array('%g2EmbedPath' => $orig['g2EmbedPath'],
'%embedPhpPath' => $embedPhpPath));
}
list ($ok, $errorString) =
G2EmbedDiscoveryUtilities::isFileReadable($embedPhpPath.'embed.php');
$new['g2EmbedPath'] = $embedPhpPath;
if (!$ok) {
// Something is wrong with the G2 embed path
$results['g2EmbedPath2']['title'] =
G2EmbedTestUtilities::_trans('\'Location of Gallery2\' variable:');
$results['g2EmbedPath2']['error'] = true;
$results['g2EmbedPath2']['notice'] = $errorString;
$gallery_valid = 0;
} else {
// G2 Embed Path is found OK
$results['g2EmbedPath2']['title'] =
G2EmbedTestUtilities::_trans('\'Location of Gallery2\' variable:');
$results['g2EmbedPath2']['success'] = true;
}
$embedUri = $orig['embedUri'];
$embedUri = G2EmbedDiscoveryUtilities::normalizeEmbedUri($embedUri);
$new['embedUri'] = $embedUri;
if ($embedUri != $orig['embedUri']) {
$results['embedUri']['title'] =
G2EmbedTestUtilities::_trans('\'Embed URI\' variable:');
$results['embedUri']['advise'] = true;
$results['embedUri']['notice'] =
G2EmbedTestUtilities::_trans('%origEmbedUri automatically updated to %embedUri to adhere to Gallery2 requirements.',
array('%origEmbedUri' => $orig['embedUri'],
'%embedUri' => $embedUri));
}
$results['embedUri2']['title'] =
G2EmbedTestUtilities::_trans('\'Embed URI\' variable:');
$results['embedUri2']['advise'] = true;
$results['embedUri2']['notice'] =
G2EmbedTestUtilities::_trans('Cannot fully check this when not in auto-detect mode.');
}
list ($numErrors, $numWarnings) = G2EmbedTestUtilities::_getNumErrorsAndWarnings($results);
return array($numErrors, $numWarnings, $new, $results);
// return array($gallery_valid, $new, $results);
}
/**
* Check the status of Gallery2 Modules before Gallery Init
*
* @param $testsToRun
* @return array results
*/
function preInitTests($testsToRun = null) {
if (!$testsToRun) {
$testsToRun['php_memory']['errorlevel'] = 'error';
$testsToRun['php_memory']['minimumMemoryLimit'] = 24;
}
/* Check for adequate PHP Memory Limit */
if (isset($testsToRun['php_memory'])) {
$results['php_memory'] = G2EmbedTestUtilities::phpMemoryCheck(
$testsToRun['php_memory']['minimumMemoryLimit']);
}
list ($numErrors, $numWarnings) = G2EmbedTestUtilities::_getNumErrorsAndWarnings($results);
return array($numErrors, $numWarnings, $results);
}
/**
* Check the status of Gallery2 Modules after Gallery Init
*
* @param $testsToRun
* @return array results
*/
function postInitTests($testsToRun = null) {
if (!$testsToRun) {
$testsToRun['imageblock']['errorlevel'] = 'error';
$testsToRun['imageframe']['errorlevel'] = 'warning';
$testsToRun['urlrewrite']['errorlevel'] = 'advise';
}
list ($ret, $allModulesStatus) = GalleryCoreApi::fetchPluginStatus('module');
/* Check for ImageBlock Module */
if (isset($testsToRun['imageblock'])) {
$results['imageblock'] =
G2EmbedTestUtilities::moduleCheck('imageblock', 'Image Block',
$testsToRun['imageblock']['errorlevel'], $allModulesStatus);
}
/* Check for ImageFrame Module */
if (isset($testsToRun['imageframe'])) {
$results['imageframe'] =
G2EmbedTestUtilities::moduleCheck('imageframe', 'Image Frame',
$testsToRun['imageframe']['errorlevel'], $allModulesStatus);
}
if (isset($testsToRun['urlrewrite'])) {
$results['urlrewrite'] =
G2EmbedTestUtilities::urlRewriteCheck($testsToRun['urlrewrite']['errorlevel']);
}
list ($numErrors, $numWarnings) = G2EmbedTestUtilities::_getNumErrorsAndWarnings($results);
return array($numErrors, $numWarnings, $results);
}
/**
* Warn if memory_limit is set and is too low
* (from Gallery2 install code)
*
* @param minimumMemoryLimit
* @return array results
*/
function phpMemoryCheck($minimumMemoryLimit = 24) {
$memoryLimit = ini_get('memory_limit');
$title = G2EmbedTestUtilities::_trans('PHP Memory Limit:');
if ($memoryLimit != '' && (G2EmbedTestUtilities::_getBytes($memoryLimit) / (1024 * 1024)) < $minimumMemoryLimit) {
$results = array(
'title' => $title,
'error' => true,
'notice' => G2EmbedTestUtilities::_trans(
'Your PHP is configured to limit the memory to %memLimit (<b>
memory_limit</b> parameter in php.ini). You should raise this limit
to at least <b>%minMemLimitMB</b> for proper Embedded Gallery2 operation',
array('%memLimit' => $memoryLimit, '%minMemLimit' => $minimumMemoryLimit)),
);
} else {
$results = array(
'title' => $title,
'success' => true,
);
}
return $results;
}
/**
* Check the status of Gallery2 URL Rewrite Module
*
* @param $errorLevel
* @return array results
*/
function urlRewriteCheck($errorLevel) {
/* Check for URL Rewrite Module */
$title = 'Gallery2 URL Rewrite Module Status:';
list ($ret, $rewriteApi) = GalleryCoreApi::newFactoryInstance('RewriteApi');
if ($ret) {
/* G2 Error handling */
$results = array(
'title' => $title,
'installed' => false,
'active' => false,
'available' => false,
$errorLevel => true,
'notice' => G2EmbedTestUtilities::_trans(
'Gallery2 Error when trying to access URL Rewrite Module status. %ret',
array('%ret' => $ret->getAsHtml())),
);
}
if (empty($rewriteApi)) {
$results = array(
'title' => $title,
'installed' => false,
'active' => false,
'available' => false,
$errorLevel => true,
'notice' => G2EmbedTestUtilities::_trans(
'Either the URL rewrite module is not installed or the version is too old.'),
);
} else {
/* Check compatibility */
$required = array(1, 0);
list ($ret, $isCompatible) = $rewriteApi->isCompatibleWithApi($required);
if ($ret) {
/* Error handeling */
$results = array(
'title' => $title,
'installed' => false,
'active' => false,
'available' => false,
$errorLevel => true,
'notice' => G2EmbedTestUtilities::_trans(
'Gallery2 Error when trying to access URL Rewrite Module status. %ret',
array('%ret' => $ret->getAsHtml())),
);
} else {
if (!$isCompatible) {
$results = array(
'title' => $title,
'installed' => false,
'active' => false,
'available' => false,
$errorLevel => true,
'notice' => G2EmbedTestUtilities::_trans(
'The installed URL Rewrite module version is not compatible.'),
);
} else {
/* Add rules checking etc */
$results = array(
'title' => $title,
'success' => true,
);
}
}
}
return $results;
}
/**
* Check the status of a Gallery2 Module
*
* @param $moduleId, $moduleName, $errorLevel, $allModulesStatus
* @return array moduleStatus
*/
function moduleCheck($moduleId, $moduleName, $errorLevel, $allModulesStatus) {
$moduleStatus = array();
if (isset($allModulesStatus[$moduleId])) {
$moduleStatus['installed'] = true;
$moduleStatus['active'] = $allModulesStatus[$moduleId]['active'];
$moduleStatus['available'] = $allModulesStatus[$moduleId]['available'];
} else {
$moduleStatus['installed'] = false;
$moduleStatus['active'] = false;
$moduleStatus['available'] = false;
}
$moduleStatus['title'] = 'Gallery2 ' . $moduleName .' Module Status:';
if (!$moduleStatus['installed']) {
$moduleStatus[$errorLevel] = true;
$moduleStatus['notice'] = G2EmbedTestUtilities::_trans(
'The %moduleName Module is not installed.',
array('%moduleName' => $moduleName));
} else {
if ($moduleStatus['active'] && $moduleStatus['available']) {
$moduleStatus['success'] = true;
} else {
$moduleStatus[$errorLevel] = true;
$moduleStatus['notice'] = G2EmbedTestUtilities::_trans(
'The %moduleName Module is installed but not active or configured correctly.',
array('%moduleName' => $moduleName));
}
}
return $moduleStatus;
}
/*
* Returns the exact bytes value from a php.ini setting
* * Copied from PHP.net's manual entry for ini_get()
*/
function _getBytes($val) {
$val = trim($val);
$last = $val{strlen($val)-1};
switch($last) {
case 'k':
case 'K':
return (int) $val * 1024;
break;
case 'm':
case 'M':
return (int) $val * 1048576;
break;
default:
return $val;
}
}
/**
* Calculate the number of errors and warnings
*
* @param $results
* @return array($numErrors, $numWarnings)
*/
function _getNumErrorsAndWarnings($results) {
$numErrors = 0;
$numWarnings = 0;
foreach ($results as $key=>$result) {
if ($result['error']) {
$numErrors++;
}
if ($result['warning']) {
$numWarnings++;
}
}
return array($numErrors, $numWarnings);
}
/**
* Translate the message string
* This needs to be implemented by each embed application individually.
*
* Returns the translated string.
* @param $string A string containing the English string to translate.
* $args An associative array of replacements to make after translation.
* Incidences of any key in this array are replaced with the corresponding value.
* @return string Translated String
*/
function _trans($string, $args = 0) {
return t($string, $args);
}
/**
* Autodetect the Embed URI
* This needs to be implemented by each embed application individually.
*
* @param none
* @return string autodetected URI
*/
function _autodetectEmbedUri() {
$uri = url('gallery', null, null, false);
if (substr($uri, -8) == '/gallery') {
$uri = substr($uri, 0, strlen($string)-7) . 'index.php?q=gallery';
}
// strip the end /gallery if present and replace with index.php?q=gallery to avoid any
// url rewrite issues. See http://gallery.menalto.com/node/46181
// Note the use of index.php in all cases. Not needed for Apache, but is for IIS
// see drupaldocs documentation for url.
return $uri;
}
}
?>
\ No newline at end of file
$Id$
HELP
----
For more help, check out: http://drupal.galleryembedded.com
Requirements
------------
Gallery2.1 (or above) installed and working (see http://gallery.menalto.com)
Image Block module installed and activated in Gallery2
Image Frame module installed and activated in Gallery2
Drupal 5.x
Gallery module (this Drupal module)
Note that this module does not provide any photo/album functions itelf, but uses
Gallery2 (http://gallery.menalto.com) to provide this functionality.
Installation Instructions
-------------------------
1. Install Gallery 2.1 and Drupal 5.x (see their respective installation
documents).
***Warning*** - Do not name your Gallery2 directory "gallery", call it something else
(eg "gallery2"). Calling it "gallery" will cause a conflict with the Drupal gallery.module
as Drupal assumes that http://www.example.com/gallery refers to the Drupal module.
2. Ensure that "Image Block" and "Image Frame" modules are installed and activated in Gallery2.
Check them in the non-embedded Gallery. See
http://codex.gallery2.org/index.php/Gallery2:Download for instructions to download it
if it was not included in your installation.
3. Log out of Gallery2 (non-embedded) - people have reported errors relating to sessions if this
is not done.
4. Copy the entire gallery module directory to your Drupal modules/ directory.
5. Enable the gallery module in Administer -> Site building -> Modules in your Drupal
installation.
6. Go to Administer -> Site configuration -> Gallery and enter the URI of Gallery2.
Leave "autodetect" selected and click "Save configuration". A series of tests will run to check
if everything is OK. There is a HELP link.
7. Enable the "Gallery Block" in Administer -> Site building -> Blocks, and optionally the
"Gallery Navigation" block and the "Gallery Grid Block".
8. Enable the "Access Gallery" permission for the roles that you want to be able to see the gallery
and gallery blocks. Go to Administer -> User management -> Access control.
9. If necessary, disable the Register module in Gallery2 and remove the Login item from the sidebar
block. All login and registration functions now need to go through Drupal (and from there
automatically to Gallery2, not Gallery2 directly.)
Optional Steps
--------------
1. Sidebar. Go to your Gallery2 site admin and include the blocks you want in the sidebar
(under Themes). I use "Item Actions" and "Album Quick Links (DHTML)". To use
the latter you need to have installed the Album Select module.
2. URL Rewrite.
3. g2image. If you install g2image http://g2image.steffensenfamily.com as either a standalone or
TinyMCE plugin you will have an excellent image chooser for Drupal/Gallery2. The
configuration is automatic when you hit the "Save configuration' button on the gallery
settings page.
Troubleshooting
---------------
See http://drupal.galleryembedded.com
\ No newline at end of file
$Id$
// $Id$
Overview
---------
This module embeds Gallery2 (http://gallery.menalto.com) inside your drupal installation
to support photos, videos and other content. There is support for 2 types of image block (can be
placed in the sidebar) and a navigation menu, inserting of images into nodes via an input filter,
TinyMCE support, syncing of users between the 2 applications, ...
This module embeds Gallery2 (http://gallery.menalto.com) inside your Drupal
installation to support photos, videos and other content. There is support for
2 types of image blocks and a navigation menu, inserting of images into nodes
via an input filter, TinyMCE support, syncing of users between the two
applications, ...
Note that you will need to download and install Gallery2
(http://codex.gallery2.org/index.php/Gallery2:Download) prior to installing this module.
Note that you will need to download and install Gallery2
(http://gallery.menalto.com/downloads) prior to installing this module.
Requirements
------------
* Gallery 2.1 or above (with ImageBlock and ImageFrame modules installed and activated)
* Gallery 2.2
* Drupal 5.x
For installation instructions please see INSTALL.txt
Installation
------------
1. Install Gallery 2 and Drupal (see their respective installation documents).
Gallery2 should be *inside* your Drupal installation so that it's accessible
by the same website. If you installed Gallery somewhere else, you can create
a symlink to it from inside your Drupal site or you can move Gallery2.
Warning - Do not name your G2 directory 'gallery', call it something else
(e.g. 'gallery2'). Calling it 'gallery' will cause a conflict with the Drupal
gallery.module as Drupal assumes that http://www.example.com/gallery refers
to the Drupal module.
2. Ensure that 'Image Block' and 'Image Frame' plugins are installed and
activated in Gallery2. Check them in the non-embedded Gallery.
3. Log out of Gallery 2 (non-embedded) - people have reported errors relating
to sessions if this is not done.
4. Copy gallery.module to your Drupal modules/ directory.
5. Enable the gallery module in Administer -> Site building -> Modules in
your Drupal installation (admin/build/modules).
6. Go to Administer -> Site configuration -> Gallery (admin/settings/gallery)
and configure the path to your Gallery2 installation using the install wizard
provided there.
7. Enable the 'Gallery Block' in Administer -> Site building -> Blocks
(admin/build/block).
- Optional -
8. The Gallery user administration is now available in Administer -> User
management -> Gallery users (admin/user/gallery). You should at least check
the 'User settings' (admin/user/gallery/settings).
9. G2Image:
If you install G2Image (http://g2image.steffensenfamily.com) as either a
standalone or TinyMCE plugin you will have an excellent image chooser for
Drupal/Gallery2. The configuration is automatic when you hit the 'Save
configuration' button on the G2Image settings page
(admin/settings/gallery/g2image).
Support
-------
Please post bug reports and feature requests in the Issues tracker
(http://drupal.org/project/issues/gallery), support requests should generally
go to the Gallery 2 Integrations Forums (http://gallery.menalto.com/forum/78)
first.
Authors
-------
James Walker <walkah@walkah.net>
Kieran Parsons <kiz_0987@yahoo.com>
Thilo Wawrzik <drupal@profix898.de>
// $Id$
function g2ic_open(field) {
// Find the form id by going back through the hierarchy. Kludge until can get the form id
// directly from drupal.
var element = document.getElementById(field).parentNode;
while (element.tagName != 'FORM') {
element = element.parentNode;
}
var form = element.id;
var url = G2IMAGE_URI + 'g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
function g2image_open(field) {
// Set some properties
var form = $('#'+field).parents('form').attr('id');
var url = G2IMAGE_URI+'g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
var name = 'g2image';
var w = 600;
var h = 600;
var valLeft = (screen.width) ? (screen.width-w)/2 : 0;
var valTop = (screen.height) ? (screen.height-h)/2 : 0;
var features = 'width='+w+',height='+h+',left='+valLeft+',top='+valTop+',resizable=1,scrollbars=1';
// Open the G2Image window
window.open(url, name, features);
}
// BUEditor
function g2bueditor_open() {
if (editor.active) {
g2image_open(editor.active.textArea.id);
}
}
......@@ -4,24 +4,61 @@
* Drupal embeded Gallery2 css overrides.
* These do not make a perfect theme, but are not bad as a first step.
*/
/* Increase font size */
#gallery {
font-size: 100%;
}
/* Increase font size */
#gallery {
font-size: 100%;
}