[GeoNetwork-devel] Extending Geonetwork using external helpers

Hi List,

I am looking to add additional functionality using external 'helpers',
for example one I have written allows people to enter keywords from the
GCMD (Global Change Master Directory) in a set format by picking these
from a set of drop down boxes.

To link the helper to Geonetwork I need to put a stub of JavaScript code
into the 'onClick' method for the keyword field. Looking at the way
Geonetwork works I guess this means altering the XSLT to insert the
JavaScript when it creates the form.

To speed things up I would appreciate any help in how to modify the
XLST, I am using the iso19115 XLST so I presume that would be my base.

Any help that points me in the right direction would be very much
appreciated. If anyone else is interested in this just contact me, I
have also written a mapping one using Google Maps.

Cheers,

Scott Bainbridge.
S.bainbridge@anonymised.com

------------------------------------------------------------------------
The information contained in this communication is for the use of the
individual or entity to whom it is addressed, and may contain
information which is the subject of legal privilege and/or copyright.
If you have received this communication in error, please notify the
sender by return E-Mail and delete the transmission, together with any
attachments, from your system. Thank you.
-------------------------------------------------------------------------

Hi Scott,
You should look into xsl/metadata.xsl, template getElementText.

Here is an example of defining a new editing options for keyword calling
another services to get a list of keyword using Ajax.

      <xsl:when test="$edit=true() and $rows=1"><!-- When
editing-->
        <xsl:choose>
          <!-- When it's a keyword in DC, FGDC
or ISO-->
          <xsl:when
test="($schema='dublin-core' and $name='dc:subject') or
  
($schema='fgdc' and $name='themekey') or
  
($schema='iso19115' and $name='keyword') or
  
($schema='iso19139' and name(..)='gmd:keyword')">
            <!-- Add the input box-->
            <input class="md"
type="text" id="_{geonet:element/@ref}" name="_{geonet:element/@ref}"
value="{text()}" size="{$cols}"/>

            <!-- Div with returned
keywords -->
            <div id='keywordList'
class="keywordList" ></div>
            
            <!-- JS calling a services
-->
            <script
type="text/javascript">
              <xsl:text>var _</xsl:text>
              <xsl:value-of
select="geonet:element/@ref"/>
              <xsl:text>_acurl =
"xml.search.keywords?pNewSearch=true&amp;pTypeSearch=1";</xsl:text>
              <xsl:text>var _</xsl:text>
              <xsl:value-of
select="geonet:element/@ref"/>
              <xsl:text>_ac = new
Ajax.Autocompleter('_</xsl:text>
              <xsl:value-of
select="geonet:element/@ref"/>
              <xsl:text>',
'keywordList',
'xml.search.keywords?pNewSearch=true&amp;pTypeSearch=1&amp;pMode=search',{me
thod:'get', paramName: 'pKeyword'});</xsl:text>

            </script>

          </xsl:when>
          <!-- If something else -->
          <xsl:otherwise>
            <input class="md"
type="text" name="_{geonet:element/@ref}" value="{text()}" size="{$cols}" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>

Demo is available here
http://dev.sandre.eaufrance.fr/gnthesaurus login admim / admin

Cheers
Francois

-----Message d'origine-----
De : geonetwork-devel-bounces@lists.sourceforge.net
[mailto:geonetwork-devel-bounces@lists.sourceforge.net] De la part de Scott
Bainbridge
Envoyé : lundi 5 mars 2007 05:36
À : geonetwork-devel@lists.sourceforge.net
Objet : [GeoNetwork-devel] Extending Geonetwork using external helpers

Hi List,

I am looking to add additional functionality using external 'helpers', for
example one I have written allows people to enter keywords from the GCMD
(Global Change Master Directory) in a set format by picking these from a set
of drop down boxes.

To link the helper to Geonetwork I need to put a stub of JavaScript code
into the 'onClick' method for the keyword field. Looking at the way
Geonetwork works I guess this means altering the XSLT to insert the
JavaScript when it creates the form.

To speed things up I would appreciate any help in how to modify the XLST, I
am using the iso19115 XLST so I presume that would be my base.

Any help that points me in the right direction would be very much
appreciated. If anyone else is interested in this just contact me, I have
also written a mapping one using Google Maps.

Cheers,

Scott Bainbridge.
S.bainbridge@anonymised.com

------------------------------------------------------------------------
The information contained in this communication is for the use of the
individual or entity to whom it is addressed, and may contain
information which is the subject of legal privilege and/or copyright.
If you have received this communication in error, please notify the
sender by return E-Mail and delete the transmission, together with any
attachments, from your system. Thank you.
-------------------------------------------------------------------------