changeset 1008:3bac9932df01

fixed behaviour of digilibUrl action. disabled non-functional slider for rotation.
author robcast
date Tue, 14 Feb 2012 20:06:04 +0100
parents c9c9621eb1e6
children 9006799d9898
files webapp/src/main/webapp/jquery/jquery.digilib.buttons.js webapp/src/main/webapp/jquery/jquery.digilib.js
diffstat 2 files changed, 31 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js	Tue Feb 14 18:36:12 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js	Tue Feb 14 20:06:04 2012 +0100
@@ -79,7 +79,7 @@
             },
         rot : {
             onclick : "rotate",
-            onclick : ["slider", "rot"],
+            //onclick : ["slider", "rot"],
             tooltip : "rotate image",
             icon : "rotate.png"
             },
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Tue Feb 14 18:36:12 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Tue Feb 14 20:06:04 2012 +0100
@@ -38,7 +38,7 @@
 
     var defaults = {
         // version of this script
-        'version' : 'jquery.digilib.js 2.1.5b1',
+        'version' : 'jquery.digilib.js 2.1.5b2',
         // logo url
         'logoUrl' : 'img/digilib-logo-text1.png',
         // homepage url (behind logo)
@@ -450,8 +450,8 @@
             var url = getDigilibUrl(data);
             if (noprompt == null) {
                 window.prompt("URL reference to the current view", url);
-                // return false so we can use is in javascript: url without reload
-                return false;
+                // return nothing so we can use is in javascript: url without reload
+                return;
             }
             return url;
         },
@@ -464,11 +464,14 @@
          * @param mode
          */
         digilibUrl : function (data, mode) {
-            var baseUrl = data.settings.digilibBaseUrl + '/jquery/digilib.html';
-            var url = getDigilibUrl(data, baseUrl);
+            var url = getDigilibUrl(data, '/jquery/digilib.html');
             if (mode === 'open') {
                 // redirect
                 window.location = url;
+            } else if (mode === 'open_new') {
+                // open new window
+                window.open(url);
+                return;
             }
             return url;
         },
@@ -631,32 +634,38 @@
         return url;
     };
 
-    /** returns URL and query string for current digilib
+    /** 
+     * returns URL and query string for current digilib.
+     * if digilibPage != null returns URL to page in digilib installation with digilib parameters,
+     * otherwise using current URL and parameters.
      * 
      */
-    var getDigilibUrl = function (data, baseUrl) {
+    var getDigilibUrl = function (data, digilibPage) {
         packParams(data);
         var settings = data.settings;
-        var paramList = settings.additionalParamNames.concat(settings.digilibParamNames);
-        if (settings.suppressParamNames != null) {
-        	// eliminate suppressed parameters from list
-        	paramList = $.map(paramList, function(e, idx) {
-        		if ($.inArray(e, settings.suppressParamNames) >= 0) {
-        			return null;
-        		} else {
-        			return e;
-        		}
-        	});
-        }
-        var queryString = getParamString(settings, paramList, defaults);
-        if (baseUrl == null) {
+        var paramList = settings.digilibParamNames;
+        if (digilibPage != null) {
+            var baseUrl = data.settings.digilibBaseUrl + digilibPage;
+        } else {
+            paramList = settings.additionalParamNames.concat(settings.digilibParamNames);
+            if (settings.suppressParamNames != null) {
+                // eliminate suppressed parameters from list
+                paramList = $.map(paramList, function(e, idx) {
+                    if ($.inArray(e, settings.suppressParamNames) >= 0) {
+                        return null;
+                    } else {
+                        return e;
+                    }
+                });
+            }
             // take url from current location
-            baseUrl = window.location.href;
+            var baseUrl = window.location.href;
             var pos = baseUrl.indexOf('?');
             if (pos > -1) {
                 baseUrl = baseUrl.substring(0, pos);
             }
         }
+        var queryString = getParamString(settings, paramList, defaults);
         return baseUrl + '?' + queryString;
     };