[FIX] share: fix URLs - `key` parameter is now required
authorOlivier Dony <odo@openerp.com>
Fri, 23 Dec 2011 16:24:21 +0000 (17:24 +0100)
committerOlivier Dony <odo@openerp.com>
Fri, 23 Dec 2011 16:24:21 +0000 (17:24 +0100)
bzr revid: odo@openerp.com-20111223162421-nn7onw3itb6noa6p

addons/share/static/src/xml/share.xml
addons/share/wizard/share_wizard.py

index 9b03005..532e8c7 100644 (file)
@@ -5,8 +5,8 @@
 
     <t t-extend="ViewManagerAction">
         <t t-jquery=".oe-shortcut-toggle" t-operation="after">
-            <a class="oe-share_link" href="#share_link" title="Link or embed"><img t-att-src='_s + "/share/static/src/img/share.png"'/></a>
-            <a class="oe-share" href="#share" title="Share by email"><img t-att-src='_s + "/share/static/src/img/share.png"'/></a>
+            <a class="oe-share_link" href="#share_link" title="Link or embed..."><img t-att-src='_s + "/share/static/src/img/share.png"'/></a>
+            <a class="oe-share" href="#share" title="Share with..."><img t-att-src='_s + "/share/static/src/img/share.png"'/></a>
         </t>
     </t>
 
index 0a50356..276021e 100644 (file)
@@ -86,7 +86,7 @@ class share_wizard(osv.osv_memory):
         # NOTE: take _ids in parameter to allow usage through browse_record objects
         base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='', context=context)
         if base_url:
-            base_url += '/web/webclient/login?db=%(dbname)s&login=%(login)s'
+            base_url += '/web/webclient/login?db=%(dbname)s&login=%(login)s&key=%(password)s'
             extra = context and context.get('share_url_template_extra_arguments')
             if extra:
                 base_url += '&' + '&'.join('%s=%%(%s)s' % (x,x) for x in extra)
@@ -97,7 +97,7 @@ class share_wizard(osv.osv_memory):
 
     def _share_root_url(self, cr, uid, ids, _fieldname, _args, context=None):
         result = dict.fromkeys(ids, '')
-        data = dict(dbname=cr.dbname, login='')
+        data = dict(dbname=cr.dbname, login='', password='')
         for this in self.browse(cr, uid, ids, context=context):
             result[this.id] = this.share_url_template() % data
         return result
@@ -150,10 +150,9 @@ class share_wizard(osv.osv_memory):
         result = dict.fromkeys(ids, '')
         for this in self.browse(cr, uid, ids, context=context):
             if this.result_line_ids:
-                ctx = dict(context, share_url_template_extra_arguments=['key'],
-                                    share_url_template_hash_arguments=['action_id'])
+                ctx = dict(context, share_url_template_hash_arguments=['action_id'])
                 user = this.result_line_ids[0]
-                data = dict(dbname=cr.dbname, login=user.login, key=user.password, action_id=this.action_id.id)
+                data = dict(dbname=cr.dbname, login=user.login, password=user.password, action_id=this.action_id.id)
                 result[this.id] = this.share_url_template(context=ctx) % data
         return result
 
@@ -813,7 +812,7 @@ class share_result_line(osv.osv_memory):
     def _share_url(self, cr, uid, ids, _fieldname, _args, context=None):
         result = dict.fromkeys(ids, '')
         for this in self.browse(cr, uid, ids, context=context):
-            data = dict(dbname=cr.dbname, login=this.login)
+            data = dict(dbname=cr.dbname, login=this.login, password='')
             result[this.id] = this.share_wizard_id.share_url_template() % data
         return result