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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
var Navigator = {} ;
Navigator.navigator_current = "top";
//___________________________________________________________________________________
/*
This function returns the URL that should be loaded as
a result of clicks on the drop down menus of the navigator form.
*/
Navigator.getNavigatorRequestURL = function()
{ // Unused?
var form = document.getElementById("NavigatorForm");
var open = form.Open;
var subscribe = form.Subscribe;
var unsubscribe = form.Unsubscribe;
url = WebLib.getApplicationURL();
if (open.value != "")
{
//url = url + "/Request?"
url = url + "RequestID=Open";
url = url + "&" + "Current=" + Navigator.navigator_current;
url = url + "&" + "Open=" + open.value;
}
else if (subscribe.value != "")
{
//url = url + "/Request?";
url = url + "RequestID=Subscribe";
url = url + "&" + "Current=" + Navigator.navigator_current;
url = url + "&" + "SubscribeTo=" + subscribe.value;
}
else if (unsubscribe.value != "")
{
//url = url + "/Request?";
url = url + "RequestID=Unsubscribe";
url = url + "&" + "Current=" + Navigator.navigator_current;
url = url + "&" + "UnsubscribeFrom=" + unsubscribe.value;
}
return url;
}
//___________________________________________________________________________________
/*
This function updates the navigator drop down menus according
to the xml of the server response.
*/
Navigator.updateNavigator = function()
{ // Unused?
if (WebLib.http_request.readyState == 4)
{
if (WebLib.http_request.status == 200)
{
var xmldoc;
var subdirs_l;
var subscribe_l;
var unsubscribe_l;
// Load the xml elements on javascript lists:
if (WebLib.http_request != false)
{
xmldoc = WebLib.http_request.responseXML;
Navigator.navigator_current = xmldoc.getElementsByTagName('current').item(0).firstChild.data;
subdirs_l = xmldoc.getElementsByTagName('open');
subscribe_l = xmldoc.getElementsByTagName('subscribe');
unsubscribe_l = xmldoc.getElementsByTagName('unsubscribe');
}
var form = document.getElementById("NavigatorForm");
var open = form.Open;
var subscribe = form.Subscribe;
var unsubscribe = form.Unsubscribe;
// Update the Open menu:
open.options.length = 0;
open.options[0] = new Option("", "", true, true);
open.options[1] = new Option("top", "top", false, false);
for(var i = 0; i < subdirs_l.length; i++)
{
var to_open = subdirs_l.item(i).firstChild.data;
open.options[i + 2] = new Option(to_open, to_open, false, false);
}
open.selectedIndex = 0;
// Update the Subscribe menu:
subscribe.options.length = 0;
subscribe.options[0] = new Option("", "", true, true);
for(var i = 0; i < subscribe_l.length; i++)
{
var to_subscribe = subscribe_l.item(i).firstChild.data;
subscribe.options[i + 1] = new Option(to_subscribe, to_subscribe, false, false);
}
subscribe.selectedIndex = 0;
// Update the Unsubscribe menu:
unsubscribe.options.length = 0;
unsubscribe.options[0] = new Option("", "", true, true);
for(var i = 0; i < unsubscribe_l.length; i++)
{
var to_unsubscribe = unsubscribe_l.item(i).firstChild.data;
unsubscribe.options[i + 1] = new Option(to_unsubscribe, to_unsubscribe, false, false);
}
unsubscribe.selectedIndex = 0;
}
}
}
//___________________________________________________________________________________
Navigator.makeNavigatorRequest = function()
{ // Unused?
url = Navigator.getNavigatorRequestURL();
// pass a reference to the updateNavigator function:
WebLib.makeRequest(url, Navigator.updateNavigator);
}
|