Validate the code as submitted, not as it is in the database
[L-seed.git] / web / php / page / myplants.pg
1 {
2         id: 'ContentPanel_myplants'
3         ,closable: true
4         ,style: 'padding: 5px;'
5         ,title: 'Meine Pflanzen'
6         ,layout: 'fit'
7         ,items: [{
8                 id: "plantlistgrid"
9                 ,title: "Saisons"
10                 ,xtype: 'grid'
11                 ,autoExpandColumn: 'Code'
12                 ,view: new Ext.grid.GroupingView({
13                         markDirty: false  
14                 })
15                 ,tbar: [{
16                         id: 'plantlistDeletePlant'
17                         ,text: 'Delete'
18                         ,icon: 'img/icons/cross.png'
19                         ,cls: 'x-btn-text-icon'
20                         ,disabled: true
21                         ,handler: function(){
22                                 var grid = Ext.getCmp("plantlistgrid");
23                                 var s = grid.getSelectionModel().getSelections();
24                                 for(var i = 0, r; r = s[i]; i++) {
25                                     grid.getStore().remove(r);
26                                 }
27                         }
28                 },{
29                         id: 'plantlistCheckPlantSyntax'
30                         ,text: 'Check Syntax'
31                         ,icon: 'img/icons/accept.png'
32                         ,cls: 'x-btn-text-icon'
33                         ,disabled: true
34                         ,handler: editor.CheckSyntax.createDelegate(editor, ['plantlistgrid'], true)
35                 },{
36                         id: 'plantlistActivatePlant'
37                         ,text: 'Activate'
38                         ,icon: 'img/icons/award.png'
39                         ,cls: 'x-btn-text-icon'
40                         ,disabled: true
41                         ,handler: function(){
42                                 var grid = Ext.getCmp("plantlistgrid");
43                                 var selected = grid.getSelectionModel().getSelections();
44                                 if(selected.length > 0) {
45                                     editor.Activate(selected[0]);
46                                 }
47                         }
48                 },{
49                         id: 'plantlistEditPlant'
50                         ,text: 'Edit'
51                         ,icon: 'img/icons/edit.png'
52                         ,cls: 'x-btn-text-icon'
53                         ,disabled: true
54                         ,handler: function(){
55                                 var grid = Ext.getCmp("plantlistgrid");
56                                 var selected = grid.getSelectionModel().getSelections();
57                                 if(selected.length > 0) {
58                                     editor.Edit(selected[0]);
59                                 }
60                         }
61                 },{
62                         id: 'plantlistRefresh'
63                         ,text: 'Refresh'
64                         ,icon: 'img/icons/arrow_refresh.png'
65                         ,cls: 'x-btn-text-icon'
66                         ,handler: communication.GetPlantList.createDelegate(communication)
67                 }]
68                 ,store: new Ext.data.GroupingStore({
69                         reader: new Ext.data.JsonReader({fields: Lseed.Plant})
70                         ,sortInfo: {field: 'Name', direction: 'ASC'}
71                         ,data: []
72                         ,listeners: {
73                                 add: function(sender, records, index) {
74                                 },
75                                 remove: function(sender, record, index) {
76                                         editor.Delete(record);
77                                 },
78                                 update: function(sender, record, operation) {
79                                         if (operation == Ext.data.Record.EDIT) {
80                                         } else if (Ext.data.Record.REJECT) {
81                                         } else if (Ext.data.Record.COMMIT) {
82                                         }
83                                 }
84                         }
85                 })
86                 ,columns: [
87                         new Ext.grid.RowNumberer()
88                         ,{
89                                 id: 'ID'
90                                 ,header: 'ID'
91                                 ,width: 200
92                                 ,sortable: true
93                                 ,dataIndex: 'ID'
94                         },{
95                                 id: 'Name'
96                                 ,header: 'Name'
97                                 ,width: 200
98                                 ,sortable: true
99                                 ,dataIndex: 'Name'
100                         },{
101                                 id: 'Code'
102                                 ,header: 'Code'
103                                 ,width: 200
104                                 ,sortable: true
105                                 ,dataIndex: 'Code'
106                                 ,editor: {
107                                         xtype: 'textfield'
108                                         ,allowBlank: true
109                                 }
110                         },{
111                                 id: 'IsActive'
112                                 ,header: 'IsActive'
113                                 ,width: 200
114                                 ,sortable: true
115                                 ,dataIndex: 'IsActive'
116                         }
117                 ]
118                 ,sm: new Ext.grid.RowSelectionModel({
119                         singleSelect:true
120                         ,listeners: {
121                                 rowselect: function() {
122                                         Ext.getCmp("plantlistDeletePlant").enable();
123                                         Ext.getCmp("plantlistCheckPlantSyntax").enable();
124                                         Ext.getCmp("plantlistActivatePlant").enable();
125                                         Ext.getCmp("plantlistEditPlant").enable();
126                                 }
127                                 ,rowdeselect: function() {
128                                         Ext.getCmp("plantlistDeletePlant").disable();
129                                         Ext.getCmp("plantlistCheckPlantSyntax").disable();
130                                         Ext.getCmp("plantlistActivatePlant").disable();
131                                         Ext.getCmp("plantlistEditPlant").disable();
132                                 }
133                         }
134                 })
135         }]
136         ,listeners: {
137                 show: communication.GetPlantList.createDelegate(communication)
138         }
139 }