Project

General

Profile

« Previous | Next » 

Revision 58115

[Library|Trunk]

New Search:
add search All component
update Search pages to work from search all component

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/services/searchResearchResults.service.ts
378 378
        let url = properties.searchAPIURLLAst+parameters+"?format=json";
379 379
        return this.numOfResults(url , properties);
380 380
    }
381
  numOfResearchOutcomes( params: string, properties:EnvProperties, refineParams:string=null):any {
382
    let url = properties.searchAPIURLLAst+"resources2/?format=json&size=0&type=publications&type=datasets&type=software&type=other";
383
    if(params.length > 0){
384
      var DOIs:string[] = DOI.getDOIsFromString(params);
385
      var doisParams = "";
381 386

  
387
      for(var i =0 ;i < DOIs.length; i++){
388
        doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
389
      }
390
      if(doisParams.length > 0){
391
        url += "&"+doisParams;
392
      }else{
393
        url += "&q=" + StringUtils.URIEncode(params);
394
      }
395
    }
396

  
397
    if(refineParams!= null && refineParams != ''  ) {
398
      url += refineParams;
399
    }
400
    return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
401
      .pipe(map(res => res['meta']['total']));
402
  }
382 403
    numOfSearchResults(resultType:string, params: string, properties:EnvProperties, refineParams:string=null):any {
383 404
        let url = properties.searchAPIURLLAst+this.getEntityName(resultType, true)+"/count?format=json";
384 405
        if(params.length > 0){
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/find/searchAll.component.html
1
<div class="image-front-topbar  uk-section-default uk-position-relative"
2
     uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}"
3
     tm-header-transparent="light">
4
  <div uk-height-viewport="offset-top: true;offset-bottom: 60" style="box-sizing: border-box;  "
5
       class=" uk-background-norepeat uk-background-cover uk-background-bottom-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed generalSearchForm">
6
    <div class="uk-position-cover" style="background-color: rgba(255, 255, 255, 0.37);"></div>
7
    <div class="uk-container">
8
      <div class="uk-position-relative">
9

  
10

  
11
        <div class="uk-container">
12
          <div class="uk-width-1-1">
13

  
14
            <advanced-search-form
15
              entityType="all"
16

  
17
              (queryChange)="keywordChanged($event)"
18
              [isDisabled]="disableForms"
19
              [simpleView]="true" [formPlaceholderText]="formPlaceholderText"
20

  
21
              [selectedFields]="selectedFields"
22
              [fieldIdsMap]="fieldIdsMap" [fieldIds]="fieldIds"
23
            >
24
            </advanced-search-form>
25
          </div>
26

  
27

  
28
        </div>
29
      </div>
30
    </div>
31
  </div>
32
</div>
33
<schema2jsonld *ngIf="name && logoURL" [URL]="properties.baseLink+'/search/find'"
34
               [logoURL]="properties.baseLink+logoURL" type="search" [name]=name></schema2jsonld>
35
<div class="uk-container-large uk-container">
36

  
37
  <ul class=" uk-tab  uk-width-1-1 " uk-tab="animation: uk-animation-fade">
38
    <li *ngIf="showPublications || showDatasets || showOrps || showSoftware" (click)="entityChanged('result')"
39
        [class]="activeEntity == 'result'?'uk-active':''">
40
      <a>
41
        Research outcomes
42
        <span *ngIf="fetchPublications.searchUtils.status !=
43
            errorCodes.LOADING && fetchPublications.searchUtils.totalResults!=null">
44
          ({{fetchPublications.searchUtils.totalResults | number}})</span>
45
      </a>
46
    </li>
47
    <li *ngIf="showProjects" (click)="entityChanged('projects')" [class]="activeEntity == 'projects'?'uk-active':''">
48
      <a>
49
        Projects
50
        <span *ngIf="fetchProjects.searchUtils.status !=
51
            errorCodes.LOADING && fetchProjects.searchUtils.totalResults!=null">
52
          ({{fetchProjects.searchUtils.totalResults | number}})</span>
53
      </a>
54
    </li>
55
    <li *ngIf="showDataProviders" (click)="entityChanged('datasources')"
56
        [class]="activeEntity == 'datasources'?'uk-active':''">
57
      <a>
58
        Content Providers
59
        <span *ngIf="fetchDataproviders.searchUtils.status !=
60
            errorCodes.LOADING && fetchDataproviders.searchUtils.totalResults!=null">
61
          ({{fetchDataproviders.searchUtils.totalResults | number}})</span>
62
      </a>
63
    </li>
64
    <li *ngIf="showOrganizations" (click)="entityChanged('organizations')"
65
        [class]="activeEntity == 'organizations'?'uk-active':''">
66
      <a>
67
        Organizations
68
        <span *ngIf="fetchOrganizations.searchUtils.status !=
69
            errorCodes.LOADING && fetchOrganizations.searchUtils.totalResults!=null">
70
          ({{fetchOrganizations.searchUtils.totalResults | number}})</span>
71
      </a>
72
    </li>
73
  </ul>
74
  <quick-selections *ngIf="activeEntity == 'result' && quickFilter" [resultTypes]="resultTypes"
75
                    (typeChange)="quickSelectionsChanged()"  [isDisabled]="disableForms"
76
                    [quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
77
                    [properties]="properties">
78
  </quick-selections>
79

  
80
</div>
81

  
82
<search-research-results *ngIf="activeEntity == 'result'" resultType="result" [includeOnlyResultsAndFilter]="true"
83
                         (searchPageUpdates)="activeEntityUpdate($event)"
84
                         simpleSearchLink="/search/find"></search-research-results>
85

  
86
<search-projects *ngIf="activeEntity == 'projects'" [includeOnlyResultsAndFilter]="true"
87
                 (searchPageUpdates)="activeEntityUpdate($event)"
88
                 simpleSearchLink="/search/find">
89
</search-projects>
90

  
91
<search-organizations *ngIf="activeEntity == 'organizations'" [includeOnlyResultsAndFilter]="true"
92
                      (searchPageUpdates)="activeEntityUpdate($event)"
93
                      simpleSearchLink="/search/find">
94
</search-organizations>
95

  
96
<search-dataproviders *ngIf="activeEntity == 'datasources'" [includeOnlyResultsAndFilter]="true"
97
                      (searchPageUpdates)="activeEntityUpdate($event)"
98
                      simpleSearchLink="/search/find">
99
</search-dataproviders>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/find/searchAll.component.ts
1
import {ChangeDetectorRef, Component, Input} from '@angular/core';
2
import {ChangeDetectionStrategy} from '@angular/core';
3
import {ViewEncapsulation} from '@angular/core';
4
import {ActivatedRoute, Router} from '@angular/router';
5
import {Location} from '@angular/common';
6
import {Title, Meta} from '@angular/platform-browser';
7

  
8
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
9
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
10
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
11
import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class';
12

  
13
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
14
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
15
import {SearchProjectsService} from '../../services/searchProjects.service';
16
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
17

  
18
import {SearchFields} from '../../utils/properties/searchFields';
19
import {ErrorCodes} from '../../utils/properties/errorCodes';
20
import {RouterHelper} from '../../utils/routerHelper.class';
21
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
22
import {PiwikService} from '../../utils/piwik/piwik.service';
23
import {ConfigurationService} from '../../utils/configuration/configuration.service';
24
import {EnvProperties} from '../../utils/properties/env-properties';
25
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
26
import {StringUtils} from '../../utils/string-utils.class';
27
import {SearchCustomFilter} from "../searchUtils/searchUtils.class";
28
import {Observable} from "rxjs";
29
import {AdvancedField, Filter} from "../searchUtils/searchHelperClasses.class";
30

  
31
@Component({
32
  changeDetection: ChangeDetectionStrategy.Default,
33
  encapsulation: ViewEncapsulation.Emulated,
34
  selector: 'search-all',
35
  templateUrl: 'searchAll.component.html'
36
})
37
export class SearchAllComponent {
38
  public sub: any;
39
  piwiksub: any;
40
  // public reloadResults: boolean;
41
  // public reloadPublications: boolean;
42
  // public reloadDatasets: boolean;
43
  // public reloadSoftware: boolean;
44
  // public reloadOrps: boolean;
45
  // public reloadProjects: boolean;
46
  // public reloadDataproviders: boolean;
47
  // public reloadOrganizations: boolean;
48
  reload:{result:boolean, projects:boolean, datasources: boolean, organizations:boolean} = {result:true, projects:true, datasources: true, organizations:true};
49

  
50
  public pageTitle = "Search in OpenAIRE"
51
  public keyword: string = "";
52
  public publications: string[];
53
  public datasets: string[];
54
  public software: string[];
55
  public orps: string[];
56
  public projectsTab: string[];
57
  public dataproviders: string[];
58
  public organizations: string[];
59

  
60
  public activeEntity = null;
61
  public linkToSearchPublications = "";
62
  public linkToSearchProjects = "";
63
  public linkToSearchDataproviders = "";
64
  public linkToSearchDatasets = "";
65
  public linkToSearchSoftware = "";
66
  public linkToSearchOrps = "";
67
  public linkToSearchOrganizations = "";
68

  
69
  public fetchPublications: FetchResearchResults;
70
  public fetchDataproviders: FetchDataproviders;
71
  public fetchProjects: FetchProjects;
72
  public fetchDatasets: FetchResearchResults;
73
  public fetchSoftware: FetchResearchResults;
74
  public fetchOrps: FetchResearchResults;
75
  public fetchOrganizations: FetchOrganizations;
76

  
77
  public searchFields: SearchFields = new SearchFields();
78
  public errorCodes: ErrorCodes = new ErrorCodes();
79
  public routerHelper: RouterHelper = new RouterHelper();
80

  
81
  public publicationsSize: any = null;
82
  public datasetsSize: any = null;
83
  public softwareSize: any = null;
84
  public oprsSize: any = null;
85
  public fundersSize: any = null;
86
  public projectsSize: any = null;
87
  public datasourcesSize: any = null;
88
  showPublications: boolean = false;
89
  showDatasets: boolean = false;
90
  showSoftware: boolean = false;
91
  showOrps: boolean = false;
92
  showProjects: boolean = false;
93
  showDataProviders: boolean = false;
94
  showOrganizations: boolean = false;
95
  advancedSearchLink: string = "/search/advanced/publications";
96
  properties: EnvProperties;
97
  @Input() logoURL;
98
  @Input() name;
99
  @Input() customFilter: SearchCustomFilter = null;
100
  @Input() piwikSiteId = null;
101
  @Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE";
102

  
103

  
104
  public subPub;
105
  public subData;
106
  public subSoftware;
107
  public subOrps;
108
  public subProjects;
109
  public subOrg;
110
  public subDataPr;
111

  
112

  
113
  quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
114
    filter: null,
115
    selected: true,
116
    filterId: "resultbestaccessright",
117
    value: "Open Access"
118
  };
119

  
120
  resultTypes = {publication: true, dataset: true, software: true, other: true};
121

  
122
  //adv Search Form
123
  public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
124
  public fieldIdsMap = this.searchFields.RESULT_FIELDS;
125
  public selectedFields: AdvancedField[] = [];
126

  
127
  //new
128
  parameters = {};
129
  disableForms: boolean = true;
130

  
131
  constructor(private route: ActivatedRoute,
132
              private _router: Router,
133
              private _searchResearchResultsService: SearchResearchResultsService,
134
              private _searchDataprovidersService: SearchDataprovidersService,
135
              private _searchProjectsService: SearchProjectsService,
136
              private _searchOrganizationsService: SearchOrganizationsService,
137
              private _refineFieldResultsService: RefineFieldResultsService,
138
              private location: Location,
139
              private _meta: Meta,
140
              private _title: Title,
141
              private _piwikService: PiwikService,
142
              private config: ConfigurationService,
143
              private seoService: SEOService, private router: Router, private cdr:ChangeDetectorRef) {
144
    this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
145
    this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
146
    this.fetchProjects = new FetchProjects(this._searchProjectsService);
147
    this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
148
    this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
149
    this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
150
    this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
151
    this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.fieldIdsMap[this.fieldIds[0]].param, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, '', "and"));
152

  
153
  }
