Project

General

Profile

1 53555 konstantin
//version compatibility: 1.1.1-SNAPSHOT
2 51340 konstantin
3 52897 argiro.kok
//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 51508 argiro.kok
//
7 52897 argiro.kok
//	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 51508 argiro.kok
//
11 52897 argiro.kok
//	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 51340 konstantin
38 53555 konstantin
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 53594 konstantin
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 53564 argiro.kok
68 53594 konstantin
    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 53564 argiro.kok
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 53936 konstantin
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
112
	communities = db.community.find().map( function(community) { return community; } );
113
114
	for (var i = 0; i < communities.length; i++) {
115
		community_pages = communities[i].pages;
116
117
		community_pages[shareInZenodo] = true;
118
119
		community_pid = communities[i].pid;
120
		db.community.update({ "pid" : community_pid },{$set: { "pages": community_pages}});
121
        print("Update pages for " + community_pid);
122
    }
123
}
124
125 51846 argiro.kok
 use openaire_admin;
126 51828 konstantin
127 52308 konstantin
//updatePages();
128 51623 konstantin
129
//updateTypeOfLandingPages();
130 51828 konstantin
//removeEntitiesFromSearchFindPage();
131 52308 konstantin
//initDivHelpContents();
132
133
//createContentPageWithTypeOther();
134
//createPagesWithTypeHtml();
135
//addContent_About_Organizations_PagesToCommunities();
136
//createCollectionForHtmlPageContents();
137
//addDefaultHtmlToHtmlPages();
138
139 52811 konstantin
//createMonitorPageWithTypeOther();
140
//addMonitorPageToCommunities();
141
142 52897 argiro.kok
//createOtherResearchProducts();
143 53555 konstantin
144 53985 argiro.kok
addDefaultHtmlToHtmlPagesForCommunity("clarin");
145
createNotificationsCollection();
146
addDivHelpContentsForCommunity("clarin");
147
addORPInStatistics();
148 53936 konstantin
createShareInZenodoPage();