knitkit 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -0
- data/app/controllers/knitkit/base_controller.rb +15 -2
- data/app/controllers/knitkit/blogs_controller.rb +4 -4
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +16 -2
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +198 -57
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +25 -11
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +123 -44
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +83 -9
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +38 -0
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +15 -6
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +185 -98
- data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +38 -16
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +126 -68
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +154 -107
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +113 -54
- data/app/controllers/knitkit/online_document_sections_controller.rb +45 -0
- data/app/controllers/knitkit/unauthorized_controller.rb +5 -0
- data/app/controllers/knitkit/website_sections_controller.rb +8 -9
- data/app/mailers/document_mailer.rb +10 -0
- data/app/models/article.rb +1 -1
- data/app/models/content.rb +35 -3
- data/app/models/document.rb +8 -0
- data/app/models/document_type.rb +3 -0
- data/app/models/documented_content.rb +29 -0
- data/app/models/documented_item.rb +31 -0
- data/app/models/extensions/configuration.rb +5 -0
- data/app/models/extensions/party.rb +13 -0
- data/app/models/online_document_section.rb +40 -0
- data/app/models/theme.rb +22 -26
- data/app/models/valid_document.rb +4 -0
- data/app/models/website.rb +158 -119
- data/app/models/website_inquiry.rb +7 -2
- data/app/models/website_inquiry_mailer.rb +4 -3
- data/app/models/website_party_role.rb +5 -0
- data/app/models/website_section.rb +76 -38
- data/app/views/document_mailer/email_document.html.erb +12 -0
- data/app/views/knitkit/blogs/_add_comment.html.erb +2 -2
- data/app/views/knitkit/online_document_sections/index.html.erb +149 -0
- data/app/views/knitkit/website_sections/index.html.erb +0 -1
- data/app/views/layouts/knitkit/base.html.erb +4 -2
- data/app/views/layouts/knitkit/online_document_sections.html.erb +59 -0
- data/app/views/menus/knitkit/_default_menu.html.erb +1 -1
- data/app/views/menus/knitkit/_default_section_menu.html.erb +1 -1
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +2 -2
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +1 -1
- data/app/widgets/contact_us/base.rb +5 -5
- data/app/widgets/contact_us/javascript/contact_us.js +2 -1
- data/app/widgets/google_map/base.rb +0 -4
- data/app/widgets/google_map/javascript/google_map.js +4 -3
- data/app/widgets/login/base.rb +0 -5
- data/app/widgets/login/javascript/login.js +155 -153
- data/app/widgets/login/views/index.html.erb +3 -3
- data/app/widgets/login/views/reset_password.html.erb +2 -2
- data/app/widgets/manage_profile/base.rb +46 -67
- data/app/widgets/manage_profile/javascript/manage_profile.js +2 -1
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +5 -1
- data/app/widgets/reset_password/base.rb +4 -6
- data/app/widgets/reset_password/javascript/reset_password.js +2 -1
- data/app/widgets/reset_password/views/index.html.erb +4 -3
- data/app/widgets/search/base.rb +1 -5
- data/app/widgets/search/javascript/search.js +2 -1
- data/app/widgets/search/views/show.html.erb +2 -2
- data/app/widgets/signup/base.rb +7 -6
- data/app/widgets/signup/javascript/signup.js +2 -1
- data/app/widgets/signup/views/error.html.erb +1 -1
- data/config/routes.rb +6 -2
- data/db/data_migrations/20110509223702_add_publisher_role.rb +10 -0
- data/db/data_migrations/20111118182910_setup_knitkit_capabilities.rb +84 -0
- data/db/data_migrations/20120127144444_create_website_role_types.rb +13 -0
- data/db/data_migrations/20120127150505_create_website_default_configuration.rb +72 -0
- data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +33 -0
- data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +16 -0
- data/db/data_migrations/upgrade/20120210195616_add_website_configs.rb +19 -0
- data/db/data_migrations/upgrade/20120213205519_populate_website_iids.rb +17 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +22 -5
- data/db/migrate/20111207161928_create_documented_items_table.rb +13 -0
- data/db/migrate/20111208180539_add_document_id_to_documented_item.rb +9 -0
- data/db/migrate/20120315163736_add_document.rb +32 -0
- data/db/migrate/20120503183431_create_valid_documents.rb +16 -0
- data/db/migrate/upgrade/20120116201510_add_render_base_layout_flag.rb +13 -0
- data/db/migrate/upgrade/20120127143745_create_website_party_roles.rb +24 -0
- data/db/migrate/upgrade/20120213184509_add_iid_to_websites.rb +14 -0
- data/lib/knitkit.rb +2 -0
- data/lib/knitkit/config.rb +31 -0
- data/lib/knitkit/engine.rb +12 -3
- data/lib/knitkit/extensions.rb +1 -3
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +2 -3
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +63 -0
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +5 -4
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +70 -0
- data/lib/knitkit/extensions/railties/action_view.rb +22 -10
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +3 -3
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +8 -3
- data/lib/knitkit/routing_filter/section_router.rb +16 -6
- data/lib/knitkit/version.rb +7 -1
- data/public/images/check.png +0 -0
- data/public/images/credit_card.png +0 -0
- data/public/images/knitkit/tooltip.gif +0 -0
- data/public/javascripts/ajax_pagination.js +33 -0
- data/public/javascripts/datepicker.js +6 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +731 -258
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +289 -238
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +2 -4
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +29 -3
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +193 -21
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +27 -26
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +167 -20
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +1 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +5 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +2 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +20 -11
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +279 -228
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +40 -40
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +83 -76
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +1961 -1397
- data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +47 -43
- data/public/javascripts/knitkit/helpers.js +26 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +1 -2
- data/public/stylesheets/knitkit/documentation.css +50 -0
- data/public/stylesheets/knitkit/style.css +23 -1
- data/spec/controllers/knitkit/erp_app/desktop/articles_controller_spec.rb +8 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_controller_spec.rb +396 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_nav_controller_spec.rb +260 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +222 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/workflow.yml +1 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/article.rb +4 -0
- data/spec/factories/basic.rb +3 -0
- data/spec/factories/blog.rb +5 -0
- data/spec/factories/documented_content.rb +4 -0
- data/spec/factories/documented_item.rb +4 -0
- data/spec/factories/online_document_section.rb +6 -0
- data/spec/factories/published_website.rb +4 -0
- data/spec/factories/theme.rb +6 -0
- data/spec/factories/website.rb +5 -0
- data/spec/factories/website_host.rb +4 -0
- data/spec/factories/website_nav.rb +5 -0
- data/spec/factories/website_nav_item.rb +4 -0
- data/spec/factories/website_section.rb +5 -0
- data/spec/models/article_spec.rb +35 -0
- data/spec/models/attribute_type_spec.rb +55 -0
- data/spec/models/attribute_value_spec.rb +114 -0
- data/spec/models/blog_spec.rb +16 -0
- data/spec/models/comment_spec.rb +11 -0
- data/spec/models/content_spec.rb +187 -0
- data/spec/models/documented_item_spec.rb +29 -0
- data/spec/models/online_document_section_spec.rb +34 -0
- data/spec/models/published_element_spec.rb +11 -0
- data/spec/models/published_website_spec.rb +11 -0
- data/spec/models/theme_spec.rb +12 -0
- data/spec/models/website_host_spec.rb +11 -0
- data/spec/models/website_inquiry_spec.rb +24 -0
- data/spec/models/website_nav_item_spec.rb +11 -0
- data/spec/models/website_nav_spec.rb +11 -0
- data/spec/models/website_section_content_spec.rb +11 -0
- data/spec/models/website_section_spec.rb +49 -0
- data/spec/models/website_spec.rb +146 -0
- data/spec/spec_helper.rb +61 -0
- metadata +391 -154
- data/app/controllers/knitkit/articles_controller.rb +0 -7
- data/lib/knitkit/extensions/compass/widgets/base.rb +0 -53
@@ -4,8 +4,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CommentsGridPanel",{
|
|
4
4
|
approve : function(rec){
|
5
5
|
var self = this;
|
6
6
|
self.initialConfig['centerRegion'].setWindowStatus('Approving Comment...');
|
7
|
-
|
8
|
-
conn.request({
|
7
|
+
Ext.Ajax.request({
|
9
8
|
url: '/knitkit/erp_app/desktop/comments/approve',
|
10
9
|
method: 'POST',
|
11
10
|
params:{
|
@@ -34,8 +33,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CommentsGridPanel",{
|
|
34
33
|
deleteComment : function(rec){
|
35
34
|
var self = this;
|
36
35
|
self.initialConfig['centerRegion'].setWindowStatus('Deleting Comment...');
|
37
|
-
|
38
|
-
conn.request({
|
36
|
+
Ext.Ajax.request({
|
39
37
|
url: '/knitkit/erp_app/desktop/comments/delete',
|
40
38
|
method: 'POST',
|
41
39
|
params:{
|
@@ -2,10 +2,36 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.EastRegion",{
|
|
2
2
|
extend:"Ext.TabPanel",
|
3
3
|
alias:'widget.knitkit_eastregion',
|
4
4
|
initComponent: function() {
|
5
|
-
this.imageAssetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel();
|
5
|
+
this.imageAssetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel(this.initialConfig['module']);
|
6
6
|
this.widgetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.WidgetsPanel();
|
7
7
|
this.fileAssetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel(this.initialConfig['module']);
|
8
|
-
this.items = [
|
8
|
+
this.items = [];
|
9
|
+
|
10
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
11
|
+
capability_type_iid:'view',
|
12
|
+
resource:'GlobalImageAsset'
|
13
|
+
}) || currentUser.hasApplicationCapability('knitkit', {
|
14
|
+
capability_type_iid:'view',
|
15
|
+
resource:'SiteImageAsset'
|
16
|
+
}))
|
17
|
+
|
18
|
+
{
|
19
|
+
this.items.push(this.imageAssetsPanel.layout)
|
20
|
+
}
|
21
|
+
|
22
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
23
|
+
capability_type_iid:'view',
|
24
|
+
resource:'GlobalFileAsset'
|
25
|
+
}) || currentUser.hasApplicationCapability('knitkit', {
|
26
|
+
capability_type_iid:'view',
|
27
|
+
resource:'SiteFileAsset'
|
28
|
+
}))
|
29
|
+
|
30
|
+
{
|
31
|
+
this.items.push(this.fileAssetsPanel.layout)
|
32
|
+
}
|
33
|
+
|
34
|
+
this.items.push(this.widgetsPanel.layout)
|
9
35
|
|
10
36
|
this.callParent(arguments);
|
11
37
|
this.setActiveTab(0);
|
@@ -14,7 +40,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.EastRegion",{
|
|
14
40
|
constructor : function(config) {
|
15
41
|
config = Ext.apply({
|
16
42
|
id:'knitkitEastRegion',
|
17
|
-
|
43
|
+
region:'east',
|
18
44
|
width:300,
|
19
45
|
split:true,
|
20
46
|
autoDestroy:true,
|
@@ -1,13 +1,44 @@
|
|
1
1
|
Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
this.websiteId = null;
|
3
|
+
var self = this;
|
4
|
+
self.module = module;
|
5
5
|
|
6
|
+
this.changeSecurityOnFile = function(node, secure, model, websiteId){
|
7
|
+
var msg = secure ? 'Securing file...' : 'Unsecuring file...';
|
8
|
+
var waitMsg = Ext.Msg.wait("Please Wait", msg);
|
9
|
+
Ext.Ajax.request({
|
10
|
+
url: '/knitkit/erp_app/desktop/file_assets/'+model+'/update_security',
|
11
|
+
method: 'POST',
|
12
|
+
params:{
|
13
|
+
path:node.get('id'),
|
14
|
+
secure:secure,
|
15
|
+
website_id:websiteId
|
16
|
+
},
|
17
|
+
success: function(response) {
|
18
|
+
var obj = Ext.decode(response.responseText);
|
19
|
+
if(obj.success){
|
20
|
+
waitMsg.hide();
|
21
|
+
if(secure){
|
22
|
+
node.set('iconCls', 'icon-document_lock');
|
23
|
+
}
|
24
|
+
else{
|
25
|
+
node.set('iconCls', 'icon-document');
|
26
|
+
}
|
27
|
+
node.set('isSecured',secure);
|
28
|
+
node.commit();
|
29
|
+
}
|
30
|
+
else{
|
31
|
+
Ext.Msg.alert('Error', 'Error securing file.');
|
32
|
+
}
|
33
|
+
},
|
34
|
+
failure: function(response) {
|
35
|
+
waitMsg.hide();
|
36
|
+
Ext.Msg.alert('Error', 'Error securing file.');
|
37
|
+
}
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
6
41
|
this.sharedFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
7
|
-
//TODO_EXTJS4 this is added to fix error should be removed when extjs 4 releases fix.
|
8
|
-
viewConfig:{
|
9
|
-
loadMask: false
|
10
|
-
},
|
11
42
|
title:'Shared',
|
12
43
|
allowDownload:false,
|
13
44
|
addViewContentsToContextMenu:false,
|
@@ -18,6 +49,18 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
18
49
|
url:'/knitkit/erp_app/desktop/file_assets/shared/expand_directory',
|
19
50
|
containerScroll: true,
|
20
51
|
additionalContextMenuItems:[{
|
52
|
+
nodeType:'leaf',
|
53
|
+
text:'View Details',
|
54
|
+
iconCls:'icon-add',
|
55
|
+
listeners:{
|
56
|
+
scope:self,
|
57
|
+
'click':function(){
|
58
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
59
|
+
Ext.Msg.alert('Details', 'URL: /download/'+node.data.text+'?path='+node.data.downloadPath);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
},
|
63
|
+
{
|
21
64
|
nodeType:'leaf',
|
22
65
|
text:'Insert link at cursor',
|
23
66
|
iconCls:'icon-add',
|
@@ -27,27 +70,84 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
27
70
|
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
28
71
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
29
72
|
if(btn == 'ok'){
|
30
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="
|
73
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
74
|
+
}
|
75
|
+
});
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
nodeType:'leaf',
|
81
|
+
text:'Insert link at cursor (inline)',
|
82
|
+
iconCls:'icon-add',
|
83
|
+
listeners:{
|
84
|
+
scope:self,
|
85
|
+
'click':function(){
|
86
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
87
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
88
|
+
if(btn == 'ok'){
|
89
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=inline">'+text+'</a>');
|
90
|
+
}
|
91
|
+
});
|
92
|
+
}
|
93
|
+
}
|
94
|
+
},
|
95
|
+
{
|
96
|
+
nodeType:'leaf',
|
97
|
+
text:'Insert link at cursor (prompt)',
|
98
|
+
iconCls:'icon-add',
|
99
|
+
listeners:{
|
100
|
+
scope:self,
|
101
|
+
'click':function(){
|
102
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
103
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
104
|
+
if(btn == 'ok'){
|
105
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
31
106
|
}
|
32
107
|
});
|
33
108
|
}
|
34
109
|
}
|
110
|
+
},
|
111
|
+
{
|
112
|
+
nodeType:'leaf',
|
113
|
+
text:'Update Security',
|
114
|
+
iconCls:'icon-document_lock',
|
115
|
+
listeners:{
|
116
|
+
scope:self,
|
117
|
+
'click':function(){
|
118
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
119
|
+
self.changeSecurityOnFile(node, !node.get('isSecured'), 'shared');
|
120
|
+
}
|
121
|
+
}
|
35
122
|
}],
|
36
123
|
listeners:{
|
124
|
+
'allowdelete':function(){
|
125
|
+
return currentUser.hasApplicationCapability('knitkit', {
|
126
|
+
capability_type_iid:'delete',
|
127
|
+
resource:'GlobalFileAsset'
|
128
|
+
});
|
129
|
+
},
|
130
|
+
'allowupload':function(){
|
131
|
+
return currentUser.hasApplicationCapability('knitkit', {
|
132
|
+
capability_type_iid:'upload',
|
133
|
+
resource:'GlobalFileAsset'
|
134
|
+
});
|
135
|
+
},
|
37
136
|
'itemclick':function(view, record, item, index, e){
|
38
137
|
e.stopEvent();
|
39
138
|
return false;
|
40
139
|
},
|
41
140
|
'fileDeleted':function(fileTreePanel, node){},
|
42
|
-
'fileUploaded':function(fileTreePanel, node){}
|
141
|
+
'fileUploaded':function(fileTreePanel, node){},
|
142
|
+
'downloadfile':function(fileTreePanel, node){
|
143
|
+
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath,'mywindow','width=400,height=200');
|
144
|
+
return false;
|
145
|
+
}
|
43
146
|
}
|
44
147
|
});
|
45
148
|
|
46
149
|
this.websiteFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
47
|
-
|
48
|
-
viewConfig:{
|
49
|
-
loadMask: false
|
50
|
-
},
|
150
|
+
autoLoadRoot:false,
|
51
151
|
title:'Website',
|
52
152
|
allowDownload:false,
|
53
153
|
addViewContentsToContextMenu:false,
|
@@ -59,7 +159,35 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
59
159
|
containerScroll: true,
|
60
160
|
additionalContextMenuItems:[{
|
61
161
|
nodeType:'leaf',
|
62
|
-
text:'
|
162
|
+
text:'View Details',
|
163
|
+
iconCls:'icon-add',
|
164
|
+
listeners:{
|
165
|
+
scope:self,
|
166
|
+
'click':function(){
|
167
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
168
|
+
Ext.Msg.alert('Details', 'URL: /download/'+node.data.text+'?path='+node.data.downloadPath);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
},
|
172
|
+
{
|
173
|
+
nodeType:'leaf',
|
174
|
+
text:'Insert link at cursor (inline)',
|
175
|
+
iconCls:'icon-add',
|
176
|
+
listeners:{
|
177
|
+
scope:self,
|
178
|
+
'click':function(){
|
179
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
180
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
181
|
+
if(btn == 'ok'){
|
182
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
183
|
+
}
|
184
|
+
});
|
185
|
+
}
|
186
|
+
}
|
187
|
+
},
|
188
|
+
{
|
189
|
+
nodeType:'leaf',
|
190
|
+
text:'Insert link at cursor (prompt)',
|
63
191
|
iconCls:'icon-add',
|
64
192
|
listeners:{
|
65
193
|
scope:self,
|
@@ -67,34 +195,79 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
67
195
|
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
68
196
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
69
197
|
if(btn == 'ok'){
|
70
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="
|
198
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
71
199
|
}
|
72
200
|
});
|
73
201
|
}
|
74
202
|
}
|
203
|
+
},
|
204
|
+
{
|
205
|
+
nodeType:'leaf',
|
206
|
+
text:'Update Security',
|
207
|
+
iconCls:'icon-document_lock',
|
208
|
+
listeners:{
|
209
|
+
scope:self,
|
210
|
+
'click':function(){
|
211
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
212
|
+
self.changeSecurityOnFile(node, !node.get('isSecured'), 'website', this.websiteId);
|
213
|
+
}
|
214
|
+
}
|
75
215
|
}],
|
76
216
|
listeners:{
|
217
|
+
scope:self,
|
218
|
+
'show': function(){
|
219
|
+
self.reloadWebsiteFileAssetsTreePanel(self.websiteId);
|
220
|
+
},
|
77
221
|
'itemclick':function(view, record, item, index, e){
|
78
222
|
e.stopEvent();
|
79
223
|
return false;
|
80
224
|
},
|
81
225
|
'fileDeleted':function(fileTreePanel, node){},
|
82
|
-
'fileUploaded':function(fileTreePanel, node){}
|
226
|
+
'fileUploaded':function(fileTreePanel, node){},
|
227
|
+
'downloadfile':function(fileTreePanel, node){
|
228
|
+
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath,'mywindow','width=400,height=200');
|
229
|
+
return false;
|
230
|
+
}
|
83
231
|
}
|
84
232
|
});
|
85
|
-
|
233
|
+
|
234
|
+
var items = [];
|
235
|
+
|
236
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
237
|
+
capability_type_iid:'view',
|
238
|
+
resource:'GlobalFileAsset'
|
239
|
+
}))
|
240
|
+
|
241
|
+
{
|
242
|
+
items.push(this.sharedFileAssetsTreePanel);
|
243
|
+
}
|
244
|
+
|
245
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
246
|
+
capability_type_iid:'view',
|
247
|
+
resource:'SiteFileAsset'
|
248
|
+
}))
|
249
|
+
|
250
|
+
{
|
251
|
+
items.push(this.websiteFileAssetsTreePanel);
|
252
|
+
}
|
253
|
+
|
86
254
|
this.layout = Ext.create('Ext.panel.Panel',{
|
87
255
|
layout: 'fit',
|
88
256
|
title:'Files',
|
89
257
|
items: Ext.create('Ext.tab.Panel',{
|
90
|
-
items:
|
91
|
-
|
258
|
+
items:items
|
259
|
+
})
|
92
260
|
});
|
93
261
|
|
94
262
|
this.selectWebsite = function(websiteId){
|
95
263
|
this.websiteId = websiteId;
|
264
|
+
this.reloadWebsiteFileAssetsTreePanel(websiteId);
|
265
|
+
}
|
266
|
+
|
267
|
+
this.reloadWebsiteFileAssetsTreePanel = function(websiteId){
|
96
268
|
this.websiteFileAssetsTreePanel.extraPostData = {
|
97
|
-
website_id:websiteId
|
269
|
+
website_id:websiteId,
|
270
|
+
websiteid:websiteId // for xhrFileUpload to work
|
98
271
|
};
|
99
272
|
this.websiteFileAssetsTreePanel.getStore().setProxy({
|
100
273
|
type: 'ajax',
|
@@ -106,4 +279,3 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
106
279
|
this.websiteFileAssetsTreePanel.getStore().load();
|
107
280
|
}
|
108
281
|
}
|
109
|
-
|
@@ -1,30 +1,31 @@
|
|
1
1
|
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
2
|
-
|
3
|
-
|
2
|
+
extend:"Ext.view.View",
|
3
|
+
alias:'widget.knitkit_imageassetsdataview',
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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}" alt="{name}" class="thumb-img"></div>',
|
25
|
+
'<span>{shortName}</span></div>',
|
26
|
+
'</tpl>')
|
27
|
+
}, config);
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
this.callParent([config]);
|
30
|
+
}
|
30
31
|
});
|
@@ -1,6 +1,8 @@
|
|
1
|
-
Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
2
|
-
var self = this;
|
1
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module) {
|
3
2
|
this.websiteId = null;
|
3
|
+
var self = this;
|
4
|
+
self.module = module;
|
5
|
+
|
4
6
|
this.sharedImageAssetsDataView = Ext.create("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
5
7
|
url: '/knitkit/erp_app/desktop/image_assets/shared/get_images'
|
6
8
|
});
|
@@ -9,10 +11,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
|
9
11
|
});
|
10
12
|
|
11
13
|
this.sharedImageAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
12
|
-
//TODO_EXTJS4 this is added to fix error should be removed when extjs 4 releases fix.
|
13
|
-
viewConfig:{
|
14
|
-
loadMask: false
|
15
|
-
},
|
16
14
|
region:'north',
|
17
15
|
rootText:'Images',
|
18
16
|
collapsible:true,
|
@@ -25,7 +23,79 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
|
25
23
|
url:'/knitkit/erp_app/desktop/image_assets/shared/expand_directory',
|
26
24
|
containerScroll: true,
|
27
25
|
height:200,
|
26
|
+
additionalContextMenuItems:[{
|
27
|
+
nodeType:'leaf',
|
28
|
+
text:'View Details',
|
29
|
+
iconCls:'icon-add',
|
30
|
+
listeners:{
|
31
|
+
scope:self,
|
32
|
+
'click':function(){
|
33
|
+
var node = this.sharedImageAssetsTreePanel.selectedNode;
|
34
|
+
Ext.Msg.alert('Details', 'URL: /download/'+node.data.text+'?path='+node.data.downloadPath);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
nodeType:'leaf',
|
40
|
+
text:'Insert link at cursor',
|
41
|
+
iconCls:'icon-add',
|
42
|
+
listeners:{
|
43
|
+
scope:self,
|
44
|
+
'click':function(){
|
45
|
+
var node = this.sharedImageAssetsTreePanel.selectedNode;
|
46
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
47
|
+
if(btn == 'ok'){
|
48
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
49
|
+
}
|
50
|
+
});
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
{
|
55
|
+
nodeType:'leaf',
|
56
|
+
text:'Insert link at cursor (inline)',
|
57
|
+
iconCls:'icon-add',
|
58
|
+
listeners:{
|
59
|
+
scope:self,
|
60
|
+
'click':function(){
|
61
|
+
var node = this.sharedImageAssetsTreePanel.selectedNode;
|
62
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
63
|
+
if(btn == 'ok'){
|
64
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=inline">'+text+'</a>');
|
65
|
+
}
|
66
|
+
});
|
67
|
+
}
|
68
|
+
}
|
69
|
+
},
|
70
|
+
{
|
71
|
+
nodeType:'leaf',
|
72
|
+
text:'Insert link at cursor (prompt)',
|
73
|
+
iconCls:'icon-add',
|
74
|
+
listeners:{
|
75
|
+
scope:self,
|
76
|
+
'click':function(){
|
77
|
+
var node = this.sharedImageAssetsTreePanel.selectedNode;
|
78
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
79
|
+
if(btn == 'ok'){
|
80
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
81
|
+
}
|
82
|
+
});
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}],
|
28
86
|
listeners:{
|
87
|
+
'allowdelete':function(){
|
88
|
+
return currentUser.hasApplicationCapability('knitkit', {
|
89
|
+
capability_type_iid:'delete',
|
90
|
+
resource:'GlobalImageAsset'
|
91
|
+
});
|
92
|
+
},
|
93
|
+
'allowupload':function(){
|
94
|
+
return currentUser.hasApplicationCapability('knitkit', {
|
95
|
+
capability_type_iid:'upload',
|
96
|
+
resource:'GlobalImageAsset'
|
97
|
+
});
|
98
|
+
},
|
29
99
|
'itemclick':function(view, record, item, index, e){
|
30
100
|
e.stopEvent();
|
31
101
|
if(!record.data["leaf"]){
|
@@ -47,16 +117,17 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
|
47
117
|
'fileUploaded':function(fileTreePanel, node){
|
48
118
|
var store = self.sharedImageAssetsDataView.getStore();
|
49
119
|
store.load();
|
50
|
-
}
|
120
|
+
},
|
121
|
+
'downloadfile':function(fileTreePanel, node){
|
122
|
+
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath+'&disposition=attachment','mywindow','width=400,height=200');
|
123
|
+
return false;
|
124
|
+
}
|
51
125
|
}
|
52
126
|
});
|
53
127
|
|
54
128
|
this.websiteImageAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
55
|
-
|
129
|
+
autoLoadRoot:false,
|
56
130
|
region:'north',
|
57
|
-
viewConfig:{
|
58
|
-
loadMask: false
|
59
|
-
},
|
60
131
|
rootText:'Images',
|
61
132
|
collapsible:true,
|
62
133
|
allowDownload:false,
|
@@ -68,6 +139,50 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
|
68
139
|
url:'/knitkit/erp_app/desktop/image_assets/website/expand_directory',
|
69
140
|
containerScroll: true,
|
70
141
|
height:200,
|
142
|
+
additionalContextMenuItems:[{
|
143
|
+
nodeType:'leaf',
|
144
|
+
text:'View Details',
|
145
|
+
iconCls:'icon-add',
|
146
|
+
listeners:{
|
147
|
+
scope:self,
|
148
|
+
'click':function(){
|
149
|
+
var node = this.websiteImageAssetsTreePanel.selectedNode;
|
150
|
+
Ext.Msg.alert('Details', 'URL: /download/'+node.data.text+'?path='+node.data.downloadPath);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
{
|
155
|
+
nodeType:'leaf',
|
156
|
+
text:'Insert link at cursor (prompt)',
|
157
|
+
iconCls:'icon-add',
|
158
|
+
listeners:{
|
159
|
+
scope:self,
|
160
|
+
'click':function(){
|
161
|
+
var node = this.websiteImageAssetsTreePanel.selectedNode;
|
162
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
163
|
+
if(btn == 'ok'){
|
164
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
165
|
+
}
|
166
|
+
});
|
167
|
+
}
|
168
|
+
}
|
169
|
+
},
|
170
|
+
{
|
171
|
+
nodeType:'leaf',
|
172
|
+
text:'Insert link at cursor (prompt)',
|
173
|
+
iconCls:'icon-add',
|
174
|
+
listeners:{
|
175
|
+
scope:self,
|
176
|
+
'click':function(){
|
177
|
+
var node = this.websiteImageAssetsTreePanel.selectedNode;
|
178
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
179
|
+
if(btn == 'ok'){
|
180
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
181
|
+
}
|
182
|
+
});
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}],
|
71
186
|
listeners:{
|
72
187
|
'itemclick':function(view, record, item, index, e){
|
73
188
|
if(self.websiteId != null){
|
@@ -101,6 +216,10 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
|
101
216
|
website_id:self.websiteId
|
102
217
|
}
|
103
218
|
});
|
219
|
+
},
|
220
|
+
'downloadfile':function(fileTreePanel, node){
|
221
|
+
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath+'&disposition=attachment','mywindow','width=400,height=200');
|
222
|
+
return false;
|
104
223
|
}
|
105
224
|
}
|
106
225
|
});
|
@@ -130,31 +249,59 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
|
130
249
|
var websiteImagesLayout = Ext.create('Ext.panel.Panel',{
|
131
250
|
layout: 'border',
|
132
251
|
title:'Website',
|
133
|
-
items: [this.websiteImageAssetsTreePanel, websiteImagesPanel]
|
252
|
+
items: [this.websiteImageAssetsTreePanel, websiteImagesPanel],
|
253
|
+
listeners:{
|
254
|
+
scope:self,
|
255
|
+
'show': function(){
|
256
|
+
self.reloadWebsiteImageAssetsTreePanel(self.websiteId);
|
257
|
+
}
|
258
|
+
}
|
134
259
|
});
|
135
260
|
|
261
|
+
var items = [];
|
262
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
263
|
+
capability_type_iid:'view',
|
264
|
+
resource:'GlobalImageAsset'
|
265
|
+
}))
|
266
|
+
|
267
|
+
{
|
268
|
+
items.push(sharedImagesLayout);
|
269
|
+
}
|
270
|
+
|
271
|
+
if (currentUser.hasApplicationCapability('knitkit', {
|
272
|
+
capability_type_iid:'view',
|
273
|
+
resource:'SiteImageAsset'
|
274
|
+
}))
|
275
|
+
|
276
|
+
{
|
277
|
+
items.push(websiteImagesLayout);
|
278
|
+
}
|
279
|
+
|
136
280
|
this.layout = Ext.create('Ext.panel.Panel',{
|
137
281
|
layout:'fit',
|
138
282
|
title:'Images',
|
139
283
|
items: Ext.create('Ext.tab.Panel',{
|
140
|
-
items:
|
284
|
+
items: items
|
141
285
|
})
|
142
286
|
});
|
143
287
|
|
144
288
|
this.selectWebsite = function(websiteId){
|
145
289
|
this.websiteId = websiteId;
|
290
|
+
}
|
291
|
+
|
292
|
+
this.reloadWebsiteImageAssetsTreePanel = function(websiteId){
|
146
293
|
this.websiteImageAssetsTreePanel.extraPostData = {
|
147
|
-
website_id:websiteId
|
294
|
+
website_id:websiteId,
|
295
|
+
websiteid:websiteId // for xhrFileUpload to work
|
148
296
|
};
|
149
|
-
|
150
|
-
|
151
|
-
|
297
|
+
this.websiteImageAssetsTreePanel.getStore().setProxy({
|
298
|
+
type: 'ajax',
|
299
|
+
url:'/knitkit/erp_app/desktop/image_assets/website/expand_directory',
|
300
|
+
extraParams:{
|
152
301
|
website_id:websiteId
|
153
302
|
}
|
154
303
|
});
|
304
|
+
this.websiteImageAssetsTreePanel.getStore().load();
|
155
305
|
this.websiteImageAssetsDataView.getStore().removeAll();
|
156
306
|
}
|
157
307
|
}
|
158
|
-
|
159
|
-
|
160
|
-
|