From 277e800c162811cdc12c545e41919d59e6200056 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Thu, 14 Jun 2012 16:49:10 +0530 Subject: [PATCH 1/3] [IMP] Improved code. bzr revid: pan@tinyerp.com-20120614111910-jyqwdkf8ec35km2i --- addons/web_linkedin/static/src/js/linkedin.js | 31 +++++++++++-------- .../web_linkedin/static/src/xml/linkedin.xml | 17 +++++----- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index 6c8fc6c5147..f13bbf6d761 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -77,15 +77,15 @@ openerp.web_linkedin = function(instance) { } if (this.view.datarecord['linkedin_id']) { if (this.view.datarecord['profile_id'] && !this.view.datarecord['twitter_id']) { - if (this.$element.find('#twitterid')) { - this.$element.find('#twitterid').remove(); - } - } - else if (!this.view.datarecord['profile_id'] && this.view.datarecord['twitter_id']) { - if (this.$element.find('#profileid')) { - this.$element.find('#profileid').remove(); - } - } + if (this.$element.find('#twitterid')) { + this.$element.find('#twitterid').remove(); + } + } + else if (!this.view.datarecord['profile_id'] && this.view.datarecord['twitter_id']) { + if (this.$element.find('#profileid')) { + this.$element.find('#profileid').remove(); + } + } }else{ this.removeTemplate(); } @@ -111,12 +111,17 @@ openerp.web_linkedin = function(instance) { instance.web.dialog($(QWeb.render("Register.Linkedin", _t(e))), { title: _t("Configure your Linkedin Key API"), modal: true, - width : 825, - buttons:[{ + width : 800, + height:500, + buttons:[ + { text: _t("Close"), - click: function() { $(this).dialog("close"); } + click: function() + { + $(this).dialog("close"); + } } - ] + ] }); }, setTemplate: function( URL, AccountName ) { diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml index 4244fc38b98..80a7b6e2908 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -32,10 +32,12 @@ - - +
+
+ - @@ -55,20 +57,21 @@ -
1)Go Tohttps://www.linkedin.com/secure/developer + + 1)Go to...https://www.linkedin.com/secure/developer
- +
- 5) Copy the API Key + + 5) Copy the API Key
- +
+
From 79a911301cea4ca1b9b21bd054c28479bda710af Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Thu, 14 Jun 2012 19:01:04 +0530 Subject: [PATCH 2/3] [IMP] Improved code. bzr revid: pan@tinyerp.com-20120614133104-102rzo97d0dq5jhq --- addons/web_linkedin/static/src/js/linkedin.js | 8 ++++++ .../web_linkedin/static/src/xml/linkedin.xml | 28 ++++++------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index f13bbf6d761..9bfd1697aaf 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -122,7 +122,15 @@ openerp.web_linkedin = function(instance) { } } ] + }); + $("#register").click(function() + { + var linkkey = $("#apikey").val(); + console.log("the key is ",linkkey); + }); + + }, setTemplate: function( URL, AccountName ) { if(AccountName){ diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml index 80a7b6e2908..e7f8b8335bb 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -34,26 +34,15 @@
- - - - - - - - - - +
    +
  1. Go to...https://www.linkedin.com/secure/developer
  2. +
  3. Log you in Linkedin if you did not yet
  4. +
  5. Add a new Application
  6. +
  7. Fill in the form
  8. +
+ @@ -70,6 +59,7 @@ +
- 1)Go to...https://www.linkedin.com/secure/developer -
- 2) Log you in Linkedin if you did not yet -
- 3) Add a new Application -
- 4) Fill in the form -
@@ -62,7 +51,7 @@
- 5) Copy the API Key +
  • Copy the API Key
  • From cc659ea35537c1289d7b1f1adb61d7197a2739b9 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Tue, 19 Jun 2012 15:46:30 +0530 Subject: [PATCH 3/3] [IMP] Improved code. bzr revid: pan@tinyerp.com-20120619101630-w1sufff8c38egvjl --- addons/web_linkedin/res_config.py | 5 +++++ addons/web_linkedin/static/src/js/linkedin.js | 17 +++++++++++++---- addons/web_linkedin/static/src/xml/linkedin.xml | 3 ++- addons/web_linkedin/web_linkedin.py | 8 ++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/addons/web_linkedin/res_config.py b/addons/web_linkedin/res_config.py index e3e70237086..e4758e1c62c 100644 --- a/addons/web_linkedin/res_config.py +++ b/addons/web_linkedin/res_config.py @@ -48,5 +48,10 @@ class base_config_settings(osv.osv_memory): company_id = company_obj._company_default_get(cr, uid, 'res.users', context=context) company_obj.write(cr, uid, [company_id], {'default_linkedin_api_key': data.default_linkedin_api_key}, context=context) + + + base_config_settings() + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index 9bfd1697aaf..285770adfdd 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -107,11 +107,12 @@ openerp.web_linkedin = function(instance) { } }, APIKeyWarning: function(e) { + var self = this; e.message=""; instance.web.dialog($(QWeb.render("Register.Linkedin", _t(e))), { title: _t("Configure your Linkedin Key API"), modal: true, - width : 800, + width : 840, height:500, buttons:[ { @@ -124,10 +125,18 @@ openerp.web_linkedin = function(instance) { ] }); - $("#register").click(function() - { + $("#register").click(function() { + var linkkey = $("#apikey").val(); - console.log("the key is ",linkkey); + + var key = JSON.stringify(linkkey); + + + self.rpc('/web_linkedin/database/api_key',{'key': key},function(data){ + + }); + + }); diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml index e7f8b8335bb..44664ca7d69 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -51,7 +51,8 @@ -
  • Copy the API Key
  • + Copy the API Key + diff --git a/addons/web_linkedin/web_linkedin.py b/addons/web_linkedin/web_linkedin.py index 77327b92bde..4ef1c414734 100644 --- a/addons/web_linkedin/web_linkedin.py +++ b/addons/web_linkedin/web_linkedin.py @@ -23,6 +23,7 @@ import urllib2 import xmlrpclib import zlib + from web import common openerpweb = common.http @@ -69,4 +70,11 @@ class Binary(openerpweb.Controller): bfile = urllib2.urlopen(url) return base64.b64encode(bfile.read()) +class Database(openerpweb.Controller): + _cp_path = "/web_linkedin/database" + + @openerpweb.jsonrequest + def api_key(self, req, key): + + return True # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: