File: db_repl_sub_image.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 (212 lines) | stat: -rw-r--r-- 8,431 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
<?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="db_repl_sub_image_page" decor="yacutia_decor.vspx" style="yacutia_style.xsl" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <vm:pagetitle>Virtuoso HTTP Database Replication</vm:pagetitle>
  <vm:pagewrapper>
    <vm:variables>
      <v:variable name="strerror1111" persist="1" type="varchar" default="''" />
      <v:variable name="list_vec" persist="1" type="any" default="null" />
    </vm:variables>
    <vm:menu>
      <vm:menuitem name="subs" value="Transactional (subscribe)"/>
    </vm:menu>
    <vm:header caption="Image File Replay"/>
    <vm:pagebody vdb_check="1">
      <table class="form_layout">
        <colgroup>
          <col/>
          <col/>
          <col/>
        </colgroup>
        <tr>
          <td class="page_tab">
            <v:url name="b_url13" value="Publications" url="db_repl_trans.vspx?page=1"/>
          </td>
          <td class="page_tab_selected">Subscriptions
          </td>
        <td class="page_tab_empty"></td>
      </tr>
    </table>
    <table class="tab_page">
      <tr>
        <td>
      <v:template name="image_template" type="simple">
        <v:form name="image_form" action="db_repl_sub_image.vspx" method="POST" type="simple">
          <div class="listing_top_ctl_grp">
            Image file
            <v:text name="fd" xhtml_id="fd"/>
            <vm:file_browser ses_type="yacutia" render="popup" list_type="details" flt="yes" flt_pat="" path="DAV" browse_type="file" style_css="test.css" w_title="DAV Browser" title="DAV Browser" advisory="mega advisory text" lang="en" return_box="fd"/>
            <v:button action="simple" value="Add To List" name="add">
              <v:on-post>
                <![CDATA[
                  if (self.list_vec is null)
                    self.list_vec := vector();
                  declare _file_name, cur varchar;
                  declare len, _ix integer;
                  _file_name := get_keyword('fd', control.vc_page.vc_event.ve_params, '');
                  len := length(self.list_vec);
                  _ix := 0;
                  while (_ix < len)
                  {
                    cur := aref(self.list_vec, _ix);
                    if (cur = _file_name)
                      return;
                    _ix := _ix + 1;
                  }
                  if (_file_name is not null and _file_name <> '')
                    self.list_vec := vector_concat(self.list_vec, vector(_file_name));
                ]]>
              </v:on-post>
            </v:button>
          </div>
          <table class="listing" rules="groups">
            <colgroup/><colgroup/><colgroup/><colgroup/><colgroup/>
            <thead>
              <tr>
                <th>Select</th>
                <th>Image file</th>
              </tr>
            </thead>
            <?vsp
              declare _if, _n, _skp varchar;
              declare _ix, _l, _len integer;
              _ix := 0;
              _l := 0;
              _len := length(self.list_vec);
              while (_ix < _len)
              {
                _n := sprintf('fd%d', _ix);
                _if := aref(self.list_vec, _ix);
                if (_if <> '')
                {
                  _l := _l + 1;

                http (sprintf ('<tr class="%s">', case when mod (_l, 2) then 'listing_row_odd' else 'listing_row_even' end));
            ?>
              <td class="listing_col">
                <input type="checkbox" name="CB_<?V _n ?>"/>
              </td>
              <td class="listing_col">
                <?V _if ?>
              </td>
            <?vsp
                  http('</tr>');
                }
                _ix := _ix + 1;
              }
              if (_l = 0)
                http ('<tr><td class="SubAction" colspan="2">No files were added</td></tr>');
            ?>
          </table>
          <div class="listing_bot_ctl_grp">
            <v:button action="simple" name="create_can_but" value="Cancel">
              <v:on-post>
                <![CDATA[
                  http_request_status('HTTP/1.1 302 Found');
                  http_header(sprintf('Location: db_repl_trans.vspx?page=2&sid=%s&realm=%s\r\n', self.sid , self.realm));
                ]]>
              </v:on-post>
            </v:button>
            <v:button action="simple" value="Load" name="play">
              <v:on-post>
                <v:script>
                  <![CDATA[
                    declare len, _idx integer;
                    len := length(self.list_vec);
                    declare tmp_vec any;
                    declare _id, _f, suc, unsuc varchar;
                    suc := '';
                    unsuc := '';
                    _idx := 0;
                    while (_idx < len)
                    {
                      _id := sprintf ('CB_fd%d', _idx);
                      _f := get_keyword(_id, control.vc_page.vc_event.ve_params, '');
                      if (_f <> '')
                      {
                        commit work;
                        declare st, msg varchar;
                        msg := '';
                        exec('replay (?)', st, msg, vector(aref(self.list_vec, _idx)));
                        if (msg <> '')
                          unsuc := concat(unsuc, '<br/>', aref(self.list_vec, _idx), msg);
                        else
                          suc := concat(suc, '<br/>', aref(self.list_vec, _idx));
                      }
                      _idx := _idx + 1;
                    }
                    if (suc <> '')
                      self.strerror1111 := concat(self.strerror1111, 'Successfully loaded:', suc);
                    if (unsuc <> '')
                      self.strerror1111 := concat(self.strerror1111, '<br/>Unsuccessfully loaded:', unsuc);
                  ]]>
                </v:script>
              </v:on-post>
            </v:button>
            <v:button action="simple" value="Remove from list" name="rem">
              <v:on-post>
                <v:script>
                  <![CDATA[
                    declare len, _idx integer;
                    len := length(self.list_vec);
                    declare tmp_vec any;
                    declare _id, _f varchar;
                    tmp_vec := vector();
                    _idx := 0;
                    while (_idx < len)
                    {
                      _id := sprintf ('CB_fd%d', _idx);
                      _f := get_keyword(_id, control.vc_page.vc_event.ve_params, '');
                      if (_f = '')
                        tmp_vec := vector_concat(tmp_vec, vector(aref(self.list_vec, _idx)));
                      _idx := _idx + 1;
                    }
                    self.list_vec := tmp_vec;
                  ]]>
                </v:script>
              </v:on-post>
            </v:button>
          </div>
        </v:form>
      </v:template>
      <v:template name="err_template" type="simple" enabled="-- case when(self.strerror1111 <> '' and self.strerror1111 is not null) then 1 else 0 end">
        <table class="warning">
          <tr>
            <td>
              <?vsp
                http(self.strerror1111);
                self.strerror1111 := '';
              ?>
            </td>
          </tr>
        </table>
      </v:template>
        </td>
      </tr>
    </table>
    </vm:pagebody>
  </vm:pagewrapper>
</v:page>