Converted Rico3 icons to CSS sprites. Moved minsrc and baselibs directories out of...
[infodrom/rico3] / examples / asp / ex2editfilterKW.asp
1 <%@ LANGUAGE="VBSCRIPT" %>\r
2 <% Response.CacheControl = "no-cache" %>\r
3 <% Response.AddHeader "Pragma", "no-cache" %> \r
4 <% Response.Expires = -1 %>\r
5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
6 <html>\r
7 <head>\r
8 <title>Rico LiveGrid-Example 2 (editable)</title>\r
9 \r
10 <!-- #INCLUDE FILE = "dbConnect.asp" --> \r
11 <!-- #INCLUDE FILE = "../../plugins/asp/ricoLiveGridForms.vbs" --> \r
12 <!-- #INCLUDE FILE = "../../plugins/asp/LoadRicoClient.asp" -->\r
13 <%\r
14 Dim RicoClient\r
15 set RicoClient = new LoadRicoClient\r
16 RicoClient.SetRicoClientParentPath "../../ricoClient/"\r
17 RicoClient.CheckQueryString   ' just for demo\r
18 RicoClient.CreateLinks\r
19 set RicoClient = Nothing\r
20 %>\r
21 \r
22 <link href="../demo.css" type="text/css" rel="stylesheet" />\r
23 \r
24 <script type='text/javascript'>\r
25 \r
26 // ricoLiveGridForms will call orders_FormInit right before grid & form initialization.\r
27 \r
28 function orders_FormInit() {\r
29   var cal=new Rico.CalendarControl("Cal");\r
30   Rico.EditControls.register(cal, Rico.imgDir+'calarrow.png');\r
31   \r
32   var kwSearch=new Rico.KeywordSearch("CustomerSearch");\r
33   Rico.EditControls.register(kwSearch, Rico.imgDir+'dotbutton.gif');\r
34 }\r
35 </script>\r
36 <style type="text/css">\r
37 div.ricoLG_cell {\r
38   white-space:nowrap;\r
39 }\r
40 </style>\r
41 </head>\r
42 \r
43 \r
44 <body>\r
45 \r
46 <%\r
47 '************************************************************************************************************\r
48 '  LiveGrid Plus-Edit Example\r
49 '************************************************************************************************************\r
50 '  Matt Brown\r
51 '************************************************************************************************************\r
52 \r
53 if OpenGridForm(empty,"Orders") then\r
54   if oForm.action="table" then DisplayHeading\r
55   DefineFields\r
56 end if\r
57 CloseApp\r
58 \r
59 \r
60 sub DisplayHeading()\r
61   response.write vbLf & "<div id='explanation'>"\r
62   response.write vbLf & "Base Library: <script type='text/javascript'>document.write(Rico.Lib+' '+Rico.LibVersion);</script>"\r
63   response.write vbLf & "<hr>The data on this grid can be edited using pop-up forms. "\r
64   response.write vbLf & "Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu. "\r
65   response.write vbLf & "The Add and Edit forms are automatically generated by LiveGrid. "\r
66   response.write vbLf & "Notice on the Add form how you use the Rico Tree control to select the customer. "\r
67   response.write vbLf & "Notice on the Edit form how the Rico Calendar is used to change dates. "\r
68   response.write vbLf & "Updates are disabled on the database, so you will get an error message if you try to save."\r
69   response.write vbLf & "</div>"\r
70   response.write vbLf & "<p><strong>Orders Table</strong></p>"\r
71 end sub\r
72 \r
73 \r
74 sub DefineFields()\r
75   dim colnum,LookupSQL\r
76   'oForm.options("showSaveMsg")="full"\r
77   'oForm.DebugFlag=true\r
78   oForm.options("FilterLocation")=-1\r
79   oForm.options("panelWidth")=500\r
80   oForm.options("frozenColumns")=1\r
81   oForm.options("menuEvent")="click"\r
82   oForm.options("highlightElem")="cursorRow"\r
83   \r
84   oForm.AddPanel "Basic Info"\r
85   oForm.AddEntryFieldW "OrderID","Order ID","B","<auto>",50\r
86   oForm.ConfirmDeleteColumn\r
87   oForm.SortAsc\r
88 \r
89   LookupSQL="select CustomerID,CompanyName from Customers order by CompanyName"\r
90   oForm.AddLookupField "CustomerID",empty,"CustID","Customer","CL","",LookupSQL\r
91   oForm.LookupField("SelectCtl")="CustomerSearch"\r
92   oForm.LookupField("InsertOnly")=true   ' do not allow customer to be changed once an order is entered\r
93   oForm.CurrentField("width")=160\r
94   oForm.CurrentField("filterUI")="t"\r
95 \r
96   LookupSQL="select EmployeeID," & oDB.concat(Array("LastName","', '","FirstName"),false) & " from Employees order by LastName,FirstName"\r
97   oForm.AddLookupField "EmployeeID",empty,"EmployeeID","Sales Person","SL","",LookupSQL\r
98   oForm.CurrentField("width")=140\r
99   oForm.CurrentField("filterUI")="m"\r
100 \r
101   oForm.AddEntryFieldW "OrderDate","Order Date","D",Date(),90\r
102   oForm.CurrentField("SelectCtl")="Cal"\r
103   oForm.AddEntryFieldW "RequiredDate","Required Date","D",Date(),90\r
104   oForm.CurrentField("SelectCtl")="Cal"\r
105   oForm.AddCalculatedField "select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID","Net Sale"\r
106   oForm.CurrentField("format")="DOLLAR"\r
107   oForm.CurrentField("width")=80\r
108 \r
109   oForm.AddPanel "Ship To"\r
110   oForm.AddEntryFieldW "ShipName","Name","B","",140\r
111   oForm.AddEntryFieldW "ShipAddress","Address","B","",140\r
112   oForm.AddEntryFieldW "ShipCity","City","B","",120\r
113   oForm.CurrentField("filterUI")="s"\r
114   oForm.AddEntryFieldW "ShipRegion","Region","T","",60\r
115   oForm.AddEntryFieldW "ShipPostalCode","Postal Code","T","",100\r
116   \r
117   ' display ShipCountry with a link to wikipedia\r
118   colnum=oForm.AddEntryFieldW("ShipCountry","Country","N","",100)\r
119   oForm.CurrentField("control")="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{" & colnum & "}','_blank')"\r
120   oForm.CurrentField("filterUI")="s"\r
121 \r
122   'oForm.AutoInit=false\r
123   oForm.DisplayPage\r
124 end sub\r
125 \r
126 %>\r
127 \r
128 </body>\r
129 </html>\r