Commit dccc293a authored by profix898's avatar profix898

- very early D6 version (Oct-01, 2007)

parent e65698fe
......@@ -161,7 +161,7 @@ class G2EmbedDiscoveryUtilities {
$fd = @fsockopen($components['host'], $port, $errno, $errstr, 1);
if (empty($fd)) {
return array(false, null, "Error $errno: '$errstr' retrieving $url");
return array(false, null, "Error $errno: '$errstr' retrieving $g2Uri");
}
$get = $components['path'] . 'embed.php?getEmbedPath=1';
......
......@@ -14,7 +14,7 @@ Note that you will need to download and install Gallery2
Requirements
------------
* Gallery 2.2
* Drupal 5.x
* Drupal 6.x
Installation
------------
......
// $Id$
function g2image_open(field) {
function g2ic_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 url = Drupal.settings.gallery2.g2image_uri+'g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
var name = 'g2image';
var w = 600;
var h = 600;
......@@ -14,10 +14,3 @@ function g2image_open(field) {
// Open the G2Image window
window.open(url, name, features);
}
// BUEditor
function g2bueditor_open() {
if (editor.active) {
g2image_open(editor.active.textArea.id);
}
}
......@@ -4,18 +4,20 @@
* Drupal embeded Gallery2 css overrides.
* These do not make a perfect theme, but are not bad as a first step.
*/
/* Increase font size */
/* Increase font size */
#gallery {
font-size: 100%;
}
/*#siteAdminForm {
font-size: 140%;
}*/
/* Remove the header */
#gsHeader {
display: none;
}
/* Removes the Gallery Title (as Drupal displays it) */
/* Removes the Gallery Title (as Drupal displays it)*/
#gallery .gbBlock table h2 {
display: none;
}
......@@ -56,6 +58,7 @@ table.ImageFrame_wood, table.ImageFrame_wood td {
padding: 0px;
}
/* Brings h2 back for siteAdmin pages */
#siteAdminForm .gbBlock h2 {
display: block;
......@@ -80,19 +83,6 @@ table.ImageFrame_wood, table.ImageFrame_wood td {
overflow: hidden;
}
/* Flatten left margin for SiteAdminLinks if moved to Drupal sidebar */
.block-gallery #gsSidebar ul#gbSiteAdminLinks,
.block-gallery #gsSidebar ul#gbSiteAdminLinks li,
.block-gallery #gsSidebar ul#gbSiteAdminLinks li ul,
.block-gallery #gsSidebar ul#gbSiteAdminLinks li ul li {
margin-left: 2px;
}
/* Remove bold font from SiteAdminLinks if moved to Drupal sidebar */
.block-gallery #gsSidebar #gbSiteAdminLinks a {
font-weight: normal;
}
.block-gallery div.block-core-ItemLinks {
margin: 0;
border-bottom: 1px solid #aaa;
......@@ -107,9 +97,8 @@ table.ImageFrame_wood, table.ImageFrame_wood td {
border-top: none;
}
/* Garland adds padding which needs to be removed */
.block-gallery td, th {
padding: 0;
padding: 0; /* Garland adds padding which needs to be removed */
}
/* Navigation Tree */
......@@ -117,7 +106,7 @@ table.ImageFrame_wood, table.ImageFrame_wood td {
font-size: 1em;
}
/* For G2Image */
/* For g2ic_plugin */
img.g2image_float_left, div.g2image_float_left {
float: left;
margin: 0px 4px 4px 0px;
......@@ -135,7 +124,7 @@ img.g2image_centered, div.g2image_centered {
text-align: center;
}
/* Need to center images with frames */
/* Neeed to centre images with frames */
.g2image_centered table {
margin: auto;
}
......@@ -215,11 +204,10 @@ td.gallery-grid-block {
margin: auto;
}*/
/* Garland adds padding which needs to be removed */
.gallery-grid-block table,
.gallery-grid-block .one-image td,
.gallery-grid-block .one-image table {
padding: 0;
padding: 0; /* Garland adds padding which needs to be removed */
margin: auto;
}
......
......@@ -4,3 +4,4 @@ name = "Gallery"
description = "Embeds Gallery2 into Drupal."
package = "Gallery2"
core = 6.x
......@@ -10,15 +10,27 @@
* Implementation of hook_install().
*/
function gallery_install() {
drupal_set_message(t(''));
}
/**
* Implementation of hook_update_N().
* Migrate settings from the 5.x-1.x to 5.x-2.x series
* (migrate settings from the 5.x-1.x to 5.x-2.x (or 6.x-1.x) series)
*/
function gallery_update_1() {
$ret = array();
$variables = array();
// Fetch all gallery-related variables
$result = db_query("SELECT * FROM {variable} WHERE name LIKE 'gallery_%'");
while ($var = db_fetch_object($result)) {
$variables[$var->name] = $var->value;
}
// Remove old variables
db_query("DELETE FROM {variable} WHERE name LIKE 'gallery_%'");
// Array containing 'old name' => 'new name' map
$migrate = array(
$variable_map = array(
// Image block settings
'gallery_album_frame' => 'gallery_block_image_0_album_frame',
'gallery_block_block' => 'gallery_block_image_0_block_block',
......@@ -47,66 +59,32 @@ function gallery_update_1() {
'gallery_use_full_name' => 'gallery_use_fullname',
'gallery_profile_full_name_field' => 'gallery_profile_fullname_field'
);
// Array containing obsolete variables
$obsolete = array('gallery_search_max_items', 'gallery_autodetect_dir', 'gallery_uri', 'gallery_dir');
// Update variables
$ret = gallery_update_variables($migrate, $obsolete);
// Update the blocks
$ret[] = update_sql("UPDATE {blocks} SET delta = 'image-0' WHERE module = 'gallery' AND delta = 0");
$ret[] = update_sql("UPDATE {blocks} SET delta = 'navigation' WHERE module = 'gallery' AND delta = 1");
$ret[] = update_sql("UPDATE {blocks} SET delta = 'grid-0' WHERE module = 'gallery' AND delta = 2");
// Mark gallery configuration invalid. This does NOT reset the configuration, but
// forces the user to run the install wizard to (re)set and verify critical settings.
variable_set('gallery_valid', FALSE);
variable_set('gallery_config_reset', TRUE);
drupal_set_message('You were updating from gallery module 5.x-1.x (or earlier) to the 5.x-2.x
series of the module. All your settings were migrated automatically (see below),
but you will need to re-configure some basic options. Please visit the
Gallery settings page (admin/settings/gallery) to complete the update.',
'error');
cache_clear_all('variables', 'cache');
menu_rebuild();
return $ret;
}
/**
* Function gallery_update_variables().
*/
function gallery_update_variables($migrate, $obsolete) {
$ret = array();
$variables = array();
// Fetch all gallery-related variables
$result = db_query("SELECT * FROM {variable} WHERE name LIKE 'gallery_%'");
while ($var = db_fetch_object($result)) {
$variables[$var->name] = $var->value;
}
// Remove old variables
db_query("DELETE FROM {variable} WHERE name LIKE 'gallery_%'");
// Migrate old variables
foreach ($migrate as $old => $new) {
foreach ($variable_map as $old => $new) {
if (isset($variables[$old])) {
$variables[$new] = $variables[$old];
unset($variables[$old]);
$ret[] = array('success' => TRUE, 'query' => 'Migrating variable ['. $old .' => '. $new .']');
}
}
// Unset obsolete variables
$obsolete = array('gallery_search_max_items', 'gallery_autodetect_dir', 'gallery_uri', 'gallery_dir');
foreach ($obsolete as $var) {
if (isset($variables[$var])) {
unset($variables[$var]);
$ret[] = array('success' => TRUE, 'query' => 'Removing variable ['. $var .']');
}
}
// Mark gallery configuration invalid. This does NOT reset the configuration, but
// forces the user to run the install wizard to (re)set and verify critical settings.
$variables['gallery_valid'] = FALSE;
drupal_set_message('You were updating from gallery module 5.x-1.x (or earlier) to the 6.x-1.x
of the module. All your settings were migrated automatically (see below),
but you will need to re-configure some basic options. Please visit the
Gallery settings page (admin/settings/gallery) to complete the update.',
'error');
// Save resulting variables array
// (all variables not migrated or unset are taken over directly)
foreach ($variables as $name => $value) {
......@@ -114,10 +92,24 @@ function gallery_update_variables($migrate, $obsolete) {
// (i.e. unserialize => serialize and cache_clear_all() for each variable)
db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, $value);
}
cache_clear_all('variables', 'cache');
menu_rebuild();
return $ret;
}
/**
* Implementation of hook_update_N().
* (initial update to Drupal 6)
*/
function gallery_update_6001() {
$ret = array();
$ret[] = array('success' => TRUE, 'query' => 'Removing variable [gallery_page_callback]');
variable_del('gallery_page_callback');
return $ret;
}
/**
* Implementation of hook_uninstall().
*/
......
This diff is collapsed.
This diff is collapsed.
......@@ -6,14 +6,18 @@
* Block functions
*/
/**
/**
* Implementation of hook_block().
*
* 0 - gallery imageblock (random, most viewed, etc)
* 1 - gallery navigation block (recommended)
* 2 - gallery grid block
*/
function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
$type_map = $param_map = array();
_gallery_block_options($type_map, $param_map);
list($type, $delta) = explode('-', $delta);
list($type, $delta) = (stristr($delta, '-') !== FALSE) ? explode('-', $delta) : array('', 0);
switch ($op) {
case 'list':
$blocks['navigation']['info'] = t('Gallery Navigation');
......@@ -36,9 +40,10 @@ function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
}
switch ($type) {
case 'navigation': // Navigation Block
if ((arg(0) == 'gallery') && !empty($GLOBALS['gallery_sidebar'])) {
global $_gallery_sidebar_;
if ((arg(0) == 'gallery') && !empty($_gallery_sidebar_)) {
$block['subject'] = t('Gallery Navigation');
$block['content'] = '<div id="gsSidebar" class="gcBorder1">'. implode('', $GLOBALS['gallery_sidebar']) .'</div>';
$block['content'] = '<div id="gsSidebar" class="gcBorder1">'. implode('', $_gallery_sidebar_) .'</div>';
}
break;
case 'image': // Image Block
......@@ -58,7 +63,6 @@ function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
case 'grid': // Image Grid Block
return _gallery_settings_block_grid($delta);
}
break;
case 'save':
require_once(drupal_get_path('module', 'gallery') .'/gallery_settings.inc');
_gallery_settings_block_save($delta, $edit);
......@@ -71,25 +75,25 @@ function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
*/
function _gallery_block_options(&$type_map, &$param_map) {
$type_map = array(
'randomImage' => t('Random image'),
'recentImage' => t('Recent image'),
'viewedImage' => t('Viewed image'),
'randomAlbum' => t('Random album'),
'recentAlbum' => t('Recent album'),
'viewedAlbum' => t('Viewed album'),
'dailyImage' => t('Daily image'),
'weeklyImage' => t('Weekly image'),
'monthlyImage' => t('Monthly image'),
'dailyAlbum' => t('Daily album'),
'weeklyAlbum' => t('Weekly album'),
'monthlyAlbum' => t('Monthly album')
'randomImage' => t('Random image'),
'recentImage' => t('Recent image'),
'viewedImage' => t('Viewed image'),
'randomAlbum' => t('Random album'),
'recentAlbum' => t('Recent album'),
'viewedAlbum' => t('Viewed album'),
'dailyImage' => t('Daily image'),
'weeklyImage' => t('Weekly image'),
'monthlyImage' => t('Monthly image'),
'dailyAlbum' => t('Daily album'),
'weeklyAlbum' => t('Weekly album'),
'monthlyAlbum' => t('Monthly album'),
);
$param_map = array(
'title' => t('Title'),
'date' => t('Date'),
'views' => t('View Count'),
'owner' => t('Item owner'),
'heading' => t('Heading')
'title' => t('Title'),
'date' => t('Date'),
'views' => t('View Count'),
'owner' => t('Item owner'),
'heading' => t('Heading'),
);
}
......@@ -97,9 +101,16 @@ function _gallery_block_options(&$type_map, &$param_map) {
* Function _gallery_block_image_block().
*/
function _gallery_block_image_block($delta, $type_map) {
$param_blocks_array = array_filter(variable_get('gallery_block_image_'. $delta .'_block_block', array('randomImage')));
$param_blocks_array = variable_get('gallery_block_image_'. $delta .'_block_block', array('randomImage'));
$params['blocks'] = is_array($param_blocks_array) ? implode('|', $param_blocks_array) : '';
$params['itemId'] = variable_get('gallery_block_image_'. $delta .'_item_id', '');
$param_itemid = variable_get('gallery_block_image_'. $delta .'_item_id', '');
if (trim($param_itemid) == '%user') {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$param_itemid = gallery_user_useralbum(NULL, FALSE);
}
if (!empty($param_itemid)) {
$params['itemId'] = $param_itemid;
}
$param_show_array = variable_get('gallery_block_image_'. $delta .'_block_show', array());
$params['show'] = is_array($param_show_array) ? implode('|', $param_show_array) : '';
if (variable_get('gallery_block_image_'. $delta .'_size_method', GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT) == 'maxsize') {
......@@ -112,13 +123,37 @@ function _gallery_block_image_block($delta, $type_map) {
$params['itemFrame'] = variable_get('gallery_block_image_'. $delta .'_item_frame', 'none');
$params['linkTarget'] = variable_get('gallery_block_image_'. $delta .'_link_target', '');
$params['link'] = variable_get('gallery_block_image_'. $delta .'_link', '');
$block = array();
list($ret, $content, $head) = GalleryEmbed::getImageBlock($params);
if ($ret) {
gallery_error(t('Unable to get Gallery image block'), $ret);
return array();
}
$block = _gallery_block_get_block($params);
$block['subject'] = (count($param_blocks_array) > 1) ? t('Gallery') : $type_map[$params['blocks']];
if ($content) {
if (count($param_blocks_array) > 1) {
$block['subject'] = t('Gallery');
}
else {
$block['subject'] = $type_map[$params['blocks']];
}
$block['content'] = theme('gallery_block_image_block', $content);
}
if ($head) {
gallery_set_head($head);
}
return $block;
}
/**
* Theme function : theme_gallery_block_image_block().
*/
function theme_gallery_block_image_block($content) {
return '<div class="g2image_centered">'. $content .'</div>';
}
/**
* Function _gallery_block_grid_block().
*/
......@@ -129,7 +164,14 @@ function _gallery_block_grid_block($delta, $type_map) {
$param_blocks_array = array_fill(0, $num_images, variable_get('gallery_block_grid_'. $delta .'_block_block', 'randomImage'));
$params['blocks'] = is_array($param_blocks_array) ? implode('|', $param_blocks_array) : '';
$params['itemId'] = variable_get('gallery_block_grid_'. $delta .'_item_id', '');
$param_itemid = variable_get('gallery_block_grid_'. $delta .'_item_id', '');
if (trim($param_itemid) == '%user') {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$param_itemid = gallery_user_useralbum(NULL, FALSE);
}
if (!empty($param_itemid)) {
$params['itemId'] = $param_itemid;
}
$param_show_array = variable_get('gallery_block_grid_'. $delta .'_block_show', array());
$params['show'] = is_array($param_show_array) ? implode('|', $param_show_array) : '';
if (variable_get('gallery_block_grid_'. $delta .'_size_method', GALLERY_GRID_SIZE_METHOD_DEFAULT) == 'maxsize') {
......@@ -143,63 +185,29 @@ function _gallery_block_grid_block($delta, $type_map) {
$params['linkTarget'] = variable_get('gallery_block_grid_'. $delta .'_link_target', '');
$params['link'] = variable_get('gallery_block_grid_'. $delta .'_link', '');
return _gallery_block_get_block($params, array('num_cols' => $num_cols));
}
/**
* Function _gallery_block_get_block().
*/
function _gallery_block_get_block($params, $extra = array()) {
// Handle useralbum feature
if (preg_match('/user(:([\d]+))?/i', $params['itemId'], $param_uid)) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$params['itemId'] = gallery_user_useralbum(isset($param_uid[2]) ? $param_uid[2] : NULL, FALSE);
}
if (empty($params['itemId']) || $params['itemId'] === FALSE) {
unset($params['itemId']);
}
gallery_debug($params, t('Block parameters'));
// Get the image(s) from G2
$block = array();
list($ret, $content, $head) = GalleryEmbed::getImageBlock($params);
if ($ret) {
gallery_error(t('Error trying to get image block.'), $ret);
gallery_error(t('Unable to get Gallery image block'), $ret);
return array();
}
// Format the block content
$block = array();
if ($content) {
$block['subject'] = t('Gallery');
if (isset($extra['num_cols'])) {
$class = isset($extra['class']) ? $extra['class'] : 'gallery-grid-block';
$block['content'] = theme('gallery_block_grid_block', $content, $extra['num_cols'], $class);
}
else {
$class = isset($extra['class']) ? $extra['class'] : 'g2image_centered';
$block['content'] = theme('gallery_block_image_block', $content, $class);
}
// Add css/js to the page
if ($head) {
gallery_set_head($head);
}
$block['subject'] = t('Gallery');
$images = _gallery_split_imageblock($content);
$images = array_chunk($images, $num_cols);
$block['content'] = theme('gallery_block_grid_block', $images);
}
if ($head) {
gallery_set_head($head);
}
return $block;
}
/**
* Theme function : theme_gallery_block_image_block().
*/
function theme_gallery_block_image_block($content, $class = 'g2image_centered') {
return '<div class="'. $class .'">'. $content .'</div>';
}
/**
* Theme function : theme_gallery_block_grid_block().
*/
function theme_gallery_block_grid_block($content, $num_cols, $class = 'gallery-grid-block') {
$images = _gallery_split_imageblock($content);
$images = array_chunk($images, $num_cols);
function theme_gallery_block_grid_block($images) {
$rows = array();
foreach ($images as $image_row) {
$row = array();
......@@ -208,10 +216,10 @@ function theme_gallery_block_grid_block($content, $num_cols, $class = 'gallery-g
}
$rows[] = $row;
}
$html = '<div class="'. $class .'"><div class="image-grid">';
$html = '<div class="gallery-grid-block"><div class="image-grid">';
$html .= theme('table', array(), $rows);
$html .= '</div></div>';
return $html;
}
......@@ -20,44 +20,33 @@ function gallery_filter_process($text) {
return $text;
}
$default['n'] = variable_get('gallery_filter_n_images', 1);
$default['type'] = variable_get('gallery_filter_default_block_type', 'recentImage');
$default['type'] = implode('|', array_fill(0, $default['n'], variable_get('gallery_filter_default_block_type', 'recentImage')));
$default['maxsize'] = variable_get('gallery_filter_default_maxsize', GALLERY_FILTER_MAXSIZE_DEFAULT);
$default['exactsize'] = variable_get('gallery_filter_default_exactsize', GALLERY_FILTER_EXACTSIZE_DEFAULT);
$default['class'] = variable_get('gallery_filter_default_div_class', 'nowrap');
$default['album_frame'] = variable_get('gallery_filter_default_album_frame', 'none');
$default['item_frame'] = variable_get('gallery_filter_default_item_frame', 'none');
$default['show'] = array_filter(variable_get('gallery_filter_default_show', array('none')));
$default['show'] = variable_get('gallery_filter_default_show', array('none'));
$default['target'] = variable_get('gallery_filter_default_link_target', '');
$default['link'] = variable_get('gallery_filter_default_link', '');
}
else {
return $text;
}
$head_array = array();
// Loop over all matches
foreach ($matches as $match) {
// First argument is numeric => valid G2 filter tag
if (is_numeric($match[1])) {
$params = array();
$params['itemId'] = intval($match[1]);
$args = array_filter(preg_split('/[\s,]+/', $match[2]));
$params = array('itemId' => intval($match[1]));
// If this item is not an album (e.g. photo, movie, ...) set block type to 'specificItem'
$details = gallery_item_details($params['itemId']);
if (isset($details['g2type']) && $details['g2type'] != 'GalleryAlbumItem') {
$params['n'] = 1;
$params['type'] = 'specificItem';
}
if (preg_match('/user(:([\d]+))?/i', $params['itemId'], $param_uid)) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$params['itemId'] = gallery_user_useralbum(isset($param_uid[2]) ? $param_uid[2] : NULL, FALSE);
}
// Loop over all (optional) arguments
foreach ($args as $arg) {
list($key, $value) = array_filter(explode('=', $arg));
if (!empty($value)) {
$key = preg_replace('/\W/', '', $key);
$params[$key] = _gallery_filter_sanitize($key, $value);
}
$key = preg_replace('/\W/', '', $key);
$params[$key] = _gallery_filter_sanitize($key, $value);
}
// Treat 'maxsize' and 'size' as the same
if (isset($params['size'])) {
......@@ -68,16 +57,13 @@ function gallery_filter_process($text) {
// entered value must take precedence over the default)
if (isset($params['maxsize'])) {
unset($default['exactsize']);
}
else if (isset($params['exactsize'])) {
}
if (isset($params['exactsize'])) {
unset($default['maxsize']);
}
// Merge params with default values
$params = array_merge($default, $params);
// Transform 'type' into a valid parameter
if ($params['n'] > 1 && $params['type'] == 'specificItem') {
$params['type'] = $default['type'];
}
if (is_array($params['type'])) {
// Ensure 'type' contains 'n' elements (auto-append if necessary)
$count = count($params['type']);
......@@ -94,32 +80,23 @@ function gallery_filter_process($text) {
}
// Convert into G2-compatible arguments
$params['blocks'] = implode('|', $params['type']);
if (isset($params['maxsize']) && !empty($params['maxsize'])) {
if (isset($params['maxsize']) && !empty($params['maxsize'])) {
$params['maxSize'] = $params['maxsize'];
unset($params['exactSize']);
}
else if (isset($params['exactsize']) && !empty($params['exactsize'])) {
if (isset($params['exactsize']) && !empty($params['exactsize'])) {
$params['exactSize'] = $params['exactsize'];
unset($params['maxSize']);
}
$params['albumFrame'] = $params['album_frame'];
$params['itemFrame'] = $params['item_frame'];
$params['show'] = implode('|', $params['show']);
$params['linkTarget'] = $params['target'];
// Unset redundant parameters
unset(
$params['n'],
$params['type'],
$params['exactsize'],
$params['maxsize'],
$params['frame'],
$params['album_frame'],
$params['item_frame'],
$params['target']
);
gallery_debug($params, t('Filter parameters'));
// Fetch the images and format output
$params['link'] = $params['link'];
// Fetch the images and format output
list($ret, $content, $head) = GalleryEmbed::getImageBlock($params);
if ($ret) {
gallery_error(t('Error trying to get image block.'), $ret);
gallery_error(t('Unable to get Gallery image block'), $ret);
continue;
}
if ($content) {
......@@ -139,7 +116,7 @@ function gallery_filter_process($text) {
gallery_set_head(implode("\n", array_unique($head_array)));
}
GalleryEmbed::done();
return $text .'<br class="giImageBlock-clear-both" />';
}
......
......@@ -16,7 +16,7 @@ function gallery_g2image_add_js() {
$path = drupal_get_path('module', 'gallery');
$g2image_uri = base_path() . $path .'/g2image/';
drupal_add_js('var G2IMAGE_URI = "'. $g2image_uri .'";', 'inline');
drupal_add_js(array('gallery2' => array('g2image_uri' => $g2image_uri)), 'setting');
drupal_add_js($path .'/g2image.js');
$sent = TRUE;
......@@ -30,7 +30,7 @@ function gallery_g2image_add_js() {
function theme_gallery_g2image_textarea_link($element, $link) {
$output = '<div class="g2image-button"><a class="g2image-link" id="g2image-link-'. $element['#id']
.'" title="'. t('Click here to add images from Gallery2 albums')
.'" href="#" onclick="g2image_open(\''. $element['#id'] .'\');">';
.'" href="#" onclick="g2ic_open(\''. $element['#id'] .'\');">';
$output .= t('Add Gallery2 images');
$output .= '</a></div>';
......
This diff is collapsed.
......@@ -4,4 +4,5 @@ name = "Gallery Menu"
description = "Gallery2 albums => Drupal menu items"
package = "Gallery2"
dependencies = gallery
dependencies[] = gallery
core = 6.x
This diff is collapsed.
......@@ -37,9 +37,9 @@ function _gallery_report($download = FALSE, $report = array(), $cache = FALSE) {
system_get_files_database($modules, 'module');
foreach ($modules as $name => $module) {
if (in_array($name, array('gallery', 'gallery_menu', 'gallery_content'))) {
$info = _module_parse_info_file(dirname($module->filename) .'/'. $module->name .'.info');
$info = drupal_parse_info_file(dirname($module->filename) .'/'. $module->name .'.info');
$report['Module']['Version'][$info['name']] = array(
'Version' => $info['version'] ? $info['version'] : 'unknown',
'Version' => isset($info['version']) ? $info['version'] : 'unknown',
'Schema Version' => $module->schema_version,
'Location' => dirname($module->filename),
'Status' => $module->status
......@@ -77,7 +77,7 @@ function _gallery_report($download = FALSE, $report = array(), $cache = FALSE) {
// Get some basic information about G2 plugins
list($ret, $plugins) = GalleryCoreApi::fetchPluginStatus('module');
foreach ($plugins as $name => $info) {
$report['Gallery 2']['Active Plugins'][drupal_ucfirst($name)]['Version'] = $info['active'] ? $info['version'] : 'inactive';
$report['Gallery 2']['Active Plugins'][drupal_ucfirst($name)]['Version'] = isset($info['active']) ? $info['version'] : 'inactive';
}
// Debug Logs
if ($GLOBALS['gallery']->_debug == 'buffered' && !empty($GLOBALS['gallery']->_debugBuffer)) {
......
......@@ -20,12 +20,13 @@ function _gallery_search($op = 'search', $keys = NULL) {
$matches = _gallery_search_pager_search($keys, $items_per_row * $rows_per_pager);
if ($matches['count']) {
$results['count'] = $matches['count'];
// Parameters for the search results
// parameters for the search results
$params = array();
$params['blocks'] = 'specificItem';
$param_show_array = variable_get('gallery_search_block_show', array());
$params['show'] = is_array($param_show_array) ? implode('|', $param_show_array) : '';
if (variable_get('gallery_search_size_method', GALLERY_SEARCH_SIZE_METHOD_DEFAULT) == 'maxsize') {
if (variable_get('gallery_search_size_method',
GALLERY_SEARCH_SIZE_METHOD_DEFAULT) == 'maxsize') {
$params['maxSize'] = variable_get('gallery_search_size', GALLERY_SEARCH_SIZE_DEFAULT);
}
else {
......@@ -37,10 +38,10 @@ function _gallery_search($op = 'search', $keys = NULL) {
$params['link'] = variable_get('gallery_search_link', '');
$show_thumbs = variable_get('gallery_search_show_thumbs', 1);
// Loop over the results
// loop over the results
foreach ($matches['results'] as $item) {
$excerpt = array();
// Get a thumbnail for this item
// get a thumbnail for this item
if ($show_thumbs) {
$params['itemId'] = $item['itemId'];
list($ret, $thumbnail, $head) = GalleryEmbed::getImageBlock($params);
......@@ -51,13 +52,13 @@ function _gallery_search($op = 'search', $keys = NULL) {
$html_head[] = $head;
}
}
// Generate a snippet with highlighted search keys
// generate a snippet with highlighted search keys
foreach ($item['fields'] as $field) {
if (preg_match("/$keys/i", $field['value'])) {
$excerpt[] = '<em>'. $field['key'] .':</em> '. search_excerpt($keys, $field['value']);
}