154

  
155
  public ngOnInit() {
156
    this.route.data
157
      .subscribe((data: { envSpecific: EnvProperties }) => {
158

  
159
        var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
160
        var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE";
161
        this.properties = data.envSpecific;
162
        var url = data.envSpecific.baseLink + this._router.url;
163
        this._title.setTitle(title);
164
        this._meta.updateTag({content: description}, "name='description'");
165
        this._meta.updateTag({content: description}, "property='og:description'");
166
        this._meta.updateTag({content: title}, "property='og:title'");
167
        this._meta.updateTag({content: url}, "property='og:url'");
168
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
169
        if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
170
          this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe();
171

  
172
        }
173

  
174

  
175
        if ((this.customFilter && this.customFilter.queryFieldName == "communitId") || this.properties.adminToolsCommunity) {
176
          this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communitId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
177
            var showEntity = {};
178
            for (var i = 0; i < data['entities'].length; i++) {
179

  
180
              showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
181
            }
182
            this.showPublications = showEntity["publication"];
183
            this.showDatasets = showEntity["dataset"];
184
            this.showProjects = showEntity["project"];
185
            this.showOrganizations = showEntity["organization"];
186
            this.showDataProviders = showEntity["datasource"];
187
            this.showSoftware = showEntity["software"];
188
            this.showOrps = showEntity["orp"];
189
            if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
190
              this.showProjects = false;
191
              this.showOrganizations = false;
192
              this.showDataProviders = false;
193
            }
194
            this.loadAll();
195

  
196
          });
