summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/lightbox2.js20
-rw-r--r--lightbox2.install2
-rw-r--r--lightbox2.module24
3 files changed, 45 insertions, 1 deletions
diff --git a/js/lightbox2.js b/js/lightbox2.js
index 10c644f..855c7ed 100644
--- a/js/lightbox2.js
+++ b/js/lightbox2.js
@@ -6,6 +6,7 @@ if (Drupal.jsEnabled) {
lightbox2_lite_general_handler();
lightbox2_lite_auto_handler();
image_node_handler();
+ image_group_handler();
$("input[@name=lightbox2_lite]").bind("click", lightbox2_lite_general_handler);
$("input[@name=lightbox2_use_alt_layout]").bind("click", alt_layout_handler);
$("input[@name=lightbox2_image_node]").bind("click", image_node_handler);
@@ -13,6 +14,7 @@ if (Drupal.jsEnabled) {
$("input[@name=lightbox2_image_assist_custom]").bind("click", image_node_handler);
$("input[@name=lightbox2_inline]").bind("click", image_node_handler);
$("textarea[@name=lightbox2_custom_trigger_classes]").bind("change", image_node_handler);
+ $("input[@name=lightbox2_image_group]").bind("click", image_group_handler);
});
}
@@ -46,6 +48,7 @@ function lightbox2_lite_auto_handler(event) {
$("input[@name=lightbox2_node_link_text]").attr("disabled", "disabled");
$("input[@name=lightbox2_node_link_target]").attr("disabled", "disabled");
$("input[@name=lightbox2_image_group]").attr("disabled", "disabled");
+ $("input[@name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled");
$("select[@name=lightbox2_display_image_size]").attr("disabled", "disabled");
$("select[@name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
$("input[@name=lightbox2_flickr]").attr("disabled", "disabled");
@@ -64,6 +67,7 @@ function lightbox2_lite_auto_handler(event) {
$("input[@name=lightbox2_node_link_text]").removeAttr("disabled");
$("input[@name=lightbox2_node_link_target]").removeAttr("disabled");
$("input[@name=lightbox2_image_group]").removeAttr("disabled");
+ $("input[@name=lightbox2_imagefield_group_node_id]").removeAttr("disabled");
$("select[@name=lightbox2_display_image_size]").removeAttr("disabled");
$("select[@name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
$("input[@name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
@@ -95,11 +99,13 @@ function image_node_handler(event) {
$("input[@name=lightbox2_node_link_text]").removeAttr("disabled");
$("input[@name=lightbox2_node_link_target]").removeAttr("disabled");
$("input[@name=lightbox2_image_group]").removeAttr("disabled");
+ $("input[@name=lightbox2_imagefield_group_node_id]").removeAttr("disabled");
}
else {
$("input[@name=lightbox2_node_link_text]").attr("disabled", "disabled");
$("input[@name=lightbox2_node_link_target]").attr("disabled", "disabled");
$("input[@name=lightbox2_image_group]").attr("disabled", "disabled");
+ $("input[@name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled");
}
// Image node only stuff.
@@ -114,4 +120,18 @@ function image_node_handler(event) {
$("select[@name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
}
}
+
+ image_group_handler();
+}
+
+function image_group_handler(event) {
+ // Image grouping stuff.
+ if ($("input[@name=lightbox2_lite]").val() != 1) {
+ if ($("input[@name=lightbox2_image_group]:checked").val() == 1) {
+ $("input[@name=lightbox2_imagefield_group_node_id]").removeAttr("disabled");
+ }
+ else {
+ $("input[@name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled");
+ }
+ }
}
diff --git a/lightbox2.install b/lightbox2.install
index 6aabe98..f63cac5 100644
--- a/lightbox2.install
+++ b/lightbox2.install
@@ -38,8 +38,10 @@ function lightbox2_uninstall() {
variable_del('lightbox2_custom_trigger_classes');
variable_del('lightbox2_image_group');
variable_del('lightbox2_node_link_text');
+ variable_del('lightbox2_node_link_target');
variable_del('lightbox2_disable_nested_galleries');
variable_del('lightbox2_disable_nested_acidfree_galleries');
+ variable_del('lightbox2_imagefield_group_node_id');
}
/*
diff --git a/lightbox2.module b/lightbox2.module
index f4c8977..aa744b9 100644
--- a/lightbox2.module
+++ b/lightbox2.module
@@ -323,7 +323,7 @@ function lightbox2_auto_image_handling_settings_form() {
$form['lightbox2_node_link_text'] = array(
'#type' => 'textfield',
'#title' => t('Text for Node Link'),
- '#description' => t('This is the text that will appear as the link to the node underneath the image in the lightbox'),
+ '#description' => t('This is the text that will appear as the link to the node underneath the image in the lightbox.'),
'#default_value' => variable_get('lightbox2_node_link_text', 'View Image Details'),
);
@@ -362,6 +362,25 @@ function lightbox2_auto_image_handling_settings_form() {
);
}
+ // Define Imagefield settings fieldset.
+ /* ---------------------------------- */
+ if (module_exists('imagefield') && module_exists('imagecache')) {
+ $form['lightbox2_imagefield_options'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Imagefield settings'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+
+ // Add checkbox for imagefield grouping.
+ $form['lightbox2_imagefield_options']['lightbox2_imagefield_group_node_id'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Group Imagefields by Node Id'),
+ '#description' => t('By default, imagefields in views are grouped by the field name they appear in the view in. Enabling this option allows them to be grouped by field name and node id (where available).'),
+ '#default_value' => variable_get('lightbox2_imagefield_group_node_id', FALSE),
+ );
+ }
+
return system_settings_form($form);
}
@@ -634,6 +653,9 @@ function theme_imagefield_image_imagecache_lightbox2($view_preset, $field, $item
$rel = 'lightbox';
if (variable_get('lightbox2_image_group', TRUE)) {
$rel = 'lightbox['. $field['field_name'] .']';
+ if (variable_get('lightbox2_imagefield_group_node_id', FALSE) && !empty($item['nid'])) {
+ $rel = 'lightbox['. $field['field_name'] . $item['nid'] .']';
+ }
}
$node_link = '';