Project

General

Profile

1 53555 konstantin
//version compatibility: 1.1.1-SNAPSHOT
2 51529 argiro.kok
print("here");
3 50973 konstantin
4 51508 argiro.kok
function dropDB(){
5
print("\n\n Drop DB\n\n")
6 50841 konstantin
	db.dropDatabase()
7
}
8 51508 argiro.kok
function createCollections(){
9
print("\n\n Create Collections \n\n")
10 50841 konstantin
	db.createCollection("community")
11
	db.createCollection("divHelpContent")
12
	db.createCollection("divId")
13
	db.createCollection("entity")
14
	db.createCollection("page")
15
	db.createCollection("pageHelpContent")
16 51032 argiro.kok
	db.createCollection("statistics")
17 51340 konstantin
	db.createCollection("communitySubscribers")
18 52308 konstantin
	db.createCollection("htmlPageContent")
19 53555 konstantin
	db.createCollection("notifications")
20 51508 argiro.kok
}
21
function initializeEntitiesPagesDivIds(){
22
print("\n\n Initialize entities, pages & divIds \n\n")
23 50841 konstantin
	db.entity.save({"pid" : "publication", "name" : "Publication"})
24
	db.entity.save({"pid" : "dataset", "name" : "Research Data"})
25
	db.entity.save({"pid" : "software", "name" : "Software"})
26 53032 konstantin
	db.entity.save({"pid" : "orp", "name" : "Other Research Products"});
27 50841 konstantin
	db.entity.save({"pid" : "project", "name" : "Project"})
28
	db.entity.save({"pid" : "organization", "name" : "Organization"})
29
	db.entity.save({"pid" : "datasource", "name" : "Content Provider"})
30
31
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
32
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
33
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
34 53032 konstantin
	orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
35 50841 konstantin
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
36
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
37
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString()
38
39 51846 argiro.kok
	db.page.save({"name" : "Publication Landing", "route" : "/search/publication", "type" : "landing", "connect":true,"openaire":true,"entities" : [publicationId]})
40
	db.page.save({"name" : "Research Data Landing", "route" : "/search/dataset", "type" : "landing", "connect":true,"openaire":true,"entities" : [datasetId]})
41
	db.page.save({"name" : "Software Landing", "route" : "/search/software", "type" : "landing", "connect":true,"openaire":true,"entities" : [softwareId]})
42 53032 konstantin
	db.page.save({"name" : "Other Research Products Landing", "route" : "/search/other", "type" : "landing", "connect":true,"openaire":true,"entities" : [orpId]});
43 51846 argiro.kok
	db.page.save({"name" : "Project Landing", "route" : "/search/project", "type" : "landing", "connect":true,"openaire":true,"entities" : [projectId]})
44
	db.page.save({"name" : "Organization Landing", "route" : "/search/organization", "type" : "landing", "connect":true,"openaire":true,"entities" : [organizationId]})
45
	db.page.save({"name" : "Content Provider Landing", "route" : "/search/dataprovider", "type" : "landing", "connect":true,"openaire":true,"entities" : [datasourceId]})
46
	db.page.save({"name" : "Project Report", "route" : "/project-report", "type" : "landing", "connect":false,"openaire":true,"entities" : [projectId]})
47 50841 konstantin
48 51846 argiro.kok
	db.page.save({"name" : "Search Find", "type" : "search", "connect":false,"openaire":true,"entities" : [], "route" : "/search/find"})
49 50841 konstantin
50 51508 argiro.kok
	db.page.save({"name" : "Search Publications", "route" : "/search/find/publications", "type" : "search", "connect":true,"openaire":true,"entities" : [publicationId]})
51 52308 konstantin
	db.page.save({"name" : "Search Research Data", "route" : "/search/find/datasets", "type" : "search", "connect":true,"openaire":true,"entities" : [datasetId]})
52 51508 argiro.kok
	db.page.save({"name" : "Search Software", "route" : "/search/find/software", "type" : "search", "connect":true,"openaire":true,"entities" : [softwareId]})
53 53032 konstantin
	db.page.save({"name" : "Search Other Research Products", "route" : "/search/find/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
54 51508 argiro.kok
	db.page.save({"name" : "Search Projects", "route" : "/search/find/projects", "type" : "search", "connect":true,"openaire":true,"entities" : [projectId]})
55
	db.page.save({"name" : "Search Organizations", "route" : "/search/find/organizations", "type" : "search", "connect":false,"openaire":true,"entities" : [organizationId]})
56
	db.page.save({"name" : "Search Content Providers", "route" : "/search/find/dataproviders", "type" : "search", "connect":true,"openaire":true,"entities" : [datasourceId]})
57 50841 konstantin
58 51508 argiro.kok
	db.page.save({"name" : "Advanced Search Publications", "route" : "/search/advanced/publications", "type" : "search", "connect":true,"openaire":true,"entities" : [publicationId]})
59
	db.page.save({"name" : "Advanced Search Research Data ", "route" : "/search/advanced/datasets", "type" : "search", "connect":true,"openaire":true,"entities" : [datasetId]})
60
	db.page.save({"name" : "Advanced Search Software", "route" : "/search/advanced/software", "type" : "search", "connect":true,"openaire":true,"entities" : [softwareId]})
61 53032 konstantin
	db.page.save({"name" : "Advanced Search Other Research Products", "route" : "/search/advanced/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
62 51508 argiro.kok
	db.page.save({"name" : "Advanced Search Projects", "route" : "/search/advanced/projects", "type" : "search", "connect":false,"openaire":true,"entities" : [projectId]})
63
	db.page.save({"name" : "Advanced Search Organizations", "route" : "/search/advanced/organizations", "type" : "search", "connect":false,"openaire":true,"entities" : [organizationId]})
64
	db.page.save({"name" : "Advanced Search Content Providers", "route" : "/search/advanced/dataproviders", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
65 50841 konstantin
66 51508 argiro.kok
	db.page.save({"name" : "Search Journals", "route" : "/search/journals", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
67
	db.page.save({"name" : "Search Entity Registries", "route" : "/search/entity-registries", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
68
	db.page.save({"name" : "Search Compatible Content Providers", "route" : "/search/content-providers", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
69 52308 konstantin
	db.page.save({"name" : "Search Journals - Table view", "route" : "/search/journals-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
70 51508 argiro.kok
	db.page.save({"name" : "Search Entity Registries - Table view", "route" : "/search/entity-registries-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
71
	db.page.save({"name" : "Search Compatible Content Providers -Table view", "route" : "/search/content-providers-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
72 50841 konstantin
73 51508 argiro.kok
	db.page.save({"name" : "Deposit Publications", "route" : "/participate/deposit-publications", "type" : "share", "connect":true,"openaire":true,"entities" : [publicationId]})
74
	db.page.save({"name" : "Deposit Research Data", "route" : "/participate/deposit-datasets", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
75
	db.page.save({"name" : "Deposit Publications Results", "route" : "/participate/deposit-publications-result", "type" : "share", "connect":true,"openaire":true,"entities" : [publicationId]})
76
	db.page.save({"name" : "Deposit Research Data Results", "route" : "/participate/deposit-datasets-result", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
77
	db.page.save({"name" : "Deposit Research Data subject result", "route" : "/participate/deposit-subject-result", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
78 53936 konstantin
	db.page.save({"name" : "Share in Zenodo", "route" : "/participate/share-zenodo", "type" : "share", "connect":true,"openaire":false,"entities" : []})
79 50841 konstantin
80 51508 argiro.kok
	db.page.save({"name" : "Link", "route" : "/participate/claim", "type" : "link", "connect":true,"openaire":true,"entities" : [projectId]})
81
	db.page.save({"name" : "Direct Link", "route" : "/participate/direct-claim", "type" : "link", "connect":true,"openaire":true,"entities" : []})
82
	db.page.save({"name" : "My claims", "route" : "/myclaims", "type" : "link", "connect":true,"openaire":true,"entities" : []})
83
	db.page.save({"name" : "Administrator claims", "route" : "/claims", "type" : "link", "connect":true,"openaire":true,"entities" : []})
84
	db.page.save({"name" : "Claims Project Manager", "route" : "/claims-project-manager", "type" : "link", "connect":false,"openaire":true,"entities" : []})
85 50841 konstantin
86 52308 konstantin
	db.page.save({"name" : "Monitor", "route" : "/monitor", "type" : "other", "connect":true,"openaire":false,"entities" : []})
87 51508 argiro.kok
88 52308 konstantin
	db.page.save({"name" : "About", "route" : "/about", "type" : "html", "connect":true,"openaire":false,"entities" : []})
89
	db.page.save({"name" : "Organizations", "route" : "/organizations", "type" : "html", "connect":true,"openaire":false,"entities" : []})
90
91 51508 argiro.kok
    link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
92
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
93
94
	db.divId.save({ "name" : "link-context-form", "pages" : [link, directLink]})
95
    db.divId.save({ "name" : "link-project-form", "pages" : [link, directLink]})
96
    db.divId.save({ "name" : "link-result-form", "pages" : [link, directLink]})
97
    db.divId.save({ "name" : "link-result-bulk", "pages" : [link]})
98
    db.divId.save({ "name" : "link-metadata", "pages" : [link, directLink]})
99
}
100
function createCommunity(name,communityPid){
101 51529 argiro.kok
    var communitySaved =  db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
102
    if(communitySaved){
103
        print("\n\n Community \'"+name +"\' exists\n\n");
104
        return ;
105
    }
106
    print("\n\n Create community \n\n");
107
    print("Name:"+name);
108
    print("communityPid:"+communityPid);
109
110 50841 konstantin
	publicationLanding = db.page.find( { route: "/search/publication" }).map( function(page) { return page._id.str; } ).toString()
111
	datasetLanding = db.page.find( { route: "/search/dataset" }).map( function(page) { return page._id.str; } ).toString()
112
	softwareLanding = db.page.find( { route: "/search/software" }).map( function(page) { return page._id.str; } ).toString()
113 53032 konstantin
	orpLanding = db.page.find( { route: "/search/other" }).map( function(page) { return page._id.str; } ).toString();
114 50841 konstantin
	projectLanding = db.page.find( { route: "/search/project" }).map( function(page) { return page._id.str; } ).toString()
115
	organizationLanding = db.page.find( { route: "/search/organization" }).map( function(page) { return page._id.str; } ).toString()
116
	dataproviderLanding = db.page.find( { route: "/search/dataprovider" }).map( function(page) { return page._id.str; } ).toString()
117
	projectReport = db.page.find( { route: "/project-report" }).map( function(page) { return page._id.str; } ).toString()
118
119
	searchFind = db.page.find( { route: "/search/find" }).map( function(page) { return page._id.str; } ).toString()
120
121
	searchPublications = db.page.find( { route: "/search/find/publications" }).map( function(page) { return page._id.str; } ).toString()
122
	searchDatasets = db.page.find( { route: "/search/find/datasets" }).map( function(page) { return page._id.str; } ).toString()
123
	searchSoftware = db.page.find( { route: "/search/find/software" }).map( function(page) { return page._id.str; } ).toString()
124 53032 konstantin
	searchOrp = db.page.find( { route: "/search/find/other" }).map( function(page) { return page._id.str; } ).toString();
125 50841 konstantin
	searchProject = db.page.find( { route: "/search/find/projects" }).map( function(page) { return page._id.str; } ).toString()
126
	searchOrganization = db.page.find( { route: "/search/find/organizations" }).map( function(page) { return page._id.str; } ).toString()
127
	searchDataprovider = db.page.find( { route: "/search/find/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
128
129
	advancedSearchPublications = db.page.find( { route: "/search/advanced/publications" }).map( function(page) { return page._id.str; } ).toString()
130
	advancedSearchDatasets = db.page.find( { route: "/search/advanced/datasets" }).map( function(page) { return page._id.str; } ).toString()
131
	advancedSearchSoftware = db.page.find( { route: "/search/advanced/software" }).map( function(page) { return page._id.str; } ).toString()
132 53032 konstantin
	advancedSearchOrp = db.page.find( { route: "/search/advanced/other" }).map( function(page) { return page._id.str; } ).toString();
133 50841 konstantin
	advancedSearchProject = db.page.find( { route: "/search/advanced/projects" }).map( function(page) { return page._id.str; } ).toString()
134
	advancedSearchOrganization = db.page.find( { route: "/search/advanced/organizations" }).map( function(page) { return page._id.str; } ).toString()
135
	advancedSearchDataprovider = db.page.find( { route: "/search/advanced/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
136
137
	searchJournals = db.page.find( { route: "/search/journals" }).map( function(page) { return page._id.str; } ).toString()
138
	searchEntityRegistries = db.page.find( { route: "/search/entity-registries" }).map( function(page) { return page._id.str; } ).toString()
139
	searchContentProviders = db.page.find( { route: "/search/content-providers" }).map( function(page) { return page._id.str; } ).toString()
140
	searchJournalsTable = db.page.find( { route: "/search/journals-table" }).map( function(page) { return page._id.str; } ).toString()
141
	searchEntityRegistriesTable = db.page.find( { route: "/search/entity-registries-table" }).map( function(page) { return page._id.str; } ).toString()
142
	searchContentProvidersTable = db.page.find( { route: "/search/content-providers-table" }).map( function(page) { return page._id.str; } ).toString()
143
144
	depositPublications = db.page.find( { route: "/participate/deposit-publications" }).map( function(page) { return page._id.str; } ).toString()
145
	depositDatasets = db.page.find( { route: "/participate/deposit-datasets" }).map( function(page) { return page._id.str; } ).toString()
146
	depositPublicationsResults = db.page.find( { route: "/participate/deposit-publications-result" }).map( function(page) { return page._id.str; } ).toString()
147
	depositDatasetsResults = db.page.find( { route: "/participate/deposit-datasets-result" }).map( function(page) { return page._id.str; } ).toString()
148
	depositDatasetSybjectResults = db.page.find( { route: "/participate/deposit-subject-result" }).map( function(page) { return page._id.str; } ).toString()
149 53936 konstantin
    shareInZenodo = db.page.find( { route: "/participate/share-zenodo" }).map( function(page) { return page._id.str; } ).toString();
150 50841 konstantin
151
	link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
152
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
153
	myClaims = db.page.find( { route: "/myclaims" }).map( function(page) { return page._id.str; } ).toString()
154
	administratorClaims = db.page.find( { route: "/claims" }).map( function(page) { return page._id.str; } ).toString()
155
	claimsProjectManager = db.page.find( { route: "/claims-project-manager" }).map( function(page) { return page._id.str; } ).toString()
156
157 52308 konstantin
	monitor = db.page.find( { route: "/monitor" }).map( function(page) { return page._id.str; } ).toString()
158
159
	about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
160
	organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
161
162 50841 konstantin
	var community_pages = {}
163
	community_pages[publicationLanding] = true;
164
	community_pages[datasetLanding] = true;
165
	community_pages[softwareLanding] = true;
166 53032 konstantin
	community_pages[orpLanding] = true;
167 50841 konstantin
	community_pages[projectLanding] = true;
168
	community_pages[organizationLanding] = true;
169
	community_pages[dataproviderLanding] = true;
170
	community_pages[projectReport] = true;
171
	community_pages[searchFind] = true;
172
	community_pages[searchPublications] = true;
173
	community_pages[searchDatasets] = true;
174
	community_pages[searchSoftware] = true;
175 53032 konstantin
	community_pages[searchOrp] = true;
176 50841 konstantin
	community_pages[searchProject] = true;
177 52363 konstantin
	community_pages[searchOrganization] = true;
178 50841 konstantin
	community_pages[searchDataprovider] = true;
179
	community_pages[advancedSearchPublications] = true;
180 52363 konstantin
	community_pages[advancedSearchDatasets] = true;
181 50841 konstantin
	community_pages[advancedSearchSoftware] = true;
182 53032 konstantin
	community_pages[advancedSearchOrp] = true;
183 50841 konstantin
	community_pages[advancedSearchProject] = true;
184
	community_pages[advancedSearchOrganization] = true;
185
	community_pages[advancedSearchDataprovider] = true;
186
	community_pages[searchJournals] = true;
187 52363 konstantin
	community_pages[searchEntityRegistries] = true;
188 50841 konstantin
	community_pages[searchContentProviders] = true;
189
	community_pages[searchJournalsTable] = true;
190
	community_pages[searchEntityRegistriesTable] = true;
191 52363 konstantin
	community_pages[searchContentProvidersTable] = true;
192
	community_pages[depositPublications] = true;
193 50841 konstantin
	community_pages[depositDatasets] = true;
194
	community_pages[depositPublicationsResults] = true;
195
	community_pages[depositDatasetsResults] = true;
196
	community_pages[depositDatasetSybjectResults] = true;
197 53936 konstantin
	community_pages[shareInZenodo] = true;
198 50841 konstantin
	community_pages[link] = true;
199
	community_pages[directLink] = true;
200
	community_pages[myClaims] = true;
201
	community_pages[administratorClaims] = true;
202
	community_pages[claimsProjectManager] = true;
203 52308 konstantin
	community_pages[monitor] = true;
204 52897 argiro.kok
	community_pages[about] = false;
205
	community_pages[organizations] = false;
206 50841 konstantin
207 51508 argiro.kok
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
208
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
209
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
210 53032 konstantin
	orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
211 51508 argiro.kok
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
212
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
213 52897 argiro.kok
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString();
214
	print("PAges:"+publicationId);
215 50841 konstantin
	var community_entities = {}
216
	community_entities[publicationId] = true;
217
	community_entities[datasetId] = true;
218
	community_entities[softwareId] = true;
219 53032 konstantin
	community_entities[orpId] = true;
220 50841 konstantin
	community_entities[projectId] = true;
221
	community_entities[organizationId] = true;
222
	community_entities[datasourceId] = true;
223 50973 konstantin
224 51508 argiro.kok
 	db.community.save({	"name" : name, "pid" : communityPid, "pages" : community_pages, "entities" : community_entities})
225
226 51273 argiro.kok
	openaireCommunity = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
227 50973 konstantin
228 51340 konstantin
    var numbers_map = {};
229
        numbers_map["total"] = { "showInMonitor" : true, "showInDashboard" : false };
230
        numbers_map["project"] = { "showInMonitor" : true, "showInDashboard" : false };
231
        numbers_map["open"] = { "showInMonitor" : true, "showInDashboard" : false };
232
        numbers_map["closed"] = { "showInMonitor" : true, "showInDashboard" : false };
233
        numbers_map["embargo"] = { "showInMonitor" : true, "showInDashboard" : false };
234
        numbers_map["restricted"] = { "showInMonitor" : true, "showInDashboard" : false };
235
    var numbers = {"map":numbers_map};
236
    var charts_map = {};
237
        charts_map["timeline"] = { "showInMonitor" : true, "showInDashboard" : false };
238
        charts_map["graph"] = { "showInMonitor" : true, "showInDashboard" : false };
239
        charts_map["projectTable"] = { "showInMonitor" : true, "showInDashboard" : false };
240
        charts_map["projectColumn"] = { "showInMonitor" : true, "showInDashboard" : false };
241
        charts_map["projectPie"] = { "showInMonitor" : true, "showInDashboard" : false };
242
    var charts = {"map":charts_map};
243 51032 argiro.kok
244 51273 argiro.kok
	var statistics_entities = {"charts":charts,"numbers":numbers}
245
	var entities = {};
246
	entities["publication"]=statistics_entities;
247
	entities["dataset"]=statistics_entities;
248 51508 argiro.kok
	entities["software"]=statistics_entities;
249 53564 argiro.kok
    entities["orp"]=statistics_entities;
250 51273 argiro.kok
	var statistics = {"pid" : communityPid, "entities" : entities};
251 51032 argiro.kok
252 51273 argiro.kok
    db.statistics.save(statistics);
253 51032 argiro.kok
254 51049 argiro.kok
    var subscribers = [];
255
    db.communitySubscribers.save({ "pid" : communityPid, "subscribers" : subscribers})
256 51846 argiro.kok
257
    link_context_form = db.divId.find( { name: "link-context-form" }).map( function(divId) { return divId._id.str; } ).toString();
258
    link_project_form = db.divId.find( { name: "link-project-form" }).map( function(divId) { return divId._id.str; } ).toString();
259
    link_result_form = db.divId.find( { name: "link-result-form" }).map( function(divId) { return divId._id.str; } ).toString();
260
    link_result_bulk = db.divId.find( { name: "link-result-bulk" }).map( function(divId) { return divId._id.str; } ).toString();
261
    link_metadata = db.divId.find( { name: "link-metadata" }).map( function(divId) { return divId._id.str; } ).toString();
262
263
    link_context_form_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info">&nbsp;</span> Information:</span> Select a research community and/or a category and search for a community concept, or browse to the community tree through the categories</div> </div>';
264
    link_project_form_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info">&nbsp;</span> Information:</span> Search for projects using project name or grant id. Limit results filtering by funder.</div> </div>';
265
    link_result_form_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info">&nbsp;</span> Information:</span></div> Search for research results in OpenAIRE information space, Datacite, CrossRef or ORCID. <div class="uk-text-small">Use keywords, DOI (more than one - space separated), author&#39;s ORCID</div> </div> ';
266
    link_result_bulk_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info">&nbsp;</span> Information:</span> Upload a csv file containing a list of DOIs. For each DOI found in the file, metadata will be fetched from CrossRef or Datacite and will be added to your selected research results.</div> <div class="uk-margin-top uk-text-small"><span class="uk-text-bold">CSV format:</span> <ul class="uk-list"> <li>The format of CSV file should be &quot;DOI&quot;,&quot;ACCESS_MODE&quot;,&quot;DATE&quot;.</li> <li>The value &quot;DOI&quot; is required</li> <li>Access mode column should have values: &quot;OPEN&quot;,&quot;CLOSED&quot; or &quot;EMBARGO&quot;.</li> <li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li> <li>In case access mode is not available default value is &quot;OPEN&quot;.</li> </ul> </div> </div> ';
267
    link_metadata_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info">&nbsp;</span> Information:</span> Manage access mode &amp; type of selected research results. For OpenAIRE this functionality isn&#39;t available.</div> </div>';
268
269 51850 argiro.kok
    communityID = db.community.find({ "pid" : communityPid}).map( function(community) { return community._id.str.toString(); } );
270 51846 argiro.kok
271 51850 argiro.kok
    db.divHelpContent.save({ "divId" : link_context_form, "community" : communityID, "content" : link_context_form_content, "isActive" : false });
272
    db.divHelpContent.save({ "divId" : link_project_form, "community" : communityID, "content" : link_project_form_content, "isActive" : false });
273
    db.divHelpContent.save({ "divId" : link_result_form, "community" : communityID, "content" : link_result_form_content, "isActive" : true });
274
    db.divHelpContent.save({ "divId" : link_result_bulk, "community" : communityID, "content" : link_result_bulk_content, "isActive" : true });
275
    db.divHelpContent.save({ "divId" : link_metadata, "community" : communityID, "content" : link_metadata_content, "isActive" : false });
276
277 51508 argiro.kok
print("\n\n Done \n\n");
278 51049 argiro.kok
279 51529 argiro.kok
}
280
function createAllCommunities(){
281
    createCommunity("OpenAIRE","openaire");
282
    createCommunity("EGI Federation","egi");
283 52897 argiro.kok
    createCommunity("SDSN - Greece ","ee");
284 51529 argiro.kok
    createCommunity("Fisheries and Aquaculture Management","fam");
285
    createCommunity("Instruct-ERIC","instruct");
286
    createCommunity("Elixir","elixir-gr");
287 52897 argiro.kok
    createCommunity("European Marine Science","mes");
288 51529 argiro.kok
    createCommunity("EC post-grant Open Access Pilot","oa-pg");
289
    createCommunity("Neuroinformatics","ni");
290
    createCommunity("Research Data Alliance","rda");
291
    createCommunity("Digital Humanities and Cultural Heritage","dh-ch");
292 52897 argiro.kok
	createCommunity("AGINFRA","aginfra");
293 52308 konstantin
	createCommunity("Clarin","clarin");
294
}
295 51508 argiro.kok
296 52308 konstantin
function addDefaultHtmlToHtmlPages() {
297
	about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
298
	organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
299
300
	communities = db.community.find().map( function(community) { return community._id.str.toString(); } );
301
302
	for (var i = 0; i < communities.length; i++) {
303 52897 argiro.kok
 		db.htmlPageContent.save({"page" : about, "community" : communities[i], "content" : '<div><div class="uk-article-title custom-article-title"> About the community </div> <p> This is an introductory text. To be updated... </p> </div>'})
304
 		db.htmlPageContent.save({"page" : organizations, "community" : communities[i], "content" : '<div><div class="uk-article-title custom-article-title"> Organizations related to the community </div> <p> This is an introductory text. Here follows the list of organizations... </p> <div class="uk-child-width-1-3@m uk-text-center uk-grid-match " uk-grid > <div class="uk-card uk-card-default uk-margin-bottom uk-padding-remove"> <div class="uk-card-media-top"> <img src="https://upload.wikimedia.org/wikipedia/el/2/2b/Logo_uoa_blue.png" alt="" class="uk-height-small uk-responsive-height "> </div> <div class="uk-card-body"> <h3 class="uk-card-title"> <a class="wk-link-reset" href="https://www.uoa.gr/">University of Athens</a> </h3> </div> </div> <div class="uk-card uk-card-default uk-margin-bottom uk-padding-remove"> <div class="uk-card-media-top"> <img src="https://pbs.twimg.com/profile_images/631127495933165569/ElbqhHK0_400x400.jpg" alt="" class="uk-height-small uk-responsive-height "> </div> <div class="uk-card-body"> <h3 class="uk-card-title"> <a class="wk-link-reset" href="https://www.athena-innovation.gr/en">Athena Research & Innovation center</a> </h3> </div> </div> <div class="uk-card uk-card-default uk-margin-bottom uk-padding-remove"> <div class="uk-card-media-top"> <img src="" alt="Logo 1" class="uk-height-small uk-responsive-height "> </div> <div class="uk-card-body"> <h3 class="uk-card-title"> <a class="wk-link-reset" href="">Organization 1</a> </h3> </div> </div> <div class="uk-card uk-card-default uk-margin-bottom uk-padding-remove"> <div class="uk-card-media-top"> <img src="" alt="Logo 2" class="uk-height-small uk-responsive-height "> </div> <div class="uk-card-body"> <h3 class="uk-card-title"> <a class="wk-link-reset" href="">Organization 2</a> </h3> </div> </div> <div class="uk-card uk-card-default uk-margin-bottom uk-padding-remove"> <div class="uk-card-media-top"> <img src="" alt="Logo 3" class="uk-height-small uk-responsive-height "> </div> <div class="uk-card-body"> <h3 class="uk-card-title"> <a class="wk-link-reset" href="">Organization 3</a> </h3> </div> </div> </div></div>'})
305 52308 konstantin
	}
306 51529 argiro.kok
}
307 52308 konstantin
308 51529 argiro.kok
use openaire_admin;
309
310 51846 argiro.kok
dropDB();
311
createCollections();
312
initializeEntitiesPagesDivIds();
313 52363 konstantin
createAllCommunities();
314 52308 konstantin
addDefaultHtmlToHtmlPages();