summaryrefslogtreecommitdiff
path: root/addons/share/web
diff options
context:
space:
mode:
authorRucha (Open ERP) <rpa@tinyerp.com>2011-11-02 10:58:27 +0530
committerRucha (Open ERP) <rpa@tinyerp.com>2011-11-02 10:58:27 +0530
commit2fdecf4717080ea98a514b67dedefc27d76c6727 (patch)
treebb54dd0e81af0bbf999fee1110fecb9e507f51e1 /addons/share/web
parent9fe0f6fa83b84d0806359bdc2a3ae31dfb7e997a (diff)
parent3d22bb8b55d48e5ee8226f023555f003288b157a (diff)
[MERGE]: Merge with latest trunk
bzr revid: rpa@tinyerp.com-20111102052827-0bctjrhb4amyg6pl
Diffstat (limited to 'addons/share/web')
-rw-r--r--addons/share/web/__init__.py2
-rw-r--r--addons/share/web/controllers.py49
-rw-r--r--addons/share/web/editors.py94
3 files changed, 0 insertions, 145 deletions
diff --git a/addons/share/web/__init__.py b/addons/share/web/__init__.py
deleted file mode 100644
index f95bb222c10..00000000000
--- a/addons/share/web/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-import controllers
-import editors \ No newline at end of file
diff --git a/addons/share/web/controllers.py b/addons/share/web/controllers.py
deleted file mode 100644
index e682c8d9709..00000000000
--- a/addons/share/web/controllers.py
+++ /dev/null
@@ -1,49 +0,0 @@
-import urlparse
-import cherrypy
-
-from openobject import rpc
-from openobject.tools import expose, ast
-
-import openerp.controllers
-
-
-
-class ShareWizardController(openerp.controllers.SecuredController):
- _cp_path = "/share"
-
- @expose()
- def index(self, domain, context, view_id, search_domain='[]', action_id=None):
- context = ast.literal_eval(context)
-
- if not action_id:
- # This should not be needed anymore, but just in case users are
- # running the module with an older version of the web client...
-
- # to remove soon-ish
- action_id = rpc.RPCProxy('ir.actions.act_window').search(
- [('view_id','=',int(view_id))], context=context)
- if not action_id: return ""
-
- action_id = action_id[0]
-
- domain = ast.literal_eval(domain)
- domain.extend(ast.literal_eval(search_domain))
-
- scheme, netloc, _, _, _ = urlparse.urlsplit(cherrypy.request.base)
- share_root_url = urlparse.urlunsplit((
- scheme, netloc, '/openerp/login',
- 'db=%(dbname)s&user=%(login)s&password=%(password)s', ''))
-
- context.update(
- #active_ids=share_wiz_id,
- #active_id=share_wiz_id[0],
- _terp_view_name='Share Wizard',
- share_root_url=share_root_url)
- Share = rpc.RPCProxy('share.wizard')
- sharing_view_id = Share.create({
- 'domain': str(domain),
- 'action_id': action_id and int(action_id)
- }, context)
- return openerp.controllers.actions.execute(
- Share.go_step_1([sharing_view_id], context),
- ids=[sharing_view_id], context=context)
diff --git a/addons/share/web/editors.py b/addons/share/web/editors.py
deleted file mode 100644
index 677de4a8317..00000000000
--- a/addons/share/web/editors.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- coding: utf-8 -*-
-import openobject.templating
-
-class FormEditor(openobject.templating.TemplateEditor):
- templates = ['/openerp/controllers/templates/form.mako']
- MAIN_FORM_BODY = u'id="main_form_body"'
-
- def insert_share_button(self, output):
- # Insert the share button on the form title H1 line, at the very end,
- # but only if the user is a member of the sharing group
- share_opener_insertion = output.index('% endif', output.index(
- '/view_diagram/process',
- output.index(self.MAIN_FORM_BODY))) + len('% endif')
- return output[:share_opener_insertion] + '''
- <%
- if 'has_share' not in cp.session:
- cp.session['has_share'] = rpc.RPCProxy('share.wizard').has_share()
- %>
- % if cp.session['has_share'] and buttons.toolbar and not is_dashboard:
- <a id="share-opener" href="#share" title="${_('Share this in 2 clicks...')}">
- <img id="share-opener-img" src="/share/static/images/share.png"/>
- </a>
- <script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery("#share-opener").click(function() {
- jQuery(this).attr(
- "href",
- openobject.http.getURL('/share', {
- context: jQuery("#_terp_context").val(),
- domain: jQuery("#_terp_domain").val(),
- view_id: jQuery("#_terp_view_id").val(),
- action_id: jQuery("#_terp_action_id").val(),
- search_domain: jQuery("#_terp_view_type").val() == "form" ?
- ("[('id','=',"+jQuery("#_terp_id").val()+")]") :
- jQuery("#_terp_search_domain").val(),
- }));
- });
- });
- </script>
- \n
- % endif
-''' + output[share_opener_insertion:]
-
- def edit(self, template, template_text):
- return self.insert_share_button(
- super(FormEditor, self).edit(template, template_text))
-
-
-class SidebarEditor(openobject.templating.TemplateEditor):
- templates = ['/openerp/widgets/templates/sidebar.mako']
- ADD_SHARE_SECTION = u'id="sidebar"'
-
- def insert_share_link(self, output):
- # Insert the link on the line, right after the link to open the
- # attachment form, but only if the user is a member of the sharing group
- share_opener_insertion = output.index(
- '\n',
- output.index(self.ADD_SHARE_SECTION)) + 1
- return output[:share_opener_insertion] + '''
- <%
- if 'has_share' not in cp.session:
- cp.session['has_share'] = rpc.RPCProxy('share.wizard').has_share()
- %>
- % if cp.session['has_share']:
- <div id="share-wizard" class="sideheader-a"><h2>${_("Sharing")}</h2></div>
- <ul class="clean-a">
- <li>
- <a id="sharing" href="#share">${_("Share")}</a>
- </li>
- </ul>
- <script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery("#sharing").click(function() {
- jQuery(this).attr(
- "href",
- openobject.http.getURL('/share', {
- context: jQuery("#_terp_context").val(),
- domain: jQuery("#_terp_domain").val(),
- view_id: jQuery("#_terp_view_id").val(),
- action_id: jQuery("#_terp_action_id").val(),
- search_domain: jQuery("#_terp_view_type").val() == "form" ?
- ("[('id','=',"+jQuery("#_terp_id").val()+")]") :
- jQuery("#_terp_search_domain").val(),
- }));
- });
- });
- </script>
- \n
- % endif
-''' + output[share_opener_insertion:]
-
- def edit(self, template, template_text):
- return self.insert_share_link(
- super(SidebarEditor, self).edit(template, template_text))