Permalink
Browse files

really moving to maven this time

  • Loading branch information...
1 parent 7779ed5 commit a5cfdb5b5e3e821cf99ab51e75725f802267dd2e Jared Williams committed Nov 30, 2011
Showing with 943 additions and 588 deletions.
  1. +1 −1 .gitignore
  2. +0 −30 BBSignup/WebContent/footer.jsp
  3. +0 −34 BBSignup/WebContent/message.jsp
  4. +0 −91 BBSignup/WebContent/process.jsp
  5. +0 −19 BBSignup/bbs.ddl
  6. +174 −0 BBSignup/pom.xml
  7. +0 −62 BBSignup/senators
  8. +133 −0 BBSignup/src/main/java/bbsignup/model/OldSenator.java
  9. +3 −26 BBSignup/src/{ → main/java}/bbsignup/model/Senator.java
  10. +12 −1 BBSignup/src/{ → main/java}/bbsignup/model/User.java
  11. +2 −10 BBSignup/src/{ → main/java}/bbsignup/model/UserAuth.java
  12. +68 −14 BBSignup/src/{ → main/java}/bbsignup/src/Controller.java
  13. 0 BBSignup/src/{ → main/java}/bbsignup/src/Dump.java
  14. +23 −0 BBSignup/src/{ → main/java}/bbsignup/src/PMF.java
  15. +20 −4 BBSignup/src/{ → main/java}/bbsignup/src/Resource.java
  16. +71 −25 BBSignup/src/{ → main/java}/collect/NYSenateServices.java
  17. 0 BBSignup/src/{ → main/java}/collect/XmlRpc.java
  18. +7 −6 BBSignup/src/{ → main/java}/servlets/MainServlet.java
  19. +1 −1 BBSignup/src/{ → main/java}/servlets/SenatorContext.java
  20. 0 BBSignup/{WebContent → src/main/webapp}/META-INF/MANIFEST.MF
  21. 0 BBSignup/{WebContent → src/main/webapp}/WEB-INF/web.xml
  22. +7 −19 BBSignup/{WebContent → src/main/webapp}/authenticate.jsp
  23. +13 −0 BBSignup/src/main/webapp/cancel.jsp
  24. +126 −0 BBSignup/src/main/webapp/css/nys.css
  25. +17 −16 BBSignup/{WebContent → src/main/webapp/css}/style.css
  26. +15 −15 BBSignup/{WebContent → src/main/webapp}/delete.jsp
  27. +20 −0 BBSignup/src/main/webapp/footer.jsp
  28. +39 −0 BBSignup/src/main/webapp/header.jsp
  29. BIN BBSignup/src/main/webapp/img/nys_favicon_0.ico
  30. +44 −143 BBSignup/{WebContent → src/main/webapp}/index.jsp
  31. +92 −0 BBSignup/src/main/webapp/js/js.js
  32. +22 −0 BBSignup/src/main/webapp/message.jsp
  33. +6 −16 BBSignup/{WebContent → src/main/webapp}/notice.jsp
  34. +13 −28 BBSignup/{WebContent → src/main/webapp}/unsubscribe.jsp
  35. +14 −27 BBSignup/{WebContent → src/main/webapp}/update.jsp
