summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThilo Wawrzik2007-07-13 08:46:43 (GMT)
committer Thilo Wawrzik2007-07-13 08:46:43 (GMT)
commitc265183b3c4664a2c08fadf421d573d553a3205c (patch)
tree7fe285b9328ffcfe20016f79c63f34bb774e800d
parent7945429d0420ce8129f6509beb121f0fd52d08dd (diff)
- feature: switch Drupal theme for gallery pages
- bugfix: dont 'lock' account of G2 site admin
-rw-r--r--gallery.module6
-rw-r--r--gallery_base.inc32
-rw-r--r--gallery_settings.inc31
-rw-r--r--gallery_user.inc2
4 files changed, 20 insertions, 51 deletions
diff --git a/gallery.module b/gallery.module
index fb9b4bd..52500a0 100644
--- a/gallery.module
+++ b/gallery.module
@@ -24,6 +24,8 @@ function gallery_perm() {
* Implementation of hook_menu
*/
function gallery_menu($may_cache) {
+ global $custom_theme;
+
$items = array();
if ($may_cache) {
if (variable_get('gallery_valid', 0)) {
@@ -144,6 +146,10 @@ function gallery_menu($may_cache) {
else {
drupal_add_css(drupal_get_path('module', 'gallery') .'/gallery.css');
drupal_add_css(drupal_get_path('module', 'gallery') .'/gallery_filter.css');
+ // Switch theme for gallery pages
+ if (arg(0) == 'gallery' && ($custom_theme = variable_get('gallery_page_theme', NULL)) != 'default') {
+ init_theme();
+ }
}
return $items;
diff --git a/gallery_base.inc b/gallery_base.inc
index b873e57..aba76dc 100644
--- a/gallery_base.inc
+++ b/gallery_base.inc
@@ -6,8 +6,6 @@
* Base functions
*/
-define(GALLERY_NO_EMBED_THEME, -1);
-
define(GALLERY_ERROR_WATCHDOG, 1);
define(GALLERY_ERROR_BROWSER, 2);
define(GALLERY_ERROR_VERBOSE, 3);
@@ -160,36 +158,6 @@ function gallery_get_language($user) {
}
/**
- * Retrieve all (active) themes from Gallery2
- */
-function gallery_get_themes($all = FALSE) {
- _gallery_init();
- // List of themes
- list($ret, $g2_themes) = GalleryCoreApi::fetchPluginStatus('theme', TRUE);
- if ($ret) {
- gallery_error(t('Error retrieving theme list'), $ret);
- return array();
- }
-
- $themes = array();
- foreach (array_keys($g2_themes) as $themeid) {
- // Only active themes
- if (!empty($g2_themes[$themeid]['active']) || $all) {
- // Get theme details
- list($ret, $theme) = GalleryCoreApi::loadPlugin('theme', $themeid, TRUE);
- if ($ret) {
- gallery_error(t('Error getting theme (:themeid) details',
- array(':themeid' => $themeid)), $ret);
- return array();
- }
- $themes[$themeid] = $theme->getName();
- }
- }
-
- return $themes;
-}
-
-/**
* Retrieve all image frames from Gallery2
*/
function gallery_get_image_frames() {
diff --git a/gallery_settings.inc b/gallery_settings.inc
index 2700622..35697b2 100644
--- a/gallery_settings.inc
+++ b/gallery_settings.inc
@@ -32,32 +32,27 @@ function _gallery_settings_general() {
'#collapsed' => FALSE,
);
- /*
- // Gallery2 Theme Settings
+ // Theme Settings
$form['theme'] = array(
'#type' => 'fieldset',
- '#title' => t('Gallery2 theme settings'),
+ '#title' => t('Theme settings'),
'#description' => '',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
- $themes = array(GALLERY_NO_EMBED_THEME => t('default'));
- $themes += gallery_get_themes();
- $form['theme']['gallery_theme'] = array(
+ $themes = system_theme_data();
+ ksort($themes);
+ $options = array('default' => t('System default'));
+ foreach ($themes as $theme) {
+ $options[$theme->name] = drupal_ucfirst($theme->name);
+ }
+ $form['theme']['gallery_page_theme'] = array(
'#type' => 'select',
- '#title' => t('Gallery2 embedded theme'),
- '#default_value' => variable_get('gallery_theme', GALLERY_NO_EMBED_THEME),
- '#options' => $themes,
- '#description' => t('Gallery2 will switch to this theme when viewed in embedded mode.'),
+ '#title' => t('Gallery page theme'),
+ '#default_value' => variable_get('gallery_page_theme', 'default'),
+ '#options' => $options,
+ '#description' => t('Drupal theme to be used for all gallery pages (gallery/*).'),
);
- */
-
- $imageblock_desc = t('The Gallery Image Block requires the Gallery2
- Image Block plugin (!imageblock_status) and optionally the Gallery2 Image Frame
- plugin (!imageframe_status).', array(
- '!imageblock_status' => theme('gallery_plugin_status_message', $plugin_status['imageblock']),
- '!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']),
- ));
// Gallery Block Settings
$form['blocks'] = array(
diff --git a/gallery_user.inc b/gallery_user.inc
index e89877d..a3caafc 100644
--- a/gallery_user.inc
+++ b/gallery_user.inc
@@ -198,7 +198,7 @@ function gallery_user_modify($user, $action = 'create', $groups = FALSE, $vars =
}
// Set the 'locked' property for the user
- if (variable_get('gallery_user_locked', 0) && $action != 'delete') {
+ if (variable_get('gallery_user_locked', 0) && ($action != 'delete') && ($user->uid > 1)) {
list($ret, $g2_user) = GalleryCoreApi::loadEntityByExternalId($user->uid, 'GalleryUser');
if ($ret) {
gallery_error(t('Error loading Gallery user'), $ret);