Project

General

Profile

1
//version compatibility: 2.0.0-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">&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>';
50
//     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>';
51
//     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> ';
52
//     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> ';
53
//     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>';
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
function addPositionsInPages() {
246
  print("Add positions in Pages\n");
247

    
248
  // Other Pages
249
  db.page.update({ route: "/" },{ $set: {"top":true,"bottom":true,"right":false,"left":true}});
250
  print("Positions for 'Other Pages' updated");
251

    
252
  // Other Pages for Connect
253
  db.page.update({ route: "/about/learn-how" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
254
  db.page.update({ route: "/about/learn-in-depth" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
255
  db.page.update({ route: "/contact-us" },{ $set: {"top":false,"bottom":false,"right":true,"left":false}});
256
  db.page.update({ route: "/content" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
257

    
258
  db.page.update({ route: "/curators" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
259
  db.page.update({ route: "/organizations" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
260
  db.page.update({ route : "/invite" }, { $set: {"top":true,"bottom":false,"right":false,"left":false}});
261
  print("Positions for 'Other Pages for Connect' updated");
262

    
263
  // Testing Page for help contents (Connect)
264
  db.page.update({ route : "/helper-test"}, { $set: {"top":true,"bottom":false,"right":false,"left":false}});
265
  print("Positions for 'Testing Page for help contents (Connect)' updated");
266

    
267
  // Other Pages for Explore
268
  db.page.update({ route: "/mail-preferences" },{ $set: {"top":true,"bottom":true,"right":true,"left":true}});
269
  print("Positions for 'Other Pages for Explore' updated");
270

    
271
  // Landing Pages
272
  db.page.update({ route: "/search/publication" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
273
  db.page.update({ route: "/search/dataset" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
274
  db.page.update({ route: "/search/software" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
275
  db.page.update({ route: "/search/other" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
276
  db.page.update({ route: "/search/project" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
277
  db.page.update({ route: "/search/organization" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
278
  db.page.update({ route: "/search/dataprovider" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
279

    
280
  db.page.update({ route: "/project-report" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
281
  print("Positions for 'Landing Pages' updated");
282

    
283
  // Search Pages
284
  db.page.update({ route: "/search/find" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
285

    
286
  db.page.update({ route: "/search/find/communities" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
287

    
288
  db.page.update({ route: "/search/find/publications" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
289
  db.page.update({ route: "/search/find/datasets" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
290
  db.page.update({ route: "/search/find/software" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
291
  db.page.update({ route: "/search/find/other" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
292
  db.page.update({ route: "/search/find/projects" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
293
  db.page.update({ route: "/search/find/organizations" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
294
  db.page.update({ route: "/search/find/dataproviders" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
295
  print("Positions for 'Search Pages' updated");
296

    
297
  // Advanced Search Pages
298
  db.page.update({ route: "/search/advanced/publications" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
299
  db.page.update({ route: "/search/advanced/datasets" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
300
  db.page.update({ route: "/search/advanced/software" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
301
  db.page.update({ route: "/search/advanced/other" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
302
  db.page.update({ route: "/search/advanced/projects" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
303
  db.page.update({ route: "/search/advanced/organizations" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
304
  db.page.update({ route: "/search/advanced/dataproviders" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
305
  print("Positions for 'Advanced Search Pages' updated");
306

    
307
  // Search Content Provider Pages
308
  db.page.update({ route: "/search/journals" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
309
  db.page.update({ route: "/search/entity-registries" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
310
  db.page.update({ route: "/search/content-providers" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
311
  db.page.update({ route: "/search/journals-table" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
312
  db.page.update({ route: "/search/entity-registries-table" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
313
  db.page.update({ route: "/search/content-providers-table" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
314
  print("Positions for 'Search Content Providers Pages' updated");
315

    
316
  // Deposit Pages
317
  db.page.update({ route: "/participate/deposit-publications" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
318
  db.page.update({ route: "/participate/deposit-datasets" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
319
  db.page.update({ route: "/participate/deposit-publications-result" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
320
  db.page.update({ route: "/participate/deposit-datasets-result" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
321
  db.page.update({ route: "/participate/deposit-subject-result" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
322
  db.page.update({ route: "/participate/share-zenodo" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
323
  db.page.update({ route: "/participate/deposit/learn-how" },{ $set: {"top":false,"bottom":true,"right":false,"left":false}});
324
  db.page.update({ route: "/participate/deposit-search" },{ $set: {"top":true,"bottom":false,"right":false,"left":false}});
325
  print("Positions for 'Deposit Pages' updated");
326

    
327
  // Linking Pages
328
  db.page.update({ route: "/participate/claim" },{ $set: {"top":false,"bottom":true,"right":false,"left":false}});
329
  db.page.update({ route: "/participate/direct-claim" },{ $set: {"top":false,"bottom":true,"right":false,"left":false}});
330
  db.page.update({ route: "/myclaims" },{ $set: {"top":true,"bottom":true,"right":true,"left":false}});
331
  db.page.update({ route: "/claims" },{ $set: {"top":true,"bottom":true,"right":true,"left":false}});
332
  db.page.update({ route: "/claims-project-manager" },{ $set: {"top":false,"bottom":false,"right":false,"left":false}});
333
  print("Positions for 'Linking Pages' updated");
334
}
335

    
336
function addMissingAndNewPages() {
337
  print("Add missing and new Pages\n");
338

    
339
  db.page.save({"name" : "Search Communities", "route" : "/search/find/communities", "type" : "search", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":false,"right":false,"left":false});
340

    
341
  db.page.save({"name" : "Deposit your research - Learn How", "route" : "/participate/deposit/learn-how", "type" : "share", "connect":false,"communities":true,"openaire":false,"entities" : [], "top":true,"bottom":true,"right":true,"left":true});
342
  db.page.save({"name" : "Deposit Browse & Search repositories", "route" : "/participate/deposit/search", "type" : "share", "connect":false,"communities":true,"openaire":false,"entities" : [], "top":true,"bottom":true,"right":true,"left":true});
343

    
344
  db.page.save({"name" : "About - Learn in depth", "route" : "/about/learn-in-depth", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":true,"right":true,"left":true});
345
  db.page.save({"name" : "Contact us", "route" : "/contact-us", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":true,"right":true,"left":true});
346

    
347
  db.page.save({"name" : "Content Policy", "route" : "/content", "type" : "other", "connect":true,"communities":false,"openaire":false,"entities" : [], "top":true,"bottom":true,"right":true,"left":true});
348

    
349
  db.page.save({"name" : "Invite", "route" : "/invite", "type" : "other", "connect":false,"communities":true,"openaire":false,"entities" : [], "top":true,"bottom":true,"right":false,"left":false});
350

    
351
  db.page.save({"name" : "Mail Preferences", "route" : "/mail-preferences", "type" : "other", "connect":false,"communities":false,"openaire":true,"entities" : [], "top":true,"bottom":true,"right":true,"left":true});
352

    
353
  // Testing Page for help contents (Connect)
354
  db.page.save({"name" : "Helper Test", "route" : "helper-test", "type" : "other", "connect":true, "communities": false, "openaire": false, "entities": [], "top": true, "bottom": false, "left": false, "right": false});
355
}
356

    
357
function changePageRoutesAboutAndZenodo() {
358
  print("change Page Routes '/about' and '/participate/share-zenodo'\n");
359

    
360
  db.page.update({ route: "/about" },{ $set: {"route": "/about/learn-how", "name" : "About - Learn How"}});
361
  db.page.update({ route: "/participate/share-zenodo" },{ $set: {"route": "/participate/deposit/zenodo"}});
362
}
363

    
364
function enableProjectReportPageInCommunities() {
365
    print("Enable project report page in communities \n");
366

    
367
  db.page.update({ route : "/project-report" },{ $set: {"communities": true}});
368
}
369

    
370
function addDepositPoliciesHelpContentInAllCommunities() {
371
    print("add deposit policies in help content in all communitites except 'openaire' and 'connect' in Deposit-Learn How page\n");
372

    
373
  deposit_first_page = db.page.find( { route: "/participate/deposit/learn-how" }).map( function(page) { return page._id.str; } ).toString();
374
  deposit_first_page_content = "" +
375
    "<div class=\"uk-width-3-5 uk-align-center\"> " +
376
    " <div class=\"uk-text-bold\">How to comply with funder Open Access policies</div> " +
377
    " <ul class=\"uk-list uk-list-bullet\"> " +
378
    "   <li>Read the <a class=\"custom-external\" href=\"https://www.openaire.eu/how-to-comply-to-h2020-mandates-for-publications\" target=\"_blank\"> OpenAIRE guide to learn how to comply with EC H2020 Open Access policy on publications </a></li> " +
379
    "   <li>Read the <a class=\"custom-external\" href=\"https://www.openaire.eu/how-to-comply-to-h2020-mandates-for-data\" target=\"_blank\"> OpenAIRE guide to learn how to comply with EC H2020 Open Access policy on research data </a></li> " +
380
    "   <li>If you want to know about National Open Access policies, please check them out <a class=\"custom-external\" href=\"https://www.openaire.eu/frontpage/country-pages\" target=\"_blank\">here</a></li> " +
381
    "   <li>All OpenAIRE guides can be found <a class=\"custom-external\" href=\"https://www.openaire.eu/guides\" target=\"_blank\">here</a></li> " +
382
    " </ul> " +
383
    "</div>";
384

    
385
  communities = db.community.find().map( function(community) { return community; } );
386
  for (var i = 0; i < communities.length; i++) {
387
    community = communities[i];
388
    if (community.pid != "connect" && community.pid != "openaire") {
389
      db.pageHelpContent.save({
390
        "page" : deposit_first_page,
391
        "community" : community._id.str,
392
        "placement" : "bottom",
393
        "order" : 1,
394
        "content" : deposit_first_page_content,
395
        "isActive" : true,
396
        "isPriorTo" : false
397
      });
398

    
399
    }
400
  }
401
}
402

    
403
function moveOrganizationsDivHelpContentsToPageHelpContents() {
404
  print("move organizations div help contents to page help contents for all communities\n ");
405

    
406
  organizations_page = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString();
407

    
408
  organizations_divId = db.divId.find( { name: "organizations" }).map( function(divId) { return divId._id.str; } ).toString();
409
  print("organizations divId: "+organizations_divId);
410

    
411
  communities = db.community.find().map(function (community) {
412
    return community;
413
  });
414
  for (var i = 0; i < communities.length; i++) {
415
    community = communities[i];
416
    print("community pid: "+community.pid);
417

    
418
    divHelpContents = db.divHelpContent.find({"community": community._id.str, "divId": organizations_divId}).map(function (divHelpContent) {
419
      return divHelpContent;
420
    });
421

    
422
    for (var j = 0; j < divHelpContents.length; j++) {
423
      divHelpContent = divHelpContents[j];
424

    
425
      db.pageHelpContent.save({
426
        "page": organizations_page,
427
        "community": community._id.str,
428
        "placement": "top",
429
        "order": j+1,
430
        "content": divHelpContent.content,
431
        "isActive": divHelpContent.isActive,
432
        "isPriorTo": false
433
      });
434

    
435
      db.divHelpContent.remove({"_id" : divHelpContent._id});
436
    }
437
  }
438
}
439

    
440
function deleteHomeDivHelpContents() {
441
    print("delete div help contents for divId 'home-news'\n");
442

    
443
  home_divId = db.divId.find( { name: "home-news" }).map( function(divId) { return divId._id.str; } ).toString();
444
  connect_communityId = db.community.find( { pid: "connect" }).map( function(community) { return community._id.str; } ).toString();
445

    
446
  divHelpContents = db.divHelpContent.find({"community": connect_communityId, "divId": home_divId}).map(function (divHelpContent) {
447
    return divHelpContent;
448
  });
449

    
450
  for (var i = 0; i < divHelpContents.length; i++) {
451
    divHelpContent = divHelpContents[i]
452

    
453
    db.divHelpContent.remove({"_id" : divHelpContent._id});
454
  }
455
}
456

    
457
function deleteHomeAndOrganizationsDivIds() {
458
  print("delete 'home-news' and 'organizations' divIds\n");
459

    
460
  db.divId.remove({"name" : "home-news"});
461
  db.divId.remove({"name" : "organizations"});
462
}
463

    
464
use openaire_admin;
465

    
466
//updatePages();
467

    
468
//updateTypeOfLandingPages();
469
//removeEntitiesFromSearchFindPage();
470
//initDivHelpContents();
471

    
472
//createContentPageWithTypeOther();
473
//createPagesWithTypeHtml();
474
//addContent_About_Organizations_PagesToCommunities();
475
//createCollectionForHtmlPageContents();
476
//addDefaultHtmlToHtmlPages();
477

    
478
//createMonitorPageWithTypeOther();
479
//addMonitorPageToCommunities();
480

    
481
//createOtherResearchProducts();
482

    
483
//addDefaultHtmlToHtmlPagesForCommunity("clarin");
484
//createNotificationsCollection();
485
//addDivHelpContentsForCommunity("clarin");
486
//addORPInStatistics();
487
//createShareInZenodoPage();
488
//addCommunityLayout();
489
//addCuratorsPage();
490
//removeMonitorPage();
491

    
492
//pageOptionConnectAsCommunities();
493

    
494
//organizationsPageTypeFromHtmlToOther();
495
//removeHtmlPageContentsFromOrganizationsPage();
496
//addOpenaireConnectCommunitiesOptionsInDivIds();
497
//addHomeNewsAndOrganizationsDivIds();
498
//removeLinkingDivHelpContentsForCommunitiesAndConnect();
499

    
500
addMissingAndNewPages();
501
changePageRoutesAboutAndZenodo();
502
addDepositPoliciesHelpContentInAllCommunities();
503
moveOrganizationsDivHelpContentsToPageHelpContents();
504
deleteHomeDivHelpContents();
505
deleteHomeAndOrganizationsDivIds();
506
enableProjectReportPageInCommunities();
507

    
508
addPositionsInPages();
(6-6/6)