-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d04b72
commit f92f523
Showing
22 changed files
with
627 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/target/ | ||
/.metadata/ | ||
/.settings/ | ||
/.classpath | ||
/.project | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<name>Sakai JSF2.2 TOOL IceFaces</name> | ||
<groupId>org.sakaiproject.jsfext</groupId> | ||
<artifactId>kickroster-ice</artifactId> | ||
<version>1.0</version> | ||
<organization> | ||
<name>Universidad de Murcia</name> | ||
<url>http://www.um.es/</url> | ||
</organization> | ||
<inceptionYear>2010</inceptionYear> | ||
<description>JSF2.2 Web Application</description> | ||
<packaging>war</packaging> | ||
|
||
<!-- the base is parent --> | ||
<parent> | ||
<groupId>org.sakaiproject</groupId> | ||
<artifactId>master</artifactId> | ||
<version>12-SNAPSHOT</version> | ||
<relativePath>../master/pom.xml</relativePath> | ||
</parent> | ||
|
||
<properties> | ||
<org.mojarra.version>2.2.14</org.mojarra.version> | ||
<org.icefaces.version>4.1.1</org.icefaces.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.sakaiproject.kernel</groupId> | ||
<artifactId>sakai-kernel-util</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.sakaiproject.kernel</groupId> | ||
<artifactId>sakai-kernel-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.sakaiproject.kernel</groupId> | ||
<artifactId>sakai-component-manager</artifactId> | ||
</dependency> | ||
<!-- Faces Implementation --> | ||
<dependency> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.faces</artifactId> | ||
<version>${org.mojarra.version}</version> | ||
</dependency> | ||
<!-- Icefaces Version --> | ||
<dependency> | ||
<groupId>org.icefaces</groupId> | ||
<artifactId>icefaces</artifactId> | ||
<version>${org.icefaces.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.icefaces</groupId> | ||
<artifactId>icefaces-ace</artifactId> | ||
<version>${org.icefaces.version}</version> | ||
</dependency> | ||
<!-- Sakai JSF --> | ||
<dependency> | ||
<groupId>org.sakaiproject.jsf</groupId> | ||
<artifactId>jsf-app</artifactId> | ||
<version>${sakai.version}</version> | ||
<classifier>jsf2</classifier> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>javax.faces</groupId> | ||
<artifactId>javax.faces-api</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>javax.faces</groupId> | ||
<artifactId>jsf-api</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>javax.faces</groupId> | ||
<artifactId>jsf-impl</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.sakaiproject.jsf</groupId> | ||
<artifactId>jsf-tool</artifactId> | ||
<version>${sakai.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.sakaiproject.jsf</groupId> | ||
<artifactId>jsf-widgets-sun-depend</artifactId> | ||
<version>${sakai.version}</version> | ||
<type>pom</type> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>javax.faces</groupId> | ||
<artifactId>jsf-api</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>javax.faces</groupId> | ||
<artifactId>jsf-impl</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>kickroster-ice</finalName> | ||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory> | ||
<resources> | ||
<resource> | ||
<directory>${basedir}/src/main/bundle</directory> | ||
<includes> | ||
<include>**/*.properties</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>${basedir}/src/main/resources</directory> | ||
<includes> | ||
<include>**/*.*</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
package demo; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import javax.faces.application.FacesMessage; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.event.ActionEvent; | ||
import javax.faces.model.SelectItem; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.icefaces.ace.model.chart.SectorSeries; | ||
import org.icefaces.ace.model.chart.SectorSeries.SectorType; | ||
import org.sakaiproject.authz.api.Member; | ||
import org.sakaiproject.exception.IdUnusedException; | ||
import org.sakaiproject.site.api.Group; | ||
import org.sakaiproject.site.api.Site; | ||
import org.sakaiproject.site.api.SiteService; | ||
import org.sakaiproject.tool.api.ToolManager; | ||
import org.sakaiproject.user.api.User; | ||
import org.sakaiproject.user.api.UserDirectoryService; | ||
|
||
public class RosterBean { | ||
|
||
private static Log log = LogFactory.getLog(RosterBean.class); | ||
|
||
protected String group; | ||
public String getGroup() { return group; } | ||
public void setGroup(String group) { this.group = group; } | ||
|
||
protected UserDirectoryService userDirectoryService; | ||
public void setUserDirectoryService(UserDirectoryService userDirectoryService) { this.userDirectoryService = userDirectoryService; } | ||
|
||
protected SiteService siteService; | ||
public void setSiteService(SiteService siteService) { this.siteService = siteService; } | ||
|
||
protected ToolManager toolManager; | ||
public void setToolManager(ToolManager toolManager) { this.toolManager = toolManager; } | ||
|
||
public String getVersion() { | ||
return FacesContext.class.getPackage().getImplementationVersion() + " IceFaces: 4.1.1"; | ||
} | ||
|
||
public List<SectorSeries> getPieData() { | ||
List<SectorSeries> pieData = new ArrayList<SectorSeries>(); | ||
try { | ||
Map<String,Integer> groups = new HashMap<String,Integer>(); | ||
Site currentSite = siteService.getSite(toolManager.getCurrentPlacement().getContext()); | ||
Collection<Member> currentMembers = currentSite.getMembers(); | ||
for (Member m:currentMembers) { | ||
for (Group g:currentSite.getGroupsWithMember(m.getUserId())) { | ||
Integer i = groups.get(g.getTitle()); | ||
if (i==null) i = 0; | ||
groups.put(g.getTitle(), i++); | ||
} | ||
} | ||
SectorSeries ss = new SectorSeries(); | ||
for (String key:groups.keySet()) { | ||
ss.add(key,groups.get(key)); | ||
} | ||
ss.setType(SectorType.PIE); | ||
ss.setShowDataLabels(true); | ||
ss.setSliceMargin(4); | ||
pieData.add(ss); | ||
} catch (Exception ex) { | ||
log.error("Error getting members.",ex); | ||
} | ||
return pieData; | ||
} | ||
|
||
public List<Participant> getDataModel() { | ||
List<Participant> users = new ArrayList<Participant>(); | ||
try { | ||
Site currentSite = siteService.getSite(toolManager.getCurrentPlacement().getContext()); | ||
if (group==null||group.equals("-")) { | ||
Collection<Member> currentMembers = currentSite.getMembers(); | ||
for (Member m:currentMembers) { | ||
StringBuffer groups = new StringBuffer(""); | ||
for (Group g:currentSite.getGroupsWithMember(m.getUserId())) { | ||
groups.append(g.getTitle() + " "); | ||
} | ||
users.add(new Participant(userDirectoryService.getUser(m.getUserId()),m.getRole().getId(),groups.toString())); | ||
} | ||
} else { | ||
Set<String> groups = new HashSet<String>(); | ||
groups.add(group); | ||
Group grp = currentSite.getGroup(group); | ||
Collection<String> members = currentSite.getMembersInGroups(groups); | ||
for (String m:members) { | ||
Member member = currentSite.getMember(m); | ||
users.add(new Participant(userDirectoryService.getUser(m),member.getRole().getId(),grp.getTitle())); | ||
} | ||
} | ||
} catch (Exception ex) { | ||
log.error("Error getting members.",ex); | ||
} | ||
return users; | ||
} | ||
|
||
public List<SelectItem> getGroupOptions() { | ||
List<SelectItem> items = new ArrayList<SelectItem>(); | ||
items.add(new SelectItem("-","-- Group --")); | ||
if (siteService!=null && toolManager!=null) { | ||
try { | ||
Collection<Group> groups = siteService.getSite(toolManager.getCurrentPlacement().getContext()).getGroups(); | ||
for (Group g:groups) { | ||
items.add(new SelectItem(g.getId(),g.getTitle())); | ||
} | ||
} catch (IdUnusedException ex) { | ||
log.error("Error getting groups.",ex); | ||
} | ||
} | ||
return items; | ||
} | ||
|
||
public void save(ActionEvent actionEvent) { | ||
FacesContext context = FacesContext.getCurrentInstance(); | ||
|
||
context.addMessage(null, new FacesMessage("Successful", "Hello " + group)); | ||
context.addMessage(null, new FacesMessage("Second Message", "Additional Info Here...")); | ||
} | ||
|
||
public class Participant { | ||
|
||
public User user; | ||
public String roleTitle; | ||
public String groupsString; | ||
|
||
public Participant(User user, String roleTitle, String groupsString) { | ||
this.user = user; | ||
this.roleTitle = roleTitle; | ||
this.groupsString = groupsString; | ||
} | ||
|
||
public User getUser() { | ||
return user; | ||
} | ||
|
||
public void setUser(User user) { | ||
this.user = user; | ||
} | ||
|
||
public String getRoleTitle() { | ||
return roleTitle; | ||
} | ||
|
||
public void setRoleTitle(String roleTitle) { | ||
this.roleTitle = roleTitle; | ||
} | ||
|
||
public String getGroupsString() { | ||
return groupsString; | ||
} | ||
|
||
public void setGroupsString(String groupsString) { | ||
this.groupsString = groupsString; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title=JSF | ||
mainTitle=Roster Application | ||
showPrime=Show as graph | ||
showRich=Show as table | ||
firstname=First Name | ||
lastname=Last Name | ||
role=Role | ||
group=Group |
8 changes: 8 additions & 0 deletions
8
kickroster-ice/src/main/resources/demo/messages_es.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title=JSF | ||
mainTitle=Aplicacion Orla | ||
showPrime=Ver como grafico | ||
showRich=Ver como tabla | ||
firstname=Nombre | ||
lastname=Apellidos | ||
role=Rol | ||
group=Grupo |
Oops, something went wrong.