knitkit 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +5 -8
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +11 -8
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +26 -4
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +49 -35
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +30 -21
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +41 -32
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +0 -6
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +42 -6
- data/app/{models → mailers}/website_inquiry_mailer.rb +0 -0
- data/app/models/article.rb +4 -0
- data/app/models/content.rb +0 -4
- data/app/models/theme.rb +3 -3
- data/app/models/website.rb +44 -17
- data/app/views/knitkit/website_sections/index.html.erb +1 -1
- data/app/views/layouts/knitkit/base.html.erb +6 -0
- data/app/views/shared/knitkit/_footer.html.erb +2 -2
- data/app/widgets/signup/base.rb +0 -2
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +77 -0
- data/lib/knitkit/engine.rb +4 -0
- data/lib/knitkit/extensions.rb +4 -1
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +36 -33
- data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +60 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +9 -4
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +1 -1
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +21 -1
- data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +26 -0
- data/lib/knitkit/extensions/railties/action_view/base.rb +11 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +62 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +83 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/knitkit_helper.rb +67 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +71 -0
- data/lib/knitkit/version.rb +1 -1
- data/public/images/knitkit/close.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +150 -400
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +687 -593
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +1 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +39 -15
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +65 -126
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +65 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +265 -183
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +24 -9
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +631 -595
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +265 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +133 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +174 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +399 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +165 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +266 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +1224 -0
- data/public/javascripts/knitkit/inline_editing.js +136 -0
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +1 -2
- data/public/stylesheets/knitkit/inline_editing.css +88 -0
- data/public/stylesheets/knitkit/style.css +1 -1
- metadata +47 -31
- data/lib/knitkit/extensions/railties/action_view.rb +0 -199
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +0 -2725
@@ -39,11 +39,10 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.EastRegion",{
|
|
39
39
|
|
40
40
|
constructor : function(config) {
|
41
41
|
config = Ext.apply({
|
42
|
-
|
42
|
+
itemId:'knitkitEastRegion',
|
43
43
|
region:'east',
|
44
44
|
width:300,
|
45
45
|
split:true,
|
46
|
-
autoDestroy:true,
|
47
46
|
collapsible:true
|
48
47
|
}, config);
|
49
48
|
|
@@ -39,13 +39,16 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
39
39
|
};
|
40
40
|
|
41
41
|
this.sharedFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
42
|
+
loadMask: true,
|
43
|
+
collapsible:false,
|
42
44
|
title:'Shared',
|
45
|
+
rootText:'Shared Files',
|
43
46
|
allowDownload:false,
|
44
47
|
addViewContentsToContextMenu:false,
|
45
48
|
rootVisible:true,
|
49
|
+
multiSelect:true,
|
46
50
|
controllerPath:'/knitkit/erp_app/desktop/file_assets/shared',
|
47
51
|
standardUploadUrl:'/knitkit/erp_app/desktop/file_assets/shared/upload_file',
|
48
|
-
xhrUploadUrl:'/knitkit/erp_app/desktop/file_assets/shared/upload_file',
|
49
52
|
url:'/knitkit/erp_app/desktop/file_assets/shared/expand_directory',
|
50
53
|
containerScroll: true,
|
51
54
|
additionalContextMenuItems:[{
|
@@ -56,7 +59,10 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
56
59
|
scope:self,
|
57
60
|
'click':function(){
|
58
61
|
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
59
|
-
Ext.Msg.alert('Details', '
|
62
|
+
Ext.Msg.alert('Details', 'Filename: '+node.data.text +
|
63
|
+
'<br /> URL: '+node.data.url +
|
64
|
+
'<br /> Size: ' + node.data.size + ' bytes'
|
65
|
+
);
|
60
66
|
}
|
61
67
|
}
|
62
68
|
},
|
@@ -70,7 +76,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
70
76
|
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
71
77
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
72
78
|
if(btn == 'ok'){
|
73
|
-
self.module.centerRegion.
|
79
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
74
80
|
}
|
75
81
|
});
|
76
82
|
}
|
@@ -86,7 +92,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
86
92
|
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
87
93
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
88
94
|
if(btn == 'ok'){
|
89
|
-
self.module.centerRegion.
|
95
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=inline">'+text+'</a>');
|
90
96
|
}
|
91
97
|
});
|
92
98
|
}
|
@@ -102,7 +108,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
102
108
|
var node = this.sharedFileAssetsTreePanel.selectedNode;
|
103
109
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
104
110
|
if(btn == 'ok'){
|
105
|
-
self.module.centerRegion.
|
111
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
106
112
|
}
|
107
113
|
});
|
108
114
|
}
|
@@ -147,14 +153,16 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
147
153
|
});
|
148
154
|
|
149
155
|
this.websiteFileAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
156
|
+
loadMask: true,
|
157
|
+
collapsible:false,
|
150
158
|
autoLoadRoot:false,
|
151
159
|
title:'Website',
|
152
160
|
allowDownload:false,
|
153
161
|
addViewContentsToContextMenu:false,
|
154
162
|
rootVisible:true,
|
163
|
+
multiSelect:true,
|
155
164
|
controllerPath:'/knitkit/erp_app/desktop/file_assets/website',
|
156
165
|
standardUploadUrl:'/knitkit/erp_app/desktop/file_assets/website/upload_file',
|
157
|
-
xhrUploadUrl:'/knitkit/erp_app/desktop/file_assets/website/upload_file',
|
158
166
|
url:'/knitkit/erp_app/desktop/file_assets/website/expand_directory',
|
159
167
|
containerScroll: true,
|
160
168
|
additionalContextMenuItems:[{
|
@@ -165,7 +173,10 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
165
173
|
scope:self,
|
166
174
|
'click':function(){
|
167
175
|
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
168
|
-
Ext.Msg.alert('Details', '
|
176
|
+
Ext.Msg.alert('Details', 'Filename: '+node.data.text +
|
177
|
+
'<br /> URL: '+node.data.url +
|
178
|
+
'<br /> Size: ' + node.data.size + ' bytes'
|
179
|
+
);
|
169
180
|
}
|
170
181
|
}
|
171
182
|
},
|
@@ -179,7 +190,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
179
190
|
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
180
191
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
181
192
|
if(btn == 'ok'){
|
182
|
-
self.module.centerRegion.
|
193
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'">'+text+'</a>');
|
183
194
|
}
|
184
195
|
});
|
185
196
|
}
|
@@ -195,7 +206,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
195
206
|
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
196
207
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
197
208
|
if(btn == 'ok'){
|
198
|
-
self.module.centerRegion.
|
209
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=inline">'+text+'</a>');
|
199
210
|
}
|
200
211
|
});
|
201
212
|
}
|
@@ -211,7 +222,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
211
222
|
var node = this.websiteFileAssetsTreePanel.selectedNode;
|
212
223
|
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
213
224
|
if(btn == 'ok'){
|
214
|
-
self.module.centerRegion.
|
225
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
215
226
|
}
|
216
227
|
});
|
217
228
|
}
|
@@ -231,6 +242,10 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
231
242
|
}],
|
232
243
|
listeners:{
|
233
244
|
scope:self,
|
245
|
+
'load':function(store, node, records){
|
246
|
+
store.getRootNode().data.text = self.websiteName;
|
247
|
+
self.websiteFileAssetsTreePanel.view.refresh();
|
248
|
+
},
|
234
249
|
'show': function(){
|
235
250
|
self.reloadWebsiteFileAssetsTreePanel(self.websiteId);
|
236
251
|
},
|
@@ -275,15 +290,14 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
275
290
|
})
|
276
291
|
});
|
277
292
|
|
278
|
-
this.selectWebsite = function(websiteId){
|
293
|
+
this.selectWebsite = function(websiteId, websiteName){
|
279
294
|
this.websiteId = websiteId;
|
280
|
-
this.
|
295
|
+
this.websiteName = websiteName;
|
281
296
|
}
|
282
297
|
|
283
298
|
this.reloadWebsiteFileAssetsTreePanel = function(websiteId){
|
284
299
|
this.websiteFileAssetsTreePanel.extraPostData = {
|
285
|
-
website_id:websiteId
|
286
|
-
websiteid:websiteId // for xhrFileUpload to work
|
300
|
+
website_id:websiteId
|
287
301
|
};
|
288
302
|
this.websiteFileAssetsTreePanel.getStore().setProxy({
|
289
303
|
type: 'ajax',
|
@@ -292,6 +306,16 @@ Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel = function(module) {
|
|
292
306
|
website_id:websiteId
|
293
307
|
}
|
294
308
|
});
|
295
|
-
|
309
|
+
|
310
|
+
if (websiteId){
|
311
|
+
while (delNode = this.websiteFileAssetsTreePanel.getRootNode().childNodes[0]) {
|
312
|
+
this.websiteFileAssetsTreePanel.getRootNode().removeChild(delNode);
|
313
|
+
}
|
314
|
+
this.websiteFileAssetsTreePanel.getRootNode().expand();
|
315
|
+
|
316
|
+
if (!this.websiteFileAssetsTreePanel.getStore().isLoading()){
|
317
|
+
this.websiteFileAssetsTreePanel.getStore().load();
|
318
|
+
}
|
319
|
+
}
|
296
320
|
}
|
297
321
|
}
|
@@ -21,7 +21,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView",{
|
|
21
21
|
tpl: new Ext.XTemplate(
|
22
22
|
'<tpl for=".">',
|
23
23
|
'<div class="thumb-wrap" id="{name}">',
|
24
|
-
'<div class="thumb"><img src="{url}" alt="{name}" class="thumb-img"></div>',
|
24
|
+
'<div class="thumb"><img src="{url}" title="{name}" alt="{name}" class="thumb-img"></div>',
|
25
25
|
'<span>{shortName}</span></div>',
|
26
26
|
'</tpl>')
|
27
27
|
}, config);
|
@@ -12,90 +12,49 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module)
|
|
12
12
|
|
13
13
|
this.sharedImageAssetsTreePanel = Ext.create("Compass.ErpApp.Shared.FileManagerTree",{
|
14
14
|
region:'north',
|
15
|
-
rootText:'Images',
|
16
|
-
collapsible:
|
15
|
+
rootText:'Shared Images',
|
16
|
+
collapsible:false,
|
17
17
|
allowDownload:false,
|
18
18
|
addViewContentsToContextMenu:false,
|
19
19
|
rootVisible:true,
|
20
|
+
multiSelect:true,
|
20
21
|
controllerPath:'/knitkit/erp_app/desktop/image_assets/shared',
|
21
22
|
standardUploadUrl:'/knitkit/erp_app/desktop/image_assets/shared/upload_file',
|
22
|
-
xhrUploadUrl:'/knitkit/erp_app/desktop/image_assets/shared/upload_file',
|
23
23
|
url:'/knitkit/erp_app/desktop/image_assets/shared/expand_directory',
|
24
24
|
containerScroll: true,
|
25
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
|
-
},
|
26
|
+
additionalContextMenuItems:[
|
38
27
|
{
|
39
28
|
nodeType:'leaf',
|
40
|
-
text:'Insert
|
29
|
+
text:'Insert image at cursor',
|
41
30
|
iconCls:'icon-add',
|
42
31
|
listeners:{
|
43
32
|
scope:self,
|
44
33
|
'click':function(){
|
45
34
|
var node = this.sharedImageAssetsTreePanel.selectedNode;
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
35
|
+
var imgTagHtml = '<img';
|
36
|
+
if(!Ext.isEmpty(node.data.width) && !Ext.isEmpty(node.data.height)){
|
37
|
+
imgTagHtml += (' width="'+node.data.width+'" height="'+node.data.height+'"');
|
38
|
+
}
|
39
|
+
imgTagHtml += ' alt="'+node.data.text+'" src="/download/'+node.data.text+'?path='+node.data.downloadPath+'" />'
|
40
|
+
self.module.centerRegion.insertHtmlIntoActiveCkEditorOrCodemirror(imgTagHtml);
|
51
41
|
}
|
52
42
|
}
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
-
}
|
43
|
+
}
|
44
|
+
],
|
45
|
+
listeners:{
|
46
|
+
'allowdelete':function(){
|
47
|
+
return currentUser.hasApplicationCapability('knitkit', {
|
48
|
+
capability_type_iid:'delete',
|
49
|
+
resource:'GlobalImageAsset'
|
66
50
|
});
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
-
}
|
51
|
+
},
|
52
|
+
'allowupload':function(){
|
53
|
+
return currentUser.hasApplicationCapability('knitkit', {
|
54
|
+
capability_type_iid:'upload',
|
55
|
+
resource:'GlobalImageAsset'
|
82
56
|
});
|
83
|
-
|
84
|
-
}
|
85
|
-
}],
|
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
|
-
},
|
57
|
+
},
|
99
58
|
'itemclick':function(view, record, item, index, e){
|
100
59
|
e.stopEvent();
|
101
60
|
if(!record.data["leaf"]){
|
@@ -112,11 +71,19 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module)
|
|
112
71
|
},
|
113
72
|
'fileDeleted':function(fileTreePanel, node){
|
114
73
|
var store = self.sharedImageAssetsDataView.getStore();
|
115
|
-
store.load(
|
74
|
+
store.load({
|
75
|
+
params:{
|
76
|
+
directory:node.data.downloadPath
|
77
|
+
}
|
78
|
+
});
|
116
79
|
},
|
117
80
|
'fileUploaded':function(fileTreePanel, node){
|
118
81
|
var store = self.sharedImageAssetsDataView.getStore();
|
119
|
-
store.load(
|
82
|
+
store.load({
|
83
|
+
params:{
|
84
|
+
directory:node.data.id
|
85
|
+
}
|
86
|
+
});
|
120
87
|
},
|
121
88
|
'downloadfile':function(fileTreePanel, node){
|
122
89
|
window.open("/download/"+node.data.text+"?path=" + node.data.downloadPath+'&disposition=attachment','mywindow','width=400,height=200');
|
@@ -129,77 +96,40 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module)
|
|
129
96
|
autoLoadRoot:false,
|
130
97
|
region:'north',
|
131
98
|
rootText:'Images',
|
132
|
-
collapsible:
|
99
|
+
collapsible:false,
|
133
100
|
allowDownload:false,
|
134
101
|
addViewContentsToContextMenu:false,
|
135
102
|
rootVisible:true,
|
103
|
+
multiSelect:true,
|
136
104
|
controllerPath:'/knitkit/erp_app/desktop/image_assets/website',
|
137
105
|
standardUploadUrl:'/knitkit/erp_app/desktop/image_assets/website/upload_file',
|
138
|
-
xhrUploadUrl:'/knitkit/erp_app/desktop/image_assets/website/upload_file',
|
139
106
|
url:'/knitkit/erp_app/desktop/image_assets/website/expand_directory',
|
140
107
|
containerScroll: true,
|
141
108
|
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',
|
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
|
-
},
|
109
|
+
additionalContextMenuItems:[
|
170
110
|
{
|
171
111
|
nodeType:'leaf',
|
172
|
-
text:'Insert
|
112
|
+
text:'Insert image at cursor',
|
173
113
|
iconCls:'icon-add',
|
174
114
|
listeners:{
|
175
115
|
scope:self,
|
176
116
|
'click':function(){
|
177
117
|
var node = this.websiteImageAssetsTreePanel.selectedNode;
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
}
|
185
|
-
},
|
186
|
-
{
|
187
|
-
nodeType:'leaf',
|
188
|
-
text:'Insert link at cursor (prompt)',
|
189
|
-
iconCls:'icon-add',
|
190
|
-
listeners:{
|
191
|
-
scope:self,
|
192
|
-
'click':function(){
|
193
|
-
var node = this.websiteImageAssetsTreePanel.selectedNode;
|
194
|
-
Ext.MessageBox.prompt('Display Name', 'Please enter display name:', function(btn, text){
|
195
|
-
if(btn == 'ok'){
|
196
|
-
self.module.centerRegion.insertHtmlIntoActiveCkEditor('<a href="/download/'+node.data.text+'?path='+node.data.downloadPath+'&disposition=attachment">'+text+'</a>');
|
197
|
-
}
|
198
|
-
});
|
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);
|
199
124
|
}
|
200
125
|
}
|
201
|
-
}
|
126
|
+
}
|
127
|
+
],
|
202
128
|
listeners:{
|
129
|
+
'load':function(store, node, records){
|
130
|
+
store.getRootNode().data.text = self.websiteName;
|
131
|
+
self.websiteImageAssetsTreePanel.view.refresh();
|
132
|
+
},
|
203
133
|
'itemclick':function(view, record, item, index, e){
|
204
134
|
if(self.websiteId != null){
|
205
135
|
e.stopEvent();
|
@@ -220,7 +150,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module)
|
|
220
150
|
'fileDeleted':function(fileTreePanel, node){
|
221
151
|
self.websiteImageAssetsDataView.getStore().load({
|
222
152
|
params:{
|
223
|
-
directory:node.data.
|
153
|
+
directory:node.data.downloadPath,
|
224
154
|
website_id:self.websiteId
|
225
155
|
}
|
226
156
|
});
|
@@ -301,14 +231,14 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module)
|
|
301
231
|
})
|
302
232
|
});
|
303
233
|
|
304
|
-
this.selectWebsite = function(websiteId){
|
234
|
+
this.selectWebsite = function(websiteId, websiteName){
|
305
235
|
this.websiteId = websiteId;
|
236
|
+
this.websiteName = websiteName;
|
306
237
|
}
|
307
238
|
|
308
239
|
this.reloadWebsiteImageAssetsTreePanel = function(websiteId){
|
309
240
|
this.websiteImageAssetsTreePanel.extraPostData = {
|
310
|
-
website_id:websiteId
|
311
|
-
websiteid:websiteId // for xhrFileUpload to work
|
241
|
+
website_id:websiteId
|
312
242
|
};
|
313
243
|
this.websiteImageAssetsTreePanel.getStore().setProxy({
|
314
244
|
type: 'ajax',
|
@@ -317,7 +247,16 @@ Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel = function(module)
|
|
317
247
|
website_id:websiteId
|
318
248
|
}
|
319
249
|
});
|
320
|
-
|
321
|
-
|
250
|
+
|
251
|
+
if (websiteId){
|
252
|
+
while (delNode = this.websiteImageAssetsTreePanel.getRootNode().childNodes[0]) {
|
253
|
+
this.websiteImageAssetsTreePanel.getRootNode().removeChild(delNode);
|
254
|
+
}
|
255
|
+
this.websiteImageAssetsTreePanel.getRootNode().expand();
|
256
|
+
|
257
|
+
if (!this.websiteImageAssetsTreePanel.getStore().isLoading()){
|
258
|
+
this.websiteImageAssetsTreePanel.getStore().load();
|
259
|
+
}
|
260
|
+
}
|
322
261
|
}
|
323
262
|
}
|