Skip to content

Commit

Permalink
Added psgi server and template improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kthakore committed Feb 19, 2011
1 parent 00a37d6 commit 4430dd4
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 38 deletions.
1 change: 1 addition & 0 deletions implementation/SIMS/SIMS/root/header.tt
Expand Up @@ -81,5 +81,6 @@
<span style="float: right" />
[% PROCESS navigation.tt %]
</span>
<div id="header-bottom" > </div>
</div>

87 changes: 49 additions & 38 deletions implementation/SIMS/SIMS/root/login.tt
@@ -1,44 +1,55 @@
[% PROCESS header.tt %]
<div id="content">
<div id="dashboard" class="dashboard>

<!-- Login form -->
<form method="post" action="[% c.uri_for('/login') %]">
[%IF c.flash.error_msg %]
<p> Error: [%c.flash.error_msg%] </p>
[%END %]
<table>
<tr>
<td>Username:</td>
<td><input type="text" name="username" size="40" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" size="40" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" /></td>
</tr>
</table>
</form>
<div id="dashboard-header" > </div>
<div id="dashboard-content">

<p>
[%
# This code illustrates how certain parts of the TT
# template will only be shown to users who have logged in
%]
[% IF c.user_exists %]
[% c.response.redirect(c.uri_for('/')); %]
[% ELSE %]
You need to log in to use this application.
[% END %]
[%#
Note that this whole block is a comment because the "#" appears
immediate after the "[%" (with no spaces in between). Although it
can be a handy way to temporarily "comment out" a whole block of
TT code, it's probably a little too subtle for use in "normal"
comments.
%]
</p>
<div id="gadget-0-renderbox" class="gadget" style="left: 5px; top: 5px; width: 99%;">
<div class="shadow"><div class="tl"></div><div class="tr"></div><div class="l"></div><div class="r"></div><div class="bl"></div><div class="br"></div><div class="b"></div></div>
<div class="dashboard-item-header">
<div class="dashboard-item-content">
<h3 class="dashboard-item-title" id="gadget-0-title" style="background-color:ddddff">Login</h3>
<!-- Login form -->
<form method="post" action="[% c.uri_for('/login') %]">
[%IF c.flash.error_msg %]
<p> Error: [%c.flash.error_msg%] </p>
[%END %]
<table>
<tr>
<td>Username:</td>
<td><input type="text" name="username" size="40" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" size="40" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" /></td>
</tr>
</table>
</form>

<p>
[%
# This code illustrates how certain parts of the TT
# template will only be shown to users who have logged in
%]
[% IF c.user_exists %]
[% c.response.redirect(c.uri_for('/')); %]
[% ELSE %]
You need to log in to use this application.
[% END %]
[%#
Note that this whole block is a comment because the "#" appears
immediate after the "[%" (with no spaces in between). Although it
can be a handy way to temporarily "comment out" a whole block of
TT code, it's probably a little too subtle for use in "normal"
comments.
%]
</p>
</div>
</div>
</div>
</div>
</div>
[% PROCESS footer.tt %]
8 changes: 8 additions & 0 deletions implementation/SIMS/SIMS/script/sims.psgi
@@ -0,0 +1,8 @@
#!/usr/bin/env perl
use strict;
use warnings;
use SIMS;

SIMS->setup_engine('PSGI');
my $app = sub { SIMS->run(@_) };

Binary file modified implementation/SIMS/SIMS/sims.db
Binary file not shown.

0 comments on commit 4430dd4

Please sign in to comment.