1 |
d2a8c3fd
|
Marc NICOLAS
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
Ext.namespace('sitools.admin.guiservices');
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
Ext.define('sitools.admin.guiservices.GuiServicesCrud', {
|
32 |
|
|
extend : 'Ext.grid.Panel',
|
33 |
|
|
alias : 'widget.s-guiservices',
|
34 |
|
|
border : false,
|
35 |
|
|
height : ADMIN_PANEL_HEIGHT,
|
36 |
|
|
id : ID.BOX.GUISERVICES,
|
37 |
|
|
pageSize : ADMIN_PANEL_NB_ELEMENTS,
|
38 |
|
|
forceFit : true,
|
39 |
|
|
mixins : {
|
40 |
|
|
utils : "sitools.admin.utils.utils"
|
41 |
|
|
},
|
42 |
|
|
|
43 |
|
|
requires : ["sitools.admin.guiservices.GuiServicesStore"
|
44 |
|
|
],
|
45 |
|
|
|
46 |
|
|
initComponent : function () {
|
47 |
|
|
|
48 |
|
|
this.url = loadUrl.get('APP_URL') + loadUrl.get('APP_GUI_SERVICES_URL');
|
49 |
|
|
|
50 |
|
|
this.store = Ext.create("sitools.admin.guiservices.GuiServicesStore", {
|
51 |
|
|
url : this.url,
|
52 |
|
|
pageSize : this.pageSize
|
53 |
|
|
});
|
54 |
|
|
|
55 |
|
|
this.columns = [{
|
56 |
|
|
header : i18n.get('label.name'),
|
57 |
|
|
dataIndex : 'name',
|
58 |
|
|
width : 150,
|
59 |
|
|
sortable : true,
|
60 |
|
|
renderer : function (value, meta, record) {
|
61 |
|
|
meta.style = "font-weight: bold;";
|
62 |
|
|
return value;
|
63 |
|
|
}
|
64 |
|
|
}, {
|
65 |
|
|
header : i18n.get('label.description'),
|
66 |
|
|
dataIndex : 'description',
|
67 |
|
|
width : 250,
|
68 |
|
|
sortable : false
|
69 |
|
|
}, {
|
70 |
|
|
header : i18n.get('label.xtype'),
|
71 |
|
|
dataIndex : 'xtype',
|
72 |
|
|
width : 300,
|
73 |
|
|
sortable : false
|
74 |
|
|
}, {
|
75 |
|
|
xtype : 'checkcolumn',
|
76 |
|
|
header : i18n.get('headers.defaultGuiService'),
|
77 |
|
|
dataIndex : 'defaultGuiService',
|
78 |
|
|
editable : false,
|
79 |
|
|
width : 55,
|
80 |
|
|
processEvent: function () { return false; },
|
81 |
|
|
sortable : false
|
82 |
|
|
}];
|
83 |
|
|
|
84 |
|
|
this.bbar = {
|
85 |
|
|
xtype : 'pagingtoolbar',
|
86 |
|
|
pageSize : this.pageSize,
|
87 |
|
|
store : this.store,
|
88 |
|
|
displayInfo : true,
|
89 |
|
|
displayMsg : i18n.get('paging.display'),
|
90 |
|
|
emptyMsg : i18n.get('paging.empty')
|
91 |
|
|
};
|
92 |
|
|
|
93 |
|
|
this.tbar = {
|
94 |
|
|
xtype : 'toolbar',
|
95 |
|
|
defaults : {
|
96 |
|
|
scope : this
|
97 |
|
|
},
|
98 |
|
|
items : [ {
|
99 |
|
|
text : i18n.get('label.create'),
|
100 |
|
|
icon : loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/icons/toolbar_create.png',
|
101 |
|
|
handler : this._onCreate,
|
102 |
|
|
xtype : 's-menuButton'
|
103 |
|
|
}, {
|
104 |
|
|
text : i18n.get('label.modify'),
|
105 |
|
|
icon : loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/icons/toolbar_edit.png',
|
106 |
|
|
handler : this._onModify,
|
107 |
|
|
xtype : 's-menuButton'
|
108 |
|
|
}, {
|
109 |
|
|
text : i18n.get('label.delete'),
|
110 |
|
|
icon : loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/icons/toolbar_delete.png',
|
111 |
|
|
handler : this._onDelete,
|
112 |
|
|
xtype : 's-menuButton'
|
113 |
|
|
}, '->', {
|
114 |
|
|
xtype : 's-filter',
|
115 |
|
|
emptyText : i18n.get('label.search'),
|
116 |
|
|
store : this.store,
|
117 |
|
|
pageSize : this.pageSize
|
118 |
|
|
} ]
|
119 |
|
|
};
|
120 |
|
|
|
121 |
|
|
this.listeners = {
|
122 |
|
|
scope : this,
|
123 |
|
|
itemdblclick : this._onModify
|
124 |
|
|
};
|
125 |
|
|
|
126 |
|
|
this.selModel = Ext.create('Ext.selection.RowModel', {
|
127 |
|
|
mode : "SINGLE"
|
128 |
|
|
});
|
129 |
|
|
|
130 |
|
|
this.callParent(arguments);
|
131 |
|
|
},
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
onRender : function () {
|
137 |
|
|
this.callParent(arguments);
|
138 |
|
|
this.store.load({
|
139 |
|
|
start : 0,
|
140 |
|
|
limit : this.pageSize
|
141 |
|
|
});
|
142 |
|
|
},
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
_onCreate : function () {
|
149 |
|
|
var dbp = Ext.create("sitools.admin.guiservices.GuiServicesProp", {
|
150 |
|
|
action : 'create',
|
151 |
|
|
store : this.store
|
152 |
|
|
});
|
153 |
|
|
dbp.show(ID.PROP.GUISERVICES);
|
154 |
|
|
},
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
_onModify : function () {
|
161 |
|
|
var rec = this.getLastSelectedRecord();
|
162 |
|
|
if (!rec) {
|
163 |
|
|
return popupMessage("", i18n.get('warning.noselection'), loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/msgBox/16/icon-info.png');;
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
var dbp = Ext.create("sitools.admin.guiservices.GuiServicesProp", {
|
167 |
|
|
action : 'modify',
|
168 |
|
|
store : this.store,
|
169 |
|
|
recordId : rec.data.id
|
170 |
|
|
});
|
171 |
|
|
dbp.show(ID.PROP.GUISERVICES);
|
172 |
|
|
},
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
_onDelete : function () {
|
178 |
|
|
var rec = this.getLastSelectedRecord();
|
179 |
|
|
if (!rec) {
|
180 |
|
|
return false;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
Ext.Msg.show({
|
184 |
|
|
title : i18n.get('label.delete'),
|
185 |
|
|
buttons : Ext.Msg.YESNO,
|
186 |
|
|
msg : Ext.String.format(i18n.get('guiServicesCrud.delete'), rec.get('name')),
|
187 |
|
|
scope : this,
|
188 |
|
|
fn : function (btn, text) {
|
189 |
|
|
if (btn === 'yes') {
|
190 |
|
|
this.doDelete(rec);
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
});
|
194 |
|
|
},
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
doDelete : function (rec) {
|
201 |
|
|
this.store.deleteRecord(rec);
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
});
|