You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(141) |
Sep
(184) |
Oct
(159) |
Nov
(77) |
Dec
(114) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(212) |
Feb
(302) |
Mar
(323) |
Apr
(360) |
May
(302) |
Jun
(392) |
Jul
(299) |
Aug
(858) |
Sep
(499) |
Oct
(489) |
Nov
(324) |
Dec
(438) |
2008 |
Jan
(449) |
Feb
(388) |
Mar
(811) |
Apr
(583) |
May
(949) |
Jun
(1431) |
Jul
(943) |
Aug
(527) |
Sep
(576) |
Oct
(440) |
Nov
(1046) |
Dec
(658) |
2009 |
Jan
(259) |
Feb
(192) |
Mar
(495) |
Apr
(2322) |
May
(2023) |
Jun
(1387) |
Jul
(722) |
Aug
(771) |
Sep
(167) |
Oct
(142) |
Nov
(384) |
Dec
(884) |
2010 |
Jan
(344) |
Feb
(82) |
Mar
(248) |
Apr
(341) |
May
(389) |
Jun
(289) |
Jul
(19) |
Aug
(478) |
Sep
(274) |
Oct
(431) |
Nov
(322) |
Dec
(207) |
2011 |
Jan
(125) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: John C. <jc...@us...> - 2006-09-01 01:11:57
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv782/src/org/tolven/web Modified Files: TopAction.java RegisterAction.java Log Message: Ad checkbox to generate patients during login process, on SelectAccount page. Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TopAction.java 31 Aug 2006 06:49:52 -0000 1.12 --- TopAction.java 1 Sep 2006 01:11:54 -0000 1.13 *************** *** 41,44 **** --- 41,45 ---- import org.tolven.core.entity.TolvenUser; import org.tolven.doc.entity.Invitation; + import org.tolven.gen.CHRGenerator; import org.tolven.security.TolvenPerson; import org.tolven.security.bean.LDAPLocal; *************** *** 60,64 **** --- 61,69 ---- // @EJB private MenuLocal menuLocal; + // @EJB + private CHRGenerator chrGen; + + private boolean genDemoData; private String startPage; private String accountTitle; *************** *** 104,107 **** --- 109,113 ---- invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); propertyBean = (TolvenPropertiesLocal) ctx.lookup("tolven/TolvenProperties/local"); + chrGen = (CHRGenerator) ctx.lookup("tolven/CHRGeneratorBean/local"); } catch (NamingException e) *************** *** 207,210 **** --- 213,220 ---- session.setAttribute("accountId", accountId); accountAdmin = accountUser.isAccountPermission(); + if (this.isGenDemoData()) { + chrGen.createPatients( accountUser.getUser(), accountUser.getAccount(), 100, getTop().getNow(), 1996 ); + } + // Map<String,Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); // for (Object x : sessionMap.keySet().toArray()) { *************** *** 390,393 **** --- 400,409 ---- this.accountTimeZone = accountTimeZone; } + public boolean isGenDemoData() { + return genDemoData; + } + public void setGenDemoData(boolean genDemoData) { + this.genDemoData = genDemoData; + } } Index: RegisterAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RegisterAction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** RegisterAction.java 31 Aug 2006 05:20:09 -0000 1.12 --- RegisterAction.java 1 Sep 2006 01:11:54 -0000 1.13 *************** *** 38,41 **** --- 38,42 ---- import org.tolven.doc.DocumentLocal; import org.tolven.doc.entity.Invitation; + import org.tolven.gen.CHRGenerator; import org.tolven.security.TolvenPerson; import org.tolven.security.bean.LDAPLocal; *************** *** 72,76 **** private String accountTitle; - private boolean demoData; private boolean noActivation; --- 73,76 ---- *************** *** 399,410 **** } - public boolean isDemoData() { - return demoData; - } - - public void setDemoData(boolean demoData) { - this.demoData = demoData; - } - public boolean isNoActivation() { return noActivation; --- 399,402 ---- |
From: John C. <jc...@us...> - 2006-09-01 01:11:57
|
Update of /cvsroot/tolven/tolvenWEB/web/public In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv782/web/public Modified Files: register.xhtml Log Message: Ad checkbox to generate patients during login process, on SelectAccount page. Index: register.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/public/register.xhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** register.xhtml 31 Jul 2006 02:09:28 -0000 1.3 --- register.xhtml 1 Sep 2006 01:11:54 -0000 1.4 *************** *** 58,63 **** <f:selectItem itemLabel="Referral" itemValue="referral"/> </h:selectOneMenu> - <h:selectBooleanCheckbox value="#{reg.demoData}" /> - <h:outputText value="Generate demo data for this account"/> <h:selectBooleanCheckbox value="#{reg.noActivation}" /> <h:outputText value="Skip the email activation step, activate immediately [demo]"/> --- 58,61 ---- |
From: John C. <jc...@us...> - 2006-08-31 23:37:16
|
Update of /cvsroot/tolven/tolvenWEB/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26784/web/WEB-INF Modified Files: faces-config.xml Log Message: Add an option to account administration page to generate patients into the current account. Index: faces-config.xml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/WEB-INF/faces-config.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** faces-config.xml 31 Aug 2006 05:20:09 -0000 1.13 --- faces-config.xml 31 Aug 2006 23:37:14 -0000 1.14 *************** *** 151,154 **** --- 151,159 ---- <to-view-id>/private/adminAccount.xhtml</to-view-id> </navigation-case> + <navigation-case> + <from-action>#{gen.createCHRPatients}</from-action> + <from-outcome>success</from-outcome> + <to-view-id>/private/adminAccount.xhtml</to-view-id> + </navigation-case> </navigation-rule> |
From: John C. <jc...@us...> - 2006-08-31 23:37:16
|
Update of /cvsroot/tolven/tolvenWEB/web/private In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26784/web/private Modified Files: adminAccount.xhtml Log Message: Add an option to account administration page to generate patients into the current account. Index: adminAccount.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/private/adminAccount.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** adminAccount.xhtml 31 Aug 2006 08:28:43 -0000 1.2 --- adminAccount.xhtml 31 Aug 2006 23:37:14 -0000 1.3 *************** *** 93,96 **** --- 93,108 ---- </h:panelGrid> </h:form> + <h3>Generate virtual patients into this account (#{reg.account.id}, #{reg.account.title})</h3> + <p>Generate random patients and add them to this account. Keep the number of patients generated under 500. + You can always add more patients in a second run (the existing patient will remain in the account). Be patient, this will take several minutes to run.</p> + <h:form id="patGen"> + <h:panelGrid columns="2"> + <h:outputText value="Number of Patients"/> + <h:inputText id="count" value="#{gen.numberToGenerate}" size="4"/> + <h:outputText value="Patients began arriving in which year"/> + <h:inputText id="startYear" value="#{gen.generateHistoryFrom}" size="4"/> + </h:panelGrid> + <h:commandButton id="patGenAction" action="#{gen.createCHRPatients}" value="Generate Patients"/> + </h:form> <h:messages globalOnly="true" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> </ui:define> |
From: John C. <jc...@us...> - 2006-08-31 23:37:16
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26784/src/org/tolven/web Modified Files: PersonGenAction.java Log Message: Add an option to account administration page to generate patients into the current account. Index: PersonGenAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/PersonGenAction.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PersonGenAction.java 21 Aug 2006 00:20:06 -0000 1.13 --- PersonGenAction.java 31 Aug 2006 23:37:14 -0000 1.14 *************** *** 139,142 **** --- 139,149 ---- } + public String createCHRPatients( ) throws Exception { + Account account = accountBean.findAccount(getTop().getAccountId()); + chrGen.createPatients( getTop().getUser(), account, getNumberToGenerate(), getTop().getNow(), this.getGenerateHistoryFrom() ); + FacesContext.getCurrentInstance().addMessage( null, new FacesMessage( "" + getNumberToGenerate() + " Patients Created")); + return "success"; + } + /** * Add members of a virtual family to our account. |
From: John C. <jc...@us...> - 2006-08-31 08:30:02
|
Update of /cvsroot/tolven/tolvenWEB/web/private In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3112/web/private Modified Files: userDemog.xhtml Log Message: Tidy up the Photo section Index: userDemog.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/private/userDemog.xhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** userDemog.xhtml 31 Aug 2006 05:20:09 -0000 1.3 --- userDemog.xhtml 31 Aug 2006 08:30:00 -0000 1.4 *************** *** 69,90 **** </h:outputLink> </h:panelGroup> - - <h:panelGroup> - <h:outputText value="Photo"/> - <h:form> - <h:panelGroup rendered="#{reg.user.likeness!=null}"> - <img src="xxx.tdoc?docId=#{reg.user.likeness.id}&width=100&height=100"/> - <h:commandLink action="photo"> - <h:outputText value="Change"/> - </h:commandLink> - </h:panelGroup> - <h:panelGroup rendered="#{reg.user.likeness==null}"> - <h:commandLink action="photo"> - <h:outputText value="Add photo"/> - </h:commandLink> - </h:panelGroup> - </h:form> - </h:panelGroup> </h:panelGrid> <h3>All accounts you are a member of</h3> <h:dataTable value="#{reg.userAccounts}" var="au"> --- 69,87 ---- </h:outputLink> </h:panelGroup> </h:panelGrid> + <h3>Photo</h3> + <h:form> + <h:panelGroup rendered="#{reg.user.likeness!=null}"> + <img src="xxx.tdoc?docId=#{reg.user.likeness.id}&width=100&height=100"/> + <h:commandLink action="photo"> + <h:outputText value="Change"/> + </h:commandLink> + </h:panelGroup> + <h:panelGroup rendered="#{reg.user.likeness==null}"> + <h:commandLink action="photo"> + <h:outputText value="Add photo"/> + </h:commandLink> + </h:panelGroup> + </h:form> <h3>All accounts you are a member of</h3> <h:dataTable value="#{reg.userAccounts}" var="au"> |
From: John C. <jc...@us...> - 2006-08-31 08:29:28
|
Update of /cvsroot/tolven/tolvenWEB/web/templates In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3090/web/templates Modified Files: portalTemplate.xhtml Log Message: Disable footer options when invalid Index: portalTemplate.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/templates/portalTemplate.xhtml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** portalTemplate.xhtml 7 Aug 2006 03:17:29 -0000 1.8 --- portalTemplate.xhtml 31 Aug 2006 08:29:22 -0000 1.9 *************** *** 57,65 **** <li><a target="_blank" href="http://www.tolven.org/index.html">Tolven Home</a></li> <li><a href="#">Help</a></li> ! <li><a href="userDemog.jsf">Preferences</a></li> ! <li><a href="customize.jsf?accountUserId=#{top.accountUserId}">Customize</a></li> <li><a href="#">Literature Search</a></li> ! <li><a href="javascript:showPane('echr:demo');">[Demo]</a></li> ! <li><a href="javascript:getRemoteContent(visiblePage);" >[Refresh]</a></li> </ul> </div> --- 57,69 ---- <li><a target="_blank" href="http://www.tolven.org/index.html">Tolven Home</a></li> <li><a href="#">Help</a></li> ! <h:panelGroup rendered="#{top.accountUserId!=0}"> ! <li><a href="userDemog.jsf">Preferences</a></li> ! <li><a href="customize.jsf?accountUserId=#{top.accountUserId}">Customize</a></li> ! </h:panelGroup> <li><a href="#">Literature Search</a></li> ! <h:panelGroup rendered="#{top.accountUserId!=0}"> ! <li><a href="javascript:showPane('echr:demo');">[Demo]</a></li> ! <li><a href="javascript:getRemoteContent(visiblePage);" >[Refresh]</a></li> ! </h:panelGroup> </ul> </div> |
From: John C. <jc...@us...> - 2006-08-31 08:28:47
|
Update of /cvsroot/tolven/tolvenWEB/web/private In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv2684/web/private Modified Files: adminAccount.xhtml Log Message: Visual cleanup Index: adminAccount.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/private/adminAccount.xhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** adminAccount.xhtml 31 Aug 2006 05:20:09 -0000 1.1 --- adminAccount.xhtml 31 Aug 2006 08:28:43 -0000 1.2 *************** *** 31,40 **** <h:dataTable value="#{reg.accountUsers}" var="au" styleClass="activity"> ! <h:column> <f:facet name="header"> ! <h:outputText value="Internal Id"/> </f:facet> <h:outputText value="#{au.user.id}"/> ! </h:column> <h:column> <f:facet name="header"> --- 31,40 ---- <h:dataTable value="#{reg.accountUsers}" var="au" styleClass="activity"> ! <!--h:column> <f:facet name="header"> ! <h:outputText value="Id"/> </f:facet> <h:outputText value="#{au.user.id}"/> ! </h:column--> <h:column> <f:facet name="header"> *************** *** 77,81 **** <h:column> <f:facet name="header"> ! <h:outputText value="Permission"/> </f:facet> <h:outputText value="me" rendered="#{au.id==top.accountUserId}"/> --- 77,81 ---- <h:column> <f:facet name="header"> ! <h:outputText value="Administrator?"/> </f:facet> <h:outputText value="me" rendered="#{au.id==top.accountUserId}"/> *************** *** 88,92 **** <h:form id="newDemoUser" rendered="#{reg.user.demoUser}"> <h:panelGrid columns="3" > ! <h:outputText value="Add new (demo) user"/> <h:inputText id="uid" value="#{reg.newDemoUser}" size="20"/> <h:commandButton action="#{reg.addDemoUser}" value="Add"/> --- 88,92 ---- <h:form id="newDemoUser" rendered="#{reg.user.demoUser}"> <h:panelGrid columns="3" > ! <h:outputText value="Add existing demo user to this account"/> <h:inputText id="uid" value="#{reg.newDemoUser}" size="20"/> <h:commandButton action="#{reg.addDemoUser}" value="Add"/> |
From: John C. <jc...@us...> - 2006-08-31 06:49:57
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25277/src/org/tolven/ajax Modified Files: AjaxServlet.java Log Message: Include timeZone adjustment in ajax-served dates Index: AjaxServlet.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax/AjaxServlet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AjaxServlet.java 31 Aug 2006 05:19:11 -0000 1.12 --- AjaxServlet.java 31 Aug 2006 06:49:52 -0000 1.13 *************** *** 24,29 **** --- 24,33 ---- import java.util.LinkedList; import java.util.List; + import java.util.Map; + import java.util.TimeZone; + import org.jboss.logging.*; + import javax.faces.context.FacesContext; import javax.naming.InitialContext; import javax.naming.NamingException; *************** *** 57,60 **** --- 61,65 ---- import org.tolven.web.AgeFormat; import org.tolven.web.RequestPerformanceItem; + import org.tolven.web.TopAction; /** * A Servlet that responds to Live Grid data requests. See http://openrico.org/docs/RicoLiveGrid.pdf for details of *************** *** 174,177 **** --- 179,196 ---- String sortCol = req.getParameter( "sort_col"); String sortDir = req.getParameter( "sort_dir"); + // Figure out timeZone + TimeZone timeZone; + Object topObj = req.getSession(false).getAttribute("top"); + if (topObj==null) { + System.out.println( "[AjaxServlet] Top Obj is null - how can that be"); + timeZone = TimeZone.getDefault(); + } + else if (topObj instanceof TopAction) { + TopAction top = (org.tolven.web.TopAction)topObj; + timeZone = TimeZone.getTimeZone(top.getTimeZone()); + } else { + timeZone = TimeZone.getDefault(); + System.out.println( "[AjaxServlet] Top class is " + topObj.getClass().getName() + " - how can that be"); + } if (sortDir==null) { sortDir = "ASC"; *************** *** 233,236 **** --- 252,256 ---- } else { SimpleDateFormat sdf = new SimpleDateFormat( col.getDisplayFunction()); + sdf.setTimeZone(timeZone); writer.write(sdf.format(val)); } |
From: John C. <jc...@us...> - 2006-08-31 06:49:55
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25277/src/org/tolven/web Modified Files: TopAction.java Log Message: Include timeZone adjustment in ajax-served dates Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TopAction.java 31 Aug 2006 05:20:09 -0000 1.11 --- TopAction.java 31 Aug 2006 06:49:52 -0000 1.12 *************** *** 207,210 **** --- 207,214 ---- session.setAttribute("accountId", accountId); accountAdmin = accountUser.isAccountPermission(); + // Map<String,Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap(); + // for (Object x : sessionMap.keySet().toArray()) { + // System.out.println( "Session Attribute: " + x ); + // } return "portal3"; } |
From: John C. <jc...@us...> - 2006-08-31 06:48:54
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv24868/src/org/tolven/web Modified Files: RequestPerformanceItem.java Log Message: Add comments Index: RequestPerformanceItem.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RequestPerformanceItem.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RequestPerformanceItem.java 21 Aug 2006 00:20:06 -0000 1.2 --- RequestPerformanceItem.java 31 Aug 2006 06:48:51 -0000 1.3 *************** *** 15,19 **** import java.util.Date; ! public class RequestPerformanceItem { Date timestamp; --- 15,23 ---- import java.util.Date; ! /** ! * Simple bean that holds one response timing entry. ! * @author John Churin ! * ! */ public class RequestPerformanceItem { Date timestamp; |
From: John C. <jc...@us...> - 2006-08-31 06:48:28
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv24841/src/org/tolven/app/bean Modified Files: MenuBean.java Log Message: Turn off a trace message Index: MenuBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean/MenuBean.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MenuBean.java 28 Aug 2006 19:37:35 -0000 1.28 --- MenuBean.java 31 Aug 2006 06:48:24 -0000 1.29 *************** *** 142,146 **** } } ! System.out.println( "MenuData Query: " + qs.toString()); Query query = em.createQuery( qs.toString() ); query.setParameter( "m", ctrl.getMenuStructure() ); --- 142,146 ---- } } ! // System.out.println( "MenuData Query: " + qs.toString()); Query query = em.createQuery( qs.toString() ); query.setParameter( "m", ctrl.getMenuStructure() ); |
From: John C. <jc...@us...> - 2006-08-31 05:20:15
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20672/src/org/tolven/web Modified Files: DocAction.java TopAction.java RegisterAction.java AccountAction.java Log Message: Improvements to Account and User preferences, see rel notes Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TopAction.java 21 Aug 2006 00:20:06 -0000 1.10 --- TopAction.java 31 Aug 2006 05:20:09 -0000 1.11 *************** *** 15,18 **** --- 15,19 ---- import java.io.IOException; + import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; *************** *** 64,74 **** private long invitationId; private TolvenUser user; ! private TolvenPerson tp; private long accountUserId; private long accountId; ! // One-time ignore default account private boolean ignoreDefault; --- 65,80 ---- private long invitationId; private TolvenUser user; + + private String timeZone; ! private String accountTimeZone; ! ! private TolvenPerson tp; private long accountUserId; private long accountId; ! private boolean accountAdmin; ! // One-time ignore default account private boolean ignoreDefault; *************** *** 116,121 **** } ! public String getServerTime( ) { ! return getNow().toString(); } /** --- 122,127 ---- } ! public String getServerTime( ) throws IOException { ! return "Transaction time at the server: " + getNow().toString() + ", TimeZone of user is " + getTimeZone(); } /** *************** *** 193,196 **** --- 199,203 ---- accountId = accountUser.getAccount().getId(); setAccountTitle( accountUser.getAccount().getTitle()); + setAccountTimeZone( accountUser.getAccount().getTimeZone()); // Ensure that this user has a menu structure setup menuLocal.createDefaultMenuStructure( accountUser.getAccount() ); *************** *** 199,202 **** --- 206,210 ---- HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); session.setAttribute("accountId", accountId); + accountAdmin = accountUser.isAccountPermission(); return "portal3"; } *************** *** 340,343 **** --- 348,389 ---- this.accountTitle = accountTitle; } + /** + * Read-only attribute indicating if this user has permission to administer account or not. + * If the flag changes in the database, user must log out and log back in to get the new setting. + * @return + */ + public boolean isAccountAdmin() { + return accountAdmin; + } + + /** + * Get the default timezone for this user, the first non-null value is select: + * <ol> + * <li>The user's timezone if not null</li> + * <li>The account's timezone if not null</li> + * <li>From tolven.properties: tolven.timezone</li> + * <li>From Java TimeZone.getDefault()</li> + * </ol> + * @return + * @throws IOException + */ + public String getTimeZone() throws IOException { + if (timeZone==null) timeZone = getUser().getTimeZone(); + if (timeZone==null) timeZone = getAccountTimeZone(); + if (timeZone==null) timeZone = propertyBean.getProperties().getProperty("tolven.timezone"); + if (timeZone==null) timeZone = java.util.TimeZone.getDefault().getID(); + return timeZone; + } + + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } + + public String getAccountTimeZone() { + return accountTimeZone; + } + public void setAccountTimeZone(String accountTimeZone) { + this.accountTimeZone = accountTimeZone; + } } Index: DocAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/DocAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DocAction.java 21 Aug 2006 00:20:06 -0000 1.5 --- DocAction.java 31 Aug 2006 05:20:09 -0000 1.6 *************** *** 23,26 **** --- 23,27 ---- import org.tolven.doc.DocumentLocal; import org.tolven.doc.entity.DocBase; + import org.tolven.doc.entity.DocImage; /** *************** *** 59,70 **** return "success"; } ! ! public List<DocBase> getDocuments() { ! long startTime = System.currentTimeMillis(); ! List<DocBase> rslt = docBean.findDocuments(getTop().getUser().getId(), 100, 0, "id", "ASC"); ! double elapsed = (System.currentTimeMillis() - startTime); ! elapsedTime = String.format("Elapsed: %.3f sec ", elapsed/1000); ! return rslt; ! } public long getCurrentDocId( ) { --- 60,64 ---- return "success"; } ! public long getCurrentDocId( ) { *************** *** 78,89 **** /** ! * Return the specified family member */ ! public DocBase getPhoto() { // Get the familt we're looking for long id = getCurrentDocId(); ! return docBean.findDocument( id ); } /** * Return a count of the number of photos owned/authored by the current user --- 72,87 ---- /** ! * Return the specified photo */ ! public DocImage getPhoto() { // Get the familt we're looking for long id = getCurrentDocId(); ! return docBean.findImage( id, getTop().getAccountId() ); } + public List<DocImage> getPhotos() { + List<DocImage> rslt = docBean.findImages(getTop().getAccountId(), 100, 0, "id", "ASC"); + return rslt; + } /** * Return a count of the number of photos owned/authored by the current user *************** *** 91,95 **** */ public int getPhotoCount() { ! return (int) docBean.countPhotos(getAuthor()); } --- 89,93 ---- */ public int getPhotoCount() { ! return (int) docBean.countImages(getTop().getAccountId()); } Index: RegisterAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RegisterAction.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RegisterAction.java 21 Aug 2006 00:20:06 -0000 1.11 --- RegisterAction.java 31 Aug 2006 05:20:09 -0000 1.12 *************** *** 14,22 **** --- 14,26 ---- package org.tolven.web; import java.io.IOException; + import java.util.ArrayList; import java.util.Date; import java.util.List; + import java.util.Map; + import java.util.TimeZone; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; + import javax.faces.model.SelectItem; import javax.naming.InitialContext; import javax.naming.NamingException; *************** *** 29,32 **** --- 33,37 ---- import org.tolven.core.InvitationLocal; import org.tolven.core.TolvenPropertiesLocal; + import org.tolven.core.entity.Account; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.TolvenUser; *************** *** 62,65 **** --- 67,75 ---- private String testResult; + private AccountUser accountUser; + private Account account; + + private String accountTitle; + private boolean demoData; private boolean noActivation; *************** *** 67,70 **** --- 77,84 ---- private FileItem likenessFile; + private String newDemoUser; + + private List<SelectItem> timeZones; + // Search Criteria private String searchCriteria; *************** *** 77,80 **** --- 91,96 ---- private TolvenUser user; // A list of all accounts this user is a member of + private List<AccountUser> userAccounts; + // a list of all users for an account private List<AccountUser> accountUsers; *************** *** 104,108 **** --- 120,159 ---- searchCriteria = "*"; } + + /** + * Read-only attribute to get the account-user associated with this user + * @return + */ + public AccountUser getAccountUser() { + if (accountUser==null) { + accountUser = activation.findAccountUser(getTop().getAccountUserId()); + } + return accountUser; + } + /** + * Read-only attribute to get the account associated with this user + * @return + */ + public Account getAccount() { + if (account==null) { + account = accountBean.findAccount(getTop().getAccountId()); + } + return account; + } + + /** + * Action to update the account + * @return "success" + */ + public String updateAccount() { + getAccount().setTitle(getAccountTitle()); + getTop().setAccountTitle(getAccountTitle()); + getTop().setAccountTimeZone(getAccount().getTimeZone()); + // Reset the timezone + getTop().setTimeZone(null); + return "success"; + } + public String sendTestMessage( ) throws Exception { invitationBean.sendTestMessage(getTp().getUid()); *************** *** 187,190 **** --- 238,243 ---- // And update the user object now, too if (user!=null) activation.updateUser( user ); + // Reset the timezone + getTop().setTimeZone(null); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage("Preference update completed " + new Date())); // If there's a new likeness, load it also. *************** *** 372,376 **** public List<AccountUser> getAccountUsers() throws NamingException, IOException { ! if (accountUsers==null) accountUsers = activation.findAccountUsers( getUser() ); return accountUsers; } --- 425,429 ---- public List<AccountUser> getAccountUsers() throws NamingException, IOException { ! if (accountUsers==null) accountUsers = activation.findAccountUsers( getAccount() ); return accountUsers; } *************** *** 380,382 **** --- 433,485 ---- } + public String getAccountTitle() { + if (accountTitle==null) accountTitle = getAccount().getTitle(); + return accountTitle; + } + + public void setAccountTitle(String accountTitle) { + this.accountTitle = accountTitle; + } + + public List<AccountUser> getUserAccounts() throws NamingException, IOException { + if (userAccounts==null) userAccounts = activation.findUserAccounts( getUser() ); + return userAccounts; + } + + public void setUserAccounts(List<AccountUser> userAccounts) { + this.userAccounts = userAccounts; + } + + public String addDemoUser( ) { + if (getNewDemoUser()==null) return "success"; + String uid = getNewDemoUser().toLowerCase().trim(); + TolvenUser user = accountBean.findUser(uid); + if (user==null) { + FacesContext.getCurrentInstance().addMessage( null, new FacesMessage("Demo user " + uid + " not found")); + return "fail"; + } + AccountUser accountUser = accountBean.addAccountUser(getAccount(), user, getNow(), false ); + FacesContext.getCurrentInstance().addMessage( null, new FacesMessage("Demo user " + uid + " added, id: " + accountUser.getUser().getId())); + return "success"; + } + + public String getNewDemoUser() { + return newDemoUser; + } + + public void setNewDemoUser(String newDemoUser) { + this.newDemoUser = newDemoUser; + } + + public List<SelectItem> getTimeZones() { + if (timeZones==null) { + timeZones = new ArrayList<SelectItem>( 30 ); + String zones[] = TimeZone.getAvailableIDs(); + timeZones.add(new SelectItem( null, "Use Default")); + for (String zone : zones) { + timeZones.add(new SelectItem( zone, zone)); + } + } + return timeZones; + } } Index: AccountAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/AccountAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AccountAction.java 21 Aug 2006 00:20:06 -0000 1.5 --- AccountAction.java 31 Aug 2006 05:20:09 -0000 1.6 *************** *** 70,74 **** */ public List<AccountUser> getAccountUsers() { ! if (accountUsers==null) accountUsers = activation.findAccountUsers(getTop().getUser()); return accountUsers; } --- 70,74 ---- */ public List<AccountUser> getAccountUsers() { ! if (accountUsers==null) accountUsers = activation.findUserAccounts(getTop().getUser()); return accountUsers; } |
From: John C. <jc...@us...> - 2006-08-31 05:20:14
|
Update of /cvsroot/tolven/tolvenWEB/web/private In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20672/web/private Modified Files: prefPhotos.xhtml userDemog.xhtml Added Files: adminAccount.xhtml Log Message: Improvements to Account and User preferences, see rel notes Index: prefPhotos.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/private/prefPhotos.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** prefPhotos.xhtml 2 Aug 2006 01:28:58 -0000 1.2 --- prefPhotos.xhtml 31 Aug 2006 05:20:09 -0000 1.3 *************** *** 7,11 **** <head> <title>User Photos</title> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> --- 7,10 ---- *************** *** 14,57 **** <ui:define name="content"> <div> ! <h2>Select a photo to be used as your likeness</h2> ! <p>The likeness you select can be seen by others when you send them a link to your data. ! It is not publically available. If you prefer not to have any photo likeness shown, click No photo below. ! Otherwise, photos in this list remain private to you.</p> ! <h:form id="photoSel"> ! <h:dataTable value="#{doc.documents}" var="p" > ! <h:column> ! <f:facet name="header"> ! <h:outputText value="id"/> ! </f:facet> ! <h:outputText value="#{p.id}"/> ! </h:column> ! <h:column> ! <f:facet name="header"> ! <h:outputText value="photo"/> ! </f:facet> ! <h:panelGroup rendered="#{p.id==reg.user.likeness.id}"> ! <img src="xxx.tdoc?docId=#{p.id}&width=100&height=100" /> [current] ! </h:panelGroup> ! <h:panelGroup rendered="#{p.id!=reg.user.likeness.id}"> ! <h:commandLink action="${reg.selectAsLikeness}"> ! <f:param name="selectedLikenessId" value="#{p.id}"/> ! <img src="xxx.tdoc?docId=#{p.id}&width=100&height=100" /> ! </h:commandLink> ! </h:panelGroup> ! </h:column> ! </h:dataTable> ! <h:commandLink action="${reg.selectAsLikeness}"> ! <f:param name="selectedLikenessId" value="0"/> ! <h:outputText value="No photo"/> ! </h:commandLink> ! <h:commandButton action="cancel" immediate="true" value="Cancel"/> ! </h:form> ! <form id="uploadForm" method="post" enctype="multipart/form-data" ! action="likeness.tdoc?userId=#{top.user.id}"> ! File to upload: <input type="file" name="upfile" /> ! <input type="hidden" name="returnTo" value="prefPhotos.jsf"/> ! <input type="submit" value="Upload Now" /> ! </form> ! <h:outputText value="[Id: #{top.user.id}]"/> </div> </ui:define> --- 13,56 ---- <ui:define name="content"> <div> ! <h2>Select a photo to be used as your likeness</h2> ! <p>The likeness you select can be seen by others when you send them a link to your data. ! It is not publically available. If you prefer not to have any photo likeness shown, click <i>No photo</i> below. ! Other photos in this list remain private to your account (subaccount).</p> ! <h:form id="photoSel"> ! <h:dataTable value="#{doc.photos}" var="p" > ! <h:column> ! <f:facet name="header"> ! <h:outputText value="id"/> ! </f:facet> ! <h:outputText value="#{p.id}"/> ! </h:column> ! <h:column> ! <f:facet name="header"> ! <h:outputText value="photo"/> ! </f:facet> ! <h:panelGroup rendered="#{p.id==reg.user.likeness.id}"> ! <img src="xxx.tdoc?docId=#{p.id}&width=100&height=100" /> [current] ! </h:panelGroup> ! <h:panelGroup rendered="#{p.id!=reg.user.likeness.id}"> ! <h:commandLink action="${reg.selectAsLikeness}"> ! <f:param name="selectedLikenessId" value="#{p.id}"/> ! <img src="xxx.tdoc?docId=#{p.id}&width=100&height=100" /> ! </h:commandLink> ! </h:panelGroup> ! </h:column> ! </h:dataTable> ! <h:commandLink action="${reg.selectAsLikeness}"> ! <f:param name="selectedLikenessId" value="0"/> ! <h:outputText value="No photo"/> ! </h:commandLink> ! <h:commandButton action="cancel" immediate="true" value="Cancel"/> ! </h:form> ! <form id="uploadForm" method="post" enctype="multipart/form-data" ! action="likeness.tdoc?userId=#{top.user.id}"> ! File to upload: <input type="file" name="upfile" /> ! <input type="hidden" name="returnTo" value="prefPhotos.jsf"/> ! <input type="submit" value="Upload Now" /> ! </form> ! <h:outputText value="[Id: #{top.user.id}]"/> </div> </ui:define> Index: userDemog.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/private/userDemog.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** userDemog.xhtml 2 Aug 2006 01:28:58 -0000 1.2 --- userDemog.xhtml 31 Aug 2006 05:20:09 -0000 1.3 *************** *** 14,64 **** <ui:define name="content"> <h3>User Preferences</h3> ! <h:form id="register"> ! <h:panelGrid columns="2"> ! <h:outputText value="Photo"/> ! <h:panelGroup> ! <h:panelGroup rendered="#{reg.user.likeness!=null}"> ! <img src="xxx.tdoc?docId=#{reg.user.likeness.id}&width=100&height=100"/> ! <h:commandLink action="photo"> ! <h:outputText value="Change"/> ! </h:commandLink> ! </h:panelGroup> ! <h:panelGroup rendered="#{reg.user.likeness==null}"> ! <h:commandLink action="photo"> ! <h:outputText value="Add photo"/> ! </h:commandLink> ! </h:panelGroup> ! </h:panelGroup> ! <h:outputText value="Email address/user id"/> ! <h:panelGroup> ! <h:panelGroup> ! <h:inputText id="uid" value="#{reg.tp.uid}" size="50" readonly="true"/> ! <h:message for="uid" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:commandButton action="#{reg.sendTestMessage}" value="Test eMail"/> ! </h:panelGroup> ! <h:outputText value="First Name"/> ! <h:panelGroup> ! <h:inputText id="givenName" value="#{reg.tp.givenName}" size="50" required="true"/> ! <h:message for="givenName" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:outputText value="Last Name"/> ! <h:panelGroup> ! <h:inputText id="sn" value="#{reg.tp.sn}" size="50" required="true"/> ! <h:message for="sn" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:outputText value="New Password"/> ! <h:panelGroup> ! <h:inputSecret id="userPassword" value="#{reg.tp.userPassword}" size="50"/> ! <h:message for="userPassword" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> </h:panelGroup> ! <h:outputText value="Repeat New Password"/> <h:panelGroup> ! <h:inputSecret id="userPassword2" value="#{reg.repeatUserPassword}" size="50"/> ! <h:message for="userPassword2" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> </h:panelGroup> ! </h:panelGrid> ! <h3>Accounts you are a member of</h3> ! <h:dataTable value="#{reg.accountUsers}" var="au"> <h:column> <f:facet name="header"> --- 14,92 ---- <ui:define name="content"> <h3>User Preferences</h3> ! <h:form id="register"> ! <h:panelGrid columns="2"> ! <h:outputText value="Email address/user id"/> ! <h:panelGroup> ! <h:panelGroup> ! <h:inputText id="uid" value="#{reg.tp.uid}" size="50" readonly="true"/> ! <h:message for="uid" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:commandButton action="#{reg.sendTestMessage}" value="Send Test eMail" rendered="#{!reg.user.demoUser}"/> ! </h:panelGroup> ! <h:outputText value="First Name"/> ! <h:panelGroup> ! <h:inputText id="givenName" value="#{reg.tp.givenName}" size="50" required="true"/> ! <h:message for="givenName" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:outputText value="Last Name"/> ! <h:panelGroup> ! <h:inputText id="sn" value="#{reg.tp.sn}" size="50" required="true"/> ! <h:message for="sn" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:outputText value="New Password"/> ! <h:panelGroup> ! <h:inputSecret id="userPassword" value="#{reg.tp.userPassword}" size="50"/> ! <h:message for="userPassword" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:outputText value="Repeat New Password"/> ! <h:panelGroup> ! <h:inputSecret id="userPassword2" value="#{reg.repeatUserPassword}" size="50"/> ! <h:message for="userPassword2" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! </h:panelGroup> ! <h:outputText value="User #{reg.user.ldapUID}'s Timezone"/> ! <h:selectOneMenu value="#{reg.user.timeZone}" > ! <f:selectItems value="#{reg.timeZones}"/> ! </h:selectOneMenu> ! <h:outputText value="Account Timezone"/> ! <h:outputText value="#{top.accountTimeZone}" /> ! <h:outputText value="Current Timezone"/> ! <h:outputText value="#{top.timeZone}" /> ! </h:panelGrid> ! <h:messages globalOnly="true" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> ! <h:panelGrid columns="1"> ! <h:commandButton action="cancel" immediate="true" value="Cancel"/> ! <h:commandButton action="#{reg.updatePrefs}" value="Update Preferences"/> ! <h:outputLink value="deleteUser.jsf"> ! <h:outputText value="Delete User"/> ! </h:outputLink> ! </h:panelGrid> ! </h:form> ! <h3>You are logged into account #{reg.account.id} #{reg.account.title}</h3> ! <h:panelGrid columns="1"> ! <h:panelGroup rendered="#{top.accountAdmin}"> ! <h:outputLink value="adminAccount.jsf"> ! <h:outputText value="Administer this account"/> ! </h:outputLink> </h:panelGroup> ! <h:panelGroup> ! <h:outputText value="Photo"/> ! <h:form> ! <h:panelGroup rendered="#{reg.user.likeness!=null}"> ! <img src="xxx.tdoc?docId=#{reg.user.likeness.id}&width=100&height=100"/> ! <h:commandLink action="photo"> ! <h:outputText value="Change"/> ! </h:commandLink> ! </h:panelGroup> ! <h:panelGroup rendered="#{reg.user.likeness==null}"> ! <h:commandLink action="photo"> ! <h:outputText value="Add photo"/> ! </h:commandLink> ! </h:panelGroup> ! </h:form> </h:panelGroup> ! </h:panelGrid> ! <h3>All accounts you are a member of</h3> ! <h:dataTable value="#{reg.userAccounts}" var="au"> <h:column> <f:facet name="header"> *************** *** 85,99 **** <h:selectBooleanCheckbox value="#{au.defaultAccount}"/> </h:column> </h:dataTable> - <h:panelGrid columns="1"> - <h:commandButton action="cancel" immediate="true" value="Cancel"/> - <h:commandButton action="#{reg.updatePrefs}" value="Update Preferences"/> - <h:outputLink value="deleteUser.jsf"> - <h:outputText value="Delete User"/> - </h:outputLink> - </h:panelGrid> - <h:messages globalOnly="true" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> - - </h:form> <h:outputText value="[Id: #{reg.user.id}]"/> </ui:define> --- 113,123 ---- <h:selectBooleanCheckbox value="#{au.defaultAccount}"/> </h:column> + <h:column> + <f:facet name="header"> + <h:outputText value="Permission"/> + </f:facet> + <h:outputText value="admin" rendered="#{au.accountPermission}"/> + </h:column> </h:dataTable> <h:outputText value="[Id: #{reg.user.id}]"/> </ui:define> --- NEW FILE: adminAccount.xhtml --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core"> <head> <title>User Preferences</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <ui:composition template="../templates/portalTemplate.xhtml"> <ui:define name="content"> <h3>Account #{reg.account.id} #{reg.account.title}</h3> <h:outputText value="This is a demo account" rendered="#{reg.user.demoUser}"/> <h:form id="accountAdmin"> <h:panelGrid columns="2"> <h:outputText value="Account Title"/> <h:inputText value="#{reg.accountTitle}" size="50" /> <h:outputText value="Account Timezone"/> <h:selectOneMenu value="#{reg.account.timeZone}" > <f:selectItems value="#{reg.timeZones}"/> </h:selectOneMenu> <h:outputText value="User #{reg.user.ldapUID}'s Timezone"/> <h:outputText value="#{reg.user.timeZone}" /> <h:outputText value="Current Timezone"/> <h:outputText value="#{top.timeZone}" /> </h:panelGrid> <h:dataTable value="#{reg.accountUsers}" var="au" styleClass="activity"> <h:column> <f:facet name="header"> <h:outputText value="Internal Id"/> </f:facet> <h:outputText value="#{au.user.id}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="User Id"/> </f:facet> <h:outputText value="#{au.user.ldapUID}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Status"/> </f:facet> <h:outputText value="#{au.status}" rendered="#{au.id==top.accountUserId}"/> <h:selectOneMenu value="#{au.status}" rendered="#{au.id!=top.accountUserId}"> <f:selectItem itemValue="ACTIVE" itemLabel="ACTIVE"/> <f:selectItem itemValue="INACTIVE" itemLabel="INACTIVE"/> </h:selectOneMenu> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Effective"/> </f:facet> <h:outputText value="#{au.effectiveDate}"> <f:convertDateTime dateStyle="medium" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Expiration"/> </f:facet> <h:outputText value="#{au.expirationDate}"> <f:convertDateTime dateStyle="medium" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Authority"/> </f:facet> <h:outputText value="tbd"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Permission"/> </f:facet> <h:outputText value="me" rendered="#{au.id==top.accountUserId}"/> <h:selectBooleanCheckbox value="#{au.accountPermission}" rendered="#{au.id!=top.accountUserId}"/> </h:column> </h:dataTable> <h:commandButton action="cancel" immediate="true" value="Cancel"/> <h:commandButton action="#{reg.updateAccount}" value="Update"/> </h:form> <h:form id="newDemoUser" rendered="#{reg.user.demoUser}"> <h:panelGrid columns="3" > <h:outputText value="Add new (demo) user"/> <h:inputText id="uid" value="#{reg.newDemoUser}" size="20"/> <h:commandButton action="#{reg.addDemoUser}" value="Add"/> </h:panelGrid> </h:form> <h:messages globalOnly="true" errorClass="errorMsg" infoClass="infoMsg" warnClass="warnMsg" fatalClass="fatalMsg"/> </ui:define> </ui:composition> </body> </html> |
From: John C. <jc...@us...> - 2006-08-31 05:20:14
|
Update of /cvsroot/tolven/tolvenWEB/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20672/web/WEB-INF Modified Files: faces-config.xml Log Message: Improvements to Account and User preferences, see rel notes Index: faces-config.xml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/WEB-INF/faces-config.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** faces-config.xml 21 Aug 2006 01:45:06 -0000 1.12 --- faces-config.xml 31 Aug 2006 05:20:09 -0000 1.13 *************** *** 129,132 **** --- 129,158 ---- <navigation-rule> <description> + Account Administration + </description> + <from-view-id>/private/adminAccount.xhtml</from-view-id> + <navigation-case> + <from-action>#{reg.updateAccount}</from-action> + <from-outcome>success</from-outcome> + <to-view-id>/private/userDemog.xhtml</to-view-id> + <redirect/> + </navigation-case> + <navigation-case> + <from-action>#{reg.addDemoUser}</from-action> + <from-outcome>success</from-outcome> + <to-view-id>/private/adminAccount.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>cancel</from-outcome> + <to-view-id>/private/userDemog.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>fail</from-outcome> + <to-view-id>/private/adminAccount.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + + <navigation-rule> + <description> User Preferences </description> |
From: John C. <jc...@us...> - 2006-08-31 05:20:06
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/gen/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20640/src/org/tolven/gen/bean Modified Files: DiabetesGen.java Log Message: Improvements to Account and User preferences, see rel notes Index: DiabetesGen.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/gen/bean/DiabetesGen.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DiabetesGen.java 29 Aug 2006 21:10:32 -0000 1.8 --- DiabetesGen.java 31 Aug 2006 05:20:03 -0000 1.9 *************** *** 41,45 **** new LabTestScenario("hemoglobin A1C test", "%", "7 (or less)", 1, new GaussianValueGen( 6.0, rng.nextUniform(0.5, 1.3)) ), new LabTestScenario("Creatinine", "mg/dL", "0.9 to 1.4 mg/dL", 1, new GaussianValueGen( 1.2, rng.nextUniform(0.1, 0.3)) ), ! new BatteryScenario( "Cholesterol, Total", new Scenario[] { new LabTestScenario("low-density lipoprotein (LDL)", "mg/dL", ">100 mg/dL", 0, new GaussianValueGen( 85.0, rng.nextUniform(10.0, 20.0)) ), new LabTestScenario("triglycerides", "mg/dL", ">150 mg/dL", 0, new GaussianValueGen( 140.0, rng.nextUniform(5.0, 15.0)) ) --- 41,45 ---- new LabTestScenario("hemoglobin A1C test", "%", "7 (or less)", 1, new GaussianValueGen( 6.0, rng.nextUniform(0.5, 1.3)) ), new LabTestScenario("Creatinine", "mg/dL", "0.9 to 1.4 mg/dL", 1, new GaussianValueGen( 1.2, rng.nextUniform(0.1, 0.3)) ), ! new BatteryScenario( "Lipid Panel", new Scenario[] { new LabTestScenario("low-density lipoprotein (LDL)", "mg/dL", ">100 mg/dL", 0, new GaussianValueGen( 85.0, rng.nextUniform(10.0, 20.0)) ), new LabTestScenario("triglycerides", "mg/dL", ">150 mg/dL", 0, new GaussianValueGen( 140.0, rng.nextUniform(5.0, 15.0)) ) *************** *** 50,54 **** new LabTestScenario("hemoglobin A1C test", "%", "7 (or less)", 1, new GaussianValueGen( 9.0, rng.nextUniform(1.0, 3.5)) ), new LabTestScenario("Creatinine", "mg/dL", "0.9 to 1.4 mg/dL", 1, new GaussianValueGen( 1.1, rng.nextUniform(0.3, 0.7)) ), ! new BatteryScenario( "Cholesterol, Total", new Scenario[] { new LabTestScenario("low-density lipoprotein (LDL)", "mg/dL", ">100 mg/dL", 0, new GaussianValueGen( 165.0, rng.nextUniform(10.0, 40.0)) ), new LabTestScenario("triglycerides", "mg/dL", ">150 mg/dL", 0, new GaussianValueGen( 180.0, rng.nextUniform(15.0, 28.0)) ) --- 50,54 ---- new LabTestScenario("hemoglobin A1C test", "%", "7 (or less)", 1, new GaussianValueGen( 9.0, rng.nextUniform(1.0, 3.5)) ), new LabTestScenario("Creatinine", "mg/dL", "0.9 to 1.4 mg/dL", 1, new GaussianValueGen( 1.1, rng.nextUniform(0.3, 0.7)) ), ! new BatteryScenario( "Lipid Panel", new Scenario[] { new LabTestScenario("low-density lipoprotein (LDL)", "mg/dL", ">100 mg/dL", 0, new GaussianValueGen( 165.0, rng.nextUniform(10.0, 40.0)) ), new LabTestScenario("triglycerides", "mg/dL", ">150 mg/dL", 0, new GaussianValueGen( 180.0, rng.nextUniform(15.0, 28.0)) ) |
From: John C. <jc...@us...> - 2006-08-31 05:20:06
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/core/entity In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20640/src/org/tolven/core/entity Modified Files: TolvenUser.java Account.java Log Message: Improvements to Account and User preferences, see rel notes Index: Account.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/core/entity/Account.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Account.java 21 Aug 2006 00:26:29 -0000 1.6 --- Account.java 31 Aug 2006 05:20:03 -0000 1.7 *************** *** 47,50 **** --- 47,56 ---- private AccountType accountType; + @Column( name="TIME_ZONE", length=40) + private String timeZone; + + @Column( name="USER_LOCALE", length=10) + private String locale; + @Column( name="KNOWN_TYPE", length=20) private String knownType; *************** *** 177,180 **** --- 183,198 ---- this.healthRecords = healthRecords; } + public String getLocale() { + return locale; + } + public void setLocale(String locale) { + this.locale = locale; + } + public String getTimeZone() { + return timeZone; + } + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } } Index: TolvenUser.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/core/entity/TolvenUser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TolvenUser.java 21 Aug 2006 00:26:29 -0000 1.5 --- TolvenUser.java 31 Aug 2006 05:20:03 -0000 1.6 *************** *** 67,70 **** --- 67,79 ---- private String status; + @Column( name="TIME_ZONE", length=40) + private String timeZone; + + @Column( name="USER_LOCALE", length=10) + private String locale; + + @Column( name="DEMO_USER" ) + private boolean demoUser; + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn( name="LIKENESS_DOC_ID") *************** *** 159,162 **** --- 168,195 ---- this.likeness = likeness; } + + public boolean isDemoUser() { + return demoUser; + } + + public void setDemoUser(boolean demoUser) { + this.demoUser = demoUser; + } + + public String getTimeZone() { + return timeZone; + } + + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } + + public String getLocale() { + return locale; + } + + public void setLocale(String locale) { + this.locale = locale; + } |
From: John C. <jc...@us...> - 2006-08-31 05:20:05
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/core/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20640/src/org/tolven/core/bean Modified Files: ActivationBean.java Log Message: Improvements to Account and User preferences, see rel notes Index: ActivationBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/core/bean/ActivationBean.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ActivationBean.java 21 Aug 2006 00:26:29 -0000 1.13 --- ActivationBean.java 31 Aug 2006 05:20:03 -0000 1.14 *************** *** 101,105 **** if (!principal.equals(activate.getPrincipal())) return false; // OK, we're good to go. Create the user and mark the invitation as used ! createTolvenUser( principal, now ); // Note: We don't actually check this the next time around. If something goes wrong and the invitation is // still valid, it's OK to reuse it. But it's nice for keeping track of which are used. --- 101,106 ---- if (!principal.equals(activate.getPrincipal())) return false; // OK, we're good to go. Create the user and mark the invitation as used ! TolvenUser user = createTolvenUser( principal, now ); ! user.setDemoUser(false); // Note: We don't actually check this the next time around. If something goes wrong and the invitation is // still valid, it's OK to reuse it. But it's nice for keeping track of which are used. *************** *** 162,166 **** /** ! * Used for test, demo only. Register and immediately activate the user without sending an email. Rhe user id does not need to be a valid email address. * @param tp A TolvenPerson object representing the LDAP attributes of this user (A TolvenPerson is a transient object) * @param now A transactional now timestamp --- 163,168 ---- /** ! * Used for test, demo only. Register and immediately activate the user without sending an email. The user id does not need to be a valid email address. ! * The demoUser flag is set in the user account. * @param tp A TolvenPerson object representing the LDAP attributes of this user (A TolvenPerson is a transient object) * @param now A transactional now timestamp *************** *** 173,176 **** --- 175,179 ---- // Create a new user object TolvenUser user = createTolvenUser( tp.getUid(), now ); + user.setDemoUser(true); return user; } *************** *** 241,254 **** /** ! * Given the TolvenUser, find a list of all Accounts that that TolvenUser is associated with. ! */ ! public List<AccountUser> findAccountUsers( TolvenUser user ) { ! Query query = em.createQuery("SELECT au FROM AccountUser au WHERE au.user = :user " + ! "and au.status = 'ACTIVE'"); ! query.setParameter("user", user); ! List<AccountUser> items = query.getResultList(); ! return items; ! } ! /** * Return a list of all active Tolven Users. This method has limited usefulness. Good for initial setup activities. --- 244,269 ---- /** ! * Given the TolvenUser, find a list of all Accounts that that TolvenUser is associated with. ! */ ! public List<AccountUser> findUserAccounts( TolvenUser user ) { ! Query query = em.createQuery("SELECT au FROM AccountUser au WHERE au.user = :user " + ! "and au.status = 'ACTIVE'"); ! query.setParameter("user", user); ! List<AccountUser> items = query.getResultList(); ! return items; ! } ! ! /** ! * Given the Tolven Account, find a list of all TolvenUsers that are users of the account. ! * We ignore users that are inactive. ! */ ! public List<AccountUser> findAccountUsers( Account account ) { ! Query query = em.createQuery("SELECT au FROM AccountUser au WHERE au.account = :account " + ! "and au.user.status = 'ACTIVE' order by au.user.ldapUID"); ! query.setParameter("account", account); ! List<AccountUser> items = query.getResultList(); ! return items; ! } ! /** * Return a list of all active Tolven Users. This method has limited usefulness. Good for initial setup activities. |
From: John C. <jc...@us...> - 2006-08-31 05:20:05
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/core In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20640/src/org/tolven/core Modified Files: ActivationLocal.java Log Message: Improvements to Account and User preferences, see rel notes Index: ActivationLocal.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/core/ActivationLocal.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ActivationLocal.java 21 Aug 2006 00:26:29 -0000 1.11 --- ActivationLocal.java 31 Aug 2006 05:20:02 -0000 1.12 *************** *** 19,22 **** --- 19,23 ---- import java.util.List; + import javax.persistence.Query; import javax.xml.bind.JAXBException; *************** *** 92,99 **** /** ! * Given the TolvenUser, find a list of all Accounts that that TolvenUser is associated with. ! */ ! public List<AccountUser> findAccountUsers( TolvenUser user ); ! /** * Update an AccountUser record, usually to set the default flag. We don't check if there's already another --- 93,105 ---- /** ! * Given the TolvenUser, find a list of all Accounts that that TolvenUser is associated with. ! */ ! public List<AccountUser> findUserAccounts( TolvenUser user ); ! ! /** ! * Given the Tolven Account, find a list of all TolvenUsers that are users of the account. ! */ ! public List<AccountUser> findAccountUsers( Account account ); ! /** * Update an AccountUser record, usually to set the default flag. We don't check if there's already another |
From: John C. <jc...@us...> - 2006-08-31 05:19:14
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20541/src/org/tolven/ajax Modified Files: AjaxServlet.java DocServlet.java Log Message: Use new DocImage subclass instead of DocBase Index: AjaxServlet.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax/AjaxServlet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AjaxServlet.java 25 Aug 2006 15:00:37 -0000 1.11 --- AjaxServlet.java 31 Aug 2006 05:19:11 -0000 1.12 *************** *** 45,48 **** --- 45,49 ---- import org.tolven.doc.DocumentLocal; import org.tolven.doc.entity.DocBase; + import org.tolven.doc.entity.DocImage; import org.tolven.gen.PersonGenerator; import org.tolven.gen.entity.FamilyUnit; *************** *** 346,358 **** } if (uri.endsWith("photoList.ajax")) { ! org.tolven.web.TopAction top = (org.tolven.web.TopAction) req.getSession(false).getAttribute("top"); ! long author = top.getUser().getId(); String sortAttribute = "id"; // if ("description".equals(sortCol)) { // sortAttribute="preferredTerm"; // } ! List<DocBase> rows = documentLocal.findDocuments(author, pageSize, offset, sortAttribute, sortDir ); int line = 0; ! for (DocBase d : rows) { line++; writer.write( "<tr>" ); --- 347,358 ---- } if (uri.endsWith("photoList.ajax")) { ! long accountId = (Long) req.getSession(false).getAttribute("accountId"); String sortAttribute = "id"; // if ("description".equals(sortCol)) { // sortAttribute="preferredTerm"; // } ! List<DocImage> rows = documentLocal.findImages(accountId, pageSize, offset, sortAttribute, sortDir ); int line = 0; ! for (DocImage d : rows) { line++; writer.write( "<tr>" ); Index: DocServlet.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax/DocServlet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DocServlet.java 21 Aug 2006 00:20:06 -0000 1.5 --- DocServlet.java 31 Aug 2006 05:19:11 -0000 1.6 *************** *** 13,25 **** */ package org.tolven.ajax; - import java.awt.Color; - import java.awt.Graphics; - import java.awt.Image; - import java.awt.Toolkit; - import java.awt.image.BufferedImage; - import java.awt.image.FilteredImageSource; - import java.awt.image.ImageFilter; - import java.awt.image.ImageProducer; - import java.awt.image.ReplicateScaleFilter; import java.io.IOException; import java.io.InputStream; --- 13,16 ---- *************** *** 34,38 **** import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import javax.swing.ImageIcon; import org.apache.commons.fileupload.FileItem; --- 25,28 ---- *************** *** 42,50 **** import org.tolven.doc.DocumentLocal; import org.tolven.doc.entity.DocBase; ! ! import com.sun.image.codec.jpeg.JPEGCodec; ! import com.sun.image.codec.jpeg.JPEGImageEncoder; public class DocServlet extends HttpServlet { // @EJB private DocumentLocal docBean; --- 32,42 ---- import org.tolven.doc.DocumentLocal; import org.tolven.doc.entity.DocBase; ! import org.tolven.doc.entity.DocImage; public class DocServlet extends HttpServlet { + /** + * + */ + private static final long serialVersionUID = 1L; // @EJB private DocumentLocal docBean; *************** *** 84,93 **** DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(4096); - // TODO allow it to use default temp file location - // factory.setRepository(tmpfile); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); Writer writer=response.getWriter(); ! String uri = request.getRequestURI(); // Parse the request String returnTo = null; --- 76,83 ---- DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(4096); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); Writer writer=response.getWriter(); ! // String uri = request.getRequestURI(); // Parse the request String returnTo = null; *************** *** 101,111 **** if ("returnTo".equals(name)) returnTo = value; } else { ! String fieldName = item.getFieldName(); ! String fileName = item.getName(); String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); // TOTO less than int bytes int sizeInBytes = (int)item.getSize(); ! DocBase doc = new DocBase(); doc.setMediaType( contentType ); if (isInMemory) { --- 91,101 ---- if ("returnTo".equals(name)) returnTo = value; } else { ! // String fieldName = item.getFieldName(); ! // String fileName = item.getName(); String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); // TOTO less than int bytes int sizeInBytes = (int)item.getSize(); ! DocImage doc = new DocImage(); doc.setMediaType( contentType ); if (isInMemory) { *************** *** 119,126 **** } // Get the logged in user and set as the author ! long userId = Long.parseLong(request.getParameter("userId")); ! id = docBean.createDocument( doc, userId ); } ! writer.write( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<html>\n" + "<head>" + (returnTo==null? " " : --- 109,117 ---- } // Get the logged in user and set as the author ! long accountId = (Long) request.getSession(false).getAttribute("accountId"); ! id = docBean.createImage( doc, accountId ); } ! // writer.write( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<html>\n" + ! writer.write( "<html>\n" + "<head>" + (returnTo==null? " " : *************** *** 139,158 **** } - @Override - // protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - // String uri = req.getRequestURI(); - // System.out.println( "Tolven DocServlet: Document Id: " + req.getQueryString()); - // resp.setHeader("Cache-Control", "no-cache"); - //// Writer writer=resp.getWriter(); - // long docId = Long.parseLong( req.getParameter( "docId")); - // DocBase doc = docBean.findDocument(docId); - // OutputStream os = resp.getOutputStream(); - // resp.setContentType(doc.getMediaType()); - // os.write(doc.getContent()); - // os.close(); - //// writer.write( ); - //// writer.close(); - // } - /** * Return an image scaled to fit the viewport while maintaining the aspect ratio and without clipping. --- 130,133 ---- *************** *** 166,189 **** // loaded before we proceed. long docId = Long.parseLong( req.getParameter( "docId")); ! DocBase doc = docBean.findDocument(docId); ! Image sourceImage = new ImageIcon(Toolkit.getDefaultToolkit().createImage(doc.getContent() )).getImage(); // Calculate the target width and height based on scaling to the smallest of the two dimensions int targetWidth = Integer.parseInt(req.getParameter("width")); int targetHeight = Integer.parseInt(req.getParameter("height")); - float hscale = ((float)targetWidth)/((float)sourceImage.getWidth(null)); - float vscale = ((float)targetHeight)/((float)sourceImage.getHeight(null)); - float scale = 1.0f; - if ( hscale < scale) scale = hscale; - if (vscale < scale) scale = vscale; - int newWidth = (int)(sourceImage.getWidth(null)*scale); - int newHeight = (int)(sourceImage.getHeight(null)*scale); - Image resizedImage = this.scaleImage(sourceImage,newWidth,newHeight); - BufferedImage bufferedImage = this.toBufferedImage(resizedImage, targetWidth, targetHeight); // Output as JPEG, regardless of input format. res.setContentType("image/jpeg"); res.setHeader("Cache-Control", "no-cache"); ! JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(res.getOutputStream()); ! encoder.encode(bufferedImage); } catch(Exception e) --- 141,154 ---- // loaded before we proceed. long docId = Long.parseLong( req.getParameter( "docId")); ! long accountId = (Long) req.getSession(false).getAttribute("accountId"); // Calculate the target width and height based on scaling to the smallest of the two dimensions int targetWidth = Integer.parseInt(req.getParameter("width")); int targetHeight = Integer.parseInt(req.getParameter("height")); + DocImage doc = docBean.findImage(docId, accountId); // Output as JPEG, regardless of input format. res.setContentType("image/jpeg"); res.setHeader("Cache-Control", "no-cache"); ! doc.streamJPEGThumbnail( targetWidth, targetHeight, res.getOutputStream()); } catch(Exception e) *************** *** 192,227 **** } } - /** - * Create a new scaled image using a filter. - * @param sourceImage - * @param width The width of the resulting picture - * @param height The height of the resulting picture - * @return The Image - */ - private Image scaleImage(Image sourceImage, int width, int height) { - ImageFilter filter = new ReplicateScaleFilter(width,height); - ImageProducer producer = new FilteredImageSource(sourceImage.getSource(),filter); - return Toolkit.getDefaultToolkit().createImage(producer); - } - /** - * Place the resulting scaled image into the output buffer - * @param image The scaled image - * @param windowWidth The desired window width to return - * @param windowHeight The desired window hight to return - * @return A Buffered image, ready for output - */ - private BufferedImage toBufferedImage(Image image, int windowWidth, int windowHeight) { - image = new ImageIcon(image).getImage(); - BufferedImage bufferedImage = new BufferedImage(windowWidth, windowHeight,BufferedImage.TYPE_INT_RGB); - Graphics g = bufferedImage.createGraphics(); - g.setColor(Color.WHITE); - g.fillRect(0,0,windowWidth,windowHeight); - // Center image in window - int hOffset = (windowWidth-image.getWidth(null))/2; - int vOffset = (windowHeight-image.getHeight(null))/2; - g.drawImage(image,hOffset,vOffset,null); - g.dispose(); - return bufferedImage; - } } --- 157,160 ---- |
From: John C. <jc...@us...> - 2006-08-31 05:18:31
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/entity In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20160/src/org/tolven/doc/entity Modified Files: DocBase.java Added Files: DocImage.java DocRIM.java Log Message: Add a specific doc subclass for images. Move image-related methods to this new class. --- NEW FILE: DocImage.java --- package org.tolven.doc.entity; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.awt.image.FilteredImageSource; import java.awt.image.ImageFilter; import java.awt.image.ImageProducer; import java.awt.image.ReplicateScaleFilter; import java.io.IOException; import java.io.OutputStream; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.swing.ImageIcon; import com.sun.image.codec.jpeg.ImageFormatException; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; /** * Storage of a non-diagnostic image such as fax, jpeg, etc. * @author John Churin * */ @Entity @DiscriminatorValue("IMG") public class DocImage extends DocBase { /** * Version number used for serialization */ private static final long serialVersionUID = 2L; /** * Create a JPEG thumbnail of the underlying image and encode it to the output stream provided. * The aspect ratio of the underlying image is retained. As a result, the thumbnail is scaled to fit in * the specified rectangle. Whitespace is added if the image does not match the aspect ratio of the rectangle. * @param targetWidth * @param targetHeight * @param stream * @throws ImageFormatException * @throws IOException */ public void streamJPEGThumbnail( int targetWidth, int targetHeight, OutputStream stream) throws ImageFormatException, IOException{ Image sourceImage = new ImageIcon(Toolkit.getDefaultToolkit().createImage(getContent() )).getImage(); float hscale = ((float)targetWidth)/((float)sourceImage.getWidth(null)); float vscale = ((float)targetHeight)/((float)sourceImage.getHeight(null)); float scale = 1.0f; if ( hscale < scale) scale = hscale; if (vscale < scale) scale = vscale; int newWidth = (int)(sourceImage.getWidth(null)*scale); int newHeight = (int)(sourceImage.getHeight(null)*scale); Image resizedImage = this.scaleImage(sourceImage,newWidth,newHeight); BufferedImage bufferedImage = this.toBufferedImage(resizedImage, targetWidth, targetHeight); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(stream); encoder.encode(bufferedImage); } /** * Create a new scaled image using a filter. * @param sourceImage * @param width The width of the resulting picture * @param height The height of the resulting picture * @return The Image */ private Image scaleImage(Image sourceImage, int width, int height) { ImageFilter filter = new ReplicateScaleFilter(width,height); ImageProducer producer = new FilteredImageSource(sourceImage.getSource(),filter); return Toolkit.getDefaultToolkit().createImage(producer); } /** * Place the resulting scaled image into the output buffer * @param image The scaled image * @param windowWidth The desired window width to return * @param windowHeight The desired window hight to return * @return A Buffered image, ready for output */ private BufferedImage toBufferedImage(Image image, int windowWidth, int windowHeight) { image = new ImageIcon(image).getImage(); BufferedImage bufferedImage = new BufferedImage(windowWidth, windowHeight,BufferedImage.TYPE_INT_RGB); Graphics g = bufferedImage.createGraphics(); g.setColor(Color.WHITE); g.fillRect(0,0,windowWidth,windowHeight); // Center image in window int hOffset = (windowWidth-image.getWidth(null))/2; int vOffset = (windowHeight-image.getHeight(null))/2; g.drawImage(image,hOffset,vOffset,null); g.dispose(); return bufferedImage; } } Index: DocBase.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/entity/DocBase.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DocBase.java 28 Aug 2006 19:37:36 -0000 1.5 --- DocBase.java 31 Aug 2006 05:18:28 -0000 1.6 *************** *** 14,21 **** package org.tolven.doc.entity; - import java.io.IOException; import java.io.Serializable; - import java.io.StringReader; - import java.io.StringWriter; import javax.persistence.Basic; --- 14,18 ---- *************** *** 34,46 **** import javax.persistence.ManyToOne; import javax.persistence.Table; - import javax.xml.bind.JAXBContext; - import javax.xml.bind.JAXBElement; - import javax.xml.bind.JAXBException; - import javax.xml.bind.Marshaller; - import javax.xml.bind.Unmarshaller; - import javax.xml.namespace.QName; - import javax.xml.transform.stream.StreamSource; import org.apache.commons.codec.binary.Base64; import org.tolven.core.entity.TolvenUser; --- 31,37 ---- import javax.persistence.ManyToOne; import javax.persistence.Table; import org.apache.commons.codec.binary.Base64; + import org.tolven.core.entity.Account; import org.tolven.core.entity.TolvenUser; *************** *** 67,70 **** --- 58,64 ---- @ManyToOne(fetch=FetchType.LAZY) + Account account; + + @ManyToOne(fetch=FetchType.LAZY) TolvenUser author; *************** *** 203,205 **** --- 197,207 ---- return ("NEW".equals(getStatus())); } + + public Account getAccount() { + return account; + } + + public void setAccount(Account account) { + this.account = account; + } } --- NEW FILE: DocRIM.java --- package org.tolven.doc.entity; import java.io.IOException; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.Transient; import javax.xml.bind.JAXBException; import org.tolven.rim.ControlAct; import org.tolven.rim.II; @Entity @DiscriminatorValue("RIM") public class DocRIM extends DocXML { /** * Version number used for serialization */ private static final long serialVersionUID = 2L; @Transient private ControlAct newCACT; public DocRIM() { super( "controlAct", "urn:tolven-org:rim:1.0"); } /** * Get the RIM ControlAct if there is one for this document. It will either be new in process (assuming a call was made to createRIM) or an unmarshalled * existing RIM ControlAct from the content of this document. * @return * @throws JAXBException */ public ControlAct getCACT() throws JAXBException { if (newCACT!=null) return newCACT; return (ControlAct)getBinding(); } /** * The constructor for this class is not sufficient to create a RIM document. This method * actually creates the document. * The base document MUST be persisted prior to calling this method in order to get the id assigned to the document. * We're not going to marshall the resulting graph until we're all done and ready to persist the document. * So in the meantime, we remember the * graph in a transient variable. We'll add the ID and marshall to XML when persisting. * @see validateAndMarshallXML */ public void createCACT( String OID ) { if (getStatus()==null) setStatus("NEW"); if (getId()==0) throw new IllegalArgumentException(); newCACT = new ControlAct(); II id = new II(); id.setRoot(OID); id.setExtension(Long.toString(getId())); newCACT.getId().add(id); } /** * Prior to persistence, if we have an object graph, we'll need to marshall it to XML. Any final validation should occur here as well. * @throws JAXBException * @throws IOException */ public void validateAndMarshallXML() throws JAXBException, IOException { if (newCACT==null) return; // We're done with the graph, marshall to XML setBinding( newCACT ); } } |
From: John C. <jc...@us...> - 2006-08-31 05:18:30
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20160/src/org/tolven/doc/bean Modified Files: DocumentBean.java Log Message: Add a specific doc subclass for images. Move image-related methods to this new class. Index: DocumentBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/DocumentBean.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DocumentBean.java 28 Aug 2006 19:37:36 -0000 1.5 --- DocumentBean.java 31 Aug 2006 05:18:28 -0000 1.6 *************** *** 36,39 **** --- 36,40 ---- import org.tolven.admin.Details; import org.tolven.core.TolvenPropertiesLocal; + import org.tolven.core.entity.Account; import org.tolven.core.entity.TolvenUser; import org.tolven.doc.DocumentLocal; *************** *** 41,44 **** --- 42,46 ---- import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; + import org.tolven.doc.entity.DocImage; /** *************** *** 125,138 **** /** - * Count of all photo-documents owned by this author. - */ - public long countPhotos( long author ) { - Query query = em.createQuery( "SELECT COUNT(d) FROM DocBase d where author.id=:author"); - query.setParameter("author", author); - Long rslt = (Long) query.getSingleResult(); - return rslt.longValue(); - } - - /** * Not a very practical method but we'll use it for testing. * @return --- 127,130 ---- *************** *** 157,160 **** --- 149,196 ---- } + /** + * @see DocumentLocal + */ + public DocImage findImage( long docId, long accountId ) { + DocImage doc = em.find( DocImage.class, docId ); + if (doc.getAccount().getId()!=accountId) throw new IllegalArgumentException( "Document is not owned by the " + + "current user's account."); + return doc; + } + + /** + * Count of all photo-documents owned by this account. + */ + public long countImages( long accountId ) { + Query query = em.createQuery( "SELECT COUNT(d) FROM DocImage d where account.id=:account"); + query.setParameter("account", accountId); + Long rslt = (Long) query.getSingleResult(); + return rslt.longValue(); + } + + /** + * Return images for the specified account + */ + public List<DocImage> findImages(long accountId, int pageSize, int offset, String sortAttribute, String sortDir ) { + Query query = em.createQuery( "SELECT d FROM DocImage d where account.id = :account ORDER BY d." + sortAttribute + " " + sortDir ); + query.setMaxResults(pageSize); + query.setFirstResult(offset); + query.setParameter( "account", accountId); + List<DocImage> items = query.getResultList(); + return items; + } + + /** + * Persist a new image and return it's ID + * @param doc + * @param accountId of the author + * @return the id assigned to the new document. + */ + public long createImage( DocImage doc, long accountId ) { + doc.setAccount(em.getReference( Account.class, accountId )); + em.persist( doc ); + return doc.getId(); + } + @PostConstruct public void init() { |
From: John C. <jc...@us...> - 2006-08-31 05:18:30
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20160/src/org/tolven/doc Modified Files: DocumentLocal.java Log Message: Add a specific doc subclass for images. Move image-related methods to this new class. Index: DocumentLocal.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/DocumentLocal.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DocumentLocal.java 28 Aug 2006 19:37:36 -0000 1.4 --- DocumentLocal.java 31 Aug 2006 05:18:28 -0000 1.5 *************** *** 28,31 **** --- 28,32 ---- import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; + import org.tolven.doc.entity.DocImage; *************** *** 78,85 **** public DocBase findDocument( long docId ); ! /** ! * Count of all photo-documents owned by this author. */ ! public long countPhotos( long author ); /** --- 79,96 ---- public DocBase findDocument( long docId ); ! ! /** ! * Get a document by its internal ID ! * @param docId the id of the document ! * @param accountId This is not part of the primay key but is required to verify account ownership. ! * A request for a docId outside of the current account is rejected. ! * @return the document object ! */ ! public DocImage findImage( long docId, long accountId ); ! ! /** ! * Count of all photo-documents owned by this account. */ ! public long countImages( long account ); /** *************** *** 88,92 **** public List<DocBase> findDocuments(long author, int pageSize, int offset, String sortAttribute, String sortDir ); ! /** * Store document details in XML form. A valid XML document must contain just one root element and we create * that element here, hiding it from the Java programmer who can just deal with the collection. --- 99,116 ---- public List<DocBase> findDocuments(long author, int pageSize, int offset, String sortAttribute, String sortDir ); ! /** ! * Return images for the specified account ! */ ! public List<DocImage> findImages(long accountId, int pageSize, int offset, String sortAttribute, String sortDir ); ! ! /** ! * Persist a new image and return it's ID ! * @param doc ! * @param accountId of the author ! * @return the id assigned to the new document. ! */ ! public long createImage( DocImage doc, long accountId ); ! ! /** * Store document details in XML form. A valid XML document must contain just one root element and we create * that element here, hiding it from the Java programmer who can just deal with the collection. |
From: John C. <jc...@us...> - 2006-08-31 05:17:16
|
Update of /cvsroot/tolven/tolvenWEB/web/five/test In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19691/web/five/test Modified Files: perfLog.xhtml Log Message: Timezone now taken from user's default in top Index: perfLog.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/test/perfLog.xhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** perfLog.xhtml 24 Aug 2006 07:55:21 -0000 1.3 --- perfLog.xhtml 31 Aug 2006 05:17:12 -0000 1.4 *************** *** 26,30 **** </f:facet> <h:outputText value="#{ph.timestamp}"> ! <f:convertDateTime type="time" pattern="hh:mm:ss"/> </h:outputText> </h:column> --- 26,30 ---- </f:facet> <h:outputText value="#{ph.timestamp}"> ! <f:convertDateTime type="time" pattern="hh:mm:ss" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> |
From: John C. <jc...@us...> - 2006-08-31 05:17:15
|
Update of /cvsroot/tolven/tolvenWEB/web/five In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19691/web/five Modified Files: famhxSummary.xhtml problemSummary.xhtml immSummary.xhtml medhxfSummary.xhtml funStatSummary.xhtml selfSummary.xhtml radSummary.xhtml labSummary.xhtml Log Message: Timezone now taken from user's default in top Index: immSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/immSummary.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** immSummary.xhtml 12 Aug 2006 07:19:01 -0000 1.2 --- immSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.3 *************** *** 16,20 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy"/> </h:outputText> </h:column> --- 16,20 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: problemSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/problemSummary.xhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** problemSummary.xhtml 18 Aug 2006 03:19:31 -0000 1.4 --- problemSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.5 *************** *** 18,22 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy"/> </h:outputText> </h:column> --- 18,22 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: selfSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/selfSummary.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** selfSummary.xhtml 12 Aug 2006 07:19:01 -0000 1.2 --- selfSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.3 *************** *** 16,20 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy"/> </h:outputText> </h:column> --- 16,20 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: famhxSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/famhxSummary.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** famhxSummary.xhtml 12 Aug 2006 07:19:01 -0000 1.2 --- famhxSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.3 *************** *** 16,20 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy"/> </h:outputText> </h:column> --- 16,20 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: funStatSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/funStatSummary.xhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** funStatSummary.xhtml 12 Aug 2006 07:19:01 -0000 1.3 --- funStatSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.4 *************** *** 16,20 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy"/> </h:outputText> </h:column> --- 16,20 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: medhxfSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/medhxfSummary.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** medhxfSummary.xhtml 12 Aug 2006 07:19:01 -0000 1.2 --- medhxfSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.3 *************** *** 16,20 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" dateStyle="short"/> </h:outputText> </h:column> --- 16,20 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" dateStyle="short" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: labSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/labSummary.xhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** labSummary.xhtml 20 Aug 2006 06:48:33 -0000 1.4 --- labSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.5 *************** *** 18,22 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="MMM-yyyy"/> </h:outputText> </h:column> --- 18,22 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="MMM-yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> Index: radSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/radSummary.xhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** radSummary.xhtml 24 Aug 2006 07:54:00 -0000 1.4 --- radSummary.xhtml 31 Aug 2006 05:17:12 -0000 1.5 *************** *** 18,22 **** <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy"/> </h:outputText> </h:column> --- 18,22 ---- <h:column> <h:outputText value="#{md.date01}"> ! <f:convertDateTime type="date" pattern="yyyy" timeZone="#{top.timeZone}"/> </h:outputText> </h:column> |