diff options
Diffstat (limited to 'addons/web_etherpad')
| -rw-r--r-- | addons/web_etherpad/__init__.py | 2 | ||||
| -rwxr-xr-x | addons/web_etherpad/__openerp__.py | 16 | ||||
| -rw-r--r-- | addons/web_etherpad/res_company.py | 15 | ||||
| -rw-r--r-- | addons/web_etherpad/res_company.xml | 16 | ||||
| -rwxr-xr-x | addons/web_etherpad/static/src/js/web_etherpad.js | 118 | ||||
| -rwxr-xr-x | addons/web_etherpad/static/src/xml/etherpad.xml | 21 |
6 files changed, 0 insertions, 188 deletions
diff --git a/addons/web_etherpad/__init__.py b/addons/web_etherpad/__init__.py deleted file mode 100644 index df35bc32106..00000000000 --- a/addons/web_etherpad/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- -import res_company diff --git a/addons/web_etherpad/__openerp__.py b/addons/web_etherpad/__openerp__.py deleted file mode 100755 index 829081e8c65..00000000000 --- a/addons/web_etherpad/__openerp__.py +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "web_etherpad", - "category" : "Hidden", - "description":'Openerp web Etherpad Widget', - "version": "2.0", - 'author': 'OpenERP SA', - 'website': 'http://openerp.com', - 'data': [ - 'res_company.xml' - ], - "depends": ['base','web'], - 'qweb' : ['static/src/xml/etherpad.xml'], - "css": [], - "js": ['static/src/js/web_etherpad.js'], - "auto_install": False, -} diff --git a/addons/web_etherpad/res_company.py b/addons/web_etherpad/res_company.py deleted file mode 100644 index 0c1dc7c4929..00000000000 --- a/addons/web_etherpad/res_company.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from osv import fields, osv - -class company_pad(osv.osv): - _inherit = 'res.company' - _columns = { - 'pad_url_template': fields.char('Pad URL Template', size=128, required=True, - help="Template used to generate pad URL."), - } - _defaults = { - 'pad_url_template': 'http://ietherpad.com/%(db)s-%(model)s-%(id)d-%(salt)s-%(name)s' - } - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/web_etherpad/res_company.xml b/addons/web_etherpad/res_company.xml deleted file mode 100644 index 20b6f52d853..00000000000 --- a/addons/web_etherpad/res_company.xml +++ /dev/null @@ -1,16 +0,0 @@ -<openerp> - <data> - <record id="view_company_form_with_pad" model="ir.ui.view"> - <field name="name">res.company.form.pad</field> - <field name="model">res.company</field> - <field name="type">form</field> - <field name="inherit_id" ref="base.view_company_form"/> - <field name="arch" type="xml"> - <xpath expr="//page[@string='Configuration']" position="inside"> - <separator string="Pad" colspan="4"/> - <field name="pad_url_template"/> - </xpath> - </field> - </record> - </data> -</openerp> diff --git a/addons/web_etherpad/static/src/js/web_etherpad.js b/addons/web_etherpad/static/src/js/web_etherpad.js deleted file mode 100755 index 8753512423c..00000000000 --- a/addons/web_etherpad/static/src/js/web_etherpad.js +++ /dev/null @@ -1,118 +0,0 @@ -openerp.web_etherpad = function (instance) { - - instance.web.form.FieldEtherpad = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { - template: 'FieldEtherpad', - initialize_content: function() { - this.$textarea = undefined; - if (!this.get("effective_readonly")) { - this.$textarea = this.$element.find('textarea'); - this.$textarea.hide(); - this.$textarea.change(_.bind(function() { - this.set({'value': instance.web.parse_value(this.$textarea.val(), this)}); - }, this)); - this.resized = false; - } - }, - 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 ; - new instance.web.DataSet(this, 'res.company', {}).read_ids([company_id],['pad_url_template'],{}).then(function(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',''), { - db : self.session.db, - model : self.view.model, - })).replace(/\s/g,'') ; - 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_) - { - self._inhibit_on_change = true; - self.set({'value': value_ }); - self._inhibit_on_change = false; - self.invalid = false; - self.render_value(); - }, - add_pad: function(self,pad_template,value_){ - var url = (_.str.sprintf(pad_template, { - db : self.session.db, - model : self.view.model, - 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); - self._dirty_flag = true ; - self.view.do_notify_change(); - }, - 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>'); - if (!this.resized && this.view.options.resize_textareas) { - this.do_resize(this.view.options.resize_textareas); - this.resized = true; - } - } else { - this.$element.text(show_value); - if(this.get('value') != false) - { - var self = this; - if(show_value.split('\n')[0] != '') - $.get(show_value.split('\n')[0]+'/export/html') - .success(function(data) { self.$element.html(data); }) - .error(function() { self.$element.text('Unable to load pad'); }); - else - self.$element.text(show_value); - } - } - }, - validate: function() { - this.invalid = false; - if (!this.get("effective_readonly")) { - try { - var value_ = instance.web.parse_value(this.$textarea.val(), this, ''); - this.invalid = this.get("required") && value_ === ''; - } catch(e) { - this.invalid = true; - } - } - }, - focus: function($element) { - this._super($element || this.$textarea); - }, - do_resize: function(max_height) { - max_height = parseInt(max_height, 10); - var $input = this.$textarea, - $div = $('<div style="position: absolute; z-index: 1000; top: 0"/>').width($input.width()), - new_height; - $div.text($input.val()); - _.each('font-family,font-size,white-space'.split(','), function(style) { - $div.css(style, $input.css(style)); - }); - $div.appendTo($('body')); - new_height = $div.height(); - if (new_height < 90) { - new_height = 90; - } - if (!isNaN(max_height) && new_height > max_height) { - new_height = max_height; - } - $div.remove(); - $input.height(new_height); - }, - reset: function() { - this.resized = false; - } - })); - - instance.web.form.widgets = instance.web.form.widgets.extend({ - 'etherpad': 'instance.web.form.FieldEtherpad', - }); - - -} diff --git a/addons/web_etherpad/static/src/xml/etherpad.xml b/addons/web_etherpad/static/src/xml/etherpad.xml deleted file mode 100755 index 64c2e2dc6a0..00000000000 --- a/addons/web_etherpad/static/src/xml/etherpad.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- vim:fdl=1: ---> -<templates id="template" xml:space="preserve"> - - -<t t-name="FieldEtherpad"> - <t t-if="!widget.get('effective_readonly')"> - <div class="oe_form_field_text"> - <textarea rows="6" - t-att-name="widget.name" - class="field_text" - t-att-tabindex="widget.node.attrs.tabindex" - t-att-autofocus="widget.node.attrs.autofocus" - ></textarea><img class="oe_field_translate oe_input_icon" t-if="widget.field.translate" t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/> - <div t-attf-class="etherpad_field_#{widget.name}" ></div> - </div> - </t> -</t> - -</templates> |