View
2 .gitignore
@@ -2,4 +2,4 @@
*.jar
*.properties
*.log
-
+target
View
30 BBSignup/WebContent/footer.jsp
@@ -1,30 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
- %>
-
-<br/><br/>
-<div class="foot">
- <table>
- <tr>
- <td>Already Subscribed?</td>
- <td><a href="update.jsp">Update</a> or </td>
- <td><a href="unsubscribe.jsp">Unsubscribe</a></td>
- </tr>
- </table>
- <table cellpadding=5>
- <tr>
- <td>
- <a href="index.jsp">Home</a>
-
- </td>
- <td align="center">
- <a href="http://www.nysenate.gov">NYSenate.gov</a>
-
- </td>
- <td align = "right">
- <a href="mailto:billbuzz@nysenate.gov">Contact</a>
- </td>
- </tr>
- </table>
-</div>
View
34 BBSignup/WebContent/message.jsp
@@ -1,34 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
- %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>BillBuzz! Processing request...</title>
-</head>
-<body>
-<center>
-<br/>
-
-<%
- String message = (String)session.getAttribute("message");
- if(message != null) {
- out.write(message);
- session.setAttribute("message", null);
- }
- else {
- response.sendRedirect("index.jsp");
- }
-
-
-%>
-
-
-<%@ include file="footer.jsp" %>
-</center>
-</body>
-</html>
View
91 BBSignup/WebContent/process.jsp
@@ -1,91 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
- %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>BillBuzz! Processing request...</title>
-</head>
-<body>
-<center>
-<br/>
-<%
- Object o = session.getAttribute("senators");
- if(o != null) {
-
- if(o instanceof List<?>) {
-
- String update = (String)session.getAttribute("update");
- String updateemail = (String)session.getAttribute("updateemail");
-
- List<Senator> list = (List<Senator>)o;
-
- Controller c = new Controller();
-
-
- String[] r = request.getParameterValues("r");
- String[] d = request.getParameterValues("d");
-
- String s = c.handle(request.getParameter("firstname"),request.getParameter("lastname"),request.getParameter("email1"),
- ((updateemail != null) ? updateemail : request.getParameter("email2")),r,d,list,
- ((update != null && update.equals("true")) ? true : false));
-
- if(s.equals("")) {
- if(update != null && update.equals("true")) {
- session.setAttribute("error",null);
- session.setAttribute("update",null);
- session.setAttribute("updateemail",null);
- %>
- <div class="good" style="width:500px;">
- Your account has been successfully updated! Thanks for using BillBuzz.
- <br/><br/>
- Redirecting to nysenate.gov in 10 seconds...
- <meta http-equiv="Refresh" content="10; URL=http://www.nysenate.gov">
- </div>
- <%
- }
- else {
- //success
- //send auth email
- c.newUserEmail(request.getParameter("email1"));
- %>
- <div class="good" style="width:500px;">
- Thanks for signing up, you should receive an email shortly to verify your request.
- <br/><br/>
- Redirecting to nysenate.gov in 10 seconds...
- <meta http-equiv="Refresh" content="10; URL=http://www.nysenate.gov">
- </div>
- <%
- }
-
- }
- else {
-
- session.setAttribute("error", s);
- session.setAttribute("fn",request.getParameter("firstname"));
- session.setAttribute("ln",request.getParameter("lastname"));
- session.setAttribute("e1",request.getParameter("email1"));
- session.setAttribute("e2",request.getParameter("email2"));
- session.setAttribute("subs", c.getSubFromArrays(r,d,list));
- %>
- <jsp:forward page="notice.jsp" />
- <%
- }
- }
- }
- else {
- %>
-
- <jsp:forward page="index.jsp" />
-
- <%
- }
-%>
-<%@ include file="footer.jsp" %>
-</center>
-</body>
-</html>
View
19 BBSignup/bbs.ddl
@@ -1,19 +0,0 @@
-
-CREATE TABLE SENATOR
-(
- `NAME` VARCHAR(256) BINARY NOT NULL,
- PARTY VARCHAR(256) BINARY NULL,
- URL VARCHAR(256) BINARY NULL,
- PRIMARY KEY (`NAME`)
-) ENGINE=INNODB;
-
-CREATE TABLE `USER`
-(
- EMAIL VARCHAR(256) BINARY NOT NULL,
- AUTH VARCHAR(256) BINARY NULL,
- FIRST_NAME VARCHAR(256) BINARY NULL,
- LAST_NAME VARCHAR(256) BINARY NULL,
- SUBS LONG VARBINARY NULL,
- PRIMARY KEY (EMAIL)
-) ENGINE=INNODB;
-
View
174 BBSignup/pom.xml
@@ -0,0 +1,174 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>BBSignup</groupId>
+ <artifactId>BBSignup</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.jdo</groupId>
+ <artifactId>jdo2-api</artifactId>
+ <version>2.3-eb</version>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.0.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpmime</artifactId>
+ <version>4.0.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jasypt</groupId>
+ <artifactId>jasypt</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4.1</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>3.1.11</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.util</groupId>
+ <artifactId>ws-commons-util</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlrpc</groupId>
+ <artifactId>xmlrpc-client</artifactId>
+ <version>3.1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-db4o</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-enhancer</artifactId>
+ <version>2.0.0-release</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-excel</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-jodatime</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-jpa</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-json</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-ldap</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-management</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-rdbms</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-rest</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-xml</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-cache</artifactId>
+ <version>2.0.0-release</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-core</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-db4o</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ </dependencies>
+</project>
View
62 BBSignup/senators
@@ -1,62 +0,0 @@
-ADAMS#eadams@senate.state.ny.us#d#http://www.nysenate.gov/senator/eric-adams
-ADDABBO#addabbo@senate.state.ny.us#d#http://www.nysenate.gov/senator/joseph-p-addabbo-jr
-ALESI#alesi@senate.state.ny.us#r#http://www.nysenate.gov/senator/james-s-alesi
-AUBERTINE#aubertin@senate.state.ny.us#d#http://www.nysenate.gov/senator/darrel-j-aubertine
-BONACIC#bonacic@senate.state.ny.us#r#http://www.nysenate.gov/senator/john-j-bonacic
-BRESLIN#breslin@senate.state.ny.us#d#http://www.nysenate.gov/senator/neil-d-breslin
-DEFRANCISCO#jdefranc@senate.state.ny.us#r#http://www.nysenate.gov/senator/john-defrancisco
-DIAZ#diaz@senate.state.ny.us#d#http://www.nysenate.gov/senator/ruben-diaz
-DILAN#dilan@senate.state.ny.us#d#http://www.nysenate.gov/senator/martin-malave-dilan
-DUANE#duane@senate.state.ny.us#d#http://www.nysenate.gov/senator/thomas-duane
-ESPADA#espada@senate.state.ny.us#d#http://www.nysenate.gov/senator/pedro-espada-jr
-FARLEY#farley@senate.state.ny.us#r#http://www.nysenate.gov/senator/hugh-t-farley
-FLANAGAN#flanagan@senate.state.ny.us#r#http://www.nysenate.gov/senator/john-j-flanagan
-FOLEY#sd3info@gmail.com#d#http://www.nysenate.gov/senator/brian-x-foley
-FUSCHILLO#fuschill@senate.state.ny.us#r#http://www.nysenate.gov/senator/charles-j-fuschillo-jr
-GOLDEN#golden@senate.state.ny.us#r#http://www.nysenate.gov/senator/martin-j-golden
-GRIFFO#griffo@senate.state.ny.us#r#http://www.nysenate.gov/senator/joseph-griffo
-HANNON#hannon@senate.state.ny.us#r#http://www.kemphannon.com/
-HASSELL-THOMPSON#hassellt@senate.state.ny.us#d#http://www.nysenate.gov/senator/ruth-hassell-thompson
-HUNTLEY#shuntley@senate.state.ny.us#d#http://www.nysenate.gov/senator/shirley-l-huntley
-JOHNSON C#johnson@senate.state.ny.us#d#http://www.nysenate.gov/senator/craig-m-johnson
-JOHNSON O#ojohnson@senate.state.ny.us#r#http://www.nysenate.gov/senator/owen-h-johnson
-KLEIN#jdklein@senate.state.ny.us#d#http://www.nysenate.gov/senator/jeffrey-d-klein
-KRUEGER#lkrueger@senate.state.ny.us#d#http://www.nysenate.gov/senator/liz-krueger
-KRUGER#kruger@senate.state.ny.us#d#http://www.nysenate.gov/senator/carl-kruger
-LANZA#lanza@senate.state.ny.us#r#http://www.nysenate.gov/senator/andrew-j-lanza
-LARKIN#larkin@senate.state.ny.us#r#http://www.nysenate.gov/senator/william-j-larkin-jr
-LAVALLE#lavalle@senate.state.ny.us#r#http://www.nysenate.gov/senator/kenneth-p-lavalle
-LEIBELL#leibell@senate.state.ny.us#r#http://www.nysenate.gov/senator/vincent-l-leibell
-LIBOUS#senator@senatorlibous.com#r#http://www.nysenate.gov/senator/tom-libous
-LITTLE#little@senate.state.ny.us#r#http://www.nysenate.gov/senator/elizabeth-little
-MARCELLINO#marcelli@senate.state.ny.us#r#http://www.nysenate.gov/senator/carl-l-marcellino
-MAZIARZ#maziarz@senate.state.ny.us#r#http://www.nysenate.gov/senator/george-d-maziarz
-MCDONALD#mcdonald@senate.state.ny.us#r#http://www.nysenate.gov/senator/roy-j-mcdonald
-MONTGOMERY#montgome@senate.state.ny.us#d#http://www.nysenate.gov/senator/velmanette-montgomery
-MORAHAN#morahan@senate.state.ny.us#r#http://www.nysenate.gov/senator/thomas-p-morahan
-NOZZOLIO#nozzolio@senate.state.ny.us#r#http://www.nysenate.gov/senator/michael-f-nozzolio
-ONORATO#onorato@senate.state.ny.us#d#http://www.nysenate.gov/senator/george-onorato
-OPPENHEIMER#oppenhei@senate.state.ny.us#d#http://www.nysenate.gov/senator/suzi-oppenheimer
-PADAVAN#padavan@senate.state.ny.us#r#http://www.nysenate.gov/senator/frank-padavan
-PARKER#parker@senate.state.ny.us#d#http://www.nysenate.gov/senator/kevin-s-parker
-PERALTA#jperalta@senate.state.ny.us#d#http://www.nysenate.gov/senator/jose-peralta
-PERKINS#perkins@senate.state.ny.us#d#http://www.nysenate.gov/senator/bill-perkins
-RANZENHOFER#ranz@senate.state.ny.us#r#http://www.nysenate.gov/senator/michael-h-ranzenhofer
-ROBACH#robach@senate.state.ny.us#r#http://www.nysenate.gov/senator/joseph-e-robach
-SALAND#saland@senate.state.ny.us#r#http://www.nysenate.gov/senator/stephen-m-saland
-SAMPSON#sampson@senate.state.ny.us#d#http://www.nysenate.gov/senator/john-l-sampson
-SAVINO#savino@senate.state.ny.us#d#http://www.nysenate.gov/senator/diane-j-savino
-SCHNEIDERMAN#schneide@senate.state.ny.us#d#http://www.nysenate.gov/senator/eric-t-schneiderman
-SERRANO#serrano@senate.state.ny.us#d#http://www.nysenate.gov/senator/jose-m-serrano
-SEWARD#seward@senate.state.ny.us#r#http://www.nysenate.gov/senator/james-l-seward
-SKELOS#skelos@senate.state.ny.us#r#http://www.nysenate.gov/senator/dean-g-skelos
-SMITH#masmith@senate.state.ny.us#d#http://www.nysenate.gov/senator/malcolm-smith
-SQUADRON#squadron@senate.state.ny.us#d#http://www.nysenate.gov/senator/daniel-l-squadron
-STACHOWSKI#stachows@senate.state.ny.us#d#http://www.nysenate.gov/senator/william-t-stachowski
-STAVISKY#stavisky@senate.state.ny.us#d#http://www.nysenate.gov/senator/toby-ann-stavisky
-STEWART-COUSINS#scousins@senate.state.ny.us#d#http://www.nysenate.gov/senator/andrea-stewart-cousins
-THOMPSON#athompso@senate.state.ny.us#d#http://www.nysenate.gov/senator/antoine-m-thompson
-VALESKY#valesky@senate.state.ny.us#d#http://www.nysenate.gov/senator/david-j-valesky
-VOLKER#volker@senate.state.ny.us#r#http://www.nysenate.gov/senator/dale-m-volker
-WINNER#winner@senate.state.ny.us#r#http://www.nysenate.gov/senator/george-h-winner-jr
-YOUNG#cyoung@senate.state.ny.us#r#http://www.nysenate.gov/senator/catharine-young
View
133 BBSignup/src/main/java/bbsignup/model/OldSenator.java
@@ -0,0 +1,133 @@
+
+package bbsignup.model;
+
+import javax.jdo.annotations.PersistenceCapable;
+
+@PersistenceCapable
+public class OldSenator {
+ String name;
+ String url;
+ String openLegName;
+
+ boolean democrat;
+ boolean republican;
+ boolean conservative;
+ boolean workingFamilies; //WF
+ //boolean independentParty; //I
+ boolean independenceParty; //IP
+ //boolean independent; //ind
+
+ public OldSenator() {
+ democrat = false;
+ republican = false;
+ conservative = false;
+ workingFamilies = false;
+ independenceParty = false;
+ }
+
+ public OldSenator(Senator senator) {
+ this.name = senator.name;
+ this.url = senator.url;
+ this.openLegName = senator.openLegName;
+ this.democrat = senator.democrat;
+ this.republican = senator.republican;
+ this.conservative = senator.conservative;
+ this.workingFamilies = senator.workingFamilies;
+ this.independenceParty = senator.independenceParty;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getOpenLegName() {
+ return openLegName;
+ }
+
+ public boolean isDemocrat() {
+ return democrat;
+ }
+
+ public boolean isRepublican() {
+ return republican;
+ }
+
+ public boolean isConservative() {
+ return conservative;
+ }
+
+ public boolean isWorkingFamilies() {
+ return workingFamilies;
+ }
+
+ public boolean isIndependenceParty() {
+ return independenceParty;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public void setOpenLegName(String openLegName) {
+ this.openLegName = openLegName;
+ }
+
+ public void setDemocrat(boolean democrat) {
+ this.democrat = democrat;
+ }
+
+ public void setRepublican(boolean republican) {
+ this.republican = republican;
+ }
+
+ public void setConservative(boolean conservative) {
+ this.conservative = conservative;
+ }
+
+ public void setWorkingFamilies(boolean workingFamilies) {
+ this.workingFamilies = workingFamilies;
+ }
+
+ public void setIndependenceParty(boolean independanceParty) {
+ this.independenceParty = independanceParty;
+ }
+
+ public String getParty() {
+
+ String ret = "";
+ if(democrat) {
+ ret = "d";
+ }
+ else if(republican) {
+ ret = "r";
+ }
+ if(independenceParty) {
+ ret = getPartyHelper(ret,"ip");
+ }
+ if(conservative) {
+ ret = getPartyHelper(ret,"c");
+ }
+ if(workingFamilies) {
+ ret = getPartyHelper(ret,"wf");
+ }
+
+ return ret;
+ }
+
+ public String getPartyHelper(String parties, String party) {
+ if(parties.equals("")) {
+ return party;
+ }
+ return parties + " - " + party;
+ }
+
+
+}
View
29 BBSignup/src/bbsignup/model/Senator.java → ...src/main/java/bbsignup/model/Senator.java
@@ -1,3 +1,4 @@
+
package bbsignup.model;
import javax.jdo.annotations.PersistenceCapable;
@@ -12,18 +13,16 @@
boolean republican;
boolean conservative;
boolean workingFamilies; //WF
- boolean independentParty; //I
+ //boolean independentParty; //I
boolean independenceParty; //IP
- boolean independent; //ind
+ //boolean independent; //ind
public Senator() {
democrat = false;
republican = false;
conservative = false;
workingFamilies = false;
- independentParty = false;
independenceParty = false;
- independent = false;
}
public String getName() {
@@ -54,18 +53,10 @@ public boolean isWorkingFamilies() {
return workingFamilies;
}
- public boolean isIndependentParty() {
- return independentParty;
- }
-
public boolean isIndependenceParty() {
return independenceParty;
}
- public boolean isIndependent() {
- return independent;
- }
-
public void setName(String name) {
this.name = name;
}
@@ -94,18 +85,10 @@ public void setWorkingFamilies(boolean workingFamilies) {
this.workingFamilies = workingFamilies;
}
- public void setIndependentParty(boolean independentParty) {
- this.independentParty = independentParty;
- }
-
public void setIndependenceParty(boolean independanceParty) {
this.independenceParty = independanceParty;
}
- public void setIndependent(boolean independent) {
- this.independent = independent;
- }
-
public String getParty() {
String ret = "";
@@ -115,15 +98,9 @@ public String getParty() {
else if(republican) {
ret = "r";
}
- if(independentParty) {
- ret = getPartyHelper(ret,"i");
- }
if(independenceParty) {
ret = getPartyHelper(ret,"ip");
}
- if(independent) {
- ret = getPartyHelper(ret,"ind");
- }
if(conservative) {
ret = getPartyHelper(ret,"c");
}
View
13 BBSignup/src/bbsignup/model/User.java → ...up/src/main/java/bbsignup/model/User.java
@@ -31,6 +31,10 @@
@Column(name="auth")
private String auth;
+ @Persistent
+ @Column(name="other_data")
+ private boolean otherData;
+
@Persistent(defaultFetchGroup="true")
@Column(name="subs")
@@ -40,12 +44,13 @@ public User() {
subscriptions = new ArrayList<String>();
}
- public User(String firstName, String lastName, String email, String auth) {
+ public User(String firstName, String lastName, String email, String auth, boolean otherData) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.auth = auth;
subscriptions = new ArrayList<String>();
+ this.otherData = otherData;
}
@@ -64,6 +69,9 @@ public String getAuth() {
public List<String> getSubscriptions() {
return subscriptions;
}
+ public boolean getOtherData() {
+ return otherData;
+ }
public void setFirstName(String firstName) {
this.firstName = firstName;
@@ -80,6 +88,9 @@ public void setAuth(String auth) {
public void setSubscriptions(List<String> subscriptions) {
this.subscriptions = subscriptions;
}
+ public void setOtherData(boolean otherData) {
+ this.otherData = otherData;
+ }
public void addSubscription(String s) {
subscriptions.add(s);
View
12 BBSignup/src/bbsignup/model/UserAuth.java → ...rc/main/java/bbsignup/model/UserAuth.java
@@ -1,11 +1,8 @@
package bbsignup.model;
-import java.io.IOException;
import java.util.Date;
-
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.PrimaryKey;
-
import org.jasypt.util.text.BasicTextEncryptor;
import bbsignup.src.Controller;
@@ -17,13 +14,8 @@
String email;
String hash;
- public static void main(String[] args) throws IOException {
- String str = "";
- Controller c = new Controller();
- UserAuth ua = c.getUserAuth("williams@nysenate.gov");
-
- System.out.println(ua.getHash());
- System.out.println(ua.isHashCorrect(str));
+ public static void main(String[] args) {
+ System.out.println(new Controller().getUser("williams@nysenate.gov").getOtherData());
}
public UserAuth() {
View
82 BBSignup/src/bbsignup/src/Controller.java → ...rc/main/java/bbsignup/src/Controller.java
@@ -1,9 +1,13 @@
package bbsignup.src;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.jdo.PersistenceManager;
import javax.jdo.Transaction;
@@ -17,18 +21,68 @@
import bbsignup.model.*;
public class Controller {
- private static final String SMTP_HOST_NAME = Resource.get("hostname");
-
- private static final String SMTP_PORT = Resource.get("port");
-
- private static final String SMTP_ACCOUNT_USER = Resource.get("user");
- private static final String SMTP_ACCOUNT_PASS = Resource.get("pass");
public String WEBLINK = "http://billbuzz.nysenate.gov/";
-
+ public static void main(String[] args) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ String in = "";
+
+ System.out.print("> ");
+ while(!(in = br.readLine()).equals("exit")) {
+
+ if(in.startsWith("add user")) {
+ Pattern p = Pattern.compile("add user (.+?) (.+?) (.+?) (true|false)$");
+ Matcher m = p.matcher(in);
+ if(m.find()) {
+ User u = new User(m.group(1), m.group(2), m.group(3),
+ "y",m.group(4).equals("true")?true:false);
+ u.addSubscription("all");
+ PMF.persistObject(u);
+ System.out.println("User " + m.group(3) + " added succesfully");
+ }
+ else {
+ System.out.println("proper format is: add user <nfame> <lfame> <email>" +
+ "<otherdata(true or false)>");
+ }
+ }
+ else if(in.startsWith("delete user")) {
+ Pattern p = Pattern.compile("delete user (.+)$");
+ Matcher m = p.matcher(in);
+ if(m.find()) {
+ PMF.deleteObjectById(User.class, "email", m.group(1));
+ System.out.println("User " + m.group(1) + " deleted");
+ }
+ else {
+ System.out.println("proper format is: add user <nfame> <lfame> <email>");
+ }
+ }
+ else if(in.startsWith("set other")) {
+ PersistenceManager pm = PMF.getPersistenceManager();
+ Transaction tx = pm.currentTransaction();
+
+ try {
+ tx.begin();
+
+ List<User> users = (List<User>)PMF.getObjects(pm, User.class);
+ for(User user:users) {
+ user.setOtherData(true);
+ }
+
+ tx.commit();
+ }
+ finally {
+ if(tx.isActive()){
+ tx.rollback();
+ }
+ pm.close();
+ }
+ }
+ System.out.print("> ");
+ }
+ }
- public Controller() throws IOException {
+ public Controller() {
}
@SuppressWarnings("unchecked")
@@ -68,7 +122,7 @@ public String tryDelete(String email) {
public boolean deleteUser(String email, String key) {
UserAuth ua = getUserAuth(email);
- if(ua.isHashCorrect(key)) {
+ if(ua != null && ua.getHash() != null && ua.isHashCorrect(key)) {
PMF.deleteObjects(new Class[] {User.class,UserAuth.class},
new String[] {"email","email"},
new String[] {email,email});
@@ -88,7 +142,7 @@ public UserAuth getUserAuth(String email) {
public void newUserEmail(String email, String hash) {
- String message = "Hello!<br/><br/>Thanks for signing up for BillBuzz, to finalize your subscription please click the following link:";
+ String message = "Hello!<br/><br/>Thanks for signing up for BillBuzz. To finalize your subscription please click the following link:";
message += "<br/><br/>" + WEBLINK + "authenticate.jsp?email=" + email + "&key=" + hash;
@@ -167,18 +221,18 @@ public boolean authenticateUser(String email, String key){
public void sendMail(String to, String subject, String message, String from, String fromDisplay) throws Exception {
Properties props = new Properties();
- props.put("mail.smtp.host", SMTP_HOST_NAME);
+ props.put("mail.smtp.host", Resource.get("hostname"));
props.put("mail.smtp.auth", "true");
props.put("mail.debug", "true");
- props.put("mail.smtp.port", SMTP_PORT);
+ props.put("mail.smtp.port", Resource.get("port"));
props.put("mail.smtp.starttls.enable","false");
- props.put("mail.smtp.socketFactory.port", SMTP_PORT);
+ props.put("mail.smtp.socketFactory.port", Resource.get("port"));
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.ssl.enable","false");
Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(SMTP_ACCOUNT_USER, SMTP_ACCOUNT_PASS);}});
+ return new PasswordAuthentication(Resource.get("user"), Resource.get("pass"));}});
session.setDebug(false);
Message msg = new MimeMessage(session);
InternetAddress addressFrom = new InternetAddress(from);
View
0 BBSignup/src/bbsignup/src/Dump.java → ...gnup/src/main/java/bbsignup/src/Dump.java
File renamed without changes.
View
23 BBSignup/src/bbsignup/src/PMF.java → BBSignup/src/main/java/bbsignup/src/PMF.java
@@ -213,4 +213,27 @@ public static boolean deleteObjects(Class<?>[] clazz, String[] key, String[] id)
return true;
}
+
+ public static void deleteObjects(Class<?> clazz) {
+ PersistenceManager pm = getPersistenceManager();
+ Transaction tx = pm.currentTransaction();
+
+ try {
+ tx.begin();
+
+ Collection<?> objs = getObjects(pm, clazz);
+
+ for(Object o:objs) {
+ pm.deletePersistent(o);
+ }
+
+ tx.commit();
+ }
+ finally {
+ if(tx.isActive()) {
+ tx.rollback();
+ }
+ pm.close();
+ }
+ }
}
View
24 BBSignup/src/bbsignup/src/Resource.java → .../src/main/java/bbsignup/src/Resource.java
@@ -6,27 +6,36 @@
import java.io.InputStream;
import java.util.Properties;
+import javax.servlet.ServletContext;
+
/**
* @author Jared Williams
* This class is the property loader and accessor. It allows the properties file
* to be accessed statically
*/
public class Resource {
- private static String resource = "app.properties";
+ private static String servletResource = "/WEB-INF/app.properties";
+// private static String classResource = "src/main/webapp" + servletResource;
+ private static String classResource = "app.properties";
private static InputStream INPUT;
private static Properties properties;
+ private static ServletContext CONTEXT;
/*
* If current context is servlet grab resource stream and load props, otherwise
* use typical file reader
- *
*/
private static Properties load() {
try{
if(properties == null) {
properties = new Properties();
- init();
+ if(CONTEXT == null) {
+ init();
+ }
+ else {
+ INPUT = CONTEXT.getResourceAsStream(servletResource);
+ }
properties.load(INPUT);
}
}
@@ -38,7 +47,14 @@ private static Properties load() {
}
public static void init() throws FileNotFoundException {
- INPUT = new FileInputStream(new File(resource));
+ INPUT = new FileInputStream(new File(classResource));
+ }
+
+ /*
+ * Would be called from the servlet, saves Servlet
+ */
+ public static void init(ServletContext sc) {
+ CONTEXT = sc;
}
public static String get(String key) {
View
96 BBSignup/src/collect/NYSenateServices.java → ...c/main/java/collect/NYSenateServices.java
@@ -10,22 +10,84 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import bbsignup.model.OldSenator;
import bbsignup.model.Senator;
import bbsignup.src.PMF;
@SuppressWarnings("unchecked")
public class NYSenateServices {
public static void index() throws Exception {
- List<Senator> senators = getSenators();
+ List<Senator> newSenList = getSenators();
+ List<Senator> prevSenList = (List<Senator>) PMF.getDetachedObjects(Senator.class);
+ List<OldSenator> oldSenList = (List<OldSenator>) PMF.getDetachedObjects(OldSenator.class);
- for(Senator s:senators) {
+ HashMap<String,Senator> newSenMap = getSenatorMap(newSenList);
+ HashMap<String,Senator> prevSenMap = getSenatorMap(prevSenList);
+ HashMap<String,OldSenator> oldSenMap = getOldSenatorMap(oldSenList);
+
+ for(String name:prevSenMap.keySet()) {
+ if(newSenMap.get(name) != null) {
+ prevSenList.remove(prevSenMap.get(name));
+ }
+ else
+ {
+ if(oldSenMap.get(name) != null) {
+ prevSenList.remove(prevSenMap.get(name));
+ }
+ }
+ }
+
+ for(Senator senator:prevSenList) {
+ oldSenList.add(new OldSenator(senator));
+ }
+
+ PMF.deleteObjects(OldSenator.class);
+ PMF.deleteObjects(Senator.class);
+
+ for(Senator s:newSenList) {
PMF.persistObject(s);
}
+ for(OldSenator os:oldSenList) {
+ PMF.persistObject(os);
+ }
+
+
+ }
+
+ public static HashMap<String,Senator> getSenatorMap(List<Senator> list) {
+ HashMap<String,Senator> map = new HashMap<String,Senator>();
+ for(Senator senator:list) {
+ map.put(senator.getOpenLegName(), senator);
+ }
+ return map;
+ }
+
+ public static HashMap<String,OldSenator> getOldSenatorMap(List<OldSenator> list) {
+ HashMap<String,OldSenator> map = new HashMap<String,OldSenator>();
+ for(OldSenator senator:list) {
+ map.put(senator.getOpenLegName(), senator);
+ }
+ return map;
}
public static void main(String[] args) throws Exception {
index();
+
+ /*if(args.length == 0) {
+ System.out.println("please indicate either 'index' or 'truncate'");
+ }
+ else {
+ if(args[0].equals("index")) {
+ index();
+ }
+ else if(args[0].equals("truncate")) {
+ PMF.deleteObjects(Senator.class);
+ }
+ else {
+ System.out.println("please indicate either 'index' or 'truncate'");
+ }
+ }*/
}
public static List<Senator> getSenators() throws Exception {
@@ -71,15 +133,9 @@ public static void main(String[] args) throws Exception {
else if(party.matches("R")) {
senator.setRepublican(true);
}
- else if(party.matches("I")) {
- senator.setIndependentParty(true);
- }
else if(party.matches("IP")) {
senator.setIndependenceParty(true);
}
- else if(party.matches("Ind")) {
- senator.setIndependent(true);
- }
else if(party.matches("WF")) {
senator.setWorkingFamilies(true);
}
@@ -102,14 +158,12 @@ else if(party.matches("C")) {
public static HashMap<String,String> getOpenLegSenators() throws IOException {
HashMap<String,String> ret = new HashMap<String,String>();
- URL url = new URL("http://open.nysenate.gov/legislation/senators/");
+ URL url = new URL("http://open.nysenate.gov/legislation/senators");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
-
- Pattern lineP = Pattern.compile("<div class=\"views-field-field-senators-district-nid\">");
+
Pattern districtP = Pattern.compile("District (\\d+)");
- Pattern nameP = Pattern.compile("/legislation/sponsor/(\\w+)");
+ Pattern nameP = Pattern.compile("/sponsor/(.+?)\\?filter");
- Matcher lineM = null;
Matcher districtM = null;
Matcher nameM = null;
@@ -118,23 +172,15 @@ else if(party.matches("C")) {
while((in = br.readLine()) != null) {
String d = null, n = null;
- lineM = lineP.matcher(in);
+ districtM = districtP.matcher(in);
- if(lineM.find()) {
+ if(districtM.find()) {
+ d = districtM.group(1);
in = br.readLine();
-
- districtM = districtP.matcher(in);
+
nameM = nameP.matcher(in);
- if(districtM.find()) {
- d = districtM.group(1);
-
- if(districtM.group(1).equals("6")) {
- n = "hannon";
- }
- }
-
if(nameM.find()) {
n = nameM.group(1);
}
View
0 BBSignup/src/collect/XmlRpc.java → BBSignup/src/main/java/collect/XmlRpc.java
File renamed without changes.
View
13 BBSignup/src/servlets/MainServlet.java → ...p/src/main/java/servlets/MainServlet.java
@@ -15,6 +15,7 @@
import bbsignup.model.UserAuth;
import bbsignup.src.Controller;
import bbsignup.src.PMF;
+import bbsignup.src.Resource;
/**
* Servlet implementation class MainServlet
@@ -23,10 +24,8 @@
private static final long serialVersionUID = 1L;
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
-
- // will store selected subscriptions */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // will store selected subscriptions
List<String> subs = new ArrayList<String>();
HttpSession session = request.getSession();
@@ -35,14 +34,16 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
String fname = null;
String lname = null;
String email = null;
+ String otherData = null;
// if update exists in the session then the user already xists */
String update = (String)session.getAttribute("update");
if(o != null) {
fname = (String)request.getParameter("firstname");
lname = (String)request.getParameter("lastname");
- email = (String)request.getParameter("email1");
+ email = (String)request.getParameter("email1");
+ otherData = (String)request.getParameter("otherData");
/* this is a session variable stored from index.jsp, verifies
* that the user is following proper workflow */
@@ -82,7 +83,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
Controller c = new Controller();
String message = null;
- User u = new User(fname, lname, email, "n");
+ User u = new User(fname, lname, email, "n", (otherData.equals("yes") ? true:false));
u.setSubscriptions(subs);
if(update == null) {
View
2 BBSignup/src/servlets/SenatorContext.java → ...rc/main/java/servlets/SenatorContext.java
@@ -1,7 +1,6 @@
package servlets;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletContext;
@@ -12,6 +11,7 @@
public class SenatorContext {
public static synchronized List<Senator> getSenators(ServletContext context) throws IOException {
+ @SuppressWarnings("unchecked")
List<Senator> senators = (List<Senator>)context.getAttribute("senators");
if(senators == null) {
senators = new Controller().getSenators();
View
0 BBSignup/WebContent/META-INF/MANIFEST.MF → ...gnup/src/main/webapp/META-INF/MANIFEST.MF
File renamed without changes.
View
0 BBSignup/WebContent/WEB-INF/web.xml → BBSignup/src/main/webapp/WEB-INF/web.xml
File renamed without changes.
View
26 BBSignup/WebContent/authenticate.jsp → BBSignup/src/main/webapp/authenticate.jsp
@@ -1,18 +1,7 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
- %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>BillBuzz! Authentication</title>
-</head>
-<body>
+<%@ page language="java" import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"%>
+<jsp:include page="header.jsp" />
+<div id="main">
<center>
-<br/>
<%
String email = request.getParameter("email");
@@ -24,7 +13,7 @@
if(c.authenticateUser(email,key) == true) {
%>
<div class="good" style="width:500px;">
- Success! Thanks for signing up, you'll start receiving BillBuzz updates within the next 24 hours.
+ Success! Thanks for signing up. You'll start receiving BillBuzz updates within the next 24 hours.
<br/><br/>
Redirecting to nysenate.gov in 10 seconds...
<meta http-equiv="Refresh" content="10; URL=http://www.nysenate.gov">
@@ -54,13 +43,12 @@
else {
%>
- <jsp:forward page="index.jsp" />
+ <jsp:forward page="/" />
<%
}
%>
-<%@ include file="footer.jsp" %>
</center>
-</body>
-</html>
+</div>
+<%@ include file="footer.jsp"%>
View
13 BBSignup/src/main/webapp/cancel.jsp
@@ -0,0 +1,13 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<%
+ session.setAttribute("subs", null);
+ session.setAttribute("fn", null);
+ session.setAttribute("ln", null);
+ session.setAttribute("e", null);
+ session.setAttribute("oldemail", null);
+ session.setAttribute("update", null);
+
+%>
+
+<jsp:forward page="/" />
View
126 BBSignup/src/main/webapp/css/nys.css
@@ -0,0 +1,126 @@
+html,body,div,ul,li {
+ margin: 0px;
+ padding: 0px;
+}
+
+html,body {
+ width: 100%;
+}
+
+.clear {
+ clear: both;
+}
+
+body {
+ color: #012849;
+ /*font-family: Times New Roman, serif;*/
+ font-family: helvetica, arial;
+ font-size: 89.5%; /* 10px */
+
+ background:url(http://www.nysenate.gov/sites/all/themes/nys/images/nyss_bg.png) top left repeat-x;
+}
+
+#page {
+ width: 877px;
+ margin: 0 auto;
+ background: #E2DED5;
+}
+
+#header {
+ background:
+ url(http://www.nysenate.gov/sites/all/themes/nys/images/header.png)
+ top left no-repeat;
+ padding: 16px 0px 0px 0px;
+ height: 77px;
+}
+
+#logo {
+ width: 250px;
+ height: 55px;
+ margin-top: 16px 0px 0px 5px;
+ border: 0px;
+}
+
+#welcome {
+ color: white;
+ font-weight: bold;
+}
+
+#nav_bar {
+ color: white;
+ background:
+ url(http://www.nysenate.gov/sites/all/themes/nys/images/nyss_menu_bg.png)
+ top left repeat-x;
+ line-height: 30px;
+ font-family: Helvetica, Arial, sans-serif;
+}
+
+#nav_bar a:link {
+ color: white;
+ font-weight: bold;
+ text-decoration: none;
+}
+
+#nav_bar a:visited {
+ color: white;
+ font-weight: bold;
+ text-decoration: none;
+}
+
+#nav_bar a:hover {
+ text-decoration: underline;
+}
+
+#nav_bar a:focus {
+
+}
+
+#nav_bar a:active {
+
+}
+
+#nav_bar ul {
+ display: inline;
+ list-icon-style: none;
+ padding-left: 10px;
+}
+
+#nav_bar li {
+ display: inline;
+}
+
+.sep {
+ padding: 0px 10px;
+ display: inline;
+}
+
+#error {
+ text-align: center;
+ color: red;
+}
+
+.entity_button {
+ display: inline;
+}
+
+.entity_title {
+ display: inline;
+ font-weight: bold;
+}
+
+
+#main {
+ margin-top: 5px;
+ margin: 20px;
+ padding: 20px;
+ padding-top: 5px;
+ background: #ffffff
+ url(http://www.nysenate.gov/sites/all/themes/nys/images/nyss_block_footer_bg.png)
+ repeat-x bottom left;
+}
+
+h2 {
+ font-family: arial, serif;
+ text-transform: uppercase;
+ text-align: left;
+}
View
33 BBSignup/WebContent/style.css → BBSignup/src/main/webapp/css/style.css
@@ -1,14 +1,6 @@
-body {
- font-family: helvetica, arial;
- font-size: 89.5%; /* 10px */
- line-height: 1.4em; /* 15px */
- color: #333;
- background-color: #fff;
- margin:16px;
- margin-top:1px;
-}
.bad {
+ color:black;
border:1px solid #FF3300;
margin:1em auto;
border-collapse:collapse;
@@ -18,6 +10,7 @@ body {
.foot {
border-collapse:collapse;
font-size:85%;
+ align:center;
}
.good {
@@ -26,7 +19,7 @@ body {
background-color: #BFFFFE;
}
-.main {
+.bb_main {
border-collapse:collapse;
border:1px solid #B2A100;
background-color: #FEF9BF;
@@ -35,11 +28,19 @@ body {
left:15%;
}
-h2 {
- position:relative;
- left:-355px;top:5px;
-}
-
A:visited {
color: blue;
-}
+}
+
+.notice
+{
+ background-color:#ffffcc;
+ color:#555;
+ padding:3px;
+ font-size:80%;
+ border:1px solid #aaaaaa;
+ text-align:center;
+
+}
+
+
View
30 BBSignup/WebContent/delete.jsp → BBSignup/src/main/webapp/delete.jsp
@@ -1,17 +1,9 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
+<%@ page language="java" import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Insert title here</title>
-</head>
-<body>
+
+<jsp:include page="header.jsp" />
+<div id="main">
<center>
-<br/>
<%
String email = (String)request.getParameter("email");
String key = (String)request.getParameter("key");
@@ -27,6 +19,15 @@
</div>
<%
}
+ else {
+ %>
+ <div class="bad" style="width:500px;">
+ There was an error authenticating your request.
+ <br/><br/>
+ Please <a href="mailto:billbuzz@nysenate.gov">contact us</a> if you are having trouble.
+ </div>
+ <%
+ }
}
@@ -44,7 +45,6 @@
%>
-<%@ include file="footer.jsp" %>
</center>
-</body>
-</html>
+</div>
+<%@ include file="footer.jsp"%>
View
20 BBSignup/src/main/webapp/footer.jsp
@@ -0,0 +1,20 @@
+ </div>
+ <center><div class="foot">
+ <table cellpadding=5>
+ <tr>
+ <td>
+ <a href="index.jsp">BillBuzz Home</a>
+
+ </td>
+ <td align="center">
+ </td>
+ <td align = "right">
+ <a href="http://www.nysenate.gov">NYSenate.gov</a>
+ </td>
+ </tr>
+ </table>
+ </div></center>
+ </body>
+</html>
+
+
View
39 BBSignup/src/main/webapp/header.jsp
@@ -0,0 +1,39 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1" import="bbsignup.src.Resource"%>
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>NYSS BillBuzz</title>
+ <link rel="shortcut icon" href="img/nys_favicon_0.ico" />
+ <link rel="stylesheet" type="text/css" href="/BBSignup/css/style.css" />
+ <link rel="stylesheet" type="text/css" href="/BBSignup/css/nys.css" />
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+ <script type="text/javascript" src="/BBSignup/js/js.js"></script>
+ </head>
+ <body>
+ <div id="page">
+ <div id="header">
+ <a href="http://www.nysenate.gov">
+ <img src="http://www.nysenate.gov/sites/all/themes/nys/images/nyss_logo.png" id="logo" />
+ </a>
+
+ </div>
+
+ <div id="nav_bar">
+ Already subscribed?
+ <ul>
+ <li><a href="update.jsp">Update</a></li>
+ <li>or</li>
+ <li><a href="unsubscribe.jsp">Unsubscribe</a></li>
+ </ul>
+ </div>
+
+ <div class="notice">
+ BillBuzz is currently in "beta" and may occasionally offer incorrect data.
+ Please give us your feedback at
+ <a href="http://www.nysenate.gov/contact">http://www.nysenate.gov/contact</a>.
+ </div>
+
+
+
View
BIN BBSignup/src/main/webapp/img/nys_favicon_0.ico
Binary file not shown.
View
187 BBSignup/WebContent/index.jsp → BBSignup/src/main/webapp/index.jsp
@@ -1,120 +1,23 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="servlets.SenatorContext,java.util.*,bbsignup.src.*,bbsignup.model.Senator,javax.jdo.*"%>
+<%@ page contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1" language="java" import="servlets.SenatorContext,java.util.*,bbsignup.src.*,bbsignup.model.Senator"%>
+ <jsp:include page="header.jsp" />
<%
-
List<Senator> list = (List<Senator>)SenatorContext.getSenators(this.getServletContext());;
%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
-<script type="text/javascript"
- src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
-<script type="text/javascript">
-
-function addError(message, msg) {
- if(message == "") {
- return msg;
- }
- else {
- return message += "<br>" + msg;
- }
-}
- $(document).ready(
- function() {
- /*reset = function() {
- $('.cb_').each(function() {
- doCheck(this, $(this).attr('party'));
- });
- };*/
-
- doCheck = function(curSelector, party) {
- if (!$('#cb_all').is(':checked')) {
- $('.senator').each(function(index) {
- var parties = $($('.party').get(index)).html();
-
- var check = $(this).children("INPUT[type='checkbox']");
-
- var re = new RegExp('(\\(|\\- )' + party
- + '(\\)| \\-)');
- if (parties.match(re)) {
- $(check).attr('checked',
- $(curSelector).is(':checked'));
- }
- });
- }
- };
-
- clearAll = function() {
- $("INPUT[type='checkbox']").attr('checked', false);
- };
-
- $('#cb_all').change(
- function() {
- $("INPUT[type='checkbox']").attr('checked',
- $('#cb_all').is(':checked'));
- });
-
- $('.cb_').change(function() {
- doCheck(this, $(this).attr('party'));
- //reset();
- });
-
- $('#process').click(function(event) {
-
-
- message = "";
- e1 = document.forms.senators.email1.value;
- e2 = document.forms.senators.email2.value;
- fn = document.forms.senators.firstname.value;
- ln = document.forms.senators.lastname.value;
-
- if(!fn){
- message = addError(message, "Enter your first name");
- }
- if(!ln) {
- message = addError(message, "Enter your last name");
- }
- if(e1 == null || e2 == null || e1 != e2) {
- message = addError(message, "Your email addresses must match!");
- }
- else {
- if(!e1.match(/.*?@.*?\..*?/)) {
- message = addError(message, "Enter a valid email address");
- }
- }
-
- if(message != "") {
- $("#error").html(message);
- $("#error").css({'display' : 'inherit'});
- $('html,body').animate({
- scrollTop:$("#error").offset().top}, 500);
- return false;
- }
- else {
- return true;
-
- }
-
- });
-
- });
-
-</script>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Sign up for BillBuzz!</title>
-</head>
-<body>
-
<center>
+<div id="main">
<%
String update = (String) session.getAttribute("update");
String fn = (String) session.getAttribute("fn");
String ln = (String) session.getAttribute("ln");
String e1 = (String) session.getAttribute("e");
+ String otherData = (String) session.getAttribute("otherData");
List<String> subs = (List<String>) session.getAttribute("subs");
+
+ if(otherData == null) {
+ otherData ="";
+ }
+
if (update != null) {
if (update.equals("update")) {
@@ -124,6 +27,9 @@ function addError(message, msg) {
<tr>
<td>Changes will be saved when you click Submit.</td>
</tr>
+ <tr>
+ <td align=center><a href="cancel.jsp">Click here to cancel your update</a></td>
+ </tr>
</table>
</div>
<%
@@ -135,6 +41,7 @@ function addError(message, msg) {
session.setAttribute("ln", null);
session.setAttribute("e", null);
session.setAttribute("update", null);
+ session.setAttribute("subs", null);
}
if(subs != null && subs.size() == 0) {
%>
@@ -155,11 +62,9 @@ function addError(message, msg) {
<form id="inputForm" name="senators" method="post"
action="subscribe">
-
-
<h2>What is BillBuzz?</h2>
-<div class="main">
+<div class="bb_main">
<table>
<tr>
<td>
@@ -181,9 +86,9 @@ function addError(message, msg) {
</div>
<div id ="error" class="bad" style="font-size: 85%; width: 40%;display:none;"></div>
-<h2 style="left: -385px">Sign Up</h2>
+<h2>Sign Up</h2>
<p></p>
-<div class="main"><br>
+<div class="bb_main"><br>
<table>
<tr>
<td>First name</td>
@@ -212,30 +117,24 @@ function addError(message, msg) {
<tr>
<td><input id="cb_all" name="cb_all" type="checkbox"></input></td>
<td>All</td>
-
<td><input class="cb_" party="D" type="checkbox"></input></td>
- <td>Democrat</td>
-
+ <td>Democratic</td>
<td><input class="cb_" party="R" type="checkbox"></input></td>
<td>Republican</td>
-
+ </tr>
+ <tr>
+ <td><input class="cb_" party="IP" type="checkbox"></input></td>
+ <td>Independence</td>
<td><input class="cb_" party="C" type="checkbox"></input></td>
<td>Conservative</td>
- </tr>
- <td><input class="cb_" party="WF" type="checkbox"></input></td>
- <td>Working Family</td>
-
- <td><input class="cb_" party="IND" type="checkbox"></input></td>
- <td>Independent</td>
+ <td><input class="cb_" party="WF" type="checkbox"></input></td>
+ <td>Working Families</td>
+
- <td><input class="cb_" party="IP" type="checkbox"></input></td>
- <td>Independence Party</td>
-
- <td><input class="cb_" party="I" type="checkbox"></input></td>
- <td>Independent Party</td>
</tr>
</table>
<br />
+<div style="position:relative;right:-7px;">
<table cellpadding=3>
<%%>
<tr>
@@ -267,7 +166,7 @@ function addError(message, msg) {
}
}
%>
- <div class="senator"><input type="checkbox"
+ <div class="senator"><input class="sen_" type="checkbox"
name="<%=s.getOpenLegName()%>"
<%=((tog == true) ? "checked=\"yes\"" : "")%>></input></div>
<%
@@ -276,7 +175,7 @@ function addError(message, msg) {
</td>
<td><a target="_blank" href="<%=s.getUrl()%>"><%=s.getName()%></a>
- <div class="party" style="font-size: 75%;">(<%=s.getParty().toUpperCase()%>)</div>
+ <div class="party" style="font-size: 75%;" pl="(<%=s.getParty().toUpperCase()%>)"></div>
</td>
<%
@@ -287,25 +186,27 @@ function addError(message, msg) {
<%%>
<tr></tr>
- <tr></tr>
<tr>
+ <td colspan=8>
+ <p>Would you like to receive updates for data where the sponsor can't be determined?
+ <select name="otherData">
+ <option <%=otherData.equals("yes")?"SELECTED":"" %>>Yes</option>
+ <option <%=otherData.equals("no")?"SELECTED":"" %>>No</option>
+ </select>
+ </p>
+ </td>
<td></td>
<td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td><input type="button" name="clear" value="Clear Selection"
- onClick="clearAll()"></input></td>
- <td></td>
- <td><input type="submit" id="process" name="submit"></input></td>
</tr>
-
</table>
+
+<div style="position:right;right:250px;"><input type="button" name="clear" value="Clear Selection"
+ onClick="clearAll()"></input>
+ <input type="submit" id="process" name="submit" value="Sign up"></input></td><div>
+</div>
</div>
</form>
-<%@ include file="footer.jsp"%></center>
-</body>
-</html>
+</div>
+</center>
+<%@ include file="footer.jsp"%>
View
92 BBSignup/src/main/webapp/js/js.js
@@ -0,0 +1,92 @@
+function addError(message, msg) {
+ if(message == "") {
+ return msg;
+ }
+ else {
+ return message += "<br>" + msg;
+ }
+}
+$(document).ready(function() {
+ reset = function() {
+ $('.cb_').each(function() {
+ if($(this).is(':checked')) {
+ doCheck(this, $(this).attr('party'));
+ }
+ });
+ };
+
+ doCheck = function(curSelector, party) {
+ if($('#cb_all').is(':checked') && !$(this).is(':checked')) {
+ $('#cb_all').attr('checked',false);
+ }
+
+ $('.senator').each(function(index) {
+ //var parties = $($('.party').get(index)).html();
+ var parties = $($('.party').get(index)).attr('pl');
+
+ var check = $(this).children("INPUT[type='checkbox']");
+
+ var re = new RegExp('(\\(|\\- )' + party
+ + '(\\)| \\-)');
+ if (parties.match(re)) {
+ $(check).attr('checked',
+ $(curSelector).is(':checked'));
+ }
+ });
+ };
+
+ clearAll = function() {
+ $("INPUT[type='checkbox']").attr('checked', false);
+ };
+
+ $('#cb_all').change(
+ function() {
+ $("INPUT[type='checkbox']").attr('checked',
+ $('#cb_all').is(':checked'));
+ });
+
+ $('.cb_').change(function() {
+ doCheck(this, $(this).attr('party'));
+ reset();
+ });
+
+ $('.sen_').change(function() {
+ if($('#cb_all').is(':checked') && !$(this).is(':checked')) {
+ $('#cb_all').attr('checked',false);
+ }
+ });
+
+ $('#process').click(function(event) {
+ message = "";
+ e1 = document.forms.senators.email1.value;
+ e2 = document.forms.senators.email2.value;
+ fn = document.forms.senators.firstname.value;
+ ln = document.forms.senators.lastname.value;
+
+ if(!fn){
+ message = addError(message, "Enter your first name");
+ }
+ if(!ln) {
+ message = addError(message, "Enter your last name");
+ }
+ if(e1 == null || e2 == null || e1 != e2) {
+ message = addError(message, "Your email addresses must match!");
+ }
+ else {
+ if(!e1.match(/.*?@.*?\..*?/)) {
+ message = addError(message, "Enter a valid email address");
+ }
+ }
+
+ if(message != "") {
+ $("#error").html(message);
+ $("#error").css({'display' : 'inherit'});
+ $('html,body').animate({
+ scrollTop:$("#error").offset().top}, 500);
+ return false;
+ }
+ else {
+ return true;
+ }
+ });
+});
View
22 BBSignup/src/main/webapp/message.jsp
@@ -0,0 +1,22 @@
+<%@ page language="java" import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
+ %>
+<jsp:include page="header.jsp" />
+<div id="main">
+<center>
+
+<%
+ String message = (String)session.getAttribute("message");
+ if(message != null) {
+ out.write(message);
+ session.setAttribute("message", null);
+ }
+ else {
+ response.sendRedirect("index.jsp");
+ }
+
+
+%>
+
+</center>
+</div>
+<%@ include file="footer.jsp"%>
View
22 BBSignup/WebContent/notice.jsp → BBSignup/src/main/webapp/notice.jsp
@@ -1,16 +1,7 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
- import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
+<%@ page language="java" import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>BillBuzz! Notice</title>
-</head>
-<body>
+<jsp:include page="header.jsp" />
+<div id="main">
<center>
<%
@@ -79,14 +70,13 @@
%>
- <jsp:forward page="index.jsp" />
+ <jsp:forward page="/" />
<%
}
%>
-<%@ include file="footer.jsp" %>
</center>
-</body>
-</html>
+</div>
+<%@ include file="footer.jsp"%>
View
41 BBSignup/WebContent/unsubscribe.jsp → BBSignup/src/main/webapp/unsubscribe.jsp
@@ -1,18 +1,9 @@
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
+<%@ page language="java"
import="java.util.*,bbsignup.src.*,bbsignup.model.*,javax.jdo.*"
%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>BillBuzz! Unsubscribe</title>
-</head>
-<body>
+<jsp:include page="header.jsp" />
+<div id="main">
<center>
-<br/>
<%
String uemail = (String)request.getParameter("uemail");
@@ -50,25 +41,20 @@
<form name="unsub" method="post" action="">
<table>
<tr>
- <td colspan=2>
- NOTE: This will remove your BillBuzz subscription. After you submit your<br/>
- email address you will receive an email confirming this with a clickable link.
+ <td colspan = 2 align=center>
+ Please enter your email address:
</td>
</tr>
<tr>
- <td>
- Email
- </td>
- <td>
+ <td colspan = 2 align=center>
<input type="text" name="uemail"></input>
+ <input type="submit" name="unsubscribe" value="Unsubscribe"></input>
</td>
</tr>
<tr>
- <td>
-
- </td>
- <td>
- <input type="submit" name="unsubscribe" value="Unsubscribe"></input>
+ <td colspan=2>
+ NOTE: This will remove your BillBuzz subscription. You will receive an email<br/>
+ email address you will receive an email confirming this with a clickable link.
</td>
</tr>
</table>
@@ -77,7 +63,6 @@
<%
}
%>
-<%@ include file="footer.jsp"<