Skip to content

Commit

Permalink
Fix DV tag line and Permissions Success Message
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed May 11, 2016
1 parent a7fdea3 commit bd9c1a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;

/**
Expand Down Expand Up @@ -396,7 +397,7 @@ private void notifyRoleChange(RoleAssignee ra, UserNotification.Type type) {
private void assignRole(RoleAssignee ra, DataverseRole r) {
try {
commandEngine.submit(new AssignRoleCommand(ra, r, dvObject, dvRequestService.getDataverseRequest()));
JsfHelper.addSuccessMessage(r.getName() + " role assigned to " + ra.getDisplayInfo().getTitle() + " for " + dvObject.getDisplayName() + ".");
JsfHelper.addSuccessMessage(r.getName() + " role assigned to " + ra.getDisplayInfo().getTitle() + " for " + StringEscapeUtils.escapeHtml(dvObject.getDisplayName()) + ".");
// don't notify if role = file downloader and object is not released
if (!(r.getAlias().equals(DataverseRole.FILE_DOWNLOADER) && !dvObject.isReleased()) ){
notifyRoleChange(ra, UserNotification.Type.ASSIGNROLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;

/**
Expand Down Expand Up @@ -187,7 +188,7 @@ public void assignRole(ActionEvent evt) {
private void assignRole(RoleAssignee ra, DataverseRole r) {
try {
commandEngine.submit(new AssignRoleCommand(ra, r, dvObject, dvRequestService.getDataverseRequest()));
JH.addMessage(FacesMessage.SEVERITY_INFO, "Role " + r.getName() + " assigned to " + ra.getDisplayInfo().getTitle() + " on " + dvObject.getDisplayName());
JH.addMessage(FacesMessage.SEVERITY_INFO, "Role " + r.getName() + " assigned to " + ra.getDisplayInfo().getTitle() + " on " + StringEscapeUtils.escapeHtml(dvObject.getDisplayName()));
} catch (CommandException ex) {
JH.addMessage(FacesMessage.SEVERITY_ERROR, "Can't assign role: " + ex.getMessage());
}
Expand Down
8 changes: 5 additions & 3 deletions src/main/webapp/dataverse_header.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
xmlns:p="http://primefaces.org/ui"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs">
xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs"
xmlns:o="http://omnifaces.org/ui">

<div id="dataverse-header-block">
<!-- Navbar Panel -->
Expand Down Expand Up @@ -164,6 +165,7 @@
<div id="dataverseHeader" class="container bg-muted"
style="background:##{!empty dataverse.dataverseTheme.backgroundColor ? dataverse.dataverseTheme.backgroundColor : 'F5F5F5'};"
jsf:rendered="#{showDataverseHeader}">
<o:importFunctions type="edu.harvard.iq.dataverse.util.MarkupChecker" />
<div class="dataverseHeaderLogo" style="text-align:#{!empty dataverse.dataverseTheme.logoAlignment ? dataverse.dataverseTheme.logoAlignment : 'center'};; background:##{!empty dataverse.dataverseTheme.logoBackgroundColor ? dataverse.dataverseTheme.logoBackgroundColor : 'F5F5F5'};"
jsf:rendered="#{!empty dataverse.dataverseTheme.logo and dataverse.dataverseTheme.logoFormat == 'RECTANGLE'}">
<img src="/logos/#{dataverse.logoOwnerId}/#{dataverse.dataverseTheme.logo}" alt="#{dataverse.name} #{bundle.dataverse}"/>
Expand All @@ -181,11 +183,11 @@
<h:outputText styleClass="dataverseHeaderDataverseName" value="#{bundle.newDataverse}"/>
</div>
<div class="dataverseHeaderCell dataverseHeaderTagline" jsf:rendered="#{!empty dataverse.dataverseTheme.tagline and empty dataverse.dataverseTheme.linkUrl}">
<h:outputText escape="false" style="color:##{!empty dataverse.dataverseTheme.textColor ? dataverse.dataverseTheme.textColor : '888888'};" value="#{dataverse.dataverseTheme.tagline}" />
<h:outputText escape="false" style="color:##{!empty dataverse.dataverseTheme.textColor ? dataverse.dataverseTheme.textColor : '888888'};" value="#{MarkupChecker:sanitizeBasicHTML(dataverse.dataverseTheme.tagline)}" />
</div>
<div class="dataverseHeaderCell dataverseHeaderLink" jsf:rendered="#{!empty dataverse.dataverseTheme.tagline and !empty dataverse.dataverseTheme.linkUrl}">
<h:outputLink value="#{dataverse.dataverseTheme.linkUrl}" style="color:##{!empty dataverse.dataverseTheme.linkColor ? dataverse.dataverseTheme.linkColor : '428bca'};" target="_blank">
<h:outputText value="#{dataverse.dataverseTheme.tagline}" escape="false"/>
<h:outputText value="#{MarkupChecker:sanitizeBasicHTML(dataverse.dataverseTheme.tagline)}" escape="false"/>
</h:outputLink>
</div>
</div>
Expand Down

0 comments on commit bd9c1a1

Please sign in to comment.