[Mapbender-commits] r6162 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue May 11 06:11:33 EDT 2010
Author: verenadiewald
Date: 2010-05-11 06:11:30 -0400 (Tue, 11 May 2010)
New Revision: 6162
Modified:
trunk/mapbender/http/plugins/mb_metadata_showOriginal.html
trunk/mapbender/http/plugins/mb_metadata_showOriginal.js
trunk/mapbender/http/plugins/mb_original_metadata_server.php
Log:
replace metadata entries with original ones
Modified: trunk/mapbender/http/plugins/mb_metadata_showOriginal.html
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showOriginal.html 2010-05-11 09:25:04 UTC (rev 6161)
+++ trunk/mapbender/http/plugins/mb_metadata_showOriginal.html 2010-05-11 10:11:30 UTC (rev 6162)
@@ -3,81 +3,68 @@
<legend>Original Service Level Metadata: </legend>
<p>
<label for="original_wms_title">WMS Title (OWS):</label>
- <input name="original_wms_title" id="original_wms_title" class="required"/>
+ <input readonly name="original_wms_title" id="original_wms_title" class="required"/>
</p>
<p>
<label for="original_wms_abstract">WMS Abstract (OWS):</label>
- <input name="original_wms_abstract" id="original_wms_abstract"/>
+ <input readonly name="original_wms_abstract" id="original_wms_abstract"/>
</p>
- <p>
+<!-- <p>
<label for="">WMS Keywords (OWS):</label>
- <input name="original_wms_keywords" id="original_wms_keywords"/>
+ <input readonly name="original_wms_keywords" id="original_wms_keywords"/>
</p>
+-->
<p>
<label for="original_fees">WMS Fees (OWS):</label>
- <input name="original_fees" id="original_fees"/>
+ <input readonly name="original_fees" id="original_fees"/>
</p>
<p>
<label for="original_accessconstraints">WMS AccessConstraints (OWS):</label>
- <input name="original_accessconstraints" id="original_accessconstraints"/>
+ <input readonly name="original_accessconstraints" id="original_accessconstraints"/>
</p>
+
<p>
- <label for="">WMS Predefined Licence (Registry):</label>
- <input name="" id""/>
- </p>
- <p>
- <label>WMS Provider Section (OWS):</label>
- </p>
- <p>
<label for="original_contactperson">Contact Individual Name (OWS):</label>
- <input name="original_contactperson" id="original_contactperson"/>
+ <input readonly name="original_contactperson" id="original_contactperson"/>
</p>
<p>
<label for="original_contactposition">Contact Position Name (OWS):</label>
- <input name="original_contactposition" id="original_contactposition"/>
+ <input readonly name="original_contactposition" id="original_contactposition"/>
</p>
<p>
<label for="original_contactvoicetelephone">Contact Phone Voice (OWS):</label>
- <input name="original_contactvoicetelephone" id="original_contactvoicetelephone"/>
+ <input readonly name="original_contactvoicetelephone" id="original_contactvoicetelephone"/>
</p>
<p>
<label for="original_contactfacsimiletelephone">Contact Phone Fax (OWS):</label>
- <input name="original_contactfacsimiletelephone" id="original_contactfacsimiletelephone"/>
+ <input readonly name="original_contactfacsimiletelephone" id="original_contactfacsimiletelephone"/>
</p>
<p>
<label for="original_contactorganization">Contact Organisation (WMS):</label>
- <input name="original_contactorganization" id="contactorganization"/>
+ <input readonly name="original_contactorganization" id="original_contactorganization"/>
</p>
<p>
<label for="original_address">Contact Address (WMS):</label>
- <input name="original_address" id="original_address"/>
+ <input readonly name="original_address" id="original_address"/>
</p>
<p>
<label for="original_city">Contact City (WMS):</label>
- <input name="original_city" id="original_city"/>
+ <input readonly name="original_city" id="original_city"/>
</p>
<p>
<label for="original_stateorprovince">Contact State or Province (WMS) - ISO 3166-II:</label>
- <input name="original_stateorprovince" id="original_stateorprovince"/>
+ <input readonly name="original_stateorprovince" id="original_stateorprovince"/>
</p>
<p>
<label for="original_postcode">Contact Post Code (WMS):</label>
- <input name="original_postcode" id="original_postcode"/>
+ <input readonly name="original_postcode" id="original_postcode"/>
</p>
<p>
<label for="original_country">Contact Post Country (WMS) - ISO 3166:</label>
- <input name="original_country" id="original_country"/>
+ <input readonly name="original_country" id="original_country"/>
</p>
<p>
<label for="original_contactelectronicmailaddress">Contact Electronic Mail Address (WMS):</label>
- <input name="original_contactelectronicmailaddress" id="original_contactelectronicmailaddress"/>
+ <input readonly name="original_contactelectronicmailaddress" id="original_contactelectronicmailaddress"/>
</p>
- <p>
- <label for="">Date of first registration (Registry):</label>
- <input name="" id=""/>
- </p>
- <p>
- <label for="">Date of last revision (Registry):</label>
- <td><input name="" id=""/>
- </p>
</fieldset>
Modified: trunk/mapbender/http/plugins/mb_metadata_showOriginal.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_showOriginal.js 2010-05-11 09:25:04 UTC (rev 6161)
+++ trunk/mapbender/http/plugins/mb_metadata_showOriginal.js 2010-05-11 10:11:30 UTC (rev 6162)
@@ -9,16 +9,78 @@
replaceMetadata : new Mapbender.Event()
};
+ var replaceMetadata = function (clickedAttr, attrVal) {
+ var returnObj = {};
+ returnObj[clickedAttr] = attrVal;
+ that.events.replaceMetadata.trigger({
+ data : returnObj
+ });
+ //remove background-color of replaced attr
+ $("#" + clickedAttr).removeClass("differentFromOriginal");
+ };
+
+ var replaceAllMetadata = function (obj) {
+ var returnObj = {};
+ for(metadataAttr in obj) {
+ var attr = metadataAttr.split("original_");
+ returnObj[attr[1]] = obj[metadataAttr];
+ }
+ that.events.replaceMetadata.trigger({
+ data : returnObj
+ });
+ //remove background-color of all replaced attr
+ $(".differentFromOriginal").removeClass("differentFromOriginal");
+ };
+
var mergeOriginalWithCurrentMetadata = function (originalObj,currentObj) {
+ var differenceFound = false;
for(metadataAttr in currentObj) {
var origMetadataAttr = "original_" + metadataAttr;
- //if(metadataAttr == ) {
- if(currentObj[metadataAttr] == originalObj[origMetadataAttr]) {
+ if(metadataAttr != "wms_timestamp" && metadataAttr != "wms_timestamp_create" && metadataAttr != "wms_keywords") {
+ //check if both fields are filled
+ if(currentObj[metadataAttr] != "" && originalObj[origMetadataAttr] != "") {
+ if(currentObj[metadataAttr] == originalObj[origMetadataAttr]) {
+ $("#" + origMetadataAttr).parent().hide();
+ }
+ else {
+ //mark all attr in main form which are different
+ $("#" + metadataAttr).addClass("differentFromOriginal");
+ (function () {
+ var clickedAttr = metadataAttr;
+ var attrValue = $("#" + origMetadataAttr).val();
+ $("#" + origMetadataAttr).parent().append("<input type='button' value='Replace' id='replaceRecord_"+origMetadataAttr+"' />");
+ $("#replaceRecord_" +origMetadataAttr).addClass("ui-state-default ui-corner-all");
+ $("#replaceRecord_" +origMetadataAttr).bind("click", function () {
+ replaceMetadata(clickedAttr, attrValue);
+ });
+ })();
+ var differenceFound = true;
+ }
+ }
+ //if both fields are empty, hide the html
+ else {
$("#" + origMetadataAttr).parent().hide();
}
- //}
-
+ }
}
+ if(differenceFound === false) {
+ $originalMetadataPopup.dialog("close");
+ var noDifferenceMsg = "No difference found.";
+ $("<div>" + noDifferenceMsg + "</div>").dialog(
+ {
+ title : "Show original metadata",
+ bgiframe: true,
+ autoOpen: true,
+ modal: false,
+ position : [600, 75],
+ buttons: {
+ "ok": function(){
+ $(this).dialog('close').remove();
+ }
+ }
+ }
+ );
+ }
};
var getOriginalMetadata = function (currentWmsId, currentWmsData) {
@@ -49,13 +111,26 @@
autoOpen : false,
draggable : true,
width : 600,
- position : [600, 75]
+ position : [600, 75],
+ buttons: {
+ "close": function() {
+ $(this).dialog('close');
+ },
+ "replace all metadata": function() {
+ replaceAllMetadata(obj);
+ $(this).dialog('close');
+ }
+ },
+ close: function() {
+ $(".differentFromOriginal").removeClass("differentFromOriginal");
+ }
});
$originalMetadataPopup.dialog("open");
};
this.init = function (obj) {
+ $originalMetadataPopup.dialog("close");
$originalMetadataForm.load("../plugins/mb_metadata_showOriginal.html", function () {
getOriginalMetadata(obj.wmsId, obj.wmsData);
});
Modified: trunk/mapbender/http/plugins/mb_original_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_original_metadata_server.php 2010-05-11 09:25:04 UTC (rev 6161)
+++ trunk/mapbender/http/plugins/mb_original_metadata_server.php 2010-05-11 10:11:30 UTC (rev 6162)
@@ -19,7 +19,25 @@
$xmlDoc->preserveWhiteSpace = false;
$xmlDoc->loadXML($capabilitiesDoc);
- $resultObj = array();
+ //define default resultObj
+ $resultObj = array(
+ "original_wms_title" => "",
+ "original_wms_abstract" => "",
+ "original_accessconstraints" => "",
+ "original_fees" => "",
+// "original_wms_keywords" => "",
+ "original_contactposition" => "",
+ "original_contactelectronicmailaddress" => "",
+ "original_contactfacsimiletelephone" => "",
+ "original_contactvoicetelephone" => "",
+ "original_contactperson" => "",
+ "original_contactorganization" => "",
+ "original_address" => "",
+ "original_city" => "",
+ "original_stateorprovince" => "",
+ "original_postcode" => "",
+ "original_country" => ""
+ );
$service_node = $xmlDoc->getElementsByTagName('Service');
foreach ($service_node as $node) {
@@ -37,7 +55,8 @@
if (strtoupper($child->nodeName) == "FEES"){
$resultObj["original_fees"] = $child->nodeValue;
}
-
+
+/*
//"Service"-childnode KeywordList
if (strtoupper($child->nodeName) == "KEYWORDLIST"){
$keywords_list = $child->childNodes;
@@ -46,9 +65,9 @@
$keyword = $keywordlist_child_node->nodeValue;
array_push($keywords, $keyword);
}
- $resultObj["original_wms_keywords"] = implode(",", $keywords);
+ $resultObj["original_wms_keywords"] = implode(", ", $keywords);
}
-
+*/
//"Service"-childnode ContactInformation
if (strtoupper($child->nodeName) == "CONTACTINFORMATION"){
$contactinfo_list = $child->childNodes;
More information about the Mapbender_commits
mailing list