[Mapbender-commits] r10334 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Nov 18 04:59:46 PST 2019


Author: armin11
Date: 2019-11-18 04:59:46 -0800 (Mon, 18 Nov 2019)
New Revision: 10334

Modified:
   trunk/mapbender/http/plugins/mod_metadataCarousel.php
Log:
some bugfixes

Modified: trunk/mapbender/http/plugins/mod_metadataCarousel.php
===================================================================
--- trunk/mapbender/http/plugins/mod_metadataCarousel.php	2019-11-16 11:34:56 UTC (rev 10333)
+++ trunk/mapbender/http/plugins/mod_metadataCarousel.php	2019-11-18 12:59:46 UTC (rev 10334)
@@ -36,21 +36,47 @@
 //load options from element vars - if not already be done before
 //element_vars we need
 // 1. script name of the searchInterface to use
-// 2. number of tiles to show together
-// 3. number of objects to get from the searchInterface with one call (should be a factor of 2. )
+// 2. slidesPerSide - number of tiles to show together
+// 3. maxResults - number of objects to get from the searchInterface with one call (should be a factor of 2. )
 // 4. resource type - wmc/layer
 // 5. list of resource ids to filter {[1,2,3]}
 // 6. size of images, ...
 // 7. allowResize - like in loadwmc cause a function is borrowed from there
 
-//options.resourceFilter = "[3,11,12]";
-options.allowResize = true;
+options.resourceFilter = "[3,11,12]";
+
 options.resourceFilter = "[]";
 
+if (options.allowResize == "true") {
+    options.allowResize = true;
+} else {
+    options.allowResize = false;
+}
+
+if (Number.isInteger(options.maxResults)) {
+    
+} else {
+    options.maxResults = 6;
+}
+if (Number.isInteger(options.slidesPerSide)) {
+    
+} else {
+    options.slidesPerSide = 3;
+}
+
+if (typeof options.searchUrl == 'undefined') {
+    options.searchUrl = "../php/mod_callMetadata.php?";
+} else {
+    //alert(options.searchUrl);
+}
+
+
 var metadataCarousel = function() {
     var that = this;
     this.id = options.id; //id of the upper div tag from mapbender element
     this.resourceFilter = JSON.parse(options.resourceFilter);
+
+
     if (this.resourceFilter.length > 0){
         this.resourceFilterString = "&resourceIds="+this.resourceFilter.join(',');
     } else {
@@ -78,12 +104,14 @@
 
     var targetName = options.target;
     var showMoreButtonText = "Show more";
-    var maxResults = 12;
+    var maxResults = options.maxResults;
     var currentPage = 0;
     var maxPages = 1;
     var numberOfResults = 0;
-    var searchUrl = "../php/mod_callMetadata.php?";
+    var searchUrl = options.searchUrl;
     //var searchUrl = "../php/mod_callMetadataRemote.php?";
+    var slidesPerSide = options.slidesPerSide;
+
     //first init form - hopefully that is done fast
     this.initForm();
 
@@ -121,7 +149,7 @@
         animationLoop: false,
         itemWidth: 150,
         itemMargin: 5,
-        maxItems: 3,
+        maxItems: slidesPerSide,
         pausePlay: false,
         start: function(slider){
             $('.slides li img', slider).click(function(){



More information about the Mapbender_commits mailing list