Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

390 lines
10 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.onReady(function(){
  8. Ext.QuickTips.init();
  9. // turn on validation errors beside the field globally
  10. Ext.form.Field.prototype.msgTarget = 'side';
  11. var bd = Ext.getBody();
  12. /*
  13. * ================ Simple form =======================
  14. */
  15. bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'});
  16. var simple = new Ext.FormPanel({
  17. labelWidth: 75, // label settings here cascade unless overridden
  18. url:'save-form.php',
  19. frame:true,
  20. title: 'Simple Form',
  21. bodyStyle:'padding:5px 5px 0',
  22. width: 350,
  23. defaults: {width: 230},
  24. defaultType: 'textfield',
  25. items: [{
  26. fieldLabel: 'First Name',
  27. name: 'first',
  28. allowBlank:false
  29. },{
  30. fieldLabel: 'Last Name',
  31. name: 'last'
  32. },{
  33. fieldLabel: 'Company',
  34. name: 'company'
  35. }, {
  36. fieldLabel: 'Email',
  37. name: 'email',
  38. vtype:'email'
  39. }, new Ext.form.TimeField({
  40. fieldLabel: 'Time',
  41. name: 'time',
  42. minValue: '8:00am',
  43. maxValue: '6:00pm'
  44. })
  45. ],
  46. buttons: [{
  47. text: 'Save'
  48. },{
  49. text: 'Cancel'
  50. }]
  51. });
  52. simple.render(document.body);
  53. /*
  54. * ================ Form 2 =======================
  55. */
  56. bd.createChild({tag: 'h2', html: 'Form 2 - Adding fieldsets'});
  57. var fsf = new Ext.FormPanel({
  58. labelWidth: 75, // label settings here cascade unless overridden
  59. url:'save-form.php',
  60. frame:true,
  61. title: 'Simple Form with FieldSets',
  62. bodyStyle:'padding:5px 5px 0',
  63. width: 350,
  64. items: [{
  65. xtype:'fieldset',
  66. checkboxToggle:true,
  67. title: 'User Information',
  68. autoHeight:true,
  69. defaults: {width: 210},
  70. defaultType: 'textfield',
  71. collapsed: true,
  72. items :[{
  73. fieldLabel: 'First Name',
  74. name: 'first',
  75. allowBlank:false
  76. },{
  77. fieldLabel: 'Last Name',
  78. name: 'last'
  79. },{
  80. fieldLabel: 'Company',
  81. name: 'company'
  82. }, {
  83. fieldLabel: 'Email',
  84. name: 'email',
  85. vtype:'email'
  86. }
  87. ]
  88. },{
  89. xtype:'fieldset',
  90. title: 'Phone Number',
  91. collapsible: true,
  92. autoHeight:true,
  93. defaults: {width: 210},
  94. defaultType: 'textfield',
  95. items :[{
  96. fieldLabel: 'Home',
  97. name: 'home',
  98. value: '(888) 555-1212'
  99. },{
  100. fieldLabel: 'Business',
  101. name: 'business'
  102. },{
  103. fieldLabel: 'Mobile',
  104. name: 'mobile'
  105. },{
  106. fieldLabel: 'Fax',
  107. name: 'fax'
  108. }
  109. ]
  110. }],
  111. buttons: [{
  112. text: 'Save'
  113. },{
  114. text: 'Cancel'
  115. }]
  116. });
  117. fsf.render(document.body);
  118. /*
  119. * ================ Form 3 =======================
  120. */
  121. bd.createChild({tag: 'h2', html: 'Form 3 - A little more complex'});
  122. var top = new Ext.FormPanel({
  123. labelAlign: 'top',
  124. frame:true,
  125. title: 'Multi Column, Nested Layouts and Anchoring',
  126. bodyStyle:'padding:5px 5px 0',
  127. width: 600,
  128. items: [{
  129. layout:'column',
  130. items:[{
  131. columnWidth:.5,
  132. layout: 'form',
  133. items: [{
  134. xtype:'textfield',
  135. fieldLabel: 'First Name',
  136. name: 'first',
  137. anchor:'95%'
  138. }, {
  139. xtype:'textfield',
  140. fieldLabel: 'Company',
  141. name: 'company',
  142. anchor:'95%'
  143. }]
  144. },{
  145. columnWidth:.5,
  146. layout: 'form',
  147. items: [{
  148. xtype:'textfield',
  149. fieldLabel: 'Last Name',
  150. name: 'last',
  151. anchor:'95%'
  152. },{
  153. xtype:'textfield',
  154. fieldLabel: 'Email',
  155. name: 'email',
  156. vtype:'email',
  157. anchor:'95%'
  158. }]
  159. }]
  160. },{
  161. xtype:'htmleditor',
  162. id:'bio',
  163. fieldLabel:'Biography',
  164. height:200,
  165. anchor:'98%'
  166. }],
  167. buttons: [{
  168. text: 'Save'
  169. },{
  170. text: 'Cancel'
  171. }]
  172. });
  173. top.render(document.body);
  174. /*
  175. * ================ Form 4 =======================
  176. */
  177. bd.createChild({tag: 'h2', html: 'Form 4 - Forms can be a TabPanel...'});
  178. var tabs = new Ext.FormPanel({
  179. labelWidth: 75,
  180. border:false,
  181. width: 350,
  182. items: {
  183. xtype:'tabpanel',
  184. activeTab: 0,
  185. defaults:{autoHeight:true, bodyStyle:'padding:10px'},
  186. items:[{
  187. title:'Personal Details',
  188. layout:'form',
  189. defaults: {width: 230},
  190. defaultType: 'textfield',
  191. items: [{
  192. fieldLabel: 'First Name',
  193. name: 'first',
  194. allowBlank:false,
  195. value: 'Jack'
  196. },{
  197. fieldLabel: 'Last Name',
  198. name: 'last',
  199. value: 'Slocum'
  200. },{
  201. fieldLabel: 'Company',
  202. name: 'company',
  203. value: 'Ext JS'
  204. }, {
  205. fieldLabel: 'Email',
  206. name: 'email',
  207. vtype:'email'
  208. }]
  209. },{
  210. title:'Phone Numbers',
  211. layout:'form',
  212. defaults: {width: 230},
  213. defaultType: 'textfield',
  214. items: [{
  215. fieldLabel: 'Home',
  216. name: 'home',
  217. value: '(888) 555-1212'
  218. },{
  219. fieldLabel: 'Business',
  220. name: 'business'
  221. },{
  222. fieldLabel: 'Mobile',
  223. name: 'mobile'
  224. },{
  225. fieldLabel: 'Fax',
  226. name: 'fax'
  227. }]
  228. }]
  229. },
  230. buttons: [{
  231. text: 'Save'
  232. },{
  233. text: 'Cancel'
  234. }]
  235. });
  236. tabs.render(document.body);
  237. /*
  238. * ================ Form 5 =======================
  239. */
  240. bd.createChild({tag: 'h2', html: 'Form 5 - ... and forms can contain TabPanel(s)'});
  241. var tab2 = new Ext.FormPanel({
  242. labelAlign: 'top',
  243. title: 'Inner Tabs',
  244. bodyStyle:'padding:5px',
  245. width: 600,
  246. items: [{
  247. layout:'column',
  248. border:false,
  249. items:[{
  250. columnWidth:.5,
  251. layout: 'form',
  252. border:false,
  253. items: [{
  254. xtype:'textfield',
  255. fieldLabel: 'First Name',
  256. name: 'first',
  257. anchor:'95%'
  258. }, {
  259. xtype:'textfield',
  260. fieldLabel: 'Company',
  261. name: 'company',
  262. anchor:'95%'
  263. }]
  264. },{
  265. columnWidth:.5,
  266. layout: 'form',
  267. border:false,
  268. items: [{
  269. xtype:'textfield',
  270. fieldLabel: 'Last Name',
  271. name: 'last',
  272. anchor:'95%'
  273. },{
  274. xtype:'textfield',
  275. fieldLabel: 'Email',
  276. name: 'email',
  277. vtype:'email',
  278. anchor:'95%'
  279. }]
  280. }]
  281. },{
  282. xtype:'tabpanel',
  283. plain:true,
  284. activeTab: 0,
  285. height:235,
  286. /*
  287. By turning off deferred rendering we are guaranteeing that the
  288. form fields within tabs that are not activated will still be rendered.
  289. This is often important when creating multi-tabbed forms.
  290. */
  291. deferredRender: false,
  292. defaults:{bodyStyle:'padding:10px'},
  293. items:[{
  294. title:'Personal Details',
  295. layout:'form',
  296. defaults: {width: 230},
  297. defaultType: 'textfield',
  298. items: [{
  299. fieldLabel: 'First Name',
  300. name: 'first',
  301. allowBlank:false,
  302. value: 'Jack'
  303. },{
  304. fieldLabel: 'Last Name',
  305. name: 'last',
  306. value: 'Slocum'
  307. },{
  308. fieldLabel: 'Company',
  309. name: 'company',
  310. value: 'Ext JS'
  311. }, {
  312. fieldLabel: 'Email',
  313. name: 'email',
  314. vtype:'email'
  315. }]
  316. },{
  317. title:'Phone Numbers',
  318. layout:'form',
  319. defaults: {width: 230},
  320. defaultType: 'textfield',
  321. items: [{
  322. fieldLabel: 'Home',
  323. name: 'home',
  324. value: '(888) 555-1212'
  325. },{
  326. fieldLabel: 'Business',
  327. name: 'business'
  328. },{
  329. fieldLabel: 'Mobile',
  330. name: 'mobile'
  331. },{
  332. fieldLabel: 'Fax',
  333. name: 'fax'
  334. }]
  335. },{
  336. cls:'x-plain',
  337. title:'Biography',
  338. layout:'fit',
  339. items: {
  340. xtype:'htmleditor',
  341. id:'bio2',
  342. fieldLabel:'Biography'
  343. }
  344. }]
  345. }],
  346. buttons: [{
  347. text: 'Save'
  348. },{
  349. text: 'Cancel'
  350. }]
  351. });
  352. tab2.render(document.body);
  353. });