Skip to content

Commit dc8dd4e

Browse files
committed
added capabilities attribution logos in the legend panel
1 parent 7dff64d commit dc8dd4e

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

index.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
a.mdMeta {
9797
text-decoration: none;
9898
}
99+
img.mdLogo {
100+
max-height: 64px;
101+
max-width: 64px;
102+
float: right;
103+
}
99104

100105
/* panels placement */
101106
.popupPanel {
@@ -168,9 +173,9 @@
168173
<div data-role="header" id="header" class="ui-bar-b">
169174
<h2 id="title"></h2>
170175
<div data-role="controlgroup" data-type="horizontal" class="ui-btn-right">
171-
<a href="#panelLegend" data-rel="popup" data-role="button" data-position-to="window" data-mini="true" data-icon="info2" data-iconpos="notext">Legend</a>
172-
<a href="#panelFind" data-rel="popup" data-role="button" data-position-to="window" data-mini="true" data-icon="search" data-iconpos="notext">Find</a>
173-
<a href="#panelShare" data-rel="popup" data-role="button" data-position-to="window" data-mini="true" data-icon="person" data-iconpos="notext">Share</a>
176+
<a href="#panelLegend" id="#panelLegendBtn" data-rel="popup" data-role="button" data-position-to="window" data-mini="true" data-icon="info2" data-iconpos="notext">Legend</a>
177+
<a href="#panelFind" id="#panelFindBtn" data-rel="popup" data-role="button" data-position-to="window" data-mini="true" data-icon="search" data-iconpos="notext">Find</a>
178+
<a href="#panelShare" id="#panelShareBtn" data-rel="popup" data-role="button" data-position-to="window" data-mini="true" data-icon="person" data-iconpos="notext">Share</a>
174179
</div>
175180
</div>
176181

@@ -181,8 +186,8 @@ <h2 id="title"></h2>
181186
<!-- map controls -->
182187
<div id="mapcontrols">
183188
<a id="zeBt" href="#" data-role="button" data-iconpos="notext" data-icon="home" data-theme="b">initial view</a>
184-
<a id="ziBt" href="#" data-role="button" data-iconpos="notext" data-icon="plus" data-theme="b">zoom +</a>
185-
<a id="zoBt" href="#" data-role="button" data-iconpos="notext" data-icon="minus" data-theme="b">zoom -</a>
189+
<a id="ziBt" href="#" data-role="button" data-iconpos="notext" data-icon="plus" data-theme="a">zoom +</a>
190+
<a id="zoBt" href="#" data-role="button" data-iconpos="notext" data-icon="minus" data-theme="a">zoom -</a>
186191
<a id="bgBt" href="#" data-role="button" data-iconpos="notext" data-icon="arrow-r" data-theme="b">background map</a>
187192
</div>
188193
</div>

js/custom.DIST.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@ var customConfig = {
114114
*/
115115
//~ openLSGeocodeUrl: "http://geobretagne.fr/openls?",
116116

117-
/**
118-
* constant : openLSMaxResponses
119-
*/
120-
//~ openLSMaxResponses: 4,
121-
122117
/**
123118
* constant : layersBackground
124119
* array of OpenLayers backgrounds. Only one displayed at a time.

js/m.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ function init() {
354354
}
355355
});
356356
if (mdLayer) {
357-
mdLayer = capabilities.capability.layers[0];
357+
console.log(mdLayer);
358358
legendArgs = {
359359
"service" : "WMS",
360360
"version" : capabilities.version,
@@ -369,40 +369,47 @@ function init() {
369369

370370
// attribution
371371
if (mdLayer.attribution) {
372-
html = html +
373-
"&nbsp;(<a target='_blank'class='mdAttrib' href='" +
374-
mdLayer.attribution.href +
375-
"'>" +
376-
escHTML(mdLayer.attribution.title) +
377-
"</a>)";
372+
if (mdLayer.attribution.logo) {
373+
html += "&nbsp;(<a target='_blank'class='mdAttrib' href='";
374+
html += mdLayer.attribution.href;
375+
html += "'>";
376+
html += "<img class='mdLogo'src='";
377+
html += mdLayer.attribution.logo.href;
378+
html += "'< /></a>)";
379+
}
380+
else {
381+
html += "&nbsp;(<a target='_blank'class='mdAttrib' href='";
382+
html += mdLayer.attribution.href;
383+
html += "'>";
384+
html += escHTML(mdLayer.attribution.title);
385+
html += "</a>)";
386+
}
378387
};
379-
html = html + "</h3>";
388+
html += "</h3>";
380389

381390
// abstract
382-
html = html +
383-
"<p class='mdAbstract'>" +
384-
escHTML(mdLayer.abstract);
391+
html += "<p class='mdAbstract'>";
392+
html += escHTML(mdLayer.abstract);
385393

386394
// metadata
387395
if (mdLayer.metadataURLs) {
388396
$.each(mdLayer.metadataURLs, function(i,md) {
389397
if (md.format === "text/html") {
390-
html = html +
391-
"&nbsp;<a target='_blank'class='mdMeta' href='" +
392-
md.href +
393-
"'>" +
394-
"[+]</a>";
398+
html += "&nbsp;<a target='_blank'class='mdMeta' href='";
399+
html += md.href;
400+
html += "'>";
401+
html += "[+]</a>";
395402
};
396403
});
397404
};
398-
html = html + "</p>";
405+
html += "</p>";
399406

400407
// legend
401-
html = html + "<img class='mdLegend' src='" +
402-
Ol.Util.urlAppend(capabilities.service.href, Ol.Util.getParameterString(legendArgs)) +
403-
"' />";
408+
html += "<img class='mdLegend' src='";
409+
html += Ol.Util.urlAppend(capabilities.service.href, Ol.Util.getParameterString(legendArgs));
410+
html += "' />";
404411

405-
html = html + "<hr />";
412+
html += "<hr />";
406413

407414
$("#legend").append(html);
408415
}
@@ -734,7 +741,6 @@ function init() {
734741
};
735742
});
736743
$("#georchestraFormData").val(JSON.stringify(params));
737-
console.log(params);
738744
return true;
739745
}
740746
};

0 commit comments

Comments
 (0)