Permalink
Browse files

Merge pull request #131 from bashtech/installationpage

Created installation page
  • Loading branch information...
2 parents 14c9775 + 3b90ace commit 21c1a695dd37af28e238edba905893ed2ad7a0d5 @mattbasta committed Apr 17, 2012
@@ -807,5 +807,16 @@ public bool canSkipAdminPhase()
//query to see if any nominations are unaccepted
return Convert.ToInt32((ds.Tables[0].Rows.Count)) > 0;
}
+
+ public void createSchema()
+ {
+ String rawShema = File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/sql/officer-schema.sql"));
+
+ openConnection();
+ cmd.Connection = connection;
+ cmd.CommandText = rawShema;
+ cmd.ExecuteNonQuery();
+ closeConnection();
+ }
}
@@ -10,7 +10,6 @@
using NHibernate.Tool.hbm2ddl;
using NHibernate;
using NHibernate.Cfg;
-using System.Diagnostics;
/// <summary>
/// Handles email notifications added during Spring 2012 for officer and committee elections
@@ -0,0 +1,211 @@
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+# Dump of table election
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `election`;
+
+CREATE TABLE `election` (
+ `idelection` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(45) NOT NULL,
+ `latest_phase` varchar(45) DEFAULT NULL,
+ PRIMARY KEY (`idelection`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table election_position
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `election_position`;
+
+CREATE TABLE `election_position` (
+ `idelection_position` int(11) NOT NULL AUTO_INCREMENT,
+ `idelection` int(11) NOT NULL DEFAULT '1',
+ `position` varchar(45) NOT NULL,
+ `tally_type` varchar(9) NOT NULL DEFAULT 'classic',
+ `idum_current` int(11) DEFAULT NULL,
+ `description` varchar(5000) DEFAULT NULL,
+ `slots_plurality` int(11) DEFAULT NULL,
+ `votes_allowed` int(11) DEFAULT NULL,
+ PRIMARY KEY (`idelection_position`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table email_verification
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `email_verification`;
+
+CREATE TABLE `email_verification` (
+ `idemail_verification` int(11) NOT NULL AUTO_INCREMENT,
+ `iduser` int(11) NOT NULL,
+ `code_verified` varchar(64) DEFAULT NULL,
+ `code_rejected` varchar(64) DEFAULT NULL,
+ `datetime_sent` varchar(45) DEFAULT NULL,
+ PRIMARY KEY (`idemail_verification`),
+ UNIQUE KEY `code_verified_UNIQUE` (`code_verified`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table flag_nec
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `flag_nec`;
+
+CREATE TABLE `flag_nec` (
+ `idflag_nec` int(11) NOT NULL AUTO_INCREMENT,
+ `idelection` int(11) NOT NULL DEFAULT '1',
+ `approve` tinyint(1) NOT NULL,
+ `slate` int(11) DEFAULT NULL,
+ PRIMARY KEY (`idflag_nec`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table flag_voted
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `flag_voted`;
+
+CREATE TABLE `flag_voted` (
+ `idflag_voted` int(11) NOT NULL AUTO_INCREMENT,
+ `idunion_members` int(11) NOT NULL,
+ `code_confirm` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`idflag_voted`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table nomination_accept
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `nomination_accept`;
+
+CREATE TABLE `nomination_accept` (
+ `idnominate_accept` int(11) NOT NULL AUTO_INCREMENT,
+ `idunion_to` int(11) NOT NULL,
+ `idunion_from` int(11) NOT NULL,
+ `position` varchar(45) NOT NULL,
+ `accepted` tinyint(1) DEFAULT NULL,
+ `from_petition` tinyint(1) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`idnominate_accept`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table petition
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `petition`;
+
+CREATE TABLE `petition` (
+ `idpetition` int(11) NOT NULL AUTO_INCREMENT,
+ `idunion_members` int(11) NOT NULL,
+ `positions` varchar(20) NOT NULL,
+ `idum_signedby` int(11) NOT NULL,
+ PRIMARY KEY (`idpetition`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table results
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `results`;
+
+CREATE TABLE `results` (
+ `position` varchar(20) NOT NULL,
+ `id_union` int(11) NOT NULL,
+ `percent` double DEFAULT NULL,
+ `tally` int(11) DEFAULT NULL,
+ PRIMARY KEY (`position`,`id_union`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table roles
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `roles`;
+
+CREATE TABLE `roles` (
+ `roles` varchar(20) NOT NULL,
+ PRIMARY KEY (`roles`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+LOCK TABLES `roles` WRITE;
+/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
+
+INSERT INTO `roles` (`roles`)
+VALUES
+ ('admin'),
+ ('faculty'),
+ ('nec');
+
+/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
+UNLOCK TABLES;
+
+# Dump of table tally
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `tally`;
+
+CREATE TABLE `tally` (
+ `id_union` int(11) NOT NULL,
+ `position` varchar(20) NOT NULL,
+ `count` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id_union`,`position`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table timeline
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `timeline`;
+
+CREATE TABLE `timeline` (
+ `idtimeline` int(11) NOT NULL AUTO_INCREMENT,
+ `idelection` int(11) NOT NULL DEFAULT '1',
+ `name_phase` varchar(45) NOT NULL,
+ `datetime_end` datetime NOT NULL,
+ `iscurrent` tinyint(1) NOT NULL,
+ PRIMARY KEY (`idtimeline`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+# Dump of table wts
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `wts`;
+
+CREATE TABLE `wts` (
+ `wts_id` int(11) NOT NULL AUTO_INCREMENT,
+ `idunion_members` int(11) DEFAULT NULL,
+ `position` varchar(20) DEFAULT NULL,
+ `date_applied` datetime DEFAULT NULL,
+ `statement` text,
+ `eligible` int(11) DEFAULT NULL,
+ PRIMARY KEY (`wts_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+
+
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
View
@@ -6,26 +6,16 @@
<configuration>
<appSettings file="settings.config"></appSettings>
- <connectionStrings>
- <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
- </connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms loginUrl="login.aspx" defaultUrl="home.aspx" timeout="20"/>
</authentication>
- <machineKey validationKey="B3DDF321A6DF0A073FCD607ACBB942F65C76C962ADEF3DF803F1135606A4694F4GB1005KP61336580692B57A2600BA2629D1C1767C639C8E7FB4DCD7771F3ERR" decryptionKey="838C019400C3501341B988BAB2C6CACE076FCB104F857515D4B77D82GF34DBAE" validation="SHA1" decryption="AES"/>
<membership defaultProvider="iVoteLoginProvider" userIsOnlineTimeWindow="30">
<providers>
<add name="iVoteLoginProvider" type="iVoteLoginProvider" applicationName="iVoteSystem" enablePasswordRetrieveal="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed"/>
</providers>
</membership>
- <profile>
- <providers>
- <clear/>
- <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
- </providers>
- </profile>
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<clear/>
@@ -0,0 +1,102 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="install_Default" %>
+
+<!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">
+<head runat="server">
+ <title>iVote System Installation</title>
+
+ <style type="text/css">
+ .good
+ {
+ color: Green;
+ }
+
+ .bad
+ {
+ color: Red;
+ }
+
+ .neutral
+ {
+ color: Orange;
+ }
+ .style1
+ {
+ font-size: x-large;
+ }
+ .style2
+ {
+ font-size: large;
+ }
+ </style>
+
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+
+ <strong>
+
+ <span class="style1">iVote System Installation<br /></span>
+ <br />
+ <span class="style2">Delete or protect the <em>install</em> folder after you have setup the system!</span></strong><br />
+ <br />
+ <strong>Settings.config check: </strong><br />
+ baseUrl: <asp:Label ID="baseUrlStatus" runat="server"></asp:Label><br />
+ <br />
+ mysqlHost: <asp:Label ID="mysqlHostStatus" runat="server"></asp:Label><br />
+ mysqlUser: <asp:Label ID="mysqlUserStatus" runat="server"></asp:Label><br />
+ mysqlPassword: <asp:Label ID="mysqlPasswordStatus" runat="server"></asp:Label><br />
+ mysqlDB: <asp:Label ID="mysqlDBStatus" runat="server"></asp:Label><br />
+ <br />
+ fromAddress: <asp:Label ID="fromAddressStatus" runat="server"></asp:Label><br />
+ smtpHost: <asp:Label ID="smtpHostStatus" runat="server"></asp:Label><br />
+ smtpPort: <asp:Label ID="smtpPortStatus" runat="server"></asp:Label><br />
+ smtpUser: <asp:Label ID="smtpUserStatus" runat="server"></asp:Label><br />
+ smtpPassword: <asp:Label ID="smtpPasswordStatus" runat="server"></asp:Label><br />
+ smtpEnableSSL: <asp:Label ID="smtpEnableSSLStatus" runat="server"></asp:Label>
+ <br />
+ <br />
+ <asp:Button ID="checkSettings" runat="server" onclick="checkSettings_Click"
+ Text="Recheck Settings" />
+ <br />
+ <hr />
+ <br />
+ <strong>Database:</strong><br />
+ This option will generate the initial database schema. This will completely
+ clear and reset the database.<br /><br />
+ <asp:Button ID="createScheme" runat="server" onclick="createScheme_Click"
+ Text="Create Schema" />
+ <asp:Label ID="createSchemaStatus" runat="server" Text="Done" CssClass="good" Visible="False"></asp:Label>
+ <br />
+ <hr />
+ <br />
+ <strong>Admin User:</strong><br />
+ This option will generate an initial user in the system with the ADMIN role.
+ After it is create, you should login and create additional user accounts and
+ delete this one.<br /><br />
+ Email Address:
+ <asp:TextBox ID="email" runat="server"></asp:TextBox>
+ <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
+ ControlToValidate="email" CssClass="bad"
+ ErrorMessage="Email address is required"></asp:RequiredFieldValidator>
+ <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
+ ControlToValidate="email" CssClass="bad" ErrorMessage="Invalid email address"
+ ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
+ <br />
+ Password:
+ <asp:TextBox ID="password" runat="server"></asp:TextBox>
+ <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
+ ControlToValidate="password" CssClass="bad" ErrorMessage="Password is required"></asp:RequiredFieldValidator>
+ <br />
+ <br />
+ <asp:Button ID="createUser" runat="server" onclick="createUser_Click"
+ Text="Create User" />
+ <asp:Label ID="createUserStatus" runat="server"
+ Text="Initial admin user created. You may now use the system." CssClass="good"
+ Visible="False"></asp:Label>
+ </div>
+ </form>
+</body>
+</html>
Oops, something went wrong.

0 comments on commit 21c1a69

Please sign in to comment.