From 61b7f5034d0d2b8b609dd99fe32766e48ed99114 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Tue, 12 Jun 2012 18:14:54 +0530 Subject: [ADD] Add linkedin module for integration linkedin with openerp. bzr revid: jra@tinyerp.com-20120612124454-78zfn48kerp93c5z --- addons/web_linkedin/static/src/css/linkedin.css | 39 ++ .../web_linkedin/static/src/img/Linkedin_blue.png | Bin 0 -> 5435 bytes .../web_linkedin/static/src/img/Linkedin_grey.png | Bin 0 -> 2748 bytes addons/web_linkedin/static/src/img/icon.png | Bin 0 -> 38257 bytes .../static/src/img/linkedin-profile.gif | Bin 0 -> 2244 bytes addons/web_linkedin/static/src/img/loading.png | Bin 0 -> 5260 bytes .../web_linkedin/static/src/img/twitt-follow.png | Bin 0 -> 12908 bytes addons/web_linkedin/static/src/js/linkedin.js | 667 +++++++++++++++++++++ addons/web_linkedin/static/src/xml/linkedin.xml | 124 ++++ 9 files changed, 830 insertions(+) create mode 100644 addons/web_linkedin/static/src/css/linkedin.css create mode 100644 addons/web_linkedin/static/src/img/Linkedin_blue.png create mode 100644 addons/web_linkedin/static/src/img/Linkedin_grey.png create mode 100644 addons/web_linkedin/static/src/img/icon.png create mode 100644 addons/web_linkedin/static/src/img/linkedin-profile.gif create mode 100644 addons/web_linkedin/static/src/img/loading.png create mode 100644 addons/web_linkedin/static/src/img/twitt-follow.png create mode 100644 addons/web_linkedin/static/src/js/linkedin.js create mode 100644 addons/web_linkedin/static/src/xml/linkedin.xml (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/css/linkedin.css b/addons/web_linkedin/static/src/css/linkedin.css new file mode 100644 index 00000000000..0ca3dc90ac9 --- /dev/null +++ b/addons/web_linkedin/static/src/css/linkedin.css @@ -0,0 +1,39 @@ +.ul-ldn-dropdown { + list-style: none outside none; + padding: 1px; + max-height: 500px; + margin: 0px; + background-color: rgb(255, 255, 255); + border: 1px solid rgb(153, 153, 153); +} + +.li-ldn-dropdown { + margin: 0px; + display: block; + cursor: default; + padding: 3px; + border: 1px solid rgb(255, 255, 255); + background-color: transparent; +} +.li-ldn-dropdown td{ + font-size:10px; + font-weight:normal; + padding: 2px 2px 0px; +} + +.li-ldn-dropdown:hover { + margin: 0px; + display: block; + cursor: pointer; + border: 1px solid rgb(10, 36, 106); + background-color: rgb(182, 189, 210) +} + +.search-box { + background: none repeat scroll 0 0%, -moz-linear-gradient(#EFEFEF, #D8D8D8) repeat scroll 0 0 transparent; + background: none repeat scroll 0 0%, -webkit-linear-gradient(#EFEFEF, #D8D8D8) repeat scroll 0 0 transparent; + border: 1px solid #ABABAB; + border-radius: 3px 3px 3px 3px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + max-height: 450px; +} diff --git a/addons/web_linkedin/static/src/img/Linkedin_blue.png b/addons/web_linkedin/static/src/img/Linkedin_blue.png new file mode 100644 index 00000000000..c37d0218f7d Binary files /dev/null and b/addons/web_linkedin/static/src/img/Linkedin_blue.png differ diff --git a/addons/web_linkedin/static/src/img/Linkedin_grey.png b/addons/web_linkedin/static/src/img/Linkedin_grey.png new file mode 100644 index 00000000000..726e012f220 Binary files /dev/null and b/addons/web_linkedin/static/src/img/Linkedin_grey.png differ diff --git a/addons/web_linkedin/static/src/img/icon.png b/addons/web_linkedin/static/src/img/icon.png new file mode 100644 index 00000000000..119f74abdd3 Binary files /dev/null and b/addons/web_linkedin/static/src/img/icon.png differ diff --git a/addons/web_linkedin/static/src/img/linkedin-profile.gif b/addons/web_linkedin/static/src/img/linkedin-profile.gif new file mode 100644 index 00000000000..e347e5e3ff8 Binary files /dev/null and b/addons/web_linkedin/static/src/img/linkedin-profile.gif differ diff --git a/addons/web_linkedin/static/src/img/loading.png b/addons/web_linkedin/static/src/img/loading.png new file mode 100644 index 00000000000..5ab0089fccb Binary files /dev/null and b/addons/web_linkedin/static/src/img/loading.png differ diff --git a/addons/web_linkedin/static/src/img/twitt-follow.png b/addons/web_linkedin/static/src/img/twitt-follow.png new file mode 100644 index 00000000000..684813a1ee4 Binary files /dev/null and b/addons/web_linkedin/static/src/img/twitt-follow.png differ diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js new file mode 100644 index 00000000000..e48b7fa7a9a --- /dev/null +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -0,0 +1,667 @@ +/*--------------------------------------------------------- + * OpenERP web_linkedin (module) + *---------------------------------------------------------*/ + +openerp.web_linkedin = function(instance) { + var QWeb = instance.web.qweb; + var _t = instance.web._t; + instance.web.form.widgets.add( + 'Linkedin', 'instance.web_linkedin.Linkedin'); + instance.web_linkedin.Linkedin = instance.web.form.FieldChar.extend({ + template: 'Linkedin', + isAuthorized: false, + render_value: function() { + this._super(); + var self = this; + this.$element.find('#loader').hide(); + if (!this.get("effective_readonly")) { + this._super(); + var context = new instance.web.CompoundContext(this.build_context()); + var build_context = this.build_context(); + this.apikey = build_context.__contexts[0].api_key; + if(this.view.fields['linkedin_id']){ + if(this.view.datarecord['linkedin_id']){ + this.$element.find('#linkedindefault').hide(); + this.$element.find('#linkedinrecord').show(); + }else{ + this.$element.find('#linkedinrecord').hide(); + this.$element.find('#linkedindefault').show(); + } + } + try { + IN.init({ api_key : this.apikey }); + } catch(e) { + if(!this.apikey){ + this.APIWarning = e; + } + if (e.type == "undefined_method") { + this.APIWarning = e; + } + } + var head = document.head || document.getElementsByTagName('head')[0]; + var tag = document.createElement('script'); + tag.type = 'text/javascript'; + tag.src = "http://platform.linkedin.com/in.js"; + if(this.apikey){ + // Registered API key is necessary to integrate with LinkedIn. + tag.innerHTML = 'api_key : '+this.apikey+'\n'; + } + tag.innerHTML = tag.innerHTML + 'authorize : true'; + // On load script Loading text is displayed + /*if(this.$element.find("#imagediv").find('.oe_loading')){ + this.$element.find("#imagediv").find('.oe_loading').remove(); + } + tag.onload=this.$element.find("#imagediv").append('Loading....');*/ + var temp = 0; + $(head).find('script').each( function(i,val) { + if($(val).attr('src')=="http://platform.linkedin.com/in.js"){ + temp = 1; + } + }); + if(temp != 1) { + head.appendChild( tag ); + } + this.notification = new instance.web.Notification(this); + this.notification.appendTo(this.$element); + this.$element.find(".linkedin_icon").click( this.do_load_linkedin ); + this.removeTemplate(); + if(this.view.fields['name'].get_value()!=false){ + /* if value get then display button of profile url */ + if (this.view.fields['profile_id'].get_value() || this.view.datarecord['profile_id']) { + this.setTemplate(this.view.datarecord['profile_id'] , false ); + } + /* if value get then display button of twitter */ + if (this.view.fields['twitter_id'].get_value() || this.view.datarecord['twitter_id']) { + this.setTemplate( false, this.view.datarecord['twitter_id']); + } + } + 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(); + } + } + }else{ + this.removeTemplate(); + } + } else { + this.removeTemplate(); + if(this.view.fields['name'].get_value()!=false){ + var tagtr = document.createElement('tr'); + tagtr.id = "profiletwittor-tr"; + this.$element.append(tagtr); + /* if value get then display button of profile url */ + if (this.view.fields['profile_id'] && this.view.datarecord['profile_id']) { + this.setTemplate( this.view.datarecord['profile_id'] , false ); + } + /* if value get then display button of twitter */ + if (this.view.fields['twitter_id'] && this.view.datarecord['twitter_id']) { + this.setTemplate( false, this.view.datarecord['twitter_id'] ); + } + } + } + }, + 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"), + modal: true, + height: 200, + width: 500, + buttons: [ + { + text: _t("Ok"), + click: function() { $(this).dialog("close"); } + }] + }); + }, + setTemplate: function( URL, AccountName ) { + if(AccountName){ + var AccountName = AccountName.replace(/[^a-zA-Z 0-9]+/g, ''); + Twitt = "https://twitter.com/intent/follow?original_referer=http%3A%2F%2Flocalhost%3A8069%2Fweb%2Fwebclient%2Fhome&screen_name="+AccountName+"&source=followbutton&variant=2.0" + this.$element.find('tr#profiletwittor-tr').append(QWeb.render('TwitterURL',{'URLID': Twitt, 'account': AccountName})) + }else if(URL){ + this.$element.find('tr#profiletwittor-tr').append(QWeb.render('ProfileURL',{'URLID': URL })) + } + }, + removeTemplate: function( flag ) { + if (flag) { + this.$element.find('#searchresults').remove(); + } else { + if (this.$element.find('#profileid')) { + this.$element.find('#profileid').remove(); + } + if (this.$element.find('#twitterid')) { + this.$element.find('#twitterid').remove(); + } + } + }, + /* Load Linkedin Data On search */ + do_load_linkedin: function( e ) { + var self = this; + this.msg_Counter=0; /* used to display notification, when record not found on Linkedin search */ + this.removeTemplate( 1 ); + if(!this.apikey){ + this.APIKeyWarning(this.APIWarning); + e.preventDefault(); + e.stopPropagation(); + e.stopImmediatePropagation(); + return false; + } + if (IN.ENV.auth.oauth_token) { + if (self.$element.find("input").val()) { + self.$element.find('#loader').show(); + $('.linkedin_icon').css('display', 'none'); + /* People Search */ + IN.API.Raw("/people-search:(people:(id,first-name,last-name,picture-url,public-profile-url,formatted-name,location,phone-numbers,im-accounts,main-address,headline))") + .params({ + "first-name": self.$element.find("input").val(), + "count" : 4 + }) + .result( self.do_fetch_detail ); + /* Company Search */ + IN.API.Raw("/company-search:(companies:(id,name,description,industry,logo-url,website-url,locations,twitter-id))") + .params({ + "keywords": self.$element.find("input").val(), + "count" : 4 + }) + .result( self.do_fetch_detail ); + }else{ + this.notification.warn(_t("Linkedin Search"), _t("Please Enter Required Field.")); + } + } + else { + self.do_authorize(); + } + e.preventDefault(); + e.stopPropagation(); + e.stopImmediatePropagation(); + }, + do_authorize: function(resultCallback){ + this.check_authorized(); + if (this.isAuthorized == false){ + IN.User.authorize(resultCallback); + } + }, + check_authorized: function(){ + this.isAuthorized = IN.User.isAuthorized(); + }, + /* Fetch Result from Linkedin and set in searchbox */ + do_fetch_detail: function(result, metadata) { + var self = this; + if (result.people) { + if (result.people._total==0) { + this.msg_Counter++; + } + var count = 0; + for (i in result.people.values) { + var temp = self.validName(result.people.values[i].firstName, result.people.values[i].lastName) + if (temp) { + count++; + } + } + if (count == 4 || count==result.people._total) { + result.people._total = 0; + } + this.resultcontact = result; + }else if (result.companies) { + if (result.companies._total == 0) { + this.msg_Counter++; + } + this.resultcompany = result; + } + this.removeTemplate( 1 ); + if (this.msg_Counter == 2) { + // dialog box + /*new instance.web.dialog($(QWeb.render("SearchWarning")), { + title: _t("Linkedin Search"), + modal: true, + buttons: [ + {text: _t("Ok"), click: function() { $(this).dialog("close"); }} + ] + });*/ + // notification + this.notification.warn(_t("Linkedin Search"), _t("Record Not Found.")); + this.$element.find('#loader').hide(); + if(this.view.fields['linkedin_id']){ + if(this.view.datarecord['linkedin_id']){ + this.$element.find('#linkedindefault').hide(); + this.$element.find('#linkedinrecord').show(); + }else{ + this.$element.find('#linkedinrecord').hide(); + this.$element.find('#linkedindefault').show(); + } + } + } else { + if (this.resultcontact || this.resultcompany) { + this.$element.find('#linkedin-field-name').append(QWeb.render( 'Linkedincontact', {'result' : this.resultcontact, 'resultcompany' : this.resultcompany})) ; + } + } + if(this.$element.find('#searchresults .search-box ul li')){ + this.$element.find('#loader').hide(); + if(this.view.fields['linkedin_id']){ + if(this.view.datarecord['linkedin_id']){ + this.$element.find('#linkedindefault').hide(); + this.$element.find('#linkedinrecord').show(); + }else{ + this.$element.find('#linkedinrecord').hide(); + this.$element.find('#linkedindefault').show(); + } + } + } + this.$element.find('#searchresults .search-box ul li').click( function() { + self.getdata( this ); + }); + $(document).click( function() { + self.removeTemplate( 1 ); + }); + }, + /* Selected record's data fetched */ + getdata: function( e ) { + var self = this; + if (this.resultcontact) { + for (i in this.resultcontact.people.values) { + if (self.resultcontact.people.values[i].id == $(e).attr('id')) { + self.removeTemplate( 1 ); + this.getTwitterAccount( self.resultcontact.people.values[i] ) + } + } + } + if(this.resultcompany){ + for ( i in this.resultcompany.companies.values ) { + if ( self.resultcompany.companies.values[i].id == $(e).attr('id') ) { + self.removeTemplate( 1 ); + self.map_values(self.resultcompany.companies.values[i]); + } + } + } + }, + /* Based on Linkedin Id of record fetch Twitter Account Detail for People */ + getTwitterAccount: function( values, flag, mainfield ){ + var self = this; + IN.API.Profile(values.id).fields('twitter-accounts') + .result(function(acname){ + values.twitterAccounts = acname.values[0].twitterAccounts + if(flag){ + self.map_values(values, flag, mainfield); + }else{ + self.map_values(values); + } + }); + }, + /* Mapping of Linkedin Fields with res.partner Fields + linkedinrecord : contains linkedin record's data + flag : indicates mapping of People search record or for company's contacts/connections (people) + if(flag) mapping for contacts of company + if(!flag) mapping for people search + mainfield : class of child_ids field + */ + map_values: function (linkedinrecord, flag, mainfield){ + var self = this, tempdata = {}, temp_data = 0, id = this.view.datarecord.id; + _(this.view.fields).each(function (field, f) { + if (f=='name') { + if (!flag) { + if (linkedinrecord.formattedName) { + field.set_value(linkedinrecord['formattedName'] || false); + } else if(linkedinrecord.name) { + field.set_value(linkedinrecord['name'] || false); + } + } else { + tempdata[f] = linkedinrecord.firstName+' '+linkedinrecord.lastName; + } + } + else if (f=='property_account_payable') { + if(flag == 1)tempdata[f] = field.get_value() + } + else if (f=='property_account_receivable') { + if(flag == 1)tempdata[f] = field.get_value() + } + else if (f=='type') { + (flag == 1) ? tempdata[f] = field.get_value() : field.get_value(); + } + else if (f=='linkedin_id') { + (flag == 1) ? tempdata[f] = linkedinrecord['id'] : field.set_value(linkedinrecord['id']); + } + else if (f=='profile_id') { + if (linkedinrecord.publicProfileUrl) { + (flag == 1) ? tempdata[f] = linkedinrecord.publicProfileUrl : field.set_value(linkedinrecord.publicProfileUrl); + } else { + field.set_value(false); + tempdata[f] = false; + } + } + else if (f=='twitter_id') { + if (linkedinrecord.twitterAccounts && linkedinrecord.twitterAccounts._total >= 1) { + (flag == 1) ? tempdata[f] = linkedinrecord.twitterAccounts.values[0].providerAccountName : field.set_value(linkedinrecord.twitterAccounts.values[0].providerAccountName); + }else if (linkedinrecord.twitterId) { + (flag == 1) ? tempdata[f] = linkedinrecord.twitterId : field.set_value(linkedinrecord.twitterId); + } else { + (flag == 1) ? tempdata[f] = false : field.set_value(false); + } + } + else if (f=='mobile') { + if (!flag && linkedinrecord.phoneNumbers && linkedinrecord['phoneNumbers']._total>=1 && linkedinrecord['phoneNumbers'].values[0].phoneType == "mobile") { + field.set_value( linkedinrecord['phoneNumbers'].values[0].phoneNumber || false ); + }else if (flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='phone') { + if (!flag && linkedinrecord.phoneNumbers && linkedinrecord['phoneNumbers']._total>=1 && linkedinrecord['phoneNumbers'].values[0].phoneType != "mobile") { + field.set_value(linkedinrecord['phoneNumbers'].values[0].phoneNumber || false); + } else if(flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='email') { + if (!flag && linkedinrecord.imAccounts && linkedinrecord['imAccounts']._total>=1) { + field.set_value(linkedinrecord['imAccounts'].values[0].imAccountName); + } else if(flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='photo') { + if (!flag) { + if (linkedinrecord.pictureUrl && linkedinrecord['pictureUrl']) { + /* Fetch binary data from URL for People */ + self.rpc('/web_linkedin/binary/url2binary',{'url':linkedinrecord['pictureUrl']},function(data){ + field.set_value(data); + }); + } else if (linkedinrecord.logoUrl && linkedinrecord['logoUrl']) { + /* Fetch binary data from URL for Company */ + self.rpc('/web_linkedin/binary/url2binary',{'url':linkedinrecord['logoUrl']},function(data){ + field.set_value(data); + }); + } else { + field.set_value(false); + } + } + else{ + if (linkedinrecord['pictureUrl']) { + temp_data = 1; + /* Fetch binary data from URL for contact of Company */ + self.rpc('/web_linkedin/binary/url2binary',{'url':linkedinrecord['pictureUrl']}).done(function(res){ + tempdata[f] = res; + self.set_o2mdata(tempdata,mainfield) + }); + } else { + tempdata[f] = "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/c+bMTVuKW24lzp49q5aXl3VZlotVVT2wtLR0JMuyAzMzM71ut2uMMe1+n5vI 0W6fBQCYWZoF2pL4qOq721dNtkVd135nZ2dnMBhcXFtb+1ev13tz//79V1944QXZC/htEdhrZgDo NE11p9Ohy5cvz3rv50UkNcbEzrmYmZM4jlOlVBbHceq9BzMXzDyqqmqkta5EpGTmOkmSkfd+49ix Yzubm5v87rvvhpdeekmee+652z4XTPxfifbHvPG2V7wGgBvf5F7PftL2bxhUblkxIzmaAAAAAElF TkSuQmCC"; + } + } + } + else if (f=='street') { + if (!flag && linkedinrecord.mainAddress && linkedinrecord['mainAddress']) { + field.set_value(linkedinrecord['mainAddress']); + } else if(flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='country_id') { + if (!flag && linkedinrecord.location && linkedinrecord['location']) { + field.field.domain = [['code', '=', linkedinrecord['location'].country['code'].toUpperCase()]]; + (new instance.web.DataSetSearch(self, field.field.relation,field.field.context,field.field.domain)).read_slice(['id','name'],{}).then(function(res){ + field.original_value = [res[0].id, res[0].name]; + field.set_value(res[0].id) + }) + } else if (!flag && linkedinrecord.locations && linkedinrecord.locations._total>0) { + if (linkedinrecord.locations.values[0].address['country-code']) { + field.field.domain = ['code', '=', linkedinrecord.locations.values[0].address['country-code'].toUpperCase()]; + (new instance.web.DataSetSearch(self, field.field.relation,field.field.context,field.field.domain)).read_slice(['id','name'],{}).then(function(res){ + field.original_value = [res[0].id, res[0].name]; + field.set_value(res[0].id) + }) + } else { + field.set_value(false); + } + } else if(flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='city') { + if (!flag && linkedinrecord.location && linkedinrecord['location']) { + field.set_value(linkedinrecord['location'].name.split(' ')[0] || false); + } else if (!flag && linkedinrecord.locations && linkedinrecord.locations._total>0) { + if (linkedinrecord.locations.values[0].address['city']) { + field.set_value(linkedinrecord.locations.values[0].address['city']); + } else { + field.set_value(false); + } + } else if (flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='website') { + if (!flag && linkedinrecord.websiteUrl) { + field.set_value(linkedinrecord['websiteUrl'] || false); + } else if (flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='customer') { + if(flag == 1)tempdata[f] = true; + } + else if (f=='supplier') { + } + else if (f=='active') { + (flag == 1) ? tempdata[f] = true : field.set_value(true); + } + else if (f=='is_company') { + if (!flag && linkedinrecord.formattedName) { + field.set_value(false); + } else { + field.set_value(true); + tempdata[f] = false; + } + } + else if (f=='zip') { + if (!flag && linkedinrecord.locations && linkedinrecord.locations._total>0) { + if (linkedinrecord.locations.values[0].address['postalCode']) { + field.set_value(linkedinrecord.locations.values[0].address['postalCode']); + } else { + field.set_value(false); + } + }else if (flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='parent_id') { + if (!flag && linkedinrecord.formattedName) { + field.set_value(false); + } else if (!flag && linkedinrecord.name) { + field.set_value(false); + } else { + if (linkedinrecord.formattedName) { + tempdata[f] = [id,self.view.fields['name'].get_value()]; + } + } + } + else if (f=='fax') { + if (!flag && linkedinrecord.locations && linkedinrecord.locations._total>0) { + if (linkedinrecord.locations.values[0].contactInfo['fax']) { + field.set_value(linkedinrecord.locations.values[0].contactInfo['fax']); + } else { + field.set_value(false); + } + } else if (flag == 1) { + tempdata[f] = field.get_value(); + } else { + field.set_value(false); + } + } + else if (f=='use_parent_address') { + (flag == 1) ? tempdata[f] = true : field.set_value(false); + } + else if (f=='child_ids') { + /* For Company Set value of child_ids field */ + if (!flag && linkedinrecord.name) { + self.$element.find('#loader').show(); + $('.linkedin_icon').css('display', 'none'); + /* Fetch contact of Company */ + IN.API.Raw("/people-search:(people:(id,first-name,last-name,formatted-name,picture-url,publicProfileUrl,phone-numbers,im-accounts,main-address,location,relation-to-viewer:(related-connections)))") + //"id", "firstName", "lastName", "pictureUrl", "publicProfileUrl", "formatted-name", "headline", "location", "industry", "languages", "phone-numbers", "im-accounts", "main-address" + .params({ + "company-name" : linkedinrecord.name, + "current-company": true, + "count" : 25 + }) + .result( function (getresult){ + if(getresult.people._total==0){ + self.$element.find('#loader').hide(); + if(self.view.fields['linkedin_id']){ + if(self.view.datarecord['linkedin_id']){ + self.$element.find('#linkedindefault').hide(); + self.$element.find('#linkedinrecord').show(); + }else{ + self.$element.find('#linkedinrecord').hide(); + self.$element.find('#linkedindefault').show(); + } + } + } + self.totalids = [],self.updteids = []; + _(field.dataset.ids).each( function(i) { + if (typeof(i)=="number") { + self.totalids.push(i); + var mobile = self.view.fields['mobile'].get_value(); + var phone = self.view.fields['phone'].get_value(); + var email = self.view.fields['email'].get_value(); + var fax = self.view.fields['fax'].get_value(); + var website = self.view.fields['website'].get_value(); + var zip = self.view.fields['zip'].get_value(); + var city = self.view.fields['city'].get_value(); + var country_id = self.view.fields['country_id'].get_value(); + var street = self.view.fields['street'].get_value(); + field.dataset.write(i,{'mobile':mobile,'phone':phone,'email':email,'fax':fax,'website':website,'zip':zip,'city':city,'country_id':country_id,'street':street},{}); + } + }); + field.dataset.ids = self.totalids; + var counter = 0;/* Indicates All searched records are Invalid or valid */ + self.t_count=0; + self.o2m_count = 0; + for (i in getresult.people.values) { + var connectTemp = self.validName(getresult.people.values[i].firstName, getresult.people.values[i].lastName) + if (connectTemp) { + counter++; + } else { + self.t_count++; + self.getTwitterAccount(getresult.people.values[i], 1, field); + } + } + if (getresult.people._count) { + var total_Count = getresult.people._count; + }else if (getresult.people._total) { + var total_Count = getresult.people._total; + } + /* If counter == total no. of people then all searched records are invalid */ + if (counter == total_Count) { + field.dataset.to_create = []; + field.dataset.ids = []; + field.reload_current_view(); + }else if(getresult.people._total == 0 || getresult.people._count == 0){ + field.dataset.ids = self.totalids; + field.reload_current_view(); + } + }); + } + /* For People Set value of child_ids field */ + else if (!flag && linkedinrecord.formattedName) { + field.set_value(false); + field.set({'invisible':true}); + } + /* For Contact of company Set value of child_ids field */ + else { + tempdata[f] = false; + } + } + else { + (flag == 1) ? tempdata[f] = false : field.set_value(false); + } + field._dirty_flag = true; + field.on('changed_value', self, function() { + if (!flag) { + self.view.do_onchange(field); + self.view.on_form_changed(true); + self.view.do_notify_change(); + } + }); + }); + if (!flag) { + this.removeTemplate(); + if (linkedinrecord.publicProfileUrl) { + this.setTemplate( linkedinrecord.publicProfileUrl , false ); + } + if (linkedinrecord.twitterId) { + this.setTemplate( false , linkedinrecord.twitterId ); + } + if (linkedinrecord.twitterAccounts && linkedinrecord.twitterAccounts._total >= 1) { + this.setTemplate( false , linkedinrecord.twitterAccounts.values[0].providerAccountName ); + } + } + if (flag && temp_data == 0) { + self.set_o2mdata(tempdata, mainfield); + } + }, + /* Update existing value of child_ids field */ + set_childids: function( ids ) { + var self = this; + _(ids).each(function(i){ + self.view.fields['child_ids'].dataset.set_ids(self.view.fields['child_ids'].dataset.ids.concat([i])); + self.view.fields['child_ids'].dataset.write(i, {"parent_id":false}, {}); + }); + }, + /* Set/create o2m contacts of child_ids field */ + set_o2mdata: function(data,field){ + var self = this; + self.o2m_count++; + field.dataset.create(data).then( function(r) { + self.totalids.push(r.result); + field.dataset.set_ids(field.dataset.ids.concat([r.result])); + field.dataset.on_change(); + }).then(); + field.dataset.ids = self.totalids; + field.reload_current_view(); + if (self.t_count == self.o2m_count) { + self.$element.find('#loader').hide(); + //$('.linkedin_icon').css('display', 'block'); + if(this.view.fields['linkedin_id']){ + if(this.view.datarecord['linkedin_id']){ + this.$element.find('#linkedindefault').hide(); + this.$element.find('#linkedinrecord').show(); + }else{ + this.$element.find('#linkedinrecord').hide(); + this.$element.find('#linkedindefault').show(); + } + } + } + }, + /* Name of Searched Linkedin Record is valid or Not */ + validName: function(fname, lname){ + if ((fname == "Private" || fname == "private") || (lname == "Private" || lname == "private") || (fname == "" && lname == "")) { + return true; + } else { + return false; + } + } + }); +}; +// vim:et fdc=0 fdl=0: diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml new file mode 100644 index 00000000000..9321e54787d --- /dev/null +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -0,0 +1,124 @@ + + + + + + + + + + +
+ + +
+ + + Search on LinkedIn + Search on LinkedIn + + + +
+
+
+ + + + + View profile on LinkedIn + + + + + + + + Follow + + + + +
Record Not Found.
+
+ +
+ +
+
+ + + + + + + +
+ + +
    +
  • + + + + + +
    + + + + + + + +
    + +
    +
  • +
+ + +
+
+
\ No newline at end of file -- cgit v1.2.3 From 7b2efd67fc5dd9a826e0343fc132024b30ee48bf Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Thu, 14 Jun 2012 12:46:33 +0530 Subject: [IMP] Improved pop up message when api key not apply. bzr revid: pan@tinyerp.com-20120614071633-vzrq3g0yha1p5skx --- addons/web_linkedin/static/src/img/apikey.png | Bin 0 -> 32154 bytes .../static/src/img/help_to_fill_form.png | Bin 0 -> 146822 bytes addons/web_linkedin/static/src/js/linkedin.js | 19 +++++----- addons/web_linkedin/static/src/xml/linkedin.xml | 39 +++++++++++++++++++++ 4 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 addons/web_linkedin/static/src/img/apikey.png create mode 100644 addons/web_linkedin/static/src/img/help_to_fill_form.png (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/img/apikey.png b/addons/web_linkedin/static/src/img/apikey.png new file mode 100644 index 00000000000..cd17d071af2 Binary files /dev/null and b/addons/web_linkedin/static/src/img/apikey.png differ diff --git a/addons/web_linkedin/static/src/img/help_to_fill_form.png b/addons/web_linkedin/static/src/img/help_to_fill_form.png new file mode 100644 index 00000000000..fe30fe4acbe Binary files /dev/null and b/addons/web_linkedin/static/src/img/help_to_fill_form.png differ diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index e48b7fa7a9a..6c8fc6c5147 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -107,17 +107,16 @@ 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"), - modal: true, - height: 200, - width: 500, - buttons: [ - { - text: _t("Ok"), + e.message=""; + instance.web.dialog($(QWeb.render("Register.Linkedin", _t(e))), { + title: _t("Configure your Linkedin Key API"), + modal: true, + width : 825, + buttons:[{ + text: _t("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 9321e54787d..4244fc38b98 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -31,6 +31,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
1)Go Tohttps://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 +
+ +
+ 5) Copy the API Key +
+ +
+
-- cgit v1.2.3 From 277e800c162811cdc12c545e41919d59e6200056 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Thu, 14 Jun 2012 16:49:10 +0530 Subject: [IMP] Improved code. bzr revid: pan@tinyerp.com-20120614111910-jyqwdkf8ec35km2i --- addons/web_linkedin/static/src/js/linkedin.js | 31 ++++++++++++++----------- addons/web_linkedin/static/src/xml/linkedin.xml | 17 ++++++++------ 2 files changed, 28 insertions(+), 20 deletions(-) (limited to 'addons/web_linkedin/static/src') 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
- +
+
-- cgit v1.2.3 From 79a911301cea4ca1b9b21bd054c28479bda710af Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Thu, 14 Jun 2012 19:01:04 +0530 Subject: [IMP] Improved code. bzr revid: pan@tinyerp.com-20120614133104-102rzo97d0dq5jhq --- addons/web_linkedin/static/src/js/linkedin.js | 8 +++++++ addons/web_linkedin/static/src/xml/linkedin.xml | 28 ++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) (limited to 'addons/web_linkedin/static/src') 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
  • -- cgit v1.2.3 From 22a9fc74bfb438b4810805bd9b6c8372ad58a950 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Mon, 18 Jun 2012 15:43:56 +0530 Subject: [REV] Remove last changes of commit revision 6895. bzr revid: jra@tinyerp.com-20120618101356-z0epjp7s1sqduwag --- addons/web_linkedin/static/src/img/apikey.png | Bin 32154 -> 0 bytes .../static/src/img/help_to_fill_form.png | Bin 146822 -> 0 bytes addons/web_linkedin/static/src/js/linkedin.js | 19 +++++----- addons/web_linkedin/static/src/xml/linkedin.xml | 39 --------------------- 4 files changed, 10 insertions(+), 48 deletions(-) delete mode 100644 addons/web_linkedin/static/src/img/apikey.png delete mode 100644 addons/web_linkedin/static/src/img/help_to_fill_form.png (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/img/apikey.png b/addons/web_linkedin/static/src/img/apikey.png deleted file mode 100644 index cd17d071af2..00000000000 Binary files a/addons/web_linkedin/static/src/img/apikey.png and /dev/null differ diff --git a/addons/web_linkedin/static/src/img/help_to_fill_form.png b/addons/web_linkedin/static/src/img/help_to_fill_form.png deleted file mode 100644 index fe30fe4acbe..00000000000 Binary files a/addons/web_linkedin/static/src/img/help_to_fill_form.png and /dev/null differ diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index 6c8fc6c5147..e48b7fa7a9a 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -107,16 +107,17 @@ openerp.web_linkedin = function(instance) { } }, APIKeyWarning: function(e) { - e.message=""; - instance.web.dialog($(QWeb.render("Register.Linkedin", _t(e))), { - title: _t("Configure your Linkedin Key API"), - modal: true, - width : 825, - buttons:[{ - text: _t("Close"), + 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: [ + { + text: _t("Ok"), 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..9321e54787d 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -31,45 +31,6 @@
    - - - - - - - - - - - - - - - - - - - - - - - - -
    1)Go Tohttps://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 -
    - -
    - 5) Copy the API Key -
    - -
    -
    -- cgit v1.2.3 From cc659ea35537c1289d7b1f1adb61d7197a2739b9 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Tue, 19 Jun 2012 15:46:30 +0530 Subject: [IMP] Improved code. bzr revid: pan@tinyerp.com-20120619101630-w1sufff8c38egvjl --- addons/web_linkedin/static/src/js/linkedin.js | 17 +++++++++++++---- addons/web_linkedin/static/src/xml/linkedin.xml | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'addons/web_linkedin/static/src') 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 + -- cgit v1.2.3 From 48fe78fc281e572d5f1769524b0ecf758dfc9ae5 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Tue, 19 Jun 2012 17:15:14 +0530 Subject: [IMP] Improved api key pop up warning. bzr revid: jra@tinyerp.com-20120619114514-2r72ppz7pwwym70h --- addons/web_linkedin/static/src/img/apikey.png | Bin 0 -> 32154 bytes .../static/src/img/help_to_fill_form.png | Bin 0 -> 63353 bytes addons/web_linkedin/static/src/js/linkedin.js | 5 +-- addons/web_linkedin/static/src/xml/linkedin.xml | 46 +++++++++------------ 4 files changed, 21 insertions(+), 30 deletions(-) create mode 100644 addons/web_linkedin/static/src/img/apikey.png create mode 100644 addons/web_linkedin/static/src/img/help_to_fill_form.png (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/img/apikey.png b/addons/web_linkedin/static/src/img/apikey.png new file mode 100644 index 00000000000..cd17d071af2 Binary files /dev/null and b/addons/web_linkedin/static/src/img/apikey.png differ diff --git a/addons/web_linkedin/static/src/img/help_to_fill_form.png b/addons/web_linkedin/static/src/img/help_to_fill_form.png new file mode 100644 index 00000000000..4962d272c3a Binary files /dev/null and b/addons/web_linkedin/static/src/img/help_to_fill_form.png differ diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index ede7cfa444b..697c3a79d29 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -128,9 +128,8 @@ openerp.web_linkedin = function(instance) { }] }); $("#register").click(function() { - var linkkey = $("#apikey").val(); - var key = JSON.stringify(linkkey); - self.rpc('/web_linkedin/database/api_key',{'key': key},function(data){ + var key = JSON.stringify($("#apikey").val()); + self.rpc('/web_linkedin/webclient/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 73c49f52279..b6aa3dc69d3 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -34,35 +34,27 @@
    - - - - - - - - - - - - - - -
    -
      -
    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. -
    -
    +
    +

    Go to... + + https://www.linkedin.com/secure/developer + +

    +

    Log you in Linkedin if you did not yet

    +

    Add a new Application

    +

    Fill in the form

    +
    +
    -
    - Copy the API Key - -
    + +
    +

    Copy the API Key: + +

    +
    +
    -
    +
    -- cgit v1.2.3 From f257cb34524e0f230e41b7229bbcd71ad50974d5 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Tue, 19 Jun 2012 18:45:18 +0530 Subject: [IMP] Improved code for api key warning pop up. bzr revid: jra@tinyerp.com-20120619131518-k4bx0yavmsshihre --- addons/web_linkedin/static/src/js/linkedin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index 697c3a79d29..f67619951bd 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -128,9 +128,9 @@ openerp.web_linkedin = function(instance) { }] }); $("#register").click(function() { - var key = JSON.stringify($("#apikey").val()); - self.rpc('/web_linkedin/webclient/api_key',{'key': key},function(data){ - }); + var key = $("#apikey").val(); + var user = new instance.web.DataSet(self, "res.users"); + user.call("set_linkedin_api_key", [key]); }); }, setTemplate: function( URL, AccountName ) { -- cgit v1.2.3 From 7fac66d682582346251638aa5cda290395595391 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Thu, 21 Jun 2012 17:17:04 +0530 Subject: [IMP] Minor changes for IN.User.authorization. bzr revid: jra@tinyerp.com-20120621114704-bwgcwcijsx7qel60 --- addons/web_linkedin/static/src/js/linkedin.js | 92 +++++++++++++-------------- 1 file changed, 43 insertions(+), 49 deletions(-) (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index f67619951bd..fdfe0e47dd1 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -106,54 +106,6 @@ 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"), -// 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, - width : 840, - height:500, - buttons:[ - { - text: _t("Ok"), - click: function() { $(this).dialog("close"); } - }] - }); - $("#register").click(function() { - var key = $("#apikey").val(); - var user = new instance.web.DataSet(self, "res.users"); - user.call("set_linkedin_api_key", [key]); - }); - }, - setTemplate: function( URL, AccountName ) { - if(AccountName){ - var AccountName = AccountName.replace(/[^a-zA-Z 0-9]+/g, ''); - Twitt = "https://twitter.com/intent/follow?original_referer=http%3A%2F%2Flocalhost%3A8069%2Fweb%2Fwebclient%2Fhome&screen_name="+AccountName+"&source=followbutton&variant=2.0" - this.$element.find('tr#profiletwittor-tr').append(QWeb.render('TwitterURL',{'URLID': Twitt, 'account': AccountName})) - }else if(URL){ - this.$element.find('tr#profiletwittor-tr').append(QWeb.render('ProfileURL',{'URLID': URL })) - } - }, - removeTemplate: function( flag ) { - if (flag) { - this.$element.find('#searchresults').remove(); - } else { - if (this.$element.find('#profileid')) { - this.$element.find('#profileid').remove(); - } - if (this.$element.find('#twitterid')) { - this.$element.find('#twitterid').remove(); - } - } - }, /* Load Linkedin Data On search */ do_load_linkedin: function( e ) { var self = this; @@ -189,7 +141,8 @@ openerp.web_linkedin = function(instance) { } } else { - self.do_authorize(); + //self.do_authorize(); + IN.User.authorize(); } e.preventDefault(); e.stopPropagation(); @@ -204,6 +157,47 @@ openerp.web_linkedin = function(instance) { check_authorized: function(){ this.isAuthorized = IN.User.isAuthorized(); }, + 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 : 840, + height:500, + buttons:[ + { + text: _t("Ok"), + click: function() { $(this).dialog("close"); } + }] + }); + $("#register").click(function() { + var key = $("#apikey").val(); + var user = new instance.web.DataSet(self, "res.users"); + user.call("set_linkedin_api_key", [key]); + }); + }, + setTemplate: function( URL, AccountName ) { + if(AccountName){ + var AccountName = AccountName.replace(/[^a-zA-Z 0-9]+/g, ''); + Twitt = "https://twitter.com/intent/follow?original_referer=http%3A%2F%2Flocalhost%3A8069%2Fweb%2Fwebclient%2Fhome&screen_name="+AccountName+"&source=followbutton&variant=2.0" + this.$element.find('tr#profiletwittor-tr').append(QWeb.render('TwitterURL',{'URLID': Twitt, 'account': AccountName})) + }else if(URL){ + this.$element.find('tr#profiletwittor-tr').append(QWeb.render('ProfileURL',{'URLID': URL })) + } + }, + removeTemplate: function( flag ) { + if (flag) { + this.$element.find('#searchresults').remove(); + } else { + if (this.$element.find('#profileid')) { + this.$element.find('#profileid').remove(); + } + if (this.$element.find('#twitterid')) { + this.$element.find('#twitterid').remove(); + } + } + }, /* Fetch Result from Linkedin and set in searchbox */ do_fetch_detail: function(result, metadata) { var self = this; -- cgit v1.2.3 From dd0a2cc66fb6cbc42279970b8226e7396e1170ad Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Thu, 21 Jun 2012 18:58:42 +0530 Subject: [IMP] Minor change. bzr revid: jra@tinyerp.com-20120621132842-s1f5melcrsi408jl --- addons/web_linkedin/static/src/js/linkedin.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index fdfe0e47dd1..d6c50ca8b99 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -159,8 +159,7 @@ openerp.web_linkedin = function(instance) { }, APIKeyWarning: function(e) { var self = this; - e.message=""; - instance.web.dialog($(QWeb.render("Register.Linkedin", _t(e))), { + instance.web.dialog($(QWeb.render("Register.Linkedin")), { title: _t("Configure your Linkedin Key API"), modal: true, width : 840, -- cgit v1.2.3 From b0826bf5556b008046eb77880c82dc6e427c1ddf Mon Sep 17 00:00:00 2001 From: Vishmita Date: Thu, 21 Jun 2012 19:14:58 +0530 Subject: [IMP] Improved API key warning. bzr revid: vja@tinyerp.com-20120621134458-2vq2xsalq5hn7w8q --- addons/web_linkedin/static/src/css/linkedin.css | 4 +++- addons/web_linkedin/static/src/js/linkedin.js | 18 +++++++++++++++--- addons/web_linkedin/static/src/xml/linkedin.xml | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/css/linkedin.css b/addons/web_linkedin/static/src/css/linkedin.css index 0ca3dc90ac9..4f61b4e89d0 100644 --- a/addons/web_linkedin/static/src/css/linkedin.css +++ b/addons/web_linkedin/static/src/css/linkedin.css @@ -6,7 +6,9 @@ background-color: rgb(255, 255, 255); border: 1px solid rgb(153, 153, 153); } - +#apikey{ + background-color: #D2D2FF +} .li-ldn-dropdown { margin: 0px; display: block; diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index d6c50ca8b99..d282226def0 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -159,7 +159,7 @@ openerp.web_linkedin = function(instance) { }, APIKeyWarning: function(e) { var self = this; - instance.web.dialog($(QWeb.render("Register.Linkedin")), { + this.dialog = instance.web.dialog($(QWeb.render("Register.Linkedin")), { title: _t("Configure your Linkedin Key API"), modal: true, width : 840, @@ -168,13 +168,25 @@ openerp.web_linkedin = function(instance) { { text: _t("Ok"), click: function() { $(this).dialog("close"); } - }] + }], }); + this.dialog.parent().find('.ui-dialog-titlebar').append('').click(function(){ + self.dialog.remove(); + }) + $('.close').css({ 'margin': '10px 0 0 19px'}) $("#register").click(function() { var key = $("#apikey").val(); var user = new instance.web.DataSet(self, "res.users"); user.call("set_linkedin_api_key", [key]); - }); + if(key.length){ + self.dialog.remove(), + user.__parentedParent.view.reload(); + } + else { + $("#apikey").css({'background-color':'#F66 '}) + } + + }) }, 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 b6aa3dc69d3..f0ee60e331f 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -49,7 +49,7 @@

    Copy the API Key: - +

    -- cgit v1.2.3 From 2251aa0b7882ae7368e6667914e9a7d468e3bfee Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Fri, 22 Jun 2012 12:16:01 +0530 Subject: [IMP] Improved apikey wizard. bzr revid: jra@tinyerp.com-20120622064601-oatb5npqwhh7r9j5 --- addons/web_linkedin/static/src/js/linkedin.js | 7 ++++--- addons/web_linkedin/static/src/xml/linkedin.xml | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/js/linkedin.js b/addons/web_linkedin/static/src/js/linkedin.js index d282226def0..a3d36ae284b 100644 --- a/addons/web_linkedin/static/src/js/linkedin.js +++ b/addons/web_linkedin/static/src/js/linkedin.js @@ -168,7 +168,7 @@ openerp.web_linkedin = function(instance) { { text: _t("Ok"), click: function() { $(this).dialog("close"); } - }], + }] }); this.dialog.parent().find('.ui-dialog-titlebar').append('').click(function(){ self.dialog.remove(); @@ -176,14 +176,15 @@ openerp.web_linkedin = function(instance) { $('.close').css({ 'margin': '10px 0 0 19px'}) $("#register").click(function() { var key = $("#apikey").val(); - var user = new instance.web.DataSet(self, "res.users"); - user.call("set_linkedin_api_key", [key]); if(key.length){ + var user = new instance.web.DataSet(self, "res.users"); + user.call("set_linkedin_api_key", [key]); self.dialog.remove(), user.__parentedParent.view.reload(); } else { $("#apikey").css({'background-color':'#F66 '}) + self.notification.warn(_t("Linkedin Search"), _t("Please Enter Required Key.")); } }) diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml index f0ee60e331f..6ced2c7dff5 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -12,8 +12,8 @@
    - Search on LinkedIn - Search on LinkedIn + Search on LinkedIn + Search on LinkedIn -- cgit v1.2.3 From e1ddabaff0fefb622511c8513f1b25416b031d74 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Fri, 22 Jun 2012 17:07:36 +0530 Subject: [IMP] Improved code. bzr revid: jra@tinyerp.com-20120622113736-ic23elcxqtf4md96 --- addons/web_linkedin/static/src/css/linkedin.css | 19 ++++++++++++++++--- addons/web_linkedin/static/src/img/apikey.png | Bin 32154 -> 26023 bytes addons/web_linkedin/static/src/xml/linkedin.xml | 22 +++++++++++----------- 3 files changed, 27 insertions(+), 14 deletions(-) (limited to 'addons/web_linkedin/static/src') diff --git a/addons/web_linkedin/static/src/css/linkedin.css b/addons/web_linkedin/static/src/css/linkedin.css index 4f61b4e89d0..949726a6246 100644 --- a/addons/web_linkedin/static/src/css/linkedin.css +++ b/addons/web_linkedin/static/src/css/linkedin.css @@ -6,9 +6,6 @@ background-color: rgb(255, 255, 255); border: 1px solid rgb(153, 153, 153); } -#apikey{ - background-color: #D2D2FF -} .li-ldn-dropdown { margin: 0px; display: block; @@ -39,3 +36,19 @@ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; max-height: 450px; } +#apikey{ + background-color: #D2D2FF; +} +#register{ + margin-left: 10px; +} + +.lbl-ldnbox{ + font-size:12px; +} +#searchresults{ + -webkit-margin-start: -70px; + -moz-margin-start: -70px; + z-index: 2000; + position: absolute; +} \ No newline at end of file diff --git a/addons/web_linkedin/static/src/img/apikey.png b/addons/web_linkedin/static/src/img/apikey.png index cd17d071af2..423b732b502 100644 Binary files a/addons/web_linkedin/static/src/img/apikey.png and b/addons/web_linkedin/static/src/img/apikey.png differ diff --git a/addons/web_linkedin/static/src/xml/linkedin.xml b/addons/web_linkedin/static/src/xml/linkedin.xml index 6ced2c7dff5..28c77ec82bc 100644 --- a/addons/web_linkedin/static/src/xml/linkedin.xml +++ b/addons/web_linkedin/static/src/xml/linkedin.xml @@ -35,25 +35,25 @@
    -

    Go to... +

    1) Go to : https://www.linkedin.com/secure/developer

    -

    Log you in Linkedin if you did not yet

    -

    Add a new Application

    -

    Fill in the form

    +

    2) Log you in Linkedin if you did not yet

    +

    3) Add a New Application

    +

    4) Fill in the Form

    - +
    -

    Copy the API Key: - +

    5) Copy the API Key: +

    - +
    @@ -69,14 +69,14 @@
    Record Not Found.
    -
    +