8e29d8c019ffee5b58845171d7d4072cc9b96588
[L-seed.git] / web / php / page / createplant.pg
1 {
2         id: 'ContentPanel_createplant'
3         ,closable: true
4         ,style: 'padding: 5px;'
5         ,title: 'Neue Pflanze erstellen'
6         ,layout: 'form'
7         ,labelWidth: 100
8         ,baseCls: 'x-plain'
9         ,bodyStyle:'padding:5px;'
10         ,defaults: {
11                 bodyStyle:'padding:5px;'
12         }
13         ,tbar: [{
14                 text: "Save"
15                 ,icon: 'img/icons/disk.png'
16                 ,cls: 'x-btn-text-icon'
17                 ,handler: function() {
18                         var namefield = Ext.getCmp("plantdefinitionnamefield");
19                         var planteditor = Ext.getCmp("plantdefinitioneditor");
20                         if (namefield.isValid()) {
21                         
22                                 var plant = new Lseed.Plant({
23                                         Name: namefield.getValue() 
24                                         ,Code: planteditor.getValue()
25                                 });
26                                 editor.Save(plant);
27                         } else {
28                                 communication.showMessage("Ihre Pflanze benötigt einen Namen.", "error");
29                         }
30                 }
31         },{
32                 text: "Test"
33                 ,icon: 'img/icons/magnifier.png'
34                 ,cls: 'x-btn-text-icon'
35                 ,handler: editor.Test.createDelegate(editor)
36         },{
37                 text: "CheckSyntax"
38                 ,icon: 'img/icons/accept.png'
39                 ,cls: 'x-btn-text-icon'
40                 ,handler: editor.CheckSyntax.createDelegate(editor)
41         }]
42         ,items: [{
43                 id: "plantdefinitionnamefield"
44                 ,xtype: 'textfield'
45                 ,name: 'name'
46                 ,allowBlank: false
47                 ,fieldLabel: 'Name der Pflanze'
48                 ,anchor:'100%'
49                 ,enableKeyEvents: true
50                 ,listeners: {
51                         keyup: editor.NameChanged.createDelegate(editor)
52                 }
53         },{
54                 id: "plantdefinitioneditor"
55                 ,xtype: 'textarea'
56                 ,name: 'code'
57                 ,fieldLabel: 'Pflanzendefinition'
58                 ,anchor:'100% -50'
59                 ,enableKeyEvents: true
60                 ,listeners: {
61                         keyup: editor.DefinitionChanged.createDelegate(editor)
62                 }
63                 ,value: 'RULE "MyRule"\nGROW BY 1'
64         }]
65 }