[Trunk|Connect]:

1. app.component: If property 'environment' is 'development', subscribe to queryParams, otherwise not (avoid duplicate calls on params change).
2. communities.component.html & community-creation-instructions.component: Rephrasing and spelling fixes.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55399 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-04-17 14:48:06 +00:00
parent 4e6b258a3d
commit a9f725c2f3
3 changed files with 173 additions and 20 deletions

View File

@ -70,6 +70,18 @@ export class AppComponent {
this.propertiesService.loadEnvironment() this.propertiesService.loadEnvironment()
.then(es => { .then(es => {
this.properties = this.propertiesService.envSpecific; this.properties = this.propertiesService.envSpecific;
var communityId: string = "";
if(this.properties.environment == "development") {
this.route.queryParams.subscribe(data => {
communityId = data['communityId'];
this.buildMenu(communityId);
});
} else {
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.buildMenu(communityId);
}
/*
this.route.queryParams.subscribe(data => { this.route.queryParams.subscribe(data => {
var community = null; var community = null;
this.community = null; this.community = null;
@ -94,19 +106,20 @@ export class AppComponent {
this.managerOfCommunities = true; this.managerOfCommunities = true;
}else if(com.managers.indexOf(Session.getUserEmail())!=-1){ }else if(com.managers.indexOf(Session.getUserEmail())!=-1){
this.managerOfCommunities = true; this.managerOfCommunities = true;
}/*else if(!this.subscriberOfCommunities){ }
// check if subscriber // else if(!this.subscriberOfCommunities){
this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe ( // // check if subscriber
isSubscriber => { // this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
if(isSubscriber) { // isSubscriber => {
this.subscriberOfCommunities = true; // if(isSubscriber) {
} // this.subscriberOfCommunities = true;
}, // }
error => { // },
console.error("Error fetching your subscribed communities") // error => {
}); // console.error("Error fetching your subscribed communities")
// });
}*/ //
// }
} }
@ -214,6 +227,7 @@ export class AppComponent {
}); });
*/
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
try{ try{
this.isClient = true; this.isClient = true;
@ -226,4 +240,143 @@ export class AppComponent {
}); });
} }
public buildMenu(communityId: string) {
var community = null;
this.community = null;
this.showMenu = false;
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe (
communities => {
for(var com of communities){
if( (communityId && communityId!="" && com.communityId == communityId
&& community !=null) ||
(
!(communityId && communityId!="" && com.communityId == communityId)
&&
this.managerOfCommunities && this.subscriberOfCommunities)) {
break;
}
if(Session.isLoggedIn() && com['status'] != "hidden"){
if(Session.isCommunityCurator() || Session.isPortalAdministrator()){
this.managerOfCommunities = true;
}else if(com.managers.indexOf(Session.getUserEmail())!=-1){
this.managerOfCommunities = true;
}/*else if(!this.subscriberOfCommunities){
// check if subscriber
this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
isSubscriber => {
if(isSubscriber) {
this.subscriberOfCommunities = true;
}
},
error => {
console.error("Error fetching your subscribed communities")
});
}*/
}
if(communityId && communityId!="" && com.communityId == communityId){
community = com;
// this._layoutService.getLayout(com.communityId,
// this.properties.adminToolsAPIURL + '/').subscribe (
// layout => {
// this.layout = layout;
// document.documentElement.style.setProperty('--portal-main-color', this.layout.color);
// }
// );
this.community = {id: community.communityId, name: (community.shortTitle)?community.shortTitle:community.title, logoUrl:community.logoUrl};
this.menuItems= [
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find", "/search/find/publications", "/search/find/datasets", "/search/find/software", "/search/find/other", "/search/find/projects", "/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Other Research Products","","/search/find/other",false,["orp"],["/search/find/other"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
]},
{
rootItem: new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: []
},
{
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets","/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: [
new MenuItem("","Zenodo Communities","","/participate/share-zenodo",false,[],["/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId})]
},
{
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
items: []
}
];
}
}
if(community == null){
this.menuItems= [];
var myCommunities = [];
if(this.managerOfCommunities){
myCommunities.push( new MenuItem("","Managing communities","","/search/find/communities",false,[],[],{role:"%22manager%22"}))
}
if(Session.isLoggedIn()){
this._subscribeService.getCommunitiesSubscribedTo(Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
pids => {
if(pids.length > 0 ) {
myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"}))
}
},
error => {
console.error("Error fetching your subscribed communities")
});
}
// if(this.subscriberOfCommunities){
// myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"}))
// }
this.menuItems.push({rootItem: new MenuItem("communities","Communities","","/search/find/communities",false,[],null,{}), items: []});
if(this.managerOfCommunities || this.subscriberOfCommunities){
this.menuItems.push({rootItem: new MenuItem("myCommunities","My Communities","","",false,[],[],{}), items: myCommunities});
}
this.menuItems.push({rootItem: new MenuItem("howto","Create Community","","/how-to-create-community",false,[],null,{}), items: []});
this.bottomMenuItems =[
new MenuItem("","About","https://beta.openaire.eu/project-factsheets","",false,[],[],{}),
new MenuItem("","News - Events","https://beta.openaire.eu/news-events","",false,[],[],{}),
new MenuItem("","Blog","https://blogs.openaire.eu/","",false,[],[],{}),
new MenuItem("","Contact us","https://beta.openaire.eu/contact-us","",false,[],[],{})
];
// if(this.properties.showContent){
// this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
// }
this.userMenuItems =[
// new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],(data['communityId'] && typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:data['communityId']}),
];
}else{
this.bottomMenuItems = [
new MenuItem("","About","","/about",false,[],["/about"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Organizations","","/organizations",false,[],["/organizations"],this.properties.environment!="development"?{}:{communityId:community.communityId})
];
if(this.properties.showContent){
this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
}
this.userMenuItems =[ new MenuItem("","My profile","","",false,[],[],{}),
new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
new MenuItem("","Invite users","","/invite",false,[],[],this.properties.environment!="development"?{}:{communityId:community.communityId}),
];
if(this.managerOfCommunities ){
this.userMenuItems.push(new MenuItem("","Support","https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611","",false,[],[],{}))
}
}
this.showMenu = true;
});
}
} }

View File

@ -60,7 +60,7 @@
</div> </div>
<div *ngIf="managerOfCommunities.length == 0 && subscriberOfCommunities.length == 0"> <div *ngIf="managerOfCommunities.length == 0 && subscriberOfCommunities.length == 0">
<h3 class="uk-margin-remove-bottom uk-margin-large-top">Embrace Open Science with OpenAIRE Connect</h3> <h3 class="uk-margin-remove-bottom uk-margin-large-top">Embrace Open Science with OpenAIRE Connect</h3>
<h5 class="uk-margin-remove-top">A plattform to manage your community profile and to share, access and link community research results</h5> <h5 class="uk-margin-remove-top">A platform to manage your community profile and to share, access and link community research results</h5>
<!--div class="uk-width-medium uk-text-center uk-margin-large-top uk-margin-large-left"> <!--div class="uk-width-medium uk-text-center uk-margin-large-top uk-margin-large-left">
<h5>Create and manage your research community page</h5> <h5>Create and manage your research community page</h5>
@ -95,8 +95,8 @@
<h3>Search, share, link results of your research community</h3> <h3>Search, share, link results of your research community</h3>
</div> </div>
<div class="uk-container"> <div class="uk-container">
<h5 class=" uk-width-expand uk-margin-remove-bottom uk-text-bold">Start by locating your community</h5> <h5 class=" uk-width-expand uk-margin-remove-bottom uk-text-bold">Find your community</h5>
<search-form [setFormCentered]=false placeholderText="Start by locating your community" link="/search/find/communities"></search-form> <search-form [setFormCentered]=false placeholderText="Search for Research Communities and Initiatives" link="/search/find/communities"></search-form>
</div> </div>
<div class="uk-container"> <div class="uk-container">

View File

@ -17,8 +17,8 @@ declare var UIkit: any;
<div class="uk-position-relative uk-panel"> <div class="uk-position-relative uk-panel">
<div class="uk-container uk-section"> <div class="uk-container uk-section">
<div> <div>
<h3 class="uk-margin-remove-bottom uk-margin-large-top">Discover the power of OpenAIRE Connect managing tool</h3> <h3 class="uk-margin-remove-bottom uk-margin-large-top">Discover the power of OpenAIRE Connect community page builder</h3>
<h5 class="uk-margin-remove-top">Bring your content online</h5> <h5 class="uk-margin-remove-top">Gather all your research in one place</h5>
<div class="uk-width-medium uk-text-center uk-margin-large-top uk-margin-large-left"> <div class="uk-width-medium uk-text-center uk-margin-large-top uk-margin-large-left">
<h5>Contact OpenAIRE team, in order to create your community page</h5> <h5>Contact OpenAIRE team, in order to create your community page</h5>
@ -37,7 +37,7 @@ declare var UIkit: any;
<div class="uk-margin-bottom uk-margin-top"> <div class="uk-margin-bottom uk-margin-top">
<!--div uk-scrollspy="cls: uk-animation-fade uk-animation-reverse; target: > div > div > .uk-card; delay: 1000; repeat: false"--> <!--div uk-scrollspy="cls: uk-animation-fade uk-animation-reverse; target: > div > div > .uk-card; delay: 1000; repeat: false"-->
<div class="uk-container uk-margin-large-top"> <div class="uk-container uk-margin-large-top">
<h3>OpenAIRE Connect managing tool at a glance</h3> <h3>OpenAIRE Connect community page builder at a glance</h3>
<div class="uk-inline uk-dark"> <div class="uk-inline uk-dark">
<img src="assets/admin-portal.png" alt="OpenAIRE" > <img src="assets/admin-portal.png" alt="OpenAIRE" >
@ -119,7 +119,7 @@ declare var UIkit: any;
</div> </div>
<div class="uk-container uk-margin-large-top"> <div class="uk-container uk-margin-large-top">
<h3>Community public page</h3> <h3>Community page</h3>
<div uk-grid uk-grid-match> <div uk-grid uk-grid-match>
<div class="uk-width-1-3 uk-card"> <div class="uk-width-1-3 uk-card">
<div class="uk-text-center uk-position-center "> <div class="uk-text-center uk-position-center ">