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 e48b7fa7a9a..ede7cfa444b 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(); } @@ -107,18 +107,32 @@ openerp.web_linkedin = function(instance) { } }, APIKeyWarning: function(e) { - e.message= "Linkedin API Key is not registerd/correct.\n Go to Settings, 'General Settings' menu and follow steps to register the LinkedIn API Key."; - instance.web.dialog($(QWeb.render("CrashManager.warning", _t(e))), { - title: _t("Linkedin API Key Warning"), +// e.message= "Linkedin API Key is not registerd/correct.\n Go to Settings, 'General Settings' menu and follow steps to register the LinkedIn API Key."; +// instance.web.dialog($(QWeb.render("CrashManager.warning", _t(e))), { +// title: _t("Linkedin API Key Warning"), +// modal: true, +// height: 200, +// width: 500, +// buttons: [ + var self = this; + e.message=""; + instance.web.dialog($(QWeb.render("Register.Linkedin", _t(e))), { + title: _t("Configure your Linkedin Key API"), modal: true, - height: 200, - width: 500, - buttons: [ + width : 840, + height:500, + buttons:[ { text: _t("Ok"), click: function() { $(this).dialog("close"); } }] }); + $("#register").click(function() { + var linkkey = $("#apikey").val(); + var key = JSON.stringify(linkkey); + self.rpc('/web_linkedin/database/api_key',{'key': key},function(data){ + }); + }); }, 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 9321e54787d..73c49f52279 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -32,6 +32,40 @@ + +
+ + + + + + + + + + + + + + +
+
    +
  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. +
+
+ +
+ 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: