[prev in list] [next in list] [prev in thread] [next in thread]
List: mapbender-commits
Subject: [Mapbender-commits] r10336 - trunk/mapbender/http/plugins
From: svn_mapbender () osgeo ! org
Date: 2019-11-19 9:37:00
Message-ID: 20191119093700.C547213FD9F () trac ! osgeo ! org
[Download RAW message or body]
Author: armin11
Date: 2019-11-19 01:37:00 -0800 (Tue, 19 Nov 2019)
New Revision: 10336
Modified:
trunk/mapbender/http/plugins/mod_metadataCarousel.php
Log:
Fix for css loding - restructure of html elements
Modified: trunk/mapbender/http/plugins/mod_metadataCarousel.php
===================================================================
--- trunk/mapbender/http/plugins/mod_metadataCarousel.php 2019-11-18 13:50:17 UTC \
(rev 10335)
+++ trunk/mapbender/http/plugins/mod_metadataCarousel.php 2019-11-19 09:37:00 UTC \
(rev 10336) @@ -33,6 +33,9 @@
//echo "var mod_gui_wms_visible = '".$vis."';";
?>
+
+options.loadMessage = "<?php echo _mb('Load theme');?>";
+
//load options from element vars - if not already be done before
//element_vars we need
// 1. script name of the searchInterface to use
@@ -56,7 +59,7 @@
if (Number.isInteger(options.maxResults)) {
} else {
- options.maxResults = 6;
+ options.maxResults = 12;
}
if (Number.isInteger(options.slidesPerSide)) {
@@ -70,7 +73,6 @@
//alert(options.searchUrl);
}
-
var metadataCarousel = function() {
var that = this;
this.id = options.id; //id of the upper div tag from mapbender element
@@ -82,28 +84,22 @@
} else {
this.resourceFilterString = "";
}
+
this.initForm = function() {
- this.moduleContainer = $(document.createElement('div')).attr({'id': \
'container'}).appendTo('#' + options.id);
- this.moduleContainer.addClass('cf');
- this.mainContainer = \
$(document.createElement('div')).appendTo(this.moduleContainer);
- this.mainContainer.attr('id', 'main');
- this.mainContainer.attr('role', 'main');
+ //this.flexsliderContainer = $(document.createElement('div')).attr({'id': \
'container'}).appendTo('#' + options.id); + this.flexsliderContainer = \
$('#metadataCarousel'); + this.flexsliderContainer.addClass('flexslider');
+ this.slidesContainer = \
$(document.createElement('ul')).appendTo(this.flexsliderContainer); + \
this.slidesContainer.addClass('slides'); + \
//this.slidesContainer.addClass('temporary'); //hide during initialization
$('#' + options.id).hide();
- this.sliderContainer = \
$(document.createElement('section')).appendTo(this.mainContainer);
- this.sliderContainer.addClass('slider');
- this.carouselContainer = \
$(document.createElement('div')).appendTo(this.sliderContainer);
- this.carouselContainer.addClass('flexslider');
- this.carouselContainer.addClass('carousel');
- this.slidesContainer = \
$(document.createElement('ul')).appendTo(this.carouselContainer);
- this.slidesContainer.addClass('slides');
- this.slidesContainer.attr('id', 'slides');
//first dummy entries ;-)
- this.slidesContainer.append("<li><img src='../img/mapbender_logo.png' \
/></li><li><img class='' src='../img/mapbender_logo.png' /></li><li><img \
src='../img/mapbender_logo.png' /></li><li><img src='../img/mapbender_logo.png' \
/></li>"); + this.slidesContainer.append("<li><img \
src='../img/mapbender_logo.png' /><p class='flex-caption'>Mapbender \
1</p></li><li><img class='' src='../img/mapbender_logo.png' /><p \
class='flex-caption'>Mapbender 2</p></li><li><img src='../img/mapbender_logo.png' \
/><p class='flex-caption'>Mapbender 3</p></li><li><img \
src='../img/mapbender_logo.png' /><p class='flex-caption'>Mapbender 4</p></li>"); }
var targetName = options.target;
- var showMoreButtonText = "Show more";
+ //var showMoreButtonText = "Show more";
var maxResults = options.maxResults;
var currentPage = 0;
var maxPages = 1;
@@ -113,12 +109,12 @@
var slidesPerSide = options.slidesPerSide;
//first init form - hopefully that is done fast
- this.initForm();
+ that.initForm();
this.loadMore = function(){
//alert("actual_loaded_page: "+currentPage+" - max pages: "+maxPages); 1-10 \
(100) //hide further loading button while loading more data
- $('.show_more_button').hide();
+ //$('.show_more_button').hide();
//load next page
$.ajax({url: \
searchUrl+"searchText=*&searchResources=wmc&searchPages="+(parseInt(currentPage) + \
parseInt(1))+"&maxResults="+maxResults+that.resourceFilterString, async: false, \
success: function(result){ result.wmc.srv.forEach(that.addElementToSlider);
@@ -130,32 +126,41 @@
$('.slides li img').click(function(){
var $this = $(this);
resourceId = $this.attr("resourceId");
- alert("Load map: " + resourceId);
+ resourceTitle = $this.attr("title");
+ alert(options.loadMessage + ": " + resourceId);
that.executeJavaScript({method:"loadWmc", parameters:{id:resourceId}});
});
- that.alterCss();
}});
//show loading button again
- $('.show_more_button').show();
+ /*$('.show_more_button').show();
$('.show_more_button').attr("value", \
"1-"+parseInt(currentPage)*parseInt(maxResults)+" ("+numberOfResults+") - \
"+showMoreButtonText);
if (parseInt(currentPage)*parseInt(maxResults) >= parseInt(numberOfResults)) {
$('.show_more_button').attr("value", "1-"+numberOfResults+" \
("+numberOfResults+")"); $('.show_more_button').unbind('click');
- }
+ }*/
}
+ //var mainFlexSlider = $('#'+this.id);
- var mainFlexSlider = $('#'+this.id);
+ var mainFlexSlider = $('.flexslider');
+
+ //alert("slidesPerSide: "+slidesPerSide);
+
mainFlexSlider.flexslider({
animation: "slide",
animationLoop: false,
- itemWidth: 150,
+ itemWidth: 160,
itemMargin: 5,
maxItems: slidesPerSide,
pausePlay: false,
+ slideshow: false,
+ //isFirefox: true,
start: function(slider){
$('.slides li img', slider).click(function(){
var $this = $(this);
- resourceId = $this.attr("resourceId"); that.loadWmcById(resourceId)
+ resourceId = $this.attr("resourceId");
+ resourceTitle = $this.attr("title");
+ alert(options.loadMessage + ": " + resourceTitle);
+ that.loadWmcById(resourceId);
});
},
end: function(slider){
@@ -180,21 +185,15 @@
$("ul.slides").html("");
//alert("number of all wmc: \
"+JSON.parse(initialResult.responseText).wmc.md.nresults);
JSON.parse(initialResult.responseText).wmc.srv.forEach(that.addElementToSlider);
- $('.show_more_button').attr("value", \
"1-"+parseInt(currentPage)*parseInt(maxResults)+" ("+numberOfResults+") - \
"+showMoreButtonText); + /*$('.show_more_button').attr("value", \
"1-"+parseInt(currentPage)*parseInt(maxResults)+" ("+numberOfResults+") - \
"+showMoreButtonText);
if (parseInt(currentPage)*parseInt(maxResults) >= parseInt(numberOfResults)) \
{
$('.show_more_button').attr("value", "1-"+numberOfResults+" \
("+numberOfResults+")"); $('.show_more_button').unbind('click');
- }
+ }*/
}
- this.alterCss = function(){
- $('.flexslider').css({"overflow":"hidden","position":"relative","height":"130px"});
- $('.flexslider_images').css({"width":"150px","height":"100px"});
- }
-
this.addElementToSlider = function(item) {
- mainFlexSlider.data('flexslider').addSlide("<li class='flexslider slides'><a \
href='#'><img class='flexslider flexslider_images' src='"+item.previewURL+"' \
resourceId='"+item.id+"' title='"+item.title+"'/><span \
class='flex-caption'>"+item.title+"</span><span \
class='flex-load-count'>"+item.loadCount+"</span></a></li>");
- that.alterCss();
+ mainFlexSlider.data('flexslider').addSlide("<li class='slide'><div \
class='slide_div'><img src='"+item.previewURL+"' resourceId='"+item.id+"' \
title='"+item.title+"'/><div><span \
class='flex-caption'>"+item.title+"</span></div><div><span \
class='flex-load-count'>"+item.loadCount+"</span></div></div></li>"); }
this.removeOldContainer = function(){
@@ -202,15 +201,15 @@
}
this.loadWmcById = function(wmcId){
- alert("Load map: " + wmcId);
+
+ //alert(options.loadMessage + ": " + wmcId);
//Mapbender.modules.loadwmc.executeJavaScript({method:"loadWmc", \
parameters:{id:wmcId}}); that.executeJavaScript({method:"loadWmc", \
parameters:{id:wmcId}}); }
- that.fillInitialMetadata();
+ that.fillInitialMetadata();
that.removeOldContainer();
$('#' + options.id).show();
- that.alterCss();
//copied from javascripts/mod_loadwmc.js because it will not available, if loadwmc \
window has been closed somewhen!!!! this.executeJavaScript = function (args) {
_______________________________________________
Mapbender_commits mailing list
Mapbender_commits@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapbender_commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic