26 |
26 |
})
|
27 |
27 |
|
28 |
28 |
export class CommunityComponent {
|
|
29 |
public sub: any;
|
29 |
30 |
public piwiksub: any;
|
30 |
31 |
public subfunders: any;
|
31 |
32 |
|
... | ... | |
52 |
53 |
|
53 |
54 |
public communityInfo = null;
|
54 |
55 |
|
|
56 |
// TODO Unsubscribe
|
|
57 |
public subPublications;
|
|
58 |
public subResearchData;
|
|
59 |
public subSoftware;
|
|
60 |
public subOrps;
|
|
61 |
|
55 |
62 |
constructor (
|
56 |
63 |
private route: ActivatedRoute,
|
57 |
64 |
private _router: Router,
|
... | ... | |
114 |
121 |
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'publications/count?format=json&fq=communityid='+this.communityId).subscribe(
|
115 |
122 |
publicationTotal => {
|
116 |
123 |
this.publicationTotal = publicationTotal;
|
117 |
|
if (this.publicationTotal > 0) {
|
118 |
|
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'publications?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
119 |
|
publicationResults => {
|
120 |
|
this.publicationResults = publicationResults;
|
121 |
|
//console.log(publicationResults);
|
122 |
|
});
|
123 |
|
}
|
|
124 |
this.searchPublications();
|
124 |
125 |
});
|
125 |
126 |
|
126 |
127 |
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'datasets/count?format=json&fq=communityid='+this.communityId).subscribe(
|
127 |
128 |
researchDataTotal => {
|
128 |
129 |
this.researchDataTotal = researchDataTotal;
|
129 |
|
if (this.researchDataTotal > 0) {
|
130 |
|
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'datasets?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
131 |
|
researchDataResults => {
|
132 |
|
this.researchDataResults = researchDataResults;
|
133 |
|
});
|
134 |
|
}
|
135 |
130 |
});
|
136 |
131 |
|
137 |
132 |
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'software/count?format=json&fq=communityid='+this.communityId).subscribe(
|
138 |
133 |
softwareTotal => {
|
139 |
134 |
this.softwareTotal = softwareTotal;
|
140 |
|
if (this.softwareTotal > 0) {
|
141 |
|
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'software?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
142 |
|
softwareResults => {
|
143 |
|
this.softwareResults = softwareResults;
|
144 |
|
});
|
145 |
|
}
|
146 |
135 |
});
|
147 |
136 |
|
148 |
137 |
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'other/count?format=json&fq=communityid='+this.communityId).subscribe(
|
149 |
138 |
orpTotal => {
|
150 |
139 |
this.orpTotal = orpTotal;
|
151 |
|
if (this.orpTotal > 0) {
|
152 |
|
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'other?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
153 |
|
orpResults => {
|
154 |
|
this.orpResults = orpResults;
|
155 |
|
});
|
156 |
|
}
|
157 |
140 |
});
|
158 |
141 |
|
159 |
142 |
this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/projects').subscribe(
|
... | ... | |
186 |
169 |
});
|
187 |
170 |
}
|
188 |
171 |
|
|
172 |
public searchPublications() {
|
|
173 |
if (this.publicationTotal > 0 && this.publicationResults == null) {
|
|
174 |
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'publications?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
|
175 |
publicationResults => {
|
|
176 |
this.publicationResults = publicationResults;
|
|
177 |
//console.log(publicationResults);
|
|
178 |
});
|
|
179 |
}
|
|
180 |
}
|
|
181 |
|
|
182 |
public searchResearchData() {
|
|
183 |
if (this.researchDataTotal > 0 && this.researchDataResults == null) {
|
|
184 |
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'datasets?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
|
185 |
researchDataResults => {
|
|
186 |
this.researchDataResults = researchDataResults;
|
|
187 |
});
|
|
188 |
}
|
|
189 |
}
|
|
190 |
|
|
191 |
public searchSoftware() {
|
|
192 |
if (this.softwareTotal > 0 && this.softwareResults == null) {
|
|
193 |
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'software?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
|
194 |
softwareResults => {
|
|
195 |
this.softwareResults = softwareResults;
|
|
196 |
});
|
|
197 |
}
|
|
198 |
}
|
|
199 |
|
|
200 |
public searchOrps() {
|
|
201 |
if (this.orpTotal > 0 && this.orpResults == null) {
|
|
202 |
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'other?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
|
203 |
orpResults => {
|
|
204 |
this.orpResults = orpResults;
|
|
205 |
});
|
|
206 |
}
|
|
207 |
}
|
|
208 |
|
189 |
209 |
public ngOnDestroy() {
|
190 |
210 |
if(this.piwiksub){
|
191 |
211 |
this.piwiksub.unsubscribe();
|
Reload tabs on click at community page