Skip to content

Commit 113196e

Browse files
committed
Merge branch 'rc' of https://github.com/BEXIS2/Core into rc
2 parents 3abad78 + 07c6453 commit 113196e

File tree

9 files changed

+317
-423
lines changed

9 files changed

+317
-423
lines changed

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Controllers/Api/CitationController.cs

Lines changed: 57 additions & 264 deletions
Large diffs are not rendered by default.

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Controllers/DataController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ public async Task<ActionResult> GetCitationOrTitle(long Id, long datasetVersionI
474474
return PartialView("_Title", datasetVersion.Title);
475475
}
476476

477-
var model = CitationsHelper.GetCitationDataModel(datasetVersionId);
477+
var model = CitationsHelper.CreateCitationDataModel(datasetVersion);
478478

479479
if (model == null)
480480
return PartialView("_Title", datasetVersion.Title);

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Ddm.Settings.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
"options": [],
6464
"type": "JSON",
6565
"value": {
66-
"publisher": "BEXIS2 DevOps Team",
67-
"instance": "BEXIS2 - DevOps Test",
6866
"numberOfAuthors": 0,
6967
"showCitation": true,
7068
"defaultViewCitationFormat": "Text",

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Helpers/CitationsHelper.cs

Lines changed: 161 additions & 100 deletions
Large diffs are not rendered by default.

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Helpers/DdmSeedDataGenerator.cs

Lines changed: 72 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using BExIS.Dim.Entities.Mappings;
22
using BExIS.Dim.Services.Mappings;
3+
using BExIS.Modules.Ddm.UI.Models;
34
using BExIS.Security.Entities.Authorization;
45
using BExIS.Security.Entities.Objects;
56
using BExIS.Security.Services.Authorization;
67
using BExIS.Security.Services.Objects;
8+
using System;
79
using System.Collections.Generic;
810
using System.Linq;
911
using Vaiona.Web.Mvc.Modularity;
@@ -190,50 +192,78 @@ private void createCitationMappingConcept()
190192
{
191193
using (var conceptManager = new ConceptManager())
192194
{
193-
// check if concept exist
194-
var concept = conceptManager.MappingConceptRepository.Query(c => c.Name.Equals("Citation")).FirstOrDefault();
195-
196-
var keys = new List<MappingKey>();
197-
198-
if (concept == null) //if not create
199-
concept = conceptManager.CreateMappingConcept("Citation", "The concept is needed to create a citation string", "", "");
200-
else // if exist load available keys
195+
foreach (CitationFormat value in Enum.GetValues(typeof(CitationFormat)))
201196
{
202-
keys = conceptManager.MappingKeyRepo.Query(k => k.Concept.Id.Equals(concept.Id)).ToList();
197+
var keys = new List<MappingKey>();
198+
// check if concept exist
199+
var concept = conceptManager.MappingConceptRepository.Query(c => c.Name.Equals("Citation_" + value)).FirstOrDefault();
200+
if (concept == null) //if not create
201+
concept = conceptManager.CreateMappingConcept("Citation_"+ value, "The concept is needed to create a " + value + " citation string", "", "");
202+
else // if exist load available keys
203+
{
204+
keys = conceptManager.MappingKeyRepo.Query(k => k.Concept.Id.Equals(concept.Id)).ToList();
205+
}
206+
207+
//title
208+
if (!keys.Any(k => k.Name.Equals("data/title")))
209+
conceptManager.CreateMappingKey("Title", "", "", false, false, "data/title", concept);
210+
//version
211+
if (!keys.Any(k => k.Name.Equals("data/version")))
212+
conceptManager.CreateMappingKey("Version", "", "", true, false, "data/version", concept);
213+
//year
214+
if (!keys.Any(k => k.Name.Equals("data/year")))
215+
conceptManager.CreateMappingKey("Year", "", "", true, false, "data/year", concept);
216+
217+
//entityType
218+
if (!keys.Any(k => k.Name.Equals("data/entityType")))
219+
conceptManager.CreateMappingKey("EntityType", "", "", true, false, "data/entityType", concept);
220+
221+
//entryType
222+
if (value == CitationFormat.Text)
223+
{
224+
if (!keys.Any(k => k.Name.Equals("data/entryType")))
225+
conceptManager.CreateMappingKey("EntryType", "", "", true, false, "data/entryType", concept);
226+
}
227+
else
228+
{
229+
if (!keys.Any(k => k.Name.Equals("data/entryType")))
230+
conceptManager.CreateMappingKey("EntryType", "", "", false, false, "data/entryType", concept);
231+
}
232+
233+
//publisher
234+
if (!keys.Any(k => k.Name.Equals("data/publisher")))
235+
conceptManager.CreateMappingKey("Publisher", "", "", false, false, "data/publisher", concept);
236+
237+
if (value == CitationFormat.Bibtex)
238+
{
239+
if (!keys.Any(k => k.Name.Equals("data/keyword")))
240+
conceptManager.CreateMappingKey("Keyword", "", "", false, false, "data/keyword", concept);
241+
}
242+
243+
//note
244+
if (!keys.Any(k => k.Name.Equals("data/note")))
245+
conceptManager.CreateMappingKey("Note", "", "", true, false, "data/note", concept);
246+
247+
//doi
248+
if (!keys.Any(k => k.Name.Equals("data/doi")))
249+
conceptManager.CreateMappingKey("DOI", "", "", true, false, "data/doi", concept);
250+
251+
//projects
252+
MappingKey projects = null;
253+
if (!keys.Any(k => k.Name.Equals("data/projects")))
254+
projects = conceptManager.CreateMappingKey("Projects", "", "", true, true, "data/projects", concept);
255+
256+
if (!keys.Any(k => k.Name.Equals("data/projects/project")))
257+
conceptManager.CreateMappingKey("Project", "", "", true, false, "data/projects/project", concept, projects);
258+
259+
//authors
260+
MappingKey authors = null;
261+
if (!keys.Any(k => k.Name.Equals("data/authorNames")))
262+
authors = conceptManager.CreateMappingKey("AuthorNames", "", "", false, true, "data/authorNames", concept);
263+
264+
if (!keys.Any(k => k.Name.Equals("data/authorNames/authorName")))
265+
conceptManager.CreateMappingKey("AuthorName", "", "", false, false, "data/authorNames/authorName", concept, authors);
203266
}
204-
205-
//title
206-
if (!keys.Any(k => k.Name.Equals("data/title")))
207-
conceptManager.CreateMappingKey("Title", "", "", false, false, "data/title", concept);
208-
//version
209-
if (!keys.Any(k => k.Name.Equals("data/version")))
210-
conceptManager.CreateMappingKey("Version", "", "", true, false, "data/version", concept);
211-
//year
212-
if (!keys.Any(k => k.Name.Equals("data/year")))
213-
conceptManager.CreateMappingKey("Year", "", "", true, false, "data/year", concept);
214-
//entityType
215-
if (!keys.Any(k => k.Name.Equals("data/entityType")))
216-
conceptManager.CreateMappingKey("EntityType", "", "", true, false, "data/entityType", concept);
217-
218-
//doi
219-
if (!keys.Any(k => k.Name.Equals("data/doi")))
220-
conceptManager.CreateMappingKey("Doi", "", "", true, false, "data/doi", concept);
221-
222-
//projects
223-
MappingKey projects = null;
224-
if (!keys.Any(k => k.Name.Equals("data/projects")))
225-
projects = conceptManager.CreateMappingKey("Projects", "", "", true, true, "data/projects", concept);
226-
227-
if (!keys.Any(k => k.Name.Equals("data/projects/project")))
228-
conceptManager.CreateMappingKey("Project", "", "", true, false, "data/projects/project", concept, projects);
229-
230-
//authors
231-
MappingKey authors = null;
232-
if (!keys.Any(k => k.Name.Equals("data/authorNames")))
233-
authors = conceptManager.CreateMappingKey("AuthorNames", "", "", false, true, "data/authorNames", concept);
234-
235-
if (!keys.Any(k => k.Name.Equals("data/authorNames/authorName")))
236-
conceptManager.CreateMappingKey("AuthorName", "", "", false, false, "data/authorNames/authorName", concept, authors);
237267
}
238268
}
239269
}

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Models/CitationModels.cs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum ReadCitationFormat
2323
Text
2424
}
2525

