update.jsp
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<jsp:useBean id="helpBroker" class="javax.help.ServletHelpBroker" scope="session" />
<%@ page import="java.net.URL, javax.help.HelpSet, javax.help.Map.ID" %>
<HTML>
<BODY STYLE="margin-left:-2;margin-right:-2;margin-top:-2;margin-bottom:-2" BGCOLOR=white>
<SCRIPT>
<%
// only a "url" or an "id" should be set.
// If for some reason both are set the url overrides the id
String url = request.getParameter("url");
String id = request.getParameter("id");
if (url == null && id == null) {
// nothing to do
// in regular java code we would return.
// we'll just else here
} else {
// Try the URL first.
// If a parameter has been past then there has been
// a change in the contentframe that needs to be reflected in the
// helpBroker and the navigator
if (url != null) {
URL curURL = helpBroker.getCurrentURL();
URL testURL = new URL(url);
if (!testURL.sameFile(curURL)) {
ID currentid = helpBroker.getCurrentID();
helpBroker.setCurrentURL(testURL);
ID mapid = helpBroker.getCurrentID();
// if the changed url translates into an id'
// update the navigatorframe
// otherwise make sure that nothing is selected
// in the navigator frame
if (mapid != null && mapid != currentid) {
%>
top.findHelpID("<%= mapid.id %>");
<%
} else {
if (currentid != null) {
%>
top.setSelected("<%= currentid.id %>", false);
<%
}
}
}
} else {
// no URL was specified how about an id?
if (id != null) {
// Yep, just update the helpBroker
// The contentsframe has already been updated
helpBroker.setCurrentID(id);
}
}
}
%>
top.setTimeout("top.checkContentsFrame( );", 2000);
</SCRIPT>
</BODY>
</HTML>