197
        } else {
198
          if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
199
            this.showPublications = true;
200
            this.showDatasets = true;
201
            this.showDataProviders = true;
202
            this.showSoftware = true;
203
            this.showOrps = true;
204
            this.showProjects = true;
205
            this.showOrganizations = true;
206
            this.showDataProviders = true;
207
          }
208
        }
209
        this.loadAll();
210
      });
211
  }
212

  
213
  loadAll() {
214
    this.reloadTabs();
215
    this.sub = this.route.queryParams.subscribe(params => {
216
      this.parameters = Object.assign({}, params);
217
      this.keyword = (params['keyword']) ? params['keyword'] : (params["q"] ? params["q"] : "");
218
      this.selectedFields[0].value = this.keyword;
219
      this.quickFilter.selected = ((params['qf']== undefined || params["qf"] == "true") == true);
220
      if (params["type"] && params["type"].length > 0) {
221
        this.resultTypes['publication'] = (params["type"].split(",").indexOf("publications") != -1);
222
        this.resultTypes['dataset'] = (params["type"].split(",").indexOf("datasets") != -1);
223
        this.resultTypes['software'] = (params["type"].split(",").indexOf("software") != -1);
224
        this.resultTypes['other'] = (params["type"].split(",").indexOf("other") != -1);
225
      }
226
      if(this.activeEntity == null && (!params["active"] || params["active"].length ==0)){
227
        this.activeEntity = this.getDefaultEntityToShow();
228
      }else if(params["active"] && params["active"].length >0 ){
229
        this.activeEntity = ((["result","projects","organizations","datasources"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow();
230
      }else if (this.activeEntity !=null  && (!params["active"] || params["active"].length ==0)){
231
        this.parameters["active"]=this.activeEntity;
232
        if(location.search && location.search.indexOf("active=") == -1){
233
          this.location.go(location.pathname, ((location.search)?(location.search+"&"):("?")) +"active=" + this.activeEntity);
234
        }
235
      }
236
      if (this.activeEntity == "result") {
237
        this.searchResults();
238
      } else if (this.activeEntity == "projects") {
239
        this.searchProjects();
240
      } else if (this.activeEntity == "datasources") {
241
        this.searchDataProviders();
242
      } else if (this.activeEntity == "organizations") {
243
        this.searchOrganizations();
244
      }
245
      this.count();
246
    });
247
  }
248

  
249
  getDefaultEntityToShow(){
250
    if (this.showPublications || this.showDatasets || this.showSoftware || this.showOrps) {
251
      return "result";
252
    } else if (this.showProjects) {
253
      return "projects";
254
    } else if (this.showDataProviders) {
255
      return "content providers";
256
    } else if (this.showOrganizations) {
257
      return "organizations";
258
    }
259
  }
260

  
261
  public ngOnDestroy() {
262
    if (this.sub) {
263
      this.sub.unsubscribe();
264
    }
265
    if (this.piwiksub) {
266
      this.piwiksub.unsubscribe();
267
    }
268
    if (this.keyword != null && this.keyword.length > 0) {
269
      if (this.subPub) {
270
        this.subPub.unsubscribe();
271
      }
272
      if (this.subData) {
273
        this.subData.unsubscribe();
274
      }
275
      if (this.subSoftware) {
276
        this.subSoftware.unsubscribe();
277
      }
278
      if (this.subOrps) {
279
        this.subOrps.unsubscribe();
280
      }
281
      if (this.subProjects) {
282
        this.subProjects.unsubscribe();
283
      }
284
      if (this.subOrg) {
285
        this.subOrg.unsubscribe();
286
      }
287
      if (this.subDataPr) {
288
        this.subDataPr.unsubscribe();
289
      }
290

  
291
    }
292
  }
293

  
294
  public searchResults() {
295
    this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications";
296
    if (this.reload[this.activeEntity] &&
297
      this.fetchPublications.searchUtils.status != this.errorCodes.NONE) {
298
      this.reload[this.activeEntity] = false;
299
      this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword="  + this.keyword;
300
    }
301
  }
302

  
303

  
304
  public searchProjects() {
305
    this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects";
306
    if (this.reload[this.activeEntity] &&
307
      this.fetchProjects.searchUtils.status != this.errorCodes.NONE ) {
308
      this.reload[this.activeEntity]  = false;
309
      this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword="  + this.keyword;
310
    }
311
  }
312

  
313
  public searchDataProviders() {
314
    this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders";
315
    if ( this.reload[this.activeEntity] &&
316
      this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE) {
317
      this.reload[this.activeEntity] = false;
318
      this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword="  + this.keyword;
319
    }
320
  }
321

  
322
  public searchOrganizations() {
323
    this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
324
    if (this.reload[this.activeEntity] &&
325
      this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE) {
326
      this.reload[this.activeEntity] = false;
327
      this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword="  + this.keyword;
328
    }
329
  }
330
  private prepareKeywordParam(keyword){
331
    if (this.parameters["q"] && keyword.length == 0) {
332
      delete this.parameters['q'];
333
      delete this.parameters['op'];
334
    } else {
335
      this.parameters["q"] = keyword;
336
      this.parameters["op"] = "and";
337
    }
338
  }
339
  private prepareResultParameters() {
340
    //quickSelections
341
    if (this.resultTypes && this.activeEntity == "result") {
342
      let values = [];
343
      if (this.resultTypes.publication) {
344
        values.push("publications");
345
      }
346
      if (this.resultTypes.dataset) {
347
        values.push("datasets");
348
      }
349
      if (this.resultTypes.software) {
350
        values.push("software");
351
      }
352
      if (this.resultTypes.other) {
353
        values.push("other");
354
      }
355
      if (values.length > 0) {
356
        this.parameters["type"] = values.join(",");
357
      }
358
    }
359
    if (this.quickFilter && this.activeEntity == "result") {
360
      this.parameters["qf"] = this.quickFilter.selected;
361
    }
362
  }
363

  
364
  public quickSelectionsChanged() {
365
    this.prepareResultParameters();
366
    this.reload[this.activeEntity] = true;
367
    this.router.navigate([location.pathname], {queryParams: this.parameters});
368
  }
369

  
370

  
371
  public keywordChanged($event) {
372
    this.prepareKeywordParam(this.selectedFields[0].value);
373
    this.reloadTabs();
374
    this.router.navigate([location.pathname], {queryParams: this.parameters});
375
  }
376

  
377
  private count() {
378
    var refineParams = null;
379
    if (this.customFilter) {
380
      refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
381
    }
382
    if (this.activeEntity != "result" && this.reload["result"] &&  (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) {
383
      this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
384
      this.reload["result"] = false;
385
      this.fetchPublications.results = [];
386
      this.subPub = this.numOfSearchResults(this.fetchPublications, refineParams);
387
    }
388

  
389
    if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) {
390
      this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
391
      this.fetchProjects.results = [];
392
      this.reload["projects"] = false;
393
      this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword, this.properties, refineParams).subscribe(
394
        data => {
395
          this.fetchProjects.searchUtils.totalResults = data;
396
          this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
397
          if (this.fetchProjects.searchUtils.totalResults == 0) {
398
            this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
399
          }
400
        },
401
        err => {
402
          //console.log(err);
403
          this.handleError("Error getting number of Projects", err);
404
          this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
405
        }
406
      );
407
    }
408
    if (this.activeEntity != "datasources"  && this.reload["datasources"] && this.showDataProviders) {
409
      this.fetchDataproviders.results = [];
410
      this.reload["datasources"] = false;
411
      this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
412
    }
413
    if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
414
      this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
415
      this.fetchOrganizations.results = [];
416
      this.reload["organizations"] = false;
417
      this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword, this.properties, refineParams).subscribe(
418
        data => {
419
          this.fetchOrganizations.searchUtils.totalResults = data;
420
          this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
421
          if (this.fetchOrganizations.searchUtils.totalResults == 0) {
422
            this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
423
          }
424
        },
425
        err => {
426
          //console.log(err);
427
          this.handleError("Error getting number of Organizations", err);
428
          this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
429

  
430
        }
431
      );
432
    }
433

  
434

  
435
  }
