Update of /cvsroot/struts/dialogs/war/mailreaderpages In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17798/war/mailreaderpages Added Files: changes.txt error.jsp home.jsp homeclassic.jsp logoff.jsp logon.jsp registration.jsp subscription.jsp subscriptions.jsp Log Message: Added MailReader Demo; Added component RuleSet --- NEW FILE: changes.txt --- Changed objects comparing to original MailReader ------------------------------------------------ Subscription: * added setter for host User: * added setter for username * added Collection getSubscriptionCollection MemoryUserDatabase: * added User createDetachedUser(String username) * added User storeUser(User user, boolean isNew) MemoryDatabasePlugIn.java * Not changed MemorySubscription: * made Cloneable and added method clone to create detached subscriptions; is nested in SubscriptionForm * added setter for host; used in subscription.jsp to set property host of nested subscription bean MemoryUser: * made Cloneable and added method clone to create detached user accounts; is nested in RegistrationForm * added setter for username; used in registration.jsp to set property username of nested registration bean * added Collection getSubscriptionCollection * added Subscription createDetachedSubscription() to create new subscription * added Subscription getDetachedSubscription(String host) to create a copy of persistent subscription * added Subscription storeDetachedSubscription(Subscription subscription, boolean isNew) to persist new or updated detached subscription MemoryUserDatabase: * added User createDetachedUser(String username) to create detached user account * added User storeUser(User user, boolean isNew) to persist new or updated user account HomeAction: * Combines features of BaseAction, WelcomeAction, LocaleAction and main menu action LogonAction: * Combines features of LogonAction and LogoffAction SubscriptionAction: * Combines features of EditSubscriptionAction and SaveSubscriptionAction RegistrationAction: * Combines features of EditRegistrationAction and SaveRegistrationAction --- NEW FILE: error.jsp --- <%-- Errors.jsp - Display unexpected errors, such as a JSP exception or missing resources --%> <%-- Copyright 2000-2004 Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="org.apache.struts.Globals" %> <%@ page import="org.apache.struts.webapp.example.Constants" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html:html> <head> <title>Unexpected Error</title> <html:base/> </head> <h3>An unexpected error has occured</h3> <logic:present name="<%=net.jspcontrols.mailreader.Constants.ERROR_KEY%>"> <ul> <logic:iterate id="error" name="<%=net.jspcontrols.mailreader.Constants.ERROR_KEY%>"> <li><bean:write name="error" /></li> </logic:iterate> </ul> </logic:present> <logic:present name="<%=Globals.EXCEPTION_KEY%>"> <p><bean:write name="<%=Globals.EXCEPTION_KEY%>" property="message" /></p> </logic:present> </body> </html:html> --- NEW FILE: home.jsp --- <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <title><bean:message key="index.title"/></title> </head> <body> <h3><bean:message key="index.heading"/></h3> <!-- Signup and login options for not logged-in user --> <logic:notPresent name="user" scope="session"> <ul> <li><html:link action="/Home?DIALOG-EVENT-SIGNUP"><bean:message key="index.registration"/></html:link></li> <li><html:link action="/Home?DIALOG-EVENT-LOGON"><bean:message key="index.logon"/></html:link></li> </ul> </logic:notPresent> <!-- Account modification and subscription list for logged-in user --> <logic:present name="user" scope="session"> <ul> <li><html:link action="/Home?DIALOG-EVENT-ACCUPDATE"><bean:message key="index.updateaccount"/></html:link></li> <li><html:link action="/Home?DIALOG-EVENT-SUBSCRIPTIONS"><bean:message key="index.managesubscriptions"/></html:link></li> <li><html:link action="/Logon"><bean:message key="index.showuserinfo"/></html:link></li> <li><html:link action="/Logon?DIALOG-EVENT-LOGOFF"><bean:message key="index.logoff"/></html:link></li> </ul> </logic:present> <!-- Language selection --> <h3><bean:message key="index.langopts"/></h3> <ul> <li><html:link action="/Home?DIALOG-EVENT-LOCALE&language=en"><bean:message key="index.langenglish"/></html:link></li> <li><html:link action="/Home?DIALOG-EVENT-LOCALE&language=ru" useLocalEncoding="true"><bean:message key="index.langrussian"/></html:link></li> </ul> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> <p><html:link action="/Tour"><bean:message key="index.tour"/></html:link></p> </body> </html> --- NEW FILE: homeclassic.jsp --- <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <title><bean:message key="index.title"/></title> </head> <body> <h3><bean:message key="index.heading"/></h3> <!-- Signup and login options for not logged-in user --> <logic:notPresent name="user" scope="session"> <ul> <li><html:link action="HomeClassic?DIALOG-EVENT-SIGNUP"><bean:message key="index.registration"/></html:link></li> <li><html:link action="HomeClassic?DIALOG-EVENT-LOGON"><bean:message key="index.logon"/></html:link></li> </ul> </logic:notPresent> <!-- Account modification and subscription list for logged-in user --> <logic:present name="user" scope="session"> <ul> <li><html:link action="HomeClassic?DIALOG-EVENT-ACCUPDATE"><bean:message key="index.updateaccount"/></html:link></li> <li><html:link action="HomeClassic?DIALOG-EVENT-SUBSCRIPTIONS"><bean:message key="index.managesubscriptions"/></html:link></li> <li><html:link action="/Logon"><bean:message key="index.showuserinfo"/></html:link></li> <li><html:link action="/Logon?DIALOG-EVENT-LOGOFF"><bean:message key="index.logoff"/></html:link></li> </ul> </logic:present> <!-- Language selection --> <h3><bean:message key="index.langopts"/></h3> <ul> <li><html:link action="HomeClassic?DIALOG-EVENT-LOCALE&language=en"><bean:message key="index.langenglish"/></html:link></li> <li><html:link action="HomeClassic?DIALOG-EVENT-LOCALE&language=ru" useLocalEncoding="true"><bean:message key="index.langrussian"/></html:link></li> </ul> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> <p><html:link action="/Tour"><bean:message key="index.tour"/></html:link></p> </body> </html> --- NEW FILE: logoff.jsp --- <!-- Struts Dialogs MailReader, 2005. Web resource: Logon. State: Logged In. --> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html:xhtml/> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited in web.xml, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <title><bean:message key="logon.title"/></title> </head> <body> <h3><bean:message key="logoff.heading"/></h3> <!-- Standard Struts error handling --> <logic:messagesPresent> <br/> <html:errors/> </logic:messagesPresent> <html:form action="/Logon"> <table> <!-- User information --> <tr> <td class="itemdescr" align="left">Username</td> <td><bean:write name="user" property="username"/></td> </tr> <tr> <td class="itemdescr" align="left">Full name</td> <td><bean:write name="user" property="fullName"/></td> </tr> <!-- Logoff and cancel buttons--> <tr> <td class="itemdescr"></td> <td class="itemdescr" align="left"> <html:submit property="DIALOG-EVENT-LOGOFF"> <bean:message key="button.logoff"/> </html:submit> <html:cancel> <bean:message key="button.cancel"/> </html:cancel> </td> </tr> </table> </html:form> <!-- Struts Dialogs logo --> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> </body> </html> --- NEW FILE: logon.jsp --- <!-- Struts Dialogs MailReader, 2005. Web resource: Logon. State: Not Logged In. --> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html:xhtml/> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited in web.xml, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <title><bean:message key="logon.title"/></title> </head> <body> <h3><bean:message key="logon.heading"/></h3> <!-- Standard Struts error handling --> <logic:messagesPresent> <br/> <html:errors/> </logic:messagesPresent> <html:form action="/Logon" focus="username"> <table> <!-- username and password --> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.username"/>: </td> <td align="left"> <html:text property="username" size="16" maxlength="18"/> </td> </tr> <tr> <td class="itemdescr"align="right"> <bean:message key="prompt.password" bundle="alternate"/> </td> <td align="left"> <html:password property="password" size="16" maxlength="18" redisplay="false"/> </td> </tr> <!-- Submit and Cancel buttons --> <tr> <td class="itemdescr"/> <td class="itemdescr" align="left"> <html:submit property="DIALOG-EVENT-LOGON"> <bean:message key="button.confirm"/> </html:submit> <html:cancel> <bean:message key="button.cancel"/> </html:cancel> </td> </tr> </table> </html:form> <!-- Struts Dialogs logo --> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> </body> </html> --- NEW FILE: registration.jsp --- <!-- Struts Dialogs MailReader, 2005. Web resource: Registration State: (Logged In) || (Not Logged In) --> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html:xhtml/> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited in web.xml, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <!-- Patch title depending on whether we are creating or updating a user --> <title> <logic:equal name="RegistrationForm" property="crudUIMode" value="CRUD-UI-MODE-UPDATE"> <bean:message key="registration.title.edit"/> </logic:equal> <logic:equal name="RegistrationForm" property="crudUIMode" value="CRUD-UI-MODE-NEW" > <bean:message key="registration.title.create"/> </logic:equal> </title> </head> <body> <!-- Patch header depending on whether we are creating or updating a user --> <h3> <logic:equal name="RegistrationForm" property="crudUIMode" value="CRUD-UI-MODE-UPDATE"> <bean:message key="registration.heading.edit"/> </logic:equal> <logic:equal name="RegistrationForm" property="crudUIMode" value="CRUD-UI-MODE-NEW" > <bean:message key="registration.heading.create"/> </logic:equal> </h3> <!-- Standard Struts error handling --> <logic:messagesPresent> <br/> <html:errors/> </logic:messagesPresent> <html:form action="/Registration" focus="username"> <table border="0" width="100%"> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.username"/>: </td> <logic:equal name="RegistrationForm" property="crudUIMode" value="CRUD-UI-MODE-UPDATE" > <td><bean:write name="RegistrationForm" property="nestedUser.username"/></td> </logic:equal> <logic:equal name="RegistrationForm" property="crudUIMode" value="CRUD-UI-MODE-NEW" > <td><html:text name="RegistrationForm" property="nestedUser.username" size="15" tabindex="1"/></td> </logic:equal> </tr> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.password"/>: </td> <td align="left"> <html:password property="nestedUser.password" size="16" maxlength="16"/> </td> </tr> <!-- Note that password2 (repeated password) is not part of the nested user object --> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.password2"/>: </td> <td align="left"> <html:password property="password2" size="16" maxlength="16"/> </td> </tr> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.fullName"/>: </td> <td align="left"> <html:text property="nestedUser.fullName" size="50"/> </td> </tr> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.fromAddress"/>: </td> <td align="left"> <html:text property="nestedUser.fromAddress" size="50"/> </td> </tr> <tr> <td class="itemdescr" align="right"> <bean:message key="prompt.replyToAddress"/>: </td> <td align="left"> <html:text property="nestedUser.replyToAddress" size="50"/> </td> </tr> <!-- Save and Cancel buttons --> <tr> <td class="itemdescr" /> <td class="itemdescr" align="left"> <html:submit property="DIALOG-EVENT-SAVE"> <bean:message key="button.save"/> </html:submit> <html:submit property="DIALOG-EVENT-CANCEL"> <bean:message key="button.cancel"/> </html:submit> </td> </tr> </table> </html:form> <!-- Struts Dialogs logo --> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> </body> </html:html> --- NEW FILE: subscription.jsp --- <!-- Struts Dialogs MailReader, 2005. Web resource: Subscription. State: (Logged In) && (CRUD_UI_MODE_NEW || CRUD_UI_MODE_EDIT) --> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html:xhtml/> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited in web.xml, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <title><bean:message key="subscription.title"/></title> </head> <body> <logic:equal name="SubscriptionForm" property="crudUIMode" value="CRUD-UI-MODE-UPDATE" > <h3><bean:message key="subscription.title.edit"/></h3> </logic:equal> <logic:equal name="SubscriptionForm" property="crudUIMode" value="CRUD-UI-MODE-NEW" > <h3><bean:message key="subscription.title.create"/></h3> </logic:equal> <!-- Standard Struts error handling --> <logic:messagesPresent> <br/> <html:errors/> </logic:messagesPresent> <html:form action="/Subscriptions.do"> <table width="250"> <!-- Current user information --> <tr> <td class="itemdescr" align="left"><bean:message key="prompt.username"/></td> <td><bean:write name="user" property="username"/></td> </tr> <tr> <td class="itemdescr" align="left"><bean:message key="prompt.mailHostname"/></td> <logic:equal name="SubscriptionForm" property="crudUIMode" value="CRUD-UI-MODE-UPDATE" > <td><bean:write name="SubscriptionForm" property="subscription.host"/></td> </logic:equal> <logic:equal name="SubscriptionForm" property="crudUIMode" value="CRUD-UI-MODE-NEW" > <td><html:text name="SubscriptionForm" property="subscription.host" tabindex="1"/></td> </logic:equal> </tr> <!-- E-mail account information --> <tr> <td class="itemdescr" align="left"><bean:message key="prompt.mailUsername"/></td> <td><html:text name="SubscriptionForm" property="subscription.username" tabindex="2"/></td> </tr> <tr> <td class="itemdescr" align="left"><bean:message key="prompt.mailPassword"/></td> <td><html:text name="SubscriptionForm" property="subscription.password" tabindex="3"/></td> </tr> <tr> <td class="itemdescr" align="left"><bean:message key="prompt.mailServerType"/></td> <td> <html:select name="SubscriptionForm" property="subscription.type" tabindex="4"> <html:options collection="serverTypes" property="value" labelProperty="label"/> </html:select> </td> </tr> <tr> <td class="itemdescr" align="left"><bean:message key="prompt.autoConnect"/></td> <td><html:checkbox name="SubscriptionForm" property="subscription.autoConnect" tabindex="5"/></td> </tr> <!-- Save and Cancel buttons --> <tr> <td class="itemdescr" /> <td class="itemdescr" align="left"> <html:submit property="DIALOG-EVENT-SAVE"> <bean:message key="button.save"/> </html:submit> <html:cancel> <bean:message key="button.cancel"/> </html:cancel> </td> </tr> </table> </html:form> <!-- Struts Dialogs logo --> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> </body> </html:html> --- NEW FILE: subscriptions.jsp --- <!-- Struts Dialogs MailReader, 2005. Web resource: Subscriptions. State: Logged In && CRUD_UI_MODE_INACTIVE --> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <!-- The nice thing about using EL is that expressions can be used within Struts-EL tags. Without EL one would have to use, say, bean:write, which cannot be nested in other tag except as in the tag body. To nest expressions inside tags, one would have to use JSP scriptlets (which are calculated before tags?) --> <%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean-el" %> <%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %> <%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic-el" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <html:xhtml/> <html> <head> <!-- Direct access to /mailreaderpages/* is prohibited in web.xml, use separate directory for CSS --> <link rel="stylesheet" type="text/css" href="mailreader-css/base.css" /> <title><bean:message key="subscriptions.title"/></title> </head> <body> <!-- Subscriptions for user: John Q. User --> <h3> <bean:message key="subscriptions.headingfor"/> <c:out value="${user.fullName}"/> </h3> <!-- Standard Struts error handling --> <logic:messagesPresent> <br/> <html:errors/> </logic:messagesPresent> <table width="100%"> <thead> <tr> <th><bean:message key="heading.host"/></th> <th><bean:message key="heading.user"/></th> <th><bean:message key="heading.type"/></th> <th><bean:message key="heading.autoConnect"/></th> <th><bean:message key="heading.action"/></th> </tr> </thead> <!-- Avoid NPE by checking for current user --> <logic:present name="user" scope="session"> <!-- Show subscription list --> <logic-el:iterate id="subscription" collection="${SubscriptionForm.subscriptions}" offset="${SubscriptionForm.offset}" length="${SubscriptionForm.pagesize}" type="net.jspcontrols.mailreader.business.Subscription"> <tr> <!-- Subscription data --> <td><c:out value="${subscription.host}"/></td> <td><c:out value="${subscription.username}"/></td> <td><c:out value="${subscription.type}"/></td> <td><c:out value="${subscription.autoConnect}"/></td> <!-- Operations on each subscription: updade and delete --> <td> <html-el:link href="Subscriptions.do?DIALOG-EVENT-UPDATE&host=${subscription.host}"> <bean:message key="registration.editSubscription"/> </html-el:link> | <html-el:link href="Subscriptions.do?DIALOG-EVENT-DELETE&host=${subscription.host}"> <bean:message key="registration.deleteSubscription"/> </html-el:link> </td> </tr> </logic-el:iterate> </logic:present> </table> <!-- Paging buttons and Create Subscription button --> <html:form action="/Subscriptions.do"> <html:submit property="DIALOG-EVENT-CREATE"> <bean:message key="registration.addSubscription"/> </html:submit> <html-el:submit property="DIALOG-EVENT-PREVPAGE" disabled="${SubscriptionForm.firstpage}"> <bean:message key="subscriptions.prevpage"/> </html-el:submit> <html-el:submit property="DIALOG-EVENT-NEXTPAGE" disabled="${SubscriptionForm.lastpage}"> <bean:message key="subscriptions.nextpage"/> </html-el:submit> <html:submit property="DIALOG-EVENT-BACKHOME"> <bean:message key="button.cancel"/> </html:submit> </html:form> <!-- Struts Dialogs logo --> <br/> <hr/> <p><html:img bundle="alternate" pageKey="strutsdialogs.logo.path" altKey="strutsdialogs.logo.alt"/></p> </body> </html:html> |