26-
public enum DownloadCitationFormat
26+
public enum CitationFormat
2727
{
2828
APA,
2929
RIS,
@@ -52,7 +52,6 @@ public class CitationDataModel
5252
public string Year { get; set; }
5353

5454
[XmlElement("doi")]
55-
[Obsolete]
5655
public string DOI { get; set; }
5756

5857
[XmlElement("url")]
@@ -65,16 +64,30 @@ public class CitationDataModel
6564
[MinCapacity(1), NoNullOrEmptyItems]
6665
public List<string> Authors { get; set; }
6766

68-
[XmlElement("entityType")]
69-
[Required(ErrorMessage = "Entity Type is required")]
70-
[MinLength(1, ErrorMessage = "Entity Type cannot be empty")]
71-
public string EntityType { get; set; }
67+
//[XmlElement("entityType")]
68+
//[Required(ErrorMessage = "Entity Type is required")]
69+
//[MinLength(1, ErrorMessage = "Entity Type cannot be empty")]
70+
//public string EntityType { get; set; }
71+
72+
[XmlElement("entryType")]
73+
[Required(ErrorMessage = "Entry Type is required")]
74+
[MinLength(1, ErrorMessage = "Entry Type cannot be empty")]
75+
public string EntryType { get; set; }
76+
77+
[XmlElement("entityName")]
78+
public string EntityName { get; set; }
7279

7380
[XmlElement("publisher")]
74-
[Required(ErrorMessage = "Title is required")]
75-
[MinLength(1, ErrorMessage = "Title cannot be empty")]
81+
[Required(ErrorMessage = "Publisher is required")]
82+
[MinLength(1, ErrorMessage = "Publisher cannot be empty")]
7683
public string Publisher { get; set; }
7784

85+
[XmlElement("keyword")]
86+
public string Keyword { get; set; }
87+
88+
[XmlElement("note")]
89+
public string Note { get; set; }
90+
7891
public CitationDataModel()
7992
{
8093
Authors = new List<string>();
@@ -96,7 +109,6 @@ public DatasetCitationEntry()
96109

97110
public string URL { get; set; }
98111
public string Publisher { get; set; }
99-
public string InstanceName { get; set; }
100112
public string Year { get; set; }
101113
public List<string> Authors { get; set; }
102114
public string Title { get; set; }
@@ -121,7 +133,7 @@ public class CitationSettings
121133
public int NumberOfAuthors { get; set; }
122134
public ReadCitationFormat ReadCitationFormat { get; set; }
123135

124-
public List<DownloadCitationFormat> DownloadCitationFormats { get; set; }
136+
public List<CitationFormat> DownloadCitationFormats { get; set; }
125137

126138
public CitationSettings()
127139
{
@@ -130,7 +142,7 @@ public CitationSettings()
130142
ShowCitation = false;
131143
NumberOfAuthors = 1;
132144
ReadCitationFormat = ReadCitationFormat.Text;
133-
DownloadCitationFormats = new List<DownloadCitationFormat>() { };
145+
DownloadCitationFormats = new List<CitationFormat>() { };
134146
}
135147
}
136148

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Views/Data/_Citation_Text.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@model BExIS.Modules.Ddm.UI.Models.CitationDataModel
22

3-
<div id="citation-container"><b>Citation:</b><div id="citation-title">@String.Join("; ", Model.Authors) (@(Model.Year)): <b>@(Model.Title)</b>. Version @(Model.Version). @(Model.Publisher). @(Model.EntityType). @(Model.URL) <span id="citation-copy" class="bx bx-copy" onclick="copyDivContentToClipboard('citation-title')"></span></div>
3+
<div id="citation-container"><b>Citation:</b><div id="citation-title">@String.Join("; ", Model.Authors) (@(Model.Year)): <b>@(Model.Title)</b>. Version @(Model.Version). @(Model.Publisher). @(Model.EntityName). @(Model.URL) <span id="citation-copy" class="bx bx-copy" onclick="copyDivContentToClipboard('citation-title')"></span></div>
44

55
</div>
66

Console/BExIS.Web.Shell/Views/Tokens/GetToken.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
<div class="col-md-6" style="word-wrap: break-word">
2121
@Html.LabelFor(m => m.Jwt)
2222
@Html.DisplayFor(m => m.Jwt)
23-
<button id="jwt-copy" class="bx bx-copy" onclick="myFunction()">Copy</button>
23+
<span id="jwt-copy" class="bx bx-copy" onclick="myFunction()"></span>
2424
</div>

Console/BExIS.Web.Shell/Views/Tokens/Read.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
<div class="col-md-6" style="word-wrap: break-word">
2121
@Html.LabelFor(m => m.Jwt)
2222
@Html.DisplayFor(m => m.Jwt)
23-
<button id="jwt-copy" class="bx bx-copy" onclick="myFunction()">Copy</button>
23+
<span id="jwt-copy" class="bx bx-copy" onclick="myFunction()"></span>
2424
</div>
2525

0 commit comments

Comments
 (0)