436

  
437
  private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Observable<any> {
438
    return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword, this.properties, refineParams).subscribe(
439
      data => {
440
        fetchClass.searchUtils.totalResults = data;
441
        fetchClass.searchUtils.status = this.errorCodes.DONE;
442
        if (fetchClass.searchUtils.totalResults == 0) {
443
          fetchClass.searchUtils.status = this.errorCodes.NONE;
444
        }
445
      },
446
      err => {
447
        this.handleError("Error getting number of research results", err);
448
        fetchClass.searchUtils.status = this.errorCodes.ERROR;
449
      }
450
    );
451
  }
452

  
453
  private reloadTabs() {
454
    this.reload = {result:true, projects:true, datasources: true, organizations:true};
455
    this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
456
    this.fetchDataproviders.searchUtils.status =  this.errorCodes.LOADING;
457
    this.fetchProjects.searchUtils.status =  this.errorCodes.LOADING;
458
    this.fetchPublications.searchUtils.status =  this.errorCodes.LOADING;
459
    this.fetchDatasets.searchUtils.status =  this.errorCodes.LOADING;
460
    this.fetchSoftware.searchUtils.status =  this.errorCodes.LOADING;
461
    this.fetchOrps.searchUtils.status =  this.errorCodes.LOADING;
462
  }
463

  
464
  private handleError(message: string, error) {
465
    console.error("General Search Page: " + message, error);
466
  }
