File: emp.vspx

package info (click to toggle)
virtuoso-opensource 6.1.6%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 260,060 kB
  • ctags: 123,765
  • sloc: ansic: 652,532; 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 (353 lines) | stat: -rw-r--r-- 11,368 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<?xml version="1.0"?>
<!--
 -  
 -  $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
 -  
 -  
-->
<html>
  <body>
    <style><![CDATA[
.page_tab
{
    background-color: #eaeaea;
    text-align: left;
    padding: 2px;
    border: 1px solid black;
}

.page_tab_empty {
    border-bottom:1px solid black;
    border-left:1px solid black;
    border-right:0;
    border-top:0;
}

.page_tab_selected
{
    background-color: white;
    text-align: left;
    padding: 2px;
    border-top:1px solid black;
    border-left:1px solid black;
    border-right:1px solid black;
    border-bottom:0
}

.tab_body
{
    background-color: white;
    padding: 2px;
    border-bottom:1px solid black;
    border-left:1px solid black;
    border-right:1px solid black;
    border-top:0
}

.emp_record
{
    background-color: white;
    padding: 5px;
    margin-bottom: 10px;
    border-bottom:1px solid black;
    border-left:1px solid black;
    border-right:1px solid black;
    border-top:1px solid black;
}
.emp_txt
{
  font-weight: bold;
}
]]></style>
    <v:page xmlns:v="http://www.openlinksw.com/vspx/" name="tab_demo">
      <v:variable name="empid" type="int" default="1" />
      <H3>Browsing a Northwind demo Database using Tab control</H3>
      <v:method name="astyle" arglist="in cmp varchar">
	if (self.tab.tb_active is not null and self.tab.tb_active.vc_name = cmp)
	  return 'page_tab_selected';
	return 'page_tab';
      </v:method>
      <v:form type="simple" method="POST" name="f1">
	<v:on-post>
	  if (e.ve_initiator is not null and e.ve_initiator.vc_name = 'emp')
	  {
	  e.ve_initiator.vc_parent.vc_focus := 1;
	  e.ve_initiator.vc_post (e);
	  e.ve_initiator.vc_user_post (e);
	  }
	</v:on-post>
	<table border="0" cellpadding="0" cellspacing="0" class="emp_record">
	  <tr><td colspan="2">Employee:</td></tr>
	  <v:form name="upf1" type="update" table="Demo.demo.Employees" if-not-exists="none">
	    <v:key  column="EmployeeID" value="--self.empid" default="null" />
	    <v:template name="updtmpl" type="if-exists">
	      <tr>
		<td>Id:
		  <v:data-list name="emp" sql="select EmployeeID, LastName from Demo.demo.Employees"
		    key-column="EmployeeID" value-column="EmployeeID" auto-submit="1" value="--self.empid">
		    <v:on-post>
		      if (e.ve_initiator = control)
		      {
		      self.empid := atoi(control.ufl_value);
		      self.ds1.vc_reset ();
		      self.ds2.vc_reset ();
		      self.ds1.vc_data_bind (e);
		      self.ds2.vc_data_bind (e);
		      self.upf1.vc_data_bind (e);
		      }
		    </v:on-post>
		  </v:data-list>
		</td>
		<td>&amp;nbsp;</td>
		<td>
		  Name:
		  <span class="emp_txt">
		  <v:label column="TitleOfCourtesy"/>
		  <v:label column="FirstName"/>
		  <v:label column="Lastname"/>
		  </span>
		</td>
	      </tr>
	      <tr>
		<td>Region:
		  <span class="emp_txt">
		  <v:label column="Region" null-value="''"/>
		  </span>
		</td>
		<td>&amp;nbsp;</td>
		<td>City:
		  <span class="emp_txt">
		  <v:label column="City"/>
		  </span>
		</td>
	      </tr>
	      <tr>
		<td>PostalCode:
		  <span class="emp_txt">
		  <v:label column="PostalCode"/>
		  </span>
		</td>
		<td>&amp;nbsp;</td>
		<td>Address:
		  <span class="emp_txt">
		  <v:label column="Address" null-value="''"/>
		  </span>
		</td>
	      </tr>
	      <tr>
		<td>Country:
		  <span class="emp_txt">
		  <v:label column="Country" null-value="''"/>
		  </span>
		</td>
		<td>&amp;nbsp;</td>
		<td>HomePhone:
		  <span class="emp_txt">
		  <v:label column="HomePhone"/>
		  </span>
		</td>
	      </tr>
	    </v:template>
	  </v:form>
      </table>
	<table border="0" cellpadding="0" cellspacing="0" width="50%">
        <tr>
	  <td class="<?V self.astyle ('template1') ?>">
	    <v:button name="tab_switch_template1" action="simple" value="Customers" style="url" xhtml_style="text-decoration:none;"/>
          </td>
	  <td class="<?V self.astyle ('template2') ?>">
            <v:button name="tab_switch_template2" action="simple" value="Orders" style="url" xhtml_style="text-decoration:none;"/>
          </td>
	  <td class="page_tab_empty" align="center" width="100%">
	    <table cellpadding="0" cellspacing="0">
	      <tr>
		<td  width="100%">
		</td>
	      </tr>
	     </table>
	  </td>
        </tr>
	<v:tab name="tab" initial-active="template1" style="custom">
          <v:template name="template1" type="simple">
            <tr>
	      <td class="tab_body" colspan="3">
	    <div>
	      <v:data-set name="ds2" nrows="10" scrollable="1" cursor-type="dynamic">
		<v:sql>
		  select c.CustomerID, c.CompanyName, count(o.OrderID) as OrdCount
		  from Demo.demo.Orders o, Demo.demo.Customers c
		  where o.EmployeeID = :empl and o.CustomerID = c.CustomerID
		  group by c.CustomerID, c.CompanyName
		  order by 1
		</v:sql>
		<v:param name="empl" value="--self.empid"/>
		<table width="100%">
		  <tr bgcolor="#eaeaea">
		    <th>Customer ID</th>
		    <th>Company Name</th>
		    <th>Orders #</th>
		    <th>Orders Price</th>
		  </tr>
		  <v:template name="rpt2" type="repeat">
		    <v:template name="brw2" type="browse">
		      <tr bgcolor="<?V case mod(self.ds2.ds_current_row.te_ctr,2) when 0 then 'white' else '#eaeaea' end ?>">
			<td>
			  <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[0]" format="%s"/>
			</td>
			<td>
			  <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[1]" format="%s"/>
			</td>
			<td align="right">
			  <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[2]" format="%d"/>
			</td>
			<td align="right">
			  <v:label value="--(select SUM(Quantity * UnitPrice * (1 - Discount)) from Demo.demo.Order_Details od, Demo.demo.Orders o where o.OrderID = od.OrderId and o.CustomerID = (control.vc_parent as vspx_row_template).te_rowset[0] and o.EmployeeID = self.empid)" format="%10.2f"/>
			</td>
		      </tr>
		    </v:template>
		  </v:template>
		  <tr>
		    <td>
		      <v:button name="ds2_prev" value="&lt;&lt;" action="simple" style="url" xhtml_style="text-decoration:none;"/>
		    </td>
		    <td>
		      <v:button name="ds2_next" value="&gt;&gt;" action="simple" style="url" xhtml_style="text-decoration:none;"/>
		    </td>
		</tr>
		</table>
	      </v:data-set>
	    </div>
	      </td>
            </tr>
          </v:template>
          <v:template name="template2" type="simple">
            <tr>
              <td class="tab_body"  colspan="3">
	    <div>
	      <v:data-set name="ds1" nrows="10" scrollable="1" cursor-type="dynamic">
		<v:sql>
		  select o.OrderID, c.CompanyName as CustomerCompany, o.OrderDate, s.CompanyName as ShipperName
		  from Demo.demo.Orders o, Demo.demo.Customers c, Demo.demo.Shippers s
		  where o.EmployeeID = :empi and o.CustomerID = c.CustomerID and o.ShipVia = s.ShipperID
		  order by 1
		</v:sql>
		<v:column name="OrderID"/>
		<v:column name="CustomerCompany"/>
		<v:column name="OrderDate"/>
		<v:column name="ShipperName"/>
		<v:param name="empi" value="--self.empid"/>
		<table width="100%">
		  <tr bgcolor="#eaeaea"><th>Order ID</th><th>Company Name</th><th>Order Date</th><th>Ship Via</th><th>Order Total</th></tr>
		  <v:template name="rpt1" type="repeat">
		    <v:template name="brw1" type="browse">
		      <tr bgcolor="<?V case mod(self.ds1.ds_current_row.te_ctr,2) when 0 then 'white' else '#eaeaea' end ?>">
			<td>
			  <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[0]" format="%d"/>
			</td>
			<td>
			  <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[1]" format="%s"/>
			</td>
			<td>
			  <v:label value="--datestring((control.vc_parent as vspx_row_template).te_rowset[2])"
			    format="%.10s"/>
			</td>
			<td>
			  <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[3]" format="%s"/>
			</td>
			<td align="right">
			  <v:label value="--(select SUM(Quantity * UnitPrice * (1 - Discount)) from Demo.demo.Order_Details where OrderId = (control.vc_parent as vspx_row_template).te_rowset[0])" format="%10.2f"/>
			</td>
		      </tr>
		      <tr bgcolor="<?V case mod(self.ds1.ds_current_row.te_ctr,2) when 0 then 'white' else '#eaeaea' end ?>">
			  <v:tree name="t1" multi-branch="1" orientation="vertical"
			    start-path="--(control.vc_parent as vspx_row_template).te_rowset[0]"
			    root="ord_root_node" child-function="ord_child_node">
			    <v:node-template name="n_tmpl">
			      <td>
				<v:button name="t1_toggle" action="simple" style="image" value="--case (control.vc_parent as vspx_tree_node).tn_open when 0 then '../plus.gif' else '../minus.gif' end"/>
			      </td>
			      <td colspan="4">
				<table bgcolor="white" cellpadding="2" cellspacing="2">
				  <v:template name="tmp1" type="simple" enabled="--((control.vc_parent as vspx_tree_node).tn_open)">
				    <tr><th>Product Name</th><th>Quantity</th><th>UnitPrice</th></tr>
				  </v:template>
				  <v:node/>
				</table>
			      </td>
			  </v:node-template>
			  <v:leaf-template name="l_tmpl">
			    <tr>
			      <td>
				<v:label name="lt1" value="--''">
				  <v:after-data-bind>
				    declare xt, xp any;
				    xt := (control.vc_parent as vspx_tree_node).tn_element;
				    xp := cast (xpath_eval ('//Product/Name/text()',xt) as varchar);
				    control.ufl_value := xp;
				  </v:after-data-bind>
				</v:label>
			      </td>
			      <td align="right">
				<v:label name="lt2" value="--''">
				  <v:after-data-bind>
				    declare xt, xp any;
				    xt := (control.vc_parent as vspx_tree_node).tn_element;
				    xp := cast (xpath_eval ('//Product/Quantity/text()',xt) as varchar);
				    control.ufl_value := xp;
				  </v:after-data-bind>
				</v:label>
			      </td>
			      <td align="right">
				<v:label name="lt3" value="--''">
				  <v:after-data-bind>
				    declare xt, xp any;
				    xt := (control.vc_parent as vspx_tree_node).tn_element;
				    xp := cast (xpath_eval ('//Product/UnitPrice/text()',xt) as varchar);
				    control.ufl_value := xp;
				  </v:after-data-bind>
				</v:label>
			      </td>
			    </tr>
			  </v:leaf-template>
			  </v:tree>
		      </tr>
		    </v:template>
		  </v:template>
		  <tr>
		    <td>
		      <v:button name="ds1_prev" value="&lt;&lt;" action="simple" style="url" xhtml_style="text-decoration:none;"/>
		    </td>
		    <td>
		      <v:button name="ds1_next" value="&gt;&gt;" action="simple" style="url" xhtml_style="text-decoration:none;"/>
		    </td>
		</tr>
		</table>
	      </v:data-set>
	    </div>
	      </td>
            </tr>
          </v:template>
        </v:tab>
      </table>
    </v:form>
    </v:page>
  </body>
</html>