Project

General

Profile

« Previous | Next » 

Revision 55057

[Trunk|Library]: #4220: Add 'References' section in 'Research Data Landing page'.

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/dataset/dataset.component.html
83 83
            </div></div> -->
84 84

  
85 85
            <ul class="custom-accordion" uk-accordion>
86
              <li *ngIf="datasetInfo.references" (click)="activeTab='References'">
87
                  <a class="uk-accordion-title" href="#">
88
                      References ({{datasetInfo.references.length | number}})
89
                  </a>
90
                  <div class="uk-accordion-content">
91
                    <div>
92
                        <div *ngIf="datasetInfo.references.length > pageSize" class="uk-margin-bottom">
93
                          <span class="uk-h6">{{datasetInfo.references.length | number}} references, page {{referencesPage | number}} of {{totalPages(datasetInfo.references.length) | number}}</span>
94
                          <paging-no-load class="uk-float-right" [currentPage]="referencesPage" [totalResults]="datasetInfo.references.length" [size]="pageSize" (pageChange)="updateReferencesPage($event)"></paging-no-load>
95
                        </div>
86 96

  
97
                        <div *ngFor="let item of datasetInfo.references.slice((referencesPage-1)*pageSize, referencesPage*pageSize)">
98
                            <p *ngIf=" item && item['url']"
99
                                class="custom-external custom-icon">
100
                                <a href="{{item['url']}}" target="_blank">
101
                                    {{item['name']}}
102
                                </a>
103
                            </p>
104
                            <p  *ngIf="!item['url']" class="pseudo-external custom-icon">
105
                                {{item['name']}}
106
                            </p>
107
                        </div>
108
                    </div>
109
                  </div>
110
               </li>
111

  
87 112
               <li *ngIf="datasetInfo.relatedResearchResults" (click)="activeTab='Related Research Results'">
88 113
                   <a class="uk-accordion-title" href="#">
89 114
                     Related Research Results
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/dataset/dataset.service.ts
28 28
    return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
29 29
                    .map(res => <any> res.json())
30 30
                    .map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result'],res])
31
                    .map(res => [res[1],
32
                                 res[1]['title'],
33
                                 res[1]['rels']['rel'],
34
                                 res[1]['children'],
35
                                 res[1]['pid'],
36
                                 res[1]['subject'],
37
                                 res[1]['bestaccessright'],
38
                                 res[1]['collectedfrom'],
39
                                 res[1]['context'],
31
                    .map(res => [res[1],  //0
32
                                 res[1]['title'],   //1
33
                                 res[1]['rels']['rel'], //2
34
                                 res[1]['children'],  //3
35
                                 res[1]['pid'], //4
36
                                 res[1]['subject'], //5
37
                                 res[1]['bestaccessright'], //6
38
                                 res[1]['collectedfrom'], //7
39
                                 res[1]['context'], //8
40 40
                                 //res[1]['resulttype'],
41
                                 res[0],
42
                                 res[1]['creator'],
43
                                 res[1]['language'],
44
                                 res[1]['country'],
45
                                 res[2]
41
                                 res[0],  //9
42
                                 res[1]['creator'], //10
43
                                 res[1]['language'],  //11
44
                                 res[1]['country'], //12
45
                                 res[2], //13
46
                                 (res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null //14
46 47
                    ]).map(res => this.parseDatasetInfo(res));
47 48
  }
48 49

  
......
56 57
  parseDatasetInfo (data: any):any {
57 58
    this.datasetInfo = new DatasetInfo();
58 59
    this.datasetInfo.record = data[13];
60
    // ['result']['metadata']['oaf:entity']['oaf:result']
59 61
    if(data[0] != null) {
60 62
      var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
61 63
      this.datasetInfo.date  = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
......
82 84
    if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
83 85
      this.datasetInfo.accessMode = data[0]['bestaccessright'].classid;
84 86
    }
87
    // ['result']['metadata']['oaf:entity']['oaf:result']['title']
85 88
    if(data[1] != null) {
86 89
      if(Array.isArray(data[1])) {
87 90
        this.datasetInfo.title = data[1][0].content;
......
93 96
      }
94 97
    }
95 98

  
99
    // ['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel']
96 100
    if(data[2] != null) {
97 101
      let relation;
98 102
      let length = data[2].length!=undefined ? data[2].length : 1;
......
119 123
      }
120 124
    }
121 125

  
126
    // ['result']['metadata']['oaf:entity']['oaf:result']['children']
122 127
    if(data[3] != null) {
123 128
      if(data[3].hasOwnProperty("instance")) {
124 129
        this.datasetInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
......
155 160
      }
156 161
    }
157 162

  
163
    // ['result']['metadata']['oaf:entity']['oaf:result']['pid']
158 164
    if(data[4] != null) {
159 165
      this.datasetInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
160 166
    }
161 167

  
168
    // ['result']['metadata']['oaf:entity']['oaf:result']['subject']
162 169
    if(data[5] != null) {
163 170
      let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[5]);
164 171
      this.datasetInfo.subjects = subjectResults[0];
......
170 177
                this.datasetInfo.hostedBy_collectedFrom, this.datasetInfo.publisher,
171 178
                null, this.datasetInfo.identifiers/*, this.datasetInfo.title*/);
172 179

  
180
    // ['result']['metadata']['oaf:entity']['oaf:result']['context']
173 181
    if(data[8] != null) {
174 182
      this.datasetInfo.contexts = this.parsingFunctions.parseContexts(data[8]);
175 183
    }
......
180 188
    //   }
181 189
    // }
182 190

  
191
    // ['result']['header']['dri:status']
183 192
    if(data[9] != null && data[9] == "under curation") {
184 193
      this.datasetInfo.underCurationMessage = true;
185 194
    } else {
186 195
      this.datasetInfo.underCurationMessage = false;
187 196
    }
188 197

  
198
    // ['result']['metadata']['oaf:entity']['oaf:result']['creator']
189 199
    if(data[10] != null) {
190 200
      if(this.datasetInfo.authors == undefined) {
191 201
        this.datasetInfo.authors = new Array<string>();
......
204 214
      });
205 215
    }
