1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.BAdminImageManager= function() {}
8 Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
11 'ef797d5638c2e1c6b6225b2247541ea5' :"Upload Image or File:",
12 'd9787032e54a7facd5c7b1db2ae61c7b' :"Image Manager",
13 '53ab4599d0106e32d015649175a70d7b' :"<i class=\"fa fa-filter\"></i> Filter",
14 '37c1097cf82226d511586ecd99ed97cf' :"search for image",
15 'cdb6b6bab1fd18b9dbfe3fb84a5d34ae' :"<i class=\"fa fa-search\"></i>",
16 '5350277f16d9998c57fa7e1d17be2a76' :"<i class=\"fa fa-upload\"></i> Upload Image",
17 '14834a16229091f47cf1810177d07916' :"Created Date:",
18 '1a0ce561842e3caef9098f46ecaa1dcf' :"Add Images with Settings",
19 '78d0f5aac952e2ce840a381976a3b01e' :"Image Details",
20 '708ea0e601087e73c4764d5086e3ea3c' :"File Name:",
21 'e0a53da57dd79cca5d3b6a7c42e463ef' :"File Type:",
22 '3f986fa4066f6bded1376eb69de18da2' :"File Size:",
23 '179d4ab94c43ccb7cd6d2b3d82c7fe1f' :"Show images for this email",
24 'd3d2e617335f08df83599665eef8a418' :"Close",
25 '84378f54966381befd040dafbdc221d6' :"<i class=\"fa fa-plus\"></i> Add into the email",
26 '361bacb1a72a350ee34e2f31a6a91dab' :"Alignment:",
27 '2cd3a1900dd0060540b418b2a60f6eec' :"Show all images",
28 'ed807858fcb68abdd180481f1fcba5c5' :"<i class=\"fa fa-trash\"></i> Delete",
29 '031fa343a28d221a25d2bcd942437174' :"Alternate Text:",
30 '48ccf48dcf2218a413ce473262f21a0c' :"Width: ",
31 'd0042a700e9bdf79689d63ee6846dc0e' :"Description:",
32 'd6d93f0d6b7c6018d8949e73ed6efb6c' :"<i class=\"fa fa-save\"></i> Save Changes",
33 'e933dc24fb245d863a43b4fefe9b45f5' :"Height:"
36 'align_fieldLabel' : '361bacb1a72a350ee34e2f31a6a91dab' /* Alignment: */ ,
37 'filename_fieldLabel' : '708ea0e601087e73c4764d5086e3ea3c' /* File Name: */ ,
38 'add_html' : '84378f54966381befd040dafbdc221d6' /* <i class="fa fa-plus"></i> Add into the email */ ,
39 'created_fieldLabel' : '14834a16229091f47cf1810177d07916' /* Created Date: */ ,
40 'height_fieldLabel' : 'e933dc24fb245d863a43b4fefe9b45f5' /* Height: */ ,
41 'mimetype_fieldLabel' : 'e0a53da57dd79cca5d3b6a7c42e463ef' /* File Type: */ ,
42 'close_html' : 'd3d2e617335f08df83599665eef8a418' /* Close */ ,
43 'imageUpload_fieldLabel' : 'ef797d5638c2e1c6b6225b2247541ea5' /* Upload Image or File: */ ,
44 'width_fieldLabel' : '48ccf48dcf2218a413ce473262f21a0c' /* Width: */ ,
45 'filesize_fieldLabel' : '3f986fa4066f6bded1376eb69de18da2' /* File Size: */ ,
46 'descript_fieldLabel' : 'd0042a700e9bdf79689d63ee6846dc0e' /* Description: */
52 show : function(data, cb)
60 this.dialog.show(this.data._el);
63 this.form.setValues(data);
64 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
72 this.dialog = Roo.factory({
74 cls : 'modal-body-enable-overflow-y pman-badmin-image-manager',
76 title : _this._strings['d9787032e54a7facd5c7b1db2ae61c7b'] /* Image Manager */,
78 resize : function (_self)
80 if (_this.dialog && _this.container && _this.toolbar) {
82 _this.document_container.el.setHeight(
83 _this.dialog.bodyEl.getHeight() -
84 _this.dialog.headerEl.getHeight() -
85 _this.toolbar.el.dom.offsetHeight -
86 _this.dialog.footerEl.getHeight()
93 '|xns' : 'Roo.bootstrap',
97 html : _this._strings['d3d2e617335f08df83599665eef8a418'] /* Close */,
101 click : function (_self, e)
107 '|xns' : 'Roo.bootstrap'
114 '|xns' : 'Roo.bootstrap',
120 '|xns' : 'Roo.bootstrap',
126 style : 'display: none;',
128 url : baseURL + '/Roo/Images.php',
130 actioncomplete : function(_self,action)
132 if (action.type == 'setdata') {
134 _this.showType = 'public';
136 this.url = _this.data._url ? baseURL + _this.data._url : baseURL + '/Roo/Images.php';
138 this.el.dom.action = this.url;
140 if (typeof(_this.data.timeout) != 'undefined') {
141 this.timeout = _this.data.timeout;
144 this.findField('UPLOAD_IDENTIFIER').setValue(
145 (new Date() * 1) + '' + Math.random());
147 _this.masonry.load();
153 if (action.type == 'load') {
155 _this.data = action.result.data;
161 if (action.type == 'submit') { // only submitted here if we are
163 _this.masonry.load();
171 actionfailed : function (_self, action)
173 if (action.type == 'submit') {
174 Roo.log("Upload error");
179 Roo.MessageBox.alert("Error", action.result.errorMsg.split(/\n/).join('<BR/>'));
183 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
188 Roo.MessageBox.alert("Error", "Error loading details");
190 render : function (_self)
197 '|xns' : 'Roo.bootstrap',
201 fieldLabel : _this._strings['ef797d5638c2e1c6b6225b2247541ea5'] /* Upload Image or File: */,
204 name : 'imageUpload',
206 render : function (_self)
208 _this.uploadDL = this;
210 _this.uploadDL.inputEl().on("change",function(){
212 _this.form.findField('onid').setValue((_this.showType == 'private') ? _this.data.onid : 0);
213 _this.form.doAction('submit');
215 //_this.dialog.uploadProgress.defer(1000, _this.dialog);
222 '|xns' : 'Roo.bootstrap'
226 inputType : 'hidden',
227 name : 'UPLOAD_IDENTIFIER',
229 '|xns' : 'Roo.bootstrap'
233 inputType : 'hidden',
234 name : 'post_max_size',
236 '|xns' : 'Roo.bootstrap'
240 inputType : 'hidden',
241 name : 'upload_max_filesize',
243 '|xns' : 'Roo.bootstrap'
247 inputType : 'hidden',
250 '|xns' : 'Roo.bootstrap'
254 inputType : 'hidden',
257 '|xns' : 'Roo.bootstrap'
261 inputType : 'hidden',
264 '|xns' : 'Roo.bootstrap'
272 render : function (_self)
274 _this.container = this;
279 '|xns' : 'Roo.bootstrap',
284 render : function (_self)
286 _this.toolbar = this;
290 '|xns' : 'Roo.bootstrap',
297 '|xns' : 'Roo.bootstrap',
301 html : _this._strings['53ab4599d0106e32d015649175a70d7b'] /* <i class="fa fa-filter"></i> Filter */,
303 '|xns' : 'Roo.bootstrap',
307 '|xns' : 'Roo.bootstrap',
311 html : _this._strings['179d4ab94c43ccb7cd6d2b3d82c7fe1f'] /* Show images for this email */,
313 preventDefault : true,
315 click : function (_self, e)
317 _this.showType = 'private';
319 _this.masonry.load();
323 '|xns' : 'Roo.bootstrap'
327 html : _this._strings['2cd3a1900dd0060540b418b2a60f6eec'] /* Show all images */,
329 preventDefault : true,
331 click : function (_self, e)
333 _this.showType = 'public';
335 _this.masonry.load();
339 '|xns' : 'Roo.bootstrap'
346 placeholder : _this._strings['37c1097cf82226d511586ecd99ed97cf'] /* search for image */,
347 style : 'width: 200px; margin-left: 15px;display: inline-block; margin-bottom: 0px; vertical-align: middle;',
349 render : function (_self)
351 _this.searchBox = this;
353 specialkey : function (_self, e)
358 if(e.keyCode == e.ENTER) {
359 _this.masonry.clearAll();
360 _this.masonry.load();
366 '|xns' : 'Roo.bootstrap',
369 html : _this._strings['cdb6b6bab1fd18b9dbfe3fb84a5d34ae'] /* <i class="fa fa-search"></i> */,
371 click : function (_self, e)
373 _this.masonry.clearAll();
374 _this.masonry.load();
378 '|xns' : 'Roo.bootstrap'
389 '|xns' : 'Roo.bootstrap',
393 html : _this._strings['5350277f16d9998c57fa7e1d17be2a76'] /* <i class="fa fa-upload"></i> Upload Image */,
397 click : function (_self, e)
399 var id = _this.data.onid;
402 Roo.MessageBox.alert('Error', 'Please save the email template first');
406 _this.uploadDL.inputEl().dom.click();
410 '|xns' : 'Roo.bootstrap'
414 html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
416 style : 'margin-left: 15px;',
419 click : function (_self, e)
421 if (_this.masonry.getSelected().length > 1) {
422 Roo.bootstrap.MessageBox.alert('Cannot delete the images !','Please select one image only');
426 if (_this.masonry.getSelected().length < 1) {
427 Roo.bootstrap.MessageBox.alert('Cannot delete any image!', 'Please select an image');
431 Roo.bootstrap.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
437 url : baseURL + '/Roo/Images.php',
440 _delete : Roo.bootstrap.MasonryBrick.get(_this.masonry.getSelected()[0]).imageObj.id
444 // _this.masonry.removeBrick(_this.masonry.getSelected()[0]);
445 _this.masonry.load();
450 render : function (_self)
452 _this.deleteBtn = this;
458 '|xns' : 'Roo.bootstrap'
466 style : 'margin-top: 15px;',
468 render : function (_self)
470 _this.document_container = this;
472 this.el.setStyle('overflow', 'auto');
476 '|xns' : 'Roo.bootstrap',
482 '|xns' : 'Roo.bootstrap',
485 xtype : 'LayoutMasonry',
486 activeClass : 'active',
488 isAutoInitial : false,
489 isLayoutInstant : false,
492 _this.setting_form.reset();
493 _this.detail_form.reset();
495 _this.setting_form.hide();
496 _this.detail_form.hide();
498 _this.masonry.clearAll();
501 url: baseURL + '/Roo/Images',
504 ontable : 'core_email',
505 onid : (_this.showType == 'private') ? _this.data.onid : 0,
506 'search[filename]' : _this.searchBox.getValue()
508 success: function(ret) {
510 if(!ret.data.length){
514 Roo.each(ret.data, function(r){
516 _this.masonry.addBrick({
519 cls: 'coba-image-mgmt-masonry-brick',
521 activeClass: 'active',
522 preventDefault: true,
523 bgimage : baseURL + '/Images/' + r.id + '/' + r.filename.replace('%', '-'),
526 click : function (_self)
528 _this.setting_form.reset();
529 _this.detail_form.reset();
531 _this.setting_form.hide();
532 _this.detail_form.hide();
534 _this.deleteBtn.hide();
536 if(!this.isSelected()){
540 if(_this.masonry.getSelected().length == 1){
541 _this.deleteBtn.show();
545 url: baseURL + '/Roo/Images.php',
548 _id: _self.imageObj.id
550 success : function(rr) {
552 _this.setting_form.show();
553 _this.detail_form.show();
555 _this.detail_form.setValues(rr.data);
556 _this.setting_form.setValues(rr.data);
558 _this.setting_form.findField('align').setValue("left");
560 _self.imageObj = rr.data;
570 _this.masonry.initial();
574 failure: function(res) {
575 Roo.log('cannot read Coba/Roo/Images');
580 render : function (_self)
582 _this.masonry = this;
587 '|xns' : 'Roo.bootstrap'
601 '|xns' : 'Roo.bootstrap',
606 '|xns' : 'Roo.bootstrap',
612 '|xns' : 'Roo.bootstrap',
617 url : baseURL + '/Roo/Images',
619 render : function (_self)
621 _this.setting_form = this;
625 '|xns' : 'Roo.bootstrap',
629 header : _this._strings['1a0ce561842e3caef9098f46ecaa1dcf'] /* Add Images with Settings */,
631 style : 'width: 100%;',
633 '|xns' : 'Roo.bootstrap',
638 '|xns' : 'Roo.bootstrap',
644 '|xns' : 'Roo.bootstrap',
649 fieldLabel : _this._strings['031fa343a28d221a25d2bcd942437174'] /* Alternate Text: */,
653 '|xns' : 'Roo.bootstrap'
662 '|xns' : 'Roo.bootstrap',
667 style : 'margin-top:15px;',
669 '|xns' : 'Roo.bootstrap',
674 fieldLabel : _this._strings['e933dc24fb245d863a43b4fefe9b45f5'] /* Height: */,
678 '|xns' : 'Roo.bootstrap'
687 '|xns' : 'Roo.bootstrap',
692 style : 'margin-top:15px;',
694 '|xns' : 'Roo.bootstrap',
699 fieldLabel : _this._strings['48ccf48dcf2218a413ce473262f21a0c'] /* Width: */,
703 '|xns' : 'Roo.bootstrap'
712 '|xns' : 'Roo.bootstrap',
717 style : 'margin-top:15px;',
719 '|xns' : 'Roo.bootstrap',
726 displayField : 'value',
728 fieldLabel : _this._strings['361bacb1a72a350ee34e2f31a6a91dab'] /* Alignment: */,
729 forceSelection : true,
733 selectOnFocus : true,
734 triggerAction : 'all',
737 '|xns' : 'Roo.bootstrap',
739 xtype : 'SimpleStore',
743 ['middle', 'middle'],
747 fields : ['code', 'value'],
759 '|xns' : 'Roo.bootstrap',
765 style : 'margin-top:15px;',
767 '|xns' : 'Roo.bootstrap',
771 html : _this._strings['84378f54966381befd040dafbdc221d6'] /* <i class="fa fa-plus"></i> Add into the email */,
775 click : function (_self, e)
777 var b = _this.masonry.getSelected();
781 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select an image');
785 var brick = Roo.bootstrap.MasonryBrick.get(b[0]);
792 id : brick.imageObj.id,
793 filename : brick.imageObj.filename,
794 width : _this.setting_form.findField('width').getValue(),
795 height : _this.setting_form.findField('height').getValue(),
796 descript : _this.setting_form.findField('descript').getValue(),
797 align : _this.setting_form.findField('align').getValue()
800 _this.callback.call(_this, data);
806 '|xns' : 'Roo.bootstrap'
823 '|xns' : 'Roo.bootstrap',
829 '|xns' : 'Roo.bootstrap',
834 url : baseURL + '/Roo/Images',
836 render : function (_self)
838 _this.detail_form = this;
842 '|xns' : 'Roo.bootstrap',
846 header : _this._strings['78d0f5aac952e2ce840a381976a3b01e'] /* Image Details */,
848 style : 'width: 100%; padding: 0',
850 '|xns' : 'Roo.bootstrap',
855 '|xns' : 'Roo.bootstrap',
861 '|xns' : 'Roo.bootstrap',
867 fieldLabel : _this._strings['708ea0e601087e73c4764d5086e3ea3c'] /* File Name: */,
870 style : 'padding: 0;',
872 '|xns' : 'Roo.bootstrap'
881 '|xns' : 'Roo.bootstrap',
886 style : 'margin-top:15px;',
888 '|xns' : 'Roo.bootstrap',
894 fieldLabel : _this._strings['e0a53da57dd79cca5d3b6a7c42e463ef'] /* File Type: */,
898 '|xns' : 'Roo.bootstrap'
907 '|xns' : 'Roo.bootstrap',
912 style : 'margin-top:15px;',
914 '|xns' : 'Roo.bootstrap',
920 fieldLabel : _this._strings['3f986fa4066f6bded1376eb69de18da2'] /* File Size: */,
924 '|xns' : 'Roo.bootstrap'
933 '|xns' : 'Roo.bootstrap',
938 style : 'margin-top:15px;',
940 '|xns' : 'Roo.bootstrap',
946 fieldLabel : _this._strings['14834a16229091f47cf1810177d07916'] /* Created Date: */,
950 '|xns' : 'Roo.bootstrap'
959 '|xns' : 'Roo.bootstrap',
964 style : 'margin-top:15px;',
966 '|xns' : 'Roo.bootstrap',
971 fieldLabel : _this._strings['d0042a700e9bdf79689d63ee6846dc0e'] /* Description: */,
975 '|xns' : 'Roo.bootstrap'
983 inputType : 'hidden',
986 '|xns' : 'Roo.bootstrap'
991 '|xns' : 'Roo.bootstrap',
997 style : 'margin-top:15px;',
999 '|xns' : 'Roo.bootstrap',
1003 html : _this._strings['d6d93f0d6b7c6018d8949e73ed6efb6c'] /* <i class="fa fa-save"></i> Save Changes */,
1006 click : function (_self, e)
1008 _this.detail_form.doAction('submit');
1011 xns : Roo.bootstrap,
1012 '|xns' : 'Roo.bootstrap'
1034 Roo.apply(Pman.Dialog.BAdminImageManager, Pman.Dialog.BAdminImageManager.prototype);