knitkit 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,46 @@
|
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.InquiriesGridPanel",{
|
|
2
|
+
extend:"Compass.ErpApp.Shared.DynamicEditableGridLoaderPanel",
|
|
3
|
+
alias:'widget.knitkit_inquiriesgridpanel',
|
|
4
|
+
deleteInquiry : function(rec){
|
|
5
|
+
var self = this;
|
|
6
|
+
Ext.getCmp('knitkitCenterRegion').setWindowStatus('Deleting inquiry...');
|
|
7
|
+
var conn = new Ext.data.Connection();
|
|
8
|
+
conn.request({
|
|
9
|
+
url: '/knitkit/erp_app/desktop/inquiries/delete',
|
|
10
|
+
method: 'POST',
|
|
11
|
+
params:{
|
|
12
|
+
id:rec.get("id")
|
|
13
|
+
},
|
|
14
|
+
success: function(response) {
|
|
15
|
+
var obj = Ext.decode(response.responseText);
|
|
16
|
+
if(obj.success){
|
|
17
|
+
Ext.getCmp('knitkitCenterRegion').clearWindowStatus();
|
|
18
|
+
self.query('shared_dynamiceditablegrid')[0].store.load();
|
|
19
|
+
}
|
|
20
|
+
else{
|
|
21
|
+
Ext.Msg.alert('Error', 'Error deleting inquiry');
|
|
22
|
+
Ext.getCmp('knitkitCenterRegion').clearWindowStatus();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
failure: function(response) {
|
|
26
|
+
Ext.getCmp('knitkitCenterRegion').clearWindowStatus();
|
|
27
|
+
Ext.Msg.alert('Error', 'Error deleting inquiry');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
constructor : function(config) {
|
|
32
|
+
config = Ext.apply({
|
|
33
|
+
id:'InquiriesGridPanel',
|
|
34
|
+
title:'Website Inquiries',
|
|
35
|
+
dataUrl: '/knitkit/erp_app/desktop/inquiries/get/' + config['websiteId'],
|
|
36
|
+
setupUrl: '/knitkit/erp_app/desktop/inquiries/setup',
|
|
37
|
+
editable:false,
|
|
38
|
+
page:true,
|
|
39
|
+
pageSize:20,
|
|
40
|
+
displayMsg:'Displaying {0} - {1} of {2}',
|
|
41
|
+
emptyMsg:'Empty'
|
|
42
|
+
}, config);
|
|
43
|
+
|
|
44
|
+
this.callParent([config]);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit",{
|
|
2
|
+
extend:"Ext.ux.desktop.Module",
|
|
3
|
+
id:'knitkit-win',
|
|
4
|
+
init : function(){
|
|
5
|
+
this.launcher = {
|
|
6
|
+
text: 'KnitKit',
|
|
7
|
+
iconCls:'icon-palette',
|
|
8
|
+
handler : this.createWindow,
|
|
9
|
+
scope: this
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
createWindow : function(){
|
|
14
|
+
var desktop = this.app.getDesktop();
|
|
15
|
+
var win = desktop.getWindow('knitkit');
|
|
16
|
+
this.centerRegion = new Compass.ErpApp.Desktop.Applications.Knitkit.CenterRegion();
|
|
17
|
+
if(!win){
|
|
18
|
+
win = desktop.createWindow({
|
|
19
|
+
id: 'knitkit',
|
|
20
|
+
title:'KnitKit',
|
|
21
|
+
autoDestroy:true,
|
|
22
|
+
width:1200,
|
|
23
|
+
height:550,
|
|
24
|
+
maximized:true,
|
|
25
|
+
iconCls: 'icon-palette',
|
|
26
|
+
shim:false,
|
|
27
|
+
animCollapse:false,
|
|
28
|
+
constrainHeader:true,
|
|
29
|
+
layout: 'border',
|
|
30
|
+
items:[
|
|
31
|
+
this.centerRegion,
|
|
32
|
+
{
|
|
33
|
+
xtype:'knitkit_eastregion',
|
|
34
|
+
module:this
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
xtype:'knitkit_westregion',
|
|
38
|
+
centerRegion:this.centerRegion,
|
|
39
|
+
module:this
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
win.show();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow",{
|
|
2
|
+
extend:"Ext.window.Window",
|
|
3
|
+
alias:'widget.knikit_publishwindow',
|
|
4
|
+
initComponent : function() {
|
|
5
|
+
|
|
6
|
+
this.addEvents(
|
|
7
|
+
/**
|
|
8
|
+
* @event publish_success
|
|
9
|
+
* Fired after success response is recieved from server
|
|
10
|
+
* @param {Compass.ErpApp.Applications.Desktop.PublishWindow} this Object
|
|
11
|
+
* @param {Object} Server Response
|
|
12
|
+
*/
|
|
13
|
+
"publish_success",
|
|
14
|
+
/**
|
|
15
|
+
* @event publish_failure
|
|
16
|
+
* Fired after response is recieved from server with error
|
|
17
|
+
* @param {Compass.ErpApp.Applications.Desktop.PublishWindow} this Object
|
|
18
|
+
* @param {Object} Server Response
|
|
19
|
+
*/
|
|
20
|
+
"publish_failure"
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.PublishWindow.superclass.initComponent.call(this, arguments);
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
constructor : function(config) {
|
|
27
|
+
config = Ext.apply({
|
|
28
|
+
layout:'fit',
|
|
29
|
+
title:'Publish',
|
|
30
|
+
autoHeight:true,
|
|
31
|
+
iconCls:'icon-document',
|
|
32
|
+
width:400,
|
|
33
|
+
height:300,
|
|
34
|
+
buttonAlign:'center',
|
|
35
|
+
plain: true,
|
|
36
|
+
items: new Ext.form.FormPanel({
|
|
37
|
+
timeout: 130000,
|
|
38
|
+
baseParams:config['baseParams'],
|
|
39
|
+
autoHeight:true,
|
|
40
|
+
labelWidth:110,
|
|
41
|
+
frame:false,
|
|
42
|
+
layout:'fit',
|
|
43
|
+
url:config['url'],
|
|
44
|
+
defaults: {
|
|
45
|
+
width: 225
|
|
46
|
+
},
|
|
47
|
+
items: [{
|
|
48
|
+
xtype: 'textarea',
|
|
49
|
+
hideLabel:true,
|
|
50
|
+
name:'comment'
|
|
51
|
+
}]
|
|
52
|
+
}),
|
|
53
|
+
buttons: [{
|
|
54
|
+
text:'Submit',
|
|
55
|
+
listeners:{
|
|
56
|
+
'click':function(button){
|
|
57
|
+
var win = button.findParentByType('knikit_publishwindow');
|
|
58
|
+
var formPanel = win.query('form')[0];
|
|
59
|
+
formPanel.getForm().submit({
|
|
60
|
+
method:'POST',
|
|
61
|
+
waitMsg:'Publishing...',
|
|
62
|
+
success:function(form, action){
|
|
63
|
+
var response = Ext.decode(action.response.responseText);
|
|
64
|
+
win.fireEvent('publish_success', win, response);
|
|
65
|
+
win.close();
|
|
66
|
+
},
|
|
67
|
+
failure:function(form, action){
|
|
68
|
+
var response = Ext.decode(action.response.responseText);
|
|
69
|
+
win.fireEvent('publish_failure', win, response);
|
|
70
|
+
win.close();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
text: 'Cancel',
|
|
78
|
+
listeners:{
|
|
79
|
+
'click':function(button){
|
|
80
|
+
var win = button.findParentByType('knikit_publishwindow');
|
|
81
|
+
var form = win.query('form')[0];
|
|
82
|
+
form.getForm().reset();
|
|
83
|
+
win.close();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}]
|
|
87
|
+
}, config);
|
|
88
|
+
|
|
89
|
+
this.callParent([config]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
});
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.PublishedGridPanel",{
|
|
2
|
+
extend:"Ext.grid.Panel",
|
|
3
|
+
alias:'widget.knitkit_publishedgridpanel',
|
|
4
|
+
initComponent: function() {
|
|
5
|
+
this.callParent(arguments);
|
|
6
|
+
this.getStore().load();
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
activate : function(rec){
|
|
10
|
+
var self = this;
|
|
11
|
+
var conn = new Ext.data.Connection();
|
|
12
|
+
conn.request({
|
|
13
|
+
url: '/knitkit/erp_app/desktop/site/activate_publication',
|
|
14
|
+
method: 'POST',
|
|
15
|
+
params:{
|
|
16
|
+
id:self.initialConfig.siteId,
|
|
17
|
+
version:rec.get('version')
|
|
18
|
+
},
|
|
19
|
+
success: function(response) {
|
|
20
|
+
var obj = Ext.decode(response.responseText);
|
|
21
|
+
if(obj.success){
|
|
22
|
+
self.getStore().load();
|
|
23
|
+
}
|
|
24
|
+
else{
|
|
25
|
+
Ext.Msg.alert('Error', 'Error activating publication');
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
failure: function(response) {
|
|
29
|
+
Ext.Msg.alert('Error', 'Error activating publication');
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
setViewingVersion : function(rec){
|
|
35
|
+
var self = this;
|
|
36
|
+
var conn = new Ext.data.Connection();
|
|
37
|
+
conn.request({
|
|
38
|
+
url: '/knitkit/erp_app/desktop/site/set_viewing_version',
|
|
39
|
+
method: 'POST',
|
|
40
|
+
params:{
|
|
41
|
+
id:self.initialConfig.siteId,
|
|
42
|
+
version:rec.get('version')
|
|
43
|
+
},
|
|
44
|
+
success: function(response) {
|
|
45
|
+
var obj = Ext.decode(response.responseText);
|
|
46
|
+
if(obj.success){
|
|
47
|
+
self.getStore().load();
|
|
48
|
+
}
|
|
49
|
+
else{
|
|
50
|
+
Ext.Msg.alert('Error', 'Error setting viewing version');
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
failure: function(response) {
|
|
54
|
+
Ext.Msg.alert('Error', 'Error setting viewing version');
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
constructor : function(config) {
|
|
60
|
+
var store = Ext.create("Ext.data.Store",{
|
|
61
|
+
proxy:{
|
|
62
|
+
type:'ajax',
|
|
63
|
+
url:'/knitkit/erp_app/desktop/site/website_publications',
|
|
64
|
+
reader:{
|
|
65
|
+
type:'json',
|
|
66
|
+
root:'data'
|
|
67
|
+
},
|
|
68
|
+
extraParams:{
|
|
69
|
+
id:config['siteId']
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
idProperty: 'id',
|
|
73
|
+
remoteSort: true,
|
|
74
|
+
fields: [
|
|
75
|
+
{
|
|
76
|
+
name:'id'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name:'version',
|
|
80
|
+
type: 'float'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name:'created_at',
|
|
84
|
+
type: 'date'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name:'published_by_username'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name:'comment'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name:'active',
|
|
94
|
+
type:'boolean'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name:'viewing',
|
|
98
|
+
type:'boolean'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
listeners:{
|
|
102
|
+
'exception':function(proxy, type, action, options, response, arg){
|
|
103
|
+
Ext.Msg.alert('Error',arg);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
config = Ext.apply({
|
|
109
|
+
store:store,
|
|
110
|
+
columns: [
|
|
111
|
+
{
|
|
112
|
+
header: "Version",
|
|
113
|
+
sortable:true,
|
|
114
|
+
width: 60,
|
|
115
|
+
dataIndex: 'version'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
header: "Published",
|
|
119
|
+
width: 130,
|
|
120
|
+
sortable:true,
|
|
121
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s'),
|
|
122
|
+
dataIndex: 'created_at'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
header: "Published By",
|
|
126
|
+
width: 130,
|
|
127
|
+
sortable:true,
|
|
128
|
+
dataIndex: 'published_by_username'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
menuDisabled:true,
|
|
132
|
+
resizable:false,
|
|
133
|
+
xtype:'actioncolumn',
|
|
134
|
+
header:'Viewing',
|
|
135
|
+
align:'center',
|
|
136
|
+
width:50,
|
|
137
|
+
items:[{
|
|
138
|
+
getClass: function(v, meta, rec) { // Or return a class from a function
|
|
139
|
+
if (rec.get('viewing')) {
|
|
140
|
+
this.items[0].tooltip = 'Viewing';
|
|
141
|
+
return 'viewing-col';
|
|
142
|
+
} else {
|
|
143
|
+
this.items[0].tooltip = 'View';
|
|
144
|
+
return 'view-col';
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
handler: function(grid, rowIndex, colIndex) {
|
|
148
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
149
|
+
if(rec.get('viewing')){
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
else{
|
|
153
|
+
grid.ownerCt.setViewingVersion(rec)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
menuDisabled:true,
|
|
160
|
+
resizable:false,
|
|
161
|
+
xtype:'actioncolumn',
|
|
162
|
+
header:'Active',
|
|
163
|
+
align:'center',
|
|
164
|
+
width:50,
|
|
165
|
+
items:[{
|
|
166
|
+
getClass: function(v, meta, rec) { // Or return a class from a function
|
|
167
|
+
if (rec.get('active')) {
|
|
168
|
+
this.items[0].tooltip = 'Active';
|
|
169
|
+
return 'active-col';
|
|
170
|
+
} else {
|
|
171
|
+
this.items[0].tooltip = 'Activate';
|
|
172
|
+
return 'activate-col';
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
handler: function(grid, rowIndex, colIndex) {
|
|
176
|
+
if(currentUser.hasRole(['admin','publisher'])){
|
|
177
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
178
|
+
if(rec.get('active')){
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
else{
|
|
182
|
+
grid.ownerCt.activate(rec)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else{
|
|
186
|
+
compassUser.showInvalidAccess();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
menuDisabled:true,
|
|
193
|
+
resizable:false,
|
|
194
|
+
xtype:'actioncolumn',
|
|
195
|
+
header:'Note',
|
|
196
|
+
align:'center',
|
|
197
|
+
width:40,
|
|
198
|
+
items:[{
|
|
199
|
+
getClass: function(v, meta, rec) { // Or return a class from a function
|
|
200
|
+
this.items[0].tooltip = rec.get('comment');
|
|
201
|
+
return 'info-col';
|
|
202
|
+
},
|
|
203
|
+
handler: function(grid, rowIndex, colIndex) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
}]
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
bbar: new Ext.PagingToolbar({
|
|
210
|
+
pageSize: 9,
|
|
211
|
+
store:store,
|
|
212
|
+
displayInfo: true,
|
|
213
|
+
displayMsg: '{0} - {1} of {2}',
|
|
214
|
+
emptyMsg: "Empty"
|
|
215
|
+
})
|
|
216
|
+
}, config);
|
|
217
|
+
|
|
218
|
+
this.callParent([config]);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel",{
|
|
2
|
+
extend:"Ext.grid.Panel",
|
|
3
|
+
alias:'widget.knitkit_sectionarticlesgridpanel',
|
|
4
|
+
deleteArticle : function(id){
|
|
5
|
+
var self = this;
|
|
6
|
+
this.initialConfig['centerRegion'].setWindowStatus('Deleting...');
|
|
7
|
+
var conn = new Ext.data.Connection();
|
|
8
|
+
conn.request({
|
|
9
|
+
url: '/knitkit/erp_app/desktop/articles/delete',
|
|
10
|
+
method: 'POST',
|
|
11
|
+
params:{
|
|
12
|
+
id:id
|
|
13
|
+
},
|
|
14
|
+
success: function(response) {
|
|
15
|
+
var obj = Ext.decode(response.responseText);
|
|
16
|
+
if(obj.success){
|
|
17
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
18
|
+
self.getStore().load();
|
|
19
|
+
}
|
|
20
|
+
else{
|
|
21
|
+
Ext.Msg.alert('Error', 'Error deleting Article');
|
|
22
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
failure: function(response) {
|
|
26
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
27
|
+
Ext.Msg.alert('Error', 'Error deleting Article');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
editArticle : function(record){
|
|
33
|
+
var self = this;
|
|
34
|
+
var addFormItems = self.addFormItems;
|
|
35
|
+
|
|
36
|
+
var editArticleWindow = Ext.create("Ext.window.Window",{
|
|
37
|
+
layout:'fit',
|
|
38
|
+
width:375,
|
|
39
|
+
title:'Edit Article',
|
|
40
|
+
plain: true,
|
|
41
|
+
buttonAlign:'center',
|
|
42
|
+
items: {
|
|
43
|
+
xtype: 'form',
|
|
44
|
+
labelWidth: 110,
|
|
45
|
+
frame:false,
|
|
46
|
+
bodyStyle:'padding:5px 5px 0',
|
|
47
|
+
width: 425,
|
|
48
|
+
url:'/knitkit/erp_app/desktop/articles/update/' + self.sectionId,
|
|
49
|
+
defaults: {
|
|
50
|
+
width: 225
|
|
51
|
+
},
|
|
52
|
+
items: [
|
|
53
|
+
{
|
|
54
|
+
xtype:'textfield',
|
|
55
|
+
fieldLabel:'Title',
|
|
56
|
+
allowBlank:false,
|
|
57
|
+
name:'title',
|
|
58
|
+
value: record.get('title')
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
xtype:'radiogroup',
|
|
62
|
+
fieldLabel:'Display title?',
|
|
63
|
+
name:'display_title',
|
|
64
|
+
columns:2,
|
|
65
|
+
items:[
|
|
66
|
+
{
|
|
67
|
+
boxLabel:'Yes',
|
|
68
|
+
name:'display_title',
|
|
69
|
+
inputValue: 'yes',
|
|
70
|
+
checked:record.get('display_title')
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
{
|
|
74
|
+
boxLabel:'No',
|
|
75
|
+
name:'display_title',
|
|
76
|
+
inputValue:'no',
|
|
77
|
+
checked:!record.get('display_title')
|
|
78
|
+
}]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
xtype:'textfield',
|
|
82
|
+
fieldLabel:'Unique Name',
|
|
83
|
+
allowBlank:true,
|
|
84
|
+
name:'internal_identifier',
|
|
85
|
+
value: record.get('internal_identifier')
|
|
86
|
+
},
|
|
87
|
+
addFormItems
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
listeners:{
|
|
91
|
+
'show':function(){
|
|
92
|
+
if (Ext.getCmp('record_id')){
|
|
93
|
+
Ext.getCmp('record_id').setValue(record.get('id'));
|
|
94
|
+
}
|
|
95
|
+
if (Ext.getCmp('tag_list')){
|
|
96
|
+
Ext.getCmp('tag_list').setValue(record.get('tag_list'));
|
|
97
|
+
}
|
|
98
|
+
if (Ext.getCmp('content_area')){
|
|
99
|
+
Ext.getCmp('content_area').setValue(record.get('content_area'));
|
|
100
|
+
}
|
|
101
|
+
if (Ext.getCmp('position')){
|
|
102
|
+
Ext.getCmp('position').setValue(record.get('position'));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
buttons: [{
|
|
107
|
+
text:'Submit',
|
|
108
|
+
listeners:{
|
|
109
|
+
'click':function(button){
|
|
110
|
+
var window = button.findParentByType('window');
|
|
111
|
+
var formPanel = window.query('form')[0];
|
|
112
|
+
self.initialConfig['centerRegion'].setWindowStatus('Updating article...');
|
|
113
|
+
formPanel.getForm().submit({
|
|
114
|
+
reset:false,
|
|
115
|
+
success:function(form, action){
|
|
116
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
117
|
+
var obj = Ext.decode(action.response.responseText);
|
|
118
|
+
if(obj.success){
|
|
119
|
+
self.getStore().load();
|
|
120
|
+
if(formPanel.getForm().findField('tag_list')){
|
|
121
|
+
var tag_list = formPanel.getForm().findField('tag_list').getValue();
|
|
122
|
+
record.set('tag_list', tag_list);
|
|
123
|
+
}
|
|
124
|
+
if(formPanel.getForm().findField('content_area')){
|
|
125
|
+
var content_area = formPanel.getForm().findField('content_area').getValue();
|
|
126
|
+
record.set('content_area', content_area);
|
|
127
|
+
}
|
|
128
|
+
if(formPanel.getForm().findField('position')){
|
|
129
|
+
var position = formPanel.getForm().findField('position').getValue();
|
|
130
|
+
record.set('position', position);
|
|
131
|
+
}
|
|
132
|
+
editArticleWindow.close();
|
|
133
|
+
}
|
|
134
|
+
else{
|
|
135
|
+
Ext.Msg.alert("Error", obj.msg);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
failure:function(form, action){
|
|
139
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
140
|
+
Ext.Msg.alert("Error", "Error updating article");
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},{
|
|
146
|
+
text: 'Close',
|
|
147
|
+
handler: function(){
|
|
148
|
+
editArticleWindow.close();
|
|
149
|
+
}
|
|
150
|
+
}]
|
|
151
|
+
});
|
|
152
|
+
editArticleWindow.show();
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
initComponent: function() {
|
|
156
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel.superclass.initComponent.call(this, arguments);
|
|
157
|
+
this.getStore().load();
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
constructor : function(config) {
|
|
161
|
+
var self = this;
|
|
162
|
+
var sectionId = config['sectionId'];
|
|
163
|
+
|
|
164
|
+
// create the Data Store
|
|
165
|
+
var store = Ext.create('Ext.data.Store', {
|
|
166
|
+
proxy: {
|
|
167
|
+
type: 'ajax',
|
|
168
|
+
url:'/knitkit/erp_app/desktop/articles/get/' + sectionId,
|
|
169
|
+
reader: {
|
|
170
|
+
type: 'json',
|
|
171
|
+
root: 'data'
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
remoteSort: true,
|
|
175
|
+
fields:[
|
|
176
|
+
{
|
|
177
|
+
name:'id'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name:'title'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name:'tag_list'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name:'excerpt_html'
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name:'position'
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name:'content_area'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name:'body_html'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name:'internal_identifier'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name:'display_title'
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
var overiddenColumns = [{
|
|
207
|
+
header:'Title',
|
|
208
|
+
sortable:true,
|
|
209
|
+
dataIndex:'title',
|
|
210
|
+
width:110
|
|
211
|
+
},{
|
|
212
|
+
header:'Unique Name',
|
|
213
|
+
sortable:true,
|
|
214
|
+
dataIndex:'internal_identifier',
|
|
215
|
+
width:110,
|
|
216
|
+
editable:false
|
|
217
|
+
}];
|
|
218
|
+
|
|
219
|
+
if(!Compass.ErpApp.Utility.isBlank(config['columns'])){
|
|
220
|
+
overiddenColumns = overiddenColumns.concat(config['columns']);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
overiddenColumns = overiddenColumns.concat([
|
|
224
|
+
{
|
|
225
|
+
menuDisabled:true,
|
|
226
|
+
resizable:false,
|
|
227
|
+
xtype:'actioncolumn',
|
|
228
|
+
header:'HTML',
|
|
229
|
+
align:'center',
|
|
230
|
+
width:40,
|
|
231
|
+
items:[{
|
|
232
|
+
icon:'/images/icons/edit/edit_16x16.png',
|
|
233
|
+
tooltip:'Edit',
|
|
234
|
+
handler :function(grid, rowIndex, colIndex){
|
|
235
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
236
|
+
self.initialConfig['centerRegion'].editContent(rec.get('title'), rec.get('id'), rec.get('body_html'), grid.ownerCt.initialConfig.siteId, grid.ownerCt.initialConfig.contentType, grid.getStore());
|
|
237
|
+
}
|
|
238
|
+
}]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
menuDisabled:true,
|
|
242
|
+
resizable:false,
|
|
243
|
+
xtype:'actioncolumn',
|
|
244
|
+
header:'Edit',
|
|
245
|
+
align:'center',
|
|
246
|
+
width:40,
|
|
247
|
+
items:[{
|
|
248
|
+
icon:'/images/icons/edit/edit_16x16.png',
|
|
249
|
+
tooltip:'Edit',
|
|
250
|
+
handler :function(grid, rowIndex, colIndex){
|
|
251
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
252
|
+
self.editArticle(rec);
|
|
253
|
+
}
|
|
254
|
+
}]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
menuDisabled:true,
|
|
258
|
+
resizable:false,
|
|
259
|
+
xtype:'actioncolumn',
|
|
260
|
+
header:'Delete',
|
|
261
|
+
align:'center',
|
|
262
|
+
width:40,
|
|
263
|
+
items:[{
|
|
264
|
+
icon:'/images/icons/delete/delete_16x16.png',
|
|
265
|
+
tooltip:'Delete',
|
|
266
|
+
handler :function(grid, rowIndex, colIndex){
|
|
267
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
268
|
+
var id = rec.get('id');
|
|
269
|
+
var messageBox = Ext.MessageBox.confirm(
|
|
270
|
+
'Confirm', 'Are you sure?',
|
|
271
|
+
function(btn){
|
|
272
|
+
if (btn == 'yes'){
|
|
273
|
+
self.deleteArticle(id);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}]
|
|
279
|
+
}
|
|
280
|
+
]);
|
|
281
|
+
|
|
282
|
+
var addFormItems = [
|
|
283
|
+
{
|
|
284
|
+
xtype:'textfield',
|
|
285
|
+
fieldLabel:'Title',
|
|
286
|
+
allowBlank:false,
|
|
287
|
+
name:'title'
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
xtype:'radiogroup',
|
|
291
|
+
fieldLabel:'Display title?',
|
|
292
|
+
name:'display_title',
|
|
293
|
+
columns:2,
|
|
294
|
+
items:[
|
|
295
|
+
{
|
|
296
|
+
boxLabel:'Yes',
|
|
297
|
+
name:'display_title',
|
|
298
|
+
inputValue: 'yes',
|
|
299
|
+
checked:true
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
{
|
|
303
|
+
boxLabel:'No',
|
|
304
|
+
name:'display_title',
|
|
305
|
+
inputValue: 'no'
|
|
306
|
+
}]
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
xtype:'textfield',
|
|
310
|
+
fieldLabel:'Unique Name',
|
|
311
|
+
allowBlank:true,
|
|
312
|
+
name:'internal_identifier'
|
|
313
|
+
}
|
|
314
|
+
];
|
|
315
|
+
|
|
316
|
+
if(!Compass.ErpApp.Utility.isBlank(config['addFormItems'])){
|
|
317
|
+
addFormItems = addFormItems.concat(config['addFormItems']);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
config['columns'] = overiddenColumns;
|
|
321
|
+
config = Ext.apply({
|
|
322
|
+
store:store,
|
|
323
|
+
tbar: [{
|
|
324
|
+
text: 'Add New Article',
|
|
325
|
+
iconCls: 'icon-add',
|
|
326
|
+
handler : function(){
|
|
327
|
+
var addArticleWindow = new Ext.Window({
|
|
328
|
+
layout:'fit',
|
|
329
|
+
width:375,
|
|
330
|
+
title:'New Article',
|
|
331
|
+
plain: true,
|
|
332
|
+
buttonAlign:'center',
|
|
333
|
+
items: new Ext.FormPanel({
|
|
334
|
+
labelWidth: 110,
|
|
335
|
+
frame:false,
|
|
336
|
+
bodyStyle:'padding:5px 5px 0',
|
|
337
|
+
width: 425,
|
|
338
|
+
url:'/knitkit/erp_app/desktop/articles/new/' + self.initialConfig['sectionId'],
|
|
339
|
+
defaults: {
|
|
340
|
+
width: 225
|
|
341
|
+
},
|
|
342
|
+
items: addFormItems
|
|
343
|
+
}),
|
|
344
|
+
buttons: [{
|
|
345
|
+
text:'Submit',
|
|
346
|
+
listeners:{
|
|
347
|
+
'click':function(button){
|
|
348
|
+
var window = button.findParentByType('window');
|
|
349
|
+
var formPanel = window.query('form')[0];
|
|
350
|
+
self.initialConfig['centerRegion'].setWindowStatus('Creating article...');
|
|
351
|
+
formPanel.getForm().submit({
|
|
352
|
+
reset:true,
|
|
353
|
+
success:function(form, action){
|
|
354
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
355
|
+
var obj = Ext.decode(action.response.responseText);
|
|
356
|
+
if(obj.success){
|
|
357
|
+
self.getStore().load();
|
|
358
|
+
}
|
|
359
|
+
else{
|
|
360
|
+
Ext.Msg.alert("Error", obj.msg);
|
|
361
|
+
}
|
|
362
|
+
addArticleWindow.close();
|
|
363
|
+
|
|
364
|
+
},
|
|
365
|
+
failure:function(form, action){
|
|
366
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
367
|
+
Ext.Msg.alert("Error", "Error creating article");
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
},{
|
|
373
|
+
text: 'Close',
|
|
374
|
+
handler: function(){
|
|
375
|
+
addArticleWindow.close();
|
|
376
|
+
}
|
|
377
|
+
}]
|
|
378
|
+
});
|
|
379
|
+
addArticleWindow.show();
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
text: 'Add Existing Article',
|
|
384
|
+
iconCls: 'icon-copy',
|
|
385
|
+
handler : function(){
|
|
386
|
+
var addExistingArticleWindow = new Ext.Window({
|
|
387
|
+
layout:'fit',
|
|
388
|
+
width:375,
|
|
389
|
+
title:'Add Existing Article',
|
|
390
|
+
height:100,
|
|
391
|
+
plain: true,
|
|
392
|
+
buttonAlign:'center',
|
|
393
|
+
items: new Ext.FormPanel({
|
|
394
|
+
labelWidth: 75,
|
|
395
|
+
frame:false,
|
|
396
|
+
bodyStyle:'padding:5px 5px 0',
|
|
397
|
+
width: 425,
|
|
398
|
+
url:'/knitkit/erp_app/desktop/articles/add_existing/' + self.initialConfig['sectionId'],
|
|
399
|
+
items:[
|
|
400
|
+
{
|
|
401
|
+
xtype:'combo',
|
|
402
|
+
hiddenName:'article_id',
|
|
403
|
+
name:'article_id',
|
|
404
|
+
labelWidth: 50,
|
|
405
|
+
width:200,
|
|
406
|
+
loadingText:'Retrieving Articles...',
|
|
407
|
+
store:Ext.create('Ext.data.Store',{
|
|
408
|
+
proxy:{
|
|
409
|
+
type:'ajax',
|
|
410
|
+
reader:{
|
|
411
|
+
type:'json',
|
|
412
|
+
root:'articles'
|
|
413
|
+
},
|
|
414
|
+
extraParams:{
|
|
415
|
+
section_id:self.initialConfig['sectionId']
|
|
416
|
+
},
|
|
417
|
+
url:'/knitkit/erp_app/desktop/section/available_articles'
|
|
418
|
+
},
|
|
419
|
+
fields:[
|
|
420
|
+
{
|
|
421
|
+
name:'id'
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name:'internal_identifier'
|
|
425
|
+
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
}),
|
|
429
|
+
forceSelection:true,
|
|
430
|
+
editable:true,
|
|
431
|
+
fieldLabel:'Article',
|
|
432
|
+
autoSelect:true,
|
|
433
|
+
typeAhead: true,
|
|
434
|
+
mode: 'remote',
|
|
435
|
+
displayField:'internal_identifier',
|
|
436
|
+
valueField:'id',
|
|
437
|
+
triggerAction: 'all',
|
|
438
|
+
allowBlank:false
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
}),
|
|
442
|
+
buttons: [{
|
|
443
|
+
text:'Submit',
|
|
444
|
+
listeners:{
|
|
445
|
+
'click':function(button){
|
|
446
|
+
var window = button.findParentByType('window');
|
|
447
|
+
var formPanel = window.query('form')[0];
|
|
448
|
+
self.initialConfig['centerRegion'].setWindowStatus('Adding article...');
|
|
449
|
+
formPanel.getForm().submit({
|
|
450
|
+
reset:true,
|
|
451
|
+
success:function(form, action){
|
|
452
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
453
|
+
var obj = Ext.decode(action.response.responseText);
|
|
454
|
+
if(obj.success){
|
|
455
|
+
self.getStore().load();
|
|
456
|
+
}else{
|
|
457
|
+
Ext.Msg.alert("Error", "Error Adding article");
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
failure:function(form, action){
|
|
461
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
|
462
|
+
Ext.Msg.alert("Error", "Error Adding article");
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
},{
|
|
468
|
+
text: 'Close',
|
|
469
|
+
handler: function(){
|
|
470
|
+
addExistingArticleWindow.close();
|
|
471
|
+
}
|
|
472
|
+
}]
|
|
473
|
+
});
|
|
474
|
+
addExistingArticleWindow.show();
|
|
475
|
+
}
|
|
476
|
+
}],
|
|
477
|
+
bbar: new Ext.PagingToolbar({
|
|
478
|
+
pageSize: 10,
|
|
479
|
+
store: store,
|
|
480
|
+
displayInfo: true,
|
|
481
|
+
displayMsg: '{0} - {1} of {2}',
|
|
482
|
+
emptyMsg: "Empty"
|
|
483
|
+
})
|
|
484
|
+
}, config);
|
|
485
|
+
|
|
486
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel.superclass.constructor.call(this, config);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.PageArticlesGridPanel",{
|
|
491
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel",
|
|
492
|
+
alias:'widget.knitkit_pagearticlesgridpanel',
|
|
493
|
+
initComponent: function() {
|
|
494
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.PageArticlesGridPanel.superclass.initComponent.call(this, arguments);
|
|
495
|
+
},
|
|
496
|
+
|
|
497
|
+
constructor : function(config) {
|
|
498
|
+
config['contentType'] = 'article';
|
|
499
|
+
var fm = Ext.form;
|
|
500
|
+
config = Ext.apply({
|
|
501
|
+
columns:[{
|
|
502
|
+
sortable:true,
|
|
503
|
+
resizable:false,
|
|
504
|
+
header:'Content Area',
|
|
505
|
+
dataIndex:'content_area',
|
|
506
|
+
width:80,
|
|
507
|
+
editable:false,
|
|
508
|
+
editor: new fm.TextField({
|
|
509
|
+
allowBlank: false
|
|
510
|
+
})
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
menuDisabled:true,
|
|
514
|
+
resizable:false,
|
|
515
|
+
header:'Pos',
|
|
516
|
+
sortable:true,
|
|
517
|
+
dataIndex:'position',
|
|
518
|
+
width:30,
|
|
519
|
+
editable:false,
|
|
520
|
+
editor: new fm.TextField({
|
|
521
|
+
allowBlank: true
|
|
522
|
+
})
|
|
523
|
+
}],
|
|
524
|
+
addFormHeight:160,
|
|
525
|
+
addFormItems:[
|
|
526
|
+
{
|
|
527
|
+
xtype:'hidden',
|
|
528
|
+
allowBlank:false,
|
|
529
|
+
name:'id',
|
|
530
|
+
id: 'record_id'
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
xtype:'textfield',
|
|
534
|
+
fieldLabel:'Content Area',
|
|
535
|
+
name:'content_area',
|
|
536
|
+
id: 'content_area'
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
xtype:'numberfield',
|
|
540
|
+
fieldLabel:'Position',
|
|
541
|
+
name:'position',
|
|
542
|
+
id: 'position'
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
|
+
}, config);
|
|
546
|
+
|
|
547
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.PageArticlesGridPanel.superclass.constructor.call(this, config);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.BlogArticlesGridPanel",{
|
|
552
|
+
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel",
|
|
553
|
+
alias:'widget.knitkit_blogarticlesgridpanel',
|
|
554
|
+
initComponent: function() {
|
|
555
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.BlogArticlesGridPanel.superclass.initComponent.call(this, arguments);
|
|
556
|
+
},
|
|
557
|
+
|
|
558
|
+
constructor : function(config) {
|
|
559
|
+
var self = this;
|
|
560
|
+
config['contentType'] = 'blog';
|
|
561
|
+
config = Ext.apply({
|
|
562
|
+
addFormHeight:200,
|
|
563
|
+
addFormItems:[
|
|
564
|
+
{
|
|
565
|
+
xtype:'hidden',
|
|
566
|
+
allowBlank:false,
|
|
567
|
+
name:'id',
|
|
568
|
+
id: 'record_id'
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
xtype:'textfield',
|
|
572
|
+
fieldLabel:'Tags',
|
|
573
|
+
allowBlank:true,
|
|
574
|
+
name:'tags',
|
|
575
|
+
id: 'tag_list'
|
|
576
|
+
}
|
|
577
|
+
],
|
|
578
|
+
columns:[{
|
|
579
|
+
menuDisabled:true,
|
|
580
|
+
resizable:false,
|
|
581
|
+
xtype:'actioncolumn',
|
|
582
|
+
header:'Comments',
|
|
583
|
+
align:'center',
|
|
584
|
+
width:60,
|
|
585
|
+
items:[{
|
|
586
|
+
icon:'/images/icons/document_text/document_text_16x16.png',
|
|
587
|
+
tooltip:'Comments',
|
|
588
|
+
handler :function(grid, rowIndex, colIndex){
|
|
589
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
590
|
+
self.initialConfig['centerRegion'].viewContentComments(rec.get('id'), rec.get('title') + ' - Comments');
|
|
591
|
+
}
|
|
592
|
+
}]
|
|
593
|
+
},{
|
|
594
|
+
menuDisabled:true,
|
|
595
|
+
resizable:false,
|
|
596
|
+
xtype:'actioncolumn',
|
|
597
|
+
header:'Excerpt',
|
|
598
|
+
align:'center',
|
|
599
|
+
width:50,
|
|
600
|
+
items:[{
|
|
601
|
+
icon:'/images/icons/edit/edit_16x16.png',
|
|
602
|
+
tooltip:'Edit',
|
|
603
|
+
handler :function(grid, rowIndex, colIndex){
|
|
604
|
+
var rec = grid.getStore().getAt(rowIndex);
|
|
605
|
+
self.initialConfig['centerRegion'].editExcerpt(rec.get('title') + ' - Excerpt', rec.get('id'), rec.get('excerpt_html'), self.initialConfig.siteId, grid.getStore());
|
|
606
|
+
}
|
|
607
|
+
}]
|
|
608
|
+
}]
|
|
609
|
+
}, config);
|
|
610
|
+
|
|
611
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.BlogArticlesGridPanel.superclass.constructor.call(this, config);
|
|
612
|
+
}
|
|
613
|
+
});
|