467

  
468
  private getEntityName(entityType: string, plural: boolean, full: boolean): string {
469
    if (entityType == "publication") {
470
      return "publication" + (plural ? "s" : "");
471
    } else if (entityType == "dataset") {
472
      return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
473
    } else if (entityType == "software") {
474
      return "software";
475
    } else if (entityType == "other") {
476
      return (full ? ("other research product" + (plural ? "s" : "")) : "other");
477
    }
478
  }
479

  
480
  activeEntityUpdate($event) {
481
    this.disableForms = $event.disableForms;
482
    let updated = true;
483
    if (this.activeEntity == "result") {
484
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
485
        this.fetchPublications.searchUtils.totalResults = $event.searchUtils.totalResults;
486
      }
487
      this.fetchPublications.searchUtils.status = $event.searchUtils.status;
488
    }else if (this.activeEntity == "projects"){
489
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
490
        this.fetchProjects.searchUtils.totalResults = $event.searchUtils.totalResults;
491
      }
492
      this.fetchProjects.searchUtils.status = $event.searchUtils.status;
493
    }else if (this.activeEntity == "datasources"){
494
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
495
        this.fetchDataproviders.searchUtils.totalResults = $event.searchUtils.totalResults;
496
      }
497
      this.fetchDataproviders.searchUtils.status = $event.searchUtils.status;
498
    }else if (this.activeEntity == "organizations") {
499
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
500
        this.fetchOrganizations.searchUtils.totalResults = $event.searchUtils.totalResults;
501
      }
502
      this.fetchOrganizations.searchUtils.status = $event.searchUtils.status;
503
    }else{
504
      updated = false;
505
    }
506
    if(updated) {
507
      this.cdr.detectChanges();
508
    }
509
  }
510

  
511
  entityChanged(entity){
512
    this.activeEntity = entity;
513
      this.parameters = {};
514
      this.reload[entity]= true;
515
      this.parameters["active"] = entity;
516
    if ( this.keyword.length > 0) {
517
      this.parameters["q"] = this.keyword;
518
      this.parameters["op"] = "and";
519
    }
520
      this.router.navigate([location.pathname], {queryParams: this.parameters});
521
    }
522

  
523
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/find/searchAll.module.ts
1
import { NgModule}            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4
import { RouterModule } from '@angular/router';
5

  
6

  
7
import {SearchResultsModule } from '../searchUtils/searchResults.module';
8

  
9
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
10
import {ProjectsServiceModule} from '../../services/projectsService.module';
11
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
12
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
13
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
14
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
15

  
16
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
17
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
18
import {SearchAllComponent} from "./searchAll.component";
19
import {AdvancedSearchFormModule} from "../searchUtils/advancedSearchForm.module";
20
import {SearchResearchResultsModule} from "../searchResearchResults.module";
21
import {QuickSelectionsModule} from "../searchUtils/quick-selections.module";
22
import {SearchProjectsModule} from "../searchProjects.module";
23
import {SearchOrganizationsModule} from "../searchOrganizations.module";
24
import {SearchDataProvidersModule} from "../searchDataProviders.module";
25

  
26
@NgModule({
27
  imports: [
28
    CommonModule, FormsModule, RouterModule,
29
    DataProvidersServiceModule, ProjectsServiceModule,
30
    SearchResearchResultsServiceModule, OrganizationsServiceModule,
31
    BrowseEntitiesModule, SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, AdvancedSearchFormModule, SearchResearchResultsModule, QuickSelectionsModule, SearchProjectsModule, SearchOrganizationsModule, SearchDataProvidersModule
32
  ],
33
  declarations: [
34
    SearchAllComponent
35
   ],
36
  providers:[
37
    //FreeGuard, PreviousRouteRecorder
38
    ],
39
  exports: [
40
    SearchAllComponent
41
     ]
42
})
43
export class SearchAllModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchDataProviders.component.ts
1
import {Component, Input, ViewChild} from '@angular/core';
1
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
2 2
import {ActivatedRoute} from '@angular/router';
3 3
import {AdvancedField} from './searchUtils/searchHelperClasses.class';
4 4
import {SearchDataprovidersService} from '../services/searchDataproviders.service';
......
19 19
      pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'content providers' | titlecase }}"
20 20
      entityType="content provider"
21 21
      type="content providers"
22
      [(results)]="results"
23
      [(searchUtils)]="searchUtils"
