summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkiz_09872006-05-30 01:21:40 (GMT)
committer kiz_09872006-05-30 01:21:40 (GMT)
commit5648810f6cf800880eddfce67aaa2ef819f0bbd7 (patch)
tree9471877bfdeeffcb258acaadae8d4a081814fc39
parent1031c81444cc1742498b5cf415773bf516378c8e (diff)
Updated G2.1 version to ensure non-default configs work. See http://www.galleryembedded.com/forums/viewtopic.php?t=29104.6.x-1.0
-rw-r--r--INSTALL.txt21
-rw-r--r--gallery.module.G2.136
2 files changed, 32 insertions, 25 deletions
diff --git a/INSTALL.txt b/INSTALL.txt
index a3528d4..ea79149 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -19,7 +19,7 @@ Installation Instructions
3. Enable the gallery module in administer -> modules in your drupal
installation.
-4. Go to administer -> settings -> gallery and enter the path to your
+4. (Gallery 2.0) Go to administer -> settings -> gallery and enter the path to your
gallery2 installation. So if your Drupal is installed at:
/var/www/www.drupal.site
@@ -33,6 +33,25 @@ Installation Instructions
http://your.site/gallery
+4. (Gallery 2.1) Go to administer -> settings -> gallery and enter the path to your
+ gallery2 installation. So if your Drupal is installed at:
+ /var/www/drupal
+
+ And your gallery2 is at:
+ /var/www/gallery2
+
+ And your site is:
+ http://your.site/ which points to /var/www/
+
+ Then your "URL Location of Gallery2" would be:
+ http://your.site/gallery2/ or just /gallery2/
+
+ And your "Physical Location of Gallery2" would be:
+ /var/www/gallery2/
+
+ Your gallery should now be available at:
+ http://your.site/drupal/gallery
+
5. Enable the "Gallery Block" in administer -> blocks
NOTE: the default themes don't work so well with Drupal yet. You'll get best
diff --git a/gallery.module.G2.1 b/gallery.module.G2.1
index 0facad9..6fbaff8 100644
--- a/gallery.module.G2.1
+++ b/gallery.module.G2.1
@@ -33,8 +33,14 @@ function gallery_menu($may_cache) {
*/
function gallery_settings() {
$output = '';
- $output.= form_textfield(t('Location of Gallery2'), 'gallery_dir', variable_get('gallery_dir', 'gallery2/'), 64, 64, t('Path to your gallery2 directory, relative to the root directory of your drupal installation. Please include a trailing slash ("/").'));
- $output.= form_textfield(t('Location of Drupal'), 'gallery_drupal_dir', variable_get('gallery_drupal_dir', '/'), 64, 64, t('Path to your drupal directory, relative to the root of your website. Please include a trailing slash ("/").'));
+ $output .= form_textfield(t('URI of Gallery2'), 'g2Uri',
+ variable_get('g2Uri', '/gallery2/'),
+ 64, 250,
+ t('URI of the G2 standalone location. Path from docroot to the Gallery2 directory where main.php is located. Protocol/hostname are both optional. Please include a trailing slash ("/"). eg: http://www.example.com/gallery2/ or /gallery2/'));
+ $output .= form_textfield(t('Location of Gallery2'), 'gallery_dir',
+ variable_get('gallery_dir', dirname(dirname(__FILE__)) . '/gallery2/'),
+ 64, 250,
+ t('Location of your gallery2 directory (absolute path or relative to the root directory of your drupal installation). Please include a trailing slash ("/"). eg: /path/to/drupal/gallery2/'));
$output .= form_checkboxes(t('Error logging'), 'gallery_error_mode',
variable_get('gallery_error_mode', array(1)),
array(1 => t('Watchdog'),
@@ -263,25 +269,7 @@ function gallery_search($op = 'search', $keys = null) {
* Main gallery display page
*/
function gallery_page() {
- /* Pass any excess path info to G2 */
- $path = substr($_GET['q'], 7 /* length of 'gallery/' */);
-
- /*
- * We simulate the rewrite module's .htaccess rules here by turning the ?q=/path into
- * ?g2_view=core.ShowItem&g2_path=/path
- *
- * It's a hack to know the 'g2_' prefix here, but the rewrite module processes the url in the
- * first round of gallery initialization and it has to have the path and the view here in order
- * to process the url.
- */
- if (!empty($path)) {
- $_GET['g2_path'] = $path;
- }
- if (empty($_GET['g2_view'])) {
- $_GET['g2_view'] = 'core.ShowItem';
- }
-
- list ($success, $ret) = _gallery_init(false);
+ list ($success, $ret) = _gallery_init(true);
if (!$success) {
gallery_error(t('Unable to initialize embedded Gallery'), $ret);
print theme('page', 'You need to <a href="' . url('admin/settings/gallery') . '">configure your embedded Gallery</a>');
@@ -306,7 +294,8 @@ function gallery_page() {
function _gallery_init($full = false) {
global $user, $base_url;
- $galleryDir = variable_get('gallery_dir', 'gallery2/');
+ $g2Uri = variable_get('g2Uri', '/gallery2/');
+ $galleryDir = variable_get('gallery_dir', dirname(dirname(__FILE__)) . '/gallery2/');
$embedPath = $galleryDir . '/embed.php';
if (!is_readable($embedPath)) {
@@ -320,8 +309,7 @@ function _gallery_init($full = false) {
// Gallery2 be installed as a subdir of Drupal, which is not necessarily
// ideal. Make this a configuration option.
$params = array('embedUri' => $base_url . '/index.php?q=gallery',
- 'g2Uri' => '/gallery2/',
- 'relativeG2Path' => $galleryDir,
+ 'g2Uri' => $g2Uri,
'loginRedirect' => url('user/login', null, null, true),
'activeUserId' => $uid,
'activeLanguage' => $user->language,