click : function (_self, e)
{
Pman.Dialog.CoreImportUrl.show({
- target : '/Crm/ImportHtml.php'
+ target : '/Core/ImportMailMessage.php'
}, function(data) {
if (data) {
// Roo.log(data);
click : function (_self, e)
{
Pman.Dialog.Image.show({
- _url : baseURL + '/Crm/ImportHtml.php'
+ _url : baseURL + '/Core/ImportMailMessage.php'
}, function(data) {
if (data) {
_this.form.findField('bodytext').setValue(data);
var l = document.location;
new Pman.Request({
- url : baseURL + '/Crm/ImportHtml.php',
+ url : baseURL + '/Core/ImportMailMessage.php',
method: 'POST',
mask : "Loading",
{
xtype: 'ComboBox',
xns: Roo.form,
+ listeners : {
+ select : function (combo, record, index)
+ {
+
+ /*
+ (function() {
+ combo.setValue('');
+ }).defer(100);
+ */
+ if(!record){
+ return;
+ }
+ _this.form.findField('bodytext').setValue(record.data.content);
+
+ }
+ },
allowBlank : true,
alwaysQuery : true,
- displayField : 'name',
+ displayField : 'file',
editable : false,
emptyText : "Select Template",
fieldLabel : 'Template',
pageSize : 20,
qtip : "Select Template",
selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
+ tpl : '<div class="x-grid-cell-text x-btn button"><b>{file}</b> </div>',
triggerAction : 'all',
typeAhead : true,
- valueField : 'name',
+ valueField : 'file',
width : 200,
store : {
xtype: 'Store',
}
},
remoteSort : true,
- sortInfo : { direction : 'DESC', field: 'name' },
+ sortInfo : { direction : 'DESC', field: 'file' },
proxy : {
xtype: 'HttpProxy',
xns: Roo.data,
id : 'name',
root : 'data',
totalProperty : 'total',
- fields : [{"name":"name","type":"string"},{"name":"body","type":"string"}]
+ fields : [{"name":"file","type":"string"},{"name":"content","type":"string"}]
}
}
},
{
if (action.type == 'setdata') {
- // _this.loaded_data = _this.form.getValues();
-
+
+ _this.data.module = _this.data.module || 'crm';
+
+ _this.form.url = baseURL + '/Roo/' + _this.data.module + '_mailing_list_message.php';
+
+ _this.html_preview.hide();
+ _this.preview_btn.hide();
+
if(_this.data.id*1 > 0){
_this.dialog.el.mask("Loading");
this.load({ method: 'GET', params: { '_id' : _this.data.id }});
- _this.html_preview.show();
+ if(_this.data.module == 'crm'){
+ _this.html_preview.show();
+ }
_this.preview_btn.show();
+
} else {
- _this.html_preview.hide();
- _this.preview_btn.hide();
_this.form.setValues({
'from_name' : Pman.Login.authUser.name,
'from_email' : Pman.Login.authUser.email
var s = Roo.get(_this.form.findField('bodytext').doc.documentElement);
+ var ontable = (_this.data.module) ? _this.data.module + '_mailing_list_message' : 'crm_mailing_list_message';
+
var nodes = [];
s.select('img[src]').each(function(i) {
nodes.push(i.dom);
method : 'POST',
params : {
onid : _this.form.findField('id').getValue(),
- ontable : 'core_mailing_list_message' ,
+ ontable : ontable ,
_remote_upload : i.src
},
success : function(res){
{
var id = _this.form.findField('id').getValue() * 1;
if (!id) {
- Roo.MessageBox.alert("Error", "Save email template first");
+ Roo.MessageBox.alert("Error", "Save message first");
return false;
}
}
var id = _this.form.findField('id').getValue() * 1;
if (!id) {
- Roo.MessageBox.alert("Error", "Save press release first");
+ Roo.MessageBox.alert("Error", "Save email template first");
return false;
}
o.params.onid = id
- o.params.ontable = 'crm_mailing_list_message';
+ o.params.ontable = 'core_mailing_list_message';
// o.params.imgtype = 'PressRelease';
//o.params['query[imagesize]'] = '150x150';
var p = _this.form.findField('plaintext');
new Pman.Request({\r
- url : baseURL + '/Crm/ImportHtml.php',\r
+ url : baseURL + '/Core/ImportMailMessage.php',\r
method : 'POST',\r
params : {
bodytext : h,\r
if(_this.data.id * 1 >= 0)
{
options.params.onid = _this.data.id;
- options.params.ontable = 'core_mailing_list_message';
+
+ options.params.ontable = (_this.data.module) ? _this.data.module + '_mailing_list_message' : 'crm_mailing_list_message';
}
}
},
return;
}
- Pman.Dialog.Image.show( { id : 0, onid: _this.data.id, ontable: 'core_mailing_list_message' }, function() {
+ var ontable = (_this.data.module) ? _this.data.module + '_mailing_list_message' : 'crm_mailing_list_message';
+
+ Pman.Dialog.Image.show( { id : 0, onid: id, ontable: ontable }, function() {
_this.igrid.getDataSource().load({});
});
}
click : function (_self, e)
{
//_this.dialog.hide();
-
- Pman.Dialog.CrmMailingListMessagePreview.show({ id : _this.form.findField('id').getValue() });
+ Roo.log(_this.data.module);
+ Pman.Dialog.CoreMailingListMessagePreview.show({ id : _this.form.findField('id').getValue(), module : _this.data.module });
},
render : function (_self)
{
var id = _this.form.findField('id').getValue();
if(id*1 < 1){
- Roo.MessageBox.alert('Error', 'Please select a queue to send');
+ Roo.MessageBox.alert('Error', 'Please save the message frist!');
return;
}
method : 'POST',
mask: 'Sending',
params : {
- _id : id,
- _action : 'html'
+ _id : id
},
success : function(res) {
if(res.data == 'SUCCESS'){