19 package org.turro.contacts.profile;
21 import org.turro.action.Actions;
22 import org.turro.collections.KeyValueMap;
23 import org.turro.config.Configurator;
24 import org.turro.contacts.db.ContactsPU;
25 import org.turro.contacts.relation.Relations;
26 import org.turro.i18n.I_;
27 import org.turro.plugin.contacts.IContactRelation;
28 import org.turro.plugin.contacts.IProfile;
39 this.profile = profile;
44 double should = 0, have = 0;
45 Configurator settings = Configurator.instance();
46 if(settings.asBoolean(
"Profile.Suggest.Image")) {
47 should++; have += !image ? 1 : 0;
49 if(settings.asBoolean(
"Profile.Suggest.Skills")) {
50 should++; have += !skills ? 1 : 0;
52 if(settings.asBoolean(
"Profile.Suggest.Relation")) {
53 should++; have += !relation ? 1 : 0;
55 if(settings.asBoolean(
"Profile.Suggest.Company")) {
56 should++; have += !company ? 1 : 0;
58 if(settings.asBoolean(
"Profile.Suggest.Professional.Documents") && profile.
isWorker()) {
59 should++; have += !documents ? 1 : 0;
60 }
else if(settings.asBoolean(
"Profile.Suggest.Student.Documents") && profile.
isStudent()) {
61 should++; have += !documents ? 1 : 0;
63 return should == 0 ? 100.0 : (have / should) * 100.0;
98 private boolean image, skills, relation, documents, company;
99 private String companyType;
101 private void readSettings() {
102 Configurator settings = Configurator.instance();
103 image = settings.asBoolean(
"Profile.Suggest.Image") && !profile.
getHasImage();
104 skills = settings.asBoolean(
"Profile.Suggest.Skills") && !profile.
getHasSkills();
105 relation = settings.asBoolean(
"Profile.Suggest.Relation") &&
111 company = settings.asBoolean(
"Profile.Suggest.Company") &&
113 companyType =
I_.
get(
"Company");
114 documents = settings.asBoolean(
"Profile.Suggest.Professional.Documents") &&
117 IContactRelation crelation = Relations.companies(profile.
getContact()).getCompanyRelation();
118 IProfile cprofile = crelation.getRelatedIContact().getProfile();
119 company = settings.asBoolean(
"Profile.Suggest.Company") &&
120 (!cprofile.getHasAbout() || !cprofile.getHasImage());
121 companyType =
I_.
get(
"Learning center");;
123 documents = settings.asBoolean(
"Profile.Suggest.Student.Documents") &&
129 KeyValueMap kvm =
new KeyValueMap();
135 KeyValueMap kvm =
new KeyValueMap();
141 KeyValueMap kvm =
new KeyValueMap();
143 return "/user/profile/pubs";
static String createRightNowAction(String values)
static String get(String msg)