1
|
//version compatibility: 1.1.1-SNAPSHOT
|
2
|
|
3
|
//function createOtherResearchProducts() {
|
4
|
// db.entity.save({"pid" : "orp", "name" : "Other Research Products"});
|
5
|
// orpId = db.entity.find( { pid: "orp" }).map( function(entity) { return entity._id.str; } ).toString();
|
6
|
//
|
7
|
// db.page.save({"name" : "Other Research Products Landing", "route" : "/search/other", "type" : "landing", "connect":true,"openaire":true,"entities" : [orpId]});
|
8
|
// db.page.save({"name" : "Search Other Research Products", "route" : "/search/find/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
|
9
|
// db.page.save({"name" : "Advanced Search Other Research Products", "route" : "/search/advanced/other", "type" : "search", "connect":true,"openaire":true,"entities" : [orpId]});
|
10
|
//
|
11
|
// orpLanding = db.page.find( { route: "/search/other" }).map( function(page) { return page._id.str; } ).toString();
|
12
|
// searchOrp = db.page.find( { route: "/search/find/other" }).map( function(page) { return page._id.str; } ).toString();
|
13
|
// advancedSearchOrp = db.page.find( { route: "/search/advanced/other" }).map( function(page) { return page._id.str; } ).toString();
|
14
|
//
|
15
|
// communities = db.community.find().map( function(community) { return community; } );
|
16
|
//
|
17
|
// for (var i = 0; i < communities.length; i++) {
|
18
|
// community_pages = communities[i].pages;
|
19
|
//
|
20
|
// community_pages[orpLanding] = true;
|
21
|
// community_pages[searchOrp] = true;
|
22
|
// community_pages[advancedSearchOrp] = true;
|
23
|
//
|
24
|
// community_pid = communities[i].pid;
|
25
|
// db.community.update({ "pid" : community_pid },{$set: { "pages": community_pages}});
|
26
|
// print("Update pages for " + community_pid);
|
27
|
//
|
28
|
// community_entities = communities[i].entities;
|
29
|
//
|
30
|
// community_entities[orpId] = true;
|
31
|
//
|
32
|
// community_pid = communities[i].pid;
|
33
|
// db.community.update({ "pid" : community_pid },{$set: { "entities": community_entities}});
|
34
|
// print("Update entities for " + community_pid);
|
35
|
// }
|
36
|
//}
|
37
|
|
38
|
function createNotificationsCollection() {
|
39
|
db.createCollection("notifications");
|
40
|
}
|
41
|
|
42
|
function addDivHelpContentsForCommunity(communityPid) {
|
43
|
link_context_form = db.divId.find( { name: "link-context-form" }).map( function(divId) { return divId._id.str; } ).toString();
|
44
|
link_project_form = db.divId.find( { name: "link-project-form" }).map( function(divId) { return divId._id.str; } ).toString();
|
45
|
link_result_form = db.divId.find( { name: "link-result-form" }).map( function(divId) { return divId._id.str; } ).toString();
|
46
|
link_result_bulk = db.divId.find( { name: "link-result-bulk" }).map( function(divId) { return divId._id.str; } ).toString();
|
47
|
link_metadata = db.divId.find( { name: "link-metadata" }).map( function(divId) { return divId._id.str; } ).toString();
|
48
|
|
49
|
link_context_form_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info"> </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>';
|
50
|
link_project_form_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info"> </span> Information:</span> Search for projects using project name or grant id. Limit results filtering by funder.</div> </div>';
|
51
|
link_result_form_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info"> </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's ORCID</div> </div> ';
|
52
|
link_result_bulk_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info"> </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 "DOI","ACCESS_MODE","DATE".</li> <li>The value "DOI" is required</li> <li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</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 "OPEN".</li> </ul> </div> </div> ';
|
53
|
link_metadata_content = '<div> <div><span class="uk-text-bold"><span uk-icon="icon: info"> </span> Information:</span> Manage access mode & type of selected research results. For OpenAIRE this functionality isn't available.</div> </div>';
|
54
|
|
55
|
communityID = db.community.find({ "pid" : communityPid}).map( function(community) { return community._id.str.toString(); } );
|
56
|
|
57
|
db.divHelpContent.save({ "divId" : link_context_form, "community" : communityID, "content" : link_context_form_content, "isActive" : false });
|
58
|
db.divHelpContent.save({ "divId" : link_project_form, "community" : communityID, "content" : link_project_form_content, "isActive" : false });
|
59
|
db.divHelpContent.save({ "divId" : link_result_form, "community" : communityID, "content" : link_result_form_content, "isActive" : true });
|
60
|
db.divHelpContent.save({ "divId" : link_result_bulk, "community" : communityID, "content" : link_result_bulk_content, "isActive" : true });
|
61
|
db.divHelpContent.save({ "divId" : link_metadata, "community" : communityID, "content" : link_metadata_content, "isActive" : false });
|
62
|
}
|
63
|
|
64
|
function addDefaultHtmlToHtmlPagesForCommunity(communityPid) {
|
65
|
about = db.page.find( { route: "/about" }).map( function(page) { return page._id.str; } ).toString()
|
66
|
organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
|
67
|
|
68
|
communityID = db.community.find({ "pid" : communityPid}).map( function(community) { return community._id.str.toString(); } );
|
69
|
|
70
|
db.htmlPageContent.save({"page" : about, "community" : communityID, "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>'})
|
71
|
db.htmlPageContent.save({"page" : organizations, "community" : communityID, "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>'})
|
72
|
}
|
73
|
|
74
|
function addORPInStatistics() {
|
75
|
|
76
|
communitiesStatistics = db.statistics.find().map( function(community) { return community; } );
|
77
|
|
78
|
for (var i = 0; i < communitiesStatistics.length; i++) {
|
79
|
|
80
|
stats =communitiesStatistics[i]
|
81
|
print("stats " + stats.pid);
|
82
|
var numbers_map = {};
|
83
|
numbers_map["total"] = { "showInMonitor" : true, "showInDashboard" : false };
|
84
|
numbers_map["project"] = { "showInMonitor" : true, "showInDashboard" : false };
|
85
|
numbers_map["open"] = { "showInMonitor" : true, "showInDashboard" : false };
|
86
|
numbers_map["closed"] = { "showInMonitor" : true, "showInDashboard" : false };
|
87
|
numbers_map["embargo"] = { "showInMonitor" : true, "showInDashboard" : false };
|
88
|
numbers_map["restricted"] = { "showInMonitor" : true, "showInDashboard" : false };
|
89
|
var numbers = {"map":numbers_map};
|
90
|
var charts_map = {};
|
91
|
charts_map["timeline"] = { "showInMonitor" : true, "showInDashboard" : false };
|
92
|
charts_map["graph"] = { "showInMonitor" : true, "showInDashboard" : false };
|
93
|
charts_map["projectTable"] = { "showInMonitor" : true, "showInDashboard" : false };
|
94
|
charts_map["projectColumn"] = { "showInMonitor" : true, "showInDashboard" : false };
|
95
|
charts_map["projectPie"] = { "showInMonitor" : true, "showInDashboard" : false };
|
96
|
var charts = {"map":charts_map};
|
97
|
|
98
|
var statistics_entities = {"charts":charts,"numbers":numbers}
|
99
|
var orp ="orp";
|
100
|
stats.entities[orp]=statistics_entities;
|
101
|
|
102
|
db.statistics.update({ "pid" : stats.pid },{$set: { "entities": stats.entities}});
|
103
|
// db.statistics.update(stats);
|
104
|
|
105
|
}
|
106
|
}
|
107
|
|
108
|
function createShareInZenodoPage() {
|
109
|
db.page.save({"name" : "Share in Zenodo", "route" : "/participate/share-zenodo", "type" : "share", "connect":true,"openaire":false,"entities" : []});
|
110
|
shareInZenodo = db.page.find( { route: "/participate/share-zenodo" }).map( function(page) { return page._id.str; } ).toString();
|
111
|
communities = db.community.find().map( function(community) { return community; } );
|
112
|
|
113
|
for (var i = 0; i < communities.length; i++) {
|
114
|
community_pages = communities[i].pages;
|
115
|
|
116
|
community_pages[shareInZenodo] = true;
|
117
|
|
118
|
community_pid = communities[i].pid;
|
119
|
db.community.update({ "pid" : community_pid },{$set: { "pages": community_pages}});
|
120
|
print("Update pages for " + community_pid);
|
121
|
}
|
122
|
}
|
123
|
|
124
|
function addCommunityLayout() {
|
125
|
db.createCollection("layout");
|
126
|
communities = db.community.find().map( function(community) { return community; } );
|
127
|
for (var i = 0; i < communities.length; i++) {
|
128
|
var layoutId = db.layout.insertOne({"color": "#EBB13E"}).insertedId.str;
|
129
|
community_pid = communities[i].pid;
|
130
|
db.community.update({ "pid" : community_pid }, {$set: {"layout": layoutId}});
|
131
|
print("Creating layout for " + community_pid);
|
132
|
}
|
133
|
}
|
134
|
|
135
|
function addCuratorsPage() {
|
136
|
curatorsId = db.page.insertOne({"name" : "Curators", "route" : "/curators", "type" : "other", "connect":true,"openaire":false,"entities" : []}).insertedId.str;
|
137
|
print("Creating curators page with id " + curatorsId);
|
138
|
communities = db.community.find().map( function(community) { return community; } );
|
139
|
for (var i = 0; i < communities.length; i++) {
|
140
|
community_pages = communities[i].pages;
|
141
|
|
142
|
community_pages[curatorsId] = false;
|
143
|
|
144
|
community_pid = communities[i].pid;
|
145
|
db.community.update({ "pid" : community_pid },{$set: { "pages": community_pages}});
|
146
|
print("Add curators page with id " + curatorsId + " on community " + community_pid);
|
147
|
}
|
148
|
}
|
149
|
|
150
|
function removeMonitorPage() {
|
151
|
monitor = db.page.find( { route: "/monitor" }).map( function(page) { return page._id.str; } ).toString()
|
152
|
db.page.remove({"route" : "/monitor"});
|
153
|
print("Remove Monitor page with id " + monitor);
|
154
|
communities = db.community.find().map( function(community) { return community; } );
|
155
|
for (var i = 0; i < communities.length; i++) {
|
156
|
community_pages = communities[i].pages;
|
157
|
|
158
|
delete community_pages[monitor];
|
159
|
|
160
|
community_pid = communities[i].pid;
|
161
|
db.community.update({ "pid" : community_pid },{$set: { "pages": community_pages}});
|
162
|
print("Remove monitor page with id " + monitor + " on community " + community_pid);
|
163
|
}
|
164
|
}
|
165
|
|
166
|
function pageOptionConnectAsCommunities() {
|
167
|
pages = db.page.find().map( function(page) { return page; } );
|
168
|
for (var i = 0; i < pages.length; i++) {
|
169
|
page = pages[i];
|
170
|
|
171
|
db.page.update(
|
172
|
{ "_id" : page._id },
|
173
|
{ $set: {"communities": page.connect, "connect": false}}
|
174
|
);
|
175
|
}
|
176
|
}
|
177
|
|
178
|
function organizationsPageTypeFromHtmlToOther() {
|
179
|
db.page.update(
|
180
|
{ "route" : "/organizations" },
|
181
|
{ $set: {"type": "other"}}
|
182
|
);
|
183
|
}
|
184
|
|
185
|
|
186
|
function removeHtmlPageContentsFromOrganizationsPage() {
|
187
|
organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString();
|
188
|
db.htmlPageContent.remove({"page" : organizations});
|
189
|
}
|
190
|
|
191
|
function addOpenaireConnectCommunitiesOptionsInDivIds() {
|
192
|
db.divId.updateMany(
|
193
|
{ },
|
194
|
{ $set: {"connect":false,"communities":false,"openaire":true}}
|
195
|
);
|
196
|
}
|
197
|
|
198
|
function addHomeNewsAndOrganizationsDivIds() {
|
199
|
home = db.page.find( { route: "/" }).map( function(page) { return page._id.str; } ).toString();
|
200
|
organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString()
|
201
|
|
202
|
db.divId.save({ "name" : "home-news", "pages" : [home], "connect":true,"communities":false,"openaire":true});
|
203
|
print("divId home-news saved");
|
204
|
db.divId.save({ "name" : "organizations", "pages" : [organizations], "connect":false,"communities":true,"openaire":false});
|
205
|
print("divId organizations saved");
|
206
|
|
207
|
organizations_class = db.divId.find( { name: "organizations" }).map( function(divId) { return divId._id.str; } ).toString();
|
208
|
organizations_class_content = '<div> <p>Here you can write more details about the organizations related to your community.</p> </div>';
|
209
|
|
210
|
communities = db.community.find().map( function(community) { return community; } );
|
211
|
for (var i = 0; i < communities.length; i++) {
|
212
|
community = communities[i];
|
213
|
if(community.pid != "openaire" && community.pid != "connect") {
|
214
|
//print(community.pid);
|
215
|
db.divHelpContent.save({
|
216
|
"divId": organizations_class,
|
217
|
"community": community._id.str,
|
218
|
"content": organizations_class_content,
|
219
|
"isActive": false
|
220
|
});
|
221
|
}
|
222
|
}
|
223
|
}
|
224
|
|
225
|
function removeLinkingDivHelpContentsForCommunitiesAndConnect() {
|
226
|
link_context_form = db.divId.find( { name: "link-context-form" }).map( function(divId) { return divId._id.str; } ).toString();
|
227
|
link_project_form = db.divId.find( { name: "link-project-form" }).map( function(divId) { return divId._id.str; } ).toString();
|
228
|
link_result_form = db.divId.find( { name: "link-result-form" }).map( function(divId) { return divId._id.str; } ).toString();
|
229
|
link_result_bulk = db.divId.find( { name: "link-result-bulk" }).map( function(divId) { return divId._id.str; } ).toString();
|
230
|
link_metadata = db.divId.find( { name: "link-metadata" }).map( function(divId) { return divId._id.str; } ).toString();
|
231
|
|
232
|
communities = db.community.find().map( function(community) { return community; } );
|
233
|
for (var i = 0; i < communities.length; i++) {
|
234
|
community = communities[i];
|
235
|
if(community.pid != "openaire") {
|
236
|
db.divHelpContent.remove({"divId" : link_context_form, "community" : community._id.str});
|
237
|
db.divHelpContent.remove({"divId" : link_project_form, "community" : community._id.str});
|
238
|
db.divHelpContent.remove({"divId" : link_result_form, "community" : community._id.str});
|
239
|
db.divHelpContent.remove({"divId" : link_result_bulk, "community" : community._id.str});
|
240
|
db.divHelpContent.remove({"divId" : link_metadata, "community" : community._id.str});
|
241
|
}
|
242
|
}
|
243
|
}
|
244
|
|
245
|
use openaire_admin;
|
246
|
|
247
|
//updatePages();
|
248
|
|
249
|
//updateTypeOfLandingPages();
|
250
|
//removeEntitiesFromSearchFindPage();
|
251
|
//initDivHelpContents();
|
252
|
|
253
|
//createContentPageWithTypeOther();
|
254
|
//createPagesWithTypeHtml();
|
255
|
//addContent_About_Organizations_PagesToCommunities();
|
256
|
//createCollectionForHtmlPageContents();
|
257
|
//addDefaultHtmlToHtmlPages();
|
258
|
|
259
|
//createMonitorPageWithTypeOther();
|
260
|
//addMonitorPageToCommunities();
|
261
|
|
262
|
//createOtherResearchProducts();
|
263
|
|
264
|
//addDefaultHtmlToHtmlPagesForCommunity("clarin");
|
265
|
//createNotificationsCollection();
|
266
|
//addDivHelpContentsForCommunity("clarin");
|
267
|
//addORPInStatistics();
|
268
|
//createShareInZenodoPage();
|
269
|
//addCommunityLayout();
|
270
|
//addCuratorsPage();
|
271
|
//removeMonitorPage();
|
272
|
|
273
|
//pageOptionConnectAsCommunities();
|
274
|
|
275
|
organizationsPageTypeFromHtmlToOther();
|
276
|
removeHtmlPageContentsFromOrganizationsPage();
|
277
|
addOpenaireConnectCommunitiesOptionsInDivIds();
|
278
|
addHomeNewsAndOrganizationsDivIds();
|
279
|
removeLinkingDivHelpContentsForCommunitiesAndConnect();
|