From: <dco...@us...> - 2009-02-13 15:12:38
|
Revision: 2168 http://geonetwork.svn.sourceforge.net/geonetwork/?rev=2168&view=rev Author: dcorpataux Date: 2009-02-13 15:12:34 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Added a map component in extent search popup Modified Paths: -------------- sandbox/geocat.ch/trunk/web/geonetwork/scripts/ed.js sandbox/geocat.ch/trunk/web/geonetwork/xsl/metadata-edit.xsl Modified: sandbox/geocat.ch/trunk/web/geonetwork/scripts/ed.js =================================================================== --- sandbox/geocat.ch/trunk/web/geonetwork/scripts/ed.js 2009-02-13 15:11:53 UTC (rev 2167) +++ sandbox/geocat.ch/trunk/web/geonetwork/scripts/ed.js 2009-02-13 15:12:34 UTC (rev 2168) @@ -109,7 +109,7 @@ */ function poped (el, pop) { // Hide optional fields - var optionalFields = ['contact.role','extent.resolution']; + var optionalFields = ['contact.role', 'extent.resolution', 'extent.map']; $('popXLink').descendants().each(function(el) { if (optionalFields.indexOf(el.id) != -1) el.style.display = "none"; }) @@ -220,10 +220,18 @@ * Search extents */ function extentInit () { + // Note: drawCmp global object is defined in metadata-edit.xsl + $("extent.map").style.display = "block"; + drawCmp.clearFeatures(); $("extent.resolution").style.display = "block"; $("extent.resolution").selectedIndex = 0; $("xlink.s").value = ""; + // FYI + // drawn feature geometry can be obtained using the global drawCmp object: + // console.log(drawCmp.writeFeature('WKT')); + // console.log(drawCmp.writeFeature('GML')); + // drawCmp.writeFeature() will return null if no feature is drawn var _acc = new Ajax.Autocompleter("xlink.s", "xll", "extent.search.list?numResults=10&property=desc&method=loose&format=gmd_bbox", Modified: sandbox/geocat.ch/trunk/web/geonetwork/xsl/metadata-edit.xsl =================================================================== --- sandbox/geocat.ch/trunk/web/geonetwork/xsl/metadata-edit.xsl 2009-02-13 15:11:53 UTC (rev 2167) +++ sandbox/geocat.ch/trunk/web/geonetwork/xsl/metadata-edit.xsl 2009-02-13 15:12:34 UTC (rev 2168) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:gmd="http://www.isotc211.org/2005/gmd" + xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:geonet="http://www.fao.org/geonetwork"> <!-- @@ -8,6 +8,7 @@ --> <xsl:include href="main.xsl"/> <xsl:include href="metadata.xsl"/> + <xsl:include href="mapfish_includes.xsl" /> <!-- additional scripts @@ -16,6 +17,9 @@ <script type="text/javascript" src="{/root/gui/url}/scripts/prototype.js"></script> <script type="text/javascript" src="{/root/gui/url}/scripts/ed.js"></script> <script type="text/javascript" src="{/root/gui/url}/scripts/scriptaculous/scriptaculous.js?load=slider,effects,controls"/> + + <xsl:call-template name="mapfish_includes"/> + <script language="JavaScript1.2" type="text/javascript"> @@ -59,7 +63,7 @@ function doElementAction(action, ref, id, offset) { - var top = findPos($(id)); + var top = findPos($(id)); //alert("In doElementAction(" + action + ", " + ref + ", " + offset + ")"); // DEBUG document.mainForm.ref.value = ref; document.mainForm.position.value = top + offset; @@ -68,15 +72,15 @@ function doMoveElementAction(action, ref, id) { - var top = findPos($(id)); + var top = findPos($(id)); // position at top of both elements - // ie. if up then subtract height of previous sibling - if down then - // do nothing - if (action.include('elem.up')) { + // do nothing + if (action.include('elem.up')) { var prev = $(id).previous(); top = top - prev.getHeight(); // alert("in doMoveElementAction " + prev.inspect() + ")"); - } + } document.mainForm.ref.value = ref; document.mainForm.position.value = top; doAction(action); @@ -117,14 +121,14 @@ function doFileUploadAction(action, ref, fname, access, id) { - var top = findPos($(id)); + var top = findPos($(id)); // alert("In doFileUploadAction(" + action + ", " + ref + ", " + fname + ")"); // DEBUG if (fname.indexOf('/') > -1) fname = fname.substring(fname.lastIndexOf('/') + 1, fname.length); else fname = fname.substring(fname.lastIndexOf('\\') + 1, fname.length); - + document.mainForm.fname .value = fname; document.mainForm.access.value = access; document.mainForm.ref .value = ref; @@ -134,7 +138,7 @@ document.mainForm.encoding="multipart/form-data"; goSubmit('mainForm'); } - + function doFileRemoveAction(action, ref, access, id) { // alert("In doFileRemoveAction(" + action + ", " + ref + ")"); // DEBUG @@ -145,7 +149,7 @@ function setRegion(westField, eastField, southField, northField, choice) { // alert(westField.name + ", " + eastField.name + ", " + southField.name + ", " + northField.name + " set to " + choice); // FIXME - + if (choice != "") { coords = choice.split(";"); @@ -168,13 +172,26 @@ window.scroll(0,<xsl:value-of select="/root/gui/position"/>); } + function initMapComponent() { + $('popXLink').style.display = 'block'; + var popupDimensions = $('popXLink').getDimensions(); + var mapCmp = new MapComponent('extent.map', { + displayLayertree: false, + resizablePanel: false, + panelWidth: popupDimensions.width-1, + panelHeight: 250 + }); + drawCmp = new MapDrawComponent(mapCmp.map, {toolbar: mapCmp.toolbar, activate: true}); + $('popXLink').style.display = 'none'; + } + // override the body onLoad init() function in geonetwork.js function onloadinit() { timeId = setTimeout('scrollIt()',1000); <!-- <xsl:message>POSITION: <xsl:value-of select="/root/gui/position"/></xsl:message> --> + initMapComponent(); } - Event.observe(window,'load',onloadinit); </script> <style type="text/css">@import url(<xsl:value-of select="/root/gui/url"/>/scripts/calendar/calendar-blue2.css);</style> @@ -185,7 +202,7 @@ <script type="text/javascript" src="{/root/gui/url}/scripts/core/kernel/kernel.js"/> <script type="text/javascript" src="{/root/gui/url}/scripts/editor/tooltip-manager.js"></script> </xsl:template> - + <!-- page content --> @@ -193,7 +210,7 @@ <table width="100%" height="100%"> <xsl:for-each select="/root/*[name(.)!='gui' and name(.)!='request']"> <!-- just one --> <xsl:variable name="locales" select="//gmd:locale"/> - + <tr height="100%"> <td class="blue-content" width="150" valign="top"> <xsl:call-template name="tab"> @@ -241,7 +258,7 @@ </td></tr> </table> </form> - + <xsl:call-template name="xlinkSelector"> <xsl:with-param name="locales" select="$locales"/> </xsl:call-template> @@ -251,33 +268,33 @@ </xsl:for-each> <tr><td class="blue-content" colspan="3"/></tr> </table> - - + + </xsl:template> - + <xsl:template name="editButtons" match="*"> <!-- reset button --> <button class="content" onclick="goReset('mainForm')"><xsl:value-of select="/root/gui/strings/reset"/></button> - + <!-- save button -->   <button class="content" onclick="doAction('{/root/gui/locService}/metadata.update')"> <xsl:value-of select="/root/gui/strings/save"/> </button> - + <!-- save and close button -->   <button class="content" onclick="doAction('{/root/gui/locService}/metadata.update.finish')"> <xsl:value-of select="/root/gui/strings/saveAndClose"/> </button> - + <!-- validate button -->   <button class="content" onclick="doActionInWindow('{/root/gui/locService}/metadata.update.validate');return false;"> <xsl:value-of select="/root/gui/strings/saveAndValidate"/> </button> - + <!-- thumbnails --> <xsl:if test="string(geonet:info/schema)='iso19115' or starts-with(string(geonet:info/schema),'iso19139')"> <!-- FIXME: should be more general -->   @@ -285,7 +302,7 @@ <xsl:value-of select="/root/gui/strings/thumbnails"/> </button> </xsl:if> - + <!-- create button --> <xsl:if test="string(geonet:info/isTemplate)!='s' and (geonet:info/isTemplate='y' or geonet:info/source=/root/gui/env/site/siteId) and /root/gui/services/service/@name='metadata.duplicate.form'">   @@ -293,17 +310,17 @@ <xsl:value-of select="/root/gui/strings/create"/> </button> </xsl:if> - + <!-- cancel button -->   <button class="content" onclick="doAction('{/root/gui/locService}/metadata.show')"> <xsl:value-of select="/root/gui/strings/cancel"/> </button> - + </xsl:template> - + <xsl:template name="templateChoice" match="*"> - + <b><xsl:value-of select="/root/gui/strings/type"/></b> <xsl:text> </xsl:text> <select class="content" name="template" size="1"> @@ -330,7 +347,7 @@ <xsl:value-of select="/root/gui/strings/subtemplateTitle"/> <xsl:text> </xsl:text> <input class="content" type="text" name="title" value="{geonet:info/title}"/> - + <input class="content" type="checkbox" name="template"> <xsl:if test="geonet:info/isTemplate='y'"> <xsl:attribute name="checked"/> @@ -338,18 +355,18 @@ <xsl:value-of select="/root/gui/strings/template"/> </input> --> - + </xsl:template> - <!-- - Div element to be use to select remote resources via XLink. + <!-- + Div element to be use to select remote resources via XLink. See scripts/ed.js for javascript behaviour. --> <xsl:template name="xlinkSelector"> <xsl:param name="locales"/> - + <div id="popXLink" name="popXLink" class="pop" style="display:none;"> <fieldset> <legend><xsl:value-of select="/root/gui/strings/xlink"/> <a onclick="$('popXLink').style.display = 'none';">[X]</a></legend> @@ -366,9 +383,9 @@ <input type="hidden" id="href" name="href" value=""/> <input type="text" id="xlink.s" value=""/> </form> - - <!-- Codelist for contact role. CI_ResponsibleParty as to defined the role - of the contact element. + + <!-- Codelist for contact role. CI_ResponsibleParty as to defined the role + of the contact element. FIXME : in iso19139.che, role could be multiple. --> <select name="contact.role" id="contact.role" onChange="contactSetRole(this.options[this.selectedIndex].value);" style="display:none;"> @@ -379,7 +396,7 @@ </option> </xsl:for-each> </select> - + <select name="extent.resolution" id="extent.resolution" onChange="extentSetFormat(this.options[this.selectedIndex].value);" style="display:none;"> <option value="gmd_polygon">Polygon</option> <option value="gmd_bbox">BBox</option> @@ -396,28 +413,30 @@ <!-- Div to display autocompletion list of elements. --> <div id='xll' class="keywordList" ></div> - + <script language="JavaScript1.2" type="text/javascript"> function submitXLink() { - + if ($('href').value == '') { alert("No XLink."); // FIXME i18n return; } - $('fXlink').submit(); + $('fXlink').submit(); } - + </script> - + <button onClick="submitXLink();"><xsl:value-of select="/root/gui/strings/add"/></button> + + <div id="extent.map"></div> </fieldset> </div> </xsl:template> - - <!-- + + <!-- Div element to be use to select remote parent metadata record. See scripts/ed.js for javascript behaviour. - --> + --> <xsl:template name="catSearcher"> <xsl:param name="category"/> <div id="popSearcher" name="popSearcher" class="pop" style="display:none;"> @@ -426,11 +445,11 @@ <a href="#" onclick="$('popSearcher').style.display = 'none';">[X]</a> </legend> <xsl:value-of select="/root/gui/strings/searchText"/><input type="text" id="any" name="any"/> - <a href="javascript:GNSearcher.search();">Go</a> + <a href="javascript:GNSearcher.search();">Go</a> <div id="catResults" name="catResults"></div> </fieldset> </div> </xsl:template> - + </xsl:stylesheet> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |