[IMP] Add PAN's changes for api key warning pop up.

bzr revid: jra@tinyerp.com-20120619110137-ocrzyg6ic6xqgo2z
This commit is contained in:
Jiten (OpenERP) 2012-06-19 16:31:37 +05:30
commit 45cce3533b
4 changed files with 76 additions and 15 deletions

View File

@ -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:

View File

@ -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){

View File

@ -32,6 +32,40 @@
</td>
</t>
<t t-name="Register.Linkedin" style="height:300px;overflow:auto;">
<div>
<table>
<tr>
<td>
<ol>
<li>Go to...<a href="https://www.linkedin.com/secure/developer" class="oe_secondary_menu_section" target="#">https://www.linkedin.com/secure/developer</a></li>
<li>Log you in Linkedin if you did not yet</li>
<li>Add a new Application</li>
<li>Fill in the form</li>
</ol>
</td>
</tr>
<tr>
<td>
<img src='/web_linkedin/static/src/img/help_to_fill_form.png' height="500" width="800" border="2"/>
</td>
</tr>
<tr>
<td >
Copy the API Key <input type="text" id="apikey" /><button id="register" class="oe_form_button_save_dirty" onclick="">Apply</button>
</td>
</tr>
<tr>
<td>
<img src='/web_linkedin/static/src/img/apikey.png' height="300" width="500" border="2"/>
</td>
</tr>
</table>
</div>
</t>
<t t-name="TwitterURL">
<td id="twitterid">
<a t-att-href="URLID" target="_blank">

View File

@ -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: