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 '37c1097cf82226d511586ecd99ed97cf' :"search for image",
14 'cdb6b6bab1fd18b9dbfe3fb84a5d34ae' :"<i class=\"fa fa-search\"></i>",
15 '5350277f16d9998c57fa7e1d17be2a76' :"<i class=\"fa fa-upload\"></i> Upload Image",
16 '14834a16229091f47cf1810177d07916' :"Created Date:",
17 '1a0ce561842e3caef9098f46ecaa1dcf' :"Add Images with Settings",
18 '78d0f5aac952e2ce840a381976a3b01e' :"Image Details",
19 '708ea0e601087e73c4764d5086e3ea3c' :"File Name:",
20 'e0a53da57dd79cca5d3b6a7c42e463ef' :"File Type:",
21 '3f986fa4066f6bded1376eb69de18da2' :"File Size:",
22 'd3d2e617335f08df83599665eef8a418' :"Close",
23 '84378f54966381befd040dafbdc221d6' :"<i class=\"fa fa-plus\"></i> Add into the email",
24 '361bacb1a72a350ee34e2f31a6a91dab' :"Alignment:",
25 'f48f7c7bccb5e29c83d87984c49ad8d4' :"Show image for this email",
26 'ed807858fcb68abdd180481f1fcba5c5' :"<i class=\"fa fa-trash\"></i> Delete",
27 '031fa343a28d221a25d2bcd942437174' :"Alternate Text:",
28 '48ccf48dcf2218a413ce473262f21a0c' :"Width: ",
29 'd0042a700e9bdf79689d63ee6846dc0e' :"Description:",
30 'd6d93f0d6b7c6018d8949e73ed6efb6c' :"<i class=\"fa fa-save\"></i> Save Changes",
31 'e933dc24fb245d863a43b4fefe9b45f5' :"Height:"
34 'align_fieldLabel' : '361bacb1a72a350ee34e2f31a6a91dab' /* Alignment: */ ,
35 'filename_fieldLabel' : '708ea0e601087e73c4764d5086e3ea3c' /* File Name: */ ,
36 'add_html' : '84378f54966381befd040dafbdc221d6' /* <i class="fa fa-plus"></i> Add into the email */ ,
37 'created_fieldLabel' : '14834a16229091f47cf1810177d07916' /* Created Date: */ ,
38 'height_fieldLabel' : 'e933dc24fb245d863a43b4fefe9b45f5' /* Height: */ ,
39 'mimetype_fieldLabel' : 'e0a53da57dd79cca5d3b6a7c42e463ef' /* File Type: */ ,
40 'close_html' : 'd3d2e617335f08df83599665eef8a418' /* Close */ ,
41 'imageUpload_fieldLabel' : 'ef797d5638c2e1c6b6225b2247541ea5' /* Upload Image or File: */ ,
42 'width_fieldLabel' : '48ccf48dcf2218a413ce473262f21a0c' /* Width: */ ,
43 'filesize_fieldLabel' : '3f986fa4066f6bded1376eb69de18da2' /* File Size: */ ,
44 'descript_fieldLabel' : 'd0042a700e9bdf79689d63ee6846dc0e' /* Description: */
50 show : function(data, cb)
58 this.dialog.show(this.data._el);
61 this.form.setValues(data);
62 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
70 this.dialog = Roo.factory({
72 cls : 'modal-body-enable-overflow-y pman-badmin-image-manager',
75 title : _this._strings['d9787032e54a7facd5c7b1db2ae61c7b'] /* Image Manager */,
76 uploadComplete : false,
77 uploadProgress : function()
79 Roo.log('uploadProgress');
82 if (!dlg.haveProgress) {
83 Roo.MessageBox.progress("Uploading", "Uploading");
86 if (dlg.haveProgress == 2) {
87 // it's been closed elsewhere..
90 if (dlg.uploadComplete) {
91 Roo.MessageBox.hide();
97 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
100 url : baseURL + '/Core/UploadProgress.php',
106 success : function(res){
108 if (dlg.haveProgress == 2) {
112 if (dlg.uploadComplete) {
113 Roo.MessageBox.hide();
118 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
119 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
122 Roo.MessageBox.updateProgress(1,
123 "Upload Complete - processing"
127 dlg.uploadProgress.defer(2000,dlg);
129 failure: function(data) {
135 resize : function (_self)
137 if (_this.dialog && _this.container && _this.toolbar) {
139 _this.document_container.el.setHeight(
140 _this.dialog.bodyEl.getHeight() -
141 _this.dialog.headerEl.getHeight() -
142 _this.toolbar.el.dom.offsetHeight -
143 _this.dialog.footerEl.getHeight()
150 '|xns' : 'Roo.bootstrap',
154 html : _this._strings['d3d2e617335f08df83599665eef8a418'] /* Close */,
158 click : function (_self, e)
164 '|xns' : 'Roo.bootstrap'
171 '|xns' : 'Roo.bootstrap',
177 '|xns' : 'Roo.bootstrap',
183 style : 'display: none;',
185 url : baseURL + '/Roo/Images.php',
187 actioncomplete : function(_self,action)
189 _this.dialog.uploadComplete = true;
191 _this.dialog.haveProgress = 2;
193 Roo.MessageBox.hide();
195 if (action.type == 'setdata') {
197 this.url = _this.data._url ? baseURL + _this.data._url : baseURL + '/Roo/Images.php';
199 this.el.dom.action = this.url;
201 if (typeof(_this.data.timeout) != 'undefined') {
202 this.timeout = _this.data.timeout;
205 this.findField('UPLOAD_IDENTIFIER').setValue(
206 (new Date() * 1) + '' + Math.random());
208 _this.masonry.load();
214 if (action.type == 'load') {
216 _this.data = action.result.data;
222 if (action.type == 'submit') { // only submitted here if we are
224 _this.masonry.load();
232 actionfailed : function (_self, action)
234 _this.dialog.uploadComplete = true;
236 _this.dialog.haveProgress = 2;
238 if (action.type == 'submit') {
239 Roo.log("Upload error");
244 Roo.MessageBox.alert("Error", action.result.errorMsg.split(/\n/).join('<BR/>'));
248 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
253 Roo.MessageBox.alert("Error", "Error loading details");
255 render : function (_self)
262 '|xns' : 'Roo.bootstrap',
266 fieldLabel : _this._strings['ef797d5638c2e1c6b6225b2247541ea5'] /* Upload Image or File: */,
269 name : 'imageUpload',
271 render : function (_self)
273 _this.uploadDL = this;
275 _this.uploadDL.inputEl().on("change",function(){
277 _this.form.findField('onid').setValue(_this.showTypeBtn.isActive() ? _this.data.onid : 0);
278 _this.form.doAction('submit');
280 //_this.dialog.uploadProgress.defer(1000, _this.dialog);
287 '|xns' : 'Roo.bootstrap'
291 inputType : 'hidden',
292 name : 'UPLOAD_IDENTIFIER',
294 '|xns' : 'Roo.bootstrap'
298 inputType : 'hidden',
299 name : 'post_max_size',
301 '|xns' : 'Roo.bootstrap'
305 inputType : 'hidden',
306 name : 'upload_max_filesize',
308 '|xns' : 'Roo.bootstrap'
312 inputType : 'hidden',
315 '|xns' : 'Roo.bootstrap'
319 inputType : 'hidden',
322 '|xns' : 'Roo.bootstrap'
326 inputType : 'hidden',
329 '|xns' : 'Roo.bootstrap'
336 render : function (_self)
338 _this.container = this;
343 '|xns' : 'Roo.bootstrap',
348 render : function (_self)
350 _this.toolbar = this;
354 '|xns' : 'Roo.bootstrap',
360 '|xns' : 'Roo.bootstrap',
364 html : _this._strings['f48f7c7bccb5e29c83d87984c49ad8d4'] /* Show image for this email */,
366 style : 'float:left;',
368 render : function (_self)
370 _this.showTypeBtn = this;
372 toggle : function (b, e, pressed)
374 _this.showTypeBtn.setText(!pressed ? 'Show all images' : 'Show image for this email');
376 _this.masonry.load();
380 '|xns' : 'Roo.bootstrap'
384 placeholder : _this._strings['37c1097cf82226d511586ecd99ed97cf'] /* search for image */,
385 style : 'float:left; width: 300px; margin-left: 15px;',
387 render : function (_self)
389 _this.searchBox = this;
391 specialkey : function (_self, e)
396 if(e.keyCode == e.ENTER) {
397 _this.masonry.clearAll();
398 _this.masonry.load();
404 '|xns' : 'Roo.bootstrap',
407 html : _this._strings['cdb6b6bab1fd18b9dbfe3fb84a5d34ae'] /* <i class="fa fa-search"></i> */,
409 click : function (_self, e)
411 _this.masonry.clearAll();
412 _this.masonry.load();
416 '|xns' : 'Roo.bootstrap'
426 '|xns' : 'Roo.bootstrap',
430 html : _this._strings['5350277f16d9998c57fa7e1d17be2a76'] /* <i class="fa fa-upload"></i> Upload Image */,
433 click : function (_self, e)
435 var id = _this.data.onid;
438 Roo.MessageBox.alert('Error', 'Please save the email template first');
442 _this.uploadDL.inputEl().dom.click();
446 '|xns' : 'Roo.bootstrap'
450 html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
451 style : 'margin-left: 15px;',
454 click : function (_self, e)
456 if (_this.masonry.getSelected().length > 1) {
458 Roo.bootstrap.MessageBox.alert('Cannot delete the images !','Please select one image only');
462 if (_this.masonry.getSelected().length < 1) {
464 Roo.bootstrap.MessageBox.alert('Cannot delete any image !','Please select an image');
468 Roo.bootstrap.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
474 url : baseURL + '/Roo/Images.php',
477 _delete : Roo.bootstrap.MasonryBrick.get(_this.masonry.getSelected()[0]).image_id
481 _this.masonry.removeBrick(_this.masonry.getSelected()[0]);
482 _this.detail_form.reset();
483 _this.setting_form.reset();
484 _this.masonry.initial();
489 render : function (_self)
491 _this.deleteBtn = this;
497 '|xns' : 'Roo.bootstrap'
505 style : 'margin-top: 15px;',
507 render : function (_self)
509 _this.document_container = this;
511 this.el.setStyle('overflow', 'auto');
515 '|xns' : 'Roo.bootstrap',
521 '|xns' : 'Roo.bootstrap',
524 xtype : 'LayoutMasonry',
525 activeClass : 'active',
527 isAutoInitial : false,
528 isLayoutInstant : false,
531 _this.setting_form.reset();
532 _this.detail_form.reset();
534 _this.setting_form.hide();
535 _this.detail_form.hide();
537 _this.masonry.clearAll();
540 url: baseURL + '/Roo/Images',
543 ontable : 'core_email',
544 onid : _this.showTypeBtn.isActive() ? _this.data.onid : 0,
545 'search[filename]' : _this.searchBox.getValue()
547 success: function(ret) {
549 if(!ret.data.length){
553 Roo.each(ret.data, function(r){
555 _this.masonry.addBrick({
558 cls: 'coba-image-mgmt-masonry-brick',
560 activeClass: 'active',
561 preventDefault: true,
562 bgimage : baseURL + '/Images/' + r.id + '/' + r.filename,
565 click : function (_self)
567 _this.setting_form.reset();
568 _this.detail_form.reset();
570 _this.setting_form.hide();
571 _this.detail_form.hide();
573 if(!this.isSelected()){
578 url: baseURL + '/Roo/Images.php',
581 _id: _self.imageObj.id
583 success : function(rr) {
585 _this.setting_form.show();
586 _this.detail_form.show();
588 _this.detail_form.setValues(rr.data);
589 _this.setting_form.setValues(rr.data);
591 _this.setting_form.findField('align').setValue("left");
592 _this.thumb.setSrc(baseURL + '/Images/' + rr.data.id + '/' + rr.data.filename);
594 _self.imageObj = rr.data;
604 _this.masonry.initial();
608 failure: function(res) {
609 Roo.log('cannot read Coba/Roo/Images');
614 render : function (_self)
616 _this.masonry = this;
621 '|xns' : 'Roo.bootstrap'
635 '|xns' : 'Roo.bootstrap',
640 '|xns' : 'Roo.bootstrap',
646 '|xns' : 'Roo.bootstrap',
651 url : baseURL + '/Roo/Images',
653 render : function (_self)
655 _this.setting_form = this;
659 '|xns' : 'Roo.bootstrap',
663 header : _this._strings['1a0ce561842e3caef9098f46ecaa1dcf'] /* Add Images with Settings */,
665 style : 'width: 100%;',
667 '|xns' : 'Roo.bootstrap',
672 fieldLabel : _this._strings['031fa343a28d221a25d2bcd942437174'] /* Alternate Text: */,
676 '|xns' : 'Roo.bootstrap'
681 fieldLabel : _this._strings['e933dc24fb245d863a43b4fefe9b45f5'] /* Height: */,
685 '|xns' : 'Roo.bootstrap'
690 fieldLabel : _this._strings['48ccf48dcf2218a413ce473262f21a0c'] /* Width: */,
694 '|xns' : 'Roo.bootstrap'
701 displayField : 'value',
703 fieldLabel : _this._strings['361bacb1a72a350ee34e2f31a6a91dab'] /* Alignment: */,
704 forceSelection : true,
708 selectOnFocus : true,
709 triggerAction : 'all',
712 '|xns' : 'Roo.bootstrap',
714 xtype : 'SimpleStore',
718 ['middle', 'middle'],
722 fields : ['code', 'value'],
729 cls : 'form-group-button_row',
731 '|xns' : 'Roo.bootstrap',
736 style : 'text-align: center',
738 '|xns' : 'Roo.bootstrap',
742 html : _this._strings['84378f54966381befd040dafbdc221d6'] /* <i class="fa fa-plus"></i> Add into the email */,
746 click : function (_self, e)
748 var b = _this.masonry.getSelected();
752 Roo.bootstrap.MessageBox.alert('Cannot add any image', 'Please select an image');
756 var brick = Roo.bootstrap.MasonryBrick.get(b[0]);
762 var data = Roo.apply(b[0].imageObj, {
763 align : _this.setting_form.findField('align').getValue()
766 _this.callback.call(_this, data);
771 filename : brick.image_filename,
772 height : _this.setting_form.findField('height').getValue(),
773 width : _this.setting_form.findField('width').getValue(),
774 alt : _this.setting_form.findField('alt').getValue(),
775 align : _this.setting_form.findField('align').getValue()
782 '|xns' : 'Roo.bootstrap'
799 '|xns' : 'Roo.bootstrap',
805 '|xns' : 'Roo.bootstrap',
810 url : baseURL + '/Roo/Images',
812 render : function (_self)
814 _this.detail_form = this;
818 '|xns' : 'Roo.bootstrap',
822 header : _this._strings['78d0f5aac952e2ce840a381976a3b01e'] /* Image Details */,
824 style : 'width: 100%; padding: 0',
826 '|xns' : 'Roo.bootstrap',
830 alt : '*Please select an image in the media library',
831 border : 'thumbnail',
832 style : 'width: 100%; margin-bottom:15px; display: none;',
834 render : function (_self)
843 '|xns' : 'Roo.bootstrap'
849 fieldLabel : _this._strings['708ea0e601087e73c4764d5086e3ea3c'] /* File Name: */,
852 style : 'padding: 0;',
854 '|xns' : 'Roo.bootstrap'
860 fieldLabel : _this._strings['e0a53da57dd79cca5d3b6a7c42e463ef'] /* File Type: */,
864 '|xns' : 'Roo.bootstrap'
870 fieldLabel : _this._strings['3f986fa4066f6bded1376eb69de18da2'] /* File Size: */,
874 '|xns' : 'Roo.bootstrap'
880 fieldLabel : _this._strings['14834a16229091f47cf1810177d07916'] /* Created Date: */,
884 '|xns' : 'Roo.bootstrap'
889 fieldLabel : _this._strings['d0042a700e9bdf79689d63ee6846dc0e'] /* Description: */,
893 '|xns' : 'Roo.bootstrap'
897 inputType : 'hidden',
900 '|xns' : 'Roo.bootstrap'
904 cls : 'form-group-button_row',
906 '|xns' : 'Roo.bootstrap',
911 style : 'text-align: center',
913 '|xns' : 'Roo.bootstrap',
917 html : _this._strings['d6d93f0d6b7c6018d8949e73ed6efb6c'] /* <i class="fa fa-save"></i> Save Changes */,
920 click : function (_self, e)
922 _this.detail_form.doAction('submit');
926 '|xns' : 'Roo.bootstrap'
948 Roo.apply(Pman.Dialog.BAdminImageManager, Pman.Dialog.BAdminImageManager.prototype);