[open-ils-commits] r22 - in servres/trunk/conifer: . locale/en_US/LC_MESSAGES static syrup templates templates/auth
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Nov 18 15:58:34 EST 2008
Author: gfawcett
Date: 2008-11-18 15:58:30 -0500 (Tue, 18 Nov 2008)
New Revision: 22
Added:
servres/trunk/conifer/templates/auth/
servres/trunk/conifer/templates/auth/login.xhtml
servres/trunk/conifer/templates/course_detail.xhtml
servres/trunk/conifer/templates/my_courses.xhtml
Removed:
servres/trunk/conifer/local_settings.py.in
servres/trunk/conifer/templates/course.xhtml
servres/trunk/conifer/templates/index.xhtml
servres/trunk/conifer/templates/login.xhtml
Modified:
servres/trunk/conifer/
servres/trunk/conifer/locale/en_US/LC_MESSAGES/
servres/trunk/conifer/settings.py
servres/trunk/conifer/static/main.css
servres/trunk/conifer/syrup/
servres/trunk/conifer/syrup/admin.py
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/syrup/urls.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/master.xhtml
servres/trunk/conifer/templates/tabbar.xhtml
Log:
template re-org; removed need for local_settings.py; added News to model.
Property changes on: servres/trunk/conifer
___________________________________________________________________
Name: svn:ignore
+ *.pyc
*~
local_settings.py
*.sqlite
Deleted: servres/trunk/conifer/local_settings.py.in
===================================================================
--- servres/trunk/conifer/local_settings.py.in 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/local_settings.py.in 2008-11-18 20:58:30 UTC (rev 22)
@@ -1,2 +0,0 @@
-# set X_BASE_DIRECTORY to the the name of the directory this file is in!
-X_BASE_DIRECTORY = '/home/graham/projects/evergreen/conifer/'
Property changes on: servres/trunk/conifer/locale/en_US/LC_MESSAGES
___________________________________________________________________
Name: svn:ignore
+ *.mo
Modified: servres/trunk/conifer/settings.py
===================================================================
--- servres/trunk/conifer/settings.py 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/settings.py 2008-11-18 20:58:30 UTC (rev 22)
@@ -3,8 +3,11 @@
# make sure you have a local_settings.py file! Copy from
# local_settings.py.in and customize that file.
-from local_settings import X_BASE_DIRECTORY
+import os
+BASE_DIRECTORY = os.path.abspath(os.getcwd())
+HERE = lambda s: os.path.join(BASE_DIRECTORY, s)
+
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -15,7 +18,7 @@
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = X_BASE_DIRECTORY +'syrup.sqlite' # Or path to database file if using sqlite3.
+DATABASE_NAME = HERE('syrup.sqlite') # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
@@ -40,7 +43,7 @@
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = X_BASE_DIRECTORY + 'static'
+MEDIA_ROOT = HERE('static')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/static/main.css 2008-11-18 20:58:30 UTC (rev 22)
@@ -42,7 +42,7 @@
/* actions (e.g. "edit user" link) */
.action a { font-weight: bold; }
-#tabbar { margin: 18 0; padding: 0; }
+#tabbar { margin: 18 0; padding: 0; width: 700; }
#tabbar li { display: inline; }
#tabbar li a { padding: 18 18 4 18; background-color: #ddf; color: black; text-decoration: none; }
#tabbar li a:hover { background-color: #fc8; }
Property changes on: servres/trunk/conifer/syrup
___________________________________________________________________
Name: svn:ignore
+ *.pyc
*~
Modified: servres/trunk/conifer/syrup/admin.py
===================================================================
--- servres/trunk/conifer/syrup/admin.py 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/syrup/admin.py 2008-11-18 20:58:30 UTC (rev 22)
@@ -22,5 +22,5 @@
# value.__unicode__ = unicode_fn(firstcharfield)
# admin.site.register(value)
-for m in [Member, Course, Term, UserProfile]:
+for m in [Member, Course, Term, UserProfile, News]:
admin.site.register(m)
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/syrup/models.py 2008-11-18 20:58:30 UTC (rev 22)
@@ -1,5 +1,6 @@
from django.db import models as m
from django.contrib.auth.models import User
+from datetime import datetime
#----------------------------------------------------------------------
# USERS
@@ -70,3 +71,15 @@
def __unicode__(self):
return '%s--%s--%s' % (self.user, self.role, self.course)
+
+#------------------------------------------------------------
+
+class News(m.Model):
+ subject = m.CharField(max_length=200)
+ body = m.TextField()
+ published = m.DateTimeField(default=datetime.now, blank=True, null=True)
+ encoding = m.CharField(max_length=10,
+ choices = (('plain', 'plain'),
+ ('html', 'html'),
+ ('markdown', 'markdown')),
+ default = 'html')
Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/syrup/urls.py 2008-11-18 20:58:30 UTC (rev 22)
@@ -1,6 +1,7 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('conifer.syrup.views',
- (r'^$', 'index'),
- (r'^course/(?P<course_id>\d+)/$', 'course_index'),
+ (r'^$', 'welcome'),
+ (r'^course/$', 'my_courses'),
+ (r'^course/(?P<course_id>\d+)/$', 'course_detail'),
)
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/syrup/views.py 2008-11-18 20:58:30 UTC (rev 22)
@@ -5,19 +5,12 @@
import conifer.genshi_support as g
from conifer.syrup import models
- at login_required
-def index(request):
- return g.render('index.xhtml')
+#------------------------------------------------------------
- at login_required
-def course_index(request, course_id):
- course = get_object_or_404(models.Course, pk=course_id)
- return g.render('course.xhtml', course=course)
-
def auth_handler(request, path):
if path == 'login/':
if request.method == 'GET':
- return g.render('login.xhtml')
+ return g.render('auth/login.xhtml')
else:
userid, password = request.POST['userid'], request.POST['password']
user = authenticate(username=userid, password=password)
@@ -33,3 +26,18 @@
return HttpResponse('Logged out. Thanks for coming!')
else:
return HttpResponse('auth_handler: ' + path)
+
+#------------------------------------------------------------
+
+def welcome(request):
+ return g.render('welcome.xhtml')
+
+
+ at login_required
+def my_courses(request):
+ return g.render('my_courses.xhtml')
+
+ at login_required
+def course_detail(request, course_id):
+ course = get_object_or_404(models.Course, pk=course_id)
+ return g.render('course_detail.xhtml', course=course)
Copied: servres/trunk/conifer/templates/auth/login.xhtml (from rev 18, servres/trunk/conifer/templates/login.xhtml)
===================================================================
--- servres/trunk/conifer/templates/auth/login.xhtml (rev 0)
+++ servres/trunk/conifer/templates/auth/login.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -0,0 +1,31 @@
+<?python
+title = 'Syrup E-Reserves: Please log in'
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="../master.xhtml"/>
+<head>
+ <title>${title}</title>
+ <script>
+ $(function() {$('#userid').focus();});
+ </script>
+</head>
+<body>
+ <h1>Please log in.</h1>
+ <form action="." method="post">
+ <input type="hidden" name="next" value="${request.GET['next']}"/>
+ <table>
+ <tr>
+ <th>User ID:</th>
+ <td><input type="text" name="userid" id="userid"/></td>
+ </tr>
+ <tr>
+ <th>Password:</th>
+ <td><input type="password" name="password"/></td>
+ </tr>
+ </table>
+ <p><input type="submit" value="Log in"/></p>
+ </form>
+</body>
+</html>
Deleted: servres/trunk/conifer/templates/course.xhtml
===================================================================
--- servres/trunk/conifer/templates/course.xhtml 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/templates/course.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -1,14 +0,0 @@
-<?python
-title = '%s: %s (%s)' % (course.code, course.title, course.term)
-?>
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:py="http://genshi.edgewall.org/">
-<xi:include href="master.xhtml"/>
-<head>
- <title>${title}</title>
-</head>
-<body>
- <h1>${title}</h1>
-</body>
-</html>
Copied: servres/trunk/conifer/templates/course_detail.xhtml (from rev 18, servres/trunk/conifer/templates/course.xhtml)
===================================================================
--- servres/trunk/conifer/templates/course_detail.xhtml (rev 0)
+++ servres/trunk/conifer/templates/course_detail.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -0,0 +1,14 @@
+<?python
+title = '%s: %s (%s)' % (course.code, course.title, course.term)
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="master.xhtml"/>
+<head>
+ <title>${title}</title>
+</head>
+<body>
+ <h1>${title}</h1>
+</body>
+</html>
Deleted: servres/trunk/conifer/templates/index.xhtml
===================================================================
--- servres/trunk/conifer/templates/index.xhtml 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/templates/index.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -1,25 +0,0 @@
-<?python
-title = 'Welcome to Syrup E-Reserves!'
-?>
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:py="http://genshi.edgewall.org/">
-<xi:include href="master.xhtml"/>
-<head>
- <title>${title}</title>
-</head>
-<body>
- <h2>My Courses</h2>
- <?python
- if user.is_authenticated():
- my_courses = user.courses()
- else:
- my_courses = []
- ?>
- <p py:if="not my_courses">You are not part of any courses at this time.</p>
- <p py:for="course in my_courses" style="font-size: large;">
- <a href="course/${course.id}/">${course.term}: ${course.code}: ${course.title}</a>
- </p>
- <div class="gap"/>
-</body>
-</html>
Deleted: servres/trunk/conifer/templates/login.xhtml
===================================================================
--- servres/trunk/conifer/templates/login.xhtml 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/templates/login.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -1,31 +0,0 @@
-<?python
-title = 'Syrup E-Reserves: Please log in'
-?>
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:py="http://genshi.edgewall.org/">
-<xi:include href="master.xhtml"/>
-<head>
- <title>${title}</title>
- <script>
- $(function() {$('#userid').focus();});
- </script>
-</head>
-<body>
- <h1>Please log in.</h1>
- <form action="." method="post">
- <input type="hidden" name="next" value="${request.GET['next']}"/>
- <table>
- <tr>
- <th>User ID:</th>
- <td><input type="text" name="userid" id="userid"/></td>
- </tr>
- <tr>
- <th>Password:</th>
- <td><input type="password" name="password"/></td>
- </tr>
- </table>
- <p><input type="submit" value="Log in"/></p>
- </form>
-</body>
-</html>
Modified: servres/trunk/conifer/templates/master.xhtml
===================================================================
--- servres/trunk/conifer/templates/master.xhtml 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/templates/master.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -23,7 +23,7 @@
<img src="/static/institution-logo.png" style="height: 50;"/>
</div>
<div id="header" py:if="user.is_authenticated()">
- <strong style="padding-right: 18;">Welcome, ${user.first_name}!</strong>
+ <strong style="padding-right: 18;">Welcome, ${user.first_name or user.username}!</strong>
<a href="/accounts/logout">Log Out</a>
• <a href="/user/prefs">Preferences</a>
• <a href="/admin/">Admin UI</a>
Copied: servres/trunk/conifer/templates/my_courses.xhtml (from rev 18, servres/trunk/conifer/templates/index.xhtml)
===================================================================
--- servres/trunk/conifer/templates/my_courses.xhtml (rev 0)
+++ servres/trunk/conifer/templates/my_courses.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -0,0 +1,25 @@
+<?python
+title = 'Welcome to Syrup E-Reserves!'
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="master.xhtml"/>
+<head>
+ <title>${title}</title>
+</head>
+<body>
+ <h2>My Courses</h2>
+ <?python
+ if user.is_authenticated():
+ my_courses = user.courses()
+ else:
+ my_courses = []
+ ?>
+ <p py:if="not my_courses">You are not part of any courses at this time.</p>
+ <p py:for="course in my_courses" style="font-size: large;">
+ <a href="${course.id}/">${course.term}: ${course.code}: ${course.title}</a>
+ </p>
+ <div class="gap"/>
+</body>
+</html>
Modified: servres/trunk/conifer/templates/tabbar.xhtml
===================================================================
--- servres/trunk/conifer/templates/tabbar.xhtml 2008-11-18 20:29:29 UTC (rev 21)
+++ servres/trunk/conifer/templates/tabbar.xhtml 2008-11-18 20:58:30 UTC (rev 22)
@@ -3,7 +3,8 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<ul id="tabbar">
- <li class="active"><a href="/syrup">My Courses</a></li>
+ <li><a href="/syrup/">Home</a></li>
+ <li class="active"><a href="/syrup/course/">My Courses</a></li>
<li><a href="/syrup">Add a Reserve</a></li>
<li><a href="/syrup">Manage Users</a></li>
<li><a href="/syrup">Preferences</a></li>
More information about the open-ils-commits
mailing list