use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class LoginBean method getTeamLoginWarningHTML.
/**
* Returns the HTML to display if the system is in TEAM mode
*
* @return The HTML to display
*/
public String getTeamLoginWarningHTML() {
FacesContext context = FacesContext.getCurrentInstance();
String contextPath = context.getExternalContext().getRequestContextPath();
StringBuilder html = new StringBuilder();
try {
html.append("<tr><td colspan='2'>");
StringWriter writer = new StringWriter();
PanelGenerator.generatePanelStart(writer, contextPath, "yellowInner", "#ffffcc");
html.append(writer.toString());
html.append("<table cellpadding='0' cellspacing='0' border='0' width='100%'>");
html.append("<tr><td valign='top' style='padding-top: 2px' width='20'>");
html.append("<img src='");
html.append(contextPath);
html.append("/images/icons/warning.gif' width='16' height='16' /></td>");
html.append("<td width='180' class='statusErrorText'>");
html.append(Application.getMessage(context, "team_login_warning"));
html.append("</td></tr></table>");
writer = new StringWriter();
PanelGenerator.generatePanelEnd(writer, contextPath, "yellowInner");
html.append(writer.toString());
html.append("</td></tr>");
} catch (IOException ioe) {
logger.error(ioe);
}
return html.toString();
}
use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class NavigationBean method toolbarLocationChanged.
/**
* Action to change the toolbar location
* Currently this will changed the location from Company to the users Home space
*/
public void toolbarLocationChanged(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
try {
UIModeList locationList = (UIModeList) event.getComponent();
String location = locationList.getValue().toString();
processToolbarLocation(location, true);
} catch (InvalidNodeRefException refErr) {
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_NOHOME), Application.getCurrentUser(context).getHomeSpaceId()), refErr);
} catch (Exception err) {
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
}
use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class NavigationBean method getCompanyHomeNode.
/**
* @return Node representing the Company Home folder
*/
public Node getCompanyHomeNode() {
if (this.companyHomeNode == null) {
FacesContext fc = FacesContext.getCurrentInstance();
String companyRootId = Application.getCompanyRootId(fc);
if (companyRootId != null) {
NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), companyRootId);
this.companyHomeNode = new Node(companyRootRef);
}
}
return this.companyHomeNode;
}
use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class NavigationBean method getGuestHomeNode.
/**
* @return Node representing the Guest Home Space folder
*/
public Node getGuestHomeNode() {
if (this.guestHomeNode == null) {
try {
FacesContext fc = FacesContext.getCurrentInstance();
String xpath = Application.getRootPath(fc) + "/" + Application.getGuestHomeFolderName(fc);
List<NodeRef> guestHomeRefs = this.getSearchService().selectNodes(this.getNodeService().getRootNode(Repository.getStoreRef()), xpath, null, this.getNamespaceService(), false);
if (guestHomeRefs.size() == 1) {
this.guestHomeNode = new Node(guestHomeRefs.get(0));
}
} catch (InvalidNodeRefException err1) {
// cannot continue if this occurs
} catch (AccessDeniedException err2) {
// cannot see node if this occurs
}
}
return this.guestHomeNode;
}
use of javax.faces.context.FacesContext in project acs-community-packaging by Alfresco.
the class SidebarBean method getPlugins.
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* Returns a list of configured plugins
*
* @return List of UIListItem's representing the plugins available
*/
public List<UIListItem> getPlugins() {
if (this.plugins == null) {
FacesContext context = FacesContext.getCurrentInstance();
this.plugins = new ArrayList<UIListItem>();
// create a list entry for each configured plugin
for (String pluginId : this.sidebarConfig.getPlugins().keySet()) {
SidebarPluginConfig plugin = this.sidebarConfig.getPlugin(pluginId);
// resolve the label for the plugin
String label = plugin.getlabelId();
if (label != null) {
label = Application.getMessage(context, label);
}
if (label == null) {
label = plugin.getlabel();
}
if (label == null) {
label = plugin.getId();
}
// resolve the description (tooltip for the plugin)
String tooltip = plugin.getDescriptionId();
if (tooltip != null) {
tooltip = Application.getMessage(context, tooltip);
}
if (tooltip == null) {
tooltip = plugin.getDescription();
}
UIListItem item = new UIListItem();
item.setValue(plugin.getId());
item.setLabel(label);
if (tooltip != null) {
item.setTooltip(tooltip);
}
this.plugins.add(item);
}
}
return this.plugins;
}
Aggregations