Commit 1c54b3a6c7c09429765930302816149fe7c50965

Authored by Edmar Moretti
1 parent a7662431

--no commit message

pacotes/cswclient/csw-proxy.php
@@ -99,9 +99,16 @@ curl_setopt($session, CURLOPT_RETURNTRANSFER, true); @@ -99,9 +99,16 @@ curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
99 99
100 100
101 // Make the call 101 // Make the call
102 -$xml = curl_exec($session);  
103 - 102 +//$xml = curl_exec($session);
104 // The web service returns XML. Set the Content-Type appropriately 103 // The web service returns XML. Set the Content-Type appropriately
  104 +if(file_exists("c:/temp/csw.xml")){
  105 + $fp = fopen("c:/temp/csw.xml","r");
  106 + $xml = fread($fp,filesize("c:/temp/csw.xml"));
  107 + fclose($fp);
  108 +}
  109 +else
  110 +{$xml = curl_exec($session);}
  111 +
105 header("Content-Type: text/xml"); 112 header("Content-Type: text/xml");
106 113
107 if ($logging) { 114 if ($logging) {
pacotes/cswclient/csw.html
@@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
79 //var csw_client = new CSWClient(cswhost, host); // if not using default settings 79 //var csw_client = new CSWClient(cswhost, host); // if not using default settings
80 //var csw_client = new CSWClient("http://geonovum.nitg.tno.nl/geonetwork/srv/en/csw"); 80 //var csw_client = new CSWClient("http://geonovum.nitg.tno.nl/geonetwork/srv/en/csw");
81 var csw_client = new CSWClient("http://www.metadados.inde.gov.br/geonetwork/srv/br/csw"); 81 var csw_client = new CSWClient("http://www.metadados.inde.gov.br/geonetwork/srv/br/csw");
82 - //var csw_client = new CSWClient("http://127.0.0.1:8080/geonetwork/srv/en/csw"); 82 + //var csw_client = new CSWClient("http://localhost:8080/geonetwork/srv/en/csw");
83 csw_client.writeClient("csw-wrapper"); 83 csw_client.writeClient("csw-wrapper");
84 //csw_client.useProxy(false); // default=true 84 //csw_client.useProxy(false); // default=true
85 </script> 85 </script>
pacotes/cswclient/lib/css/cswclient.css
@@ -112,15 +112,18 @@ @@ -112,15 +112,18 @@
112 112
113 .meta-param 113 .meta-param
114 { vertical-align: top; 114 { vertical-align: top;
115 - color: #004393 115 + color: #004393;
  116 + font-size: 13px;
  117 + width:100px;
116 } 118 }
117 119
118 .meta-value 120 .meta-value
119 { vertical-align: top; 121 { vertical-align: top;
  122 + font-size:13px;
120 } 123 }
121 124
122 h3 { 125 h3 {
123 - font-size: 1.1em; 126 + font-size: 13px;
124 color: #21507B; 127 color: #21507B;
125 margin-top: 0.6em; 128 margin-top: 0.6em;
126 } 129 }
pacotes/cswclient/lib/scripts/cswclient.js
@@ -234,7 +234,8 @@ CSWClient.prototype.clearPage = function() @@ -234,7 +234,8 @@ CSWClient.prototype.clearPage = function()
234 234
235 CSWClient.prototype.overlayDiv = function(div) 235 CSWClient.prototype.overlayDiv = function(div)
236 { 236 {
237 - while (div.tagName !="DIV") { 237 + div = document.getElementById("popup2");
  238 + while (div.tagName !="DIV") {
238 div = div.parentNode 239 div = div.parentNode
239 } 240 }
240 241
@@ -300,7 +301,8 @@ CSWClient.prototype.positionPopUp = function(div1, div2) @@ -300,7 +301,8 @@ CSWClient.prototype.positionPopUp = function(div1, div2)
300 301
301 CSWClient.prototype.findPosX = function(obj) 302 CSWClient.prototype.findPosX = function(obj)
302 { 303 {
303 - var curleft = 0; 304 + return 0;
  305 + var curleft = 0;
304 if(obj.offsetParent) 306 if(obj.offsetParent)
305 while(1) { 307 while(1) {
306 curleft += obj.offsetLeft; 308 curleft += obj.offsetLeft;
@@ -315,7 +317,8 @@ CSWClient.prototype.findPosX = function(obj) @@ -315,7 +317,8 @@ CSWClient.prototype.findPosX = function(obj)
315 317
316 CSWClient.prototype.findPosY = function(obj) 318 CSWClient.prototype.findPosY = function(obj)
317 { 319 {
318 - var curtop = 0; 320 + return 0;
  321 + var curtop = 0;
319 if(obj.offsetParent) 322 if(obj.offsetParent)
320 while(1) { 323 while(1) {
321 curtop += obj.offsetTop; 324 curtop += obj.offsetTop;
pacotes/cswclient/lib/xml/csw-hosts.xml
@@ -4,5 +4,6 @@ @@ -4,5 +4,6 @@
4 <option value="http://www.geodata.alterra.nl/excat/csw">eXcat@alterra</option> 4 <option value="http://www.geodata.alterra.nl/excat/csw">eXcat@alterra</option>
5 <option value="http://geonovum.nitg.tno.nl:8080/geonetwork/srv/en/csw">Geonovum</option> 5 <option value="http://geonovum.nitg.tno.nl:8080/geonetwork/srv/en/csw">Geonovum</option>
6 <option value="http://www.metadados.inde.gov.br/geonetwork/srv/br/csw">INDE-BR</option> 6 <option value="http://www.metadados.inde.gov.br/geonetwork/srv/br/csw">INDE-BR</option>
  7 + <option value="http://localhost:8080/geonetwork/srv/en/csw">teste</option>
7 <option value="http://mapas.mma.gov.br/geonetwork/srv/br/csw">INDE-MMA</option> 8 <option value="http://mapas.mma.gov.br/geonetwork/srv/br/csw">INDE-MMA</option>
8 </select> 9 </select>
pacotes/cswclient/lib/xsl/csw-results.xsl
1 -<?xml version="1.0"?>  
2 -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 1 +<?xml version="1.0" encoding="ISO-8859-1"?>
  2 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  3 + xmlns:gco="http://www.isotc211.org/2005/gco"
  4 + xmlns:gmd="http://www.isotc211.org/2005/gmd"
3 xmlns:dc="http://purl.org/dc/elements/1.1/" 5 xmlns:dc="http://purl.org/dc/elements/1.1/"
4 - xmlns:dct="http://purl.org/dc/terms/">  
5 -<!--xsl:output method="html" encoding="ISO-8859-1"/--> 6 + xmlns:dct="http://purl.org/dc/terms/"
  7 + xmlns:ows="http://www.opengis.net/ows"
  8 + xmlns:cat="http://www.esri.com/metadata/csw/">
  9 +
  10 +<xsl:output method="xml" encoding="ISO-8859-1"/>
  11 +
6 12
7 13
8 <xsl:variable name="pageUrl"> 14 <xsl:variable name="pageUrl">
@@ -77,64 +83,231 @@ @@ -77,64 +83,231 @@
77 </h3> 83 </h3>
78 84
79 <br/> 85 <br/>
80 - <ol>  
81 - <xsl:attribute name="start">  
82 - <xsl:value-of select="$start"/>  
83 - </xsl:attribute>  
84 - <xsl:for-each select="./*[local-name()='MD_Metadata']|./*[local-name()='identificationInfo']|./*[local-name()='MD_DataIdentification']|/*[local-name()='citation']|./*[local-name()='CI_Citation']|./*[local-name()='title']/*[local-name()='CharacterString']">  
85 - <li>  
86 - <strong><xsl:text>Title: </xsl:text></strong>  
87 - <a>  
88 - <xsl:attribute name="href">  
89 - <xsl:text>javascript:(csw_client.getRecordById</xsl:text>  
90 - <xsl:text>('</xsl:text>  
91 - <xsl:value-of select="./dc:identifier"/>  
92 - <xsl:text>'))</xsl:text>  
93 - </xsl:attribute>  
94 - <xsl:value-of select="."/> 86 +</div>
  87 + <div>
  88 + <xsl:apply-templates/>
  89 + </div>
  90 +</xsl:template>
95 91
96 - </a>  
97 - <br/>  
98 - <xsl:apply-templates select="./dct:abstract"/>  
99 - <br/>  
100 - <strong><xsl:text>Keywords: </xsl:text></strong>  
101 - <xsl:for-each select="./dc:subject">  
102 - <xsl:if test=".!=''">  
103 - <xsl:if test="position() &gt; 1">, </xsl:if>  
104 - <i><xsl:value-of select="."/></i>  
105 - </xsl:if>  
106 - </xsl:for-each>  
107 - <hr/>  
108 - </li>  
109 - </xsl:for-each>  
110 - </ol> 92 +<xsl:template match="/*[local-name()='GetRecordByIdResponse']">
  93 + <xsl:apply-templates select="cat:FullRecord"/>
  94 + <xsl:apply-templates select="*[local-name()='Record']"/>
  95 + <xsl:apply-templates select="*[local-name()='SummaryRecord']"/>
  96 + <xsl:apply-templates select="*[local-name()='BriefRecord']"/>
  97 + <xsl:apply-templates select="gmd:MD_Metadata"/>
  98 +
  99 +</xsl:template>
  100 +
  101 +<xsl:template match="cat:FullRecord">
  102 + <xsl:apply-templates select="metadata"/>
  103 +</xsl:template>
  104 +
  105 +
  106 +<!-- Start Metadata ISO19139 -->
  107 +<xsl:template match="gmd:MD_Metadata">
  108 + <!-- First the Identification block -->
  109 + <xsl:apply-templates select="./gmd:identificationInfo/gmd:MD_DataIdentification"/>
  110 + <xsl:apply-templates select="./gmd:distributionInfo/gmd:MD_Distribution"/>
  111 +
  112 + <table class="meta">
  113 + <tr>
  114 + <td class="meta-param">Mais info:</td>
  115 + <td class="meta-value">
  116 + <a>
  117 + <xsl:attribute name="href">
  118 + <xsl:text>javascript:csw_client.getRecordById</xsl:text>
  119 + <xsl:text>('</xsl:text>
  120 + <xsl:value-of select="./gmd:fileIdentifier/gco:CharacterString"/>
  121 + <xsl:text>')</xsl:text>
  122 + </xsl:attribute>
  123 + <xsl:value-of select="./gmd:fileIdentifier/gco:CharacterString"/>
  124 + </a>
  125 + </td>
  126 + </tr>
  127 + </table>
  128 +</xsl:template>
  129 +
  130 +<!-- 'Identification' block -->
  131 +<xsl:template match="gmd:MD_DataIdentification">
  132 +<div class="captioneddiv">
  133 +<!--<h3>Identification info</h3>-->
  134 +<table class="meta"><tr></tr>
  135 + <tr><td></td><td><hr></hr></td></tr>
  136 + <xsl:call-template name="tablerowBold">
  137 + <xsl:with-param name="cname" select="'Título'"/>
  138 + <xsl:with-param name="cvalue" select="./gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString"/>
  139 + </xsl:call-template>
  140 + <tr>
  141 + <td class="meta-param">Resumo:</td>
  142 + <td class="meta-value">
  143 + <xsl:apply-templates select="./gmd:abstract"/>
  144 + </td>
  145 + </tr>
  146 + <xsl:apply-templates select="./gmd:pointOfContact"/>
  147 +</table>
111 </div> 148 </div>
112 </xsl:template> 149 </xsl:template>
113 150
114 -<xsl:template match="dc:CharacterString"> 151 +<!-- 'Identification->Point of Contact' block -->
  152 +<xsl:template match="gmd:pointOfContact">
  153 + <tr>
  154 + <td class="meta-param">Organização:</td>
  155 + <td class="meta-value">
  156 + <xsl:apply-templates select="./gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString"/>
  157 + </td>
  158 + </tr>
  159 + <tr>
  160 + <td class="meta-param">e-mail:</td>
  161 + <td class="meta-value">
  162 + <xsl:apply-templates select="./gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString"/>
  163 + </td>
  164 + </tr>
  165 +
  166 +</xsl:template>
  167 +
  168 +<!-- 'Distribution Info' block -->
  169 +<xsl:template match="gmd:MD_Distribution">
  170 + <table class="meta">
  171 + <xsl:for-each select="gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource">
  172 + <xsl:choose>
  173 + <xsl:when test="starts-with(./gmd:protocol/gco:CharacterString,'WWW:DOWNLOAD-') and contains(./gmd:protocol/gco:CharacterString,'http--download') and ./gmd:name/gco:CharacterString">
  174 + <tr>
  175 + <td class="meta-param">Download:</td>
  176 + <td class="meta-value">
  177 + <a><xsl:attribute name="href">
  178 + <xsl:value-of select="gmd:linkage/gmd:URL"/>
  179 + </xsl:attribute>
  180 + <xsl:value-of select="gmd:linkage/gmd:URL"/>
  181 + </a>
  182 + </td>
  183 + </tr>
  184 + </xsl:when>
  185 + <xsl:when test="starts-with(./gmd:protocol/gco:CharacterString,'ESRI:AIMS-') and contains(./gmd:protocol/gco:CharacterString,'-get-image') and ./gmd:name/gco:CharacterString">
  186 + <tr>
  187 + <td class="meta-param">Esri ArcIms:</td>
  188 + <td class="meta-value">
  189 + <a><xsl:attribute name="href">
  190 + <xsl:value-of select="gmd:linkage/gmd:URL"/>
  191 + </xsl:attribute>
  192 + <xsl:value-of select="gmd:name/gco:CharacterString"/>
  193 + </a>
  194 + </td>
  195 + </tr>
  196 + </xsl:when>
  197 + <xsl:when test="starts-with(./gmd:protocol/gco:CharacterString,'OGC:WMS-') and contains(./gmd:protocol/gco:CharacterString,'-get-map') and ./gmd:name/gco:CharacterString">
  198 + <tr>
  199 + <td class="meta-param">OGC-WMS:</td>
  200 + <td class="meta-value">
  201 + <a><xsl:attribute name="href">
  202 + <xsl:text>javascript:void(window.open('</xsl:text>
  203 + <xsl:value-of select="gmd:linkage/gmd:URL"/>
  204 + <xsl:text>'))</xsl:text>
  205 + </xsl:attribute>
  206 + <xsl:value-of select="gmd:name/gco:CharacterString"/>
  207 + </a>
  208 + </td>
  209 + </tr>
  210 + </xsl:when>
  211 + <xsl:when test="starts-with(./gmd:protocol/gco:CharacterString,'OGC:WMS-') and contains(./gmd:protocol/gco:CharacterString,'-get-capabilities') and ./gmd:name/gco:CharacterString">
  212 + <tr>
  213 + <td class="meta-param">OGC-WMS Capabilities:</td>
  214 + <td class="meta-value">
  215 + <a><xsl:attribute name="href">
  216 + <xsl:value-of select="gmd:linkage/gmd:URL"/>
  217 + </xsl:attribute>
  218 + <xsl:value-of select="gmd:name/gco:CharacterString"/>
  219 + </a>
  220 + </td>
  221 + </tr>
  222 + </xsl:when>
  223 + <!--xsl:when test="linkage[text()]">
  224 + <link type="url"><xsl:value-of select="linkage[text()]"/></link>
  225 + </xsl:when-->
  226 + </xsl:choose>
  227 + </xsl:for-each>
  228 + </table>
  229 +</xsl:template>
  230 +
  231 +<!-- 'Identification->Abstract -->
  232 +<xsl:template match="gmd:abstract">
  233 + <xsl:apply-templates select="./gco:CharacterString/text()"/>
  234 +</xsl:template>
  235 +
  236 +
  237 +<!-- 'Identification' block -->
  238 +<xsl:template match="*[local-name()='Record']|*[local-name()='SummaryRecord']|*[local-name()='BriefRecord']">
  239 + <xsl:call-template name="tablerow">
  240 + <xsl:with-param name="cname" select="'Identifier'"/>
  241 + <xsl:with-param name="cvalue" select="./dc:identifier"/>
  242 + </xsl:call-template>
  243 +</xsl:template>
  244 +
  245 +
  246 +<xsl:template match="dct:abstract">
  247 +<!--xsl:value-of select="."/-->
  248 +<xsl:apply-templates select="text()"/>
  249 +</xsl:template>
  250 +
  251 +
  252 +<!-- Start Utills -->
  253 +<xsl:template match="text()">
  254 + <xsl:call-template name="to-para">
  255 + <xsl:with-param name="from" select="'&#10;&#10;'"/>
  256 + <xsl:with-param name="string" select="."/>
  257 + </xsl:call-template>
  258 +</xsl:template>
  259 +
  260 +<!-- replace all occurences of the character(s) `from'
  261 + by <p/> in the string `string'.-->
  262 +<xsl:template name="to-para" >
  263 + <xsl:param name="string"/>
  264 + <xsl:param name="from"/>
115 <xsl:choose> 265 <xsl:choose>
116 - <xsl:when test=".!=''">  
117 - <xsl:value-of select="."/> 266 + <xsl:when test="contains($string,$from)">
  267 + <xsl:value-of select="substring-before($string,$from)"/>
  268 + <!-- output a <p/> tag instead of `from' -->
  269 + <p/>
  270 + <xsl:call-template name="to-para">
  271 + <xsl:with-param name="string" select="substring-after($string,$from)"/>
  272 + <xsl:with-param name="from" select="$from"/>
  273 + </xsl:call-template>
118 </xsl:when> 274 </xsl:when>
119 <xsl:otherwise> 275 <xsl:otherwise>
120 - <xsl:text> x</xsl:text> 276 + <xsl:value-of select="$string"/>
121 </xsl:otherwise> 277 </xsl:otherwise>
122 </xsl:choose> 278 </xsl:choose>
123 </xsl:template> 279 </xsl:template>
124 280
125 -<xsl:template match="dct:abstract">  
126 - <strong><xsl:text>Abstract: </xsl:text></strong>  
127 - <xsl:value-of select="substring(.,1,250)"/>  
128 - <xsl:text> ...</xsl:text>  
129 - <a>  
130 - <xsl:attribute name="href">  
131 - <xsl:text>javascript:(csw_client.getRecordById</xsl:text>  
132 - <xsl:text>('</xsl:text>  
133 - <xsl:value-of select="../dc:identifier"/>  
134 - <xsl:text>'))</xsl:text>  
135 - </xsl:attribute>  
136 - <xsl:text> more</xsl:text>  
137 - </a> 281 +
  282 +<xsl:template name="tablerow" >
  283 + <xsl:param name="cname"/>
  284 + <xsl:param name="cvalue"/>
  285 + <xsl:choose>
  286 + <xsl:when test="string($cvalue)">
  287 + <tr>
  288 + <td class="meta-param"><xsl:value-of select="$cname"/><xsl:text>: </xsl:text></td>
  289 + <td class="meta-value"><xsl:value-of select="$cvalue"/></td>
  290 + </tr>
  291 + </xsl:when>
  292 + <xsl:otherwise>
  293 + </xsl:otherwise>
  294 + </xsl:choose>
  295 +</xsl:template>
  296 +
  297 +<xsl:template name="tablerowBold" >
  298 + <xsl:param name="cname"/>
  299 + <xsl:param name="cvalue"/>
  300 + <xsl:choose>
  301 + <xsl:when test="string($cvalue)">
  302 + <tr>
  303 + <td class="meta-param"><xsl:value-of select="$cname"/><xsl:text>: </xsl:text></td>
  304 + <td class="meta-value"><b><xsl:value-of select="$cvalue"/></b></td>
  305 + </tr>
  306 + </xsl:when>
  307 + <xsl:otherwise>
  308 + </xsl:otherwise>
  309 + </xsl:choose>
138 </xsl:template> 310 </xsl:template>
  311 +<!-- End Utills -->
139 312
140 </xsl:stylesheet> 313 </xsl:stylesheet>