File: uiedit_wishlist.vspx

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (294 lines) | stat: -rw-r--r-- 12,611 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
284
285
286
287
288
289
290
291
292
293
294
<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2018 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="foaf-import-page"
        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
        xmlns:v="http://www.openlinksw.com/vspx/"
        style="index.xsl"
        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
	      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <v:variable name="wl_mode" type="varchar" default="'WL/browse'"/>

	<v:variable name="wl_id" type="any" default="null" />
	<v:variable name="wl_type" type="varchar" default="'2'" />
	<v:variable name="wl_properties" type="any" default="null" />
	<v:variable name="wl_newProperties" type="any" default="null" />

	<v:form name="usr_personal_055" type="simple" method="POST" xhtml_enctype="multipart/form-data">
    <h3>I Want, Seek, or Need</h3>
    <vm:if test="self.wl_mode = 'WL/browse'">
      <?vsp
        if (0)
        {
      ?>
        <v:button name="wl_dButton" action="simple" value="Delete">
          <v:on-post>
            <![CDATA[
              delete from DB.DBA.WA_USER_OFFERLIST where WUOL_ID = get_keyword ('wl_id', self.vc_page.vc_event.ve_params) and WUOL_U_ID = self.u_id;
              self.vc_data_bind(e);
            ]]>
          </v:on-post>
        </v:button>
      <?vsp
        }
      ?>
      <input type="hidden" name="wl_id" id="wl_id" value="" />
      <div style="padding: 0 0 0.5em 0;">
        <v:button name="wl_aButton" action="simple" style="url" value="''" xhtml_class="img_button">
          <v:before-render>
    <![CDATA[
              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
            ]]>
          </v:before-render>
          <v:on-post>
            <![CDATA[
              self.wl_mode := 'WL/add';
              self.wl_flag.ufl_value := null;
              self.wl_offer.ufl_value := null;
              self.wl_comment.ufl_value := null;
              self.wl_properties := ODS..jsonObject ();
              self.wl_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', vector ())));

              self.vc_data_bind(e);
    ]]>
          </v:on-post>
        </v:button>
      </div>

	    <v:data-set name="wl_ds"
	                sql="select WUOL_ID, WUOL_OFFER, WUOL_COMMENT from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = :self.u_id and WUOL_TYPE = :self.wl_type"
		              scrollable="1"
		              editable="1"
		              nrows="0">

        <v:template name="wl_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
	  <table class="listing" rules="groups">
	    <tr class="listing_header_row">
      		    <th>Offer</th>
      		    <th width="50px">Action</th>
	    </tr>
          </table>
        </v:template>

        <v:template name="wl_ds_repeat" type="repeat" name-to-remove="" set-to-remove="">

          <v:template name="wl_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
            <table>
              <tr align="center">
                <td colspan="2">No Offers</td>
              </tr>
            </table>
          </v:template>

          <v:template name="wl_ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
            <table>
  			      <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
                <td nowrap="nowrap" width="100%">
                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUOL_OFFER')" format="%s" name="wl_ds_browse_1_label"/>
                </td>
                <td nowrap="nowrap">
                  <v:button name="wl_eButton" action="simple" style="url" value="''" xhtml_class="img_button">
                    <v:before-render>
                      <![CDATA[
                        control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Offer" title="Edit Offer"/> Edit';
                      ]]>
                    </v:before-render>
                    <v:on-post>
                      <![CDATA[
                        self.wl_mode := 'WL/edit';
                        self.wl_id := (control.vc_parent as vspx_row_template).te_column_value('WUOL_ID');
                        self.wl_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', vector ())));

                        select WUOL_FLAG,
                               WUOL_OFFER,
                               WUOL_COMMENT,
                               deserialize (WUOL_PROPERTIES)
                          into self.wl_flag.ufl_value,
                               self.wl_offer.ufl_value,
                               self.wl_comment.ufl_value,
                               self.wl_properties
                          from DB.DBA.WA_USER_OFFERLIST
                         where WUOL_ID = self.wl_id;

                        if (get_keyword ('version', self.wl_properties) = '1.0')
                        self.wl_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', self.wl_properties, vector ()))));

                        if (get_keyword ('version', self.wl_properties) = '2.0')
                          self.wl_newProperties := get_keyword ('ontologies', self.wl_properties, vector ());

                        self.vc_data_bind(e);
                      ]]>
                    </v:on-post>
                  </v:button>
                  <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('wl_id').value = <?V (control as vspx_row_template).te_column_value('WUOL_ID') ?>; doPost('page_form', 'wl_dButton');}">
                    <img class="button" src="/ods/images/icons/trash_16.png"/> Delete
                  </span>
			        </td>
			      </tr>
            </table>
		      </v:template>

		    </v:template>

		    <v:template name="wl_ds_footer" type="simple" name-to-remove="table" set-to-remove="top">
          <table>
          </table>
		    </v:template>
	    </v:data-set>

    </vm:if>

    <vm:if test="self.wl_mode <> 'WL/browse'">
	  <div class="fm">
				<table>
				  <tr>
				    <th width="100px">
		          Access
		        </th>
		        <td>
              <v:select-list name="wl_flag" xhtml_id="wl_flag">
                <v:item name="public" value="1" />
                <v:item name="acl" value="2" />
                <v:item name="private" value="3" />
              </v:select-list>
            </td>
          </tr>
				  <tr>
				    <th>
		          Offer Name
		        </th>
		        <td>
              <v:text name="wl_offer" value="" xhtml_id="wl_offer" xhtml_size="50" xhtml_class="_validate_" />
            </td>
          </tr>
				  <tr>
				    <th valign="top">
		          Comment
		        </th>
		        <td>
              <v:textarea name="wl_comment" value="" xhtml_id="wl_comment" xhtml_rows="5" xhtml_cols="50"/>
            </td>
          </tr>
          				  <tr>
  				    <th valign="top">
  		          Products
  		        </th>
              <td width="800px">
              <table class="ctl_grp">
                <tr>
                  <td width="800px">
                <table id="wl_tbl" class="listing">
                      <thead>
                        <tr class="listing_header_row">
                          <th>
                            <div style="width: 16px;"><![CDATA[&nbsp;]]></div>
                          </th>
                          <th width="100%">
                            Ontology
                          </th>
                          <th width="80px">
                            Action
                          </th>
                  </tr>
                      </thead>
                      <tbody id="wl_tbody" class="colorize">
                        <tr id="wl_tr_no"><td colspan="3"><b>No Attached Ontologies</b></td></tr>
                  </tbody>
			  </table>
                  </td>
                  <td valign="top" nowrap="nowrap">
                    <span class="button pointer" onclick="TBL.createRow('wl', null, {fld_1: {mode: 40, cssText: 'display: none;'}, fld_2: {mode: 41, labelValue: 'Ontology: ', cssText: 'width: 95%;'}, btn_1: {mode: 40}, btn_2: {mode: 41, title: 'Attach'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Ontology" title="Add Ontology" /> Add</span>
                  </td>
                </tr>
              </table>
                <input type="hidden" id="wl_no" name="wl_no" value="1" />
          <script type="text/javascript">
            <![CDATA[
              ODSInitArray.push ( function () {
                      OAT.Loader.load(["ajax", "json", "combolist"], function(){
                        RDF.tablePrefix = 'wl';
                        RDF.tableOptions = {itemType: {fld_1: {cssText: "display: none;"}, btn_1: {cssText: "display: none;"}}};
                        RDF.itemTypes = <?vsp http (replace (ODS..obj2json (self.wl_newProperties, 10), 'class:', 'className:')); ?>;
                        RDF.showItemTypes();
                });
              } );
            ]]>
          </script>
              </td>
            </tr>
          <tr>
            <td></td>
            <td>
              <br />
    		      <v:button name="user_c_personal_055" value="Cancel" action="simple">
		        <v:on-post>
                self.wl_mode := 'WL/browse';
                self.vc_data_bind (e);
		        </v:on-post>
		      </v:button>
    		      <v:button name="user_s_personal_055" value="--case when self.wl_mode = 'WL/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
		        <v:on-post><![CDATA[
                if (self.vc_is_valid = 0)
                  return;

                declare ontologies, IDs any;
                declare products any;

                IDs := vector ();
                ontologies := vector ();
                self.getItems ('wl', 'gr', ontologies, IDs);
                  self.wl_properties := vector_concat (ODS..jsonObject (), vector ('version', '2.0', 'ontologies', ontologies));
                if (self.wl_mode = 'WL/add')
              {
                    if (exists (select 1 from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = self.u_id and WUOL_TYPE = self.wl_type and WUOL_OFFER = self.wl_offer.ufl_value))
                    {
                      self.vc_error_message := 'An offer with same name already exists, please specify unique name.';
                      self.vc_is_valid := 0;
                      return;
                    }
                    insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
                      values (self.u_id, self.wl_type, self.wl_flag.ufl_value, self.wl_offer.ufl_value, self.wl_comment.ufl_value, serialize (self.wl_properties));
              }
              else
              {
                    update DB.DBA.WA_USER_OFFERLIST
                       set WUOL_FLAG = self.wl_flag.ufl_value,
                           WUOL_OFFER = self.wl_offer.ufl_value,
                           WUOL_COMMENT = self.wl_comment.ufl_value,
                           WUOL_PROPERTIES = serialize (self.wl_properties)
                     where WUOL_ID = self.wl_id;
              }

                self.wl_mode := 'WL/browse';
                self.vc_data_bind (e);
            ]]></v:on-post>
          </v:button>
            </td>
          </tr>
        </table>
    </div>
    </vm:if>
	</v:form>
</v:page>