24
      [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
22
      [results]="results"
23
      [searchUtils]="searchUtils"
24
      [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
25 25
      [csvParams]="csvParams" csvPath="projects"
26 26
      [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
27 27
      [disableForms]="disableForms"
28 28
      [loadPaging]="loadPaging"
29 29
      [oldTotalResults]="oldTotalResults"
30
      [(openaireLink)]=openaireLink
30
      [openaireLink]=openaireLink
31
      [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
31 32
      [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
32 33
      searchFormClass="datasourcesSearchForm"
33 34

  
34
      [(filters)]="filters"
35
      [filters]="filters"
35 36
      [simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..."
36 37
    >
37 38
    </new-search-page>
......
65 66
  public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS;
66 67
  @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
67 68
  @Input() simpleView: boolean = true;
68
  simpleSearchLink: string = "";
69
  @Input() simpleSearchLink: string = "";
69 70
  advancedSearchLink: string = "";
70 71
  @Input() hasPrefix: boolean = true;
71 72
  @Input() openaireLink: string;
73
  @Input() includeOnlyResultsAndFilter: boolean = false;
74
  @Output() searchPageUpdates = new EventEmitter();
72 75
  constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
73 76
    this.results =[];
74 77
    this.errorCodes = new ErrorCodes();
......
82 85
    this.route.data
83 86
      .subscribe((data: { envSpecific: EnvProperties }) => {
84 87
        this.properties= data.envSpecific;
85
        this.simpleSearchLink = this.properties.searchLinkToDataProviders;
86
        this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;
88
        if (!this.simpleSearchLink) {
89
          this.simpleSearchLink = this.properties.searchLinkToProjects;
90
        }        this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;
87 91
        this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
88 92
         this.pagingLimit = data.envSpecific.pagingLimit;
89 93
         this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
......
141 145
      this.searchUtils.status = this.errorCodes.LOADING;
142 146
      //this.searchPage.openLoading();
143 147
      this.disableForms = true;
148
      this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
149

  
144 150
      this.results = [];
145 151
      this.searchUtils.totalResults = 0;
146 152

  
......
162 168
            }
163 169
            //this.searchPage.closeLoading();
164 170
            this.disableForms = false;
171
           this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
165 172

  
166 173
            if(this.searchUtils.status == this.errorCodes.DONE) {
167 174
              // Page out of limit
......
195 202
              }*/
196 203
              //this.searchPage.closeLoading();
197 204
              this.disableForms = false;
205
            this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
206

  
198 207
          }
199 208
        );
200 209
      }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchOrganizations.component.ts
1
import {Component, Input, ViewChild} from '@angular/core';
1
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
2 2
import {ActivatedRoute} from '@angular/router';
3 3
import {AdvancedField} from './searchUtils/searchHelperClasses.class';
4 4
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
......
17 17
        pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'organizations' | titlecase }}"
18 18
        entityType="organization"
19 19
        type="organizations"
20
        [(results)]="results"
21
        [(searchUtils)]="searchUtils"
22
        [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
20
        [results]="results"
21
        [searchUtils]="searchUtils"
22
        [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
23 23
        [csvParams]="csvParams" csvPath="organizations"
24 24
        [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
25 25
        [disableForms]="disableForms"
26 26
        [loadPaging]="loadPaging"
27 27
        [oldTotalResults]="oldTotalResults"
28
        [(openaireLink)]=openaireLink
28
        [openaireLink]=openaireLink
29 29
        [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
30 30
        searchFormClass="organizationSearchForm"
31
        [(filters)]="filters"
31
        [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
32

  
33
        [filters]="filters"
32 34
        [simpleView]="simpleView" formPlaceholderText="Search by title, author, doi, abstract content..."
33 35
      >
34 36
      </new-search-page>
......
59 61
  public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS;
60 62
  @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
61 63
  @Input() simpleView: boolean = true;
62
  simpleSearchLink: string = "";
64
  @Input() simpleSearchLink: string = "";
63 65
  advancedSearchLink: string = "";
64 66
  @Input() hasPrefix: boolean = true;
65 67
  @Input() openaireLink: string;
66

  
68
  @Input() includeOnlyResultsAndFilter: boolean = false;
69
  @Output() searchPageUpdates = new EventEmitter();
67 70
public resourcesQuery = "(oaftype exact organization)";
68 71
  constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
69 72
    this.results =[];
......
78 81
    this.route.data
79 82
      .subscribe((data: { envSpecific: EnvProperties }) => {
80 83
        this.properties= data.envSpecific;
81
        this.simpleSearchLink = this.properties.searchLinkToProjects;
82
        this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;
84
        if (!this.simpleSearchLink) {
85
          this.simpleSearchLink = this.properties.searchLinkToProjects;
86
        }        this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;
83 87
        this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
84 88
        this.pagingLimit = data.envSpecific.pagingLimit;
85 89
        this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
......
139 143
      this.searchUtils.status = this.errorCodes.LOADING;
140 144
      //this.searchPage.openLoading();
141 145
      this.disableForms = true;
146
      this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
147

  
142 148
      this.results = [];
143 149
      this.searchUtils.totalResults = 0;
144 150

  
......
160 166
            }
161 167
            //this.searchPage.closeLoading();
162 168
            this.disableForms = false;
169
          this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
163 170

  
164
            if(this.searchUtils.status == this.errorCodes.DONE) {
171
          if(this.searchUtils.status == this.errorCodes.DONE) {
165 172
              // Page out of limit!!!
166 173
              let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
167 174
              if(!(Number.isInteger(totalPages))) {
......
194 201

  
195 202
            //this.searchPage.closeLoading();
196 203
            this.disableForms = false;
204
          this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
205

  
197 206
        }
198 207
      );
199 208
    }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchProjects.component.ts
1
import {Component, Input, ViewChild} from '@angular/core';
1
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
2 2
import {ActivatedRoute} from '@angular/router';
3 3
import {AdvancedField} from './searchUtils/searchHelperClasses.class';
4 4
import {SearchProjectsService} from '../services/searchProjects.service';
......
17 17
        pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'projects' | titlecase }}"
18 18
        entityType="project"
19 19
        type="projects"
20
        [(results)]="results"
21
        [(searchUtils)]="searchUtils"
22
        [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
20
        [results]="results"
21
        [searchUtils]="searchUtils"
22
        [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
23 23
        [csvParams]="csvParams" csvPath="projects"
24 24
        [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
25 25
        [disableForms]="disableForms"
26 26
        [loadPaging]="loadPaging"
27 27
        [oldTotalResults]="oldTotalResults"
28
        [(openaireLink)]=openaireLink
28
        [openaireLink]=openaireLink
29 29
        [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
30 30
        searchFormClass="projectSearchForm"
31
        [(filters)]="filters"
31
        [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
32
        [filters]="filters"
32 33
        [rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
33 34
        [simpleView]="simpleView" formPlaceholderText="Search by title, author, doi, abstract content..."
34 35
      >
......
65 66
  public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS;
66 67
  @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
67 68
  @Input() simpleView: boolean = true;
68
  simpleSearchLink: string = "";
69
  @Input() simpleSearchLink: string = "";
69 70
  advancedSearchLink: string = "";
70 71
  @Input() hasPrefix: boolean = true;
71 72
  @Input() openaireLink: string;
72

  
73
  @Input() includeOnlyResultsAndFilter: boolean = false;
74
  @Output() searchPageUpdates = new EventEmitter();
73 75
  constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
74 76

  
75 77
    this.results =[];
......
85 87
    this.route.data
86 88
      .subscribe((data: { envSpecific: EnvProperties }) => {
87 89
        this.properties= data.envSpecific;
88
        this.simpleSearchLink = this.properties.searchLinkToProjects;
90
        if (!this.simpleSearchLink) {
91
          this.simpleSearchLink = this.properties.searchLinkToProjects;
92
        }
89 93
        this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;
90 94
        this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
91 95
         this.pagingLimit = data.envSpecific.pagingLimit;
......
118 122
      this.searchPage.fieldIds = this.fieldIds;
119 123
      this.selectedFields = [];
120 124
      this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project");
121
      // this.selectedFields =[];
122
      // this.searchPage.selectedFields = this.selectedFields;
123
      // this.searchPage.fieldIdsMap = this.fieldIdsMap;
124
      // this.searchPage.customFilter = this.customFilter;
125
      // this.searchPage.getSelectedFiltersFromUrl(params);
126 125
      this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(),  this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
127 126
      firstLoad = false;
128 127
    });
......
147 146
      this.searchUtils.status = this.errorCodes.LOADING;
148 147
      //this.searchPage.openLoading();
149 148
      this.disableForms = true;
149
      this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
150 150
      this.results = [];
151 151
      this.searchUtils.totalResults = 0;
152 152

  
......
170 170
              }
171 171
              //this.searchPage.closeLoading();
172 172
              this.disableForms = false;
173
            this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
173 174

  
174 175
              if(this.searchUtils.status == this.errorCodes.DONE) {
175 176
                // Page out of limit!!!
......
204 205

  
205 206
              //this.searchPage.closeLoading();
206 207
              this.disableForms = false;
208
            this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
207 209

  
208 210
          }
209 211
      );
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/entitiesSelection.component.ts
87 87
  getUrl(simpleView:boolean){
88 88
    let url = "";
89 89
    if(this.selectedEntity == "all"){
90
      url = "/search/find/";
90
      url = (simpleView?"/search/find/":null);
91 91
    }else if(this.selectedEntity == "result"){
92 92
      url = (simpleView?this.properties.searchLinkToResults:this.properties.searchLinkToAdvancedResults);
93 93
    }else if(this.selectedEntity == "project"){
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchForm.component.html
141 141
          Search
142 142
        </button>
143 143
        <div class="uk-margin-small-top">
144
          <a *ngIf ="this.entityType == this.selectedEntity" routerLinkActive="router-link-active"
144
          <a *ngIf ="this.entityType == this.selectedEntity && advancedSearchLink" routerLinkActive="router-link-active"
145 145
             [routerLink]="advancedSearchLink" style="z-index:1;" [queryParams]="advancedSearchLinkParameters"
146 146
             [class]="(isDisabled)?'  uk-disabled uk-link-muted  portal-link   uk-margin-left ':' portal-link   uk-margin-left '">Advanced search
147 147
          </a>
148
          <a *ngIf ="this.entityType != this.selectedEntity" routerLinkActive="router-link-active"
148
          <a *ngIf ="this.entityType != this.selectedEntity && selectedEntityAdvancedUrl " routerLinkActive="router-link-active"
149 149
             [routerLink]="selectedEntityAdvancedUrl" style="z-index:1;"
150 150
             [queryParams]="{q:this.selectedFields[0].value,op:'and'}"
151 151
             [class]="(isDisabled)?'  uk-disabled uk-link-muted  portal-link   uk-margin-left ':' portal-link   uk-margin-left '">Advanced search
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchForm.component.ts
24 24
  @Input() formPlaceholderText = "Type Keywords...";
25 25
  @Input() pageTitle;
26 26
  @Output() queryChange  = new EventEmitter();
27
  @Input() @Output() resultTypes;
27
  @Input()resultTypes;
28 28
  @Input()  quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string};
29 29
  validDateFrom: boolean = true;
30 30
  validDateTo: boolean = true;
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
1 1

  
2
<div class="image-front-topbar  uk-section-default uk-position-relative" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
2
<div *ngIf="!includeOnlyResultsAndFilter" class="image-front-topbar  uk-section-default uk-position-relative"
3
      uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
3 4
  <div  style="box-sizing: border-box;  " [class]="' uk-background-norepeat uk-background-cover uk-background-bottom-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed advancedSearchFormBackground '+searchFormClass">
4 5
    <div class="uk-position-cover" style="/*background-color: rgba(255, 255, 255, 0.37);*/"></div>
5 6
    <div class="uk-width-1-1">
......
7 8
           <div   class="uk-container uk-margin-large-top">
8 9
                <advanced-search-form
9 10
                   [entityType] = "entityType"
10
                   [(fieldIds)]="fieldIds"
11
                   [(fieldIdsMap)]="fieldIdsMap"
12
                   [(selectedFields)]="selectedFields"
11
                   [fieldIds]="fieldIds"
12
                   [fieldIdsMap]="fieldIdsMap"
13
                   [selectedFields]="selectedFields"
13 14
                   (queryChange)="queryChanged()"
14 15
                   [isDisabled]="disableForms"
15 16
                   [simpleSearchLink]="simpleSearchLink"
......
17 18
                   [advancedSearchLinkParameters]
18 19
                     ="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
19 20
                   [pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
20
                   [(resultTypes)]="resultTypes" [quickFilter]="quickFilter"
21
                   [resultTypes]="resultTypes" [quickFilter]="quickFilter"
21 22
                   >
22 23
               </advanced-search-form>
23 24
           </div>
......
25 26
     </div>
26 27
  </div>
27 28
</div>
28
<schema2jsonld   *ngIf="url"  [URL]="url" type="search" [name]=pageTitle [searchAction]=false></schema2jsonld>
29
<schema2jsonld *ngIf="!includeOnlyResultsAndFilter && url"  [URL]="url" type="search" [name]=pageTitle
30
               [searchAction]=false></schema2jsonld>
29 31

  
30 32

  
31 33

  
......
144 146

  
145 147
            </div>
146 148
          </div>
147
          <div class="uk-width-1-1 uk-grid helper-grid uk-padding-large uk-padding-remove-top" >
149
          <div class="uk-width-1-1 uk-grid helper-grid uk-padding-small uk-padding-remove-top" >
148 150
            <div *ngIf="showRefine" class="uk-margin-top uk-width-1-4@m search-filters uk-visible@m">
149 151
              <!-- top: #container-1; bottom: #true; -->
150 152
              <!-- <div id="container-1" style="z-index: -1;" uk-sticky="top: #container-1; offset: 120; "> -->
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
66 66
  @Input() keywordFields = [];
67 67
  @Input() simpleView: boolean = true;
68 68
  @Input() formPlaceholderText = "Type Keywords...";
69
  @Input() @Output() resultTypes = null;
70
  @Input() @Output() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
71

  
69
  @Input() resultTypes = null;
70
  @Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
71
  @Input() includeOnlyResultsAndFilter:boolean = false;
72 72
  piwiksub: any;
73 73
  public parameterNames: string[] = [];
74 74
  public parameterValues: string[] = [];
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchResearchResults.component.ts
1
import {Component, Input, ViewChild} from '@angular/core';
1
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild} from '@angular/core';
2 2
import {ActivatedRoute} from '@angular/router';
3 3
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
4 4
import {SearchResearchResultsService} from '../services/searchResearchResults.service';
......
18 18
      pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ getEntityName(resultType, true, true) | titlecase }}"
19 19
      [entityType]="resultType"
20 20
      [type]="getEntityName(resultType, true, true)"
21
      [(results)]="results"
22
      [(searchUtils)]="searchUtils"
23
      [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
21
      [results]="results"
22
      [searchUtils]="searchUtils"
23
      [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
24 24
      [csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
25 25
      [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
26 26
      [disableForms]="disableForms"
27 27
      [loadPaging]="loadPaging"
28 28
      [oldTotalResults]="oldTotalResults"
29
      [(openaireLink)]=openaireLink
29
      [openaireLink]=openaireLink
30 30
      [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
31 31
      searchFormClass="publicationsSearchForm"
32
      [(sort)]=sort
33
      [(filters)]="filters" [quickFilter]="quickFilter"
32
      [sort]=sort
33
      [filters]="filters" [quickFilter]="quickFilter"
34 34
      [rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
35 35
      [simpleView]="simpleView" formPlaceholderText="Search by title, author, doi, abstract content..."
36
      [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
36 37
    >
37 38
    </new-search-page>
38
 
39

  
39 40
  `
40 41
})
41 42

  
42 43
export class SearchResearchResultsComponent {
43 44
  @Input() resultType: string = "result";
44 45

  
45
  simpleSearchLink: string = "";
46
  @Input() simpleSearchLink: string = "";
46 47
  advancedSearchLink: string = "";
47 48

  
48 49
  private errorCodes: ErrorCodes;
......
80 81
    filterId: "resultbestaccessright",
81 82
    value: "Open Access"
82 83
  };
84
  @Input() includeOnlyResultsAndFilter: boolean = false;
85
  @Output() searchPageUpdates = new EventEmitter();
83 86

  
84 87
  constructor(private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService) {
85 88
    this.results = [];
86 89
    this.errorCodes = new ErrorCodes();
87 90
    this.errorMessages = new ErrorMessagesComponent();
88 91
    this.searchUtils.status = this.errorCodes.LOADING;
89
      }
92
  }
90 93

  
91 94
  ngOnInit() {
92 95
    console.log(this.quickFilter);
......
96 99
      this.pagingLimit = data.envSpecific.pagingLimit;
97 100
      this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
98 101

  
99

  
100
      this.simpleSearchLink = this.properties.searchLinkToResults;
102
      if (!this.simpleSearchLink) {
103
        this.simpleSearchLink = this.properties.searchLinkToResults;
104
      }
101 105
      this.advancedSearchLink = this.properties.searchLinkToAdvancedResults;
102
      this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
106
      this.searchUtils.baseUrl = (this.simpleView) ? this.simpleSearchLink : this.advancedSearchLink;
103 107

  
104 108
    });
105 109

  
......
128 132
      }
129 133

  
130 134
      this.selectedFields = [];
131
// <<<<<<< .mine
132 135
      this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter);
133 136
      this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
134
// ||||||| .r58066
135
//       this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params);
136
//       this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params));
137
// =======
138
//       this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter);
139
//       this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
140
//       firstLoad = false;
141
//
142
// >>>>>>> .r58095
137
      firstLoad = false;
143 138
    });
144 139
  }
145 140

  
......
159 154
      } else {
160 155
        this.csvParams = "&fq=" + this.resourcesQuery;
161 156
      }
162
      this.csvParams += (refineFieldsFilterQuery?refineFieldsFilterQuery:'');
157
      this.csvParams += (refineFieldsFilterQuery ? refineFieldsFilterQuery : '');
163 158

  
164 159
      this.searchUtils.status = this.errorCodes.LOADING;
165 160
      this.disableForms = true;
161
      this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
166 162
      this.results = [];
167 163
      this.searchUtils.totalResults = 0;
168 164
      this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
......
172 168

  
173 169
          if (refine) {
174 170
            this.filters = this.searchPage.prepareFiltersToShow(data[2]);
175
          }else{
171
          } else {
176 172
            this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
177 173
          }
178 174
          this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
......
182 178
            this.searchUtils.status = this.errorCodes.NONE;
183 179
          }
184 180
          this.disableForms = false;
181
          this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
185 182

  
186 183
          if (this.searchUtils.status == this.errorCodes.DONE) {
187 184
            // Page out of limit!!!
......
215 212

  
216 213
          //this.searchPage.closeLoading();
217 214
          this.disableForms = false;
215
          this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
218 216

  
219 217
        }
220 218
      );

Also available in: Unified diff