knitkit 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +5 -8
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +11 -8
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +26 -4
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +49 -35
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +30 -21
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +41 -32
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +0 -6
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +42 -6
- data/app/{models → mailers}/website_inquiry_mailer.rb +0 -0
- data/app/models/article.rb +4 -0
- data/app/models/content.rb +0 -4
- data/app/models/theme.rb +3 -3
- data/app/models/website.rb +44 -17
- data/app/views/knitkit/website_sections/index.html.erb +1 -1
- data/app/views/layouts/knitkit/base.html.erb +6 -0
- data/app/views/shared/knitkit/_footer.html.erb +2 -2
- data/app/widgets/signup/base.rb +0 -2
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +77 -0
- data/lib/knitkit/engine.rb +4 -0
- data/lib/knitkit/extensions.rb +4 -1
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +36 -33
- data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +60 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +9 -4
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +1 -1
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +21 -1
- data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +26 -0
- data/lib/knitkit/extensions/railties/action_view/base.rb +11 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +62 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +83 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/knitkit_helper.rb +67 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +71 -0
- data/lib/knitkit/version.rb +1 -1
- data/public/images/knitkit/close.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +150 -400
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +687 -593
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +1 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +39 -15
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +65 -126
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +65 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +265 -183
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +24 -9
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +631 -595
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +265 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +133 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +174 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +399 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +165 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +266 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +1224 -0
- data/public/javascripts/knitkit/inline_editing.js +136 -0
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +1 -2
- data/public/stylesheets/knitkit/inline_editing.css +88 -0
- data/public/stylesheets/knitkit/style.css +1 -1
- metadata +47 -31
- data/lib/knitkit/extensions/railties/action_view.rb +0 -199
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +0 -2725
@@ -251,6 +251,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel",{
|
|
251
251
|
config = Ext.apply({
|
252
252
|
autoLoadRoot:true,
|
253
253
|
rootVisible:true,
|
254
|
+
multiSelect:true,
|
254
255
|
title:'Themes',
|
255
256
|
rootText:'Websites',
|
256
257
|
controllerPath:'/knitkit/erp_app/desktop/theme',
|
@@ -258,49 +259,63 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel",{
|
|
258
259
|
allowDownload:true,
|
259
260
|
addViewContentsToContextMenu:true,
|
260
261
|
standardUploadUrl:'/knitkit/erp_app/desktop/theme/upload_file',
|
261
|
-
xhrUploadUrl:'/knitkit/erp_app/desktop/theme/upload_file',
|
262
262
|
url:'/knitkit/erp_app/desktop/theme/index',
|
263
263
|
fields:[
|
264
264
|
{
|
265
265
|
name:'isTheme'
|
266
266
|
},
|
267
|
-
|
268
267
|
{
|
269
268
|
name:'isActive'
|
270
269
|
},
|
271
|
-
|
272
270
|
{
|
273
271
|
name:'siteId'
|
274
272
|
},
|
275
|
-
|
276
273
|
{
|
277
274
|
name:'text'
|
278
275
|
},
|
279
|
-
|
280
276
|
{
|
281
277
|
name:'id'
|
282
278
|
},
|
283
|
-
|
279
|
+
{
|
280
|
+
name:'url'
|
281
|
+
},
|
284
282
|
{
|
285
283
|
name:'leaf'
|
286
284
|
},
|
287
|
-
|
288
285
|
{
|
289
286
|
name:'handleContextMenu'
|
290
287
|
},
|
291
|
-
|
292
288
|
{
|
293
289
|
name:'contextMenuDisabled'
|
294
290
|
}
|
295
291
|
],
|
296
292
|
containerScroll: true,
|
297
293
|
listeners:{
|
294
|
+
'load':function(store){
|
295
|
+
store.getRootNode().expandChildren();
|
296
|
+
store.getRootNode().eachChild(function(child){
|
297
|
+
child.expandChildren();
|
298
|
+
});
|
299
|
+
},
|
300
|
+
'showImage':function(fileManager, node, themeId){
|
301
|
+
var themeId = null;
|
302
|
+
var themeNode = node;
|
303
|
+
while(themeId == null && !Compass.ErpApp.Utility.isBlank(themeNode.parentNode)){
|
304
|
+
if(themeNode.data.isTheme){
|
305
|
+
themeId = themeNode.data.id;
|
306
|
+
}
|
307
|
+
else{
|
308
|
+
themeNode = themeNode.parentNode;
|
309
|
+
}
|
310
|
+
}
|
311
|
+
self.initialConfig['centerRegion'].showImage(node, themeId);
|
312
|
+
},
|
298
313
|
'contentLoaded':function(fileManager, node, content){
|
299
314
|
var themeId = null;
|
300
315
|
var themeNode = node;
|
301
316
|
while(themeId == null && !Compass.ErpApp.Utility.isBlank(themeNode.parentNode)){
|
302
317
|
if(themeNode.data.isTheme){
|
303
|
-
themeId = themeNode.data.id
|
318
|
+
themeId = themeNode.data.id;
|
304
319
|
}
|
305
320
|
else{
|
306
321
|
themeNode = themeNode.parentNode;
|
@@ -1,182 +1,190 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
},
|
7
|
-
|
8
|
-
constructor : function(config) {
|
9
|
-
var overiddenColumns = [
|
10
|
-
{
|
11
|
-
header:'Version',
|
12
|
-
dataIndex:'version',
|
13
|
-
sortable:true,
|
14
|
-
width:50
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel", {
|
2
|
+
extend:"Ext.grid.Panel",
|
3
|
+
initComponent:function () {
|
4
|
+
this.callParent(arguments);
|
5
|
+
this.getStore().load();
|
15
6
|
},
|
16
|
-
{
|
17
|
-
header:'Timestamp',
|
18
|
-
dataIndex:'updated_at',
|
19
|
-
sortable:true,
|
20
|
-
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s'),
|
21
|
-
width:120
|
22
|
-
},
|
23
|
-
{
|
24
|
-
header:'Published By',
|
25
|
-
dataIndex: 'publisher'
|
26
|
-
}];
|
27
|
-
|
28
|
-
if(!Compass.ErpApp.Utility.isBlank(config['columns'])){
|
29
|
-
overiddenColumns = overiddenColumns.concat(config['columns']);
|
30
|
-
}
|
31
7
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
8
|
+
constructor:function (config) {
|
9
|
+
var overiddenColumns = [
|
10
|
+
{
|
11
|
+
header:'Version',
|
12
|
+
dataIndex:'version',
|
13
|
+
sortable:true,
|
14
|
+
width:50
|
15
|
+
},
|
16
|
+
{
|
17
|
+
header:'Timestamp',
|
18
|
+
dataIndex:'updated_at',
|
19
|
+
sortable:true,
|
20
|
+
renderer:Ext.util.Format.dateRenderer('m/d/Y H:i:s'),
|
21
|
+
width:120
|
22
|
+
},
|
23
|
+
{
|
24
|
+
header:'Published By',
|
25
|
+
dataIndex:'publisher'
|
26
|
+
}
|
27
|
+
];
|
28
|
+
|
29
|
+
if (!Compass.ErpApp.Utility.isBlank(config['columns'])) {
|
30
|
+
overiddenColumns = overiddenColumns.concat(config['columns']);
|
46
31
|
}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
},
|
65
|
-
{
|
66
|
-
menuDisabled:true,
|
67
|
-
resizable:false,
|
68
|
-
xtype:'actioncolumn',
|
69
|
-
header:'Published',
|
70
|
-
align:'center',
|
71
|
-
width:60,
|
72
|
-
items:[{
|
73
|
-
getClass: function(v, meta, rec) { // Or return a class from a function
|
74
|
-
if (rec.get('published')) {
|
75
|
-
this.items[0].tooltip = 'Published';
|
76
|
-
return 'published-col';
|
77
|
-
} else {
|
78
|
-
this.items[0].tooltip = 'Publish';
|
79
|
-
return 'publish-col';
|
80
|
-
}
|
81
|
-
},
|
82
|
-
handler: function(grid, rowIndex, colIndex) {
|
83
|
-
var rec = grid.getStore().getAt(rowIndex);
|
84
|
-
if(rec.get('published')){
|
85
|
-
return false;
|
32
|
+
|
33
|
+
overiddenColumns = overiddenColumns.concat([
|
34
|
+
{
|
35
|
+
menuDisabled:true,
|
36
|
+
resizable:false,
|
37
|
+
xtype:'actioncolumn',
|
38
|
+
header:'View',
|
39
|
+
align:'center',
|
40
|
+
width:60,
|
41
|
+
items:[
|
42
|
+
{
|
43
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
44
|
+
tooltip:'View',
|
45
|
+
handler:function (grid, rowIndex, colIndex) {
|
46
|
+
var rec = grid.getStore().getAt(rowIndex);
|
47
|
+
grid.ownerCt.viewVersionedContent(rec);
|
48
|
+
}
|
86
49
|
}
|
87
|
-
|
88
|
-
|
50
|
+
]
|
51
|
+
},
|
52
|
+
{
|
53
|
+
menuDisabled:true,
|
54
|
+
resizable:false,
|
55
|
+
xtype:'actioncolumn',
|
56
|
+
header:'Revert',
|
57
|
+
align:'center',
|
58
|
+
width:60,
|
59
|
+
items:[
|
60
|
+
{
|
61
|
+
icon:'/images/icons/document_down/document_down_16x16.png',
|
62
|
+
tooltip:'Revert',
|
63
|
+
handler:function (grid, rowIndex, colIndex) {
|
64
|
+
var rec = grid.getStore().getAt(rowIndex);
|
65
|
+
grid.ownerCt.revert(rec);
|
66
|
+
}
|
89
67
|
}
|
68
|
+
]
|
69
|
+
},
|
70
|
+
{
|
71
|
+
menuDisabled:true,
|
72
|
+
resizable:false,
|
73
|
+
xtype:'actioncolumn',
|
74
|
+
header:'Published',
|
75
|
+
align:'center',
|
76
|
+
width:60,
|
77
|
+
items:[
|
78
|
+
{
|
79
|
+
getClass:function (v, meta, rec) { // Or return a class from a function
|
80
|
+
if (rec.get('published')) {
|
81
|
+
this.items[0].tooltip = 'Published';
|
82
|
+
return 'published-col';
|
83
|
+
} else {
|
84
|
+
this.items[0].tooltip = 'Publish';
|
85
|
+
return 'publish-col';
|
86
|
+
}
|
87
|
+
},
|
88
|
+
handler:function (grid, rowIndex, colIndex) {
|
89
|
+
var rec = grid.getStore().getAt(rowIndex);
|
90
|
+
if (rec.get('published')) {
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
grid.ownerCt.publish(rec)
|
95
|
+
}
|
90
96
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
97
|
+
}
|
98
|
+
}
|
99
|
+
]
|
100
|
+
},
|
101
|
+
{
|
102
|
+
header:'Active',
|
103
|
+
dataIndex:'active',
|
104
|
+
sortable:true,
|
105
|
+
align:'center',
|
106
|
+
width:60,
|
107
|
+
renderer:function () {
|
108
|
+
var rec = arguments[2];
|
109
|
+
if (rec.get('active')) {
|
110
|
+
return '<img class="x-action-col-0 active-col" ext:qtip="Active" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="">'
|
111
|
+
}
|
112
|
+
else {
|
113
|
+
return '<img class="x-action-col-0 activate-col" ext:qtip="Not Active" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="">'
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
]);
|
118
|
+
|
119
|
+
config['columns'] = overiddenColumns;
|
120
|
+
config = Ext.apply({
|
121
|
+
collapsed:true,
|
122
|
+
bbar:Ext.create("Ext.PagingToolbar", {
|
123
|
+
pageSize:15,
|
124
|
+
title: 'Version History',
|
125
|
+
store:config['store'],
|
126
|
+
displayInfo:true,
|
127
|
+
displayMsg:'{0} - {1} of {2}',
|
128
|
+
emptyMsg:"Empty"
|
129
|
+
})
|
130
|
+
}, config);
|
131
|
+
|
132
|
+
this.callParent([config]);
|
109
133
|
}
|
110
|
-
]);
|
111
|
-
|
112
|
-
config['columns'] = overiddenColumns;
|
113
|
-
config = Ext.apply({
|
114
|
-
bbar: Ext.create("Ext.PagingToolbar",{
|
115
|
-
pageSize: 15,
|
116
|
-
store: config['store'],
|
117
|
-
displayInfo: true,
|
118
|
-
displayMsg: '{0} - {1} of {2}',
|
119
|
-
emptyMsg: "Empty"
|
120
|
-
})
|
121
|
-
}, config);
|
122
|
-
|
123
|
-
this.callParent([config]);
|
124
|
-
}
|
125
134
|
});
|
126
135
|
|
127
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsArticleGridPanel",{
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
136
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsArticleGridPanel", {
|
137
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",
|
138
|
+
alias:'widget.knitkit_versionsarticlegridpanel',
|
139
|
+
viewVersionedContent:function (rec) {
|
140
|
+
this.initialConfig['centerRegion'].viewContent(rec.get('title') + " - Revision " + rec.get('version'), rec.get('body_html'));
|
141
|
+
},
|
133
142
|
|
134
|
-
|
143
|
+
revert:function (rec) {
|
135
144
|
if (currentUser.hasApplicationCapability('knitkit', {
|
136
145
|
capability_type_iid:'revert_version',
|
137
146
|
resource:'Article'
|
138
|
-
}))
|
139
|
-
{
|
147
|
+
})) {
|
140
148
|
var self = this;
|
141
149
|
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
142
|
-
|
143
|
-
|
144
|
-
url:
|
145
|
-
method:
|
150
|
+
|
151
|
+
Ext.Ajax.request({
|
152
|
+
url:'/knitkit/erp_app/desktop/versions/revert_content',
|
153
|
+
method:'POST',
|
146
154
|
params:{
|
147
155
|
id:rec.get('id'),
|
148
156
|
version:rec.get('version')
|
149
157
|
},
|
150
|
-
success:
|
151
|
-
|
152
|
-
var obj =
|
153
|
-
if(obj.success){
|
158
|
+
success:function (response) {
|
159
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
160
|
+
var obj = Ext.decode(response.responseText);
|
161
|
+
if (obj.success) {
|
154
162
|
self.initialConfig['centerRegion'].replaceHtmlInActiveCkEditor(rec.get('body_html'));
|
155
163
|
self.getStore().load();
|
156
164
|
}
|
157
|
-
else{
|
165
|
+
else {
|
158
166
|
Ext.Msg.alert('Error', 'Error reverting');
|
159
167
|
}
|
160
168
|
},
|
161
|
-
failure:
|
169
|
+
failure:function (response) {
|
162
170
|
self.initialConfig['centerRegion'].clearWindowStatus();
|
163
171
|
Ext.Msg.alert('Error', 'Error reverting');
|
164
172
|
}
|
165
173
|
});
|
174
|
+
|
166
175
|
} else {
|
167
176
|
currentUser.showInvalidAccess();
|
168
177
|
}
|
169
178
|
},
|
170
|
-
|
171
|
-
publish:
|
179
|
+
|
180
|
+
publish:function (rec) {
|
172
181
|
if (currentUser.hasApplicationCapability('knitkit', {
|
173
182
|
capability_type_iid:'publish',
|
174
183
|
resource:'Article'
|
175
|
-
}))
|
176
|
-
{
|
184
|
+
})) {
|
177
185
|
var self = this;
|
178
186
|
|
179
|
-
var publishWindow = new Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow
|
187
|
+
var publishWindow = new Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow',{
|
180
188
|
baseParams:{
|
181
189
|
id:rec.get('id'),
|
182
190
|
site_id:self.initialConfig.siteId,
|
@@ -184,17 +192,17 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsArticleGridPanel
|
|
184
192
|
},
|
185
193
|
url:'/knitkit/erp_app/desktop/versions/publish_content',
|
186
194
|
listeners:{
|
187
|
-
'publish_success':function(window, response){
|
188
|
-
if(response.success){
|
195
|
+
'publish_success':function (window, response) {
|
196
|
+
if (response.success) {
|
189
197
|
self.initialConfig['centerRegion'].clearWindowStatus();
|
190
198
|
self.getStore().load();
|
191
199
|
}
|
192
|
-
else{
|
200
|
+
else {
|
193
201
|
Ext.Msg.alert('Error', 'Error publishing');
|
194
202
|
self.initialConfig['centerRegion'].clearWindowStatus();
|
195
203
|
}
|
196
204
|
},
|
197
|
-
'publish_failure':function(window, response){
|
205
|
+
'publish_failure':function (window, response) {
|
198
206
|
self.initialConfig['centerRegion'].clearWindowStatus();
|
199
207
|
Ext.Msg.alert('Error', 'Error publishing');
|
200
208
|
}
|
@@ -207,465 +215,493 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsArticleGridPanel
|
|
207
215
|
}
|
208
216
|
},
|
209
217
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
218
|
+
constructor:function (config) {
|
219
|
+
config = Ext.apply({
|
220
|
+
title: 'Version History',
|
221
|
+
store:Ext.create("Ext.data.Store", {
|
222
|
+
proxy:{
|
223
|
+
type:'ajax',
|
224
|
+
url:'/knitkit/erp_app/desktop/versions/content_versions',
|
225
|
+
reader:{
|
226
|
+
type:'json',
|
227
|
+
root:'data'
|
228
|
+
},
|
229
|
+
extraParams:{
|
230
|
+
id:config['contentId'],
|
231
|
+
site_id:config['siteId']
|
232
|
+
}
|
233
|
+
},
|
234
|
+
idProperty:'id',
|
235
|
+
remoteSort:true,
|
236
|
+
fields:[
|
237
|
+
{
|
238
|
+
name:'published'
|
239
|
+
},
|
240
|
+
{
|
241
|
+
name:'id'
|
242
|
+
},
|
243
|
+
{
|
244
|
+
name:'version'
|
245
|
+
},
|
246
|
+
{
|
247
|
+
name:'title'
|
248
|
+
},
|
249
|
+
{
|
250
|
+
name:'excerpt_html'
|
251
|
+
},
|
252
|
+
{
|
253
|
+
name:'body_html'
|
254
|
+
},
|
255
|
+
{
|
256
|
+
name:'active'
|
257
|
+
},
|
258
|
+
{
|
259
|
+
name:'updated_at',
|
260
|
+
type:'date'
|
261
|
+
},
|
262
|
+
{
|
263
|
+
name:'publisher'
|
264
|
+
}
|
265
|
+
]
|
266
|
+
})
|
267
|
+
}, config);
|
259
268
|
|
260
|
-
|
261
|
-
|
269
|
+
this.callParent([config]);
|
270
|
+
}
|
262
271
|
});
|
263
272
|
|
264
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsBlogGridPanel",{
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
var publishWindow = new Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow({
|
304
|
-
baseParams:{
|
305
|
-
id:rec.get('id'),
|
306
|
-
site_id:self.initialConfig.siteId,
|
307
|
-
version:rec.get('version')
|
308
|
-
},
|
309
|
-
url:'/knitkit/erp_app/desktop/versions/publish_content',
|
310
|
-
listeners:{
|
311
|
-
'publish_success':function(window, response){
|
312
|
-
if(response.success){
|
313
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
314
|
-
self.getStore().load();
|
315
|
-
}
|
316
|
-
else{
|
317
|
-
Ext.Msg.alert('Error', 'Error publishing');
|
318
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
319
|
-
}
|
320
|
-
},
|
321
|
-
'publish_failure':function(window, response){
|
322
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
323
|
-
Ext.Msg.alert('Error', 'Error publishing');
|
324
|
-
}
|
325
|
-
}
|
326
|
-
});
|
327
|
-
|
328
|
-
publishWindow.show();
|
329
|
-
},
|
330
|
-
|
331
|
-
constructor : function(config) {
|
332
|
-
config = Ext.apply({
|
333
|
-
store:Ext.create("Ext.data.Store",{
|
334
|
-
proxy: {
|
335
|
-
type: 'ajax',
|
336
|
-
url:'/knitkit/erp_app/desktop/versions/content_versions',
|
337
|
-
reader: {
|
338
|
-
type: 'json',
|
339
|
-
root: 'data'
|
340
|
-
},
|
341
|
-
extraParams:{
|
342
|
-
id:config['contentId'],
|
343
|
-
site_id:config['siteId']
|
344
|
-
}
|
345
|
-
},
|
346
|
-
idProperty: 'id',
|
347
|
-
remoteSort: true,
|
348
|
-
fields: [
|
349
|
-
{
|
350
|
-
name:'id'
|
351
|
-
},
|
352
|
-
{
|
353
|
-
name:'version'
|
354
|
-
},
|
355
|
-
{
|
356
|
-
name:'title'
|
357
|
-
},
|
358
|
-
{
|
359
|
-
name:'excerpt_html'
|
360
|
-
},
|
361
|
-
{
|
362
|
-
name:'body_html'
|
363
|
-
},
|
364
|
-
{
|
365
|
-
name:'active'
|
366
|
-
},
|
367
|
-
{
|
368
|
-
name:'updated_at',
|
369
|
-
type:'date'
|
370
|
-
},
|
371
|
-
{
|
372
|
-
name:'published'
|
373
|
-
},
|
374
|
-
{
|
375
|
-
name:'publisher'
|
273
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsBlogGridPanel", {
|
274
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",
|
275
|
+
alias:'widget.knitkit_versionsbloggridpanel',
|
276
|
+
|
277
|
+
viewVersionedContent:function (rec) {
|
278
|
+
this.initialConfig['centerRegion'].viewContent(rec.get('title') + " - Revision " + rec.get('version'), rec.get('body_html'));
|
279
|
+
},
|
280
|
+
|
281
|
+
revert:function (rec) {
|
282
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
283
|
+
capability_type_iid:'revert_version',
|
284
|
+
resource:'Article'
|
285
|
+
})) {
|
286
|
+
var self = this;
|
287
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
288
|
+
Ext.Ajax.request({
|
289
|
+
url:'/knitkit/erp_app/desktop/versions/revert_content',
|
290
|
+
method:'POST',
|
291
|
+
params:{
|
292
|
+
id:rec.get('id'),
|
293
|
+
version:rec.get('version')
|
294
|
+
},
|
295
|
+
success:function (response) {
|
296
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
297
|
+
var obj = Ext.decode(response.responseText);
|
298
|
+
if (obj.success) {
|
299
|
+
self.initialConfig['centerRegion'].replaceHtmlInActiveCkEditor(rec.get('body_html'));
|
300
|
+
self.getStore().load();
|
301
|
+
}
|
302
|
+
else {
|
303
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
304
|
+
}
|
305
|
+
},
|
306
|
+
failure:function (response) {
|
307
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
308
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
309
|
+
}
|
310
|
+
});
|
376
311
|
}
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
312
|
+
},
|
313
|
+
|
314
|
+
publish:function (rec) {
|
315
|
+
var self = this;
|
316
|
+
|
317
|
+
var publishWindow = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow',{
|
318
|
+
baseParams:{
|
319
|
+
id:rec.get('id'),
|
320
|
+
site_id:self.initialConfig.siteId,
|
321
|
+
version:rec.get('version')
|
322
|
+
},
|
323
|
+
url:'/knitkit/erp_app/desktop/versions/publish_content',
|
324
|
+
listeners:{
|
325
|
+
'publish_success':function (window, response) {
|
326
|
+
if (response.success) {
|
327
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
328
|
+
self.getStore().load();
|
329
|
+
}
|
330
|
+
else {
|
331
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
332
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
333
|
+
}
|
334
|
+
},
|
335
|
+
'publish_failure':function (window, response) {
|
336
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
337
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
338
|
+
}
|
339
|
+
}
|
340
|
+
});
|
341
|
+
|
342
|
+
publishWindow.show();
|
343
|
+
},
|
344
|
+
|
345
|
+
constructor:function (config) {
|
346
|
+
config = Ext.apply({
|
347
|
+
title: 'Version History',
|
348
|
+
store:Ext.create("Ext.data.Store", {
|
349
|
+
proxy:{
|
350
|
+
type:'ajax',
|
351
|
+
url:'/knitkit/erp_app/desktop/versions/content_versions',
|
352
|
+
reader:{
|
353
|
+
type:'json',
|
354
|
+
root:'data'
|
355
|
+
},
|
356
|
+
extraParams:{
|
357
|
+
id:config['contentId'],
|
358
|
+
site_id:config['siteId']
|
359
|
+
}
|
360
|
+
},
|
361
|
+
idProperty:'id',
|
362
|
+
remoteSort:true,
|
363
|
+
fields:[
|
364
|
+
{
|
365
|
+
name:'id'
|
366
|
+
},
|
367
|
+
{
|
368
|
+
name:'version'
|
369
|
+
},
|
370
|
+
{
|
371
|
+
name:'title'
|
372
|
+
},
|
373
|
+
{
|
374
|
+
name:'excerpt_html'
|
375
|
+
},
|
376
|
+
{
|
377
|
+
name:'body_html'
|
378
|
+
},
|
379
|
+
{
|
380
|
+
name:'active'
|
381
|
+
},
|
382
|
+
{
|
383
|
+
name:'updated_at',
|
384
|
+
type:'date'
|
385
|
+
},
|
386
|
+
{
|
387
|
+
name:'published'
|
388
|
+
},
|
389
|
+
{
|
390
|
+
name:'publisher'
|
391
|
+
}
|
392
|
+
]
|
393
|
+
}),
|
394
|
+
columns:[
|
395
|
+
{
|
396
|
+
menuDisabled:true,
|
397
|
+
resizable:false,
|
398
|
+
xtype:'actioncolumn',
|
399
|
+
header:'Excerpt',
|
400
|
+
align:'center',
|
401
|
+
width:50,
|
402
|
+
items:[
|
403
|
+
{
|
404
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
405
|
+
tooltip:'View',
|
406
|
+
handler:function (grid, rowIndex, colIndex) {
|
407
|
+
var rec = grid.getStore().getAt(rowIndex);
|
408
|
+
grid.initialConfig['centerRegion'].viewContent(rec.get('title') + " Excerpt - Revision " + rec.get('version'), rec.get('body_html'));
|
409
|
+
}
|
410
|
+
}
|
411
|
+
]
|
412
|
+
}
|
413
|
+
]
|
414
|
+
}, config);
|
415
|
+
|
416
|
+
this.callParent([config]);
|
417
|
+
}
|
400
418
|
});
|
401
419
|
|
402
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsWebsiteSectionGridPanel",{
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
var publishWindow = new Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow({
|
460
|
-
baseParams:{
|
461
|
-
id:rec.get('id'),
|
462
|
-
site_id:self.initialConfig.siteId,
|
463
|
-
version:rec.get('version')
|
464
|
-
},
|
465
|
-
url:'/knitkit/erp_app/desktop/versions/publish_website_section',
|
466
|
-
listeners:{
|
467
|
-
'publish_success':function(window, response){
|
468
|
-
if(response.success){
|
469
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
470
|
-
self.getStore().load();
|
471
|
-
}
|
472
|
-
else{
|
473
|
-
Ext.Msg.alert('Error', 'Error publishing');
|
474
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
475
|
-
}
|
476
|
-
},
|
477
|
-
'publish_failure':function(window, response){
|
478
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
479
|
-
Ext.Msg.alert('Error', 'Error publishing');
|
480
|
-
}
|
481
|
-
}
|
482
|
-
});
|
483
|
-
|
484
|
-
publishWindow.show();
|
485
|
-
},
|
486
|
-
|
487
|
-
constructor : function(config) {
|
488
|
-
config = Ext.apply({
|
489
|
-
store:Ext.create("Ext.data.Store",{
|
490
|
-
proxy: {
|
491
|
-
type: 'ajax',
|
492
|
-
url:'/knitkit/erp_app/desktop/versions/website_section_layout_versions',
|
493
|
-
reader: {
|
494
|
-
type: 'json',
|
495
|
-
root: 'data'
|
496
|
-
},
|
497
|
-
extraParams:{
|
498
|
-
id:config['websiteSectionId'],
|
499
|
-
site_id:config['siteId']
|
500
|
-
}
|
501
|
-
},
|
502
|
-
idProperty: 'id',
|
503
|
-
remoteSort: true,
|
504
|
-
fields: [
|
505
|
-
{
|
506
|
-
name:'id'
|
507
|
-
},
|
508
|
-
{
|
509
|
-
name:'version'
|
510
|
-
},
|
511
|
-
{
|
512
|
-
name:'title'
|
513
|
-
},
|
514
|
-
{
|
515
|
-
name:'updated_at',
|
516
|
-
type:'date'
|
517
|
-
},
|
518
|
-
{
|
519
|
-
name:'active'
|
520
|
-
},
|
521
|
-
{
|
522
|
-
name:'published'
|
523
|
-
},
|
524
|
-
{
|
525
|
-
name:'publisher'
|
420
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsWebsiteSectionGridPanel", {
|
421
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",
|
422
|
+
alias:'widget.knitkit_versionswebsitesectiongridpanel',
|
423
|
+
|
424
|
+
viewVersionedContent:function (rec) {
|
425
|
+
this.initialConfig['centerRegion'].setWindowStatus('Loading template...');
|
426
|
+
var self = this;
|
427
|
+
Ext.Ajax.request({
|
428
|
+
url:'/knitkit/erp_app/desktop/versions/get_website_section_version',
|
429
|
+
method:'POST',
|
430
|
+
params:{
|
431
|
+
id:rec.get('id'),
|
432
|
+
version:rec.get('version')
|
433
|
+
},
|
434
|
+
success:function (response) {
|
435
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
436
|
+
var template = response.responseText
|
437
|
+
self.initialConfig['centerRegion'].viewSectionLayout(rec.get('title'), template);
|
438
|
+
},
|
439
|
+
failure:function (response) {
|
440
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
441
|
+
Ext.Msg.alert('Error', 'Error loading tempalte');
|
442
|
+
}
|
443
|
+
});
|
444
|
+
},
|
445
|
+
|
446
|
+
revert:function (rec) {
|
447
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
448
|
+
capability_type_iid:'revert_version',
|
449
|
+
resource:'Article'
|
450
|
+
})) {
|
451
|
+
var self = this;
|
452
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
453
|
+
Ext.Ajax.request({
|
454
|
+
url:'/knitkit/erp_app/desktop/versions/revert_website_section',
|
455
|
+
method:'POST',
|
456
|
+
params:{
|
457
|
+
id:rec.get('id'),
|
458
|
+
version:rec.get('version')
|
459
|
+
},
|
460
|
+
success:function (response) {
|
461
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
462
|
+
var obj = Ext.decode(response.responseText);
|
463
|
+
if (obj.success) {
|
464
|
+
self.initialConfig['centerRegion'].replaceContentInActiveCodeMirror(obj.body_html);
|
465
|
+
self.getStore().load();
|
466
|
+
}
|
467
|
+
else {
|
468
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
469
|
+
}
|
470
|
+
},
|
471
|
+
failure:function (response) {
|
472
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
473
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
474
|
+
}
|
475
|
+
});
|
526
476
|
}
|
527
|
-
|
528
|
-
|
529
|
-
|
477
|
+
},
|
478
|
+
|
479
|
+
publish:function (rec) {
|
480
|
+
var self = this;
|
481
|
+
|
482
|
+
var publishWindow = Ext.create('Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow',{
|
483
|
+
baseParams:{
|
484
|
+
id:rec.get('id'),
|
485
|
+
site_id:self.initialConfig.siteId,
|
486
|
+
version:rec.get('version')
|
487
|
+
},
|
488
|
+
url:'/knitkit/erp_app/desktop/versions/publish_website_section',
|
489
|
+
listeners:{
|
490
|
+
'publish_success':function (window, response) {
|
491
|
+
if (response.success) {
|
492
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
493
|
+
self.getStore().load();
|
494
|
+
}
|
495
|
+
else {
|
496
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
497
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
498
|
+
}
|
499
|
+
},
|
500
|
+
'publish_failure':function (window, response) {
|
501
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
502
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
503
|
+
}
|
504
|
+
}
|
505
|
+
});
|
530
506
|
|
531
|
-
|
532
|
-
|
507
|
+
publishWindow.show();
|
508
|
+
},
|
509
|
+
|
510
|
+
constructor:function (config) {
|
511
|
+
config = Ext.apply({
|
512
|
+
title: 'Version History',
|
513
|
+
store:Ext.create("Ext.data.Store", {
|
514
|
+
proxy:{
|
515
|
+
type:'ajax',
|
516
|
+
url:'/knitkit/erp_app/desktop/versions/website_section_layout_versions',
|
517
|
+
reader:{
|
518
|
+
type:'json',
|
519
|
+
root:'data'
|
520
|
+
},
|
521
|
+
extraParams:{
|
522
|
+
id:config['websiteSectionId'],
|
523
|
+
site_id:config['siteId']
|
524
|
+
}
|
525
|
+
},
|
526
|
+
idProperty:'id',
|
527
|
+
remoteSort:true,
|
528
|
+
fields:[
|
529
|
+
{
|
530
|
+
name:'id'
|
531
|
+
},
|
532
|
+
{
|
533
|
+
name:'version'
|
534
|
+
},
|
535
|
+
{
|
536
|
+
name:'title'
|
537
|
+
},
|
538
|
+
{
|
539
|
+
name:'updated_at',
|
540
|
+
type:'date'
|
541
|
+
},
|
542
|
+
{
|
543
|
+
name:'active'
|
544
|
+
},
|
545
|
+
{
|
546
|
+
name:'published'
|
547
|
+
},
|
548
|
+
{
|
549
|
+
name:'publisher'
|
550
|
+
}
|
551
|
+
]
|
552
|
+
})
|
553
|
+
}, config);
|
554
|
+
|
555
|
+
this.callParent([config]);
|
556
|
+
}
|
533
557
|
});
|
534
558
|
|
535
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGridPanel",{
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
this.getStore().load();
|
573
|
-
},
|
574
|
-
|
575
|
-
constructor : function(config) {
|
576
|
-
var store = Ext.create("Ext.data.Store",{
|
577
|
-
proxy: {
|
578
|
-
type: 'ajax',
|
579
|
-
url:'/knitkit/erp_app/desktop/versions/non_published_content_versions',
|
580
|
-
reader: {
|
581
|
-
type: 'json',
|
582
|
-
root: 'data'
|
583
|
-
},
|
584
|
-
extraParams:{
|
585
|
-
id:config['contentId']
|
559
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGridPanel", {
|
560
|
+
extend:"Ext.grid.Panel",
|
561
|
+
alias:'widget.knitkit_nonpublishedversionswebsitesectiongridpanel',
|
562
|
+
viewVersionedContent:function (rec) {
|
563
|
+
this.initialConfig['centerRegion'].viewContent(rec.get('title') + " - Revision " + rec.get('version'), rec.get('body_html'));
|
564
|
+
},
|
565
|
+
|
566
|
+
revert:function (rec) {
|
567
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
568
|
+
capability_type_iid:'revert_version',
|
569
|
+
resource:'Article'
|
570
|
+
})) {
|
571
|
+
var self = this;
|
572
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
573
|
+
Ext.Ajax.request({
|
574
|
+
url:'/knitkit/erp_app/desktop/versions/revert_content',
|
575
|
+
method:'POST',
|
576
|
+
params:{
|
577
|
+
id:rec.get('id'),
|
578
|
+
version:rec.get('version')
|
579
|
+
},
|
580
|
+
success:function (response) {
|
581
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
582
|
+
var obj = Ext.decode(response.responseText);
|
583
|
+
if (obj.success) {
|
584
|
+
self.initialConfig['centerRegion'].replaceHtmlInActiveCkEditor(rec.get('body_html'));
|
585
|
+
self.getStore().load();
|
586
|
+
}
|
587
|
+
else {
|
588
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
589
|
+
}
|
590
|
+
},
|
591
|
+
failure:function (response) {
|
592
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
593
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
594
|
+
}
|
595
|
+
});
|
586
596
|
}
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
},
|
594
|
-
{
|
595
|
-
name:'version'
|
596
|
-
},
|
597
|
-
{
|
598
|
-
name:'title'
|
599
|
-
},
|
600
|
-
{
|
601
|
-
name:'excerpt_html'
|
602
|
-
},
|
603
|
-
{
|
604
|
-
name:'body_html'
|
605
|
-
},
|
606
|
-
{
|
607
|
-
name:'updated_at',
|
608
|
-
type:'date'
|
609
|
-
}
|
610
|
-
]
|
611
|
-
});
|
612
|
-
|
613
|
-
config = Ext.apply({
|
614
|
-
columns:[ {
|
615
|
-
header:'Version',
|
616
|
-
dataIndex:'version',
|
617
|
-
sortable:true,
|
618
|
-
width:50
|
619
|
-
},
|
620
|
-
{
|
621
|
-
header:'Timestamp',
|
622
|
-
dataIndex:'updated_at',
|
623
|
-
sortable:true,
|
624
|
-
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s'),
|
625
|
-
width:120
|
626
|
-
},{
|
627
|
-
menuDisabled:true,
|
628
|
-
resizable:false,
|
629
|
-
xtype:'actioncolumn',
|
630
|
-
header:'View',
|
631
|
-
align:'center',
|
632
|
-
width:60,
|
633
|
-
items:[{
|
634
|
-
icon:'/images/icons/document_view/document_view_16x16.png',
|
635
|
-
tooltip:'View',
|
636
|
-
handler :function(grid, rowIndex, colIndex){
|
637
|
-
var rec = grid.getStore().getAt(rowIndex);
|
638
|
-
grid.ownerCt.viewVersionedContent(rec);
|
639
|
-
}
|
640
|
-
}]
|
641
|
-
},
|
642
|
-
{
|
643
|
-
menuDisabled:true,
|
644
|
-
resizable:false,
|
645
|
-
xtype:'actioncolumn',
|
646
|
-
header:'Revert',
|
647
|
-
align:'center',
|
648
|
-
width:60,
|
649
|
-
items:[{
|
650
|
-
icon:'/images/icons/document_down/document_down_16x16.png',
|
651
|
-
tooltip:'Revert',
|
652
|
-
handler :function(grid, rowIndex, colIndex){
|
653
|
-
var rec = grid.getStore().getAt(rowIndex);
|
654
|
-
grid.ownerCt.revert(rec);
|
655
|
-
}
|
656
|
-
}]
|
657
|
-
}],
|
658
|
-
store:store,
|
659
|
-
bbar: Ext.create("Ext.PagingToolbar",{
|
660
|
-
pageSize: 15,
|
661
|
-
store: store,
|
662
|
-
displayInfo: true,
|
663
|
-
displayMsg: '{0} - {1} of {2}',
|
664
|
-
emptyMsg: "Empty"
|
665
|
-
})
|
666
|
-
}, config);
|
667
|
-
|
668
|
-
Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGridPanel.superclass.constructor.call(this, config);
|
669
|
-
}
|
670
|
-
});
|
597
|
+
},
|
598
|
+
|
599
|
+
initComponent:function () {
|
600
|
+
this.callParent(arguments);
|
601
|
+
this.getStore().load();
|
602
|
+
},
|
671
603
|
|
604
|
+
constructor:function (config) {
|
605
|
+
var store = Ext.create("Ext.data.Store", {
|
606
|
+
title: 'Version History',
|
607
|
+
proxy:{
|
608
|
+
type:'ajax',
|
609
|
+
url:'/knitkit/erp_app/desktop/versions/non_published_content_versions',
|
610
|
+
reader:{
|
611
|
+
type:'json',
|
612
|
+
root:'data'
|
613
|
+
},
|
614
|
+
extraParams:{
|
615
|
+
id:config['contentId']
|
616
|
+
}
|
617
|
+
},
|
618
|
+
idProperty:'id',
|
619
|
+
remoteSort:true,
|
620
|
+
fields:[
|
621
|
+
{
|
622
|
+
name:'id'
|
623
|
+
},
|
624
|
+
{
|
625
|
+
name:'version'
|
626
|
+
},
|
627
|
+
{
|
628
|
+
name:'title'
|
629
|
+
},
|
630
|
+
{
|
631
|
+
name:'excerpt_html'
|
632
|
+
},
|
633
|
+
{
|
634
|
+
name:'body_html'
|
635
|
+
},
|
636
|
+
{
|
637
|
+
name:'updated_at',
|
638
|
+
type:'date'
|
639
|
+
}
|
640
|
+
]
|
641
|
+
});
|
642
|
+
|
643
|
+
config = Ext.apply({
|
644
|
+
columns:[
|
645
|
+
{
|
646
|
+
header:'Version',
|
647
|
+
dataIndex:'version',
|
648
|
+
sortable:true,
|
649
|
+
width:50
|
650
|
+
},
|
651
|
+
{
|
652
|
+
header:'Timestamp',
|
653
|
+
dataIndex:'updated_at',
|
654
|
+
sortable:true,
|
655
|
+
renderer:Ext.util.Format.dateRenderer('m/d/Y H:i:s'),
|
656
|
+
width:120
|
657
|
+
},
|
658
|
+
{
|
659
|
+
menuDisabled:true,
|
660
|
+
resizable:false,
|
661
|
+
xtype:'actioncolumn',
|
662
|
+
header:'View',
|
663
|
+
align:'center',
|
664
|
+
width:60,
|
665
|
+
items:[
|
666
|
+
{
|
667
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
668
|
+
tooltip:'View',
|
669
|
+
handler:function (grid, rowIndex, colIndex) {
|
670
|
+
var rec = grid.getStore().getAt(rowIndex);
|
671
|
+
grid.ownerCt.viewVersionedContent(rec);
|
672
|
+
}
|
673
|
+
}
|
674
|
+
]
|
675
|
+
},
|
676
|
+
{
|
677
|
+
menuDisabled:true,
|
678
|
+
resizable:false,
|
679
|
+
xtype:'actioncolumn',
|
680
|
+
header:'Revert',
|
681
|
+
align:'center',
|
682
|
+
width:60,
|
683
|
+
items:[
|
684
|
+
{
|
685
|
+
icon:'/images/icons/document_down/document_down_16x16.png',
|
686
|
+
tooltip:'Revert',
|
687
|
+
handler:function (grid, rowIndex, colIndex) {
|
688
|
+
var rec = grid.getStore().getAt(rowIndex);
|
689
|
+
grid.ownerCt.revert(rec);
|
690
|
+
}
|
691
|
+
}
|
692
|
+
]
|
693
|
+
}
|
694
|
+
],
|
695
|
+
store:store,
|
696
|
+
bbar:Ext.create("Ext.PagingToolbar", {
|
697
|
+
pageSize:15,
|
698
|
+
store:store,
|
699
|
+
displayInfo:true,
|
700
|
+
displayMsg:'{0} - {1} of {2}',
|
701
|
+
emptyMsg:"Empty"
|
702
|
+
})
|
703
|
+
}, config);
|
704
|
+
|
705
|
+
this.callParent([config]);
|
706
|
+
}
|
707
|
+
});
|