Revision 56293
Added by Konstantina Galouni over 5 years ago
modules/uoa-admin-tools/update_db.js | ||
---|---|---|
175 | 175 |
} |
176 | 176 |
} |
177 | 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 |
|
|
178 | 245 |
use openaire_admin; |
179 | 246 |
|
180 | 247 |
//updatePages(); |
... | ... | |
202 | 269 |
//addCommunityLayout(); |
203 | 270 |
//addCuratorsPage(); |
204 | 271 |
//removeMonitorPage(); |
205 |
pageOptionConnectAsCommunities(); |
|
272 |
|
|
273 |
//pageOptionConnectAsCommunities(); |
|
274 |
|
|
275 |
organizationsPageTypeFromHtmlToOther(); |
|
276 |
removeHtmlPageContentsFromOrganizationsPage(); |
|
277 |
addOpenaireConnectCommunitiesOptionsInDivIds(); |
|
278 |
addHomeNewsAndOrganizationsDivIds(); |
|
279 |
removeLinkingDivHelpContentsForCommunitiesAndConnect(); |
modules/uoa-admin-tools/init_db.js | ||
---|---|---|
39 | 39 |
organizationId = db.entity.find( { pid: "organization" }).map( function(entity) { return entity._id.str; } ).toString() |
40 | 40 |
datasourceId = db.entity.find( { pid: "datasource" }).map( function(entity) { return entity._id.str; } ).toString() |
41 | 41 |
|
42 |
db.page.save({"name" : "Publication Landing", "route" : "/search/publication", "type" : "landing", "connect":false,"communities":true,"openaire":true,"entities" : [publicationId]}) |
|
42 |
db.page.save({"name" : "Home", "route" : "/", "type" : "other", "connect":true,"communities":false,"openaire":true,"entities" : []}) |
|
43 |
|
|
44 |
db.page.save({"name" : "Publication Landing", "route" : "/search/publication", "type" : "landing", "connect":false,"communities":true,"openaire":true,"entities" : [publicationId]}) |
|
43 | 45 |
db.page.save({"name" : "Research Data Landing", "route" : "/search/dataset", "type" : "landing", "connect":false,"communities":true,"openaire":true,"entities" : [datasetId]}) |
44 | 46 |
db.page.save({"name" : "Software Landing", "route" : "/search/software", "type" : "landing", "connect":false,"communities":true,"openaire":true,"entities" : [softwareId]}) |
45 | 47 |
db.page.save({"name" : "Other Research Products Landing", "route" : "/search/other", "type" : "landing", "connect":false,"communities":true,"openaire":true,"entities" : [orpId]}); |
... | ... | |
48 | 50 |
db.page.save({"name" : "Content Provider Landing", "route" : "/search/dataprovider", "type" : "landing", "connect":false,"communities":true,"openaire":true,"entities" : [datasourceId]}) |
49 | 51 |
db.page.save({"name" : "Project Report", "route" : "/project-report", "type" : "landing", "connect":false,"communities":false,"openaire":true,"entities" : [projectId]}) |
50 | 52 |
|
51 |
db.page.save({"name" : "Search Find", "type" : "search", "connect":false,"communities":false,"openaire":true,"entities" : [], "route" : "/search/find"})
|
|
53 |
db.page.save({"name" : "Search Find", "type" : "search", "connect":false,"communities":true,"openaire":true,"entities" : [], "route" : "/search/find"})
|
|
52 | 54 |
|
53 | 55 |
db.page.save({"name" : "Search Publications", "route" : "/search/find/publications", "type" : "search", "connect":false,"communities":true,"openaire":true,"entities" : [publicationId]}) |
54 | 56 |
db.page.save({"name" : "Search Research Data", "route" : "/search/find/datasets", "type" : "search", "connect":false,"communities":true,"openaire":true,"entities" : [datasetId]}) |
... | ... | |
92 | 94 |
db.page.save({"name" : "Curators", "route" : "/curators", "type" : "other", "connect":false,"communities":true,"openaire":false,"entities" : []}) |
93 | 95 |
|
94 | 96 |
db.page.save({"name" : "About", "route" : "/about", "type" : "html", "connect":false,"communities":true,"openaire":false,"entities" : []}) |
95 |
db.page.save({"name" : "Organizations", "route" : "/organizations", "type" : "html", "connect":false,"communities":true,"openaire":false,"entities" : []})
|
|
97 |
db.page.save({"name" : "Organizations", "route" : "/organizations", "type" : "other", "connect":false,"communities":true,"openaire":false,"entities" : []})
|
|
96 | 98 |
|
97 |
link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString() |
|
99 |
home = db.page.find( { route: "/" }).map( function(page) { return page._id.str; } ).toString(); |
|
100 |
organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString() |
|
101 |
link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString() |
|
98 | 102 |
directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString() |
99 | 103 |
|
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]}) |
|
104 |
db.divId.save({ "name" : "home-news", "pages" : [home], "connect":true,"communities":false,"openaire":true}) |
|
105 |
db.divId.save({ "name" : "organizations", "pages" : [organizations], "connect":false,"communities":true,"openaire":false}) |
|
106 |
db.divId.save({ "name" : "link-context-form", "pages" : [link, directLink], "connect":false,"communities":false,"openaire":true}) |
|
107 |
db.divId.save({ "name" : "link-project-form", "pages" : [link, directLink], "connect":false,"communities":false,"openaire":true}) |
|
108 |
db.divId.save({ "name" : "link-result-form", "pages" : [link, directLink], "connect":false,"communities":false,"openaire":true}) |
|
109 |
db.divId.save({ "name" : "link-result-bulk", "pages" : [link], "connect":false,"communities":false,"openaire":true}) |
|
110 |
db.divId.save({ "name" : "link-metadata", "pages" : [link, directLink], "connect":false,"communities":false,"openaire":true}) |
|
105 | 111 |
} |
106 | 112 |
function createCommunity(name,communityPid){ |
107 | 113 |
var communitySaved = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString() |
... | ... | |
113 | 119 |
print("Name:"+name); |
114 | 120 |
print("communityPid:"+communityPid); |
115 | 121 |
|
116 |
publicationLanding = db.page.find( { route: "/search/publication" }).map( function(page) { return page._id.str; } ).toString() |
|
122 |
home = db.page.find( { route: "/" }).map( function(page) { return page._id.str; } ).toString() |
|
123 |
|
|
124 |
publicationLanding = db.page.find( { route: "/search/publication" }).map( function(page) { return page._id.str; } ).toString() |
|
117 | 125 |
datasetLanding = db.page.find( { route: "/search/dataset" }).map( function(page) { return page._id.str; } ).toString() |
118 | 126 |
softwareLanding = db.page.find( { route: "/search/software" }).map( function(page) { return page._id.str; } ).toString() |
119 | 127 |
orpLanding = db.page.find( { route: "/search/other" }).map( function(page) { return page._id.str; } ).toString(); |
... | ... | |
152 | 160 |
depositPublicationsResults = db.page.find( { route: "/participate/deposit-publications-result" }).map( function(page) { return page._id.str; } ).toString() |
153 | 161 |
depositDatasetsResults = db.page.find( { route: "/participate/deposit-datasets-result" }).map( function(page) { return page._id.str; } ).toString() |
154 | 162 |
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();
|
|
163 |
shareInZenodo = db.page.find( { route: "/participate/share-zenodo" }).map( function(page) { return page._id.str; } ).toString(); |
|
156 | 164 |
|
157 | 165 |
link = db.page.find( { route: "/participate/claim" }).map( function(page) { return page._id.str; } ).toString() |
158 | 166 |
directLink = db.page.find( { route: "/participate/direct-claim" }).map( function(page) { return page._id.str; } ).toString() |
... | ... | |
169 | 177 |
organizations = db.page.find( { route: "/organizations" }).map( function(page) { return page._id.str; } ).toString() |
170 | 178 |
|
171 | 179 |
var community_pages = {} |
180 |
community_pages[home] = true; |
|
172 | 181 |
community_pages[publicationLanding] = true; |
173 | 182 |
community_pages[datasetLanding] = true; |
174 | 183 |
community_pages[softwareLanding] = true; |
... | ... | |
258 | 267 |
entities["publication"]=statistics_entities; |
259 | 268 |
entities["dataset"]=statistics_entities; |
260 | 269 |
entities["software"]=statistics_entities; |
261 |
entities["orp"]=statistics_entities;
|
|
270 |
entities["orp"]=statistics_entities;
|
|
262 | 271 |
var statistics = {"pid" : communityPid, "entities" : entities}; |
263 | 272 |
|
264 | 273 |
db.statistics.save(statistics); |
... | ... | |
266 | 275 |
var subscribers = []; |
267 | 276 |
db.communitySubscribers.save({ "pid" : communityPid, "subscribers" : subscribers}) |
268 | 277 |
|
278 |
organizations_class = db.divId.find( { name: "organizations" }).map( function(divId) { return divId._id.str; } ).toString(); |
|
269 | 279 |
link_context_form = db.divId.find( { name: "link-context-form" }).map( function(divId) { return divId._id.str; } ).toString(); |
270 | 280 |
link_project_form = db.divId.find( { name: "link-project-form" }).map( function(divId) { return divId._id.str; } ).toString(); |
271 | 281 |
link_result_form = db.divId.find( { name: "link-result-form" }).map( function(divId) { return divId._id.str; } ).toString(); |
272 | 282 |
link_result_bulk = db.divId.find( { name: "link-result-bulk" }).map( function(divId) { return divId._id.str; } ).toString(); |
273 | 283 |
link_metadata = db.divId.find( { name: "link-metadata" }).map( function(divId) { return divId._id.str; } ).toString(); |
274 | 284 |
|
285 |
organizations_class_content = '<div> <p>Here you can write more details about the organizations related to your community.</p> </div>'; |
|
275 | 286 |
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>'; |
276 | 287 |
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>'; |
277 | 288 |
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> '; |
... | ... | |
280 | 291 |
|
281 | 292 |
communityID = db.community.find({ "pid" : communityPid}).map( function(community) { return community._id.str.toString(); } ); |
282 | 293 |
|
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 |
|
|
294 |
if(communityPid != "openaire" && communityPid != "connect") { |
|
295 |
db.divHelpContent.save({ "divId": organizations_class, "community": communityID, "content": organizations_class_content, "isActive": false }); |
|
296 |
} |
|
297 |
if(communityPid == "openaire") { |
|
298 |
db.divHelpContent.save({ "divId" : link_context_form, "community" : communityID, "content" : link_context_form_content, "isActive" : false }); |
|
299 |
db.divHelpContent.save({ "divId" : link_project_form, "community" : communityID, "content" : link_project_form_content, "isActive" : false }); |
|
300 |
db.divHelpContent.save({ "divId" : link_result_form, "community" : communityID, "content" : link_result_form_content, "isActive" : true }); |
|
301 |
db.divHelpContent.save({ "divId" : link_result_bulk, "community" : communityID, "content" : link_result_bulk_content, "isActive" : true }); |
|
302 |
db.divHelpContent.save({ "divId" : link_metadata, "community" : communityID, "content" : link_metadata_content, "isActive" : false }); |
|
303 |
} |
|
289 | 304 |
print("\n\n Done \n\n"); |
290 | 305 |
|
291 | 306 |
} |
... | ... | |
315 | 330 |
|
316 | 331 |
for (var i = 0; i < communities.length; i++) { |
317 | 332 |
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>'}) |
318 |
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>'}) |
|
333 |
//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>'})
|
|
319 | 334 |
} |
320 | 335 |
} |
321 | 336 |
|
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/DivIdDAO.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
DivId findById(String Id); |
16 | 16 |
|
17 |
List<DivId> findByConnect(boolean connect); |
|
18 |
List<DivId> findByCommunities(boolean communities); |
|
19 |
List<DivId> findByOpenaire(boolean openaire); |
|
20 |
|
|
17 | 21 |
DivId save(DivId divId); |
18 | 22 |
|
19 | 23 |
void deleteAll(); |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/MongoDBDivIdDAO.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
DivId findById(String Id); |
17 | 17 |
|
18 |
List<DivId> findByConnect(boolean connect); |
|
19 |
List<DivId> findByCommunities(boolean communities); |
|
20 |
List<DivId> findByOpenaire(boolean openaire); |
|
21 |
|
|
18 | 22 |
DivId save(DivId divId); |
19 | 23 |
|
20 | 24 |
void deleteAll(); |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/DivId.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
private String name; |
14 | 14 |
private List<String> pages; |
15 |
private Boolean connect; |
|
16 |
private Boolean communities; |
|
17 |
private Boolean openaire; |
|
15 | 18 |
|
16 | 19 |
public DivId() { |
17 | 20 |
} |
... | ... | |
19 | 22 |
public DivId(DivId divId) { |
20 | 23 |
setName(divId.getName()); |
21 | 24 |
setPages(divId.getPages()); |
25 |
setConnect(divId.getConnect()); |
|
26 |
setCommunities(divId.getCommunities()); |
|
27 |
setOpenaire(divId.getOpenaire()); |
|
22 | 28 |
} |
23 | 29 |
|
24 | 30 |
public String getId() { |
... | ... | |
44 | 50 |
public void setPages(List<String> pages) { |
45 | 51 |
this.pages = pages; |
46 | 52 |
} |
53 |
|
|
54 |
public Boolean getConnect() { |
|
55 |
return connect; |
|
56 |
} |
|
57 |
|
|
58 |
public void setConnect(Boolean connect) { this.connect = connect; } |
|
59 |
|
|
60 |
public Boolean getCommunities() { return communities; } |
|
61 |
|
|
62 |
public void setCommunities(Boolean communities) { |
|
63 |
this.communities = communities; |
|
64 |
} |
|
65 |
|
|
66 |
public Boolean getOpenaire() { |
|
67 |
return openaire; |
|
68 |
} |
|
69 |
|
|
70 |
public void setOpenaire(Boolean openaire) { |
|
71 |
this.openaire = openaire; |
|
72 |
} |
|
47 | 73 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/DivIdResponse.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
private String name; |
14 | 14 |
private List<Page> pages; |
15 |
private Boolean connect; |
|
16 |
private Boolean communities; |
|
17 |
private Boolean openaire; |
|
15 | 18 |
|
16 | 19 |
public DivIdResponse() {} |
17 | 20 |
|
18 | 21 |
public DivIdResponse(DivId divId) { |
19 | 22 |
this.id = divId.getId(); |
20 | 23 |
this.name = divId.getName(); |
24 |
setConnect(divId.getConnect()); |
|
25 |
setCommunities(divId.getCommunities()); |
|
26 |
setOpenaire(divId.getOpenaire()); |
|
21 | 27 |
} |
22 | 28 |
|
23 | 29 |
public String getId() { |
... | ... | |
43 | 49 |
public void setPages(List<Page> pages) { |
44 | 50 |
this.pages = pages; |
45 | 51 |
} |
52 |
|
|
53 |
public Boolean getConnect() { |
|
54 |
return connect; |
|
55 |
} |
|
56 |
|
|
57 |
public void setConnect(Boolean connect) { this.connect = connect; } |
|
58 |
|
|
59 |
public Boolean getCommunities() { return communities; } |
|
60 |
|
|
61 |
public void setCommunities(Boolean communities) { |
|
62 |
this.communities = communities; |
|
63 |
} |
|
64 |
|
|
65 |
public Boolean getOpenaire() { |
|
66 |
return openaire; |
|
67 |
} |
|
68 |
|
|
69 |
public void setOpenaire(Boolean openaire) { |
|
70 |
this.openaire = openaire; |
|
71 |
} |
|
46 | 72 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/DivIdController.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import eu.dnetlib.uoaadmintools.dao.CommunityDAO; |
4 | 4 |
import eu.dnetlib.uoaadmintools.dao.DivIdDAO; |
5 |
import eu.dnetlib.uoaadmintools.dao.MongoDBCommunityDAO; |
|
5 | 6 |
import eu.dnetlib.uoaadmintools.dao.PageDAO; |
6 | 7 |
import eu.dnetlib.uoaadmintools.entities.*; |
7 | 8 |
import org.apache.log4j.Logger; |
... | ... | |
22 | 23 |
private PageDAO pageDAO; |
23 | 24 |
|
24 | 25 |
@Autowired |
26 |
private CommunityController communityController; |
|
27 |
|
|
28 |
@Autowired |
|
25 | 29 |
private DivHelpContentController divHelpContentController; |
26 | 30 |
|
27 | 31 |
DivIdController() {} |
... | ... | |
112 | 116 |
DivId divId = new DivId(); |
113 | 117 |
divId.setId(divIdResponse.getId()); |
114 | 118 |
divId.setName(divIdResponse.getName()); |
119 |
divId.setOpenaire(divIdResponse.getOpenaire()); |
|
120 |
divId.setConnect(divIdResponse.getConnect()); |
|
121 |
divId.setCommunities(divIdResponse.getCommunities()); |
|
115 | 122 |
|
116 | 123 |
List<Page> fullPages = divIdResponse.getPages(); |
117 | 124 |
List<String> pages = new ArrayList<String>(); |
... | ... | |
132 | 139 |
divIdDAO.save(divId); |
133 | 140 |
return this.getDivIdFull(divId.getId()); |
134 | 141 |
*/ |
142 |
DivId divIdOld = divIdDAO.findById(divIdResponse.getId()); |
|
135 | 143 |
DivId divId = this.getDivIdByDivIdResponse(divIdResponse); |
136 | 144 |
divIdDAO.save(divId); |
145 |
|
|
146 |
boolean openaireEnabled = divId.getOpenaire(); |
|
147 |
boolean connectEnabled = divId.getConnect(); |
|
148 |
|
|
149 |
if(divId.getCommunities() && !divIdOld.getCommunities()) { |
|
150 |
List<Community> communities = communityController.getAllCommunities(); |
|
151 |
for( Community community : communities ) { |
|
152 |
if(!community.getPid().equals("openaire") && !community.getPid().equals("connect")) { |
|
153 |
divHelpContentController.addDivHelpContentsInCommunity(community.getPid(), community.getId(), divId.getName()); |
|
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
if(openaireEnabled && !divIdOld.getOpenaire()) { |
|
158 |
Community community = communityController.getCommunity("openaire"); |
|
159 |
divHelpContentController.addDivHelpContentsInCommunity(community.getPid(), community.getId(), divId.getName()); |
|
160 |
} |
|
161 |
|
|
162 |
if(connectEnabled && !divIdOld.getConnect()) { |
|
163 |
Community community = communityController.getCommunity("connect"); |
|
164 |
divHelpContentController.addDivHelpContentsInCommunity(community.getPid(), community.getId(), divId.getName()); |
|
165 |
} |
|
166 |
|
|
167 |
if(!divId.getCommunities()) { |
|
168 |
List<Community> communities = communityController.getAllCommunities(); |
|
169 |
for( Community community : communities ) { |
|
170 |
if(!community.getPid().equals("openaire") && !community.getPid().equals("connect")) { |
|
171 |
// delete div contents related to this divId |
|
172 |
List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents(community.getPid(), null, divId.getName(), null); |
|
173 |
for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) { |
|
174 |
divHelpContentController.deleteDivHelpContent(divHelpContentResponse.getId()); |
|
175 |
} |
|
176 |
} |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
if(!openaireEnabled) { |
|
181 |
Community community = communityController.getCommunity("openaire"); |
|
182 |
|
|
183 |
// delete div contents related to this divId |
|
184 |
List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents("openaire", null, divId.getName(), null); |
|
185 |
for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) { |
|
186 |
divHelpContentController.deleteDivHelpContent(divHelpContentResponse.getId()); |
|
187 |
} |
|
188 |
} |
|
189 |
|
|
190 |
if(!connectEnabled) { |
|
191 |
Community community = communityController.getCommunity("connect"); |
|
192 |
|
|
193 |
// delete div contents related to this divId |
|
194 |
List<DivHelpContentResponse> divHelpContentResponses = divHelpContentController.getDivHelpContents("connect", null, divId.getName(), null); |
|
195 |
for(DivHelpContentResponse divHelpContentResponse : divHelpContentResponses) { |
|
196 |
divHelpContentController.deleteDivHelpContent(divHelpContentResponse.getId()); |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
137 | 200 |
return divIdResponse; |
138 | 201 |
} |
139 | 202 |
|
... | ... | |
159 | 222 |
} |
160 | 223 |
|
161 | 224 |
@RequestMapping(value = "/div/pages", method = RequestMethod.GET) |
162 |
public Set<String> getDivIdsPages() { |
|
225 |
public Set<String> getDivIdsPages(@RequestParam(value="communityId", required = false) String pid) {
|
|
163 | 226 |
List<DivId> divIds = null; |
164 | 227 |
Set<String> hasCommunityPageDivIds = new HashSet<>(); |
165 | 228 |
|
166 |
divIds = divIdDAO.findAll(); |
|
229 |
if(pid != null) { |
|
230 |
if(pid.equals("openaire")) { |
|
231 |
divIds = divIdDAO.findByOpenaire(true); |
|
232 |
} else if(pid.equals("connect")) { |
|
233 |
divIds = divIdDAO.findByConnect(true); |
|
234 |
} else { |
|
235 |
divIds = divIdDAO.findByCommunities(true); |
|
236 |
} |
|
237 |
} else { |
|
238 |
divIds = divIdDAO.findAll(); |
|
239 |
} |
|
167 | 240 |
|
168 | 241 |
for(DivId divId : divIds) { |
169 | 242 |
for(String pageId : divId.getPages()) { |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java | ||
---|---|---|
211 | 211 |
|
212 | 212 |
String id = savedCommunity.getId(); |
213 | 213 |
|
214 |
String 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>"; |
|
215 |
String 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>"; |
|
216 |
String 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>"; |
|
217 |
String 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>"; |
|
218 |
String 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>"; |
|
214 |
divHelpContentController.addDivHelpContentsInCommunity(savedCommunity.getPid(), id, null); |
|
219 | 215 |
|
220 |
DivId div = null; |
|
221 |
div=divIdDAO.findByName("link-context-form"); |
|
222 |
if(div != null) { |
|
223 |
String link_context_form = div.getId(); |
|
224 |
divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_context_form, id, link_context_form_content, false)); |
|
225 |
} |
|
226 |
|
|
227 |
div=divIdDAO.findByName("link-project-form"); |
|
228 |
if(div != null) { |
|
229 |
String link_project_form = div.getId(); |
|
230 |
divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_project_form, id, link_project_form_content, false)); |
|
231 |
} |
|
232 |
|
|
233 |
div=divIdDAO.findByName("link-result-form"); |
|
234 |
if(div != null) { |
|
235 |
String link_result_form = div.getId(); |
|
236 |
divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_result_form, id, link_result_form_content, true)); |
|
237 |
} |
|
238 |
|
|
239 |
div=divIdDAO.findByName("link-result-bulk"); |
|
240 |
if(div != null) { |
|
241 |
String link_result_bulk = div.getId(); |
|
242 |
divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_result_bulk, id, link_result_bulk_content, true)); |
|
243 |
} |
|
244 |
|
|
245 |
div=divIdDAO.findByName("link-metadata"); |
|
246 |
if(div != null) { |
|
247 |
String link_metadata = div.getId(); |
|
248 |
divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_metadata, id, link_metadata_content, false)); |
|
249 |
} |
|
250 |
|
|
251 | 216 |
Page page = null; |
252 | 217 |
page = pageDAO.findByRoute("/about" ); |
253 | 218 |
if(page != null) { |
... | ... | |
256 | 221 |
htmlPageContentController.updateHtmlPageContent(htmlPageContent); |
257 | 222 |
} |
258 | 223 |
|
224 |
/* |
|
259 | 225 |
page = pageDAO.findByRoute("/organizations"); |
260 | 226 |
if(page != null) { |
261 | 227 |
String htmlContent = "<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>"; |
262 | 228 |
HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent); |
263 | 229 |
htmlPageContentController.updateHtmlPageContent(htmlPageContent); |
264 | 230 |
} |
231 |
*/ |
|
265 | 232 |
|
266 | 233 |
return communityResponse; |
267 | 234 |
} |
... | ... | |
378 | 345 |
if(div != null && div.equals("true")) { |
379 | 346 |
Community community = communityDAO.findByPid(pid); |
380 | 347 |
List<DivId> divIds = divIdDAO.findByPagesContaining(page.getKey()); |
348 |
Iterator<DivId> divIdIterator = divIds.iterator(); |
|
349 |
|
|
350 |
while (divIdIterator.hasNext()) { |
|
351 |
DivId divId = divIdIterator.next(); |
|
352 |
if((pid.equals("openaire") && !divId.getOpenaire()) || |
|
353 |
(pid.equals("connect") && !divId.getConnect()) || |
|
354 |
(!pid.equals("openaire") && !pid.equals("connect") && !divId.getCommunities())) { |
|
355 |
divIdIterator.remove(); |
|
356 |
} |
|
357 |
} |
|
358 |
|
|
381 | 359 |
if(divIds.isEmpty()) { |
382 | 360 |
continue; |
383 | 361 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/DivHelpContentController.java | ||
---|---|---|
130 | 130 |
return divHelpContents; |
131 | 131 |
} |
132 | 132 |
|
133 |
public void addDivHelpContentsInCommunity(String pid, String communityId, String divIdName) { |
|
134 |
String organizations_class_content = "<div> <p>Here you can write more details about the organizations related to your community.</p> </div>"; |
|
135 |
String 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>"; |
|
136 |
String 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>"; |
|
137 |
String 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>"; |
|
138 |
String 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>"; |
|
139 |
String 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>"; |
|
140 |
|
|
141 |
List<DivId> divIds = divIdController.getDivIds(null, divIdName); |
|
142 |
|
|
143 |
for( DivId div : divIds ) { |
|
144 |
if (div != null && ( |
|
145 |
(div.getOpenaire() && pid.equals("openaire")) || |
|
146 |
(div.getConnect() && pid.equals("connect")) || |
|
147 |
(div.getCommunities() && !pid.equals("openaire") && !pid.equals("connect")) |
|
148 |
)) { |
|
149 |
if (div.getName().equals("organizations")) { |
|
150 |
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, organizations_class_content, false)); |
|
151 |
} else if (div.getName().equals("link-context-form")) { |
|
152 |
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_context_form_content, false)); |
|
153 |
} else if (div.getName().equals("link-project-form")) { |
|
154 |
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_project_form_content, false)); |
|
155 |
} else if (div.getName().equals("link-result-form")) { |
|
156 |
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_result_form_content, false)); |
|
157 |
} else if (div.getName().equals("link-result-bulk")) { |
|
158 |
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_result_bulk_content, false)); |
|
159 |
} else if (div.getName().equals("link-metadata")) { |
|
160 |
this.insertOrUpdateDivHelpContent(new DivHelpContent(div.getId(), communityId, link_metadata_content, false)); |
|
161 |
} |
|
162 |
} |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
133 | 166 |
} |
Also available in: Unified diff
1. init_db.js:
1a. Add page "Home"
1b. Make "communities" true in "Search Find" Page
1c. Change "Organizations" page type from "html" to "other"
1d. Add divId "home-news" and "organizations"
1e. Add divHelpContents for "organizations" divId
2. update_db.js: Methods: organizationsPageTypeFromHtmlToOther(), removeHtmlPageContentsFromOrganizationsPage(),
addOpenaireConnectCommunitiesOptionsInDivIds(), addHomeNewsAndOrganizationsDivIds(), removeLinkingDivHelpContentsForCommunitiesAndConnect()
3. DivIdDAO.java & MongoDBDivIdDAO.java & DivId.java & DivIdResponse.java: Add fields "connect", "communities", "openaire"
4. DivHelpContentController.java: Add method "addDivHelpContentsInCommunity()" to add in a community proper div help contents for all or one specifiv divId.
5. CommunityController.java:
5a. Call "addDivHelpContentsInCommunity()" from DivHelpContentController.java to add div help contents
5b. Check divId options to return pages with divIds
6. DivIdController.java:
6a. Check divId options to return pages with divIds
6b. On update: Call "addDivHelpContentsInCommunity()" from DivHelpContentController.java to add div help contents
OR
delete divHelpContents according to "connect", "communities", "openaire" options