knitkit 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL-3-LICENSE +674 -0
- data/README.md +6 -0
- data/Rakefile +30 -0
- data/app/assets/javascripts/knitkit/application.js +9 -0
- data/app/assets/stylesheets/knitkit/application.css +7 -0
- data/app/controllers/knitkit/articles_controller.rb +7 -0
- data/app/controllers/knitkit/base_controller.rb +45 -0
- data/app/controllers/knitkit/blogs_controller.rb +27 -0
- data/app/controllers/knitkit/comments_controller.rb +18 -0
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +135 -0
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +144 -0
- data/app/controllers/knitkit/erp_app/desktop/comments_controller.rb +43 -0
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +27 -0
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +145 -0
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -0
- data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +68 -0
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +20 -0
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +272 -0
- data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +135 -0
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +177 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +143 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +116 -0
- data/app/controllers/knitkit/unauthorized_controller.rb +8 -0
- data/app/controllers/knitkit/website_sections_controller.rb +17 -0
- data/app/helpers/application_helper.rb +132 -0
- data/app/models/article.rb +14 -0
- data/app/models/blog.rb +21 -0
- data/app/models/comment.rb +24 -0
- data/app/models/content.rb +158 -0
- data/app/models/extensions/user.rb +5 -0
- data/app/models/published_element.rb +9 -0
- data/app/models/published_website.rb +118 -0
- data/app/models/theme.rb +239 -0
- data/app/models/website.rb +457 -0
- data/app/models/website_host.rb +3 -0
- data/app/models/website_inquiry.rb +11 -0
- data/app/models/website_inquiry_mailer.rb +12 -0
- data/app/models/website_nav.rb +17 -0
- data/app/models/website_nav_item.rb +21 -0
- data/app/models/website_section.rb +152 -0
- data/app/models/website_section_content.rb +4 -0
- data/app/views/knitkit/articles/index.html.erb +3 -0
- data/app/views/knitkit/articles/show.html.erb +4 -0
- data/app/views/knitkit/blogs/_add_comment.html.erb +28 -0
- data/app/views/knitkit/blogs/_comment.html.erb +8 -0
- data/app/views/knitkit/blogs/index.html.erb +51 -0
- data/app/views/knitkit/blogs/index.rss.builder +23 -0
- data/app/views/knitkit/blogs/show.html.erb +22 -0
- data/app/views/knitkit/unauthorized/index.html.erb +4 -0
- data/app/views/knitkit/website_sections/index.html.erb +6 -0
- data/app/views/layouts/knitkit/base.html.erb +59 -0
- data/app/views/menus/knitkit/_default_menu.html.erb +23 -0
- data/app/views/menus/knitkit/_default_section_menu.html.erb +27 -0
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +45 -0
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +49 -0
- data/app/views/shared/knitkit/_bread_crumb.html.erb +7 -0
- data/app/views/shared/knitkit/_footer.html.erb +3 -0
- data/app/views/website_inquiry_mailer/inquiry.erb +3 -0
- data/app/widgets/contact_us/base.rb +86 -0
- data/app/widgets/contact_us/javascript/contact_us.js +13 -0
- data/app/widgets/contact_us/views/_contact_form.html.erb +36 -0
- data/app/widgets/contact_us/views/error.html.erb +10 -0
- data/app/widgets/contact_us/views/index.html.erb +1 -0
- data/app/widgets/contact_us/views/layouts/base.html.erb +7 -0
- data/app/widgets/contact_us/views/success.html.erb +4 -0
- data/app/widgets/google_map/base.rb +48 -0
- data/app/widgets/google_map/javascript/google_map.js +174 -0
- data/app/widgets/google_map/views/index.html.erb +41 -0
- data/app/widgets/login/base.rb +61 -0
- data/app/widgets/login/javascript/login.js +162 -0
- data/app/widgets/login/views/index.html.erb +37 -0
- data/app/widgets/login/views/layouts/base.html.erb +14 -0
- data/app/widgets/login/views/login_header.html.erb +9 -0
- data/app/widgets/login/views/reset_password.html.erb +26 -0
- data/app/widgets/manage_profile/base.rb +327 -0
- data/app/widgets/manage_profile/javascript/manage_profile.js +11 -0
- data/app/widgets/manage_profile/views/_contact_information_form.html.erb +180 -0
- data/app/widgets/manage_profile/views/_password_form.html.erb +20 -0
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +30 -0
- data/app/widgets/manage_profile/views/contact_type_in_use.html.erb +4 -0
- data/app/widgets/manage_profile/views/default_type_error.html.erb +5 -0
- data/app/widgets/manage_profile/views/error.html.erb +3 -0
- data/app/widgets/manage_profile/views/index.html.erb +46 -0
- data/app/widgets/manage_profile/views/layouts/base.html.erb +1 -0
- data/app/widgets/manage_profile/views/password_blank.html.erb +4 -0
- data/app/widgets/manage_profile/views/password_invalid.html.erb +4 -0
- data/app/widgets/manage_profile/views/password_success.html.erb +3 -0
- data/app/widgets/manage_profile/views/success.html.erb +3 -0
- data/app/widgets/reset_password/base.rb +42 -0
- data/app/widgets/reset_password/javascript/reset_password.js +13 -0
- data/app/widgets/reset_password/views/index.html.erb +31 -0
- data/app/widgets/reset_password/views/layouts/base.html.erb +1 -0
- data/app/widgets/search/base.rb +80 -0
- data/app/widgets/search/javascript/search.js +31 -0
- data/app/widgets/search/views/_search.html.erb +39 -0
- data/app/widgets/search/views/index.html.erb +3 -0
- data/app/widgets/search/views/layouts/base.html.erb +24 -0
- data/app/widgets/search/views/show.html.erb +48 -0
- data/app/widgets/signup/base.rb +72 -0
- data/app/widgets/signup/javascript/signup.js +13 -0
- data/app/widgets/signup/views/_signup_form.html.erb +36 -0
- data/app/widgets/signup/views/error.html.erb +11 -0
- data/app/widgets/signup/views/index.html.erb +1 -0
- data/app/widgets/signup/views/layouts/base.html.erb +7 -0
- data/app/widgets/signup/views/success.html.erb +4 -0
- data/config/environment.rb +0 -0
- data/config/routes.rb +41 -0
- data/db/data_migrations/20110509223702_add_publisher_role.rb +11 -0
- data/db/data_migrations/20110816153456_add_knitkit_application.rb +31 -0
- data/db/data_migrations/upgrade/20111011203718_create_paths_for_sections.rb +13 -0
- data/db/data_migrations/upgrade/20111216192114_add_secured_models_to_menu_items.rb +18 -0
- data/db/data_migrations/upgrade/20111216202819_set_contents_iid_to_permalink_where_null.rb +12 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +259 -0
- data/db/migrate/upgrade/20111014190442_update_contents.rb +25 -0
- data/db/migrate/upgrade/20111014201502_add_published_by_to_published_elements.rb +22 -0
- data/db/migrate/upgrade/20111017133851_add_iid_to_section.rb +21 -0
- data/db/migrate/upgrade/20111027145006_add_in_menu_to_section.rb +19 -0
- data/lib/knitkit.rb +12 -0
- data/lib/knitkit/engine.rb +26 -0
- data/lib/knitkit/extensions.rb +18 -0
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +88 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +28 -0
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +38 -0
- data/lib/knitkit/extensions/active_record/theme_support/has_many_themes.rb +34 -0
- data/lib/knitkit/extensions/compass/widgets/base.rb +53 -0
- data/lib/knitkit/extensions/core/array.rb +5 -0
- data/lib/knitkit/extensions/railties/action_view.rb +187 -0
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +198 -0
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +44 -0
- data/lib/knitkit/routing_filter/section_router.rb +55 -0
- data/lib/knitkit/syntax_validator.rb +32 -0
- data/lib/knitkit/version.rb +3 -0
- data/lib/tasks/knitkit_tasks.rake +4 -0
- data/public/images/knitkit/bullet.png +0 -0
- data/public/images/knitkit/content.png +0 -0
- data/public/images/knitkit/footer.png +0 -0
- data/public/images/knitkit/graphic.png +0 -0
- data/public/images/knitkit/greyFadeDown.png +0 -0
- data/public/images/knitkit/link.png +0 -0
- data/public/images/knitkit/logo.png +0 -0
- data/public/images/knitkit/menu.png +0 -0
- data/public/images/knitkit/menu_select.png +0 -0
- data/public/images/knitkit/search.png +0 -0
- data/public/javascripts/datepicker.js +440 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +473 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +576 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +217 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +26 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +109 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +30 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +160 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +46 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +46 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +92 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +220 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +613 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +573 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +664 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +2161 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +52 -0
- data/public/stylesheets/datepicker.css +121 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +114 -0
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +219 -0
- data/public/stylesheets/knitkit/style.css +394 -0
- metadata +289 -0
@@ -0,0 +1,217 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CommentsGridPanel",{
|
2
|
+
extend:"Ext.grid.Panel",
|
3
|
+
alias:'widget.knitkit_commentsgridpanel',
|
4
|
+
approve : function(rec){
|
5
|
+
var self = this;
|
6
|
+
self.initialConfig['centerRegion'].setWindowStatus('Approving Comment...');
|
7
|
+
var conn = new Ext.data.Connection();
|
8
|
+
conn.request({
|
9
|
+
url: '/knitkit/erp_app/desktop/comments/approve',
|
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
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
18
|
+
self.getStore().load();
|
19
|
+
}
|
20
|
+
else{
|
21
|
+
Ext.Msg.alert('Error', 'Error approving comemnt');
|
22
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
23
|
+
}
|
24
|
+
},
|
25
|
+
failure: function(response) {
|
26
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
27
|
+
Ext.Msg.alert('Error', 'Error approving comemnt');
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
|
32
|
+
},
|
33
|
+
|
34
|
+
deleteComment : function(rec){
|
35
|
+
var self = this;
|
36
|
+
self.initialConfig['centerRegion'].setWindowStatus('Deleting Comment...');
|
37
|
+
var conn = new Ext.data.Connection();
|
38
|
+
conn.request({
|
39
|
+
url: '/knitkit/erp_app/desktop/comments/delete',
|
40
|
+
method: 'POST',
|
41
|
+
params:{
|
42
|
+
id:rec.get("id")
|
43
|
+
},
|
44
|
+
success: function(response) {
|
45
|
+
var obj = Ext.decode(response.responseText);
|
46
|
+
if(obj.success){
|
47
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
48
|
+
self.getStore().load();
|
49
|
+
}
|
50
|
+
else{
|
51
|
+
Ext.Msg.alert('Error', 'Error deleting comemnt');
|
52
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
53
|
+
}
|
54
|
+
},
|
55
|
+
failure: function(response) {
|
56
|
+
self.initialConfig['centerRegion'].clearWindowStatus();
|
57
|
+
Ext.Msg.alert('Error', 'Error deleting comemnt');
|
58
|
+
}
|
59
|
+
});
|
60
|
+
|
61
|
+
|
62
|
+
},
|
63
|
+
|
64
|
+
initComponent: function() {
|
65
|
+
this.callParent(arguments);
|
66
|
+
this.getStore().load();
|
67
|
+
},
|
68
|
+
|
69
|
+
constructor : function(config) {
|
70
|
+
var self = this;
|
71
|
+
|
72
|
+
var store = Ext.create('Ext.data.Store', {
|
73
|
+
proxy: {
|
74
|
+
type: 'ajax',
|
75
|
+
url:'/knitkit/erp_app/desktop/comments/index/' + config['contentId'],
|
76
|
+
reader: {
|
77
|
+
type: 'json',
|
78
|
+
root: 'comments'
|
79
|
+
}
|
80
|
+
},
|
81
|
+
remoteSort: true,
|
82
|
+
fields:[
|
83
|
+
{
|
84
|
+
name:'id'
|
85
|
+
},
|
86
|
+
{
|
87
|
+
name:'commentor_name'
|
88
|
+
},
|
89
|
+
{
|
90
|
+
name:'email'
|
91
|
+
},
|
92
|
+
{
|
93
|
+
name:'created_at'
|
94
|
+
},
|
95
|
+
{
|
96
|
+
name:'approved?'
|
97
|
+
},
|
98
|
+
{
|
99
|
+
name:'comment'
|
100
|
+
},
|
101
|
+
{
|
102
|
+
name:'approved_by_username'
|
103
|
+
},
|
104
|
+
{
|
105
|
+
name:'approved_at'
|
106
|
+
}
|
107
|
+
]
|
108
|
+
});
|
109
|
+
|
110
|
+
config = Ext.apply({
|
111
|
+
store:store,
|
112
|
+
columns:[
|
113
|
+
{
|
114
|
+
header:'Commentor',
|
115
|
+
sortable:true,
|
116
|
+
width:150,
|
117
|
+
dataIndex:'commentor_name'
|
118
|
+
},
|
119
|
+
{
|
120
|
+
header:'Email',
|
121
|
+
sortable:true,
|
122
|
+
width:150,
|
123
|
+
dataIndex:'email'
|
124
|
+
},
|
125
|
+
{
|
126
|
+
header:'Commented On',
|
127
|
+
dataIndex:'created_at',
|
128
|
+
width:120,
|
129
|
+
sortable:true,
|
130
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
|
131
|
+
},
|
132
|
+
{
|
133
|
+
menuDisabled:true,
|
134
|
+
resizable:false,
|
135
|
+
xtype:'actioncolumn',
|
136
|
+
header:'View',
|
137
|
+
align:'center',
|
138
|
+
width:50,
|
139
|
+
items:[{
|
140
|
+
icon:'/images/icons/document_view/document_view_16x16.png',
|
141
|
+
tooltip:'View',
|
142
|
+
handler :function(grid, rowIndex, colIndex){
|
143
|
+
var rec = grid.getStore().getAt(rowIndex);
|
144
|
+
self.initialConfig['centerRegion'].showComment(rec.get('comment'));
|
145
|
+
}
|
146
|
+
}]
|
147
|
+
},
|
148
|
+
{
|
149
|
+
menuDisabled:true,
|
150
|
+
resizable:false,
|
151
|
+
xtype:'actioncolumn',
|
152
|
+
header:'Approval',
|
153
|
+
align:'center',
|
154
|
+
width:60,
|
155
|
+
items:[{
|
156
|
+
getClass: function(v, meta, rec) { // Or return a class from a function
|
157
|
+
if (rec.get('approved?')) {
|
158
|
+
this.items[0].tooltip = 'Approved';
|
159
|
+
return 'approved-col';
|
160
|
+
} else {
|
161
|
+
this.items[0].tooltip = 'Approve';
|
162
|
+
return 'approve-col';
|
163
|
+
}
|
164
|
+
},
|
165
|
+
handler: function(grid, rowIndex, colIndex) {
|
166
|
+
var rec = grid.getStore().getAt(rowIndex);
|
167
|
+
if(rec.get('approved?')){
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
else{
|
171
|
+
self.approve(rec)
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}]
|
175
|
+
},
|
176
|
+
{
|
177
|
+
header:'Approved By',
|
178
|
+
sortable:true,
|
179
|
+
width:140,
|
180
|
+
dataIndex:'approved_by_username'
|
181
|
+
},
|
182
|
+
{
|
183
|
+
header:'Approved At',
|
184
|
+
sortable:true,
|
185
|
+
width:140,
|
186
|
+
dataIndex:'approved_at',
|
187
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
|
188
|
+
},
|
189
|
+
{
|
190
|
+
menuDisabled:true,
|
191
|
+
resizable:false,
|
192
|
+
xtype:'actioncolumn',
|
193
|
+
header:'Delete',
|
194
|
+
align:'center',
|
195
|
+
width:50,
|
196
|
+
items:[{
|
197
|
+
icon:'/images/icons/delete/delete_16x16.png',
|
198
|
+
tooltip:'Delete',
|
199
|
+
handler :function(grid, rowIndex, colIndex){
|
200
|
+
var rec = grid.getStore().getAt(rowIndex);
|
201
|
+
self.deleteComment(rec);
|
202
|
+
}
|
203
|
+
}]
|
204
|
+
}
|
205
|
+
],
|
206
|
+
bbar: Ext.create("Ext.PagingToolbar",{
|
207
|
+
pageSize: 10,
|
208
|
+
store: store,
|
209
|
+
displayInfo: true,
|
210
|
+
displayMsg: '{0} - {1} of {2}',
|
211
|
+
emptyMsg: "Empty"
|
212
|
+
})
|
213
|
+
}, config);
|
214
|
+
|
215
|
+
this.callParent([config]);
|
216
|
+
}
|
217
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.EastRegion",{
|
2
|
+
extend:"Ext.TabPanel",
|
3
|
+
alias:'widget.knitkit_eastregion',
|
4
|
+
initComponent: function() {
|
5
|
+
this.imageAssetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel();
|
6
|
+
this.widgetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.WidgetsPanel();
|
7
|
+
this.fileAssetsPanel = new Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel(this.initialConfig['module']);
|
8
|
+
this.items = [this.imageAssetsPanel.layout, this.fileAssetsPanel.layout, this.widgetsPanel.layout];
|
9
|
+
|
10
|
+
this.callParent(arguments);
|
11
|
+
this.setActiveTab(0);
|
12
|
+
},
|
13
|
+
|
14
|
+
constructor : function(config) {
|
15
|
+
config = Ext.apply({
|
16
|
+
id:'knitkitEastRegion',
|
17
|
+
region:'east',
|
18
|
+
width:300,
|
19
|
+
split:true,
|
20
|
+
autoDestroy:true,
|
21
|
+
collapsible:true
|
22
|
+
}, config);
|
23
|
+
|
24
|
+
this.callParent([config]);
|
25
|
+
}
|
26
|
+
});
|
@@ -0,0 +1,109 @@
|
|
1
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
2
|
+
this.websiteId = null;
|
3
|
+
var self = this;
|
4
|
+
self.module = module;
|
5
|
+
|
6
|
+
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
|
+
title:'Shared',
|
12
|
+
allowDownload:false,
|
13
|
+
addViewContentsToContextMenu:false,
|
14
|
+
rootVisible:true,
|
15
|
+
controllerPath:'/knitkit/erp_app/desktop/file_assets/shared',
|
16
|
+
standardUploadUrl:'/knitkit/erp_app/desktop/file_assets/shared/upload_file',
|
17
|
+
xhrUploadUrl:'/knitkit/erp_app/desktop/file_assets/shared/upload_file',
|
18
|
+
url:'/knitkit/erp_app/desktop/file_assets/shared/expand_directory',
|
19
|
+
containerScroll: true,
|
20
|
+
additionalContextMenuItems:[{
|
21
|
+
nodeType:'leaf',
|
22
|
+
text:'Insert link at cursor',
|
23
|
+
iconCls:'icon-add',
|
24
|
+
listeners:{
|
25
|
+
scope:self,
|
26
|
+
'click':function(){
|
27
|
+
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
28
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
29
|
+
if(btn == 'ok'){
|
30
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="#" onclick="window.open(\'/erp_app/public/download_file/?path='+node.data.downloadPath+'\',\'mywindow\',\'width=400,height=200\');return false;">'+text+'</a>');
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}],
|
36
|
+
listeners:{
|
37
|
+
'itemclick':function(view, record, item, index, e){
|
38
|
+
e.stopEvent();
|
39
|
+
return false;
|
40
|
+
},
|
41
|
+
'fileDeleted':function(fileTreePanel, node){},
|
42
|
+
'fileUploaded':function(fileTreePanel, node){}
|
43
|
+
}
|
44
|
+
});
|
45
|
+
|
46
|
+
this.websiteFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
47
|
+
//TODO_EXTJS4 this is added to fix error should be removed when extjs 4 releases fix.
|
48
|
+
viewConfig:{
|
49
|
+
loadMask: false
|
50
|
+
},
|
51
|
+
title:'Website',
|
52
|
+
allowDownload:false,
|
53
|
+
addViewContentsToContextMenu:false,
|
54
|
+
rootVisible:true,
|
55
|
+
controllerPath:'/knitkit/erp_app/desktop/file_assets/website',
|
56
|
+
standardUploadUrl:'/knitkit/erp_app/desktop/file_assets/website/upload_file',
|
57
|
+
xhrUploadUrl:'/knitkit/erp_app/desktop/file_assets/website/upload_file',
|
58
|
+
url:'/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
59
|
+
containerScroll: true,
|
60
|
+
additionalContextMenuItems:[{
|
61
|
+
nodeType:'leaf',
|
62
|
+
text:'Insert link at cursor',
|
63
|
+
iconCls:'icon-add',
|
64
|
+
listeners:{
|
65
|
+
scope:self,
|
66
|
+
'click':function(){
|
67
|
+
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
68
|
+
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
69
|
+
if(btn == 'ok'){
|
70
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="#" onclick="window.open(\'/erp_app/public/download_file/?path='+node.data.downloadPath+'\',\'mywindow\',\'width=400,height=200\');return false;">'+text+'</a>');
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}],
|
76
|
+
listeners:{
|
77
|
+
'itemclick':function(view, record, item, index, e){
|
78
|
+
e.stopEvent();
|
79
|
+
return false;
|
80
|
+
},
|
81
|
+
'fileDeleted':function(fileTreePanel, node){},
|
82
|
+
'fileUploaded':function(fileTreePanel, node){}
|
83
|
+
}
|
84
|
+
});
|
85
|
+
|
86
|
+
this.layout = Ext.create('Ext.panel.Panel',{
|
87
|
+
layout: 'fit',
|
88
|
+
title:'Files',
|
89
|
+
items: Ext.create('Ext.tab.Panel',{
|
90
|
+
items:[this.sharedFileAssetsTreePanel, this.websiteFileAssetsTreePanel]
|
91
|
+
})
|
92
|
+
});
|
93
|
+
|
94
|
+
this.selectWebsite = function(websiteId){
|
95
|
+
this.websiteId = websiteId;
|
96
|
+
this.websiteFileAssetsTreePanel.extraPostData = {
|
97
|
+
website_id:websiteId
|
98
|
+
};
|
99
|
+
this.websiteFileAssetsTreePanel.getStore().setProxy({
|
100
|
+
type: 'ajax',
|
101
|
+
url:'/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
102
|
+
extraParams:{
|
103
|
+
website_id:websiteId
|
104
|
+
}
|
105
|
+
});
|
106
|
+
this.websiteFileAssetsTreePanel.getStore().load();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
@@ -0,0 +1,30 @@
|
|
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
|
+
store: Ext.create('Ext.data.Store', {
|
10
|
+
proxy: {
|
11
|
+
type: 'ajax',
|
12
|
+
url: config['url'],
|
13
|
+
reader: {
|
14
|
+
type: 'json',
|
15
|
+
root: 'images'
|
16
|
+
}
|
17
|
+
},
|
18
|
+
fields:['name', 'url','shortName']
|
19
|
+
}),
|
20
|
+
tpl: new Ext.XTemplate(
|
21
|
+
'<tpl for=".">',
|
22
|
+
'<div class="thumb-wrap" id="{name}">',
|
23
|
+
'<div class="thumb"><img src="{url}" alt="{name}" class="thumb-img"></div>',
|
24
|
+
'<span>{shortName}</span></div>',
|
25
|
+
'</tpl>')
|
26
|
+
}, config);
|
27
|
+
|
28
|
+
this.callParent([config]);
|
29
|
+
}
|
30
|
+
});
|
@@ -0,0 +1,160 @@
|
|
1
|
+
Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function() {
|
2
|
+
var self = this;
|
3
|
+
this.websiteId = null;
|
4
|
+
this.sharedImageAssetsDataView = Ext.create("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
5
|
+
url: '/knitkit/erp_app/desktop/image_assets/shared/get_images'
|
6
|
+
});
|
7
|
+
this.websiteImageAssetsDataView = Ext.create("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
8
|
+
url: '/knitkit/erp_app/desktop/image_assets/website/get_images'
|
9
|
+
});
|
10
|
+
|
11
|
+
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
|
+
region:'north',
|
17
|
+
rootText:'Images',
|
18
|
+
collapsible:true,
|
19
|
+
allowDownload:false,
|
20
|
+
addViewContentsToContextMenu:false,
|
21
|
+
rootVisible:true,
|
22
|
+
controllerPath:'/knitkit/erp_app/desktop/image_assets/shared',
|
23
|
+
standardUploadUrl:'/knitkit/erp_app/desktop/image_assets/shared/upload_file',
|
24
|
+
xhrUploadUrl:'/knitkit/erp_app/desktop/image_assets/shared/upload_file',
|
25
|
+
url:'/knitkit/erp_app/desktop/image_assets/shared/expand_directory',
|
26
|
+
containerScroll: true,
|
27
|
+
height:200,
|
28
|
+
listeners:{
|
29
|
+
'itemclick':function(view, record, item, index, e){
|
30
|
+
e.stopEvent();
|
31
|
+
if(!record.data["leaf"]){
|
32
|
+
var store = self.sharedImageAssetsDataView.getStore();
|
33
|
+
store.load({
|
34
|
+
params:{
|
35
|
+
directory:record.data.id
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
else{
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
},
|
43
|
+
'fileDeleted':function(fileTreePanel, node){
|
44
|
+
var store = self.sharedImageAssetsDataView.getStore();
|
45
|
+
store.load();
|
46
|
+
},
|
47
|
+
'fileUploaded':function(fileTreePanel, node){
|
48
|
+
var store = self.sharedImageAssetsDataView.getStore();
|
49
|
+
store.load();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
this.websiteImageAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
55
|
+
//TODO_EXTJS4 this is added to fix error should be removed when extjs 4 releases fix.
|
56
|
+
region:'north',
|
57
|
+
viewConfig:{
|
58
|
+
loadMask: false
|
59
|
+
},
|
60
|
+
rootText:'Images',
|
61
|
+
collapsible:true,
|
62
|
+
allowDownload:false,
|
63
|
+
addViewContentsToContextMenu:false,
|
64
|
+
rootVisible:true,
|
65
|
+
controllerPath:'/knitkit/erp_app/desktop/image_assets/website',
|
66
|
+
standardUploadUrl:'/knitkit/erp_app/desktop/image_assets/website/upload_file',
|
67
|
+
xhrUploadUrl:'/knitkit/erp_app/desktop/image_assets/website/upload_file',
|
68
|
+
url:'/knitkit/erp_app/desktop/image_assets/website/expand_directory',
|
69
|
+
containerScroll: true,
|
70
|
+
height:200,
|
71
|
+
listeners:{
|
72
|
+
'itemclick':function(view, record, item, index, e){
|
73
|
+
if(self.websiteId != null){
|
74
|
+
e.stopEvent();
|
75
|
+
if(!record.data["leaf"]){
|
76
|
+
var store = self.websiteImageAssetsDataView.getStore();
|
77
|
+
store.load({
|
78
|
+
params:{
|
79
|
+
directory:record.data.id,
|
80
|
+
website_id:self.websiteId
|
81
|
+
}
|
82
|
+
});
|
83
|
+
}
|
84
|
+
else{
|
85
|
+
return false;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
},
|
89
|
+
'fileDeleted':function(fileTreePanel, node){
|
90
|
+
self.websiteImageAssetsDataView.getStore().load({
|
91
|
+
params:{
|
92
|
+
directory:node.data.id,
|
93
|
+
website_id:self.websiteId
|
94
|
+
}
|
95
|
+
});
|
96
|
+
},
|
97
|
+
'fileUploaded':function(fileTreePanel, node){
|
98
|
+
self.websiteImageAssetsDataView.getStore().load({
|
99
|
+
params:{
|
100
|
+
directory:node.data.id,
|
101
|
+
website_id:self.websiteId
|
102
|
+
}
|
103
|
+
});
|
104
|
+
}
|
105
|
+
}
|
106
|
+
});
|
107
|
+
|
108
|
+
var sharedImagesPanel = Ext.create('Ext.panel.Panel',{
|
109
|
+
cls:'image-assets',
|
110
|
+
region:'center',
|
111
|
+
margins: '5 5 5 0',
|
112
|
+
layout:'fit',
|
113
|
+
items: this.sharedImageAssetsDataView
|
114
|
+
});
|
115
|
+
|
116
|
+
var websiteImagesPanel = Ext.create('Ext.panel.Panel',{
|
117
|
+
cls:'image-assets',
|
118
|
+
region:'center',
|
119
|
+
margins: '5 5 5 0',
|
120
|
+
layout:'fit',
|
121
|
+
items: this.websiteImageAssetsDataView
|
122
|
+
});
|
123
|
+
|
124
|
+
var sharedImagesLayout = Ext.create('Ext.panel.Panel',{
|
125
|
+
layout: 'border',
|
126
|
+
title:'Shared',
|
127
|
+
items: [this.sharedImageAssetsTreePanel, sharedImagesPanel]
|
128
|
+
});
|
129
|
+
|
130
|
+
var websiteImagesLayout = Ext.create('Ext.panel.Panel',{
|
131
|
+
layout: 'border',
|
132
|
+
title:'Website',
|
133
|
+
items: [this.websiteImageAssetsTreePanel, websiteImagesPanel]
|
134
|
+
});
|
135
|
+
|
136
|
+
this.layout = Ext.create('Ext.panel.Panel',{
|
137
|
+
layout:'fit',
|
138
|
+
title:'Images',
|
139
|
+
items: Ext.create('Ext.tab.Panel',{
|
140
|
+
items: [sharedImagesLayout, websiteImagesLayout]
|
141
|
+
})
|
142
|
+
});
|
143
|
+
|
144
|
+
this.selectWebsite = function(websiteId){
|
145
|
+
this.websiteId = websiteId;
|
146
|
+
this.websiteImageAssetsTreePanel.extraPostData = {
|
147
|
+
website_id:websiteId
|
148
|
+
};
|
149
|
+
var store = this.websiteImageAssetsTreePanel.getStore();
|
150
|
+
store.load({
|
151
|
+
params:{
|
152
|
+
website_id:websiteId
|
153
|
+
}
|
154
|
+
});
|
155
|
+
this.websiteImageAssetsDataView.getStore().removeAll();
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|