Project

General

Profile

metacat / lib / style / skins / first / first-resultset.xsl @ 3510

1
<?xml version="1.0"?>
2
<!--
3
*  '$RCSfile$'
4
*      Authors: Matt Jones, CHad Berkley
5
*    Copyright: 2000 Regents of the University of California and the
6
*               National Center for Ecological Analysis and Synthesis
7
*  For Details: http://www.nceas.ucsb.edu/
8
*
9
*   '$Author: leinfelder $'
10
*     '$Date: 2007-10-09 18:15:39 -0700 (Tue, 09 Oct 2007) $'
11
* '$Revision: 3510 $'
12
*
13
* This program is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 2 of the License, or
16
* (at your option) any later version.
17
*
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
* GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with this program; if not, write to the Free Software
25
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
*
27
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
* convert an XML file showing the resultset of a query
29
* into an HTML format suitable for rendering with modern web browsers.
30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32

    
33
  <xsl:output method="html"/>
34
  <xsl:param name="sessid"/>
35
  <xsl:param name="qformat">default</xsl:param>
36
  <xsl:param name="enableediting">false</xsl:param>
37
  <xsl:template match="/">
38
   <html>
39
      <head>
40
      	<title>Search Results</title>
41
        <link rel="stylesheet" type="text/css" 
42
              href="/knb/style/skins/{$qformat}/{$qformat}.css" />
43
        <script language="Javascript" type="text/JavaScript"
44
                src="/knb/style/skins/{$qformat}/{$qformat}.js" />
45
        <script language="Javascript" type="text/JavaScript"
46
                src="/knb/style/common/branding.js" />
47
        <script language="JavaScript">
48
          <![CDATA[
49
          function submitform(action,form_ref) {
50
              form_ref.action.value=action;
51
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
52
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
53
              form_ref.submit();
54
          }
55

    
56
          ]]>
57
        </script>
58
      </head>
59

    
60
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
61
      <script language="JavaScript">
62
          insertTemplateOpening();
63
          insertSearchBox();
64
      </script>
65
        <table width="100%" align="center" border="0" cellpadding="5" cellspacing="0">
66
           <tr>
67
             <td align="left"><br></br><p class="emphasis"><xsl:number value="count(resultset/document)" /> records found</p></td>
68
           </tr></table>
69
<!-- This tests to see if there are returned documents,
70
            if there are not then don't show the query results -->
71

    
72
      <xsl:if test="count(resultset/document) &gt; 0">
73

    
74
         <table width="95%" align="center" border="0" cellpadding="0" cellspacing="0">
75
           <tr>
76
             <th class="tablehead" style="text-align: left">Course Title</th>
77
             <th class="tablehead" style="text-align: left">Assessment Title</th>
78
             <th width="15%" class="tablehead" style="text-align: left">Instructor[s]</th>
79
             <th width="15%" class="tablehead" style="text-align: left">Organization[s]</th>
80
             <th width="15%" class="tablehead" style="text-align: left">Keywords</th>
81
             <xsl:if test="$enableediting = 'true'">
82
               <th width="10%" class="tablehead" style="text-align: middle">Actions</th>
83
             </xsl:if>
84
           </tr>
85

    
86
         <xsl:for-each select="resultset/document">
87
           <xsl:sort select="./param[@name='dataset/title']"/>
88
           <tr valign="top" class="subpanel">
89
             <xsl:attribute name="class">
90
               <xsl:choose>
91
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
92
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
93
               </xsl:choose>
94
             </xsl:attribute>
95

    
96
             <td class="text_plain">
97
               <form action="/knb/metacat" method="POST">
98
                 <xsl:attribute name="name">
99
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
100
                 </xsl:attribute>
101

    
102
                 <input type="hidden" name="qformat" />
103
                 <input type="hidden" name="sessionid" />
104
                 <xsl:if test="$enableediting = 'true'">
105
	 	           <input type="hidden" name="enableediting" value="{$enableediting}"/>
106
                 </xsl:if>
107
                 <input type="hidden" name="action" value="read"/>
108
                 <input type="hidden" name="docid">
109
                   <xsl:attribute name="value">
110
                     <xsl:value-of select="./docid"/>
111
                   </xsl:attribute>
112
                 </input>
113
                 <xsl:for-each select="./relation">
114
                   <input type="hidden" name="docid">
115
                     <xsl:attribute name="value" >
116
                       <xsl:value-of select="./relationdoc" />
117
                     </xsl:attribute>
