Revision 4076
Added by berkley over 16 years ago
lib/style/skins/sms/util.js | ||
---|---|---|
88 | 88 |
//make sure the user is logged in. |
89 | 89 |
function checkLogin() |
90 | 90 |
{ |
91 |
var currentTab = getCookie("sms-current-tab"); |
|
92 |
|
|
91 | 93 |
if(getCookie("sms-login") == "true") |
92 | 94 |
{ |
93 | 95 |
setLoginHeader(true); |
94 | 96 |
showDatasets(); |
95 |
showSearchPane(); |
|
97 |
if(currentTab == null || currentTab == 'search') |
|
98 |
{ |
|
99 |
showSearchPane(); |
|
100 |
} |
|
101 |
else |
|
102 |
{ |
|
103 |
if(currentTab == 'browse') |
|
104 |
{ |
|
105 |
showBrowsePane(); |
|
106 |
} |
|
107 |
else if(currentTab == 'upload') |
|
108 |
{ |
|
109 |
showUploadPane(); |
|
110 |
} |
|
111 |
} |
|
96 | 112 |
} |
97 | 113 |
else |
98 | 114 |
{ |
... | ... | |
107 | 123 |
var url = '/sms/metacat?action=query&anyfield=' + searchval + '&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=0'; |
108 | 124 |
setCookie("sms-searchval", searchval); |
109 | 125 |
setCookie("sms-pagestart", 0); |
110 |
reloadSearchContent(url,'#innersearchresultdiv'); |
|
111 |
setCookie('sms-pagestart', 0); |
|
126 |
reloadSearchContent(url); |
|
112 | 127 |
} |
113 | 128 |
|
114 | 129 |
//show all of the datasets in metacat |
... | ... | |
119 | 134 |
{ |
120 | 135 |
searchval = '%25'; |
121 | 136 |
} |
122 |
var page = getCookie('sms-pagestart'); |
|
137 |
var currentTab = getCookie('sms-current-tab'); |
|
138 |
var page; |
|
139 |
if(currentTab == null) |
|
140 |
{ |
|
141 |
page = 0; |
|
142 |
} |
|
143 |
else if(currentTab == 'search' || currentTab == 'upload') |
|
144 |
{ |
|
145 |
page = getCookie('sms-search-pagestart'); |
|
146 |
} |
|
147 |
else |
|
148 |
{ |
|
149 |
page = getCookie('sms-browse-pagestart'); |
|
150 |
setCookie('sms-browse-content-loaded', 'true'); |
|
151 |
searchval = '%25'; |
|
152 |
} |
|
153 |
|
|
123 | 154 |
if(page) |
124 | 155 |
{ |
125 |
reloadSearchContent('/sms/metacat?action=query&anyfield=' + searchval + '&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=' + page, '#searchresultdiv');
|
|
156 |
reloadSearchContent('/sms/metacat?action=query&anyfield=' + searchval + '&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=' + page); |
|
126 | 157 |
} |
127 | 158 |
else |
128 | 159 |
{ |
129 |
reloadSearchContent('/sms/metacat?action=query&anyfield=' + searchval + '&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=0', '#searchresultdiv');
|
|
160 |
reloadSearchContent('/sms/metacat?action=query&anyfield=' + searchval + '&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=0'); |
|
130 | 161 |
} |
131 | 162 |
} |
132 | 163 |
|
133 | 164 |
//reload the search result table |
134 |
function reloadSearchContent(url, div)
|
|
165 |
function reloadSearchContent(url) |
|
135 | 166 |
{ |
167 |
var table; |
|
168 |
var div; |
|
136 | 169 |
var page = url.substring(url.indexOf('pagestart=') + 10, url.length); |
137 |
setCookie("sms-pagestart", page); |
|
138 |
$("#searchresulttable").load(url); |
|
170 |
var currentTab = getCookie('sms-current-tab'); |
|
171 |
if(currentTab == null || currentTab == 'search' || currentTab == 'upload') |
|
172 |
{ |
|
173 |
table = '#searchresulttable'; |
|
174 |
div = '#searchresultdiv' |
|
175 |
setCookie("sms-search-pagestart", page); |
|
176 |
} |
|
177 |
else if(currentTab == 'browse') |
|
178 |
{ |
|
179 |
table = '#browseresulttable'; |
|
180 |
div = '#browseresultdiv' |
|
181 |
setCookie("sms-browse-pagestart", page); |
|
182 |
} |
|
183 |
|
|
184 |
$(table).load(url); |
|
139 | 185 |
} |
140 | 186 |
|
141 | 187 |
//upload a file to metacat |
... | ... | |
275 | 321 |
//show the search tab |
276 | 322 |
function showSearchPane() |
277 | 323 |
{ |
324 |
setCookie('sms-current-tab', 'search'); |
|
278 | 325 |
//hide all, then slide down the search pane |
279 | 326 |
$('#uploaddiv').fadeOut("slow"); |
280 |
$('#searchresultdiv').fadeOut("slow");
|
|
327 |
$('#browseresultdiv').fadeOut("slow");
|
|
281 | 328 |
$('#searchdiv').fadeIn("slow"); |
282 | 329 |
switchTabs('search'); |
283 | 330 |
} |
... | ... | |
285 | 332 |
//show the upload tab |
286 | 333 |
function showUploadPane() |
287 | 334 |
{ |
335 |
setCookie('sms-current-tab', 'upload'); |
|
288 | 336 |
//hide all, then slide down the upload pane |
289 | 337 |
$('#searchdiv').fadeOut("slow"); |
290 |
$('#searchresultdiv').fadeOut("slow");
|
|
338 |
$('#browseresultdiv').fadeOut("slow");
|
|
291 | 339 |
$('#uploaddiv').fadeIn("slow"); |
292 | 340 |
$('#uploadetabimg').hide(); |
293 | 341 |
$('#uploadtabimgsel').show(); |
... | ... | |
297 | 345 |
//show the browse tab |
298 | 346 |
function showBrowsePane() |
299 | 347 |
{ |
348 |
setCookie('sms-current-tab', 'browse'); |
|
349 |
var contentLoaded = getCookie('sms-browse-content-loaded'); |
|
350 |
if(!contentLoaded) |
|
351 |
{ |
|
352 |
reloadSearchContent('/sms/metacat?action=query&anyfield=%25&returnfield=dataset/title&qformat=sms&pagesize=10&pagestart=0'); |
|
353 |
} |
|
300 | 354 |
//hide all, then slide down the browse pane |
301 | 355 |
$('#searchdiv').fadeOut("slow"); |
302 | 356 |
$('#uploaddiv').fadeOut("slow"); |
303 |
$('#searchresultdiv').fadeIn("slow");
|
|
357 |
$('#browseresultdiv').fadeIn("slow");
|
|
304 | 358 |
$('#browsetabimg').hide(); |
305 | 359 |
$('#browsetabimgsel').show(); |
306 | 360 |
switchTabs('browse'); |
lib/style/skins/sms/resultset.xsl | ||
---|---|---|
30 | 30 |
<xsl:otherwise> |
31 | 31 |
<a> |
32 | 32 |
<xsl:attribute name="href"> |
33 |
javascript:reloadSearchContent('/sms/metacat?action=query&anyfield=<xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>&qformat=sms&returnfield=dataset/title&pagesize=10&pagestart=<xsl:value-of select="//previouspage"/>'); |
|
33 |
<xsl:if test="/resultset/query/pathquery/querygroup/queryterm/value!='%'"> |
|
34 |
javascript:reloadSearchContent('/sms/metacat?action=query&anyfield=<xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>&qformat=sms&returnfield=dataset/title&pagesize=10&pagestart=<xsl:value-of select="//previouspage"/>'); |
|
35 |
</xsl:if> |
|
36 |
<xsl:if test="/resultset/query/pathquery/querygroup/queryterm/value='%'"> |
|
37 |
javascript:reloadSearchContent('/sms/metacat?action=query&anyfield=<xsl:value-of select="'%25'"/><xsl:value-of select="'25'"/>&qformat=sms&returnfield=dataset/title&pagesize=10&pagestart=<xsl:value-of select="//previouspage"/>'); |
|
38 |
</xsl:if> |
|
34 | 39 |
</xsl:attribute> |
35 | 40 |
← previous |
36 | 41 |
</a> |
... | ... | |
47 | 52 |
<xsl:otherwise> |
48 | 53 |
<a> |
49 | 54 |
<xsl:attribute name="href"> |
50 |
javascript:reloadSearchContent('/sms/metacat?action=query&anyfield=<xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>&qformat=sms&returnfield=dataset/title&pagesize=10&pagestart=<xsl:value-of select="//nextpage"/>'); |
|
55 |
<xsl:choose> |
|
56 |
<xsl:when test="/resultset/query/pathquery/querygroup/queryterm/value!='%'"> |
|
57 |
javascript:reloadSearchContent('/sms/metacat?action=query&anyfield=<xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>&qformat=sms&returnfield=dataset/title&pagesize=10&pagestart=<xsl:value-of select="//nextpage"/>'); |
|
58 |
</xsl:when> |
|
59 |
<xsl:when test="/resultset/query/pathquery/querygroup/queryterm/value='%'"> |
|
60 |
javascript:reloadSearchContent('/sms/metacat?action=query&anyfield=<xsl:value-of select="'%25'"/><xsl:value-of select="'25'"/>&qformat=sms&returnfield=dataset/title&pagesize=10&pagestart=<xsl:value-of select="//nextpage"/>'); |
|
61 |
</xsl:when> |
|
62 |
</xsl:choose> |
|
63 |
|
|
51 | 64 |
</xsl:attribute> |
52 | 65 |
next → |
53 | 66 |
</a> |
lib/style/skins/sms/index.jsp | ||
---|---|---|
72 | 72 |
</form> |
73 | 73 |
</div> |
74 | 74 |
|
75 |
<div id="innersearchresultdiv" style="position: relative; left: 3px; padding: 10px; width: 595px; ">
|
|
75 |
<div id="searchresultdiv" style="position: relative; left: 3px; padding: 10px; width: 595px; "> |
|
76 | 76 |
<div id="searchresulttable"> |
77 | 77 |
<!--this is filled in via an AJAX call. see search()--> |
78 | 78 |
</div> |
... | ... | |
110 | 110 |
</tr> |
111 | 111 |
</table> |
112 | 112 |
</form> |
113 |
<div id="uploadstatus" style="font-size: 70%; width:312px">
|
|
113 |
<div id="uploadstatus" style="width:312px"> |
|
114 | 114 |
<% |
115 | 115 |
if(status != null && status.equals("success")) |
116 | 116 |
{ |
... | ... | |
118 | 118 |
+ "&action=read&qformat=sms\">" + docid + "</a>. " + |
119 | 119 |
"<a href=\"javascript:makepublic('" + docid + "')\">Click here</a> to make this document publicly readable."); |
120 | 120 |
} |
121 |
else if(status == null) |
|
122 |
{ |
|
123 |
//do nothing |
|
124 |
} |
|
121 | 125 |
else |
122 | 126 |
{ |
123 | 127 |
out.print("Sorry, your file upload failed. Try logging in again."); |
... | ... | |
128 | 132 |
</div> |
129 | 133 |
</div> |
130 | 134 |
|
131 |
<!--search result panel-->
|
|
132 |
<div id="searchresultdiv" style="position: relative; left: 3px; border: 1px solid ; padding: 10px; width: 595px; ">
|
|
133 |
<div id="searchresulttable">
|
|
135 |
<!--browse panel-->
|
|
136 |
<div id="browseresultdiv" style="position: relative; left: 3px; border: 1px solid ; padding: 10px; width: 595px; ">
|
|
137 |
<div id="browseresulttable">
|
|
134 | 138 |
<!--this is filled in via an AJAX call. see showDatasets()--> |
135 | 139 |
</div> |
136 | 140 |
</div> |
Also available in: Unified diff
more improvements to the UI