Project

General

Profile

1
//version compatibility: 1.1.1-SNAPSHOT
2
print("here");
3

    
4
function dropDB(){
5
print("\n\n Drop DB\n\n")
6
	db.dropDatabase()
7
}
8
function createCollections(){
9
print("\n\n Create Collections \n\n")
10
	db.createCollection("community")
11
	db.createCollection("layout")
12
	db.createCollection("divHelpContent")
13
	db.createCollection("divId")
14
	db.createCollection("entity")
15
	db.createCollection("page")
16
	db.createCollection("pageHelpContent")
17
	db.createCollection("statistics")
18
	db.createCollection("communitySubscribers")
19
	db.createCollection("htmlPageContent")
20
	db.createCollection("notifications")
21
	db.createCollection("subscriber")
22
	db.createCollection("curator")
23
}
24
function initializeEntitiesPagesDivIds(){
25
print("\n\n Initialize entities, pages & divIds \n\n")
26
	db.entity.save({"pid" : "publication", "name" : "Publication"})
27
	db.entity.save({"pid" : "dataset", "name" : "Research Data"})
28
	db.entity.save({"pid" : "software", "name" : "Software"})
29
	db.entity.save({"pid" : "orp", "name" : "Other Research Products"});
30
	db.entity.save({"pid" : "project", "name" : "Project"})
31
	db.entity.save({"pid" : "organization", "name" : "Organization"})
32
	db.entity.save({"pid" : "datasource", "name" : "Content Provider"})
33

    
34
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
35
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
36
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
37
	orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
38
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
39
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
40
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString()
41

    
42
	db.page.save({"name" : "Publication Landing", "route" : "/search/publication", "type" : "landing", "connect":true,"openaire":true,"entities" : [publicationId]})
43
	db.page.save({"name" : "Research Data Landing", "route" : "/search/dataset", "type" : "landing", "connect":true,"openaire":true,"entities" : [datasetId]})
44
	db.page.save({"name" : "Software Landing", "route" : "/search/software", "type" : "landing", "connect":true,"openaire":true,"entities" : [softwareId]})
45
	db.page.save({"name" : "Other Research Products Landing", "route" : "/search/other", "type" : "landing", "connect":true,"openaire":true,"entities" : [orpId]});
46
	db.page.save({"name" : "Project Landing", "route" : "/search/project", "type" : "landing", "connect":true,"openaire":true,"entities" : [projectId]})
47
	db.page.save({"name" : "Organization Landing", "route" : "/search/organization", "type" : "landing", "connect":true,"openaire":true,"entities" : [organizationId]})
48
	db.page.save({"name" : "Content Provider Landing", "route" : "/search/dataprovider", "type" : "landing", "connect":true,"openaire":true,"entities" : [datasourceId]})
49
	db.page.save({"name" : "Project Report", "route" : "/project-report", "type" : "landing", "connect":false,"openaire":true,"entities" : [projectId]})
50

    
51
	db.page.save({"name" : "Search Find", "type" : "search", "connect":false,"openaire":true,"entities" : [], "route" : "/search/find"})
52

    
53
	db.page.save({"name" : "Search Publications", "route" : "/search/find/publications", "type" : "search", "connect":true,"openaire":true,"entities" : [publicationId]})
54
	db.page.save({"name" : "Search Research Data", "route" : "/search/find/datasets", "type" : "search", "connect":true,"openaire":true,"entities" : [datasetId]})
55
	db.page.save({"name" : "Search Software", "route" : "/search/find/software", "type" : "search", "connect":true,"openaire":true,"entities" : [softwareId]})
56
	db.page.save({"name" : "Search Other Research Products", "route" : "/search/find/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
57
	db.page.save({"name" : "Search Projects", "route" : "/search/find/projects", "type" : "search", "connect":true,"openaire":true,"entities" : [projectId]})
58
	db.page.save({"name" : "Search Organizations", "route" : "/search/find/organizations", "type" : "search", "connect":false,"openaire":true,"entities" : [organizationId]})
59
	db.page.save({"name" : "Search Content Providers", "route" : "/search/find/dataproviders", "type" : "search", "connect":true,"openaire":true,"entities" : [datasourceId]})
60

    
61
	db.page.save({"name" : "Advanced Search Publications", "route" : "/search/advanced/publications", "type" : "search", "connect":true,"openaire":true,"entities" : [publicationId]})
62
	db.page.save({"name" : "Advanced Search Research Data ", "route" : "/search/advanced/datasets", "type" : "search", "connect":true,"openaire":true,"entities" : [datasetId]})
63
	db.page.save({"name" : "Advanced Search Software", "route" : "/search/advanced/software", "type" : "search", "connect":true,"openaire":true,"entities" : [softwareId]})
64
	db.page.save({"name" : "Advanced Search Other Research Products", "route" : "/search/advanced/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
65
	db.page.save({"name" : "Advanced Search Projects", "route" : "/search/advanced/projects", "type" : "search", "connect":false,"openaire":true,"entities" : [projectId]})
66
	db.page.save({"name" : "Advanced Search Organizations", "route" : "/search/advanced/organizations", "type" : "search", "connect":false,"openaire":true,"entities" : [organizationId]})
67
	db.page.save({"name" : "Advanced Search Content Providers", "route" : "/search/advanced/dataproviders", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
68

    
69
	db.page.save({"name" : "Search Journals", "route" : "/search/journals", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
70
	db.page.save({"name" : "Search Entity Registries", "route" : "/search/entity-registries", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
71
	db.page.save({"name" : "Search Compatible Content Providers", "route" : "/search/content-providers", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
72
	db.page.save({"name" : "Search Journals - Table view", "route" : "/search/journals-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
73
	db.page.save({"name" : "Search Entity Registries - Table view", "route" : "/search/entity-registries-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
74
	db.page.save({"name" : "Search Compatible Content Providers -Table view", "route" : "/search/content-providers-table", "type" : "search", "connect":false,"openaire":true,"entities" : [datasourceId]})
75

    
76
	db.page.save({"name" : "Deposit Publications", "route" : "/participate/deposit-publications", "type" : "share", "connect":true,"openaire":true,"entities" : [publicationId]})
77
	db.page.save({"name" : "Deposit Research Data", "route" : "/participate/deposit-datasets", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
78
	db.page.save({"name" : "Deposit Publications Results", "route" : "/participate/deposit-publications-result", "type" : "share", "connect":true,"openaire":true,"entities" : [publicationId]})
79
	db.page.save({"name" : "Deposit Research Data Results", "route" : "/participate/deposit-datasets-result", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
80
	db.page.save({"name" : "Deposit Research Data subject result", "route" : "/participate/deposit-subject-result", "type" : "share", "connect":true,"openaire":true,"entities" : [datasetId]})
81
	db.page.save({"name" : "Share in Zenodo", "route" : "/participate/share-zenodo", "type" : "share", "connect":true,"openaire":false,"entities" : []})
82

    
83
	db.page.save({"name" : "Link", "route" : "/participate/claim", "type" : "link", "connect":true,"openaire":true,"entities" : [projectId]})
84
	db.page.save({"name" : "Direct Link", "route" : "/participate/direct-claim", "type" : "link", "connect":true,"openaire":true,"entities" : []})
85
	db.page.save({"name" : "My claims", "route" : "/myclaims", "type" : "link", "connect":true,"openaire":true,"entities" : []})
86
	db.page.save({"name" : "Administrator claims", "route" : "/claims", "type" : "link", "connect":true,"openaire":true,"entities" : []})
87
	db.page.save({"name" : "Claims Project Manager", "route" : "/claims-project-manager", "type" : "link", "connect":false,"openaire":true,"entities" : []})
88

    
89
/*
90
	db.page.save({"name" : "Monitor", "route" : "/monitor", "type" : "other", "connect":true,"openaire":false,"entities" : []})
91
*/
92
	db.page.save({"name" : "Curators", "route" : "/curators", "type" : "other", "connect":true,"openaire":false,"entities" : []})
93

    
94
	db.page.save({"name" : "About", "route" : "/about", "type" : "html", "connect":true,"openaire":false,"entities" : []})
95
	db.page.save({"name" : "Organizations", "route" : "/organizations", "type" : "html", "connect":true,"openaire":false,"entities" : []})
96

    
97
    link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
98
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
99

    
100
	db.divId.save({ "name" : "link-context-form", "pages" : [link, directLink]})
101
    db.divId.save({ "name" : "link-project-form", "pages" : [link, directLink]})
102
    db.divId.save({ "name" : "link-result-form", "pages" : [link, directLink]})
103
    db.divId.save({ "name" : "link-result-bulk", "pages" : [link]})
104
    db.divId.save({ "name" : "link-metadata", "pages" : [link, directLink]})
105
}
106
function createCommunity(name,communityPid){
107
    var communitySaved =  db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
108
    if(communitySaved){
109
        print("\n\n Community \'"+name +"\' exists\n\n");
110
        return ;
111
    }
112
    print("\n\n Create community \n\n");
113
    print("Name:"+name);
114
    print("communityPid:"+communityPid);
115

    
116
	publicationLanding = db.page.find( { route: "/search/publication" }).map( function(page) { return page._id.str; } ).toString()
117
	datasetLanding = db.page.find( { route: "/search/dataset" }).map( function(page) { return page._id.str; } ).toString()
118
	softwareLanding = db.page.find( { route: "/search/software" }).map( function(page) { return page._id.str; } ).toString()
119
	orpLanding = db.page.find( { route: "/search/other" }).map( function(page) { return page._id.str; } ).toString();
120
	projectLanding = db.page.find( { route: "/search/project" }).map( function(page) { return page._id.str; } ).toString()
121
	organizationLanding = db.page.find( { route: "/search/organization" }).map( function(page) { return page._id.str; } ).toString()
122
	dataproviderLanding = db.page.find( { route: "/search/dataprovider" }).map( function(page) { return page._id.str; } ).toString()
123
	projectReport = db.page.find( { route: "/project-report" }).map( function(page) { return page._id.str; } ).toString()
124

    
125
	searchFind = db.page.find( { route: "/search/find" }).map( function(page) { return page._id.str; } ).toString()
126

    
127
	searchPublications = db.page.find( { route: "/search/find/publications" }).map( function(page) { return page._id.str; } ).toString()
128
	searchDatasets = db.page.find( { route: "/search/find/datasets" }).map( function(page) { return page._id.str; } ).toString()
129
	searchSoftware = db.page.find( { route: "/search/find/software" }).map( function(page) { return page._id.str; } ).toString()
130
	searchOrp = db.page.find( { route: "/search/find/other" }).map( function(page) { return page._id.str; } ).toString();
131
	searchProject = db.page.find( { route: "/search/find/projects" }).map( function(page) { return page._id.str; } ).toString()
132
	searchOrganization = db.page.find( { route: "/search/find/organizations" }).map( function(page) { return page._id.str; } ).toString()
133
	searchDataprovider = db.page.find( { route: "/search/find/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
134

    
135
	advancedSearchPublications = db.page.find( { route: "/search/advanced/publications" }).map( function(page) { return page._id.str; } ).toString()
136
	advancedSearchDatasets = db.page.find( { route: "/search/advanced/datasets" }).map( function(page) { return page._id.str; } ).toString()
137
	advancedSearchSoftware = db.page.find( { route: "/search/advanced/software" }).map( function(page) { return page._id.str; } ).toString()
138
	advancedSearchOrp = db.page.find( { route: "/search/advanced/other" }).map( function(page) { return page._id.str; } ).toString();
139
	advancedSearchProject = db.page.find( { route: "/search/advanced/projects" }).map( function(page) { return page._id.str; } ).toString()
140
	advancedSearchOrganization = db.page.find( { route: "/search/advanced/organizations" }).map( function(page) { return page._id.str; } ).toString()
141
	advancedSearchDataprovider = db.page.find( { route: "/search/advanced/dataproviders" }).map( function(page) { return page._id.str; } ).toString()
142

    
143
	searchJournals = db.page.find( { route: "/search/journals" }).map( function(page) { return page._id.str; } ).toString()
144
	searchEntityRegistries = db.page.find( { route: "/search/entity-registries" }).map( function(page) { return page._id.str; } ).toString()
145
	searchContentProviders = db.page.find( { route: "/search/content-providers" }).map( function(page) { return page._id.str; } ).toString()
146
	searchJournalsTable = db.page.find( { route: "/search/journals-table" }).map( function(page) { return page._id.str; } ).toString()
147
	searchEntityRegistriesTable = db.page.find( { route: "/search/entity-registries-table" }).map( function(page) { return page._id.str; } ).toString()
148
	searchContentProvidersTable = db.page.find( { route: "/search/content-providers-table" }).map( function(page) { return page._id.str; } ).toString()
149

    
150
	depositPublications = db.page.find( { route: "/participate/deposit-publications" }).map( function(page) { return page._id.str; } ).toString()
151
	depositDatasets = db.page.find( { route: "/participate/deposit-datasets" }).map( function(page) { return page._id.str; } ).toString()
152
	depositPublicationsResults = db.page.find( { route: "/participate/deposit-publications-result" }).map( function(page) { return page._id.str; } ).toString()
153
	depositDatasetsResults = db.page.find( { route: "/participate/deposit-datasets-result" }).map( function(page) { return page._id.str; } ).toString()
154
	depositDatasetSybjectResults = db.page.find( { route: "/participate/deposit-subject-result" }).map( function(page) { return page._id.str; } ).toString()
155
    shareInZenodo = db.page.find( { route: "/participate/share-zenodo" }).map( function(page) { return page._id.str; } ).toString();
156

    
157
	link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString()
158
	directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString()
159
	myClaims = db.page.find( { route: "/myclaims" }).map( function(page) { return page._id.str; } ).toString()
160
	administratorClaims = db.page.find( { route: "/claims" }).map( function(page) { return page._id.str; } ).toString()
161
	claimsProjectManager = db.page.find( { route: "/claims-project-manager" }).map( function(page) { return page._id.str; } ).toString()
162

    
163
/*
164
	monitor = db.page.find( { route: "/monitor" }).map( function(page) { return page._id.str; } ).toString()
165
*/
166
	curators = db.page.find( { route: "/curators" }).map( function(page) { return page._id.str; } ).toString()
167

    
168
	about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
169
	organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
170

    
171
	var community_pages = {}
172
	community_pages[publicationLanding] = true;
173
	community_pages[datasetLanding] = true;
174
	community_pages[softwareLanding] = true;
175
	community_pages[orpLanding] = true;
176
	community_pages[projectLanding] = true;
177
	community_pages[organizationLanding] = true;
178
	community_pages[dataproviderLanding] = true;
179
	community_pages[projectReport] = true;
180
	community_pages[searchFind] = true;
181
	community_pages[searchPublications] = true;
182
	community_pages[searchDatasets] = true;
183
	community_pages[searchSoftware] = true;
184
	community_pages[searchOrp] = true;
185
	community_pages[searchProject] = true;
186
	community_pages[searchOrganization] = true;
187
	community_pages[searchDataprovider] = true;
188
	community_pages[advancedSearchPublications] = true;
189
	community_pages[advancedSearchDatasets] = true;
190
	community_pages[advancedSearchSoftware] = true;
191
	community_pages[advancedSearchOrp] = true;
192
	community_pages[advancedSearchProject] = true;
193
	community_pages[advancedSearchOrganization] = true;
194
	community_pages[advancedSearchDataprovider] = true;
195
	community_pages[searchJournals] = true;
196
	community_pages[searchEntityRegistries] = true;
197
	community_pages[searchContentProviders] = true;
198
	community_pages[searchJournalsTable] = true;
199
	community_pages[searchEntityRegistriesTable] = true;
200
	community_pages[searchContentProvidersTable] = true;
201
	community_pages[depositPublications] = true;
202
	community_pages[depositDatasets] = true;
203
	community_pages[depositPublicationsResults] = true;
204
	community_pages[depositDatasetsResults] = true;
205
	community_pages[depositDatasetSybjectResults] = true;
206
	community_pages[shareInZenodo] = true;
207
	community_pages[link] = true;
208
	community_pages[directLink] = true;
209
	community_pages[myClaims] = true;
210
	community_pages[administratorClaims] = true;
211
	community_pages[claimsProjectManager] = true;
212
	// community_pages[monitor] = true;
213
	community_pages[curators] = false;
214
	community_pages[about] = false;
215
	community_pages[organizations] = false;
216

    
217
	publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString()
218
	datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString()
219
	softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString()
220
	orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
221
	projectId = db.entity.find( { pid: "project" }).map( function(entity) { return entity._id.str; } ).toString()
222
	organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString()
223
	datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString();
224
	print("PAges:"+publicationId);
225
	var community_entities = {}
226
	community_entities[publicationId] = true;
227
	community_entities[datasetId] = true;
228
	community_entities[softwareId] = true;
229
	community_entities[orpId] = true;
230
	community_entities[projectId] = true;
231
	community_entities[organizationId] = true;
232
	community_entities[datasourceId] = true;
233
	var layoutId = db.layout.insertOne({"color": "#EBB13E"}).insertedId.str;
234
	print("Layout:" + layoutId);
235
 	db.community.save({	"name" : name,
236
		"pid" : communityPid, "pages" : community_pages, "entities" : community_entities, "layout": layoutId})
237

    
238
	openaireCommunity = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
239

    
240
    var numbers_map = {};
241
        numbers_map["total"] = { "showInMonitor" : true, "showInDashboard" : false };
242
        numbers_map["project"] = { "showInMonitor" : true, "showInDashboard" : false };
243
        numbers_map["open"] = { "showInMonitor" : true, "showInDashboard" : false };
244
        numbers_map["closed"] = { "showInMonitor" : true, "showInDashboard" : false };
245
        numbers_map["embargo"] = { "showInMonitor" : true, "showInDashboard" : false };
246
        numbers_map["restricted"] = { "showInMonitor" : true, "showInDashboard" : false };
247
    var numbers = {"map":numbers_map};
248
    var charts_map = {};
249
        charts_map["timeline"] = { "showInMonitor" : true, "showInDashboard" : false };
250
        charts_map["graph"] = { "showInMonitor" : true, "showInDashboard" : false };
251
        charts_map["projectTable"] = { "showInMonitor" : true, "showInDashboard" : false };
252
        charts_map["projectColumn"] = { "showInMonitor" : true, "showInDashboard" : false };
253
        charts_map["projectPie"] = { "showInMonitor" : true, "showInDashboard" : false };
254
    var charts = {"map":charts_map};
255

    
256
	var statistics_entities = {"charts":charts,"numbers":numbers}
257
	var entities = {};
258
	entities["publication"]=statistics_entities;
259
	entities["dataset"]=statistics_entities;
260
	entities["software"]=statistics_entities;
261
    entities["orp"]=statistics_entities;
262
	var statistics = {"pid" : communityPid, "entities" : entities};
263

    
264
    db.statistics.save(statistics);
265

    
266
    var subscribers = [];
267
    db.communitySubscribers.save({ "pid" : communityPid, "subscribers" : subscribers})
268

    
269
    link_context_form = db.divId.find( { name: "link-context-form" }).map( function(divId) { return divId._id.str; } ).toString();
270
    link_project_form = db.divId.find( { name: "link-project-form" }).map( function(divId) { return divId._id.str; } ).toString();
271
    link_result_form = db.divId.find( { name: "link-result-form" }).map( function(divId) { return divId._id.str; } ).toString();
272
    link_result_bulk = db.divId.find( { name: "link-result-bulk" }).map( function(divId) { return divId._id.str; } ).toString();
273
    link_metadata = db.divId.find( { name: "link-metadata" }).map( function(divId) { return divId._id.str; } ).toString();
274

    
275
    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>';
276
    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>';
277
    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> ';
278
    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> ';
279
    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>';
280

    
281
    communityID = db.community.find({ "pid" : communityPid}).map( function(community) { return community._id.str.toString(); } );
282

    
283
    db.divHelpContent.save({ "divId" : link_context_form, "community" : communityID, "content" : link_context_form_content, "isActive" : false });
284
    db.divHelpContent.save({ "divId" : link_project_form, "community" : communityID, "content" : link_project_form_content, "isActive" : false });
285
    db.divHelpContent.save({ "divId" : link_result_form, "community" : communityID, "content" : link_result_form_content, "isActive" : true });
286
    db.divHelpContent.save({ "divId" : link_result_bulk, "community" : communityID, "content" : link_result_bulk_content, "isActive" : true });
287
    db.divHelpContent.save({ "divId" : link_metadata, "community" : communityID, "content" : link_metadata_content, "isActive" : false });
288

    
289
print("\n\n Done \n\n");
290

    
291
}
292
function createAllCommunities(){
293
    createCommunity("OpenAIRE","openaire");
294
    createCommunity("EGI Federation","egi");
295
    createCommunity("SDSN - Greece ","ee");
296
    createCommunity("Fisheries and Aquaculture Management","fam");
297
    createCommunity("Instruct-ERIC","instruct");
298
    createCommunity("Elixir","elixir-gr");
299
    createCommunity("European Marine Science","mes");
300
    createCommunity("EC post-grant Open Access Pilot","oa-pg");
301
    createCommunity("Neuroinformatics","ni");
302
    createCommunity("Research Data Alliance","rda");
303
    createCommunity("Digital Humanities and Cultural Heritage","dh-ch");
304
	createCommunity("AGINFRA","aginfra");
305
	createCommunity("Clarin","clarin");
306
	createCommunity("DARIAH EU", "dariah");
307
}
308

    
309
function addDefaultHtmlToHtmlPages() {
310
	about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
311
	organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
312

    
313
	communities = db.community.find().map( function(community) { return community._id.str.toString(); } );
314

    
315
	for (var i = 0; i < communities.length; i++) {
316
 		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>'})
317
 		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>'})
318
	}
319
}
320

    
321
use openaire_admin;
322

    
323
dropDB();
324
createCollections();
325
initializeEntitiesPagesDivIds();
326
createAllCommunities();
327
addDefaultHtmlToHtmlPages();
(2-2/4)