Project

General

Profile

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">&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
use openaire_admin;
167

    
168
//updatePages();
169

    
170
//updateTypeOfLandingPages();
171
//removeEntitiesFromSearchFindPage();
172
//initDivHelpContents();
173

    
174
//createContentPageWithTypeOther();
175
//createPagesWithTypeHtml();
176
//addContent_About_Organizations_PagesToCommunities();
177
//createCollectionForHtmlPageContents();
178
//addDefaultHtmlToHtmlPages();
179

    
180
//createMonitorPageWithTypeOther();
181
//addMonitorPageToCommunities();
182

    
183
//createOtherResearchProducts();
184

    
185
//addDefaultHtmlToHtmlPagesForCommunity("clarin");
186
//createNotificationsCollection();
187
//addDivHelpContentsForCommunity("clarin");
188
//addORPInStatistics();
189
//createShareInZenodoPage();
190
//addCommunityLayout();
191
addCuratorsPage();
192
removeMonitorPage();
(4-4/4)