knitkit 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL-3-LICENSE +674 -0
- data/README.md +6 -0
- data/Rakefile +30 -0
- data/app/assets/javascripts/knitkit/application.js +9 -0
- data/app/assets/stylesheets/knitkit/application.css +7 -0
- data/app/controllers/knitkit/articles_controller.rb +7 -0
- data/app/controllers/knitkit/base_controller.rb +45 -0
- data/app/controllers/knitkit/blogs_controller.rb +27 -0
- data/app/controllers/knitkit/comments_controller.rb +18 -0
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +135 -0
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +144 -0
- data/app/controllers/knitkit/erp_app/desktop/comments_controller.rb +43 -0
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +27 -0
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +145 -0
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -0
- data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +68 -0
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +20 -0
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +272 -0
- data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +135 -0
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +177 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +143 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +116 -0
- data/app/controllers/knitkit/unauthorized_controller.rb +8 -0
- data/app/controllers/knitkit/website_sections_controller.rb +17 -0
- data/app/helpers/application_helper.rb +132 -0
- data/app/models/article.rb +14 -0
- data/app/models/blog.rb +21 -0
- data/app/models/comment.rb +24 -0
- data/app/models/content.rb +158 -0
- data/app/models/extensions/user.rb +5 -0
- data/app/models/published_element.rb +9 -0
- data/app/models/published_website.rb +118 -0
- data/app/models/theme.rb +239 -0
- data/app/models/website.rb +457 -0
- data/app/models/website_host.rb +3 -0
- data/app/models/website_inquiry.rb +11 -0
- data/app/models/website_inquiry_mailer.rb +12 -0
- data/app/models/website_nav.rb +17 -0
- data/app/models/website_nav_item.rb +21 -0
- data/app/models/website_section.rb +152 -0
- data/app/models/website_section_content.rb +4 -0
- data/app/views/knitkit/articles/index.html.erb +3 -0
- data/app/views/knitkit/articles/show.html.erb +4 -0
- data/app/views/knitkit/blogs/_add_comment.html.erb +28 -0
- data/app/views/knitkit/blogs/_comment.html.erb +8 -0
- data/app/views/knitkit/blogs/index.html.erb +51 -0
- data/app/views/knitkit/blogs/index.rss.builder +23 -0
- data/app/views/knitkit/blogs/show.html.erb +22 -0
- data/app/views/knitkit/unauthorized/index.html.erb +4 -0
- data/app/views/knitkit/website_sections/index.html.erb +6 -0
- data/app/views/layouts/knitkit/base.html.erb +59 -0
- data/app/views/menus/knitkit/_default_menu.html.erb +23 -0
- data/app/views/menus/knitkit/_default_section_menu.html.erb +27 -0
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +45 -0
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +49 -0
- data/app/views/shared/knitkit/_bread_crumb.html.erb +7 -0
- data/app/views/shared/knitkit/_footer.html.erb +3 -0
- data/app/views/website_inquiry_mailer/inquiry.erb +3 -0
- data/app/widgets/contact_us/base.rb +86 -0
- data/app/widgets/contact_us/javascript/contact_us.js +13 -0
- data/app/widgets/contact_us/views/_contact_form.html.erb +36 -0
- data/app/widgets/contact_us/views/error.html.erb +10 -0
- data/app/widgets/contact_us/views/index.html.erb +1 -0
- data/app/widgets/contact_us/views/layouts/base.html.erb +7 -0
- data/app/widgets/contact_us/views/success.html.erb +4 -0
- data/app/widgets/google_map/base.rb +48 -0
- data/app/widgets/google_map/javascript/google_map.js +174 -0
- data/app/widgets/google_map/views/index.html.erb +41 -0
- data/app/widgets/login/base.rb +61 -0
- data/app/widgets/login/javascript/login.js +162 -0
- data/app/widgets/login/views/index.html.erb +37 -0
- data/app/widgets/login/views/layouts/base.html.erb +14 -0
- data/app/widgets/login/views/login_header.html.erb +9 -0
- data/app/widgets/login/views/reset_password.html.erb +26 -0
- data/app/widgets/manage_profile/base.rb +327 -0
- data/app/widgets/manage_profile/javascript/manage_profile.js +11 -0
- data/app/widgets/manage_profile/views/_contact_information_form.html.erb +180 -0
- data/app/widgets/manage_profile/views/_password_form.html.erb +20 -0
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +30 -0
- data/app/widgets/manage_profile/views/contact_type_in_use.html.erb +4 -0
- data/app/widgets/manage_profile/views/default_type_error.html.erb +5 -0
- data/app/widgets/manage_profile/views/error.html.erb +3 -0
- data/app/widgets/manage_profile/views/index.html.erb +46 -0
- data/app/widgets/manage_profile/views/layouts/base.html.erb +1 -0
- data/app/widgets/manage_profile/views/password_blank.html.erb +4 -0
- data/app/widgets/manage_profile/views/password_invalid.html.erb +4 -0
- data/app/widgets/manage_profile/views/password_success.html.erb +3 -0
- data/app/widgets/manage_profile/views/success.html.erb +3 -0
- data/app/widgets/reset_password/base.rb +42 -0
- data/app/widgets/reset_password/javascript/reset_password.js +13 -0
- data/app/widgets/reset_password/views/index.html.erb +31 -0
- data/app/widgets/reset_password/views/layouts/base.html.erb +1 -0
- data/app/widgets/search/base.rb +80 -0
- data/app/widgets/search/javascript/search.js +31 -0
- data/app/widgets/search/views/_search.html.erb +39 -0
- data/app/widgets/search/views/index.html.erb +3 -0
- data/app/widgets/search/views/layouts/base.html.erb +24 -0
- data/app/widgets/search/views/show.html.erb +48 -0
- data/app/widgets/signup/base.rb +72 -0
- data/app/widgets/signup/javascript/signup.js +13 -0
- data/app/widgets/signup/views/_signup_form.html.erb +36 -0
- data/app/widgets/signup/views/error.html.erb +11 -0
- data/app/widgets/signup/views/index.html.erb +1 -0
- data/app/widgets/signup/views/layouts/base.html.erb +7 -0
- data/app/widgets/signup/views/success.html.erb +4 -0
- data/config/environment.rb +0 -0
- data/config/routes.rb +41 -0
- data/db/data_migrations/20110509223702_add_publisher_role.rb +11 -0
- data/db/data_migrations/20110816153456_add_knitkit_application.rb +31 -0
- data/db/data_migrations/upgrade/20111011203718_create_paths_for_sections.rb +13 -0
- data/db/data_migrations/upgrade/20111216192114_add_secured_models_to_menu_items.rb +18 -0
- data/db/data_migrations/upgrade/20111216202819_set_contents_iid_to_permalink_where_null.rb +12 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +259 -0
- data/db/migrate/upgrade/20111014190442_update_contents.rb +25 -0
- data/db/migrate/upgrade/20111014201502_add_published_by_to_published_elements.rb +22 -0
- data/db/migrate/upgrade/20111017133851_add_iid_to_section.rb +21 -0
- data/db/migrate/upgrade/20111027145006_add_in_menu_to_section.rb +19 -0
- data/lib/knitkit.rb +12 -0
- data/lib/knitkit/engine.rb +26 -0
- data/lib/knitkit/extensions.rb +18 -0
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +88 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +28 -0
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +38 -0
- data/lib/knitkit/extensions/active_record/theme_support/has_many_themes.rb +34 -0
- data/lib/knitkit/extensions/compass/widgets/base.rb +53 -0
- data/lib/knitkit/extensions/core/array.rb +5 -0
- data/lib/knitkit/extensions/railties/action_view.rb +187 -0
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +198 -0
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +44 -0
- data/lib/knitkit/routing_filter/section_router.rb +55 -0
- data/lib/knitkit/syntax_validator.rb +32 -0
- data/lib/knitkit/version.rb +3 -0
- data/lib/tasks/knitkit_tasks.rake +4 -0
- data/public/images/knitkit/bullet.png +0 -0
- data/public/images/knitkit/content.png +0 -0
- data/public/images/knitkit/footer.png +0 -0
- data/public/images/knitkit/graphic.png +0 -0
- data/public/images/knitkit/greyFadeDown.png +0 -0
- data/public/images/knitkit/link.png +0 -0
- data/public/images/knitkit/logo.png +0 -0
- data/public/images/knitkit/menu.png +0 -0
- data/public/images/knitkit/menu_select.png +0 -0
- data/public/images/knitkit/search.png +0 -0
- data/public/javascripts/datepicker.js +440 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +473 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +576 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +217 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +26 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +109 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +30 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +160 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +46 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +46 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +92 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +220 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +613 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +573 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +664 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +2161 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +52 -0
- data/public/stylesheets/datepicker.css +121 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +114 -0
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +219 -0
- data/public/stylesheets/knitkit/style.css +394 -0
- metadata +289 -0
@@ -0,0 +1,664 @@
|
|
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();
|
6
|
+
},
|
7
|
+
|
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
|
+
if(!Compass.ErpApp.Utility.isBlank(config['columns'])){
|
29
|
+
overiddenColumns = overiddenColumns.concat(config['columns']);
|
30
|
+
}
|
31
|
+
|
32
|
+
overiddenColumns = overiddenColumns.concat([
|
33
|
+
{
|
34
|
+
menuDisabled:true,
|
35
|
+
resizable:false,
|
36
|
+
xtype:'actioncolumn',
|
37
|
+
header:'View',
|
38
|
+
align:'center',
|
39
|
+
width:60,
|
40
|
+
items:[{
|
41
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
42
|
+
tooltip:'View',
|
43
|
+
handler :function(grid, rowIndex, colIndex){
|
44
|
+
var rec = grid.getStore().getAt(rowIndex);
|
45
|
+
grid.ownerCt.viewVersionedContent(rec);
|
46
|
+
}
|
47
|
+
}]
|
48
|
+
},
|
49
|
+
{
|
50
|
+
menuDisabled:true,
|
51
|
+
resizable:false,
|
52
|
+
xtype:'actioncolumn',
|
53
|
+
header:'Revert',
|
54
|
+
align:'center',
|
55
|
+
width:60,
|
56
|
+
items:[{
|
57
|
+
icon:'/images/icons/document_down/document_down_16x16.png',
|
58
|
+
tooltip:'Revert',
|
59
|
+
handler :function(grid, rowIndex, colIndex){
|
60
|
+
var rec = grid.getStore().getAt(rowIndex);
|
61
|
+
grid.ownerCt.revert(rec);
|
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
|
+
if(currentUser.hasRole(['publisher','admin'])){
|
84
|
+
var rec = grid.getStore().getAt(rowIndex);
|
85
|
+
if(rec.get('published')){
|
86
|
+
return false;
|
87
|
+
}
|
88
|
+
else{
|
89
|
+
grid.ownerCt.publish(rec)
|
90
|
+
}
|
91
|
+
}
|
92
|
+
else{
|
93
|
+
compassUser.showInvalidAccess();
|
94
|
+
}
|
95
|
+
|
96
|
+
}
|
97
|
+
}]
|
98
|
+
},
|
99
|
+
{
|
100
|
+
header:'Active',
|
101
|
+
dataIndex:'active',
|
102
|
+
sortable:true,
|
103
|
+
align:'center',
|
104
|
+
width:60,
|
105
|
+
renderer:function(){
|
106
|
+
var rec = arguments[2];
|
107
|
+
if (rec.get('active')){
|
108
|
+
return '<img class="x-action-col-0 active-col" ext:qtip="Active" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="">'
|
109
|
+
}
|
110
|
+
else{
|
111
|
+
return '<img class="x-action-col-0 activate-col" ext:qtip="Not Active" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt="">'
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
]);
|
116
|
+
|
117
|
+
config['columns'] = overiddenColumns;
|
118
|
+
config = Ext.apply({
|
119
|
+
bbar: Ext.create("Ext.PagingToolbar",{
|
120
|
+
pageSize: 15,
|
121
|
+
store: config['store'],
|
122
|
+
displayInfo: true,
|
123
|
+
displayMsg: '{0} - {1} of {2}',
|
124
|
+
emptyMsg: "Empty"
|
125
|
+
})
|
126
|
+
}, config);
|
127
|
+
|
128
|
+
this.callParent([config]);
|
129
|
+
}
|
130
|
+
});
|
131
|
+
|
132
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsArticleGridPanel",{
|
133
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",
|
134
|
+
alias:'widget.knitkit_versionsarticlegridpanel',
|
135
|
+
viewVersionedContent : function(rec){
|
136
|
+
this.initialConfig['centerRegion'].viewContent(rec.get('title') + " - Revision " + rec.get('version'), rec.get('body_html'));
|
137
|
+
},
|
138
|
+
|
139
|
+
revert: function(rec){
|
140
|
+
var self = this;
|
141
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
142
|
+
var conn = new Ext.data.Connection();
|
143
|
+
conn.request({
|
144
|
+
url: '/knitkit/erp_app/desktop/versions/revert_content',
|
145
|
+
method: 'POST',
|
146
|
+
params:{
|
147
|
+
id:rec.get('id'),
|
148
|
+
version:rec.get('version')
|
149
|
+
},
|
150
|
+
success: function(response) {
|
151
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
152
|
+
var obj = Ext.decode(response.responseText);
|
153
|
+
if(obj.success){
|
154
|
+
self.initialConfig['centerRegion'].replaceHtmlInActiveCkEditor(rec.get('body_html'));
|
155
|
+
self.getStore().load();
|
156
|
+
}
|
157
|
+
else{
|
158
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
159
|
+
}
|
160
|
+
},
|
161
|
+
failure: function(response) {
|
162
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
163
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
164
|
+
}
|
165
|
+
});
|
166
|
+
},
|
167
|
+
|
168
|
+
publish: function(rec){
|
169
|
+
var self = this;
|
170
|
+
|
171
|
+
var publishWindow = new Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow({
|
172
|
+
baseParams:{
|
173
|
+
id:rec.get('id'),
|
174
|
+
site_id:self.initialConfig.siteId,
|
175
|
+
version:rec.get('version')
|
176
|
+
},
|
177
|
+
url:'/knitkit/erp_app/desktop/versions/publish_content',
|
178
|
+
listeners:{
|
179
|
+
'publish_success':function(window, response){
|
180
|
+
if(response.success){
|
181
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
182
|
+
self.getStore().load();
|
183
|
+
}
|
184
|
+
else{
|
185
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
186
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
187
|
+
}
|
188
|
+
},
|
189
|
+
'publish_failure':function(window, response){
|
190
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
191
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
192
|
+
}
|
193
|
+
}
|
194
|
+
});
|
195
|
+
|
196
|
+
publishWindow.show();
|
197
|
+
},
|
198
|
+
|
199
|
+
constructor : function(config) {
|
200
|
+
config = Ext.apply({
|
201
|
+
store:Ext.create("Ext.data.Store",{
|
202
|
+
proxy: {
|
203
|
+
type: 'ajax',
|
204
|
+
url:'/knitkit/erp_app/desktop/versions/content_versions',
|
205
|
+
reader: {
|
206
|
+
type: 'json',
|
207
|
+
root: 'data'
|
208
|
+
},
|
209
|
+
extraParams:{
|
210
|
+
id:config['contentId'],
|
211
|
+
site_id:config['siteId']
|
212
|
+
}
|
213
|
+
},
|
214
|
+
idProperty: 'id',
|
215
|
+
remoteSort: true,
|
216
|
+
fields: [
|
217
|
+
{
|
218
|
+
name:'published'
|
219
|
+
},
|
220
|
+
{
|
221
|
+
name:'id'
|
222
|
+
},
|
223
|
+
{
|
224
|
+
name:'version'
|
225
|
+
},
|
226
|
+
{
|
227
|
+
name:'title'
|
228
|
+
},
|
229
|
+
{
|
230
|
+
name:'excerpt_html'
|
231
|
+
},
|
232
|
+
{
|
233
|
+
name:'body_html'
|
234
|
+
},
|
235
|
+
{
|
236
|
+
name:'active'
|
237
|
+
},
|
238
|
+
{
|
239
|
+
name:'updated_at',
|
240
|
+
type:'date'
|
241
|
+
},
|
242
|
+
{
|
243
|
+
name:'publisher'
|
244
|
+
}
|
245
|
+
]
|
246
|
+
})
|
247
|
+
}, config);
|
248
|
+
|
249
|
+
this.callParent([config]);
|
250
|
+
}
|
251
|
+
});
|
252
|
+
|
253
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsBlogGridPanel",{
|
254
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",
|
255
|
+
alias:'widget.knitkit_versionsbloggridpanel',
|
256
|
+
|
257
|
+
viewVersionedContent : function(rec){
|
258
|
+
this.initialConfig['centerRegion'].viewContent(rec.get('title') + " - Revision " + rec.get('version'), rec.get('body_html'));
|
259
|
+
},
|
260
|
+
|
261
|
+
revert: function(rec){
|
262
|
+
var self = this;
|
263
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
264
|
+
var conn = new Ext.data.Connection();
|
265
|
+
conn.request({
|
266
|
+
url: '/knitkit/erp_app/desktop/versions/revert_content',
|
267
|
+
method: 'POST',
|
268
|
+
params:{
|
269
|
+
id:rec.get('id'),
|
270
|
+
version:rec.get('version')
|
271
|
+
},
|
272
|
+
success: function(response) {
|
273
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
274
|
+
var obj = Ext.decode(response.responseText);
|
275
|
+
if(obj.success){
|
276
|
+
self.initialConfig['centerRegion'].replaceHtmlInActiveCkEditor(rec.get('body_html'));
|
277
|
+
self.getStore().load();
|
278
|
+
}
|
279
|
+
else{
|
280
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
281
|
+
}
|
282
|
+
},
|
283
|
+
failure: function(response) {
|
284
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
285
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
286
|
+
}
|
287
|
+
});
|
288
|
+
},
|
289
|
+
|
290
|
+
publish: function(rec){
|
291
|
+
var self = this;
|
292
|
+
|
293
|
+
var publishWindow = new Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow({
|
294
|
+
baseParams:{
|
295
|
+
id:rec.get('id'),
|
296
|
+
site_id:self.initialConfig.siteId,
|
297
|
+
version:rec.get('version')
|
298
|
+
},
|
299
|
+
url:'/knitkit/erp_app/desktop/versions/publish_content',
|
300
|
+
listeners:{
|
301
|
+
'publish_success':function(window, response){
|
302
|
+
if(response.success){
|
303
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
304
|
+
self.getStore().load();
|
305
|
+
}
|
306
|
+
else{
|
307
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
308
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
309
|
+
}
|
310
|
+
},
|
311
|
+
'publish_failure':function(window, response){
|
312
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
313
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
314
|
+
}
|
315
|
+
}
|
316
|
+
});
|
317
|
+
|
318
|
+
publishWindow.show();
|
319
|
+
},
|
320
|
+
|
321
|
+
constructor : function(config) {
|
322
|
+
config = Ext.apply({
|
323
|
+
store:Ext.create("Ext.data.Store",{
|
324
|
+
proxy: {
|
325
|
+
type: 'ajax',
|
326
|
+
url:'/knitkit/erp_app/desktop/versions/content_versions',
|
327
|
+
reader: {
|
328
|
+
type: 'json',
|
329
|
+
root: 'data'
|
330
|
+
},
|
331
|
+
extraParams:{
|
332
|
+
id:config['contentId'],
|
333
|
+
site_id:config['siteId']
|
334
|
+
}
|
335
|
+
},
|
336
|
+
idProperty: 'id',
|
337
|
+
remoteSort: true,
|
338
|
+
fields: [
|
339
|
+
{
|
340
|
+
name:'id'
|
341
|
+
},
|
342
|
+
{
|
343
|
+
name:'version'
|
344
|
+
},
|
345
|
+
{
|
346
|
+
name:'title'
|
347
|
+
},
|
348
|
+
{
|
349
|
+
name:'excerpt_html'
|
350
|
+
},
|
351
|
+
{
|
352
|
+
name:'body_html'
|
353
|
+
},
|
354
|
+
{
|
355
|
+
name:'active'
|
356
|
+
},
|
357
|
+
{
|
358
|
+
name:'updated_at',
|
359
|
+
type:'date'
|
360
|
+
},
|
361
|
+
{
|
362
|
+
name:'published'
|
363
|
+
},
|
364
|
+
{
|
365
|
+
name:'publisher'
|
366
|
+
}
|
367
|
+
]
|
368
|
+
}),
|
369
|
+
columns:[
|
370
|
+
{
|
371
|
+
menuDisabled:true,
|
372
|
+
resizable:false,
|
373
|
+
xtype:'actioncolumn',
|
374
|
+
header:'Excerpt',
|
375
|
+
align:'center',
|
376
|
+
width:50,
|
377
|
+
items:[{
|
378
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
379
|
+
tooltip:'View',
|
380
|
+
handler :function(grid, rowIndex, colIndex){
|
381
|
+
var rec = grid.getStore().getAt(rowIndex);
|
382
|
+
grid.initialConfig['centerRegion'].viewContent(rec.get('title') + " Excerpt - Revision " + rec.get('version'), rec.get('body_html'));
|
383
|
+
}
|
384
|
+
}]
|
385
|
+
}]
|
386
|
+
}, config);
|
387
|
+
|
388
|
+
this.callParent([config]);
|
389
|
+
}
|
390
|
+
});
|
391
|
+
|
392
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.VersionsWebsiteSectionGridPanel",{
|
393
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.VersionsGridPanel",
|
394
|
+
alias:'widget.knitkit_versionswebsitesectiongridpanel',
|
395
|
+
|
396
|
+
viewVersionedContent : function(rec){
|
397
|
+
this.initialConfig['centerRegion'].setWindowStatus('Loading template...');
|
398
|
+
var self = this;
|
399
|
+
var conn = new Ext.data.Connection();
|
400
|
+
conn.request({
|
401
|
+
url: '/knitkit/erp_app/desktop/versions/get_website_section_version',
|
402
|
+
method: 'POST',
|
403
|
+
params:{
|
404
|
+
id:rec.get('id'),
|
405
|
+
version:rec.get('version')
|
406
|
+
},
|
407
|
+
success: function(response) {
|
408
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
409
|
+
var template = response.responseText
|
410
|
+
self.initialConfig['centerRegion'].viewSectionLayout(rec.get('title'),template);
|
411
|
+
},
|
412
|
+
failure: function(response) {
|
413
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
414
|
+
Ext.Msg.alert('Error', 'Error loading tempalte');
|
415
|
+
}
|
416
|
+
});
|
417
|
+
},
|
418
|
+
|
419
|
+
revert: function(rec){
|
420
|
+
var self = this;
|
421
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
422
|
+
var conn = new Ext.data.Connection();
|
423
|
+
conn.request({
|
424
|
+
url: '/knitkit/erp_app/desktop/versions/revert_website_section',
|
425
|
+
method: 'POST',
|
426
|
+
params:{
|
427
|
+
id:rec.get('id'),
|
428
|
+
version:rec.get('version')
|
429
|
+
},
|
430
|
+
success: function(response) {
|
431
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
432
|
+
var obj = Ext.decode(response.responseText);
|
433
|
+
if(obj.success){
|
434
|
+
self.initialConfig['centerRegion'].replaceContentInActiveCodeMirror(obj.body_html);
|
435
|
+
self.getStore().load();
|
436
|
+
}
|
437
|
+
else{
|
438
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
439
|
+
}
|
440
|
+
},
|
441
|
+
failure: function(response) {
|
442
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
443
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
444
|
+
}
|
445
|
+
});
|
446
|
+
},
|
447
|
+
|
448
|
+
publish: function(rec){
|
449
|
+
var self = this;
|
450
|
+
|
451
|
+
var publishWindow = new Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow({
|
452
|
+
baseParams:{
|
453
|
+
id:rec.get('id'),
|
454
|
+
site_id:self.initialConfig.siteId,
|
455
|
+
version:rec.get('version')
|
456
|
+
},
|
457
|
+
url:'/knitkit/erp_app/desktop/versions/publish_website_section',
|
458
|
+
listeners:{
|
459
|
+
'publish_success':function(window, response){
|
460
|
+
if(response.success){
|
461
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
462
|
+
self.getStore().load();
|
463
|
+
}
|
464
|
+
else{
|
465
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
466
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
467
|
+
}
|
468
|
+
},
|
469
|
+
'publish_failure':function(window, response){
|
470
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
471
|
+
Ext.Msg.alert('Error', 'Error publishing');
|
472
|
+
}
|
473
|
+
}
|
474
|
+
});
|
475
|
+
|
476
|
+
publishWindow.show();
|
477
|
+
},
|
478
|
+
|
479
|
+
constructor : function(config) {
|
480
|
+
config = Ext.apply({
|
481
|
+
store:Ext.create("Ext.data.Store",{
|
482
|
+
proxy: {
|
483
|
+
type: 'ajax',
|
484
|
+
url:'/knitkit/erp_app/desktop/versions/website_section_layout_versions',
|
485
|
+
reader: {
|
486
|
+
type: 'json',
|
487
|
+
root: 'data'
|
488
|
+
},
|
489
|
+
extraParams:{
|
490
|
+
id:config['websiteSectionId'],
|
491
|
+
site_id:config['siteId']
|
492
|
+
}
|
493
|
+
},
|
494
|
+
idProperty: 'id',
|
495
|
+
remoteSort: true,
|
496
|
+
fields: [
|
497
|
+
{
|
498
|
+
name:'id'
|
499
|
+
},
|
500
|
+
{
|
501
|
+
name:'version'
|
502
|
+
},
|
503
|
+
{
|
504
|
+
name:'title'
|
505
|
+
},
|
506
|
+
{
|
507
|
+
name:'updated_at',
|
508
|
+
type:'date'
|
509
|
+
},
|
510
|
+
{
|
511
|
+
name:'active'
|
512
|
+
},
|
513
|
+
{
|
514
|
+
name:'published'
|
515
|
+
},
|
516
|
+
{
|
517
|
+
name:'publisher'
|
518
|
+
}
|
519
|
+
]
|
520
|
+
})
|
521
|
+
}, config);
|
522
|
+
|
523
|
+
this.callParent([config]);
|
524
|
+
}
|
525
|
+
});
|
526
|
+
|
527
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGridPanel",{
|
528
|
+
extend:"Ext.grid.Panel",
|
529
|
+
alias:'widget.knitkit_nonpublishedversionswebsitesectiongridpanel',
|
530
|
+
viewVersionedContent : function(rec){
|
531
|
+
this.initialConfig['centerRegion'].viewContent(rec.get('title') + " - Revision " + rec.get('version'), rec.get('body_html'));
|
532
|
+
},
|
533
|
+
|
534
|
+
revert: function(rec){
|
535
|
+
var self = this;
|
536
|
+
self.initialConfig['centerRegion'].setWindowStatus('Reverting...');
|
537
|
+
var conn = new Ext.data.Connection();
|
538
|
+
conn.request({
|
539
|
+
url: '/knitkit/erp_app/desktop/versions/revert_content',
|
540
|
+
method: 'POST',
|
541
|
+
params:{
|
542
|
+
id:rec.get('id'),
|
543
|
+
version:rec.get('version')
|
544
|
+
},
|
545
|
+
success: function(response) {
|
546
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
547
|
+
var obj = Ext.decode(response.responseText);
|
548
|
+
if(obj.success){
|
549
|
+
self.initialConfig['centerRegion'].replaceHtmlInActiveCkEditor(rec.get('body_html'));
|
550
|
+
self.getStore().load();
|
551
|
+
}
|
552
|
+
else{
|
553
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
554
|
+
}
|
555
|
+
},
|
556
|
+
failure: function(response) {
|
557
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
558
|
+
Ext.Msg.alert('Error', 'Error reverting');
|
559
|
+
}
|
560
|
+
});
|
561
|
+
},
|
562
|
+
|
563
|
+
initComponent: function() {
|
564
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGridPanel.superclass.initComponent.call(this, arguments);
|
565
|
+
this.getStore().load();
|
566
|
+
},
|
567
|
+
|
568
|
+
constructor : function(config) {
|
569
|
+
var store = Ext.create("Ext.data.Store",{
|
570
|
+
proxy: {
|
571
|
+
type: 'ajax',
|
572
|
+
url:'/knitkit/erp_app/desktop/versions/non_published_content_versions',
|
573
|
+
reader: {
|
574
|
+
type: 'json',
|
575
|
+
root: 'data'
|
576
|
+
},
|
577
|
+
extraParams:{
|
578
|
+
id:config['contentId']
|
579
|
+
}
|
580
|
+
},
|
581
|
+
idProperty: 'id',
|
582
|
+
remoteSort: true,
|
583
|
+
fields: [
|
584
|
+
{
|
585
|
+
name:'id'
|
586
|
+
},
|
587
|
+
{
|
588
|
+
name:'version'
|
589
|
+
},
|
590
|
+
{
|
591
|
+
name:'title'
|
592
|
+
},
|
593
|
+
{
|
594
|
+
name:'excerpt_html'
|
595
|
+
},
|
596
|
+
{
|
597
|
+
name:'body_html'
|
598
|
+
},
|
599
|
+
{
|
600
|
+
name:'updated_at',
|
601
|
+
type:'date'
|
602
|
+
}
|
603
|
+
]
|
604
|
+
});
|
605
|
+
|
606
|
+
config = Ext.apply({
|
607
|
+
columns:[ {
|
608
|
+
header:'Version',
|
609
|
+
dataIndex:'version',
|
610
|
+
sortable:true,
|
611
|
+
width:50
|
612
|
+
},
|
613
|
+
{
|
614
|
+
header:'Timestamp',
|
615
|
+
dataIndex:'updated_at',
|
616
|
+
sortable:true,
|
617
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s'),
|
618
|
+
width:120
|
619
|
+
},{
|
620
|
+
menuDisabled:true,
|
621
|
+
resizable:false,
|
622
|
+
xtype:'actioncolumn',
|
623
|
+
header:'View',
|
624
|
+
align:'center',
|
625
|
+
width:60,
|
626
|
+
items:[{
|
627
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
628
|
+
tooltip:'View',
|
629
|
+
handler :function(grid, rowIndex, colIndex){
|
630
|
+
var rec = grid.getStore().getAt(rowIndex);
|
631
|
+
grid.ownerCt.viewVersionedContent(rec);
|
632
|
+
}
|
633
|
+
}]
|
634
|
+
},
|
635
|
+
{
|
636
|
+
menuDisabled:true,
|
637
|
+
resizable:false,
|
638
|
+
xtype:'actioncolumn',
|
639
|
+
header:'Revert',
|
640
|
+
align:'center',
|
641
|
+
width:60,
|
642
|
+
items:[{
|
643
|
+
icon:'/images/icons/document_down/document_down_16x16.png',
|
644
|
+
tooltip:'Revert',
|
645
|
+
handler :function(grid, rowIndex, colIndex){
|
646
|
+
var rec = grid.getStore().getAt(rowIndex);
|
647
|
+
grid.ownerCt.revert(rec);
|
648
|
+
}
|
649
|
+
}]
|
650
|
+
}],
|
651
|
+
store:store,
|
652
|
+
bbar: Ext.create("Ext.PagingToolbar",{
|
653
|
+
pageSize: 15,
|
654
|
+
store: store,
|
655
|
+
displayInfo: true,
|
656
|
+
displayMsg: '{0} - {1} of {2}',
|
657
|
+
emptyMsg: "Empty"
|
658
|
+
})
|
659
|
+
}, config);
|
660
|
+
|
661
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.NonPublishedVersionsGridPanel.superclass.constructor.call(this, config);
|
662
|
+
}
|
663
|
+
});
|
664
|
+
|