|
1
|
|
|
/** |
|
2
|
|
|
* Query Manager |
|
3
|
|
|
* Copyright (c) Webmatch GmbH |
|
4
|
|
|
* |
|
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
6
|
|
|
* it under the terms of the GNU General Public License as published by |
|
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
8
|
|
|
* (at your option) any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is distributed in the hope that it will be useful, |
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13
|
|
|
* GNU General Public License for more details. |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
//{namespace name=backend/plugins/wbm/querymanager} |
|
17
|
|
|
// |
|
18
|
|
|
Ext.define('Shopware.apps.WbmQueryManager.view.main.List', { |
|
|
|
|
|
|
19
|
|
|
extend:'Ext.grid.Panel', |
|
20
|
|
|
border: false, |
|
21
|
|
|
alias:'widget.query-manager-list', |
|
22
|
|
|
region:'center', |
|
23
|
|
|
autoScroll:true, |
|
24
|
|
|
listeners: { |
|
25
|
|
|
itemclick: function(dv, record, item, rowIndex, e) { |
|
|
|
|
|
|
26
|
|
|
var me = this; |
|
27
|
|
|
me.fireEvent('openQueryDetail', me, rowIndex); |
|
28
|
|
|
} |
|
29
|
|
|
}, |
|
30
|
|
|
initComponent:function () { |
|
31
|
|
|
var me = this; |
|
32
|
|
|
me.registerEvents(); |
|
33
|
|
|
me.columns = me.getColumns(); |
|
34
|
|
|
me.dockedItems = [ |
|
35
|
|
|
{ |
|
36
|
|
|
xtype: 'toolbar', |
|
37
|
|
|
dock: 'top', |
|
38
|
|
|
cls: 'shopware-toolbar', |
|
39
|
|
|
ui: 'shopware-ui', |
|
40
|
|
|
items: me.getButtons() |
|
41
|
|
|
} |
|
42
|
|
|
]; |
|
43
|
|
|
me.callParent(arguments); |
|
44
|
|
|
}, |
|
45
|
|
|
registerEvents:function () { |
|
46
|
|
|
this.addEvents( |
|
47
|
|
|
); |
|
48
|
|
|
return true; |
|
49
|
|
|
}, |
|
50
|
|
|
getColumns:function () { |
|
51
|
|
|
var me = this; |
|
52
|
|
|
return [ |
|
53
|
|
|
{ |
|
54
|
|
|
header: '{s name="nameColumnHeader"}Name{/s}', |
|
55
|
|
|
dataIndex:'name', |
|
56
|
|
|
flex:1 |
|
57
|
|
|
}, |
|
58
|
|
|
{ |
|
59
|
|
|
header: 'C', |
|
60
|
|
|
width:25, |
|
61
|
|
|
dataIndex: 'hasCronjob', |
|
62
|
|
|
xtype: 'booleancolumn', |
|
63
|
|
|
renderer: me.activeColumnRenderer |
|
64
|
|
|
}, |
|
65
|
|
|
{ |
|
66
|
|
|
xtype:'actioncolumn', |
|
67
|
|
|
width:50, |
|
68
|
|
|
items:me.getActionColumnItems() |
|
69
|
|
|
} |
|
70
|
|
|
]; |
|
71
|
|
|
}, |
|
72
|
|
|
getButtons : function() |
|
73
|
|
|
{ |
|
74
|
|
|
var me = this; |
|
75
|
|
|
return [ |
|
76
|
|
|
{ |
|
77
|
|
|
text : '{s name="add"}Hinzufügen{/s}', |
|
78
|
|
|
scope : me, |
|
79
|
|
|
iconCls : 'sprite-plus-circle-frame', |
|
80
|
|
|
action : 'addQuery' |
|
81
|
|
|
} |
|
82
|
|
|
]; |
|
83
|
|
|
}, |
|
84
|
|
|
getActionColumnItems: function () { |
|
85
|
|
|
var me = this; |
|
86
|
|
|
return [ |
|
87
|
|
|
{ |
|
88
|
|
|
iconCls:'x-action-col-icon sprite-minus-circle-frame', |
|
89
|
|
|
cls:'duplicateColumn', |
|
90
|
|
|
tooltip:'{s name="delete"}Löschen{/s}', |
|
91
|
|
|
getClass: function(value, metadata, record) { |
|
92
|
|
|
if (!record.get("id")) { |
|
|
|
|
|
|
93
|
|
|
return 'x-hidden'; |
|
94
|
|
|
} |
|
95
|
|
|
}, |
|
96
|
|
|
handler:function (view, rowIndex, colIndex, item) { |
|
97
|
|
|
me.fireEvent('deleteQuery', view, rowIndex, colIndex, item); |
|
98
|
|
|
} |
|
99
|
|
|
}, |
|
100
|
|
|
{ |
|
101
|
|
|
iconCls:'x-action-col-icon sprite-blue-document-copy', |
|
102
|
|
|
cls:'duplicateColumn', |
|
103
|
|
|
tooltip:'{s name="duplicate"}Duplizieren{/s}', |
|
104
|
|
|
getClass: function(value, metadata, record) { |
|
105
|
|
|
if (!record.get("id")) { |
|
|
|
|
|
|
106
|
|
|
return 'x-hidden'; |
|
107
|
|
|
} |
|
108
|
|
|
}, |
|
109
|
|
|
handler:function (view, rowIndex, colIndex, item) { |
|
110
|
|
|
me.fireEvent('cloneQuery', view, rowIndex, colIndex, item); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
]; |
|
114
|
|
|
}, |
|
115
|
|
|
activeColumnRenderer: function(value) { |
|
116
|
|
|
if (value) { |
|
117
|
|
|
return '<div class="sprite-tick-small"> </div>'; |
|
118
|
|
|
} else { |
|
119
|
|
|
return '<div class="sprite-cross-small"> </div>'; |
|
120
|
|
|
} |
|
121
|
|
|
} |
|
122
|
|
|
}); |
|
123
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.