118
                   </input>
119
                 </xsl:for-each>
120

    
121
                 <a>
122
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')"/>)</xsl:attribute>
123
                   <xsl:text>&#187;&#160;</xsl:text>
124
                   <xsl:choose>
125
                     <xsl:when test="./param[@name='dataset/title']!=''">
126
                        <xsl:value-of select="./param[@name='dataset/title']"/>
127
                     </xsl:when>
128
                     <xsl:otherwise>			
129
                       <xsl:value-of select="./param[@name='lom/general/title/string']"/>
130
                       <xsl:value-of select="./param[@name='lom/general/description/string']"/>
131
                     </xsl:otherwise>
132
                   </xsl:choose>
133
                 </a><br />
134
                 <br/>
135
                 <p><pre>ID: <xsl:value-of select="./docid"/></pre></p>
136

    
137
               </form>
138
             </td>
139

    
140
	     <td class="text_plain">
141
               <xsl:for-each select="./param[@name='assessment/@title']" >
142
                 <xsl:value-of select="." />
143
                 <br/>
144
                </xsl:for-each>
145
             </td>
146
             <td class="text_plain">
147
               <xsl:for-each select="./param[@name='individualName/surName']" >
148
                 <xsl:value-of select="." />
149
                 <br/>
150
                </xsl:for-each>
151
             </td>
152
             <td class="text_plain">
153
             	<xsl:for-each select="./param[@name='organizationName']" >
154
					<xsl:value-of select="." />
155
					<br/>
156
				</xsl:for-each>	
157
             </td>
158

    
159
             <td class="text_plain">
160
               <xsl:for-each
161
                select="./param[@name='keyword']">
162
                 <xsl:value-of select="." />
163
                 <br/>
164
               </xsl:for-each>
165
               <xsl:for-each
166
                select="./param[@name='lom/general/keyword/string']">
167
                 <xsl:value-of select="." />
168
                 <br/>
169
               </xsl:for-each>
170

    
171
             </td>
172
	   
173
             <xsl:if test="$enableediting = 'true'">
174
               <td class="text_plain">
175
	       <form action="/knb/metacat" method="POST">
176
	               <input type="hidden" name="action" value="read"/>
177
	 	       <input type="hidden" name="qformat" value="{$qformat}"/>
178
				<input type="hidden" name="sessionid"  value="{$sessid}"/>
179
                       <input type="hidden" name="docid">
180
                       <xsl:attribute name="value">
181
                          <xsl:value-of select="./docid"/>
182
                       </xsl:attribute>
183
                       </input>
184
                       <center>
185
		       <input type="SUBMIT"  value=" View " name="View">
186
 	               </input>
187
	               </center>
188
	             </form>
189
                 <form action="@cgi-prefix@/cgi-bin/register-dataset.cgi" 
190
                       method="POST">
191
	               <input type="hidden" name="stage" value="modify"/>	
192
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
193
					<input type="hidden" name="sessionid"  value="{$sessid}"/>
194
                   <input type="hidden" name="docid">
195
                     <xsl:attribute name="value">
196
                       <xsl:value-of select="./docid"/>
197
                     </xsl:attribute>
198
                   </input>
199
                   <center>
200
		             <input type="SUBMIT"  value=" Edit " name="Edit">
201
 	                 </input>
202
	               </center>
203
	             </form>
204
                 <form action="@cgi-prefix@/cgi-bin/register-dataset.cgi" 
205
                       method="POST">
206
	               <input type="hidden" name="stage" value="delete"/>	
207
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
208
					<input type="hidden" name="sessionid"  value="{$sessid}"/>
209
                   <input type="hidden" name="docid">
210
                     <xsl:attribute name="value">
211
                       <xsl:value-of select="./docid"/>
212
                     </xsl:attribute>
213
                   </input>
214
                   <center>
215
		             <input type="SUBMIT"  value="Delete" name="Delete">
216
 	                 </input>
217
	               </center>
218
	             </form>
219
	           </td>	  
220
             </xsl:if>
221
             </tr>
222
             <tr class="searchresultsdivider">
223
             	<td colspan="5"><img src="/knb/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></td>
224
             </tr>
225

    
226
          </xsl:for-each>
227
          </table>
228

    
229
       </xsl:if>
230
      <script language="JavaScript">
231
          insertTemplateClosing();
232
      </script>
233
    </body>
234
    </html>
235
    </xsl:template>
236

    
237
</xsl:stylesheet>