knitkit 2.1.15 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/controllers/knitkit/base_controller.rb +1 -1
- data/app/controllers/knitkit/comments_controller.rb +7 -2
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +78 -98
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +65 -45
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +22 -12
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +1 -1
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -16
- data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +15 -49
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +4 -3
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +69 -11
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +63 -60
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +98 -82
- data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +77 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +64 -44
- data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +147 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +81 -45
- data/app/controllers/knitkit/mobile_controller.rb +15 -0
- data/app/controllers/knitkit/online_document_sections_controller.rb +2 -1
- data/app/controllers/knitkit/unauthorized_controller.rb +0 -1
- data/app/controllers/knitkit/website_sections_controller.rb +7 -4
- data/app/mailers/website_inquiry_mailer.rb +8 -7
- data/app/models/content.rb +11 -2
- data/app/models/document.rb +2 -17
- data/app/models/published_website.rb +96 -59
- data/app/models/theme.rb +100 -14
- data/app/models/website.rb +260 -28
- data/app/models/website_inquiry.rb +5 -12
- data/app/models/website_section.rb +9 -1
- data/app/views/knitkit/blogs/_add_comment.html.erb +44 -23
- data/app/views/knitkit/blogs/_comment.html.erb +4 -6
- data/app/views/knitkit/blogs/index.html.erb +63 -49
- data/app/views/knitkit/blogs/show.html.erb +17 -12
- data/app/views/knitkit/mobile/index.html.erb +162 -0
- data/app/views/knitkit/online_document_sections/index.html.erb +7 -5
- data/app/views/knitkit/unauthorized/index.html.erb +8 -4
- data/app/views/knitkit/website_sections/index.html.erb +8 -4
- data/app/views/layouts/knitkit/base.html.erb +79 -63
- data/app/views/layouts/knitkit/online_document_sections.html.erb +74 -52
- data/app/views/menus/knitkit/_default_menu.html.erb +4 -4
- data/app/views/menus/knitkit/_default_section_menu.html.erb +22 -23
- data/app/views/shared/knitkit/_bread_crumb.html.erb +10 -7
- data/app/views/shared/knitkit/_footer.html.erb +2 -2
- data/app/views/website_inquiry_mailer/inquiry.erb +23 -2
- data/app/widgets/contact_us/base.rb +25 -50
- data/app/widgets/contact_us/javascript/contact_us.js +7 -7
- data/app/widgets/contact_us/views/error.html.erb +6 -8
- data/app/widgets/contact_us/views/index.html.erb +28 -1
- data/app/widgets/contact_us/views/layouts/base.html.erb +9 -6
- data/app/widgets/contact_us/views/success.html.erb +3 -3
- data/app/widgets/google_map/views/index.html.erb +36 -36
- data/app/widgets/login/base.rb +1 -0
- data/app/widgets/login/javascript/login.js +3 -3
- data/app/widgets/login/views/index.html.erb +46 -26
- data/app/widgets/login/views/layouts/base.html.erb +15 -13
- data/app/widgets/login/views/login_header.html.erb +7 -9
- data/app/widgets/manage_profile/base.rb +116 -164
- data/app/widgets/manage_profile/views/_address.html.erb +184 -0
- data/app/widgets/manage_profile/views/_contact_information_form.html.erb +23 -192
- data/app/widgets/manage_profile/views/_email_address.html.erb +163 -0
- data/app/widgets/manage_profile/views/_password_form.html.erb +23 -20
- data/app/widgets/manage_profile/views/_phone_number.html.erb +165 -0
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +49 -33
- data/app/widgets/manage_profile/views/error.html.erb +6 -0
- data/app/widgets/manage_profile/views/index.html.erb +44 -46
- data/app/widgets/manage_profile/views/layouts/base.html.erb +3 -1
- data/app/widgets/manage_profile/views/success.html.erb +5 -0
- data/app/widgets/reset_password/views/index.html.erb +33 -28
- data/app/widgets/reset_password/views/layouts/base.html.erb +10 -1
- data/app/widgets/search/base.rb +37 -25
- data/app/widgets/search/views/_inline_search_form.html.erb +12 -0
- data/app/widgets/search/views/_search_form.html.erb +41 -0
- data/app/widgets/search/views/index.html.erb +5 -3
- data/app/widgets/search/views/layouts/base.html.erb +13 -23
- data/app/widgets/search/views/show.html.erb +32 -47
- data/app/widgets/signup/base.rb +1 -1
- data/app/widgets/signup/javascript/signup.js +7 -9
- data/app/widgets/signup/views/_signup_form.html.erb +34 -29
- data/app/widgets/signup/views/error.html.erb +11 -11
- data/app/widgets/signup/views/index.html.erb +3 -2
- data/app/widgets/signup/views/layouts/base.html.erb +8 -5
- data/app/widgets/signup/views/success.html.erb +5 -4
- data/config/routes.rb +39 -28
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +3 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +0 -1
- data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +33 -0
- data/db/migrate/20140622212723_update_website_inquiries.rb +22 -0
- data/db/migrate/20140911185022_add_publishing_to_website.rb +5 -0
- data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +12 -0
- data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +13 -0
- data/lib/knitkit.rb +0 -1
- data/lib/knitkit/engine.rb +1 -0
- data/lib/knitkit/extensions.rb +4 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +33 -0
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +0 -12
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +7 -10
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +2 -4
- data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +4 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +16 -13
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +10 -8
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +123 -108
- data/lib/knitkit/extensions/will_paginate/link_renderer.rb +67 -0
- data/lib/knitkit/routing_filter/section_router.rb +10 -8
- data/lib/knitkit/syntax_validator.rb +2 -2
- data/lib/knitkit/version.rb +7 -3
- data/public/images/inline_edit/close.png +0 -0
- data/public/images/knitkit/close_window.png +0 -0
- data/public/images/knitkit/logo.png +0 -0
- data/public/images/knitkit/splash/images/add-site.png +0 -0
- data/public/images/knitkit/splash/images/adjust-site.png +0 -0
- data/public/images/knitkit/splash/images/browse-site.png +0 -0
- data/public/images/knitkit/splash/images/find-themes.png +0 -0
- data/public/images/knitkit/splash/images/settings.png +0 -0
- data/public/images/knitkit/splash/images/tutorials.png +0 -0
- data/public/images/knitkit/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +656 -627
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +444 -333
- data/public/javascripts/erp_app/desktop/applications/knitkit/{east_region.js → east_region/east_region.js} +33 -33
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +332 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +144 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +335 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/{widgets_panel.js → east_region/widgets_panel.js} +55 -55
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +150 -37
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +228 -96
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +89 -85
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +238 -217
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +59 -54
- data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +170 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +1168 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +71 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +301 -306
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +216 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +182 -153
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +48 -65
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +93 -94
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +523 -197
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +20 -34
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +74 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +245 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +360 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +348 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +106 -1132
- data/public/javascripts/knitkit/bootstrap-datepicker.js +474 -0
- data/public/javascripts/knitkit/bootstrap.min.js +7 -0
- data/public/javascripts/knitkit/confirm-bootstrap.js +110 -0
- data/public/javascripts/knitkit/inline_editing.js +73 -50
- data/public/javascripts/knitkit/jquery.maskedinput.min.js +7 -0
- data/public/javascripts/knitkit/mobile/app/view/Main.js +108 -0
- data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +734 -0
- data/public/javascripts/knitkit/theme.js +76 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +95 -35
- data/public/stylesheets/knitkit/bootstrap-responsive.min.css +10 -0
- data/public/stylesheets/knitkit/bootstrap.min.css +7 -0
- data/public/stylesheets/knitkit/custom.css +122 -0
- data/public/stylesheets/knitkit/datepicker.css +182 -0
- data/public/stylesheets/knitkit/inline_editing.css +58 -58
- data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/models/article_spec.rb +3 -3
- data/spec/models/content_spec.rb +9 -9
- data/spec/models/website_spec.rb +1 -1
- metadata +100 -114
- data/app/helpers/application_helper.rb +0 -134
- data/app/views/knitkit/articles/index.html.erb +0 -3
- data/app/views/knitkit/articles/show.html.erb +0 -4
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +0 -43
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +0 -47
- data/app/widgets/contact_us/views/_contact_form.html.erb +0 -36
- data/app/widgets/dynamic_forms/base.rb +0 -139
- data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +0 -110
- data/app/widgets/dynamic_forms/views/error.html.erb +0 -5
- data/app/widgets/dynamic_forms/views/index.html.erb +0 -8
- data/app/widgets/dynamic_forms/views/success.html.erb +0 -4
- data/app/widgets/dynamic_grid/base.rb +0 -130
- data/app/widgets/dynamic_grid/helpers/controller/dynamic_grid_controller_helper.rb +0 -3
- data/app/widgets/dynamic_grid/helpers/view/dynamic_grid_view_helper.rb +0 -3
- data/app/widgets/dynamic_grid/javascript/dynamic_grid.js +0 -177
- data/app/widgets/dynamic_grid/views/index.html.erb +0 -14
- data/app/widgets/login/views/reset_password.html.erb +0 -26
- data/app/widgets/manage_profile/views/default_type_error.html.erb +0 -5
- data/app/widgets/scaffold/base.rb +0 -87
- data/app/widgets/scaffold/helpers/controller/scaffold_controller_helper.rb +0 -3
- data/app/widgets/scaffold/helpers/view/scaffold_view_helper.rb +0 -3
- data/app/widgets/scaffold/javascript/scaffold.js +0 -337
- data/app/widgets/scaffold/views/index.html.erb +0 -15
- data/app/widgets/search/views/_search.html.erb +0 -39
- data/public/images/knitkit/bullet.png +0 -0
- data/public/images/knitkit/close.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/menu.png +0 -0
- data/public/images/knitkit/menu_select.png +0 -0
- data/public/images/knitkit/search.png +0 -0
- data/public/images/knitkit/tooltip.gif +0 -0
- data/public/javascripts/ajax_pagination.js +0 -33
- data/public/javascripts/datepicker.js +0 -445
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +0 -341
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +0 -31
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +0 -263
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +0 -722
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +0 -585
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +0 -155
- data/public/javascripts/knitkit/helpers.js +0 -26
- data/public/stylesheets/datepicker.css +0 -121
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +0 -233
- data/public/stylesheets/knitkit/style.css +0 -426
@@ -1,31 +0,0 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
2
|
-
extend:"Ext.view.View",
|
3
|
-
alias:'widget.knitkit_imageassetsdataview',
|
4
|
-
|
5
|
-
constructor : function(config) {
|
6
|
-
config = Ext.apply({
|
7
|
-
autoDestroy:true,
|
8
|
-
style:'overflow:auto',
|
9
|
-
itemSelector: 'div.thumb-wrap',
|
10
|
-
store: Ext.create('Ext.data.Store', {
|
11
|
-
proxy: {
|
12
|
-
type: 'ajax',
|
13
|
-
url: config['url'],
|
14
|
-
reader: {
|
15
|
-
type: 'json',
|
16
|
-
root: 'images'
|
17
|
-
}
|
18
|
-
},
|
19
|
-
fields:['name', 'url','shortName']
|
20
|
-
}),
|
21
|
-
tpl: new Ext.XTemplate(
|
22
|
-
'<tpl for=".">',
|
23
|
-
'<div class="thumb-wrap" id="{name}">',
|
24
|
-
'<div class="thumb"><img src="{url}" title="{name}" alt="{name}" class="thumb-img"></div>',
|
25
|
-
'<span>{shortName}</span></div>',
|
26
|
-
'</tpl>')
|
27
|
-
}, config);
|
28
|
-
|
29
|
-
this.callParent([config]);
|
30
|
-
}
|
31
|
-
});
|
@@ -1,263 +0,0 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel",{
|
2
|
-
extend:"Ext.tab.Panel",
|
3
|
-
alias:'widget.knitkit_ImageAssetsPanel',
|
4
|
-
|
5
|
-
constructor : function(config) {
|
6
|
-
this.websiteId = null;
|
7
|
-
var self = this;
|
8
|
-
self.module = config.module;
|
9
|
-
|
10
|
-
this.sharedImageAssetsDataView = Ext.create("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
11
|
-
url: '/knitkit/erp_app/desktop/image_assets/shared/get_images'
|
12
|
-
});
|
13
|
-
this.websiteImageAssetsDataView = Ext.create("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
14
|
-
url: '/knitkit/erp_app/desktop/image_assets/website/get_images'
|
15
|
-
});
|
16
|
-
|
17
|
-
this.sharedImageAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
18
|
-
region:'north',
|
19
|
-
rootText:'Shared Images',
|
20
|
-
collapsible:false,
|
21
|
-
allowDownload:false,
|
22
|
-
addViewContentsToContextMenu:false,
|
23
|
-
showNewFileMenuItem:false,
|
24
|
-
rootVisible:true,
|
25
|
-
multiSelect:true,
|
26
|
-
controllerPath:'/knitkit/erp_app/desktop/image_assets/shared',
|
27
|
-
standardUploadUrl:'/knitkit/erp_app/desktop/image_assets/shared/upload_file',
|
28
|
-
url:'/knitkit/erp_app/desktop/image_assets/shared/expand_directory',
|
29
|
-
containerScroll: true,
|
30
|
-
height:200,
|
31
|
-
additionalContextMenuItems:[
|
32
|
-
{
|
33
|
-
nodeType:'leaf',
|
34
|
-
text:'Insert image at cursor',
|
35
|
-
iconCls:'icon-add',
|
36
|
-
listeners:{
|
37
|
-
scope:self,
|
38
|
-
'click':function(){
|
39
|
-
var node = this.sharedImageAssetsTreePanel.selectedNode;
|
40
|
-
var imgTagHtml = '<img';
|
41
|
-
if(!Ext.isEmpty(node.data.width) && !Ext.isEmpty(node.data.height)){
|
42
|
-
imgTagHtml += (' width="'+node.data.width+'" height="'+node.data.height+'"');
|
43
|
-
}
|
44
|
-
imgTagHtml += ' alt="'+node.data.text+'" src="/download/'+node.data.text+'?path='+node.data.downloadPath+'" />';
|
45
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror(imgTagHtml);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
],
|
50
|
-
listeners:{
|
51
|
-
'allowdelete':function(){
|
52
|
-
return currentUser.hasCapability('delete','GlobalImageAsset');
|
53
|
-
},
|
54
|
-
'allowupload':function(){
|
55
|
-
return currentUser.hasCapability('upload','GlobalImageAsset');
|
56
|
-
},
|
57
|
-
'itemclick':function(view, record, item, index, e){
|
58
|
-
e.stopEvent();
|
59
|
-
if(!record.data["leaf"]){
|
60
|
-
var store = self.sharedImageAssetsDataView.getStore();
|
61
|
-
store.load({
|
62
|
-
params:{
|
63
|
-
directory:record.data.id
|
64
|
-
}
|
65
|
-
});
|
66
|
-
}
|
67
|
-
else{
|
68
|
-
return false;
|
69
|
-
}
|
70
|
-
},
|
71
|
-
'fileDeleted':function(fileTreePanel, node){
|
72
|
-
var store = self.sharedImageAssetsDataView.getStore();
|
73
|
-
store.load({
|
74
|
-
params:{
|
75
|
-
directory:node.data.downloadPath
|
76
|
-
}
|
77
|
-
});
|
78
|
-
},
|
79
|
-
'fileUploaded':function(fileTreePanel, node){
|
80
|
-
var store = self.sharedImageAssetsDataView.getStore();
|
81
|
-
store.load({
|
82
|
-
params:{
|
83
|
-
directory:node.data.id
|
84
|
-
}
|
85
|
-
});
|
86
|
-
},
|
87
|
-
'downloadfile':function(fileTreePanel, node){
|
88
|
-
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath+'&disposition=attachment','mywindow','width=400,height=200');
|
89
|
-
return false;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
});
|
93
|
-
|
94
|
-
this.websiteImageAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
95
|
-
autoLoadRoot:false,
|
96
|
-
region:'north',
|
97
|
-
rootText:'Images',
|
98
|
-
collapsible:false,
|
99
|
-
allowDownload:false,
|
100
|
-
addViewContentsToContextMenu:false,
|
101
|
-
showNewFileMenuItem:false,
|
102
|
-
rootVisible:true,
|
103
|
-
multiSelect:true,
|
104
|
-
controllerPath:'/knitkit/erp_app/desktop/image_assets/website',
|
105
|
-
standardUploadUrl:'/knitkit/erp_app/desktop/image_assets/website/upload_file',
|
106
|
-
url:'/knitkit/erp_app/desktop/image_assets/website/expand_directory',
|
107
|
-
containerScroll: true,
|
108
|
-
height:200,
|
109
|
-
additionalContextMenuItems:[
|
110
|
-
{
|
111
|
-
nodeType:'leaf',
|
112
|
-
text:'Insert image at cursor',
|
113
|
-
iconCls:'icon-add',
|
114
|
-
listeners:{
|
115
|
-
scope:self,
|
116
|
-
'click':function(){
|
117
|
-
var node = this.websiteImageAssetsTreePanel.selectedNode;
|
118
|
-
var imgTagHtml = '<img';
|
119
|
-
if(!Ext.isEmpty(node.data.width) && !Ext.isEmpty(node.data.height)){
|
120
|
-
imgTagHtml += (' width="'+node.data.width+'" height="'+node.data.height+'"');
|
121
|
-
}
|
122
|
-
imgTagHtml += ' alt="'+node.data.text+'" src="/download/'+node.data.text+'?path='+node.data.downloadPath+'" />';
|
123
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror(imgTagHtml);
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
127
|
-
],
|
128
|
-
listeners:{
|
129
|
-
'load':function(store, node, records){
|
130
|
-
store.getRootNode().data.text = self.websiteName;
|
131
|
-
self.websiteImageAssetsTreePanel.view.refresh();
|
132
|
-
},
|
133
|
-
'itemclick':function(view, record, item, index, e){
|
134
|
-
if(self.websiteId !== null){
|
135
|
-
e.stopEvent();
|
136
|
-
if(!record.data["leaf"]){
|
137
|
-
var store = self.websiteImageAssetsDataView.getStore();
|
138
|
-
store.load({
|
139
|
-
params:{
|
140
|
-
directory:record.data.id,
|
141
|
-
website_id:self.websiteId
|
142
|
-
}
|
143
|
-
});
|
144
|
-
}
|
145
|
-
else{
|
146
|
-
return false;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
},
|
150
|
-
'fileDeleted':function(fileTreePanel, node){
|
151
|
-
self.websiteImageAssetsDataView.getStore().load({
|
152
|
-
params:{
|
153
|
-
directory:node.data.downloadPath,
|
154
|
-
website_id:self.websiteId
|
155
|
-
}
|
156
|
-
});
|
157
|
-
},
|
158
|
-
'fileUploaded':function(fileTreePanel, node){
|
159
|
-
self.websiteImageAssetsDataView.getStore().load({
|
160
|
-
params:{
|
161
|
-
directory:node.data.id,
|
162
|
-
website_id:self.websiteId
|
163
|
-
}
|
164
|
-
});
|
165
|
-
},
|
166
|
-
'downloadfile':function(fileTreePanel, node){
|
167
|
-
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath+'&disposition=attachment','mywindow','width=400,height=200');
|
168
|
-
return false;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
});
|
172
|
-
|
173
|
-
var sharedImagesPanel = Ext.create('Ext.panel.Panel',{
|
174
|
-
cls:'image-assets',
|
175
|
-
region:'center',
|
176
|
-
margins: '5 5 5 0',
|
177
|
-
layout:'fit',
|
178
|
-
items: this.sharedImageAssetsDataView
|
179
|
-
});
|
180
|
-
|
181
|
-
var websiteImagesPanel = Ext.create('Ext.panel.Panel',{
|
182
|
-
cls:'image-assets',
|
183
|
-
region:'center',
|
184
|
-
margins: '5 5 5 0',
|
185
|
-
layout:'fit',
|
186
|
-
items: this.websiteImageAssetsDataView
|
187
|
-
});
|
188
|
-
|
189
|
-
var sharedImagesLayout = Ext.create('Ext.panel.Panel',{
|
190
|
-
layout: 'border',
|
191
|
-
title:'Shared',
|
192
|
-
items: [this.sharedImageAssetsTreePanel, sharedImagesPanel]
|
193
|
-
});
|
194
|
-
|
195
|
-
var websiteImagesLayout = Ext.create('Ext.panel.Panel',{
|
196
|
-
autoRender: true,
|
197
|
-
layout: 'border',
|
198
|
-
title:'Website',
|
199
|
-
items: [this.websiteImageAssetsTreePanel, websiteImagesPanel],
|
200
|
-
listeners:{
|
201
|
-
scope:self,
|
202
|
-
'show': function(panel){
|
203
|
-
self.reloadWebsiteImageAssetsTreePanel(self.websiteId);
|
204
|
-
}
|
205
|
-
}
|
206
|
-
});
|
207
|
-
|
208
|
-
this.selectWebsite = function(websiteId, websiteName){
|
209
|
-
this.websiteId = websiteId;
|
210
|
-
this.websiteName = websiteName;
|
211
|
-
};
|
212
|
-
|
213
|
-
this.reloadWebsiteImageAssetsTreePanel = function(websiteId){
|
214
|
-
this.websiteImageAssetsTreePanel.extraPostData = {
|
215
|
-
website_id:websiteId
|
216
|
-
};
|
217
|
-
this.websiteImageAssetsTreePanel.getStore().setProxy({
|
218
|
-
type: 'ajax',
|
219
|
-
url:'/knitkit/erp_app/desktop/image_assets/website/expand_directory',
|
220
|
-
extraParams:{
|
221
|
-
website_id:websiteId
|
222
|
-
}
|
223
|
-
});
|
224
|
-
|
225
|
-
if (websiteId){
|
226
|
-
while (delNode = this.websiteImageAssetsTreePanel.getRootNode().childNodes[0]) {
|
227
|
-
this.websiteImageAssetsTreePanel.getRootNode().removeChild(delNode);
|
228
|
-
}
|
229
|
-
this.websiteImageAssetsTreePanel.getRootNode().expand();
|
230
|
-
|
231
|
-
if (!this.websiteImageAssetsTreePanel.getStore().isLoading()){
|
232
|
-
this.websiteImageAssetsTreePanel.getStore().load();
|
233
|
-
}
|
234
|
-
}
|
235
|
-
};
|
236
|
-
|
237
|
-
var items = [];
|
238
|
-
if (currentUser.hasCapability('view','GlobalImageAsset')){
|
239
|
-
items.push(sharedImagesLayout);
|
240
|
-
}
|
241
|
-
|
242
|
-
if (currentUser.hasCapability('view','SiteImageAsset')){
|
243
|
-
items.push(websiteImagesLayout);
|
244
|
-
}
|
245
|
-
|
246
|
-
config = Ext.apply({
|
247
|
-
deferredRender:false,
|
248
|
-
layout: 'fit',
|
249
|
-
title:'Images',
|
250
|
-
items: items,
|
251
|
-
activeTab: 1,
|
252
|
-
listeners:{
|
253
|
-
afterrender: function(panel){
|
254
|
-
// workaround for extJS rendering bug. set activetab 1 above and 0 afterrender
|
255
|
-
panel.setActiveTab(0);
|
256
|
-
}
|
257
|
-
}
|
258
|
-
}, config);
|
259
|
-
|
260
|
-
this.callParent([config]);
|
261
|
-
|
262
|
-
}
|
263
|
-
});
|
@@ -1,722 +0,0 @@
|
|
1
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel",{
|
2
|
-
extend:"Ext.grid.Panel",
|
3
|
-
alias:'widget.knitkit_sectionarticlesgridpanel',
|
4
|
-
detachArticle : function(article_id){
|
5
|
-
var self = this;
|
6
|
-
this.initialConfig['centerRegion'].setWindowStatus('Detaching...');
|
7
|
-
Ext.Ajax.request({
|
8
|
-
url: '/knitkit/erp_app/desktop/section/detach_article',
|
9
|
-
method: 'POST',
|
10
|
-
params:{
|
11
|
-
id:self.initialConfig['sectionId'],
|
12
|
-
article_id:article_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 detaching Article');
|
22
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
23
|
-
}
|
24
|
-
},
|
25
|
-
failure: function(response) {
|
26
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
27
|
-
Ext.Msg.alert('Error', 'Error detaching Article');
|
28
|
-
}
|
29
|
-
});
|
30
|
-
},
|
31
|
-
|
32
|
-
editArticle : function(record){
|
33
|
-
var self = this;
|
34
|
-
var itemId = 'editArticle-'+record.get('id');
|
35
|
-
var editArticleWindow = Ext.ComponentQuery.query('#'+itemId).first();
|
36
|
-
var editFormItems = [{
|
37
|
-
xtype:'hidden',
|
38
|
-
allowBlank:false,
|
39
|
-
name:'id',
|
40
|
-
value: record.data.id
|
41
|
-
},
|
42
|
-
{
|
43
|
-
xtype:'textfield',
|
44
|
-
fieldLabel:'Title',
|
45
|
-
allowBlank:false,
|
46
|
-
name:'title',
|
47
|
-
value: record.data.title
|
48
|
-
},
|
49
|
-
{
|
50
|
-
xtype:'radiogroup',
|
51
|
-
fieldLabel:'Display title?',
|
52
|
-
name:'display_title',
|
53
|
-
columns:2,
|
54
|
-
items:[
|
55
|
-
{
|
56
|
-
boxLabel:'Yes',
|
57
|
-
name:'display_title',
|
58
|
-
inputValue: 'yes',
|
59
|
-
checked:record.data.display_title
|
60
|
-
},
|
61
|
-
{
|
62
|
-
boxLabel:'No',
|
63
|
-
name:'display_title',
|
64
|
-
inputValue:'no',
|
65
|
-
checked:!record.data.display_title
|
66
|
-
}]
|
67
|
-
},
|
68
|
-
{
|
69
|
-
xtype:'textfield',
|
70
|
-
fieldLabel:'Internal ID',
|
71
|
-
allowBlank:true,
|
72
|
-
name:'internal_identifier',
|
73
|
-
value: record.data.internal_identifier
|
74
|
-
}
|
75
|
-
];
|
76
|
-
if (self.alias.first() == 'widget.knitkit_pagearticlesgridpanel'){
|
77
|
-
editFormItems = editFormItems.concat([
|
78
|
-
{
|
79
|
-
xtype:'textfield',
|
80
|
-
fieldLabel:'Content Area',
|
81
|
-
name:'content_area',
|
82
|
-
value:record.data.content_area
|
83
|
-
},
|
84
|
-
{
|
85
|
-
xtype:'numberfield',
|
86
|
-
fieldLabel:'Position',
|
87
|
-
name:'position',
|
88
|
-
value:record.data.position
|
89
|
-
}
|
90
|
-
]);
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
if (self.alias.first() == 'widget.knitkit_blogarticlesgridpanel'){
|
94
|
-
editFormItems = editFormItems.concat( [
|
95
|
-
{
|
96
|
-
xtype:'textfield',
|
97
|
-
fieldLabel:'Tags',
|
98
|
-
allowBlank:true,
|
99
|
-
name:'tags',
|
100
|
-
value:record.data.tag_list
|
101
|
-
}
|
102
|
-
]);
|
103
|
-
}
|
104
|
-
}
|
105
|
-
editFormItems = editFormItems.concat([
|
106
|
-
{
|
107
|
-
xtype: 'displayfield',
|
108
|
-
fieldLabel: 'Created At',
|
109
|
-
name: 'created_at',
|
110
|
-
value: record.data.created_at
|
111
|
-
},
|
112
|
-
{
|
113
|
-
xtype: 'displayfield',
|
114
|
-
fieldLabel: 'Updated At',
|
115
|
-
name: 'updated_at',
|
116
|
-
value: record.data.updated_at
|
117
|
-
}
|
118
|
-
]);
|
119
|
-
if(Ext.isEmpty(editArticleWindow)){
|
120
|
-
editArticleWindow = Ext.create("Ext.window.Window",{
|
121
|
-
layout:'fit',
|
122
|
-
width:375,
|
123
|
-
title:'Edit Article',
|
124
|
-
itemId:itemId,
|
125
|
-
plain: true,
|
126
|
-
buttonAlign:'center',
|
127
|
-
items: {
|
128
|
-
xtype: 'form',
|
129
|
-
labelWidth: 110,
|
130
|
-
frame:false,
|
131
|
-
bodyStyle:'padding:5px 5px 0',
|
132
|
-
width: 425,
|
133
|
-
url:'/knitkit/erp_app/desktop/articles/update/' + self.sectionId,
|
134
|
-
defaults: {
|
135
|
-
width: 225
|
136
|
-
},
|
137
|
-
items: editFormItems
|
138
|
-
},
|
139
|
-
buttons: [{
|
140
|
-
text:'Submit',
|
141
|
-
listeners:{
|
142
|
-
'click':function(button){
|
143
|
-
var window = button.findParentByType('window');
|
144
|
-
var formPanel = window.query('form')[0];
|
145
|
-
self.initialConfig['centerRegion'].setWindowStatus('Updating article...');
|
146
|
-
formPanel.getForm().submit({
|
147
|
-
reset:false,
|
148
|
-
success:function(form, action){
|
149
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
150
|
-
var obj = Ext.decode(action.response.responseText);
|
151
|
-
if(obj.success){
|
152
|
-
self.getStore().load();
|
153
|
-
if(formPanel.getForm().findField('tag_list')){
|
154
|
-
var tag_list = formPanel.getForm().findField('tag_list').getValue();
|
155
|
-
record.set('tag_list', tag_list);
|
156
|
-
}
|
157
|
-
if(formPanel.getForm().findField('content_area')){
|
158
|
-
var content_area = formPanel.getForm().findField('content_area').getValue();
|
159
|
-
record.set('content_area', content_area);
|
160
|
-
}
|
161
|
-
if(formPanel.getForm().findField('position')){
|
162
|
-
var position = formPanel.getForm().findField('position').getValue();
|
163
|
-
record.set('position', position);
|
164
|
-
}
|
165
|
-
editArticleWindow.close();
|
166
|
-
}
|
167
|
-
else{
|
168
|
-
Ext.Msg.alert("Error", obj.msg);
|
169
|
-
}
|
170
|
-
},
|
171
|
-
failure:function(form, action){
|
172
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
173
|
-
Ext.Msg.alert("Error", "Error updating article");
|
174
|
-
}
|
175
|
-
});
|
176
|
-
}
|
177
|
-
}
|
178
|
-
},{
|
179
|
-
text: 'Close',
|
180
|
-
handler: function(){
|
181
|
-
editArticleWindow.close();
|
182
|
-
}
|
183
|
-
}]
|
184
|
-
});
|
185
|
-
}
|
186
|
-
editArticleWindow.show();
|
187
|
-
},
|
188
|
-
|
189
|
-
initComponent: function() {
|
190
|
-
this.callParent([arguments]);
|
191
|
-
this.getStore().load();
|
192
|
-
},
|
193
|
-
|
194
|
-
constructor : function(config) {
|
195
|
-
var self = this;
|
196
|
-
var sectionId = config['sectionId'];
|
197
|
-
|
198
|
-
// create the Data Store
|
199
|
-
var store = Ext.create('Ext.data.Store', {
|
200
|
-
pageSize: 10,
|
201
|
-
proxy: {
|
202
|
-
type: 'ajax',
|
203
|
-
url:'/knitkit/erp_app/desktop/articles/get/' + sectionId,
|
204
|
-
reader: {
|
205
|
-
type: 'json',
|
206
|
-
root: 'data'
|
207
|
-
}
|
208
|
-
},
|
209
|
-
remoteSort: true,
|
210
|
-
fields:[
|
211
|
-
{name:'id'},
|
212
|
-
{name:'title'},
|
213
|
-
{name:'tag_list'},
|
214
|
-
{name:'excerpt_html'},
|
215
|
-
{name:'position'},
|
216
|
-
{name:'content_area'},
|
217
|
-
{name:'body_html'},
|
218
|
-
{name:'internal_identifier'},
|
219
|
-
{name:'display_title'},
|
220
|
-
{name:'created_at'},
|
221
|
-
{name:'updated_at'}
|
222
|
-
]
|
223
|
-
});
|
224
|
-
|
225
|
-
var overiddenColumns = [{
|
226
|
-
header:'Title',
|
227
|
-
sortable:true,
|
228
|
-
dataIndex:'title',
|
229
|
-
width:110
|
230
|
-
}];
|
231
|
-
|
232
|
-
if(!Compass.ErpApp.Utility.isBlank(config['columns'])){
|
233
|
-
overiddenColumns = overiddenColumns.concat(config['columns']);
|
234
|
-
}
|
235
|
-
|
236
|
-
overiddenColumns = overiddenColumns.concat([
|
237
|
-
{
|
238
|
-
menuDisabled:true,
|
239
|
-
resizable:false,
|
240
|
-
xtype:'actioncolumn',
|
241
|
-
header:'HTML',
|
242
|
-
align:'center',
|
243
|
-
width:40,
|
244
|
-
items:[{
|
245
|
-
icon:'/images/icons/edit/edit_16x16.png',
|
246
|
-
iconCls:'actioncolumn_hover',
|
247
|
-
tooltip:'Edit',
|
248
|
-
handler :function(grid, rowIndex, colIndex){
|
249
|
-
var rec = grid.getStore().getAt(rowIndex);
|
250
|
-
self.initialConfig['centerRegion'].editContent(rec.get('title'), rec.get('id'), rec.get('body_html'), grid.ownerCt.initialConfig.siteId, grid.ownerCt.initialConfig.contentType, grid.getStore());
|
251
|
-
}
|
252
|
-
}]
|
253
|
-
}]);
|
254
|
-
|
255
|
-
if (currentUser.hasCapability('edit','Content'))
|
256
|
-
{
|
257
|
-
overiddenColumns = overiddenColumns.concat([
|
258
|
-
{
|
259
|
-
menuDisabled:true,
|
260
|
-
resizable:false,
|
261
|
-
xtype:'actioncolumn',
|
262
|
-
header:'Edit',
|
263
|
-
align:'center',
|
264
|
-
width:40,
|
265
|
-
items:[{
|
266
|
-
icon:'/images/icons/edit/edit_16x16.png',
|
267
|
-
iconCls:'actioncolumn_hover',
|
268
|
-
tooltip:'Edit Attributes',
|
269
|
-
handler :function(grid, rowIndex, colIndex){
|
270
|
-
var rec = grid.getStore().getAt(rowIndex);
|
271
|
-
self.editArticle(rec);
|
272
|
-
}
|
273
|
-
}]
|
274
|
-
}]);
|
275
|
-
}
|
276
|
-
|
277
|
-
if (currentUser.hasCapability('delete','Content'))
|
278
|
-
{
|
279
|
-
overiddenColumns = overiddenColumns.concat([
|
280
|
-
{
|
281
|
-
menuDisabled:true,
|
282
|
-
resizable:false,
|
283
|
-
xtype:'actioncolumn',
|
284
|
-
header:'Detach',
|
285
|
-
align:'center',
|
286
|
-
width:40,
|
287
|
-
items:[{
|
288
|
-
icon:'/images/icons/delete/delete_16x16.png',
|
289
|
-
iconCls:'actioncolumn_hover',
|
290
|
-
tooltip:'Delete Article from Section',
|
291
|
-
handler :function(grid, rowIndex, colIndex){
|
292
|
-
var rec = grid.getStore().getAt(rowIndex);
|
293
|
-
var id = rec.get('id');
|
294
|
-
var messageBox = Ext.MessageBox.confirm(
|
295
|
-
'Confirm', 'Are you sure? NOTE: Article may be orphaned',
|
296
|
-
function(btn){
|
297
|
-
if (btn == 'yes'){
|
298
|
-
self.detachArticle(id);
|
299
|
-
}
|
300
|
-
}
|
301
|
-
);
|
302
|
-
}
|
303
|
-
}]
|
304
|
-
}
|
305
|
-
]);
|
306
|
-
}
|
307
|
-
|
308
|
-
var addFormItems = [
|
309
|
-
{
|
310
|
-
xtype:'textfield',
|
311
|
-
fieldLabel:'Title',
|
312
|
-
allowBlank:false,
|
313
|
-
name:'title'
|
314
|
-
},
|
315
|
-
{
|
316
|
-
xtype:'radiogroup',
|
317
|
-
fieldLabel:'Display title?',
|
318
|
-
name:'display_title',
|
319
|
-
columns:2,
|
320
|
-
items:[
|
321
|
-
{
|
322
|
-
boxLabel:'Yes',
|
323
|
-
name:'display_title',
|
324
|
-
inputValue: 'yes',
|
325
|
-
checked:true
|
326
|
-
},
|
327
|
-
|
328
|
-
{
|
329
|
-
boxLabel:'No',
|
330
|
-
name:'display_title',
|
331
|
-
inputValue: 'no'
|
332
|
-
}]
|
333
|
-
},
|
334
|
-
{
|
335
|
-
xtype:'textfield',
|
336
|
-
fieldLabel:'Internal ID',
|
337
|
-
allowBlank:true,
|
338
|
-
name:'internal_identifier'
|
339
|
-
}
|
340
|
-
];
|
341
|
-
|
342
|
-
if(!Compass.ErpApp.Utility.isBlank(config['addFormItems'])){
|
343
|
-
addFormItems = addFormItems.concat(config['addFormItems']);
|
344
|
-
}
|
345
|
-
|
346
|
-
var tbarItems = [];
|
347
|
-
|
348
|
-
if (currentUser.hasCapability('create','Content'))
|
349
|
-
{
|
350
|
-
tbarItems.push(
|
351
|
-
{
|
352
|
-
text: 'New Article',
|
353
|
-
iconCls: 'icon-add',
|
354
|
-
handler : function(){
|
355
|
-
var addArticleWindow = new Ext.Window({
|
356
|
-
layout:'fit',
|
357
|
-
width:375,
|
358
|
-
title:'New Article',
|
359
|
-
plain: true,
|
360
|
-
buttonAlign:'center',
|
361
|
-
items: new Ext.FormPanel({
|
362
|
-
labelWidth: 110,
|
363
|
-
frame:false,
|
364
|
-
bodyStyle:'padding:5px 5px 0',
|
365
|
-
width: 425,
|
366
|
-
url:'/knitkit/erp_app/desktop/articles/new/' + self.initialConfig['sectionId'],
|
367
|
-
defaults: {
|
368
|
-
width: 257
|
369
|
-
},
|
370
|
-
items: addFormItems
|
371
|
-
}),
|
372
|
-
buttons: [{
|
373
|
-
text:'Submit',
|
374
|
-
listeners:{
|
375
|
-
'click':function(button){
|
376
|
-
var window = button.findParentByType('window');
|
377
|
-
var formPanel = window.query('form')[0];
|
378
|
-
self.initialConfig['centerRegion'].setWindowStatus('Creating article...');
|
379
|
-
formPanel.getForm().submit({
|
380
|
-
reset:true,
|
381
|
-
success:function(form, action){
|
382
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
383
|
-
var obj = Ext.decode(action.response.responseText);
|
384
|
-
if(obj.success){
|
385
|
-
self.getStore().load();
|
386
|
-
}
|
387
|
-
else{
|
388
|
-
Ext.Msg.alert("Error", obj.msg);
|
389
|
-
}
|
390
|
-
addArticleWindow.close();
|
391
|
-
|
392
|
-
},
|
393
|
-
failure:function(form, action){
|
394
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
395
|
-
Ext.Msg.alert("Error", "Error creating article");
|
396
|
-
}
|
397
|
-
});
|
398
|
-
}
|
399
|
-
}
|
400
|
-
},{
|
401
|
-
text: 'Close',
|
402
|
-
handler: function(){
|
403
|
-
addArticleWindow.close();
|
404
|
-
}
|
405
|
-
}]
|
406
|
-
});
|
407
|
-
addArticleWindow.show();
|
408
|
-
}
|
409
|
-
});
|
410
|
-
}
|
411
|
-
|
412
|
-
if (currentUser.hasCapability('add_existing','Content'))
|
413
|
-
{
|
414
|
-
tbarItems.push(
|
415
|
-
{
|
416
|
-
text: 'Attach Article',
|
417
|
-
iconCls: 'icon-copy',
|
418
|
-
handler : function(){
|
419
|
-
var addExistingArticleWindow = new Ext.Window({
|
420
|
-
layout:'fit',
|
421
|
-
width:375,
|
422
|
-
title:'Attach Existing Article',
|
423
|
-
height:130,
|
424
|
-
plain: true,
|
425
|
-
buttonAlign:'center',
|
426
|
-
items: new Ext.FormPanel({
|
427
|
-
labelWidth: 75,
|
428
|
-
frame:false,
|
429
|
-
bodyStyle:'padding:5px 5px 0',
|
430
|
-
width: 425,
|
431
|
-
url:'/knitkit/erp_app/desktop/articles/add_existing/' + self.initialConfig['sectionId'],
|
432
|
-
items:[
|
433
|
-
{
|
434
|
-
itemId: 'available_articles_filter_combobox',
|
435
|
-
xtype:'combo',
|
436
|
-
hiddenName:'website_id',
|
437
|
-
name:'website_id',
|
438
|
-
labelWidth: 50,
|
439
|
-
width:350,
|
440
|
-
loadingText:'Retrieving Websites...',
|
441
|
-
store:Ext.create('Ext.data.Store',{
|
442
|
-
autoLoad: true,
|
443
|
-
proxy:{
|
444
|
-
type:'ajax',
|
445
|
-
reader:{
|
446
|
-
type:'json',
|
447
|
-
root:'websites'
|
448
|
-
},
|
449
|
-
extraParams:{
|
450
|
-
section_id:self.initialConfig['sectionId']
|
451
|
-
},
|
452
|
-
url:'/knitkit/erp_app/desktop/section/available_articles_filter'
|
453
|
-
},
|
454
|
-
fields:[
|
455
|
-
{
|
456
|
-
name:'id'
|
457
|
-
},
|
458
|
-
{
|
459
|
-
name:'internal_identifier'
|
460
|
-
|
461
|
-
},
|
462
|
-
{
|
463
|
-
name:'name'
|
464
|
-
|
465
|
-
}],
|
466
|
-
listeners:{
|
467
|
-
'load':function(store){
|
468
|
-
available_articles_filter_combobox = Ext.ComponentQuery.query('#available_articles_filter_combobox')[0];
|
469
|
-
available_articles_filter_combobox.select(0);
|
470
|
-
available_articles_filter_combobox.fireEvent('select');
|
471
|
-
}
|
472
|
-
}
|
473
|
-
}),
|
474
|
-
forceSelection:true,
|
475
|
-
fieldLabel:'Filter By',
|
476
|
-
queryMode: 'local',
|
477
|
-
autoSelect:true,
|
478
|
-
typeAhead: true,
|
479
|
-
displayField:'name',
|
480
|
-
valueField:'id',
|
481
|
-
triggerAction: 'all',
|
482
|
-
allowBlank:false,
|
483
|
-
listeners:{
|
484
|
-
'select':function(combo, records){
|
485
|
-
available_articles_combobox = Ext.ComponentQuery.query('#available_articles_combobox')[0];
|
486
|
-
available_articles_combobox.getPicker().setLoading(false);
|
487
|
-
available_articles_combobox.getStore().load({
|
488
|
-
params:{
|
489
|
-
section_id: self.initialConfig['sectionId'],
|
490
|
-
website_id: Ext.ComponentQuery.query('#available_articles_filter_combobox')[0].getValue()
|
491
|
-
}
|
492
|
-
});
|
493
|
-
}
|
494
|
-
}
|
495
|
-
},
|
496
|
-
{
|
497
|
-
xtype:'combo',
|
498
|
-
itemId:'available_articles_combobox',
|
499
|
-
hiddenName:'article_id',
|
500
|
-
name:'article_id',
|
501
|
-
labelWidth: 50,
|
502
|
-
width:350,
|
503
|
-
loadingText:'Retrieving Articles...',
|
504
|
-
store:Ext.create('Ext.data.Store',{
|
505
|
-
autoLoad: false,
|
506
|
-
remoteFilter: true,
|
507
|
-
proxy:{
|
508
|
-
type:'ajax',
|
509
|
-
reader:{
|
510
|
-
type:'json',
|
511
|
-
root:'articles'
|
512
|
-
},
|
513
|
-
extraParams:{
|
514
|
-
section_id:self.initialConfig['sectionId']
|
515
|
-
},
|
516
|
-
url:'/knitkit/erp_app/desktop/section/available_articles'
|
517
|
-
},
|
518
|
-
fields:[
|
519
|
-
{
|
520
|
-
name:'id'
|
521
|
-
},
|
522
|
-
{
|
523
|
-
name:'internal_identifier'
|
524
|
-
|
525
|
-
},
|
526
|
-
{
|
527
|
-
name:'combobox_display_value'
|
528
|
-
}
|
529
|
-
],
|
530
|
-
listeners: {
|
531
|
-
'beforeload':function(store){
|
532
|
-
Ext.apply(store.getProxy().extraParams, {
|
533
|
-
website_id: Ext.ComponentQuery.query('#available_articles_filter_combobox')[0].getValue()
|
534
|
-
});
|
535
|
-
},
|
536
|
-
'load':function(store, records){
|
537
|
-
available_articles_combobox = Ext.ComponentQuery.query('#available_articles_combobox')[0];
|
538
|
-
available_articles_combobox.setValue(store.getAt(0).data.id);
|
539
|
-
}
|
540
|
-
}
|
541
|
-
}),
|
542
|
-
queryMode: 'local',
|
543
|
-
forceSelection:true,
|
544
|
-
fieldLabel:'Article',
|
545
|
-
autoSelect:true,
|
546
|
-
typeAhead: true,
|
547
|
-
displayField:'combobox_display_value',
|
548
|
-
valueField:'id',
|
549
|
-
triggerAction: 'all',
|
550
|
-
allowBlank:false,
|
551
|
-
loadMask: false
|
552
|
-
}
|
553
|
-
]
|
554
|
-
}),
|
555
|
-
buttons: [{
|
556
|
-
text:'Submit',
|
557
|
-
listeners:{
|
558
|
-
'click':function(button){
|
559
|
-
var window = button.findParentByType('window');
|
560
|
-
var formPanel = window.query('form')[0];
|
561
|
-
self.initialConfig['centerRegion'].setWindowStatus('Attaching article...');
|
562
|
-
formPanel.getForm().submit({
|
563
|
-
reset:true,
|
564
|
-
success:function(form, action){
|
565
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
566
|
-
var obj = Ext.decode(action.response.responseText);
|
567
|
-
if(obj.success){
|
568
|
-
self.getStore().load();
|
569
|
-
window.close();
|
570
|
-
}else{
|
571
|
-
Ext.Msg.alert("Error", "Error Attaching article");
|
572
|
-
}
|
573
|
-
},
|
574
|
-
failure:function(form, action){
|
575
|
-
self.initialConfig['centerRegion'].clearWindowStatus();
|
576
|
-
Ext.Msg.alert("Error", "Error Attaching article");
|
577
|
-
}
|
578
|
-
});
|
579
|
-
}
|
580
|
-
}
|
581
|
-
},{
|
582
|
-
text: 'Close',
|
583
|
-
handler: function(){
|
584
|
-
addExistingArticleWindow.close();
|
585
|
-
}
|
586
|
-
}]
|
587
|
-
});
|
588
|
-
addExistingArticleWindow.show();
|
589
|
-
}
|
590
|
-
}
|
591
|
-
);
|
592
|
-
}
|
593
|
-
|
594
|
-
config['columns'] = overiddenColumns;
|
595
|
-
config = Ext.apply({
|
596
|
-
store:store,
|
597
|
-
tbar: tbarItems,
|
598
|
-
bbar: new Ext.PagingToolbar({
|
599
|
-
store: store,
|
600
|
-
displayInfo: true,
|
601
|
-
displayMsg: '{0} - {1} of {2}',
|
602
|
-
emptyMsg: "Empty"
|
603
|
-
})
|
604
|
-
}, config);
|
605
|
-
|
606
|
-
this.callParent([config]);
|
607
|
-
}
|
608
|
-
});
|
609
|
-
|
610
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.PageArticlesGridPanel",{
|
611
|
-
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel",
|
612
|
-
alias:'widget.knitkit_pagearticlesgridpanel',
|
613
|
-
|
614
|
-
constructor : function(config) {
|
615
|
-
config['contentType'] = 'article';
|
616
|
-
var fm = Ext.form;
|
617
|
-
config = Ext.apply({
|
618
|
-
columns:[{
|
619
|
-
sortable:true,
|
620
|
-
resizable:false,
|
621
|
-
header:'Content Area',
|
622
|
-
dataIndex:'content_area',
|
623
|
-
width:80,
|
624
|
-
editable:false,
|
625
|
-
editor: new fm.TextField({
|
626
|
-
allowBlank: false
|
627
|
-
})
|
628
|
-
},
|
629
|
-
{
|
630
|
-
menuDisabled:true,
|
631
|
-
resizable:false,
|
632
|
-
header:'Pos',
|
633
|
-
sortable:true,
|
634
|
-
dataIndex:'position',
|
635
|
-
width:30,
|
636
|
-
editable:false,
|
637
|
-
editor: new fm.TextField({
|
638
|
-
allowBlank: true
|
639
|
-
})
|
640
|
-
}],
|
641
|
-
addFormHeight:160,
|
642
|
-
addFormItems:[
|
643
|
-
{
|
644
|
-
xtype:'hidden',
|
645
|
-
allowBlank:false,
|
646
|
-
name:'id'
|
647
|
-
},
|
648
|
-
{
|
649
|
-
xtype:'textfield',
|
650
|
-
fieldLabel:'Content Area',
|
651
|
-
name:'content_area'
|
652
|
-
},
|
653
|
-
{
|
654
|
-
xtype:'numberfield',
|
655
|
-
fieldLabel:'Position',
|
656
|
-
name:'position'
|
657
|
-
}
|
658
|
-
]
|
659
|
-
}, config);
|
660
|
-
|
661
|
-
this.callParent([config]);
|
662
|
-
}
|
663
|
-
});
|
664
|
-
|
665
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.BlogArticlesGridPanel",{
|
666
|
-
extend:"Compass.ErpApp.Desktop.Applications.Knitkit.SectionArticlesGridPanel",
|
667
|
-
alias:'widget.knitkit_blogarticlesgridpanel',
|
668
|
-
|
669
|
-
constructor : function(config) {
|
670
|
-
var self = this;
|
671
|
-
config['contentType'] = 'blog';
|
672
|
-
config = Ext.apply({
|
673
|
-
addFormHeight:200,
|
674
|
-
addFormItems:[
|
675
|
-
{
|
676
|
-
xtype:'hidden',
|
677
|
-
allowBlank:false,
|
678
|
-
name:'id'
|
679
|
-
},
|
680
|
-
{
|
681
|
-
xtype:'textfield',
|
682
|
-
fieldLabel:'Tags',
|
683
|
-
allowBlank:true,
|
684
|
-
name:'tags'
|
685
|
-
}
|
686
|
-
],
|
687
|
-
columns:[{
|
688
|
-
menuDisabled:true,
|
689
|
-
resizable:false,
|
690
|
-
xtype:'actioncolumn',
|
691
|
-
header:'Comments',
|
692
|
-
align:'center',
|
693
|
-
width:60,
|
694
|
-
items:[{
|
695
|
-
icon:'/images/icons/document_text/document_text_16x16.png',
|
696
|
-
tooltip:'Comments',
|
697
|
-
handler :function(grid, rowIndex, colIndex){
|
698
|
-
var rec = grid.getStore().getAt(rowIndex);
|
699
|
-
self.initialConfig['centerRegion'].viewContentComments(rec.get('id'), rec.get('title') + ' - Comments');
|
700
|
-
}
|
701
|
-
}]
|
702
|
-
},{
|
703
|
-
menuDisabled:true,
|
704
|
-
resizable:false,
|
705
|
-
xtype:'actioncolumn',
|
706
|
-
header:'Excerpt',
|
707
|
-
align:'center',
|
708
|
-
width:50,
|
709
|
-
items:[{
|
710
|
-
icon:'/images/icons/edit/edit_16x16.png',
|
711
|
-
tooltip:'Edit Excerpt',
|
712
|
-
handler :function(grid, rowIndex, colIndex){
|
713
|
-
var rec = grid.getStore().getAt(rowIndex);
|
714
|
-
self.initialConfig['centerRegion'].editExcerpt(rec.get('title') + ' - Excerpt', rec.get('id'), rec.get('excerpt_html'), self.initialConfig.siteId, grid.getStore());
|
715
|
-
}
|
716
|
-
}]
|
717
|
-
}]
|
718
|
-
}, config);
|
719
|
-
|
720
|
-
this.callParent([config]);
|
721
|
-
}
|
722
|
-
});
|