Project

General

Profile

« Previous | Next » 

Revision 505

Added by Matt Jones about 24 years ago

Began work on new UI for the KNB web site. It will be the main query
interface from the KNB website.

View differences:

lib/style/resultset.xsl
2 2
<!--
3 3
  * resultset.xsl
4 4
  *
5
  *      Authors: Matt Jones
5
  *      Authors: Matt Jones, Chad Berkley
6 6
  *    Copyright: 2000 Regents of the University of California and the 
7 7
  *               National Center for Ecological Analysis and Synthesis
8 8
  *  For Details: http://www.nceas.ucsb.edu/
9
  *      Created: 2000 April 5
10
  *    File Info: '$Id$'
9
  *      Created: 2000 July 20
10
  *    File Info: '$Id$' 
11 11
  *
12 12
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
13 13
  * convert an XML file showing the resultset of a query
14 14
  * into an HTML format suitable for rendering with modern web browsers.
15 15
-->
16 16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
17

  
18 17
  <xsl:output method="html"/>
19

  
20 18
  <xsl:template match="/">
21 19
    <html>
22 20
      <head>
23
	<link rel="stylesheet" type="text/css" href="@html-path@/style/rowcol.css" />
21
        <link rel="stylesheet" type="text/css" 
22
              href="@html-path@/style/rowcol.css" />
23
        <script language="JavaScript">
24
          <![CDATA[
25
          function submitform(current_action,form_ref) {
26
              form_ref.action.value=current_action;
27
              form_ref.submit();
28
          }
29
          ]]>
30
        </script>
24 31
      </head>
25
      <body class="emlbody">
26
	<center>
27
          <b>Query Results</b>
28
          for query <xsl:value-of select="resultset/query"/>
29
        </center>
32

  
33
      <body>
34
        <table width="100%">
35
         <tr>
36
          <td align="right" valign="top">
37
            <form action="@html-path@/servlet/metacat" method="POST">
38
             Data Search: <input type="text" name="anyfield" size="10" />
39
             <input type="hidden" name="action" value="query" />   
40
             <input type="hidden" name="qformat" value="html" />
41
             <input type="hidden" name="operator" value="UNION" />
42
            
43
             <input type="hidden" name="returnfield" 
44
              value="resource/dataset/originator/individualName/surName" />
45
             <input type="hidden" name="returnfield" 
46
              value="resource/dataset/originator/individualName/givenName" />
47
             <input type="hidden" name="returnfield" 
48
              value="resource/dataset/originator/organizationName" />
49
             <input type="hidden" name="returnfield" 
50
              value="resource/dataset/title" />
51
             <input type="hidden" name="returnfield" 
52
              value="eml-dataset/title" />
53
             <input type="hidden" name="returnfield" 
54
              value="resource/dataset/keywordInfo/keyword" />
55
             <input type="hidden" name="returndoc"
56
              value="-//NCEAS//resource//EN" />
57
             <input type="hidden" name="returndoc"
58
              value="-//NCEAS//eml-dataset//EN" />
59
           </form>
60
          </td>
61
        </tr>  
62
       </table>
30 63
        
31
        <form action="@servlet-path@" method="POST">
32
        <input type="hidden" name="action" value="getdocument"/>
64
       <p><xsl:number value="count(resultset/document)" /> documents found.</p>
65
       <!-- This tests to see if there are returned documents,
66
            if there are not then don't show the query results -->
67
       <xsl:if test="count(resultset/document) &gt; 0">
68
         <center>
69
           <u><h2>Results</h2></u>
70
         </center>
71
          
72
         <table width="100%">
73
           <tr>
74
             <th class="sectionhead">Title</th>
75
             <th class="sectionhead">Action</th>
76
             <th class="sectionhead">Related Documents</th>
77
             <th class="sectionhead">Contacts</th>
78
             <th class="sectionhead">Organization</th>
79
             <th class="sectionhead">Keywords</th>
80
           </tr>
81
        
82
         <xsl:for-each select="resultset/document">
83
           <xsl:sort select="doctitle"/>
84
           <tr valign="top">
85
             <xsl:attribute name="class">
86
               <xsl:choose>
87
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
88
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
89
               </xsl:choose>
90
             </xsl:attribute>
33 91

  
34
        <xsl:text>Output Format: </xsl:text>
35
        <select name="qformat">
36
          <option value="html">HTML</option>
37
          <option value="xml">XML</option>
38
        </select>
92
             <td>
93
               <xsl:value-of select="./param[@name='resource/dataset/title']"/>
94
               <xsl:value-of select="./param[@name='eml-dataset/title']"/>
95
               <br/>
96
               <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
97
             </td>
