Project

General

Profile

1 52363 konstantin
//version compatibility: 1.1.0-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 51508 argiro.kok
}
20
function initializeEntitiesPagesDivIds(){
21
print("\n\n Initialize entities, pages & divIds \n\n")
22 50841 konstantin
	db.entity.save({"pid" : "publication", "name" : "Publication"})
23
	db.entity.save({"pid" : "dataset", "name" : "Research Data"})
24
	db.entity.save({"pid" : "software", "name" : "Software"})
25 53032 konstantin
	db.entity.save({"pid" : "orp", "name" : "Other Research Products"});
26 50841 konstantin
	db.entity.save({"pid" : "project", "name" : "Project"})
27
	db.entity.save({"pid" : "organization", "name" : "Organization"})
28
	db.entity.save({"pid" : "datasource", "name" : "Content Provider"})
29
30
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
31
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
32
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
33 53032 konstantin
	orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
34 50841 konstantin
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
35
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
36
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString()
37
38 51846 argiro.kok
	db.page.save({"name" : "Publication Landing", "route" : "/search/publication", "type" : "landing", "connect":true,"openaire":true,"entities" : [publicationId]})
39
	db.page.save({"name" : "Research Data Landing", "route" : "/search/dataset", "type" : "landing", "connect":true,"openaire":true,"entities" : [datasetId]})
40
	db.page.save({"name" : "Software Landing", "route" : "/search/software", "type" : "landing", "connect":true,"openaire":true,"entities" : [softwareId]})
41 53032 konstantin
	db.page.save({"name" : "Other Research Products Landing", "route" : "/search/other", "type" : "landing", "connect":true,"openaire":true,"entities" : [orpId]});
42 51846 argiro.kok
	db.page.save({"name" : "Project Landing", "route" : "/search/project", "type" : "landing", "connect":true,"openaire":true,"entities" : [projectId]})
43
	db.page.save({"name" : "Organization Landing", "route" : "/search/organization", "type" : "landing", "connect":true,"openaire":true,"entities" : [organizationId]})
44
	db.page.save({"name" : "Content Provider Landing", "route" : "/search/dataprovider", "type" : "landing", "connect":true,"openaire":true,"entities" : [datasourceId]})
45
	db.page.save({"name" : "Project Report", "route" : "/project-report", "type" : "landing", "connect":false,"openaire":true,"entities" : [projectId]})
46 50841 konstantin
47 51846 argiro.kok
	db.page.save({"name" : "Search Find", "type" : "search", "connect":false,"openaire":true,"entities" : [], "route" : "/search/find"})
48 50841 konstantin
49 51508 argiro.kok
	db.page.save({"name" : "Search Publications", "route" : "/search/find/publications", "type" : "search", "connect":true,"openaire":true,"entities" : [publicationId]})
50 52308 konstantin
	db.page.save({"name" : "Search Research Data", "route" : "/search/find/datasets", "type" : "search", "connect":true,"openaire":true,"entities" : [datasetId]})
51 51508 argiro.kok
	db.page.save({"name" : "Search Software", "route" : "/search/find/software", "type" : "search", "connect":true,"openaire":true,"entities" : [softwareId]})
52 53032 konstantin
	db.page.save({"name" : "Search Other Research Products", "route" : "/search/find/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
53 51508 argiro.kok
	db.page.save({"name" : "Search Projects", "route" : "/search/find/projects", "type" : "search", "connect":true,"openaire":true,"entities" : [projectId]})
54
	db.page.save({"name" : "Search Organizations", "route" : "/search/find/organizations", "type" : "search", "connect":false,"openaire":true,"entities" : [organizationId]})
55
	db.page.save({"name" : "Search Content Providers", "route" : "/search/find/dataproviders", "type" : "search", "connect":true,"openaire":true,"entities" : [datasourceId]})
56 50841 konstantin
57 51508 argiro.kok
	db.page.save({"name" : "Advanced Search Publications", "route" : "/search/advanced/publications", "type" : "search", "connect":true,"openaire":true,"entities" : [publicationId]})
58
	db.page.save({"name" : "Advanced Search Research Data ", "route" : "/search/advanced/datasets", "type" : "search", "connect":true,"openaire":true,"entities" : [datasetId]})
59
	db.page.save({"name" : "Advanced Search Software", "route" : "/search/advanced/software", "type" : "search", "connect":true,"openaire":true,"entities" : [softwareId]})
60 53032 konstantin
	db.page.save({"name" : "Advanced Search Other Research Products", "route" : "/search/advanced/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
61 51508 argiro.kok
	db.page.save({"name" : "Advanced Search Projects", "route" : "/search/advanced/projects", "type" : "search", "connect":false,"openaire":true,"entities" : [projectId]})
62
	db.page.save({"name" : "Advanced Search Organizations", "route" : "/search/advanced/organizations", "type" : "search", "connect":false,"openaire":true,"entities" : [organizationId]})
63
	db.page.save({"name" : "Advanced Search Content Providers", "route" : "/search/advanced/dataproviders", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
64 50841 konstantin
65 51508 argiro.kok
	db.page.save({"name" : "Search Journals", "route" : "/search/journals", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
66
	db.page.save({"name" : "Search Entity Registries", "route" : "/search/entity-registries", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
67
	db.page.save({"name" : "Search Compatible Content Providers", "route" : "/search/content-providers", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
68 52308 konstantin
	db.page.save({"name" : "Search Journals - Table view", "route" : "/search/journals-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
69 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]})
70
	db.page.save({"name" : "Search Compatible Content Providers -Table view", "route" : "/search/content-providers-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
71 50841 konstantin
72 51508 argiro.kok
	db.page.save({"name" : "Deposit Publications", "route" : "/participate/deposit-publications", "type" : "share", "connect":true,"openaire":true,"entities" : [publicationId]})
73
	db.page.save({"name" : "Deposit Research Data", "route" : "/participate/deposit-datasets", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
74
	db.page.save({"name" : "Deposit Publications Results", "route" : "/participate/deposit-publications-result", "type" : "share", "connect":true,"openaire":true,"entities" : [publicationId]})
75
	db.page.save({"name" : "Deposit Research Data Results", "route" : "/participate/deposit-datasets-result", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
76
	db.page.save({"name" : "Deposit Research Data subject result", "route" : "/participate/deposit-subject-result", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
77 50841 konstantin
78 51508 argiro.kok
	db.page.save({"name" : "Link", "route" : "/participate/claim", "type" : "link", "connect":true,"openaire":true,"entities" : [projectId]})
79
	db.page.save({"name" : "Direct Link", "route" : "/participate/direct-claim", "type" : "link", "connect":true,"openaire":true,"entities" : []})
80
	db.page.save({"name" : "My claims", "route" : "/myclaims", "type" : "link", "connect":true,"openaire":true,"entities" : []})
81
	db.page.save({"name" : "Administrator claims", "route" : "/claims", "type" : "link", "connect":true,"openaire":true,"entities" : []})
82
	db.page.save({"name" : "Claims Project Manager", "route" : "/claims-project-manager", "type" : "link", "connect":false,"openaire":true,"entities" : []})
83 50841 konstantin
84 52308 konstantin
	db.page.save({"name" : "Monitor", "route" : "/monitor", "type" : "other", "connect":true,"openaire":false,"entities" : []})
85 51508 argiro.kok
86 52308 konstantin
	db.page.save({"name" : "About", "route" : "/about", "type" : "html", "connect":true,"openaire":false,"entities" : []})
87
	db.page.save({"name" : "Organizations", "route" : "/organizations", "type" : "html", "connect":true,"openaire":false,"entities" : []})
88
89 51508 argiro.kok
    link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
90
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
91
92
	db.divId.save({ "name" : "link-context-form", "pages" : [link, directLink]})
93
    db.divId.save({ "name" : "link-project-form", "pages" : [link, directLink]})
94
    db.divId.save({ "name" : "link-result-form", "pages" : [link, directLink]})
95
    db.divId.save({ "name" : "link-result-bulk", "pages" : [link]})
96
    db.divId.save({ "name" : "link-metadata", "pages" : [link, directLink]})
97
}
98
function createCommunity(name,communityPid){
99 51529 argiro.kok
    var communitySaved =  db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
100
    if(communitySaved){
101
        print("\n\n Community \'"+name +"\' exists\n\n");
102
        return ;
103
    }
104
    print("\n\n Create community \n\n");
105
    print("Name:"+name);
106
    print("communityPid:"+communityPid);
107
108 50841 konstantin
	publicationLanding = db.page.find( { route: "/search/publication" }).map( function(page) { return page._id.str; } ).toString()
109
	datasetLanding = db.page.find( { route: "/search/dataset" }).map( function(page) { return page._id.str; } ).toString()
110
	softwareLanding = db.page.find( { route: "/search/software" }).map( function(page) { return page._id.str; } ).toString()
111 53032 konstantin
	orpLanding = db.page.find( { route: "/search/other" }).map( function(page) { return page._id.str; } ).toString();
112 50841 konstantin
	projectLanding = db.page.find( { route: "/search/project" }).map( function(page) { return page._id.str; } ).toString()
113
	organizationLanding = db.page.find( { route: "/search/organization" }).map( function(page) { return page._id.str; } ).toString()
114
	dataproviderLanding = db.page.find( { route: "/search/dataprovider" }).map( function(page) { return page._id.str; } ).toString()
115
	projectReport = db.page.find( { route: "/project-report" }).map( function(page) { return page._id.str; } ).toString()
116
117
	searchFind = db.page.find( { route: "/search/find" }).map( function(page) { return page._id.str; } ).toString()
118
119
	searchPublications = db.page.find( { route: "/search/find/publications" }).map( function(page) { return page._id.str; } ).toString()
120
	searchDatasets = db.page.find( { route: "/search/find/datasets" }).map( function(page) { return page._id.str; } ).toString()
121
	searchSoftware = db.page.find( { route: "/search/find/software" }).map( function(page) { return page._id.str; } ).toString()
122 53032 konstantin
	searchOrp = db.page.find( { route: "/search/find/other" }).map( function(page) { return page._id.str; } ).toString();
123 50841 konstantin
	searchProject = db.page.find( { route: "/search/find/projects" }).map( function(page) { return page._id.str; } ).toString()
124
	searchOrganization = db.page.find( { route: "/search/find/organizations" }).map( function(page) { return page._id.str; } ).toString()
125
	searchDataprovider = db.page.find( { route: "/search/find/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
126
127
	advancedSearchPublications = db.page.find( { route: "/search/advanced/publications" }).map( function(page) { return page._id.str; } ).toString()
128
	advancedSearchDatasets = db.page.find( { route: "/search/advanced/datasets" }).map( function(page) { return page._id.str; } ).toString()
129
	advancedSearchSoftware = db.page.find( { route: "/search/advanced/software" }).map( function(page) { return page._id.str; } ).toString()
130 53032 konstantin
	advancedSearchOrp = db.page.find( { route: "/search/advanced/other" }).map( function(page) { return page._id.str; } ).toString();
131 50841 konstantin
	advancedSearchProject = db.page.find( { route: "/search/advanced/projects" }).map( function(page) { return page._id.str; } ).toString()
132
	advancedSearchOrganization = db.page.find( { route: "/search/advanced/organizations" }).map( function(page) { return page._id.str; } ).toString()
133
	advancedSearchDataprovider = db.page.find( { route: "/search/advanced/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
134
135
	searchJournals = db.page.find( { route: "/search/journals" }).map( function(page) { return page._id.str; } ).toString()
136
	searchEntityRegistries = db.page.find( { route: "/search/entity-registries" }).map( function(page) { return page._id.str; } ).toString()
137
	searchContentProviders = db.page.find( { route: "/search/content-providers" }).map( function(page) { return page._id.str; } ).toString()
138
	searchJournalsTable = db.page.find( { route: "/search/journals-table" }).map( function(page) { return page._id.str; } ).toString()
139
	searchEntityRegistriesTable = db.page.find( { route: "/search/entity-registries-table" }).map( function(page) { return page._id.str; } ).toString()
140
	searchContentProvidersTable = db.page.find( { route: "/search/content-providers-table" }).map( function(page) { return page._id.str; } ).toString()
141
142
	depositPublications = db.page.find( { route: "/participate/deposit-publications" }).map( function(page) { return page._id.str; } ).toString()
143
	depositDatasets = db.page.find( { route: "/participate/deposit-datasets" }).map( function(page) { return page._id.str; } ).toString()
144
	depositPublicationsResults = db.page.find( { route: "/participate/deposit-publications-result" }).map( function(page) { return page._id.str; } ).toString()
145
	depositDatasetsResults = db.page.find( { route: "/participate/deposit-datasets-result" }).map( function(page) { return page._id.str; } ).toString()
146
	depositDatasetSybjectResults = db.page.find( { route: "/participate/deposit-subject-result" }).map( function(page) { return page._id.str; } ).toString()
147
148
	link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
149
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
150
	myClaims = db.page.find( { route: "/myclaims" }).map( function(page) { return page._id.str; } ).toString()
151
	administratorClaims = db.page.find( { route: "/claims" }).map( function(page) { return page._id.str; } ).toString()
152
	claimsProjectManager = db.page.find( { route: "/claims-project-manager" }).map( function(page) { return page._id.str; } ).toString()
153
154 52308 konstantin
	monitor = db.page.find( { route: "/monitor" }).map( function(page) { return page._id.str; } ).toString()
155
156
	about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
157
	organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
158
159 50841 konstantin
	var community_pages = {}
160
	community_pages[publicationLanding] = true;
161
	community_pages[datasetLanding] = true;
162
	community_pages[softwareLanding] = true;
163 53032 konstantin
	community_pages[orpLanding] = true;
164 50841 konstantin
	community_pages[projectLanding] = true;
165
	community_pages[organizationLanding] = true;
166
	community_pages[dataproviderLanding] = true;
167
	community_pages[projectReport] = true;
168
	community_pages[searchFind] = true;
169
	community_pages[searchPublications] = true;
170
	community_pages[searchDatasets] = true;
171
	community_pages[searchSoftware] = true;
172 53032 konstantin
	community_pages[searchOrp] = true;
173 50841 konstantin
	community_pages[searchProject] = true;
174 52363 konstantin
	community_pages[searchOrganization] = true;
175 50841 konstantin
	community_pages[searchDataprovider] = true;
176
	community_pages[advancedSearchPublications] = true;
177 52363 konstantin
	community_pages[advancedSearchDatasets] = true;
178 50841 konstantin
	community_pages[advancedSearchSoftware] = true;
179 53032 konstantin
	community_pages[advancedSearchOrp] = true;
180 50841 konstantin
	community_pages[advancedSearchProject] = true;
181
	community_pages[advancedSearchOrganization] = true;
182
	community_pages[advancedSearchDataprovider] = true;
183
	community_pages[searchJournals] = true;
184 52363 konstantin
	community_pages[searchEntityRegistries] = true;
185 50841 konstantin
	community_pages[searchContentProviders] = true;
186
	community_pages[searchJournalsTable] = true;
187
	community_pages[searchEntityRegistriesTable] = true;
188 52363 konstantin
	community_pages[searchContentProvidersTable] = true;
189
	community_pages[depositPublications] = true;
190 50841 konstantin
	community_pages[depositDatasets] = true;
191
	community_pages[depositPublicationsResults] = true;
192
	community_pages[depositDatasetsResults] = true;
193
	community_pages[depositDatasetSybjectResults] = true;
194
	community_pages[link] = true;
195
	community_pages[directLink] = true;
196
	community_pages[myClaims] = true;
197
	community_pages[administratorClaims] = true;
198
	community_pages[claimsProjectManager] = true;
199 52308 konstantin
	community_pages[monitor] = true;
200 52897 argiro.kok
	community_pages[about] = false;
201
	community_pages[organizations] = false;
202 50841 konstantin
203 51508 argiro.kok
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
204
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
205
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
206 53032 konstantin
	orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
207 51508 argiro.kok
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
208
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
209 52897 argiro.kok
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString();
210
	print("PAges:"+publicationId);
211 50841 konstantin
	var community_entities = {}
212
	community_entities[publicationId] = true;
213
	community_entities[datasetId] = true;
214
	community_entities[softwareId] = true;
215 53032 konstantin
	community_entities[orpId] = true;
216 50841 konstantin
	community_entities[projectId] = true;
217
	community_entities[organizationId] = true;
218
	community_entities[datasourceId] = true;
219 50973 konstantin
220 51508 argiro.kok
 	db.community.save({	"name" : name, "pid" : communityPid, "pages" : community_pages, "entities" : community_entities})
221
222 51273 argiro.kok
	openaireCommunity = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
223 50973 konstantin
224 51340 konstantin
    var numbers_map = {};
225
        numbers_map["total"] = { "showInMonitor" : true, "showInDashboard" : false };
226
        numbers_map["project"] = { "showInMonitor" : true, "showInDashboard" : false };
227
        numbers_map["open"] = { "showInMonitor" : true, "showInDashboard" : false };
228
        numbers_map["closed"] = { "showInMonitor" : true, "showInDashboard" : false };
229
        numbers_map["embargo"] = { "showInMonitor" : true, "showInDashboard" : false };
230
        numbers_map["restricted"] = { "showInMonitor" : true, "showInDashboard" : false };
231
    var numbers = {"map":numbers_map};
232
    var charts_map = {};
233
        charts_map["timeline"] = { "showInMonitor" : true, "showInDashboard" : false };
234
        charts_map["graph"] = { "showInMonitor" : true, "showInDashboard" : false };
235
        charts_map["projectTable"] = { "showInMonitor" : true, "showInDashboard" : false };
236
        charts_map["projectColumn"] = { "showInMonitor" : true, "showInDashboard" : false };
237
        charts_map["projectPie"] = { "showInMonitor" : true, "showInDashboard" : false };
238
    var charts = {"map":charts_map};
239 51032 argiro.kok
240 51273 argiro.kok
	var statistics_entities = {"charts":charts,"numbers":numbers}
241
	var entities = {};
242
	entities["publication"]=statistics_entities;
243
	entities["dataset"]=statistics_entities;
244 51508 argiro.kok
	entities["software"]=statistics_entities;
245 51273 argiro.kok
	var statistics = {"pid" : communityPid, "entities" : entities};
246 51032 argiro.kok
247 51273 argiro.kok
    db.statistics.save(statistics);
248 51032 argiro.kok
249 51049 argiro.kok
    var subscribers = [];
250
    db.communitySubscribers.save({ "pid" : communityPid, "subscribers" : subscribers})
251 51846 argiro.kok
252
    link_context_form = db.divId.find( { name: "link-context-form" }).map( function(divId) { return divId._id.str; } ).toString();
253
    link_project_form = db.divId.find( { name: "link-project-form" }).map( function(divId) { return divId._id.str; } ).toString();
254
    link_result_form = db.divId.find( { name: "link-result-form" }).map( function(divId) { return divId._id.str; } ).toString();
255
    link_result_bulk = db.divId.find( { name: "link-result-bulk" }).map( function(divId) { return divId._id.str; } ).toString();
256
    link_metadata = db.divId.find( { name: "link-metadata" }).map( function(divId) { return divId._id.str; } ).toString();
257
258
    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>';
259
    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>';
260
    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> ';
261
    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> ';
262
    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>';
263
264 51850 argiro.kok
    communityID = db.community.find({ "pid" : communityPid}).map( function(community) { return community._id.str.toString(); } );
265 51846 argiro.kok
266 51850 argiro.kok
    db.divHelpContent.save({ "divId" : link_context_form, "community" : communityID, "content" : link_context_form_content, "isActive" : false });
267
    db.divHelpContent.save({ "divId" : link_project_form, "community" : communityID, "content" : link_project_form_content, "isActive" : false });
268
    db.divHelpContent.save({ "divId" : link_result_form, "community" : communityID, "content" : link_result_form_content, "isActive" : true });
269
    db.divHelpContent.save({ "divId" : link_result_bulk, "community" : communityID, "content" : link_result_bulk_content, "isActive" : true });
270
    db.divHelpContent.save({ "divId" : link_metadata, "community" : communityID, "content" : link_metadata_content, "isActive" : false });
271
272 51508 argiro.kok
print("\n\n Done \n\n");
273 51049 argiro.kok
274 51529 argiro.kok
}
275
function createAllCommunities(){
276
    createCommunity("OpenAIRE","openaire");
277
    createCommunity("EGI Federation","egi");
278 52897 argiro.kok
    createCommunity("SDSN - Greece ","ee");
279 51529 argiro.kok
    createCommunity("Fisheries and Aquaculture Management","fam");
280
    createCommunity("Instruct-ERIC","instruct");
281
    createCommunity("Elixir","elixir-gr");
282 52897 argiro.kok
    createCommunity("European Marine Science","mes");
283 51529 argiro.kok
    createCommunity("EC post-grant Open Access Pilot","oa-pg");
284
    createCommunity("Neuroinformatics","ni");
285
    createCommunity("Research Data Alliance","rda");
286
    createCommunity("Digital Humanities and Cultural Heritage","dh-ch");
287 52897 argiro.kok
	createCommunity("AGINFRA","aginfra");
288 52308 konstantin
	createCommunity("Clarin","clarin");
289
}
290 51508 argiro.kok
291 52308 konstantin
function addDefaultHtmlToHtmlPages() {
292
	about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
293
	organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
294
295
	communities = db.community.find().map( function(community) { return community._id.str.toString(); } );
296
297
	for (var i = 0; i < communities.length; i++) {
298 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>'})
299
 		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>'})
300 52308 konstantin
	}
301 51529 argiro.kok
}
302 52308 konstantin
303 51529 argiro.kok
use openaire_admin;
304
305 51846 argiro.kok
dropDB();
306
createCollections();
307
initializeEntitiesPagesDivIds();
308 52363 konstantin
createAllCommunities();
309 52308 konstantin
addDefaultHtmlToHtmlPages();