206 216

  
217
    // ['result']['metadata']['oaf:entity']['oaf:result']['language']
207 218
    if(data[11] != null) {
208 219
      this.datasetInfo.languages = this.parsingFunctions.parseLanguages(data[11]);
209 220
    }
221
    // ['result']['metadata']['oaf:entity']['oaf:result']['country']
210 222
    if(data[12] != null) {
211 223
      this.datasetInfo.countries = this.parsingFunctions.parseCountries(data[12]);
212 224
    }
213 225

  
226
    // ['result']['metadata']['oaf:entity']['oaf:result']['extraInfo']['citations']['citation']
227
    if(data[14] != null) {
228
      this.datasetInfo.references = this.parsingFunctions.parseReferences(data[14]);
229
    }
230

  
214 231
    if(this.datasetInfo.relatedResearchResults) {
215 232
      let self = this;
216 233
      this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) {
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/dataset/dataset.component.ts
37 37
    public totalDownloads: number;
38 38
    public pageViews: number;
39 39

  
40
    // Custom tab paging variables
41
    public referencesPage: number = 1;
42
    public pageSize: number = 10;
43

  
40 44
    // Active tab variable for responsiveness
41
    public activeTab: string = "Related Research Results";
45
    public activeTab: string = "References";
42 46

  
43 47
    // Map counting variable
44 48
    public relatedResearchResultsNum: number = 0;
......
200 204
    private handleError(message: string, error) {
201 205
        console.error("Research Data Landing Page: "+message, error);
202 206
    }
207

  
208
    public updateReferencesPage($event) {
209
      this.referencesPage = $event.value;
210
    }
211

  
212
    public totalPages(totalResults: number): number {
213
      let totalPages:any = totalResults/this.pageSize;
214
      if(!(Number.isInteger(totalPages))) {
215
          totalPages = (parseInt(totalPages, this.pageSize) + 1);
216
      }
217
      return totalPages;
218
    }
203 219
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/dataset/dataset.module.ts
16 16
import {AltMetricsModule}           from '../../utils/altmetrics.module';
17 17
import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module';
18 18
import {IFrameModule}               from '../../utils/iframe.module';
19
import {PagingModule}               from '../../utils/paging.module';
19 20

  
20 21
import {DatasetService}             from './dataset.service';
21 22

  
......
29 30
  imports: [
30 31
    //MaterialModule.forRoot(),
31 32
    CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
32
    CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule,
33
    CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule,
33 34
    AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule
34 35
  ],
35 36
  declarations: [
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/datasetInfo.ts
47 47
    similarResearchResults: { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]; // percentage is for similarity
48 48
    contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
49 49
    record;
50
    references: { "name": string, "url": string}[];
50 51
}
modules/uoa-services-library/trunk/ng-openaire-library/src/assets/env-properties.json
9 9
  "statisticsFrameAPIURL":"https://beta.openaire.eu/stats/",
10 10
  "claimsAPIURL" : "http://duffy.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/",
11 11

  
12
   "searchAPIURLLAst"     : "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/",
12
   "searchAPIURLLAst"     : "https://beta.services.openaire.eu/search/v2/api/",
13 13

  
14 14
  "searchResourcesAPIURL"     : "https://beta.services.openaire.eu/search/v2/api/resources",
15 15

  
16 16
  "openCitationsAPIURL" : "https://services.openaire.eu/opencitations/getCitations?id=",
17 17

  
18
  "csvAPIURL" : "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/reports",
18
  "csvAPIURL" : "https://beta.services.openaire.eu/search/v2/api/reports",
19 19

  
20 20
  "searchCrossrefAPIURL" : "https://api.crossref.org/works",
21 21
  "searchDataciteAPIURL" : "https://api.datacite.org/works",

Also available in: Unified diff