98
             <td>
99
               <form action="@html-path@/servlet/marine" method="POST">
100
                 <xsl:attribute name="name">
101
                   <xsl:value-of select="translate(./docid,':','')"/>
102
                 </xsl:attribute>
103
                 <!-- abstractpath tells the servlet where the abstract is in 
104
                      the document.  The % sign is used because the path could 
105
                      be resource/literature or resource/dataset. -->
106
                 <input type="hidden" name="abstractpath" 
107
                        value="resource/%/abstract" />
108
                 <input type="hidden" name="action" value="getdocument"/>
109
                 <input type="hidden" name="docid">
110
                   <xsl:attribute name="value">
111
                     <xsl:value-of select="./docid"/>
112
                   </xsl:attribute>
113
                 </input>
114
                 <xsl:for-each select="./relation">
115
                   <input type="hidden" name="relation">
116
                     <xsl:attribute name="value" >
117
                       <xsl:value-of select="./relationdoc" />
118
                     </xsl:attribute>
119
                   </input>
120
                 </xsl:for-each>
39 121

  
40
        <table width="100%">
41
        <tr class="highlight">
42
        <th>&nbsp;</th>
43
        <th><xsl:text>Title</xsl:text></th>
44
        <th><xsl:text>Document</xsl:text></th>
45
        <th><xsl:text>Document Type</xsl:text></th>
46
        </tr>
122
                 <a>
123
                   <xsl:attribute name="href">javascript:submitform('getdocument',document.<xsl:value-of select="translate(./docid, ':', '')"/>)</xsl:attribute>
124
                   Dataset Information
125
                 </a><br />
126
                 <a>
127
                   <xsl:attribute name="href">javascript:submitform('getabstract',document.<xsl:value-of select="translate(./docid,':','')"/>)</xsl:attribute>
128
                   View Abstract
129
                 </a><br />
130
                 <a>
131
                   <xsl:attribute name="href">javascript:submitform('getdatadoc',document.<xsl:value-of select="translate(./docid,':','')"/>)</xsl:attribute>
132
                    Download Data and Metadata
133
                 </a><br />
134
               </form>
135
             </td>
136
             <td>
137
               <xsl:if test="count(./relation) &gt; 0">
138
                 <xsl:for-each select="./relation">
139
                   <a>
140
                     <xsl:if test="starts-with(./relationdoc, 'http')">
141
                       <xsl:attribute name="href">
142
                         <xsl:value-of select="./relationdoc" />
143
                       </xsl:attribute>
144
                       <xsl:if 
145
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
146
                         Variable Information
147
                       </xsl:if>
148
                       <xsl:if 
149
                        test="./relationdoctype = '-//NCEAS//eml-file//EN'">
150
                         File Information
151
                       </xsl:if>
152
                       <xsl:if 
153
                        test="./relationdoctype = '-//NCEAS//eml-access//EN'">
154
                         Access Information
155
                       </xsl:if>
156
                       <xsl:if 
157
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
158
                         Context Information
159
                       </xsl:if>
160
                       <xsl:if 
161
                        test="./relationdoctype = '-//NCEAS//eml-software//EN'">
162
                         Software Information
163
                       </xsl:if>
164
                       <xsl:if 
165
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
166
                         Status Information
167
                       </xsl:if>
168
                       <xsl:if 
169
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
170
                         Supplemental Information
171
                       </xsl:if>
172
                       <!-- If the doctype is null, this file is assumed to 
173
                            be a data file
174
                        -->
175
                       <xsl:if test="./relationdoctype = 'null'">
176
                         Data File
177
                       </xsl:if>
178
                     </xsl:if>
179
                     <xsl:if test="starts-with(./relationdoc, 'metacat')">
180
                       <xsl:attribute name="href">
181
                         <xsl:text>http://dev.nceas.ucsb.edu@html-path@/servlet/marine/?action=getrelateddocument&amp;qformat=html&amp;url=</xsl:text>
182
                         <xsl:value-of select="./relationdoc" />
183
                       </xsl:attribute>
184
                       <xsl:if 
185
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
186
                         Variable Information
187
                       </xsl:if>
188
                       <xsl:if 
189
                        test="./relationdoctype = '-//NCEAS//eml-file//EN'">
190
                         File Information
191
                       </xsl:if>
192
                       <xsl:if 
193
                        test="./relationdoctype = '-//NCEAS//eml-access//EN'">
194
                         Access Information
195
                       </xsl:if>
196
                       <xsl:if 
197
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
198
                         Context Information
199
                       </xsl:if>
200
                       <xsl:if 
201
                        test="./relationdoctype = '-//NCEAS//eml-software//EN'">
