Revision 53594
Added by Konstantina Galouni over 5 years ago
modules/uoa-admin-tools/update_db.js | ||
---|---|---|
61 | 61 |
db.divHelpContent.save({ "divId" : link_metadata, "community" : communityID, "content" : link_metadata_content, "isActive" : false }); |
62 | 62 |
} |
63 | 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() |
|
64 | 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 |
|
|
65 | 74 |
function addORPInStatistics() { |
66 | 75 |
|
67 | 76 |
communitiesStatistics = db.statistics.find().map( function(community) { return community; } ); |
... | ... | |
96 | 105 |
} |
97 | 106 |
} |
98 | 107 |
|
99 |
|
|
100 | 108 |
use openaire_admin; |
101 | 109 |
|
102 | 110 |
//updatePages(); |
... | ... | |
116 | 124 |
|
117 | 125 |
//createOtherResearchProducts(); |
118 | 126 |
|
119 |
// createNotificationsCollection(); |
|
120 |
// addDivHelpContentsForCommunity("clarin"); |
|
121 |
// addORPInStatistics(); |
|
127 |
addDefaultHtmlToHtmlPagesForCommunity("clarin"); |
|
128 |
//createNotificationsCollection(); |
|
129 |
//addDivHelpContentsForCommunity("clarin"); |
|
130 |
//addORPInStatistics(); |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/PageDAO.java | ||
---|---|---|
9 | 9 |
List<Page> findByConnect(boolean connect); |
10 | 10 |
List<Page> findByOpenaire(boolean openaire); |
11 | 11 |
Page findById(String Id); |
12 |
Page findByRoute(String route); |
|
12 | 13 |
|
13 | 14 |
Page save(Page page); |
14 | 15 |
|
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/HtmlPageContent.java | ||
---|---|---|
15 | 15 |
public HtmlPageContent() { |
16 | 16 |
} |
17 | 17 |
|
18 |
public HtmlPageContent(String page, String community, String content) { |
|
19 |
this.page = page; |
|
20 |
this.community = community; |
|
21 |
this.content = content; |
|
22 |
} |
|
23 |
|
|
18 | 24 |
public String getId() { |
19 | 25 |
return id; |
20 | 26 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/HtmlPageContentController.java | ||
---|---|---|
79 | 79 |
return htmlPageContentDAO.save(htmlPageContent); |
80 | 80 |
} |
81 | 81 |
|
82 |
@RequestMapping(value = "/htmlpagecontent/{id}", method = RequestMethod.DELETE) |
|
83 |
public void deleteHtmlPageContent(@PathVariable(value = "id") String id) { |
|
84 |
htmlPageContentDAO.delete(id); |
|
85 |
} |
|
82 | 86 |
/* |
83 | 87 |
@RequestMapping(value = "/htmlpagecontent/{id}", method = RequestMethod.GET) |
84 | 88 |
public HtmlPageContent getHtmlPageContent(@PathVariable(value = "id") String id) { |
85 | 89 |
return htmlPageContentDAO.findById(id); |
86 | 90 |
} |
87 | 91 |
|
88 |
@RequestMapping(value = "/htmlpagecontent/{id}", method = RequestMethod.DELETE) |
|
89 |
public void deleteHtmlPageContent(@PathVariable(value = "id") String id) { |
|
90 |
htmlPageContentDAO.delete(id); |
|
91 |
} |
|
92 | 92 |
|
93 | 93 |
@RequestMapping(value = "/htmlpagecontent/delete", method = RequestMethod.POST) |
94 | 94 |
public Boolean deleteHtmlPageContents(@RequestBody List<String> htmlPageContents) throws Exception { |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java | ||
---|---|---|
9 | 9 |
import org.springframework.web.bind.annotation.*; |
10 | 10 |
import org.springframework.beans.factory.annotation.Autowired; |
11 | 11 |
|
12 |
import javax.swing.text.html.HTML; |
|
12 | 13 |
import java.util.*; |
13 | 14 |
|
14 | 15 |
@RestController |
... | ... | |
35 | 36 |
private DivHelpContentController divHelpContentController; |
36 | 37 |
|
37 | 38 |
@Autowired |
39 |
private HtmlPageContentController htmlPageContentController; |
|
40 |
|
|
41 |
@Autowired |
|
38 | 42 |
private DivIdController divIdController; |
39 | 43 |
|
40 | 44 |
@Autowired |
... | ... | |
232 | 236 |
divHelpContentController.insertOrUpdateDivHelpContent(new DivHelpContent(link_metadata, id, link_metadata_content, false)); |
233 | 237 |
} |
234 | 238 |
|
239 |
Page page = null; |
|
240 |
page = pageDAO.findByRoute("/about" ); |
|
241 |
if(page != null) { |
|
242 |
String htmlContent = "<div><div class=\"uk-article-title custom-article-title\"> About the community </div> <p> This is an introductory text. To be updated... </p> </div>"; |
|
243 |
HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent); |
|
244 |
htmlPageContentController.updateHtmlPageContent(htmlPageContent); |
|
245 |
} |
|
246 |
|
|
247 |
page = pageDAO.findByRoute("/organizations"); |
|
248 |
if(page != null) { |
|
249 |
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>"; |
|
250 |
HtmlPageContent htmlPageContent = new HtmlPageContent(page.getId(), id, htmlContent); |
|
251 |
htmlPageContentController.updateHtmlPageContent(htmlPageContent); |
|
252 |
} |
|
253 |
|
|
235 | 254 |
return communityResponse; |
236 | 255 |
} |
237 | 256 |
|
... | ... | |
284 | 303 |
pageHelpContentController.deletePageHelpContent(pageHelpContentResponse.getId()); |
285 | 304 |
} |
286 | 305 |
|
306 |
List<HtmlPageContent> htmlPageContents = htmlPageContentController.getHtmlPageContents(pid, null); |
|
307 |
for(HtmlPageContent htmlPageContent : htmlPageContents) { |
|
308 |
htmlPageContentController.deleteHtmlPageContent(htmlPageContent.getId()); |
|
309 |
} |
|
310 |
|
|
311 |
Statistics stats = statisticsDAO.findByPid(pid); |
|
312 |
if(stats != null) { |
|
313 |
statisticsDAO.delete(stats.getId()); |
|
314 |
} |
|
315 |
|
|
316 |
CommunitySubscribers communitySubscribers = communitySubscribersDAO.findByPid(pid); |
|
317 |
if(communitySubscribers != null) { |
|
318 |
communitySubscribersDAO.delete(communitySubscribers.getId()); |
|
319 |
} |
|
320 |
|
|
287 | 321 |
communityDAO.delete(id); |
288 | 322 |
} |
289 | 323 |
|
Also available in: Unified diff
1. update_db.js: Add 'addDefaultHtmlToHtmlPagesForCommunity()' function for adding hmtl contents (/about and /organizations routes) to 'Clarin' community.
2. CommunityController.java: Add htmlPageContents when a community is created | delete htmlPageContents, statistics, communitySubscribers when a community is deleted.