Etherpad : with edit avble to save pad.
bzr revid: tta@openerp.com-20120420105706-58pf3atz6qy90ttb
This commit is contained in:
@@ -16,27 +16,19 @@ openerp.web_etherpad = function (instance) {
|
||||
set_value: function(value_) {
|
||||
var self = this ;
|
||||
var company_id = (self.view.datarecord.hasOwnProperty('id')) ?self.view.datarecord.company_id[0]: self.view.datarecord.company_id ;
|
||||
/* getting etherpad url and set pad to field. */
|
||||
self.rpc('/web/dataset/get',{
|
||||
'model':'res.company',
|
||||
'ids':[company_id],
|
||||
'fields':['pad_url_template'],
|
||||
'context':{}
|
||||
},function(companies){
|
||||
var pad_template = companies[0].pad_url_template.replace('-%(salt)s-%(name)s','').replace(/\s/g,'');
|
||||
new instance.web.DataSet(this, 'res.company', {}).read_ids([company_id],['pad_url_template'],{}).then(function(res){
|
||||
console.log("dataset :::::" , res);
|
||||
var pad_template = res[0].pad_url_template.replace('-%(salt)s-%(name)s','').replace(/\s/g,'');
|
||||
|
||||
var patt_url = (_.str.sprintf(pad_template.replace('-%(id)d',''), {
|
||||
var patt_url = (_.str.sprintf(pad_template.replace('-%(id)d',''), {
|
||||
db : self.session.db,
|
||||
model : self.view.model,
|
||||
})).replace(/\s/g,'') ;
|
||||
//alert("match or not >?"+value_.search(patt_url));
|
||||
if(value_ == false)
|
||||
self.add_pad(self,pad_template,value_);
|
||||
else if(value_.search(patt_url) != 0)
|
||||
self.add_pad(self,pad_template,value_);
|
||||
else
|
||||
self.show_pad_value(self,value_);
|
||||
});
|
||||
if(value_ == false || value_.search(patt_url) != 0)
|
||||
self.add_pad(self,pad_template,value_);
|
||||
else
|
||||
self.show_pad_value(self,value_);
|
||||
});
|
||||
},
|
||||
show_pad_value: function(self,value_)
|
||||
{
|
||||
@@ -44,7 +36,6 @@ openerp.web_etherpad = function (instance) {
|
||||
self.set({'value': value_ });
|
||||
self._inhibit_on_change = false;
|
||||
self.invalid = false;
|
||||
self.update_dom();
|
||||
self.render_value();
|
||||
},
|
||||
add_pad: function(self,pad_template,value_){
|
||||
@@ -54,14 +45,14 @@ openerp.web_etherpad = function (instance) {
|
||||
id : Math.round(new Date().getTime()/100.0),
|
||||
})).replace(/\s/g,'');
|
||||
var show_value = instance.web.format_value(value_, this, '');
|
||||
self.show_pad_value(self,url + '\n'+ show_value);
|
||||
this.dirty = true;
|
||||
self.show_pad_value(self,url + '\n'+ show_value);
|
||||
self._dirty_flag = true ;
|
||||
},
|
||||
render_value: function() {
|
||||
var show_value = instance.web.format_value(this.get('value'), this, '');
|
||||
if (!this.get("effective_readonly")) {
|
||||
this.$textarea.val(show_value);
|
||||
this.$element.find('div').html('<iframe frameborder="0" height="217px" width="100%" src="'+show_value.split('\n')[0]+'?showChat=false"></iframe>');
|
||||
this.$element.find('div').html('<iframe frameborder="0" height="217px" width="100%" src="'+show_value.split('\n')[0]+'?showChat=false"></iframe>');
|
||||
if (!this.resized && this.view.options.resize_textareas) {
|
||||
this.do_resize(this.view.options.resize_textareas);
|
||||
this.resized = true;
|
||||
@@ -70,11 +61,14 @@ openerp.web_etherpad = function (instance) {
|
||||
this.$element.text(show_value);
|
||||
if(this.get('value') != false)
|
||||
{
|
||||
var self = this;
|
||||
$.get(show_value.split('\n')[0]+'/export/html', function(data) {
|
||||
console.log(data);
|
||||
self.$element.html(data);
|
||||
});
|
||||
var self = this;
|
||||
if(show_value.split('\n')[0] != '')
|
||||
$.get(show_value.split('\n')[0]+'/export/html', function(data) {
|
||||
console.log(data);
|
||||
self.$element.html(data);
|
||||
});
|
||||
else
|
||||
self.$element.text(show_value);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user