closable : false,
collapsible : false,
height : 380,
+ modal : true,
resizable : false,
title : "Edit / Create Product",
width : 700,
actioncomplete : function(_self,action)
{
if (action.type == 'setdata') {
- //_this.dialog.el.mask("Loading");
+
if (_this.data.id) {
+ _this.dialog.el.mask("Loading");
this.load({ method: 'GET', params: { '_id' : _this.data.id }});
return;
}
if (action.type =='submit') {
_this.dialog.el.unmask();
- _this.dialog.hide();
-
+
+ _this.data.id = action.result.data.id;
+ _this.form.findField('id').setValue(_this.data.id);
if (_this.callback) {
- _this.callback.call(_this, _this.form.getValues());
+ var res = _this.callback.call(_this, _this.form.getValues());
+ if (res === false) {
+ return;
+ }
}
+ _this.dialog.hide();
_this.form.reset();
return;
}
}
]
},
+ {
+ xtype: 'Hidden',
+ xns: Roo.form,
+ name : 'category_id'
+ },
{
xtype: 'Hidden',
xns: Roo.form,
activate : function (_self)
{
//console.log('activate');
- if (!_this.loaded) {
- return;
+ if ( _this.imageView ){
+ _this.imageView.loadImages();
}
- _this.imageView.loadImages();
+
if (_this.hasUploadWatch) {
return;
}
_this.hasUploadWatch =true;
- _this.uploadSending =false;
- window.setInterval( function() {
+ _this.uploadSending =false;
+ window.setInterval( function()
+ {
var val = _this.uploadForm.findField('imageUpload').getValue();
if (!val || !val.length) {
return;
if (_this.uploadSending) {
return;
}
+
+ if (!_this.data.id) {
+ // trigger a save..
+ var cb = _this.callback;
+ _this.callback = function() {
+ _this.uploadSending = false;
+ _this.callback = cb;
+ return false;
+ }
+ _this.uploadSending = true;
+ _this.form.doAction("submit");
+ return;
+ }
+
_this.uploadSending =true;
_this.uploadForm.findField('onid').setValue(_this.data.id);
_this.uploadForm.el.mask("Sending");
jsonRoot : 'data',
singleSelect : true,
loadImages : function() {
+ if (!_this.data.id) {
+ this.clearSelections();
+ this.el.update("");
+ this.jsonData = [];
+ return;
+ }
+
this.load({
url : baseURL + '/Roo/Images.php',
method : 'GET',
xtype: 'Template',
xns: Roo,
html : '<div class="thumb-wrap"> ' +
- '<div class="thumb"><img src="{url}" class="thumb-img"></div>' +
+ '<div class="thumb"><img src="'+ baseURL + '/Images/Thumb/150/{id}/{filename}" class="thumb-img"></div>' +
'</div>'
}
}
Roo.MessageBox.alert("Error", "Select an Image");
return;
}
- var id = _this.imageView.getNodeData(_this.imageView.getSelectedNodes()[0]).id;
+ var n = _this.imageView.getNodeData(_this.imageView.getSelectedNodes()[0]);
+
// open a new window with this file in..
-
+ Pman.download( {
+ url: baseURL + '/Images/Download/' + n.id + '/' + n.filename
+ });
}
},
- text : "View / Download"
+ text : "Download"
},
{
xtype: 'Fill',
method : 'GET',
success : function() {
_this.imageView.el.unmask();
- _this.imageView.load({
- url : baseURL + '/Roo/Images.php',
- method : 'GET',
- params : {
- on_table : 'SellerProduct',
- on_id : _this.data.id,
- 'query[imagesize]' : 150
- },
- text : 'Loading'
- });
+ _this.imageView.loadImages();
},
failure : function() {
_this.imageView.el.unmask();
});
}
},
- text : "Delete Selected File or Image"
+ text : "Delete File/Image"
}
]
}
_this.uploadForm.reset();
_this.uploadSending = false;
_this.uploadForm.el.unmask();
- _this.imageView.load({
- url : baseURL + '/Roo/Images.php',
- method : 'GET',
- params : {
- on_table : 'SellerProduct',
- on_id : _this.data.id,
- 'query[imagesize]' : 150
- },
- text : 'Loading'
- });
+ _this.imageView.loadImages();
return;
}