commit 39574b1d41661dbd05b3b4fc63acfd3177fe7300 Author: cpa-openerp Date: Fri Oct 15 15:46:26 2010 +0530 [IMP] Piratepad web addons. bzr revid: cpa@tinyerp.com-20101015101626-e23fxuyvzwsx9ao2 diff --git a/addons/piratepad/__init__.py b/addons/piratepad/__init__.py new file mode 100644 index 00000000000..95542e91e3e --- /dev/null +++ b/addons/piratepad/__init__.py @@ -0,0 +1,2 @@ +import controllers +import editors diff --git a/addons/piratepad/__openerp__.py b/addons/piratepad/__openerp__.py new file mode 100644 index 00000000000..05e707b0581 --- /dev/null +++ b/addons/piratepad/__openerp__.py @@ -0,0 +1,8 @@ +{ + "name" : "Piratepad Controller methods", + "version" : "1.0", + "depends" : ["openerp"], + "author" : "Tiny", + "website": 'http://www.openerp.com/', + "active": True, +} diff --git a/addons/piratepad/controllers.py b/addons/piratepad/controllers.py new file mode 100644 index 00000000000..290cfc2953b --- /dev/null +++ b/addons/piratepad/controllers.py @@ -0,0 +1,22 @@ +from openobject.tools import expose +from openerp.controllers import form +from openerp.utils import rpc, common, TinyDict +import cherrypy + +class Form(form.Form): + _cp_path = "/piratepad/form" + + @expose('json', methods=('POST',)) + def save(self, **kwargs): + params, data = TinyDict.split(cherrypy.session['params']) + pad_name=kwargs.get('pad_name') + ctx = dict(rpc.session.context, + default_res_model=params.model, default_res_id=params.id, + active_id=False, active_ids=[]) + + pad_link = "http://piratepad.net/"+'-'.join(pad_name.split()) + attachment_id = rpc.RPCProxy('ir.attachment').create({ + 'name': pad_name, + 'url': pad_link, + }, ctx) + return {'id': attachment_id, 'name': pad_name, 'url': pad_link} \ No newline at end of file diff --git a/addons/piratepad/editors.py b/addons/piratepad/editors.py new file mode 100644 index 00000000000..a70dc6aa429 --- /dev/null +++ b/addons/piratepad/editors.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +from openobject.widgets import JSLink +import openobject.templating + +class SidebarTemplateEditor(openobject.templating.TemplateEditor): + templates = ['/openerp/widgets/templates/sidebar.mako'] + SIDEBAR_START = u'
' + + def edit(self, template, template_text): + output = super(SidebarTemplateEditor, self).edit(template, template_text) + + insertion_point = output.index(self.SIDEBAR_START) + len(self.SIDEBAR_START) + return output[:insertion_point] + ''' + +
+ + + + + + +
+ + + ${_("Ok")} +
+
+ ''' + output[insertion_point:]