File: robot_sched.vspx

package info (click to toggle)
virtuoso-opensource 6.1.6%2Bdfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (283 lines) | stat: -rw-r--r-- 12,066 bytes parent folder | download | duplicates (2)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2012 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
 -
 -
-->
<v:page name="event1_edit_page"
  decor="yacutia_decor.vspx"
  style="yacutia_style.xsl"
  fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/"
  xmlns:vm="http://www.openlinksw.com/vspx/macro"
  doctype="-//W3C//DTD XHTML 1.0 Transitional//EN">
  <vm:pagetitle>WebDAV Content Management</vm:pagetitle>
  <vm:pagewrapper>
    <vm:variables>
      <v:variable persist="0" name="ename" type="varchar" default="''"/>
      <v:variable persist="0" name="host" type="varchar" default="''" param-name="host"/>
      <v:variable persist="0" name="root" type="varchar" default="''" param-name="root"/>
    </vm:variables>
    <vm:menu>
      <vm:menuitem value="WebDAV Content Management"/>
    </vm:menu>
    <vm:rawheader>
      <h1 class="page_title">
        <?vsp
          if (get_keyword('mode', self.vc_page.vc_event.ve_params) = 'edt')
            http('Modify Web Robot Scheduled Event');
          else
            http('Create Web Robot Scheduled Event');
        ?>
      </h1>
    </vm:rawheader>
    <vm:pagebody>
      <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
        <tr valign='top'>
          <td>
            <table cellpadding='10' cellspacing='0' border='0' width='100%'>
              <tr>
                <td>
                  <table cellpadding="0" cellspacing="0" border="0">
                    <colgroup>
                      <col/>
                      <col/>
                      <col/>
                      <col/>
                      <col/>
                    </colgroup>
                    <tr>
                        <td class="page_tab" align="center" nowrap="1">
                          <v:url name="b_url41" value="Repository" url="cont_page.vspx?page=1" xhtml_class="uddi"/>
                        </td>
                        <td class="page_tab_selected" align="center" nowrap="1">
                          <v:url name="b_url45" value="Content Imports" url="cont_page.vspx?page=2" xhtml_class="uddi"/>
                        </td>
                        <td class="page_tab" align="center" nowrap="1">
			  <v:url name="b_url43" value="Text Indexing" format="%s" url="cont_page.vspx?page=3" xhtml_class="uddi"/>
                        </td>
                        <td class="page_tab" align="center" nowrap="1">
			  <v:url name="b_url42" value="Resource Types" format="%s" url="cont_page.vspx?page=4" xhtml_class="uddi"/>
                        </td>
                        <td class="page_tab_empty" align="center" width="100%">
                          <table cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="100%" >
                              </td>
                            </tr>
                          </table>
                        </td>
                    </tr>
                  </table>
                  <table class="tab_page">
                    <tr>
                      <td valign="top">
      <table width="100%">
        <tr>
          <td align="right">
            <v:form name="robot_form1" type="simple" method="POST" action="">
              <table>
                <tr>
                  <td align="right">
                    <v:button action="simple" value="Import Queues" name="robot_button36" format="%s">
                      <v:on-post>
                        <![CDATA[
                          http_request_status('HTTP/1.1 302 Found');
                          http_header(sprintf('Location: robot_queues.vspx?sid=%s&realm=%s\r\n', self.sid , self.realm));
                          return;
                        ]]>
                      </v:on-post>
                    </v:button>
                  </td>
                  <td align="right">
                    <v:button action="simple" value="Retrieved Sites" name="robot_button4" format="%s">
                      <v:on-post>
                        <![CDATA[
                          http_request_status ('HTTP/1.1 302 Found');
                          http_header(sprintf('Location: robot_sites.vspx?sid=%s&realm=%s\r\n', self.sid , self.realm));
                          return;
                        ]]>
                      </v:on-post>
                    </v:button>
                  </td>
                </tr>
              </table>
            </v:form>
          </td>
        </tr>
      </table>
      <table width="98%" border="0" cellspacing="0" cellpadding="3" class="ctl_grp" xmlns:xhtml="http://www.w3.org/1999/xhtml">
        <v:form name="event_form" type="simple" method="POST" action="robot_sched.vspx">
          <input type="hidden" name="mode" value="<?= get_keyword('mode', self.vc_page.vc_event.ve_params) ?>"/>
	  <v:before-data-bind><![CDATA[
            declare _host, _root, _name varchar;
	    if (get_keyword('mode', self.vc_page.vc_event.ve_params) = 'edt')
	      {
	        if (self.ename = '')
	 	  self.ename := cast(deserialize(decode_base64(get_keyword('ename', self.vc_page.vc_event.ve_params))) as varchar);
	      }
            else
              {
                _host := self.host;
                _root := self.root;
	        declare exit handler for not found {
	          signal ('.....', sprintf ('No such target'));
	        };
                select VS_DESCR into _name from WS.WS.VFS_SITE where VS_HOST = _host and VS_ROOT = _root;
                self.ename := concat(_name, '(', _host,' in /DAV/',_root,')');
              }
	    ]]></v:before-data-bind>
          <v:on-post>
            <v:script>
              <![CDATA[
                declare i, cnt, exist, u_ident, g_name, inter integer;
                declare tmp, val, start_str varchar;
                if (get_keyword('cancel', params) <> '' or self.vc_is_valid = 0)
                {
                  success:
                  http_request_status ('HTTP/1.1 302 Found');
                  http_header(sprintf('Location: robot_queues.vspx?sid=%s&realm=%s\r\n', self.sid, self.realm));
                  return;
                }
                inter := 0;
                if ((control.vc_find_control('start_time') as vspx_field).ufl_value <> '')
                {
                  declare state, msg, m_dta, res varchar;
                  state := '00000';
                  exec('stringdate(?)', state, msg, vector((control.vc_find_control('start_time') as vspx_field).ufl_value), m_dta, res);
                  if (state <> '00000')
                    start_str := cast(now() as varchar);
                  else
                    start_str := stringdate((control.vc_find_control('start_time') as vspx_field).ufl_value);
                }
                else
                  start_str := cast(now() as varchar);
                inter := get_keyword('interval_value', e.ve_params, '10');
		if (exists(select 1 from DB.DBA.SYS_SCHEDULED_EVENT where SE_NAME = self.ename))
		  {
                    update DB.DBA.SYS_SCHEDULED_EVENT set SE_START = start_str, SE_INTERVAL = inter where SE_NAME = self.ename;
		  }
                else
                  insert into SYS_SCHEDULED_EVENT (SE_NAME, SE_START, SE_INTERVAL, SE_SQL) values(self.ename, start_str, inter, concat('WS.WS.SERV_QUEUE_TOP(\'',self.host,'\',\'',self.root,'\', 1, 0, null, null)'));
		commit work;
                goto success;
              ]]>
            </v:script>
          </v:on-post>
         <tr align="left">
           <td width="20%" align="left" valign="left">Event Name</td>
           <td valign="left">
             <?V self.ename ?>
           </td>
         </tr>
         <tr align="left">
           <td width="20%" align="left" valign="top">Start Time</td>
           <td valign="top">
             <v:text name="start_time" xhtml_style="width:400">
               <v:before-data-bind>
                 <v:script><![CDATA[
                   declare start_time varchar;
                   if (get_keyword('mode', params) = 'edt')
                   {
                     select adm_date_fmt(se_start) into start_time from sys_scheduled_event where se_name = self.ename;
                     control.ufl_value := start_time;
                     control.vc_data_bound := 1;
                   }
                   else
                   {
                     start_time := get_keyword('start_time', params);
                     if (start_time is not NULL)
                     {
                       control.ufl_value:= start_time;
                       control.vc_data_bound := 1;
                     }
                     else
                     {
                       control.ufl_value:= cast(now() as varchar);
                       control.vc_data_bound := 1;
                     }
                   }
                 ]]></v:script>
               </v:before-data-bind>
             </v:text>
           </td>
         </tr>
         <tr align="left">
           <td width="20%" align="left" valign="top">Interval</td>
           <td valign="top">
             <v:text name="interval_value" xhtml_style="width:400">
               <!-- v:validator name="interval_value_val1" min="1" max="999999999" empty-allowed="1" test="value" regexp="" message="Wrong value! " /-->
               <!-- v:validator name="interval_value_val2" min="0" max="0" empty-allowed="0" test="regexp" regexp="^[0-9]+$" message="Wrong value! must be a number" /-->
               <v:before-data-bind>
                 <v:script>
                   <![CDATA[
                     declare ufn integer;
                     if (get_keyword('mode', params) = 'edt')
                     {
                       select se_interval into ufn from SYS_SCHEDULED_EVENT where SE_NAME = self.ename;
                       control.ufl_value := cast(ufn as varchar);
                       control.vc_data_bound := 1;
                     }
                     else
                     {
                       declare pwd varchar;
                       pwd := get_keyword('interval_value', params, '10');
                       if (pwd is not NULL)
                       {
                         control.ufl_value:= pwd;
                         control.vc_data_bound := 1;
                       }
                     }
                   ]]>
                 </v:script>
               </v:before-data-bind>
             </v:text>
           </td>
         </tr>
         <tr align="left">
           <td/>
           <td colspan="3">
             <v:button action="submit" name="cancel" value="Cancel" />
             <?vsp
               if (get_keyword('mode', self.vc_page.vc_event.ve_params) is NULL or get_keyword('mode', self.vc_page.vc_event.ve_params) <> 'edit')
               {
             ?>
             <input type="reset" name="Submit2" value="Reset"/>
             <?vsp
               }
             ?>
             <v:button action="submit" name="save" value="Save"/>
           </td>
         </tr>
       </v:form>
      </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </vm:pagebody>
  </vm:pagewrapper>
</v:page>