202
                         Software Information
203
                       </xsl:if>
204
                       <xsl:if 
205
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
206
                         Status Information
207
                       </xsl:if>
208
                       <xsl:if 
209
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
210
                         Supplemental Information
211
                       </xsl:if>
212
                       <!-- If the doctype is null, this file is assumed to 
213
                            be a data file
214
                        -->
215
                       <xsl:if test="./relationdoctype = 'null'">
216
                         Data File
217
                       </xsl:if>
218
                     </xsl:if>
219
                   </a>
220
                   <br/>
221
                 </xsl:for-each>  
222
               </xsl:if>
223
             </td>
224
             <td>
225
               <xsl:for-each select="./param[@name='resource/dataset/originator/individualName/surName']" >  
226
                 <xsl:value-of select="." />
227
                 <br/>
47 228

  
48
        <xsl:for-each select="resultset/document">
49
          <tr valign="top">
50
            <xsl:attribute name="class">
51
              <xsl:choose>
52
                <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
53
                <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
54
              </xsl:choose>
55
            </xsl:attribute>
229
               </xsl:for-each>
230
               <xsl:text>&nbsp;</xsl:text>
231
             </td>
232
             <td>
233
                 <xsl:value-of select=
234
                 "./param[@name='resource/dataset/originator/organizationName']"                 />
235
                 <xsl:text>&nbsp;</xsl:text>
236
             </td>
237
  
238
             <td>
239
               <xsl:for-each
240
                select="./param[@name='resource/dataset/keywordInfo/keyword']">
241
                 <xsl:value-of select="." />
242
                 <br/>
243
               </xsl:for-each>
244
               <xsl:text>&nbsp;</xsl:text>
245
             </td>
246
           </tr>
56 247

  
57
          <td>
58
<!--
59
              <input type="radio" name="docid">
60
                <xsl:attribute name="value">
61
                  <xsl:value-of select="./docid"/>
62
                </xsl:attribute>
63
              </input>
64
              <input type="submit" value="Display"/>
65
-->
66
              <input border="0" type="image">
67
                <xsl:attribute name="src">
68
                  <xsl:choose>
69
                    <xsl:when test="position() 
70
                         mod 2 = 1">@html-path@/bttns-white.png</xsl:when>
71
                    <xsl:when test="position() 
72
                         mod 2 = 0">@html-path@/bttns-blue.jpg</xsl:when>
73
                  </xsl:choose>
74
                </xsl:attribute>
75
                <xsl:attribute name="name">
76
                  <xsl:value-of select="./docid"/>
77
                </xsl:attribute>
78
              </input>
79
          </td>
80
          <td><xsl:value-of select="./doctitle"/>
81
              <xsl:text>&nbsp;</xsl:text>
82
         </td>
83
          <td>
84
              <xsl:value-of select="./docname"/> 
85
              <xsl:text> </xsl:text>
86
              <xsl:value-of select="./docid"/>
87
              <xsl:text>&nbsp;</xsl:text>
88
          </td>
89
          <td><xsl:value-of select="./doctype"/>
90
              <xsl:text>&nbsp;</xsl:text>
91
         </td>
92
          </tr>
93
        </xsl:for-each>
94
        </table>
95
        </form>
248
          </xsl:for-each>
249
          </table>
96 250

  
251
       </xsl:if>
97 252
      </body>
98 253
    </html>
99 254
  </xsl:template>
lib/style/rowcol.css
1 1
 .page    {font-family: Tahoma, sans-serif; background-color:white}
2
 body    {font-family: Tahoma, sans-serif; background-color:white}
2 3
 .emlbody    {font-family: Tahoma, sans-serif; background-color:white}
3 4
 .rowodd  {background-color: white; color: black; vertical-align: top}
4 5
 .roweven {background-color: #C0D3E7; color: black; vertical-align: top}
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
210 210
      params.put(name,value); 
211 211
    }  
212 212
    
213
    String action = ((String[])params.get("action"))[0];  
214
    util.debugMessage("Line 213: Action is: " + action);
213 215
    //if the user clicked on the input images, decode which image
214 216
    //was clicked then set the action.
215
    String action = decodeMouseAction(params);
216
    if(action.equals("error"))
217
    {
218
      action = ((String[])params.get("action"))[0];  
219
    }
217
    //MBJELIMINATE String action = decodeMouseAction(params);
218
    //if(action.equals("error"))
219
    //{
220
     // util.debugMessage("Line 218: Action is: " + action);
221
      //action = ((String[])params.get("action"))[0];  
222
    //}
220 223
    
221 224
    // This block handles session management for the servlet
222 225
    // by looking up the current session information for all actions

Also available in: Unified diff