Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: SamJette/SamSite
base: 3954f2727c
...
head fork: SamJette/SamSite
compare: d468043603
  • 2 commits
  • 14 files changed
  • 0 commit comments
  • 1 contributor
View
6 .gitignore
@@ -33,4 +33,8 @@ doc/
*.swp
*~
.project
-.DS_Store
+.DS_Store
+
+# Windows IIS files
+IsapiRewrite4.ini
+web.config
View
8 IsapiRewrite4.ini
@@ -1,8 +0,0 @@
-# this file can be deleted if you're not planning on using URL rewriting with IIS 6.
-
-# you can add your own files and folders that should be excluded from URL rewriting by adding them to the first "RewriteRule" line below.
-
-# please read the online documentation on http://cfwheels.org for more information about URL rewriting.
-
-
-# UNCOMMENT ALL LINES BELOW THIS ONE TO TURN ON THE URL REWRITING RULES
View
2  config/routes.cfm
@@ -7,7 +7,7 @@ your application and edit the default one.
<cfscript>
drawRoutes()
- .root(controller="main", action="home")
+ .root(controller="main", action="login")
.namespace("admin")
.resources(name="answers", nested="true")
.end()
View
5 controllers/Admin.cfc
@@ -1,11 +1,12 @@
component extends="Controller" output="false" {
public void function init(){
- filters(through="checkLogin", except="login,register,signin,activate");
+ filters(through="checkAdminLogin", except="login,register,signin,activate");
usesLayout("../layout");
}
// checkLogin
- public void function checkLogin(){
+ public void function checkAdminLogin(){
+ writedump(session);
if(!structKeyExists(session, "user")){
redirectTo(controller="admin.dashboard", action="login");
}
View
26 controllers/Controller.cfc
@@ -1,20 +1,12 @@
component extends="Wheels" output="false" {
+ public void function init(){
+ filters(through="checkLogin", except="admin,login,register,signin,activate");
+ }
- // public void function init(){
- // super.init();
- // //filters(through="checkLogin", except="login,register,signin,activate");
- // }
-
- // // checkLogin
- // public void function checkLogin(){
- // if(!structKeyExists(session, "user")){
- // redirectTo(controller="dashboard", action="login");
- // }
- // }
-
- // public void function redirectStudent (){
- // if (session.user.roleid GT 2){
- // redirectTo(controller = "main", action = "home");
- // }
- // }
+ // checkLogin
+ public void function checkLogin(){
+ if(!structKeyExists(session, "stuser")){
+ redirectTo(controller="main", action="login");
+ }
+ }
}
View
14 controllers/JsonTest.cfc
@@ -0,0 +1,14 @@
+component extends="Controller" output="false" {
+ public void function init(){
+ //super.init();
+ provides("html,xml,json,csv");
+ }
+ public void function export(){
+ output = model("students").findAll();
+ if(params.format == 'json'){
+ renderWith(data=output);
+ }
+
+ }
+
+ }
View
38 controllers/Main.cfc
@@ -1,9 +1,43 @@
component extends="Controller" output="false" {
public void function init(){
+ //super.init();
}
- public void function home(){
+ public void function home(){
output="Studenten pagina";
}
- }
+ public void function login(){
+ //initialize model
+ stuser = model("student").new();
+
+ }
+ public void function logout(){
+ if(structKeyExists(session, "stuser")){
+ StructDelete(session, "stuser");
+ }
+ redirectTo(controller="main", action="login");
+ }
+ public void function signin(){
+
+ if (len(params.stuser.password) eq 0){
+ params.stuser.password = "0";
+ }
+ //find a modelobject
+ stuser = model("student").findOne(where="email='#params.stuser.email#' AND password='#params.stuser.password#'");
+
+ if (IsObject(stuser)){
+ renderPage(action="login");
+ session.stuser.id = stuser.id;
+ session.stuser.name = stuser.name;
+ session.stuser.roleid = 3;
+ redirectTo(controller="main", action="home");
+
+ }else{
+ stuser = model("student").new(email=params.stuser.email);
+ flashInsert(error="The email and password you entered are not valid.");
+ renderPage(action="login");
+ }
+
+ }
+}
View
2  views/admin/dashboard/login.cfm
@@ -1,5 +1,5 @@
<cfoutput>
- <h1>Login</h1>
+ <h1>Admin Login</h1>
#includePartial("../showFlash")#
#startFormTag(route="adminDashboardSignin")#
#includePartial("form")#
View
70 views/admin/layout.cfm
@@ -1,7 +1,6 @@
<cfif CGI.SERVER_NAME NEQ "samsite.local">
<cfsetting showDebugOutput = "no" />
</cfif>
-<cfparam name="session.user.roleid" default = 3 >
<!--- Place HTML here that should be used as the default layout of your application --->
<!DOCTYPE html>
<html lang="en">
@@ -53,11 +52,9 @@
<a class="brand" href="#">Sam</a>
<div class="btn-group pull-right">
<cfoutput>
- <cfif structKeyExists(session.user,"name")>
- <cfif session.user.roleid LTE 3>
+ <cfif structKeyExists(session, "user")>
<a class="btn dropdown-toggle" data-toggle="dropdown" href="##">
<i class="icon-user"></i>
- #session.user.name#
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
@@ -65,29 +62,17 @@
<li class="divider"></li>
<li>#linkTo(text="Sign Out", controller="admin.dashboard", action="logout")#</li>
</ul>
- </cfif>
- </cfif>
- </cfoutput>
+ </cfif>
+ </cfoutput>
</div>
<cfoutput>
- <cfif session.user.roleid EQ 1>
+ <cfif structKeyExists(session, "user")>
<div class="nav-collapse">
-
<ul class="nav">
- <li class="active">#linkTo(text="<span>Database</span>", controller="admin.dashboard", action="")#</li>
- <!---<li>#linkTo(text="<span>Students</span>", controller="admin.students", action="")#</li>
- <li>#linkTo(text="<span>Classes</span>", controller="admin.classes", action="")#</li>
- <li>#linkTo(text="<span>Classes_Students</span>", controller="admin.Classes_students", action="")#</li>
- <li>#linkTo(text="<span>Roles</span>", controller="admin.roles", action="")#</li>
- <li>#linkTo(text="<span>Schoolyears</span>", controller="admin.schoolyears", action="")#</li>
- <li>#linkTo(text="<span>Questions</span>", controller="admin.questions", action="")#</li>
- <li>#linkTo(text="<span>Answers</span>", controller="admin.answers", action="")#</li>
- <li>#linkTo(text="<span>Open Questions Results</span>", controller="admin.openquestionsresults", action="")#</li>
- <li>#linkTo(text="<span>Results</span>", controller="admin.results", action="")#</li>--->
- </ul>
-
+ <li class="active">#linkTo(text="<span>Database</span>", controller="admin.dashboard", action="")#</li>
+ </ul>
</div>
- </cfif>
+ </cfif>
</cfoutput><!--/.nav-collapse -->
</div>
</div>
@@ -96,7 +81,7 @@
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
- <cfif session.user.roleid EQ 1>
+ <cfif structKeyExists(session, "user")>
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Database Tables</li>
@@ -116,49 +101,12 @@
</cfoutput>
</ul>
</div>
- </cfif>
+ </cfif>
<!--/.well -->
</div><!--/span-->
<div class="span9">
- <!---<div class="hero-unit">
- <h1>Hello, world!</h1>
- <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
- <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>
- </div>--->
<div class="row-fluid">
<cfoutput> #contentForLayout()#</cfoutput>
- <!--- <div class="span4">
- <h2>Heading</h2>
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
- <p><a class="btn" href="#">View details &raquo;</a></p>
- </div><!--/span-->
- <div class="span4">
- <h2>Heading</h2>
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
- <p><a class="btn" href="#">View details &raquo;</a></p>
- </div><!--/span-->
- <div class="span4">
- <h2>Heading</h2>
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
- <p><a class="btn" href="#">View details &raquo;</a></p>
- </div><!--/span-->
- </div><!--/row-->
- <div class="row-fluid">
- <div class="span4">
- <h2>Heading</h2>
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
- <p><a class="btn" href="#">View details &raquo;</a></p>
- </div><!--/span-->
- <div class="span4">
- <h2>Heading</h2>
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
- <p><a class="btn" href="#">View details &raquo;</a></p>
- </div><!--/span-->
- <div class="span4">
- <h2>Heading</h2>
- <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
- <p><a class="btn" href="#">View details &raquo;</a></p>
- </div> ---><!--/span-->
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
View
72 views/layout.cfm
@@ -1,7 +1,6 @@
<cfif CGI.SERVER_NAME NEQ "samsite.local">
- <cfsetting showDebugOutput = "no" />
+ <cfsetting showDebugOutput = "no" />
</cfif>
-<cfparam name="session.user.roleid" default = 3 >
<!--- Place HTML here that should be used as the default layout of your application --->
<!DOCTYPE html>
<html lang="en">
@@ -30,7 +29,7 @@
}
</style>
- <cfoutput>#stylesheetLinkTag("bootstrap-responsive.min")#</cfoutput>
+ <cfoutput>#stylesheetLinkTag("bootstrap-responsive.min")#</cfoutput>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@@ -52,51 +51,40 @@
</a>
<a class="brand" href="#">Sam</a>
<div class="btn-group pull-right">
- <cfoutput>
- <cfif structKeyExists(session.user,"name")>
- <cfif session.user.roleid LTE 3>
- <a class="btn dropdown-toggle" data-toggle="dropdown" href="##">
- <i class="icon-user"></i>
- #session.user.name#
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu">
- <li><a href="##">Profile</a></li>
- <li class="divider"></li>
- <li>#linkTo(text="Sign Out", controller="dashboard", action="logout")#</li>
- </ul>
- </cfif>
- </cfif>
- </cfoutput>
+ <cfoutput>
+ <cfif structKeyExists(session,"stuser") >
+ <a class="btn dropdown-toggle" data-toggle="dropdown" href="##">
+ <i class="icon-user"></i>
+ #session.stuser.name#
+ <span class="caret"></span>
+ </a>
+ <ul class="dropdown-menu">
+ <li><a href="##">Profile</a></li>
+ <li class="divider"></li>
+ <li>#linkTo(text="Sign Out", controller="main", action="logout")#</li>
+ </ul>
+ </cfif>
+ </cfoutput>
</div>
- <!---<cfoutput>
- <cfif session.user.roleid EQ 1>
+ <cfoutput>
+ <cfif !structKeyExists(session, "user")>
<div class="nav-collapse">
-
<ul class="nav">
- <li class="active">#linkTo(text="<span>Database</span>", controller="dashboard", action="")#</li>
- <!---<li>#linkTo(text="<span>Students</span>", controller="students", action="")#</li>
- <li>#linkTo(text="<span>Classes</span>", controller="classes", action="")#</li>
- <li>#linkTo(text="<span>Classes_Students</span>", controller="Classes_students", action="")#</li>
- <li>#linkTo(text="<span>Roles</span>", controller="roles", action="")#</li>
- <li>#linkTo(text="<span>Schoolyears</span>", controller="schoolyears", action="")#</li>
- <li>#linkTo(text="<span>Questions</span>", controller="questions", action="")#</li>
- <li>#linkTo(text="<span>Answers</span>", controller="answers", action="")#</li>
- <li>#linkTo(text="<span>Open Questions Results</span>", controller="openquestionsresults", action="")#</li>
- <li>#linkTo(text="<span>Results</span>", controller="results", action="")#</li>--->
- </ul>
-
+ <li class="active">#linkTo(text="<span>Admin Section</span>", controller="admin.dashboard", action="login")#</li>
+ </ul>
</div>
- </cfif>
- </cfoutput>---><!--/.nav-collapse -->
+ </cfif>
+ </cfoutput><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container-fluid">
- <div class="row-fluid">
- <cfoutput> #contentForLayout()#</cfoutput>
- </div><!--/row-->
+ <div class="row">
+ <div class="span9 offset3">
+ <div class="row-fluid">
+ <cfoutput> #contentForLayout()#</cfoutput>
+ </div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<div class="bottombar">
@@ -111,9 +99,9 @@
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
- <cfoutput>
- #javaScriptIncludeTag("jquery-1.7.2.min")#
- #javaScriptIncludeTag("bootstrap.min")#
+ <cfoutput>
+ #javaScriptIncludeTag("jquery-1.7.2.min")#
+ #javaScriptIncludeTag("bootstrap.min")#
</cfoutput>
</body>
</html>
View
5 views/main/_form.cfm
@@ -0,0 +1,5 @@
+<cfoutput>
+ #textField(label="Email", objectName="stuser", property="email")#
+ #passwordField(label="Password", objectName="stuser", property="password")#
+ #submitTag(class='btn', value='Log In')#
+</cfoutput>
View
13 views/main/_showFlash.cfm
@@ -0,0 +1,13 @@
+<cfoutput>
+ <cfif flashKeyExists("success")>
+ <div class="success">
+ #flash("success")#
+ </div>
+ </cfif>
+ <cfif flashKeyExists("error")>
+ <div class="error">
+ #flash("error")#
+ </div>
+ </cfif>
+</cfoutput>
+
View
7 views/main/login.cfm
@@ -0,0 +1,7 @@
+<cfoutput>
+ <h1>Login</h1>
+ #includePartial("showFlash")#
+ #startFormTag(controller="main", action="Signin")#
+ #includePartial("form")#
+ #endFormTag()#
+</cfoutput>
View
27 web.config
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- You need the Rewrite Module for IIS 7 (http://www.iis.net/download/URLRewrite) installed before enabling URL rewriting.
- Uncomment the "rewrite" section below and restart IIS/CF to enable URL rewriting.
- You can add your own files and folders that should be excluded from URL rewriting by adding them to the "pattern".
- This file can be deleted if you're not planning on using URL rewriting with IIS 7.
- Please read the online documentation on http://cfwheels.org for more information.
--->
-
-<configuration>
- <system.webServer>
- <!--
- <rewrite>
- <rules>
- <rule name="ColdFusion on Wheels URL Rewriting" enabled="true">
- <match url="^(.*)$" ignoreCase="true" />
- <conditions logicalGrouping="MatchAll">
- <add input="{SCRIPT_NAME}" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|CFFileServlet|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$)" />
- </conditions>
- <action type="Rewrite" url="/rewrite.cfm/{R:1}" />
- </rule>
- </rules>
- </rewrite>
- -->
- </system.webServer>
-</configuration>

No commit comments for this range

Something went wrong with that request. Please try again.