-
Notifications
You must be signed in to change notification settings - Fork 211
/
ajax.vsp
158 lines (141 loc) · 5.65 KB
/
ajax.vsp
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?vsp
--
-- $Id$
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2014 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
declare domain_id, account_id integer;
declare sid, realm, action, subAction any;
declare aSession any;
sid := get_keyword ('sid', params, '');
realm := get_keyword ('realm', params, '');
action := get_keyword ('a', params, '');
subAction := get_keyword ('sa', params, '');
-- dbg_obj_print ('action, subAction: ', action, subAction);
aSession := AB.WA.session_restore (params);
domain_id := cast (get_keyword('domain_id', aSession, '0') as integer);
account_id := cast (get_keyword('account_id', aSession, '0') as integer);
if (action = 'load')
{
declare progressID, progressIndex, progressPoll, progressPollData any;
progressID := cast (get_keyword ('id', params, msec_time()) as varchar);
progressIndex := registry_get ('addressbook_index_' || progressID);
if (subAction = 'stop')
{
registry_set ('addressbook_action_' || progressID, 'stop');
}
else if (subAction = 'state')
{
if (not (isinteger(progressIndex) and (progressIndex = 0)))
{
http_rewrite ();
http_header ('Content-Type: text/xml\r\n');
http('<root>');
http(sprintf('<index>%s</index>', cast (progressIndex as varchar)));
progressPoll := registry_get ('addressbook_poll_' || progressID);
if (not (isinteger (progressPoll) and (progressPoll = 0)))
{
progressPollData := registry_get ('addressbook_poll_data_' || progressID);
http (sprintf ('<poll><action>%s</action><data>%s</data></poll>', cast (progressPoll as varchar), cast (progressPollData as varchar)));
}
http('</root>');
}
}
else if (subAction = 'poll')
{
declare pollValue any;
pollValue := get_keyword ('value', params);
if (not is_empty_or_null (pollValue))
registry_set ('addressbook_poll_' || progressID, pollValue);
registry_set ('addressbook_poll_time_' || progressID, cast (msec_time() as varchar));
}
else if (subAction = 'init')
{
registry_set ('addressbook_index_' || progressID, '0');
http_rewrite ();
http_header ('Content-Type: text/xml\r\n');
http ('<root>');
http (sprintf ('<id>%s</id>', cast (progressID as varchar)));
http ('</root>');
http_flush ();
commit work;
declare i_type, i_data, i_options, i_validation any;
i_type := deserialize (decode_base64 (get_keyword ('i_type', params)));
i_data := deserialize (decode_base64 (get_keyword ('i_data', params)));
i_options := deserialize (decode_base64 (get_keyword ('i_options', params)));
i_validation := deserialize (decode_base64 (get_keyword ('i_validation', params)));
-- import
{
declare exit handler for sqlstate '*'
{
goto _end;
};
AB.WA.import (domain_id, i_type, i_data, i_options, i_validation, progressID);
}
_end:;
registry_remove ('addressbook_index_' || progressID);
registry_remove ('addressbook_action_' || progressID);
}
}
else if (action = 'about')
{
http ( '<div style="padding: 1em; overflow: hidden;">');
http ( '<table style="width: 100%;">');
http ( ' <tr>');
http ( ' <td align="right" width="50%">');
http ( ' <b>Server Version:</b>');
http ( ' </td>');
http ( ' <td>');
http (sprintf (' %s', sys_stat('st_dbms_ver')));
http ( ' </td>');
http ( ' </tr>');
http ( ' <tr>');
http ( ' <td align="right">');
http ( ' <b>Server Build Date:</b>');
http ( ' </td>');
http ( ' <td>');
http (sprintf (' %s', sys_stat('st_build_date')));
http ( ' </tr>');
http ( ' <tr><td align="center" colspan="2"><hr /><td></tr>');
http ( ' <tr>');
http ( ' <td align="right">');
http ( ' <b>ODS AddressBook Version:</b>');
http ( ' </td>');
http ( ' <td>');
http (sprintf (' %s', registry_get('ab_version')));
http ( ' </td>');
http ( ' </tr>');
http ( ' <tr>');
http ( ' <td align="right">');
http ( ' <b>ODS AddressBook Build Date:</b>');
http ( ' </td>');
http ( ' <td>');
http (sprintf (' %s', registry_get('ab_build')));
http ( ' </td>');
http ( ' </tr>');
http ( ' <tr><td align="center" colspan="2"><hr /><td></tr>');
http ( ' <tr>');
http ( ' <td align="center" colspan="2">');
http ( ' <input type="button" value="OK" onclick="javascript: aboutDialog.hide(); return false;" />');
http ( ' <td>');
http ( ' </tr>');
http ( '</table>');
http ( '</div>');
}
?>