Revision 57319
Added by Konstantinos Triantafyllou over 4 years ago
modules/uoa-admin-tools/update_db.js | ||
---|---|---|
121 | 121 |
// } |
122 | 122 |
// } |
123 | 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 |
// }
|
|
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 | 134 |
// |
135 | 135 |
// function addCuratorsPage() { |
136 | 136 |
// curatorsId = db.page.insertOne({"name" : "Curators", "route" : "/curators", "type" : "other", "connect":true,"openaire":false,"entities" : []}).insertedId.str; |
... | ... | |
1418 | 1418 |
} |
1419 | 1419 |
} |
1420 | 1420 |
|
1421 |
function removeOldLayouts() { |
|
1422 |
db.community.updateMany({}, {$unset: {layout: ""}}); |
|
1423 |
db.layout.deleteMany({}); |
|
1424 |
} |
|
1425 |
|
|
1421 | 1426 |
use openaire_admin; |
1422 | 1427 |
|
1423 | 1428 |
//updatePages(); |
... | ... | |
1475 | 1480 |
// addHelpTextsInContentPolicyPage(); |
1476 | 1481 |
// |
1477 | 1482 |
// addNewRoutesInCommunities(); |
1478 |
addMyCommunitiesPage(); |
|
1479 |
removeFaultyEmptyPageFromCommunities(); |
|
1483 |
//addMyCommunitiesPage(); |
|
1484 |
//removeFaultyEmptyPageFromCommunities(); |
|
1485 |
|
|
1486 |
/* 08-10-2019*/ |
|
1487 |
removeOldLayouts(); |
modules/uoa-admin-tools/init_db.js | ||
---|---|---|
301 | 301 |
community_entities[projectId] = true; |
302 | 302 |
community_entities[organizationId] = true; |
303 | 303 |
community_entities[datasourceId] = true; |
304 |
var layoutId = db.layout.insertOne({"color": "#EBB13E"}).insertedId.str; |
|
305 |
print("Layout:" + layoutId); |
|
306 | 304 |
db.community.save({ "name" : name, |
307 |
"pid" : communityPid, "pages" : community_pages, "entities" : community_entities, "layout": layoutId})
|
|
305 |
"pid" : communityPid, "pages" : community_pages, "entities" : community_entities}) |
|
308 | 306 |
|
309 | 307 |
openaireCommunity = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString() |
310 | 308 |
|
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/LayoutDAO.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
Layout findById(String Id); |
11 | 11 |
|
12 |
Layout findByColor(String color); |
|
13 |
|
|
14 | 12 |
Layout save(Layout entity); |
15 | 13 |
|
16 | 14 |
void deleteAll(); |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/MongoDBLayoutDAO.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
Layout findById(String Id); |
13 | 13 |
|
14 |
Layout findByColor(String color); |
|
15 |
|
|
16 | 14 |
Layout save(Layout entity); |
17 | 15 |
|
18 | 16 |
void deleteAll(); |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Panel.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Panel { |
|
4 |
|
|
5 |
private Boolean onDarkBackground; |
|
6 |
private Background background; |
|
7 |
private Fonts fonts; |
|
8 |
private Fonts title; |
|
9 |
private PanelElements panelElements; |
|
10 |
|
|
11 |
public Panel() { |
|
12 |
} |
|
13 |
|
|
14 |
public Panel(Boolean onDarkBackground, Background background, Fonts fonts, Fonts title, PanelElements panelElements) { |
|
15 |
this.onDarkBackground = onDarkBackground; |
|
16 |
this.background = background; |
|
17 |
this.fonts = fonts; |
|
18 |
this.title = title; |
|
19 |
this.panelElements = panelElements; |
|
20 |
} |
|
21 |
|
|
22 |
public Boolean getOnDarkBackground() { |
|
23 |
return onDarkBackground; |
|
24 |
} |
|
25 |
|
|
26 |
public void setOnDarkBackground(Boolean onDarkBackground) { |
|
27 |
this.onDarkBackground = onDarkBackground; |
|
28 |
} |
|
29 |
|
|
30 |
public Background getBackground() { |
|
31 |
return background; |
|
32 |
} |
|
33 |
|
|
34 |
public void setBackground(Background background) { |
|
35 |
this.background = background; |
|
36 |
} |
|
37 |
|
|
38 |
public Fonts getFonts() { |
|
39 |
return fonts; |
|
40 |
} |
|
41 |
|
|
42 |
public void setFonts(Fonts fonts) { |
|
43 |
this.fonts = fonts; |
|
44 |
} |
|
45 |
|
|
46 |
public Fonts getTitle() { |
|
47 |
return title; |
|
48 |
} |
|
49 |
|
|
50 |
public void setTitle(Fonts title) { |
|
51 |
this.title = title; |
|
52 |
} |
|
53 |
|
|
54 |
public PanelElements getPanelElements() { |
|
55 |
return panelElements; |
|
56 |
} |
|
57 |
|
|
58 |
public void setPanelElements(PanelElements panelElements) { |
|
59 |
this.panelElements = panelElements; |
|
60 |
} |
|
61 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Background.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Background { |
|
4 |
|
|
5 |
private String color; |
|
6 |
private String borderStyle; |
|
7 |
private String borderColor; |
|
8 |
private Integer borderWidth; |
|
9 |
|
|
10 |
public Background() { |
|
11 |
} |
|
12 |
|
|
13 |
public Background(String color, String borderStyle, String borderColor, Integer borderWidth) { |
|
14 |
this.color = color; |
|
15 |
this.borderStyle = borderStyle; |
|
16 |
this.borderColor = borderColor; |
|
17 |
this.borderWidth = borderWidth; |
|
18 |
} |
|
19 |
|
|
20 |
public String getColor() { |
|
21 |
return color; |
|
22 |
} |
|
23 |
|
|
24 |
public void setColor(String color) { |
|
25 |
this.color = color; |
|
26 |
} |
|
27 |
|
|
28 |
public String getBorderStyle() { |
|
29 |
return borderStyle; |
|
30 |
} |
|
31 |
|
|
32 |
public void setBorderStyle(String borderStyle) { |
|
33 |
this.borderStyle = borderStyle; |
|
34 |
} |
|
35 |
|
|
36 |
public String getBorderColor() { |
|
37 |
return borderColor; |
|
38 |
} |
|
39 |
|
|
40 |
public void setBorderColor(String borderColor) { |
|
41 |
this.borderColor = borderColor; |
|
42 |
} |
|
43 |
|
|
44 |
public Integer getBorderWidth() { |
|
45 |
return borderWidth; |
|
46 |
} |
|
47 |
|
|
48 |
public void setBorderWidth(Integer borderWidth) { |
|
49 |
this.borderWidth = borderWidth; |
|
50 |
} |
|
51 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Links.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Links { |
|
4 |
|
|
5 |
private Link darkBackground; |
|
6 |
private Link lightBackground; |
|
7 |
|
|
8 |
public Links() { |
|
9 |
} |
|
10 |
|
|
11 |
public Links(Link darkBackground, Link lightBackground) { |
|
12 |
this.darkBackground = darkBackground; |
|
13 |
this.lightBackground = lightBackground; |
|
14 |
} |
|
15 |
|
|
16 |
public Link getDarkBackground() { |
|
17 |
return darkBackground; |
|
18 |
} |
|
19 |
|
|
20 |
public void setDarkBackground(Link darkBackground) { |
|
21 |
this.darkBackground = darkBackground; |
|
22 |
} |
|
23 |
|
|
24 |
public Link getLightBackground() { |
|
25 |
return lightBackground; |
|
26 |
} |
|
27 |
|
|
28 |
public void setLightBackground(Link lightBackground) { |
|
29 |
this.lightBackground = lightBackground; |
|
30 |
} |
|
31 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Box.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Box { |
|
4 |
|
|
5 |
private String borderColor; |
|
6 |
private String borderStyle; |
|
7 |
private String borderWidth; |
|
8 |
private Integer borderRadius; |
|
9 |
|
|
10 |
public Box() { |
|
11 |
} |
|
12 |
|
|
13 |
public Box(String borderColor, String borderStyle, String borderWidth, Integer borderRadius) { |
|
14 |
this.borderColor = borderColor; |
|
15 |
this.borderStyle = borderStyle; |
|
16 |
this.borderWidth = borderWidth; |
|
17 |
this.borderRadius = borderRadius; |
|
18 |
} |
|
19 |
|
|
20 |
public String getBorderColor() { |
|
21 |
return borderColor; |
|
22 |
} |
|
23 |
|
|
24 |
public void setBorderColor(String borderColor) { |
|
25 |
this.borderColor = borderColor; |
|
26 |
} |
|
27 |
|
|
28 |
public String getBorderStyle() { |
|
29 |
return borderStyle; |
|
30 |
} |
|
31 |
|
|
32 |
public void setBorderStyle(String borderStyle) { |
|
33 |
this.borderStyle = borderStyle; |
|
34 |
} |
|
35 |
|
|
36 |
public String getBorderWidth() { |
|
37 |
return borderWidth; |
|
38 |
} |
|
39 |
|
|
40 |
public void setBorderWidth(String borderWidth) { |
|
41 |
this.borderWidth = borderWidth; |
|
42 |
} |
|
43 |
|
|
44 |
public Integer getBorderRadius() { |
|
45 |
return borderRadius; |
|
46 |
} |
|
47 |
|
|
48 |
public void setBorderRadius(Integer borderRadius) { |
|
49 |
this.borderRadius = borderRadius; |
|
50 |
} |
|
51 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Fonts.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Fonts { |
|
4 |
|
|
5 |
private String color; |
|
6 |
private String family; |
|
7 |
private Integer size; |
|
8 |
private Integer weight; |
|
9 |
|
|
10 |
public Fonts() { |
|
11 |
} |
|
12 |
|
|
13 |
public Fonts(String color, String family, Integer size, Integer weight) { |
|
14 |
this.color = color; |
|
15 |
this.family = family; |
|
16 |
this.size = size; |
|
17 |
this.weight = weight; |
|
18 |
} |
|
19 |
|
|
20 |
public String getColor() { |
|
21 |
return color; |
|
22 |
} |
|
23 |
|
|
24 |
public void setColor(String color) { |
|
25 |
this.color = color; |
|
26 |
} |
|
27 |
|
|
28 |
public String getFamily() { |
|
29 |
return family; |
|
30 |
} |
|
31 |
|
|
32 |
public void setFamily(String family) { |
|
33 |
this.family = family; |
|
34 |
} |
|
35 |
|
|
36 |
public Integer getSize() { |
|
37 |
return size; |
|
38 |
} |
|
39 |
|
|
40 |
public void setSize(Integer size) { |
|
41 |
this.size = size; |
|
42 |
} |
|
43 |
|
|
44 |
public Integer getWeight() { |
|
45 |
return weight; |
|
46 |
} |
|
47 |
|
|
48 |
public void setWeight(Integer weight) { |
|
49 |
this.weight = weight; |
|
50 |
} |
|
51 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Button.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Button { |
|
4 |
|
|
5 |
private String backgroundColor; |
|
6 |
private String color; |
|
7 |
private String borderStyle; |
|
8 |
private String borderColor; |
|
9 |
private Integer borderWidth; |
|
10 |
private Integer borderRadius; |
|
11 |
private OnHoverButton onHover; |
|
12 |
|
|
13 |
public Button() { |
|
14 |
} |
|
15 |
|
|
16 |
public Button(String backgroundColor, String color, String borderStyle, String borderColor, Integer borderWidth, Integer borderRadius, OnHoverButton onHover) { |
|
17 |
this.backgroundColor = backgroundColor; |
|
18 |
this.color = color; |
|
19 |
this.borderStyle = borderStyle; |
|
20 |
this.borderColor = borderColor; |
|
21 |
this.borderWidth = borderWidth; |
|
22 |
this.borderRadius = borderRadius; |
|
23 |
this.onHover = onHover; |
|
24 |
} |
|
25 |
|
|
26 |
public String getBackgroundColor() { |
|
27 |
return backgroundColor; |
|
28 |
} |
|
29 |
|
|
30 |
public void setBackgroundColor(String backgroundColor) { |
|
31 |
this.backgroundColor = backgroundColor; |
|
32 |
} |
|
33 |
|
|
34 |
public String getColor() { |
|
35 |
return color; |
|
36 |
} |
|
37 |
|
|
38 |
public void setColor(String color) { |
|
39 |
this.color = color; |
|
40 |
} |
|
41 |
|
|
42 |
public String getBorderStyle() { |
|
43 |
return borderStyle; |
|
44 |
} |
|
45 |
|
|
46 |
public void setBorderStyle(String borderStyle) { |
|
47 |
this.borderStyle = borderStyle; |
|
48 |
} |
|
49 |
|
|
50 |
public String getBorderColor() { |
|
51 |
return borderColor; |
|
52 |
} |
|
53 |
|
|
54 |
public void setBorderColor(String borderColor) { |
|
55 |
this.borderColor = borderColor; |
|
56 |
} |
|
57 |
|
|
58 |
public Integer getBorderWidth() { |
|
59 |
return borderWidth; |
|
60 |
} |
|
61 |
|
|
62 |
public void setBorderWidth(Integer borderWidth) { |
|
63 |
this.borderWidth = borderWidth; |
|
64 |
} |
|
65 |
|
|
66 |
public Integer getBorderRadius() { |
|
67 |
return borderRadius; |
|
68 |
} |
|
69 |
|
|
70 |
public void setBorderRadius(Integer borderRadius) { |
|
71 |
this.borderRadius = borderRadius; |
|
72 |
} |
|
73 |
|
|
74 |
public OnHoverButton getOnHover() { |
|
75 |
return onHover; |
|
76 |
} |
|
77 |
|
|
78 |
public void setOnHover(OnHoverButton onHover) { |
|
79 |
this.onHover = onHover; |
|
80 |
} |
|
81 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/PanelElements.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class PanelElements { |
|
4 |
|
|
5 |
private String backgroundColor; |
|
6 |
private String borderColor; |
|
7 |
private String color; |
|
8 |
|
|
9 |
public PanelElements() { |
|
10 |
} |
|
11 |
|
|
12 |
public PanelElements(String backgroundColor, String borderColor, String color) { |
|
13 |
this.backgroundColor = backgroundColor; |
|
14 |
this.borderColor = borderColor; |
|
15 |
this.color = color; |
|
16 |
} |
|
17 |
|
|
18 |
public String getBackgroundColor() { |
|
19 |
return backgroundColor; |
|
20 |
} |
|
21 |
|
|
22 |
public void setBackgroundColor(String backgroundColor) { |
|
23 |
this.backgroundColor = backgroundColor; |
|
24 |
} |
|
25 |
|
|
26 |
public String getBorderColor() { |
|
27 |
return borderColor; |
|
28 |
} |
|
29 |
|
|
30 |
public void setBorderColor(String borderColor) { |
|
31 |
this.borderColor = borderColor; |
|
32 |
} |
|
33 |
|
|
34 |
public String getColor() { |
|
35 |
return color; |
|
36 |
} |
|
37 |
|
|
38 |
public void setColor(String color) { |
|
39 |
this.color = color; |
|
40 |
} |
|
41 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/OnHoverButton.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class OnHoverButton { |
|
4 |
|
|
5 |
private String backgroundColor; |
|
6 |
private String color; |
|
7 |
private String borderColor; |
|
8 |
|
|
9 |
public OnHoverButton() { |
|
10 |
} |
|
11 |
|
|
12 |
public OnHoverButton(String backgroundColor, String color, String borderColor) { |
|
13 |
this.backgroundColor = backgroundColor; |
|
14 |
this.color = color; |
|
15 |
this.borderColor = borderColor; |
|
16 |
} |
|
17 |
|
|
18 |
public String getColor() { |
|
19 |
return color; |
|
20 |
} |
|
21 |
|
|
22 |
public void setColor(String color) { |
|
23 |
this.color = color; |
|
24 |
} |
|
25 |
|
|
26 |
public String getBackgroundColor() { |
|
27 |
return backgroundColor; |
|
28 |
} |
|
29 |
|
|
30 |
public void setBackgroundColor(String backgroundColor) { |
|
31 |
this.backgroundColor = backgroundColor; |
|
32 |
} |
|
33 |
|
|
34 |
public String getBorderColor() { |
|
35 |
return borderColor; |
|
36 |
} |
|
37 |
|
|
38 |
public void setBorderColor(String borderColor) { |
|
39 |
this.borderColor = borderColor; |
|
40 |
} |
|
41 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Link.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Link { |
|
4 |
|
|
5 |
private String family; |
|
6 |
private Integer size; |
|
7 |
private Integer weight; |
|
8 |
private String color; |
|
9 |
private OnHoverLink onHover; |
|
10 |
|
|
11 |
public Link() { |
|
12 |
} |
|
13 |
|
|
14 |
public Link(String family, Integer size, Integer weight, String color, OnHoverLink onHover) { |
|
15 |
this.family = family; |
|
16 |
this.size = size; |
|
17 |
this.weight = weight; |
|
18 |
this.color = color; |
|
19 |
this.onHover = onHover; |
|
20 |
} |
|
21 |
|
|
22 |
public String getFamily() { |
|
23 |
return family; |
|
24 |
} |
|
25 |
|
|
26 |
public void setFamily(String family) { |
|
27 |
this.family = family; |
|
28 |
} |
|
29 |
|
|
30 |
public Integer getSize() { |
|
31 |
return size; |
|
32 |
} |
|
33 |
|
|
34 |
public void setSize(Integer size) { |
|
35 |
this.size = size; |
|
36 |
} |
|
37 |
|
|
38 |
public Integer getWeight() { |
|
39 |
return weight; |
|
40 |
} |
|
41 |
|
|
42 |
public void setWeight(Integer weight) { |
|
43 |
this.weight = weight; |
|
44 |
} |
|
45 |
|
|
46 |
public String getColor() { |
|
47 |
return color; |
|
48 |
} |
|
49 |
|
|
50 |
public void setColor(String color) { |
|
51 |
this.color = color; |
|
52 |
} |
|
53 |
|
|
54 |
public OnHoverLink getOnHover() { |
|
55 |
return onHover; |
|
56 |
} |
|
57 |
|
|
58 |
public void setOnHover(OnHoverLink onHover) { |
|
59 |
this.onHover = onHover; |
|
60 |
} |
|
61 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/OnHoverLink.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class OnHoverLink { |
|
4 |
|
|
5 |
private String color; |
|
6 |
|
|
7 |
public OnHoverLink() { |
|
8 |
} |
|
9 |
|
|
10 |
public OnHoverLink(String color) { |
|
11 |
this.color = color; |
|
12 |
} |
|
13 |
|
|
14 |
public String getColor() { |
|
15 |
return color; |
|
16 |
} |
|
17 |
|
|
18 |
public void setColor(String color) { |
|
19 |
this.color = color; |
|
20 |
} |
|
21 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/layoutEntities/Buttons.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.layoutEntities; |
|
2 |
|
|
3 |
public class Buttons { |
|
4 |
|
|
5 |
private Button darkBackground; |
|
6 |
private Button lightBackground; |
|
7 |
|
|
8 |
public Buttons() { |
|
9 |
} |
|
10 |
|
|
11 |
public Buttons(Button darkBackground, Button lightBackground) { |
|
12 |
this.darkBackground = darkBackground; |
|
13 |
this.lightBackground = lightBackground; |
|
14 |
} |
|
15 |
|
|
16 |
public Button getDarkBackground() { |
|
17 |
return darkBackground; |
|
18 |
} |
|
19 |
|
|
20 |
public void setDarkBackground(Button darkBackground) { |
|
21 |
this.darkBackground = darkBackground; |
|
22 |
} |
|
23 |
|
|
24 |
public Button getLightBackground() { |
|
25 |
return lightBackground; |
|
26 |
} |
|
27 |
|
|
28 |
public void setLightBackground(Button lightBackground) { |
|
29 |
this.lightBackground = lightBackground; |
|
30 |
} |
|
31 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/Layout.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.uoaadmintools.entities; |
2 | 2 |
|
3 | 3 |
import com.fasterxml.jackson.annotation.JsonProperty; |
4 |
import eu.dnetlib.uoaadmintools.entities.layoutEntities.Box; |
|
5 |
import eu.dnetlib.uoaadmintools.entities.layoutEntities.Buttons; |
|
6 |
import eu.dnetlib.uoaadmintools.entities.layoutEntities.Links; |
|
7 |
import eu.dnetlib.uoaadmintools.entities.layoutEntities.Panel; |
|
4 | 8 |
import org.springframework.data.annotation.Id; |
5 | 9 |
|
6 | 10 |
public class Layout { |
... | ... | |
8 | 12 |
@Id |
9 | 13 |
@JsonProperty("_id") |
10 | 14 |
private String id; |
11 |
private String color; |
|
15 |
private String mainColor; |
|
16 |
private String secondaryColor; |
|
17 |
private Panel panel; |
|
18 |
private Box box; |
|
19 |
private Links links; |
|
20 |
private Buttons buttons; |
|
12 | 21 |
|
22 |
|
|
13 | 23 |
public Layout() { } |
14 | 24 |
|
25 |
public Layout(String id, String mainColor, String secondaryColor, Panel panel, Box box, Links links, Buttons buttons) { |
|
26 |
this.id = id; |
|
27 |
this.mainColor = mainColor; |
|
28 |
this.secondaryColor = secondaryColor; |
|
29 |
this.panel = panel; |
|
30 |
this.box = box; |
|
31 |
this.links = links; |
|
32 |
this.buttons = buttons; |
|
33 |
} |
|
34 |
|
|
15 | 35 |
public String getId() { |
16 | 36 |
return id; |
17 | 37 |
} |
... | ... | |
20 | 40 |
this.id = id; |
21 | 41 |
} |
22 | 42 |
|
23 |
public String getColor() { |
|
24 |
return color;
|
|
43 |
public String getMainColor() {
|
|
44 |
return mainColor;
|
|
25 | 45 |
} |
26 | 46 |
|
27 |
public void setColor(String color) {
|
|
28 |
this.color = color;
|
|
47 |
public void setMainColor(String mainColor) {
|
|
48 |
this.mainColor = mainColor;
|
|
29 | 49 |
} |
50 |
|
|
51 |
public String getSecondaryColor() { |
|
52 |
return secondaryColor; |
|
53 |
} |
|
54 |
|
|
55 |
public void setSecondaryColor(String secondaryColor) { |
|
56 |
this.secondaryColor = secondaryColor; |
|
57 |
} |
|
58 |
|
|
59 |
public Panel getPanel() { |
|
60 |
return panel; |
|
61 |
} |
|
62 |
|
|
63 |
public void setPanel(Panel panel) { |
|
64 |
this.panel = panel; |
|
65 |
} |
|
66 |
|
|
67 |
public Box getBox() { |
|
68 |
return box; |
|
69 |
} |
|
70 |
|
|
71 |
public void setBox(Box box) { |
|
72 |
this.box = box; |
|
73 |
} |
|
74 |
|
|
75 |
public Links getLinks() { |
|
76 |
return links; |
|
77 |
} |
|
78 |
|
|
79 |
public void setLinks(Links links) { |
|
80 |
this.links = links; |
|
81 |
} |
|
82 |
|
|
83 |
public Buttons getButtons() { |
|
84 |
return buttons; |
|
85 |
} |
|
86 |
|
|
87 |
public void setButtons(Buttons buttons) { |
|
88 |
this.buttons = buttons; |
|
89 |
} |
|
30 | 90 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java | ||
---|---|---|
48 | 48 |
@Autowired |
49 | 49 |
private CommunitySubscribersDAO communitySubscribersDAO; |
50 | 50 |
|
51 |
// TODO moved to properties |
|
52 |
private String defaultColor = "#EBB13E"; |
|
53 | 51 |
|
54 | 52 |
@RequestMapping(value = "/community", method = RequestMethod.GET) |
55 | 53 |
public List<Community> getAllCommunities() { |
... | ... | |
200 | 198 |
|
201 | 199 |
community.setEntities(entities); |
202 | 200 |
community.setPages(pages); |
203 |
Layout layout = new Layout(); |
|
204 |
layout.setColor(defaultColor); |
|
205 |
layout = layoutDAO.save(layout); |
|
206 |
community.setLayout(layout.getId()); |
|
207 | 201 |
Statistics statistics = new Statistics(community.getPid()); |
208 | 202 |
statisticsDAO.save(statistics); |
209 | 203 |
CommunitySubscribers communitySubscribers = new CommunitySubscribers(community.getPid()); |
... | ... | |
473 | 467 |
@RequestMapping(value = "/community/{pid}/layout", method = RequestMethod.GET) |
474 | 468 |
public Layout getLayoutForCommunity(@PathVariable(value = "pid") String pid) { |
475 | 469 |
Community community = communityDAO.findByPid(pid); |
476 |
return layoutDAO.findById(community.getLayout()); |
|
477 |
} |
|
478 |
|
|
479 |
@RequestMapping(value = "/community/{pid}/updateLayout", method = RequestMethod.POST) |
|
480 |
public Layout updateLayoutForCommunity(@PathVariable(value = "pid") String pid, @RequestBody Layout layout) { |
|
481 |
Community community = communityDAO.findByPid(pid); |
|
482 | 470 |
if(community.getLayout() != null) { |
483 |
layout.setId(community.getLayout()); |
|
484 |
layout = layoutDAO.save(layout); |
|
471 |
return layoutDAO.findById(community.getLayout()); |
|
485 | 472 |
} else { |
486 |
layout = layoutDAO.save(layout); |
|
487 |
community.setLayout(layout.getId()); |
|
488 |
communityDAO.save(community); |
|
473 |
return null; |
|
489 | 474 |
} |
490 |
return layout; |
|
491 | 475 |
} |
492 | 476 |
|
493 |
@RequestMapping(value = "/community/{pid}/resetLayout", method = RequestMethod.POST) |
|
494 |
public Layout resetLayoutForCommunity(@PathVariable(value = "pid") String pid) { |
|
495 |
Layout layout; |
|
477 |
@RequestMapping(value = "/community/{pid}/layout", method = RequestMethod.POST) |
|
478 |
public Layout updateLayoutForCommunity(@PathVariable(value = "pid") String pid, @RequestBody Layout layout) { |
|
496 | 479 |
Community community = communityDAO.findByPid(pid); |
497 | 480 |
if(community.getLayout() != null) { |
498 |
layout = layoutDAO.findById(community.getLayout()); |
|
499 |
layout.setColor(defaultColor); |
|
481 |
layout.setId(community.getLayout()); |
|
500 | 482 |
layout = layoutDAO.save(layout); |
501 | 483 |
} else { |
502 |
layout = new Layout(); |
|
503 |
layout.setColor(defaultColor); |
|
504 | 484 |
layout = layoutDAO.save(layout); |
505 | 485 |
community.setLayout(layout.getId()); |
506 | 486 |
communityDAO.save(community); |
... | ... | |
508 | 488 |
return layout; |
509 | 489 |
} |
510 | 490 |
|
491 |
|
|
511 | 492 |
@RequestMapping(value = "/community/{pid}/pagehelpcontent", method = RequestMethod.GET) |
512 | 493 |
public Map<String, List<PageHelpContentResponse>> getPageHelpContentsByPosition(@PathVariable(value = "pid") String pid, |
513 | 494 |
@RequestParam(required=false) String page, |
Also available in: Unified diff
[AdminTool]: Add New Layout options. Run update.js on your mongo to delete the previous one.