r935 - in /schooltool/branches/upstream/current: ./ schooltool-skel/etc/ src/schoolbell/ src/schooltool.egg-info/ src/schooltool/app/browser/ src/schooltool/app/browser/ftests/ src/schooltool/app/browser/templates/ src/schooltool/basicperson/ src/schooltool/basicperson/browser/ src/schooltool/basicperson/browser/ftests/ src/schooltool/basicperson/browser/templates/ src/schooltool/basicperson/browser/tests/ src/schooltool/basicperson/tests/ src/schooltool/calendar/ src/schooltool/course/ src/schooltool/demographics/ src/schooltool/person/ src/schooltool/person/browser/ src/schooltool/sbapp/ src/schooltool/skin/ src/schooltool/skin/resources/ src/schooltool/skin/templates/ src/schooltool/stapp2005/ src/schooltool/stapp2005/ftests/ src/schooltool/stapp2007/ src/schooltool/stapp2007/ftests/ src/schooltool/term/ src/schooltool/term/browser/ src/schooltool/term/browser/ftests/ src/schooltool/timetable/ src/schooltool/timetable/browser/ src/schooltool/timetable/browser/ftests/ src/schooltool/timetable/browser/templates/ src/schooltool/timetable/browser/tests/ src/schooltool/widget/ utilities/
jinty-guest at users.alioth.debian.org
jinty-guest at users.alioth.debian.org
Fri Jul 13 10:48:08 UTC 2007
Author: jinty-guest
Date: Fri Jul 13 10:48:08 2007
New Revision: 935
URL: http://svn.debian.org/wsvn/pkg-zope/?sc=1&rev=935
Log:
[svn-upgrade] Integrating new upstream version, schooltool (2006.999-2007-alpha1-svn-r7056)
Added:
schooltool/branches/upstream/current/src/schooltool/basicperson/
schooltool/branches/upstream/current/src/schooltool/basicperson/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/advisor.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/configure.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/basicperson.txt (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/test_all.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/overrides.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/person.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_add.pt (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_edit.pt (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_view.pt (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/test_person.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/configure.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/interfaces.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/overrides.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/person.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/sampledata.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/security.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/tests/
schooltool/branches/upstream/current/src/schooltool/basicperson/tests/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_person.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_vocabularies.py (with props)
schooltool/branches/upstream/current/src/schooltool/basicperson/vocabularies.py (with props)
schooltool/branches/upstream/current/src/schooltool/person/sampledata.py (with props)
schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-angry.png (with props)
schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-pointing.png (with props)
schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-question.png (with props)
schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-reading.png (with props)
schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-regular.png (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/
schooltool/branches/upstream/current/src/schooltool/stapp2005/README.txt (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/configure.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/
schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/stapp2005.txt (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/test_all.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/
schooltool/branches/upstream/current/src/schooltool/stapp2007/README.txt (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/configure.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/
schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/stapp2007.txt (with props)
schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/test_all.py (with props)
schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/
schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/__init__.py (with props)
schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/term.txt (with props)
schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/test_all.py (with props)
schooltool/branches/upstream/current/src/schooltool/term/browser/term_basic_add_edit.pt (with props)
schooltool/branches/upstream/current/src/schooltool/term/ftesting.py (with props)
schooltool/branches/upstream/current/src/schooltool/term/ftesting.zcml (with props)
schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-add.pt (with props)
schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-edit.pt (with props)
schooltool/branches/upstream/current/utilities/generate_vcal_dict.py (with props)
Removed:
schooltool/branches/upstream/current/schoolbell-server.py
schooltool/branches/upstream/current/schoolbell-site.zcml
schooltool/branches/upstream/current/schoolbell.conf.in
schooltool/branches/upstream/current/src/schoolbell/translations.zcml
schooltool/branches/upstream/current/src/schooltool/sbapp/
Modified:
schooltool/branches/upstream/current/Makefile
schooltool/branches/upstream/current/PKG-INFO
schooltool/branches/upstream/current/schooltool-skel/etc/site.zcml
schooltool/branches/upstream/current/setup.py
schooltool/branches/upstream/current/src/schooltool.egg-info/PKG-INFO
schooltool/branches/upstream/current/src/schooltool.egg-info/SOURCES.txt
schooltool/branches/upstream/current/src/schooltool.egg-info/requires.txt
schooltool/branches/upstream/current/src/schooltool/app/browser/app.py
schooltool/branches/upstream/current/src/schooltool/app/browser/configure.zcml
schooltool/branches/upstream/current/src/schooltool/app/browser/ftests/cal.txt
schooltool/branches/upstream/current/src/schooltool/app/browser/templates/edit_relationships.pt
schooltool/branches/upstream/current/src/schooltool/app/browser/testing.py
schooltool/branches/upstream/current/src/schooltool/calendar/generate_vcal_dict.py
schooltool/branches/upstream/current/src/schooltool/course/configure.zcml
schooltool/branches/upstream/current/src/schooltool/demographics/configure.zcml
schooltool/branches/upstream/current/src/schooltool/demographics/overrides.zcml
schooltool/branches/upstream/current/src/schooltool/demographics/sampledata.py
schooltool/branches/upstream/current/src/schooltool/person/browser/person-csvimport.pt
schooltool/branches/upstream/current/src/schooltool/person/browser/person.py
schooltool/branches/upstream/current/src/schooltool/person/browser/person_add.pt
schooltool/branches/upstream/current/src/schooltool/person/browser/person_container_delete.pt
schooltool/branches/upstream/current/src/schooltool/person/browser/person_edit.pt
schooltool/branches/upstream/current/src/schooltool/person/browser/person_preferences.pt
schooltool/branches/upstream/current/src/schooltool/person/browser/tests.py
schooltool/branches/upstream/current/src/schooltool/person/configure.zcml
schooltool/branches/upstream/current/src/schooltool/skin/configure.zcml
schooltool/branches/upstream/current/src/schooltool/skin/containers.py
schooltool/branches/upstream/current/src/schooltool/skin/resources/favicon.ico
schooltool/branches/upstream/current/src/schooltool/skin/resources/layout.css
schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.css
schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.js
schooltool/branches/upstream/current/src/schooltool/skin/templates/actionsbar.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/container.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/container_delete.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/edit_form.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/error.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/navigation.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/notfound.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_add.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_edit.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/table_container.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/unauthorized.pt
schooltool/branches/upstream/current/src/schooltool/skin/templates/view_macros.pt
schooltool/branches/upstream/current/src/schooltool/term/browser/term.py
schooltool/branches/upstream/current/src/schooltool/term/browser/tests.py
schooltool/branches/upstream/current/src/schooltool/term/configure.zcml
schooltool/branches/upstream/current/src/schooltool/term/term.py
schooltool/branches/upstream/current/src/schooltool/timetable/browser/__init__.py
schooltool/branches/upstream/current/src/schooltool/timetable/browser/configure.zcml
schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetable-events.txt
schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetabling.txt
schooltool/branches/upstream/current/src/schooltool/timetable/browser/schema.py
schooltool/branches/upstream/current/src/schooltool/timetable/browser/tests/test_schema.py
schooltool/branches/upstream/current/src/schooltool/timetable/configure.zcml
schooltool/branches/upstream/current/src/schooltool/timetable/schema.py
schooltool/branches/upstream/current/src/schooltool/widget/password.py
Modified: schooltool/branches/upstream/current/Makefile
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/Makefile?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/Makefile (original)
+++ schooltool/branches/upstream/current/Makefile Fri Jul 13 10:48:08 2007
@@ -2,10 +2,10 @@
#
# Makefile for SchoolTool
#
-# $Id: Makefile 7008 2007-07-09 14:58:27Z jinty $
+# $Id: Makefile 7039 2007-07-12 16:48:17Z jinty $
PYTHON=python2.4
-TRANSLATION_DOMAINS=schoolbell schooltool schooltool.commendation
+TRANSLATION_DOMAINS=schooltool schooltool.commendation
TESTFLAGS=-v
PYTHONPATH:=$(PYTHONPATH):src:eggs
SETUPFLAGS=
@@ -137,17 +137,17 @@
#
# Makefile rules for importing and exporting translations to rosetta:
#
-# To create a translation templates (schooltool.pot, schoolbell.pot) for
+# To create a translation templates ($DOMAIN.pot) for
# uploading to rosetta:
#
# 1. run 'make extract-translations'
-# 2. upload the src/schooltool/locales/{schoolbell,schooltool}.pot files
+# 2. upload the src/schooltool/locales/DOMAIN.pot files
# to rosetta.
#
# To create tarballs suitable for uploading to rosetta:
#
# The following command will create tarballs in the current directory of
-# the form {schooltool,schoolbell}-translations.tar.gz. These should be
+# the form DOMAIN-translations.tar.gz. These should be
# suitable for uploading to rosetta.
#
# $ make translation-tarballs
@@ -160,7 +160,7 @@
#
# 1. get a clean checkout of schooltool
# 2. download the tarballs of exportd PO files from rosetta and rename
-# them to rosetta-schooltool.tar.gz and rosetta-schoolbell.tar.gz
+# them to rosetta-DOMAIN.tar.gz
# 3. run 'make update-rosetta-translations'
# 4. use svn to add and commit any new/changed translations
#
@@ -181,8 +181,10 @@
.PHONY: translation-tarballs
translation-tarballs: extract-translations update-translations
- $(MAKE) DOMAIN=schooltool create-translation-tarball
- $(MAKE) DOMAIN=schoolbell create-translation-tarball
+ set -e; \
+ for domain in $(TRANSLATION_DOMAINS); do \
+ $(MAKE) DOMAIN=$$domain create-translation-tarball\
+ done
.PHONY: extract-rosetta-tarball
extract-rosetta-tarball:
@@ -201,8 +203,10 @@
.PHONY: update-rosetta-translations
update-rosetta-translations:
- [ ! -e rosetta-schooltool.tar.gz ] || $(MAKE) DOMAIN=schooltool extract-rosetta-tarball
- [ ! -e rosetta-schoolbell.tar.gz ] || $(MAKE) DOMAIN=schoolbell extract-rosetta-tarball
+ set -e; \
+ for domain in $(TRANSLATION_DOMAINS); do \
+ [ ! -e rosetta-$${domain}.tar.gz ] || $(MAKE) DOMAIN=$${domain} extract-rosetta-tarball\
+ done
$(MAKE) PYTHON=$(PYTHON) extract-translations update-translations
# remove .po~ and .mo files so they are not accidentally committed
find $(LOCALES) \( -name '*.po~' -o -name '*.mo' \) -exec rm -f {} \;
Modified: schooltool/branches/upstream/current/PKG-INFO
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/PKG-INFO?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/PKG-INFO (original)
+++ schooltool/branches/upstream/current/PKG-INFO Fri Jul 13 10:48:08 2007
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: schooltool
-Version: 2006.999-2007-alpha1-svn-r7010
+Version: 2006.999-2007-alpha1-svn-r7056
Summary: A common information systems platform for school administration.
Home-page: http://www.schooltool.org
Author: SchoolTool development team
Modified: schooltool/branches/upstream/current/schooltool-skel/etc/site.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/schooltool-skel/etc/site.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/schooltool-skel/etc/site.zcml (original)
+++ schooltool/branches/upstream/current/schooltool-skel/etc/site.zcml Fri Jul 13 10:48:08 2007
@@ -1,31 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
-<configure xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="schooltool">
+<configure xmlns="http://namespaces.zope.org/zope">
- <include package="schooltool.help" file="meta.zcml" />
+ <include package="schooltool.stapp2007" />
- <include package="schooltool" />
-
- <include package="schooltool.attendance" />
- <include package="schooltool.commendation" />
- <include package="schooltool.course" />
- <include package="schooltool.dashboard" />
- <include xmlns:zcml="http://namespaces.zope.org/zcml"
- zcml:condition="have devmode"
- package="schooltool.devmode" />
- <include package="schooltool.gradebook" />
- <include package="schooltool.help" />
- <include package="schooltool.level" />
- <include package="schooltool.note" />
- <include package="schooltool.requirement" />
- <include package="schooltool.term" />
- <include package="schooltool.timetable" />
-
- <include files="package-includes/*-configure.zcml" />
-
- <!-- Provide local overrides of standard configurations-->
- <includeOverrides package="schooltool.devmode" file="overrides.zcml" />
- <includeOverrides package="schooltool.demographics" file="overrides.zcml" />
+ <include files="plugins/*.zcml" />
</configure>
Modified: schooltool/branches/upstream/current/setup.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/setup.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/setup.py (original)
+++ schooltool/branches/upstream/current/setup.py Fri Jul 13 10:48:08 2007
@@ -21,7 +21,9 @@
"""
SchoolTool setup script.
"""
-
+import os
+
+here = os.path.dirname(__file__)
# Check python version
import sys
@@ -31,47 +33,54 @@
sys.exit(1)
import site
-site.addsitedir('eggs')
+site.addsitedir(os.path.join(here, 'eggs'))
import pkg_resources
pkg_resources.require("setuptools>=0.6a11")
-import os
from setuptools import setup, find_packages
def get_version():
- version_file = os.path.join('src', 'schooltool', 'version.txt')
+ version_file = os.path.join(here, 'src', 'schooltool', 'version.txt')
f = open(version_file, 'r')
result = f.read()
f.close()
return result
+# allowed extensions
+ALLOWED_EXTENSIONS = ['conf','css', 'gif', 'ico', 'ics', 'js', 'mo', 'po', 'pt',
+ 'png', 'txt', 'xml', 'xpdl', 'zcml']
+
# Define packages we want to recursively include, we do this explicitly here
# to avoid automatic accidents
root_packages = ['schooltool.app',
+ 'schooltool.attendance',
+ 'schooltool.calendar',
+ 'schooltool.course',
'schooltool.dashboard',
+ 'schooltool.devmode',
'schooltool.demographics',
'schooltool.generations',
- 'schooltool.securitypolicy',
- 'schooltool.relationship',
- 'schooltool.course',
- 'schooltool.timetable',
- 'schooltool.person',
+ 'schooltool.group',
'schooltool.help',
'schooltool.locales',
- 'schooltool.locales.en',
+ 'schooltool.person',
'schooltool.resource',
- 'schooltool.utility',
+ 'schooltool.relationship',
+ 'schooltool.securitypolicy',
+ 'schooltool.skin',
+ 'schooltool.table',
'schooltool.term',
- 'schooltool.table',
- 'schooltool.group',
- 'schooltool.widget',
- 'schooltool.attendance',
- 'schooltool.calendar',
- 'schooltool.skin',
'schooltool.tests',
'schooltool.testing',
+ 'schooltool.timetable',
'schooltool.traverser',
+ 'schooltool.utility',
+ 'schooltool.widget',
+
+ # The schooltool configurations we maintain
+ 'schooltool.stapp2005',
+ 'schooltool.stapp2007',
# only needed for tests
'schooltool.sampledata',
@@ -81,34 +90,40 @@
]
# Packages we want to non-recursively include
-packages = ['schooltool']
-
package_data = {'schooltool': ['*.zcml', 'version.txt']}
# filter packages eliminating things that don't match
+# XXX - the next for loop is pretty insane and inefficient. Feel free to fix it
+# all it does is find the files in each package that need to be included.
all_packages = set(find_packages('src'))
for package in all_packages:
for root_package in root_packages:
if package.startswith(root_package):
- packages.append(package)
- package_data[package] = ['*.zcml',
- '*.xml',
- '*.xpdl',
- '*.txt', # only for tests
- '*.conf', # only for tests
- '*/*.ics', # only for tests
- '*.pt', '*/*.pt',
- '*/*.png',
- '*.css', '*/*.css',
- '*/*/*.css',
- '*/*.js',
- '*/*/*.js',
- '*/*.ico',
- '*/*.gif',
- '*/*/*.gif']
+ package_data[package] = []
+ includes = []
+ package_dir = os.path.join(here, 'src', *package.split('.'))
+ for root, dirs, files in os.walk(package_dir):
+ if dir in set(dirs):
+ if dir.startswith('.'):
+ dirs.remove(dir)
+ prefix = []
+ r = root
+ while r != package_dir:
+ r, dir = os.path.split(r)
+ prefix.insert(0, dir)
+ assert r.startswith(package_dir)
+ if prefix:
+ prefix = os.path.join(*prefix)
+ for file in files:
+ for ext in ALLOWED_EXTENSIONS:
+ if file.endswith('.%s' % ext) and not file.startswith('.'):
+ break
+ else:
+ continue
+ if prefix:
+ file = os.path.join(prefix, file)
+ package_data[package].append(file)
break
-
-package_data['schooltool.locales'].append('*/*/*.po')
# Setup SchoolTool
setup(
@@ -149,7 +164,7 @@
"Topic :: Education",
"Topic :: Office/Business :: Scheduling"],
package_dir={'': 'src'},
- packages=packages,
+ packages=package_data.keys(),
install_requires=['pytz',
'zc.resourcelibrary >= 0.7dev_r72506',
'zc.table >= 0.7dev_r72459', 'zc.catalog >= 1.2dev',
@@ -164,7 +179,9 @@
'zope.app.file',
'zope.app.onlinehelp',
'zope.app.apidoc',
+ 'z3c.breadcrumb',
'z3c.layer',
+ 'z3c.menu',
'z3c.optionstorage',
'z3c.pagelet',
'z3c.template',
@@ -179,5 +196,6 @@
'zope.app.zcmlfiles'],
dependency_links=['http://ftp.schooltool.org/schooltool/eggs/',
'http://download.zope.org/distribution/'],
- package_data=package_data
+ package_data=package_data,
+ include_package_data=True
)
Modified: schooltool/branches/upstream/current/src/schooltool.egg-info/PKG-INFO
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool.egg-info/PKG-INFO?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool.egg-info/PKG-INFO (original)
+++ schooltool/branches/upstream/current/src/schooltool.egg-info/PKG-INFO Fri Jul 13 10:48:08 2007
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: schooltool
-Version: 2006.999-2007-alpha1-svn-r7010
+Version: 2006.999-2007-alpha1-svn-r7056
Summary: A common information systems platform for school administration.
Home-page: http://www.schooltool.org
Author: SchoolTool development team
Modified: schooltool/branches/upstream/current/src/schooltool.egg-info/SOURCES.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool.egg-info/SOURCES.txt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool.egg-info/SOURCES.txt (original)
+++ schooltool/branches/upstream/current/src/schooltool.egg-info/SOURCES.txt Fri Jul 13 10:48:08 2007
@@ -2,9 +2,6 @@
Makefile
README.txt
i18nextract.py
-schoolbell-server.py
-schoolbell-site.zcml
-schoolbell.conf.in
schooltool-server.py
schooltool.conf.in
setup.cfg
@@ -39,7 +36,6 @@
scripts/schooltool-rest-client
src/trace.py
src/schoolbell/__init__.py
-src/schoolbell/translations.zcml
src/schoolbell/app/__init__.py
src/schoolbell/app/app.py
src/schoolbell/app/cal.py
@@ -240,6 +236,32 @@
src/schooltool/attendance/tests/test_attendance.py
src/schooltool/attendance/tests/test_sampledata.py
src/schooltool/attendance/tests/test_sparkline.py
+src/schooltool/basicperson/__init__.py
+src/schooltool/basicperson/advisor.py
+src/schooltool/basicperson/configure.zcml
+src/schooltool/basicperson/ftesting.py
+src/schooltool/basicperson/ftesting.zcml
+src/schooltool/basicperson/interfaces.py
+src/schooltool/basicperson/overrides.zcml
+src/schooltool/basicperson/person.py
+src/schooltool/basicperson/sampledata.py
+src/schooltool/basicperson/security.py
+src/schooltool/basicperson/vocabularies.py
+src/schooltool/basicperson/browser/__init__.py
+src/schooltool/basicperson/browser/configure.zcml
+src/schooltool/basicperson/browser/overrides.zcml
+src/schooltool/basicperson/browser/person.py
+src/schooltool/basicperson/browser/ftests/__init__.py
+src/schooltool/basicperson/browser/ftests/basicperson.txt
+src/schooltool/basicperson/browser/ftests/test_all.py
+src/schooltool/basicperson/browser/templates/person_add.pt
+src/schooltool/basicperson/browser/templates/person_edit.pt
+src/schooltool/basicperson/browser/templates/person_view.pt
+src/schooltool/basicperson/browser/tests/__init__.py
+src/schooltool/basicperson/browser/tests/test_person.py
+src/schooltool/basicperson/tests/__init__.py
+src/schooltool/basicperson/tests/test_person.py
+src/schooltool/basicperson/tests/test_vocabularies.py
src/schooltool/calendar/README.txt
src/schooltool/calendar/__init__.py
src/schooltool/calendar/browser.py
@@ -617,6 +639,7 @@
src/schooltool/person/interfaces.py
src/schooltool/person/person.py
src/schooltool/person/preference.py
+src/schooltool/person/sampledata.py
src/schooltool/person/security.zcml
src/schooltool/person/utility.py
src/schooltool/person/browser/__init__.py
@@ -754,48 +777,6 @@
src/schooltool/sampledata/tests/test_browser.py
src/schooltool/sampledata/tests/test_generator.py
src/schooltool/sampledata/tests/test_name.py
-src/schooltool/sbapp/README.txt
-src/schooltool/sbapp/__init__.py
-src/schooltool/sbapp/configure.zcml
-src/schooltool/sbapp/main.py
-src/schooltool/sbapp/browser/__init__.py
-src/schooltool/sbapp/browser/cal.py
-src/schooltool/sbapp/browser/configure.zcml
-src/schooltool/sbapp/browser/csvimport.py
-src/schooltool/sbapp/browser/skin.py
-src/schooltool/sbapp/browser/ftests/__init__.py
-src/schooltool/sbapp/browser/ftests/app.txt
-src/schooltool/sbapp/browser/ftests/test_all.py
-src/schooltool/sbapp/browser/resources/schoolbell.png
-src/schooltool/sbapp/browser/templates/calendar_overlay.pt
-src/schooltool/sbapp/browser/templates/generic_macros.pt
-src/schooltool/sbapp/browser/templates/index.pt
-src/schooltool/sbapp/browser/templates/navigation.pt
-src/schooltool/sbapp/browser/templates/person.pt
-src/schooltool/sbapp/browser/tests/__init__.py
-src/schooltool/sbapp/browser/tests/test_cal.py
-src/schooltool/sbapp/browser/tests/test_skin.py
-src/schooltool/sbapp/generations/__init__.py
-src/schooltool/sbapp/generations/evolve1.py
-src/schooltool/sbapp/generations/evolve2.py
-src/schooltool/sbapp/generations/evolve3.py
-src/schooltool/sbapp/generations/evolve4.py
-src/schooltool/sbapp/generations/evolve5.py
-src/schooltool/sbapp/generations/evolve6.py
-src/schooltool/sbapp/generations/evolve7.py
-src/schooltool/sbapp/generations/evolve8.py
-src/schooltool/sbapp/rest/__init__.py
-src/schooltool/sbapp/rest/configure.zcml
-src/schooltool/sbapp/rest/ftests/__init__.py
-src/schooltool/sbapp/rest/ftests/app.txt
-src/schooltool/sbapp/rest/ftests/test_all.py
-src/schooltool/sbapp/rest/tests/__init__.py
-src/schooltool/sbapp/rest/tests/test_app.py
-src/schooltool/sbapp/rest/tests/test_rest.py
-src/schooltool/sbapp/tests/__init__.py
-src/schooltool/sbapp/tests/empty.conf
-src/schooltool/sbapp/tests/sample.conf
-src/schooltool/sbapp/tests/test_main.py
src/schooltool/securitypolicy/README.txt
src/schooltool/securitypolicy/__init__.py
src/schooltool/securitypolicy/configure.zcml
@@ -873,6 +854,11 @@
src/schooltool/skin/resources/sidebar-background.png
src/schooltool/skin/resources/toolbar-background-hover.png
src/schooltool/skin/resources/toolbar-background.png
+src/schooltool/skin/resources/zonki-angry.png
+src/schooltool/skin/resources/zonki-pointing.png
+src/schooltool/skin/resources/zonki-question.png
+src/schooltool/skin/resources/zonki-reading.png
+src/schooltool/skin/resources/zonki-regular.png
src/schooltool/skin/templates/actions.pt
src/schooltool/skin/templates/actionsViewlet.pt
src/schooltool/skin/templates/actionsbar.pt
@@ -902,6 +888,22 @@
src/schooltool/skin/tests/test_dateformatter.py
src/schooltool/skin/tests/test_error.py
src/schooltool/skin/tests/test_skin.py
+src/schooltool/stapp2005/README.txt
+src/schooltool/stapp2005/__init__.py
+src/schooltool/stapp2005/configure.zcml
+src/schooltool/stapp2005/ftesting.py
+src/schooltool/stapp2005/ftesting.zcml
+src/schooltool/stapp2005/ftests/__init__.py
+src/schooltool/stapp2005/ftests/stapp2005.txt
+src/schooltool/stapp2005/ftests/test_all.py
+src/schooltool/stapp2007/README.txt
+src/schooltool/stapp2007/__init__.py
+src/schooltool/stapp2007/configure.zcml
+src/schooltool/stapp2007/ftesting.py
+src/schooltool/stapp2007/ftesting.zcml
+src/schooltool/stapp2007/ftests/__init__.py
+src/schooltool/stapp2007/ftests/stapp2007.txt
+src/schooltool/stapp2007/ftests/test_all.py
src/schooltool/table/__init__.py
src/schooltool/table/batch.py
src/schooltool/table/interfaces.py
@@ -913,6 +915,8 @@
src/schooltool/term/README.txt
src/schooltool/term/__init__.py
src/schooltool/term/configure.zcml
+src/schooltool/term/ftesting.py
+src/schooltool/term/ftesting.zcml
src/schooltool/term/interfaces.py
src/schooltool/term/sampledata.py
src/schooltool/term/term-configure.zcml
@@ -927,8 +931,12 @@
src/schooltool/term/browser/term.pt
src/schooltool/term/browser/term.py
src/schooltool/term/browser/term_add_edit.pt
+src/schooltool/term/browser/term_basic_add_edit.pt
src/schooltool/term/browser/termrenderer.txt
src/schooltool/term/browser/tests.py
+src/schooltool/term/browser/ftests/__init__.py
+src/schooltool/term/browser/ftests/term.txt
+src/schooltool/term/browser/ftests/test_all.py
src/schooltool/term/rest/__init__.py
src/schooltool/term/rest/configure.zcml
src/schooltool/term/rest/term.py
@@ -976,6 +984,8 @@
src/schooltool/timetable/browser/templates/simpletts.pt
src/schooltool/timetable/browser/templates/specialday_change.pt
src/schooltool/timetable/browser/templates/specialday_select.pt
+src/schooltool/timetable/browser/templates/timetable-add.pt
+src/schooltool/timetable/browser/templates/timetable-edit.pt
src/schooltool/timetable/browser/templates/timetable-schema-container.pt
src/schooltool/timetable/browser/templates/timetable.pt
src/schooltool/timetable/browser/templates/timetable_event_edit.pt
@@ -1028,5 +1038,6 @@
testsupport/__init__.py
testsupport/checks.py
utilities/README.txt
+utilities/generate_vcal_dict.py
utilities/gpl.py
utilities/xpathgrep.py
Modified: schooltool/branches/upstream/current/src/schooltool.egg-info/requires.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool.egg-info/requires.txt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool.egg-info/requires.txt (original)
+++ schooltool/branches/upstream/current/src/schooltool.egg-info/requires.txt Fri Jul 13 10:48:08 2007
@@ -14,7 +14,9 @@
zope.app.file
zope.app.onlinehelp
zope.app.apidoc
+z3c.breadcrumb
z3c.layer
+z3c.menu
z3c.optionstorage
z3c.pagelet
z3c.template
Modified: schooltool/branches/upstream/current/src/schooltool/app/browser/app.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/app/browser/app.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/app/browser/app.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/app/browser/app.py Fri Jul 13 10:48:08 2007
@@ -19,10 +19,9 @@
"""
SchoolTool application views.
-$Id: app.py 6967 2007-06-04 15:01:11Z ignas $
+$Id: app.py 7045 2007-07-13 08:09:06Z ignas $
"""
-from zope.component import getUtility
from zope.interface import implements
from zope.security.interfaces import IParticipation
from zope.security.management import getSecurityPolicy
@@ -37,6 +36,7 @@
from zope.component import queryMultiAdapter
from zope.app.security.interfaces import IAuthentication
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.publisher.browser import BrowserPage
from schooltool import SchoolToolMessage as _
from schooltool.app.app import getSchoolToolApplication
@@ -45,10 +45,10 @@
from schooltool.app.interfaces import ISchoolToolCalendar
from schooltool.app.interfaces import IAsset
from schooltool.person.interfaces import IPerson
-from schooltool.person.interfaces import IPersonFactory
from schooltool.table.table import CheckboxColumn
from schooltool.table.table import label_cell_formatter_factory
from schooltool.table.interfaces import ITableFormatter
+from schooltool.skin.breadcrumbs import CustomNameBreadCrumbInfo
class ApplicationView(BrowserView):
@@ -281,3 +281,11 @@
def getAvailableItemsContainer(self):
return ISchoolToolApplication(None)['persons']
+
+class ViewRobot(BrowserPage):
+
+ def __call__(self):
+ return "User-agent: *\nDisallow: /"
+
+
+SchoolBreadcrumbInfo = CustomNameBreadCrumbInfo(_('school'))
Modified: schooltool/branches/upstream/current/src/schooltool/app/browser/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/app/browser/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/app/browser/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/app/browser/configure.zcml Fri Jul 13 10:48:08 2007
@@ -80,6 +80,13 @@
for="*"
permission="zope.View"
template="templates/calendar_macros.pt"
+ />
+
+ <page
+ name="robots.txt"
+ for="schooltool.app.interfaces.ISchoolToolApplication"
+ permission="zope.View"
+ class=".app.ViewRobot"
/>
<resource name="day.png" file="resources/day.png"
@@ -590,4 +597,12 @@
factory=".cal.CalendarMenuViewletCrowd"
name="schooltool.view" />
+ <zope:adapter
+ for="schooltool.app.interfaces.ISchoolToolApplication
+ zope.publisher.interfaces.http.IHTTPRequest"
+ factory=".app.SchoolBreadcrumbInfo"
+ trusted="true"
+ permission="zope.Public"
+ />
+
</configure>
Modified: schooltool/branches/upstream/current/src/schooltool/app/browser/ftests/cal.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/app/browser/ftests/cal.txt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/app/browser/ftests/cal.txt (original)
+++ schooltool/branches/upstream/current/src/schooltool/app/browser/ftests/cal.txt Fri Jul 13 10:48:08 2007
@@ -432,7 +432,7 @@
>>> print analyze.queryHTML('//div[@class="breadcrumbs"]',
... frog.contents)[0]
<div class="breadcrumbs">
- <a href="http://localhost">SchoolTool</a>
+ <a href="http://localhost">school</a>
»
<a href="http://localhost/persons">persons</a>
»
Modified: schooltool/branches/upstream/current/src/schooltool/app/browser/templates/edit_relationships.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/app/browser/templates/edit_relationships.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/app/browser/templates/edit_relationships.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/app/browser/templates/edit_relationships.pt Fri Jul 13 10:48:08 2007
@@ -1,53 +1,53 @@
<tal:defs define="update view/update" />
<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
-<head>
- <title metal:fill-slot="title" tal:content="context/title" />
-</head>
-<body>
-<metal:block metal:fill-slot="body"
- tal:define="batch view/available_table/batch">
-
-<form method="post" tal:attributes="action request/URL" class="standalone">
-<h3 i18n:translate="" tal:content="view/title" />
-<fieldset tal:define="items view/getSelectedItems">
- <tal:if condition="items">
- <legend i18n:translate="" tal:content="view/current_title" />
- <tal:block replace="structure view/selected_table/render" />
- <div class="controls">
- <input type="submit" class="button-ok" name="REMOVE_ITEMS"
- value="Remove"
- title="Shortcut: Alt-R" accesskey="R"
- i18n:attributes="value; accesskey" />
- </div>
- </tal:if>
- <p tal:condition="not:items" i18n:translate="">
- There are none.
- </p>
-</fieldset>
-<fieldset>
- <legend i18n:translate="" tal:content="view/available_title" />
- <div class="item_list">
- <tal:block replace="structure view/available_table/batch/render" />
- <tal:block replace="structure view/available_table/filter_widget/render" />
- <tal:block replace="structure view/available_table/render" />
- <div class="controls">
- <input type="submit" class="button-ok" name="ADD_ITEMS"
- value="Add" tal:condition="batch"
- title="Shortcut: Alt-A" accesskey="A"
- i18n:attributes="value; accesskey" />
- </div>
- <p tal:condition="not:batch" i18n:translate="">
- There are none to add.
- </p>
- </div>
-</fieldset>
-
-<div class="controls">
- <input type="submit" class="button-cancel" name="CANCEL" value="Cancel"
- i18n:attributes="value cancel-button" />
-</div>
-</form>
-
-</metal:block>
-</body>
+ <head>
+ <title metal:fill-slot="title" tal:content="context/title" />
+ </head>
+ <body>
+ <metal:block metal:fill-slot="body"
+ tal:define="batch view/available_table/batch">
+
+ <form method="post" tal:attributes="action request/URL" class="standalone">
+ <h3 i18n:translate="" tal:content="view/title" />
+ <fieldset tal:define="items view/getSelectedItems">
+ <tal:if condition="items">
+ <legend i18n:translate="" tal:content="view/current_title" />
+ <tal:block replace="structure view/selected_table/render" />
+ <div class="controls">
+ <input type="submit" class="button-ok" name="REMOVE_ITEMS"
+ value="Remove"
+ title="Shortcut: Alt-R" accesskey="R"
+ i18n:attributes="value; accesskey" />
+ </div>
+ </tal:if>
+ <p tal:condition="not:items" i18n:translate="">
+ There are none.
+ </p>
+ </fieldset>
+ <fieldset>
+ <legend i18n:translate="" tal:content="view/available_title" />
+ <div class="item_list">
+ <tal:block replace="structure view/available_table/batch/render" />
+ <tal:block replace="structure view/available_table/filter_widget/render" />
+ <tal:block replace="structure view/available_table/render" />
+ <div class="controls">
+ <input type="submit" class="button-ok" name="ADD_ITEMS"
+ value="Add" tal:condition="batch"
+ title="Shortcut: Alt-A" accesskey="A"
+ i18n:attributes="value; accesskey" />
+ </div>
+ <p tal:condition="not:batch" i18n:translate="">
+ There are none to add.
+ </p>
+ </div>
+ </fieldset>
+
+ <div class="controls">
+ <input type="submit" class="button-cancel" name="CANCEL" value="Cancel"
+ i18n:attributes="value cancel-button" />
+ </div>
+ </form>
+
+ </metal:block>
+ </body>
</html>
Modified: schooltool/branches/upstream/current/src/schooltool/app/browser/testing.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/app/browser/testing.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/app/browser/testing.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/app/browser/testing.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Setup code for SchoolTool application browser unit tests
-$Id: testing.py 6992 2007-07-02 17:54:31Z pcardune $
+$Id: testing.py 7045 2007-07-13 08:09:06Z ignas $
"""
import os.path
import zope.component
@@ -163,9 +163,12 @@
return "a dummy resource"
for name in ['layout.css', 'schooltool.css', 'schooltool.js',
- 'logo.png', 'next.png', 'prev.png', 'favicon.ico',
+ 'next.png', 'prev.png', 'favicon.ico',
'calwidget-calendar.js', 'calwidget-calendar.css',
- 'calwidget-icon.gif', 'print.css', 'jquery.js']:
+ 'calwidget-icon.gif', 'print.css', 'jquery.js',
+ 'zonki-angry.png', 'zonki-pointing.png',
+ 'zonki-question.png', 'zonki-reading.png',
+ 'zonki-regular.png', ]:
ztapi.browserResource(name, ResourceStub)
# menus
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/__init__.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/__init__.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/__init__.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,1 @@
+#
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/advisor.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/advisor.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/advisor.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/advisor.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,81 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Lyceum advisor relationship.
+
+$Id: advisor.py 7031 2007-07-12 14:08:13Z ignas $
+
+"""
+from zope.component import adapts
+from zope.interface import implements
+
+from schooltool.relationship.uri import URIObject
+from schooltool.relationship.relationship import RelationshipSchema
+from schooltool.relationship.interfaces import IRelationshipLinks
+
+from schooltool.basicperson.interfaces import IBasicPerson
+from schooltool.basicperson.interfaces import IAdvisor
+from schooltool.basicperson.interfaces import IStudent
+
+
+URIAdvising = URIObject('http://schooltool.org/ns/advising',
+ 'Advising', 'The advising relationship.')
+URIStudent = URIObject('http://schooltool.org/ns/advising/student',
+ 'Student', 'An advising relationship student role.')
+URIAdvisor = URIObject('http://schooltool.org/ns/advising/advisor',
+ 'Advisor', 'An advising relationship advisor role.')
+
+Advising = RelationshipSchema(URIAdvising,
+ advisor=URIAdvisor,
+ student=URIStudent)
+
+
+class PersonAdvisorAdapter(object):
+ adapts(IBasicPerson)
+ implements(IAdvisor)
+
+ def __init__(self, context):
+ self.context = context
+
+ @property
+ def students(self):
+ relationships = IRelationshipLinks(self.context)
+ return relationships.getTargetsByRole(URIStudent, URIAdvising)
+
+ def addStudent(self, student):
+ Advising(student=student, advisor=self.context)
+
+ def removeStudent(self, student):
+ Advising.unlink(student=student, advisor=self.context)
+
+
+class PersonStudentAdapter(object):
+ adapts(IBasicPerson)
+ implements(IStudent)
+
+ def __init__(self, context):
+ self.context = context
+
+ @property
+ def advisor(self):
+ relationships = IRelationshipLinks(self.context)
+ advisors = relationships.getTargetsByRole(URIAdvisor, URIAdvising)
+ assert len(advisors) < 2
+ advisors.append(None)
+ return advisors[0]
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/advisor.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/__init__.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/__init__.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/__init__.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,1 @@
+#
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/configure.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/configure.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/configure.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,41 @@
+<?xml version="1.0"?>
+<configure xmlns="http://namespaces.zope.org/browser"
+ xmlns:zope="http://namespaces.zope.org/zope"
+ i18n_domain="schooltool">
+
+ <page
+ name="index.html"
+ for="schooltool.basicperson.interfaces.IBasicPerson"
+ class=".person.PersonView"
+ permission="schooltool.view"
+ menu="schooltool_actions"
+ title="View"
+ />
+
+ <page
+ name="edit.html"
+ for="schooltool.basicperson.interfaces.IBasicPerson"
+ class=".person.PersonEditView"
+ permission="schooltool.edit"
+ menu="schooltool_actions"
+ title="Edit"
+ />
+
+ <!-- list of persons -->
+ <zope:adapter
+ for="schooltool.basicperson.interfaces.IBasicPersonSource
+ zope.publisher.interfaces.browser.IBrowserRequest"
+ factory=".person.PersonTerms"
+ />
+
+ <!-- list of groups -->
+ <zope:adapter
+ for="schooltool.basicperson.interfaces.IGroupSource
+ zope.publisher.interfaces.browser.IBrowserRequest"
+ factory=".person.GroupTerms"
+ />
+
+ <!-- person add form adapter -->
+ <zope:adapter factory=".person.PersonAddFormAdapter" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/configure.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/__init__.py?rev=935&op=file
==============================================================================
(empty)
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/basicperson.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/basicperson.txt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/basicperson.txt (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/basicperson.txt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,16 @@
+Basic Person
+============
+
+A manager logs in
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> manager = Browser()
+ >>> manager.addHeader('Authorization', 'Basic manager:schooltool')
+ >>> manager.handleErrors = False
+ >>> manager.open('http://localhost/')
+
+Create a Basic Person
+
+ >>> manager.getLink('Persons').click()
+ >>> manager.getLink('New Person').click()
+
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/basicperson.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/test_all.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/test_all.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/test_all.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/test_all.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,35 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional tests for schooltool.basicperson
+
+$Id: test_all.py 7049 2007-07-13 09:39:54Z jfroche $
+"""
+
+import unittest
+
+from schooltool.testing.functional import collect_ftests
+from schooltool.basicperson.ftesting import basicperson_functional_layer
+
+def test_suite():
+ return collect_ftests(layer=basicperson_functional_layer)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/ftests/test_all.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/overrides.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/overrides.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/overrides.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/overrides.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,14 @@
+<?xml version="1.0"?>
+<configure xmlns="http://namespaces.zope.org/browser"
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ i18n_domain="schooltool">
+
+ <page
+ name="add.html"
+ for="schooltool.person.interfaces.IPersonContainer"
+ class=".person.PersonAddView"
+ permission="schooltool.edit"
+ menu="schooltool_actions" title="New Person" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/overrides.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/person.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/person.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/person.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/person.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,229 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Lyceum person browser views.
+
+$Id: person.py 7031 2007-07-12 14:08:13Z ignas $
+"""
+from zope.app import zapi
+from zope.app.container.interfaces import INameChooser
+from zope.app.form.browser.interfaces import ITerms
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.component import adapts
+from zope.component import getUtility
+from zope.exceptions.interfaces import UserError
+from zope.formlib import form
+from zope.interface import implements
+from zope.publisher.browser import BrowserView
+from zope.schema import Password
+from zope.schema import TextLine
+from zope.schema.interfaces import ITitledTokenizedTerm
+
+from schooltool.app.interfaces import ISchoolToolApplication
+from schooltool.person.interfaces import IPersonFactory
+from schooltool.skin.form import BasicForm
+from schooltool.skin.form import EditForm
+from schooltool.widget.password import PasswordConfirmationWidget
+
+from schooltool.basicperson.interfaces import IBasicPerson
+from schooltool import SchoolToolMessage as _
+
+
+class PersonView(BrowserView):
+
+ template = ViewPageTemplateFile('templates/person_view.pt')
+
+ def __call__(self):
+ return self.template()
+
+
+class IPersonAddForm(IBasicPerson):
+
+ password = Password(
+ title=_("Password"),
+ required=False)
+
+ username = TextLine(
+ title=_("Username"),
+ description=_("Username"),
+ required=True)
+
+
+class PersonAddFormAdapter(object):
+ implements(IPersonAddForm)
+ adapts(IBasicPerson)
+
+ def __init__(self, context):
+ self.__dict__['context'] = context
+
+ password = None
+
+ def __setattr__(self, name, value):
+ if name == 'password':
+ self.context.setPassword(value)
+ else:
+ setattr(self.context, name, value)
+
+ def __getattr__(self, name):
+ return getattr(self.context, name)
+
+
+class PersonAddView(BasicForm):
+ """Person add form for basic persons."""
+
+ template = ViewPageTemplateFile('templates/person_add.pt')
+
+ form_fields = form.Fields(IPersonAddForm, render_context=False)
+ form_fields['password'].custom_widget = PasswordConfirmationWidget
+
+ @form.action(_("Apply"))
+ def handle_apply_action(self, action, data):
+ if data['username'] in self.context:
+ self.status = _("This username is already used!")
+ return None
+
+ try:
+ INameChooser(self.context).checkName(data['username'], None)
+ except UserError:
+ self.status = _("Names cannot begin with '+' or '@' or contain '/'")
+ return None
+
+ person = self._factory(data['username'], data['first_name'],
+ data['last_name'])
+
+ form.applyChanges(person, self.form_fields, data, self.adapters)
+ self.addPerson(person)
+
+ # Add the persons to his class
+ if person.gradeclass is not None:
+ groups = ISchoolToolApplication(None)['groups']
+ person.groups.add(groups[person.gradeclass])
+
+ url = zapi.absoluteURL(person, self.request)
+ self.request.response.redirect(url)
+ return ''
+
+ @form.action(_("Cancel"))
+ def handle_cancel_action(self, action, data):
+ # XXX validation upon cancellation doesn't make any sense
+ # how to make this work properly?
+ return self._redirect()
+
+ def _redirect(self):
+ url = zapi.absoluteURL(self.context, self.request)
+ self.request.response.redirect(url)
+ return ''
+
+ @property
+ def _factory(self):
+ return getUtility(IPersonFactory)
+
+ def addPerson(self, person):
+ """Add `person` to the container.
+
+ Uses the username of `person` as the object ID (__name__).
+ """
+ name = person.username
+ self.context[name] = person
+ return person
+
+
+class PersonEditView(EditForm):
+ """Edit form for basic person."""
+
+ template = ViewPageTemplateFile('templates/person_edit.pt')
+
+ @form.action(_('Apply'), name='apply')
+ def handle_apply(self, action, data):
+ self.edit_action(action, data)
+
+ @form.action(_('Cancel'), name='cancel')
+ def handle_cancel(self, action, data):
+ self.cancel_action(action, data)
+
+ def title(self):
+ return _(u'Change information for ${fullname}',
+ mapping={'fullname': self.fullname()})
+
+ form_fields = form.Fields(IBasicPerson)
+
+ def fullname(self):
+ return self.context.title
+
+
+class PersonTerm(object):
+ """A term for displaying a person."""
+ implements(ITitledTokenizedTerm)
+
+ def __init__(self, value):
+ self.title = value.title
+ self.token = value.__name__
+ self.value = value
+
+
+class TermsBase(object):
+ """Base terms implementation."""
+
+ implements(ITerms)
+
+ def factory(self, value):
+ raise NotImplementedError(
+ "Term Factory must be provided by inheriting classes.")
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def getTerm(self, value):
+ if value not in self.context:
+ raise LookupError(value)
+ return self.factory(value)
+
+ def getValue(self, token):
+ if token not in self.context:
+ raise LookupError(token)
+ return token
+
+
+class PersonTerms(TermsBase):
+ """Displaying persons."""
+ factory = PersonTerm
+
+ def getValue(self, token):
+ if token not in self.context:
+ raise LookupError(token)
+ app = ISchoolToolApplication(None)
+ return app['persons'][token]
+
+
+class GroupTerm(object):
+ """A term for displaying a group."""
+ implements(ITitledTokenizedTerm)
+
+ def __init__(self, value):
+ groups = ISchoolToolApplication(None)['groups']
+ self.title = groups[value].title
+ self.token = value
+ self.value = value
+
+
+class GroupTerms(TermsBase):
+ """Displaying groups."""
+
+ factory = GroupTerm
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/person.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_add.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_add.pt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_add.pt (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_add.pt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,18 @@
+<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
+<body>
+<metal:nothing metal:fill-slot="content-header" />
+<metal:block metal:fill-slot="body">
+
+ <metal:block use-macro="view/@@formlib_macros/edit">
+ <metal:block fill-slot="controls">
+ <input type="submit" id="form.actions.apply" name="form.actions.apply" value="Add" class="button-ok"
+ title="Shortcut: Alt-A" accesskey="A"
+ i18n:attributes="value submit-button; accesskey" />
+ <input type="submit" id="form.actions.cancel" name="form.actions.cancel" value="Cancel" class="button-cancel"
+ i18n:attributes="value cancel-button" />
+ </metal:block>
+ </metal:block>
+
+</metal:block>
+</body>
+</html>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_add.pt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_edit.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_edit.pt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_edit.pt (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_edit.pt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,20 @@
+<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
+<body>
+<metal:nothing metal:fill-slot="content-header" />
+<metal:block metal:fill-slot="body">
+
+ <metal:block use-macro="view/@@menu_macros/tab_menu" />
+
+ <metal:block use-macro="view/@@formlib_macros/edit">
+ <metal:block fill-slot="controls">
+ <input type="submit" id="form.actions.apply" name="form.actions.apply" value="Apply" class="button-ok"
+ title="Shortcut: Alt-A" accesskey="A"
+ i18n:attributes="value submit-button; accesskey" />
+ <input type="submit" id="form.actions.cancel" name="form.actions.cancel" value="Cancel" class="button-cancel"
+ i18n:attributes="value cancel-button" />
+ </metal:block>
+ </metal:block>
+
+</metal:block>
+</body>
+</html>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_edit.pt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_view.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_view.pt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_view.pt (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_view.pt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,34 @@
+<metal:block use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
+
+ <metal:block fill-slot="title">
+ <title i18n:translate="">Person info: <span tal:replace="context/title"
+ i18n:name="title"/></title>
+ </metal:block>
+
+ <metal:block fill-slot="content-header">
+
+ <tal:if condition="context/photo">
+ <img src="photo" class="person-photo" alt="photo" i18n:attributes="alt"
+ tal:attributes="src string:${context/@@absolute_url}/photo" />
+ </tal:if>
+ <h1 tal:content="context/title" />
+ <strong i18n:translate="">Username:</strong>
+ <span tal:replace="context/zope:name">not_doe</span>
+ <br />
+
+ </metal:block>
+
+ <metal:block metal:fill-slot="body">
+
+ <tal:block replace="structure context/@@notes|nothing"/>
+
+ <div class="person-info">
+ <div class="info-block">
+ <h5 i18n:translate="">Details</h5>
+ </div>
+ <tal:block tal:replace="structure provider:schooltool.person.Info"/>
+ </div>
+
+ </metal:block>
+
+</metal:block>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/templates/person_view.pt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/__init__.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/__init__.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/__init__.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,1 @@
+#
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/test_person.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/test_person.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/test_person.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/test_person.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,172 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Unit tests for basic person views.
+
+$Id: test_person.py 7031 2007-07-12 14:08:13Z ignas $
+"""
+import unittest
+
+from zope.component import provideAdapter
+from zope.app.testing import setup
+from zope.testing import doctest
+
+
+def doctest_PersonAddFormAdapter():
+ """Tests for PersonAddFormAdapter
+
+ PersonAddFormAdapter just wraps a person object but hides
+ setPassword method unde a write only password property:
+
+ >>> class PersonStub(object):
+ ... def setPassword(self, new_password):
+ ... print "Setting password to:", new_password
+
+ >>> person = PersonStub()
+ >>> person.name = "John"
+ >>> person.last_name = "Johnson"
+
+ >>> from schooltool.basicperson.browser.person import PersonAddFormAdapter
+ >>> pa = PersonAddFormAdapter(person)
+ >>> pa.password = "FooBar3"
+ Setting password to: FooBar3
+
+ >>> pa.password is None
+ True
+
+ >>> pa.name
+ 'John'
+
+ >>> pa.surname = "Peterson"
+ >>> person.surname
+ 'Peterson'
+
+ """
+
+
+def doctest_PersonTerm():
+ """Tests for PersonTerm.
+
+ Person term is a title tokenized term that uses the title of a
+ person as the title to be displayed:
+
+ >>> class PersonStub(object):
+ ... def __init__(self, title):
+ ... self.title = title
+ ... self.__name__ = title.lower()
+
+ >>> john = PersonStub('John')
+
+ >>> from schooltool.basicperson.browser.person import PersonTerm
+ >>> term = PersonTerm(john)
+ >>> term.title
+ 'John'
+ >>> term.token
+ 'john'
+ >>> term.value
+ <...test_person.PersonStub object at ...>
+
+ """
+
+
+def doctest_TermsBase():
+ """Tests for TermsBase.
+
+ Let's construct the TermsBase:
+
+ >>> class TermStub(object):
+ ... def __init__(self, value):
+ ... self.value = value
+ ... def __repr__(self):
+ ... return "<TermStub %s>" % self.value
+
+ >>> from schooltool.basicperson.browser.person import TermsBase
+ >>> source = ["john"]
+ >>> terms = TermsBase(source, None)
+
+ If no term factory is set - NotImplementedError is raised:
+
+ >>> terms.getTerm("john")
+ Traceback (most recent call last):
+ ...
+ NotImplementedError: Term Factory must be provided by inheriting classes.
+
+ If term factory is present it is used to construct the term from
+ the given value:
+
+ >>> terms.factory = TermStub
+
+ >>> terms.getTerm("john")
+ <TermStub john>
+
+ If there is no such value in the source - we get a lookup error:
+
+ >>> terms.getTerm("peter")
+ Traceback (most recent call last):
+ ...
+ LookupError: peter
+
+ """
+
+
+def doctest_GroupTerm():
+ """Tests for GroupTerm.
+
+ Group term is a title tokenized term that uses the title of a
+ group as the title to be displayed:
+
+ >>> class GroupStub(object):
+ ... def __init__(self, title):
+ ... self.title = title
+
+ >>> class STAppStub(dict):
+ ... def __init__(self, context):
+ ... self['groups'] = {'teachers': GroupStub('Teachers')}
+
+ >>> from schooltool.app.interfaces import ISchoolToolApplication
+ >>> provideAdapter(STAppStub, adapts=[None], provides=ISchoolToolApplication)
+
+ >>> from schooltool.basicperson.browser.person import GroupTerm
+ >>> term = GroupTerm("teachers")
+ >>> term.title
+ 'Teachers'
+ >>> term.token
+ 'teachers'
+ >>> term.value
+ 'teachers'
+
+ """
+
+
+def setUp(test):
+ setup.placelessSetUp()
+
+
+def tearDown(test):
+ setup.placelessTearDown()
+
+
+def test_suite():
+ optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+ return doctest.DocTestSuite(optionflags=optionflags,
+ setUp=setUp, tearDown=tearDown)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/browser/tests/test_person.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/configure.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/configure.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/configure.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,58 @@
+<?xml version="1.0"?>
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ i18n_domain="schooltool">
+
+ <class class=".person.BasicPerson">
+ <implements interface="schooltool.app.interfaces.IHaveCalendar" />
+ <implements interface="schooltool.note.interfaces.IHaveNotes" />
+ <implements interface="schooltool.person.interfaces.IHavePreferences" />
+ <require
+ permission="schooltool.view"
+ interface="schooltool.person.interfaces.IReadPerson"
+ attributes="__cmp__" />
+ <require
+ permission="schooltool.edit"
+ interface="schooltool.person.interfaces.IWritePerson"
+ set_schema="schooltool.person.interfaces.IPerson" />
+ <require
+ permission="schooltool.edit"
+ set_schema="schooltool.basicperson.interfaces.IBasicPerson" />
+ <require
+ permission="schooltool.view"
+ interface="schooltool.basicperson.interfaces.IBasicPerson" />
+ <require
+ permission="schooltool.edit"
+ set_attributes="modified" />
+ </class>
+
+ <adapter
+ factory=".person.BasicPersonCalendarCrowd"
+ provides="schooltool.app.interfaces.ICalendarParentCrowd"
+ name="schooltool.view" />
+
+ <subscriber
+ for="schooltool.app.interfaces.ICatalogSetUpEvent"
+ handler=".person.catalogSetUpSubscriber"
+ />
+
+ <adapter
+ factory=".advisor.PersonAdvisorAdapter" />
+
+ <adapter
+ factory=".advisor.PersonStudentAdapter" />
+
+ <utility
+ factory=".vocabularies.gradeClassVocabularyFactory"
+ provides="zope.schema.interfaces.IVocabularyFactory"
+ name="schooltool.basicperson.grade_class_source" />
+
+ <utility
+ factory=".vocabularies.advisorVocabularyFactory"
+ provides="zope.schema.interfaces.IVocabularyFactory"
+ name="schooltool.basicperson.advisor_source" />
+
+ <include package="schooltool.basicperson.browser" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/configure.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,33 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional Testing Utilities for basic person
+
+$Id: ftesting.py 7049 2007-07-13 09:39:54Z jfroche $
+"""
+import os
+
+from schooltool.testing.functional import ZCMLLayer
+
+dir = os.path.abspath(os.path.dirname(__file__))
+filename = os.path.join(dir, 'ftesting.zcml')
+
+basicperson_functional_layer = ZCMLLayer(filename,
+ __name__,
+ 'basicperson_functional_layer')
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,9 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope">
+
+ <include package="schooltool" />
+ <include package="schooltool.basicperson" />
+ <include package="schooltool.term" />
+ <include package="schooltool.timetable" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/ftesting.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/interfaces.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/interfaces.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/interfaces.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/interfaces.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,104 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Lyceum person interfaces.
+
+$Id: interfaces.py 7031 2007-07-12 14:08:13Z ignas $
+"""
+from zope.schema import Date
+from zope.schema import Choice
+from zope.schema import TextLine
+from zope.interface import Interface
+from zope.interface import Attribute
+from zope.schema.interfaces import IIterableSource
+
+from schooltool.demographics.interfaces import SourceList
+from schooltool import SchoolToolMessage as _
+
+
+class IBasicPerson(Interface):
+ """Marker interface for Lyceum specific person."""
+
+ first_name = TextLine(
+ title=_(u"First name"),
+ required=False,
+ )
+
+ last_name = TextLine(
+ title=_(u"Last name"),
+ required=True,
+ )
+
+ gender = Choice(
+ title=_(u"Gender"),
+ source=SourceList([_('male'), _('female')]),
+ required=False,
+ )
+
+ email = TextLine(
+ title=_(u"Email"),
+ required=False,
+ )
+
+ phone = TextLine(
+ title=_(u"Phone"),
+ required=False,
+ )
+
+ gradeclass = Choice(
+ title=_(u"Grade"),
+ source="schooltool.basicperson.grade_class_source",
+ required=False,
+ )
+
+ birth_date = Date(
+ title=_(u"Birth date"),
+ required=False,
+ )
+
+ advisor = Choice(
+ title=_(u"Advisor"),
+ source="schooltool.basicperson.advisor_source",
+ required=False,
+ )
+
+
+class IBasicPersonSource(IIterableSource):
+ """Marker interface for sources that list basic persons."""
+
+
+# XXX should be in skin or common, or more properly - core
+class IGroupSource(IIterableSource):
+ """Marker interface for sources that list schooltool groups."""
+
+
+class IStudent(Interface):
+
+ advisor = Attribute("""Advisor of a student.""")
+
+
+class IAdvisor(Interface):
+
+ students = Attribute("""Students being advised by the advisor.""")
+
+ def addStudent(student):
+ """Add a student to the advised students list."""
+
+ def removeStudent(student):
+ """Remove this student from the advised students list."""
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/interfaces.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/overrides.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/overrides.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/overrides.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/overrides.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,38 @@
+<?xml version="1.0"?>
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:security="http://schooltool.org/securitypolicy"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ i18n_domain="schooltool">
+
+ <utility factory=".person.PersonFactoryUtility" />
+
+ <security:crowd
+ name="person_info_viewers"
+ factory=".security.PersonInfoViewersCrowd" />
+
+ <adapter
+ for="schooltool.person.interfaces.IPersonContainer"
+ factory=".person.getPersonContainerCatalog"
+ provides="zope.app.catalog.interfaces.ICatalog" />
+
+ <configure
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have devmode">
+
+ <utility
+ factory=".sampledata.SampleBasicStudents"
+ provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
+ name="students"
+ />
+
+ <utility
+ factory=".sampledata.SampleBasicTeachers"
+ provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
+ name="teachers"
+ />
+
+ </configure>
+
+ <include package=".browser" file="overrides.zcml" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/overrides.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/person.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/person.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/person.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/person.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,144 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Lyceum person specific code.
+
+$Id: person.py 7031 2007-07-12 14:08:13Z ignas $
+
+"""
+from zope.interface import implements
+from zope.component import adapts
+from zope.app.catalog.interfaces import ICatalog
+from zope.app.catalog.catalog import Catalog
+from zope.component import getUtility
+
+from zc.catalog.catalogindex import ValueIndex
+
+import schooltool.app # Dead chicken to appease the circle of import gods
+from schooltool.person.person import Person
+from schooltool.person.interfaces import IPersonFactory
+from schooltool.course.section import PersonInstructorsCrowd
+from schooltool.person.person import PersonCalendarCrowd
+from schooltool.table.table import IndexedLocaleAwareGetterColumn
+from schooltool.utility.utility import UtilitySetUp
+from schooltool.table.table import url_cell_formatter
+from schooltool.relationship.interfaces import IRelationshipLinks
+
+from schooltool.basicperson.advisor import Advising, URIAdvisor, URIAdvising, URIStudent
+from schooltool.basicperson.interfaces import IAdvisor
+from schooltool.basicperson.interfaces import IStudent
+from schooltool.basicperson.interfaces import IBasicPerson
+from schooltool import SchoolToolMessage as _
+
+
+PERSON_CATALOG_KEY = 'schooltool.basicperson'
+
+
+class BasicPerson(Person):
+ implements(IBasicPerson)
+
+ gender = None
+ gradeclass = None
+ birth_date = None
+
+ def getAdvisor(self):
+ return IStudent(self).advisor
+
+ def setAdvisor(self, advisor):
+ old_advisor = IStudent(self).advisor
+ if old_advisor:
+ IAdvisor(old_advisor).removeStudent(self)
+ IAdvisor(advisor).addStudent(self)
+
+ advisor = property(getAdvisor, setAdvisor)
+
+ def __init__(self, username, first_name, last_name,
+ email=None, phone=None):
+ self.first_name = first_name
+ self.last_name = last_name
+ self.username = username
+ self.email = email
+ self.phone = phone
+
+ @property
+ def title(self):
+ return "%s %s" % (self.last_name, self.first_name)
+
+
+class PersonFactoryUtility(object):
+
+ implements(IPersonFactory)
+
+ def columns(self):
+ first_name = IndexedLocaleAwareGetterColumn(
+ index='first_name',
+ name='first_name',
+ cell_formatter=url_cell_formatter,
+ title=_(u'First Name'),
+ getter=lambda i, f: i.first_name,
+ subsort=True)
+ last_name = IndexedLocaleAwareGetterColumn(
+ index='last_name',
+ name='last_name',
+ cell_formatter=url_cell_formatter,
+ title=_(u'Last Name'),
+ getter=lambda i, f: i.last_name,
+ subsort=True)
+
+ return [first_name, last_name]
+
+ def createManagerUser(self, username, system_name):
+ return self(username, system_name, "Administratorius")
+
+ def sortOn(self):
+ return (("last_name", False),)
+
+ def groupBy(self):
+ return (("grade", False),)
+
+ def __call__(self, *args, **kw):
+ result = BasicPerson(*args, **kw)
+ return result
+
+
+class BasicPersonCalendarCrowd(PersonCalendarCrowd):
+ """Crowd that allows instructor of a person access persons calendar.
+
+ XXX write functional test.
+ """
+ adapts(IBasicPerson)
+
+ def contains(self, principal):
+ return (PersonCalendarCrowd.contains(self, principal) or
+ PersonInstructorsCrowd(self.context).contains(principal))
+
+
+def catalogSetUp(catalog):
+ catalog['__name__'] = ValueIndex('__name__', IBasicPerson)
+ catalog['title'] = ValueIndex('title', IBasicPerson)
+ catalog['first_name'] = ValueIndex('first_name', IBasicPerson)
+ catalog['last_name'] = ValueIndex('last_name', IBasicPerson)
+
+
+catalogSetUpSubscriber = UtilitySetUp(
+ Catalog, ICatalog, PERSON_CATALOG_KEY, setUp=catalogSetUp)
+
+
+def getPersonContainerCatalog(container):
+ return getUtility(ICatalog, PERSON_CATALOG_KEY)
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/person.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/sampledata.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/sampledata.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/sampledata.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/sampledata.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,47 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Basic person sample data generation
+
+$Id: sampledata.py 7035 2007-07-12 15:19:06Z ignas $
+"""
+from schooltool.demographics.sampledata import SampleStudents
+from schooltool.demographics.sampledata import SampleTeachers
+from schooltool.basicperson.person import BasicPerson
+
+
+class SampleBasicStudents(SampleStudents):
+
+ def personFactory(self, namegen, prefixgen, gendergen, count):
+ first_name, last_name, full_name = namegen.generate()
+ person_id = 'student%03d' % count
+ person = BasicPerson(person_id, first_name, last_name)
+ person.setPassword(person_id)
+ person.gender = gendergen.generate()
+ return person
+
+
+class SampleBasicTeachers(SampleTeachers):
+
+ def personFactory(self, namegen, count):
+ first_name, last_name, full_name = namegen.generate()
+ person_id = 'teacher%03d' % count
+ person = BasicPerson(person_id, first_name, last_name)
+ person.setPassword(person_id)
+ return person
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/sampledata.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/security.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/security.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/security.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/security.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,39 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Lyceum specific security code.
+
+$Id: security.py 6804 2007-04-05 14:11:34Z ignas $
+
+"""
+from schooltool.securitypolicy.crowds import ConfigurableCrowd
+from schooltool.app.interfaces import ISchoolToolApplication
+
+
+class PersonInfoViewersCrowd(ConfigurableCrowd):
+ """The crowd of people who can view the info of a person."""
+
+ setting_key = 'everyone_can_view_person_info'
+
+ def contains(self, principal):
+ teachers = ISchoolToolApplication(None)['groups']['teachers']
+ groups = list(self.context.groups)
+ return (ConfigurableCrowd.contains(self, principal) or
+ teachers in groups)
+
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/security.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/tests/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/tests/__init__.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/tests/__init__.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/tests/__init__.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,1 @@
+#
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/tests/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_person.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_person.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_person.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_person.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,113 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Unit tests for basic person.
+
+$Id: test_person.py 7031 2007-07-12 14:08:13Z ignas $
+"""
+import unittest
+
+from zope.component import provideAdapter
+from zope.app.testing import setup
+from zope.testing import doctest
+
+
+def doctest_BasicPerson():
+ """Tests for BasicPerson.
+
+ >>> from zope.interface.verify import verifyObject
+ >>> from schooltool.basicperson.person import BasicPerson
+ >>> person = BasicPerson("peter", "Peter", "Johnson")
+
+ >>> from zope.component import provideAdapter
+ >>> from schooltool.basicperson.interfaces import IBasicPerson
+ >>> from schooltool.basicperson.interfaces import IStudent
+ >>> from zope.interface import implements
+ >>> class StudentStub(object):
+ ... implements(IStudent)
+ ... def __init__(self, context):
+ ... pass
+ ... advisor = "John"
+ >>> provideAdapter(StudentStub, adapts=[IBasicPerson], provides=IStudent)
+ >>> verifyObject(IBasicPerson, person)
+ True
+
+ >>> person.title
+ 'Johnson Peter'
+
+ """
+
+
+def doctest_PersonFactoryUtility():
+ """Tests for PersonFactoryUtility.
+
+ >>> from schooltool.basicperson.person import PersonFactoryUtility
+ >>> factory = PersonFactoryUtility()
+
+ >>> from schooltool.person.interfaces import IPersonFactory
+ >>> from zope.interface.verify import verifyObject
+ >>> verifyObject(IPersonFactory, factory)
+ True
+
+ >>> for column in factory.columns():
+ ... print "%s, %s" % (column.name, column.title)
+ first_name, First Name
+ last_name, Last Name
+
+ >>> factory.sortOn()
+ (('last_name', False),)
+
+ """
+
+
+def doctest_PersonFactoryUtility_createManagerUser():
+ """Tests for PersonFactoryUtility.createManagerUser
+
+ First let's create the utility:
+
+ >>> from schooltool.basicperson.person import PersonFactoryUtility
+ >>> utility = PersonFactoryUtility()
+
+ The title of the manager user is set to "Administratorius" + system name:
+
+ >>> manager = utility.createManagerUser("manager_username", "SchoolTool")
+ >>> manager.title
+ 'Administratorius SchoolTool'
+ >>> manager.username
+ 'manager_username'
+
+ """
+
+
+def setUp(test):
+ setup.placelessSetUp()
+
+
+def tearDown(test):
+ setup.placelessTearDown()
+
+
+def test_suite():
+ optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+ return doctest.DocTestSuite(optionflags=optionflags,
+ setUp=setUp, tearDown=tearDown)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_person.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_vocabularies.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_vocabularies.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_vocabularies.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_vocabularies.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,124 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Unit tests for basic person vocabularies.
+
+$Id: test_vocabularies.py 7031 2007-07-12 14:08:13Z ignas $
+"""
+import unittest
+
+from zope.app.testing import setup
+from zope.component import provideAdapter
+from zope.interface import implements
+from zope.testing import doctest
+
+
+def doctest_GradeClassSource():
+ """Tests for GradeClassSource
+
+ If the context of a source is not a person, all groups from the
+ group container are returned:
+
+ >>> from schooltool.app.interfaces import ISchoolToolApplication
+ >>> class STAppStub(dict):
+ ... def __init__(self, context):
+ ... self['groups'] = {'a': None, 'b': None, 'some-group': None}
+
+ >>> provideAdapter(STAppStub, adapts=[None], provides=ISchoolToolApplication)
+
+ >>> from schooltool.basicperson.vocabularies import GradeClassSource
+ >>> source = GradeClassSource(None)
+ >>> [group for group in source]
+ ['a', 'b', 'some-group']
+
+ If the context of the vocabulary is a person - list all the groups
+ he belongs to as possible grade classes:
+
+ >>> from schooltool.group.interfaces import IGroup
+ >>> class GroupStub(object):
+ ... implements(IGroup)
+ ... def __init__(self, name):
+ ... self.__name__ = name
+
+ >>> class SectionStub(object):
+ ... def __init__(self, name):
+ ... self.__name__ = name
+
+ >>> from schooltool.person.interfaces import IPerson
+ >>> class PersonStub(object):
+ ... implements(IPerson)
+ ... def __init__(self):
+ ... self.groups = map(GroupStub, ['g2', 'g1'])
+ ... self.groups.extend(map(SectionStub, ['s1', 's2']))
+
+ >>> person = PersonStub()
+ >>> source = GradeClassSource(person)
+ >>> [group for group in source]
+ ['g1', 'g2']
+
+ """
+
+
+def doctest_AdvisorSource():
+ """Tests for AdvisorSource
+
+ If the context of a source is not a person, all groups from the
+ group container are returned:
+
+ >>> from schooltool.app.interfaces import ISchoolToolApplication
+ >>> class GroupStub(object):
+ ... def __init__(self, members):
+ ... self.members = members
+
+ >>> class PersonStub(object):
+ ... def __init__(self, name):
+ ... self.__name__ = name
+
+ >>> class STAppStub(dict):
+ ... def __init__(self, context):
+ ... self['groups'] = {}
+ ... members = map(PersonStub, ['john', 'sarrah'])
+ ... self['groups']['teachers'] = GroupStub(members)
+
+ >>> provideAdapter(STAppStub, adapts=[None], provides=ISchoolToolApplication)
+
+ >>> from schooltool.basicperson.vocabularies import AdvisorSource
+ >>> source = AdvisorSource(None)
+ >>> [person.__name__ for person in source]
+ ['john', 'sarrah']
+
+ """
+
+
+def setUp(test):
+ setup.placelessSetUp()
+
+
+def tearDown(test):
+ setup.placelessTearDown()
+
+
+def test_suite():
+ optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+ return doctest.DocTestSuite(optionflags=optionflags,
+ setUp=setUp, tearDown=tearDown)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/tests/test_vocabularies.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/basicperson/vocabularies.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/basicperson/vocabularies.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/basicperson/vocabularies.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/basicperson/vocabularies.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,81 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Sources and vocabularies for form fields.
+
+$Id: vocabularies.py 7031 2007-07-12 14:08:13Z ignas $
+
+"""
+from zope.interface import implements
+
+from schooltool.app.interfaces import ISchoolToolApplication
+from schooltool.person.interfaces import IPerson
+from schooltool.group.interfaces import IGroup
+
+from schooltool.basicperson.interfaces import IGroupSource
+from schooltool.basicperson.interfaces import IBasicPersonSource
+
+
+class GradeClassSource(object):
+ implements(IGroupSource)
+
+ def __init__(self, context):
+ self.context = context
+
+ def __len__(self):
+ len(self.context.groups)
+
+ def __contains__(self, value):
+ return True
+
+ def __iter__(self):
+ if IPerson.providedBy(self.context):
+ groups = [group.__name__
+ for group in self.context.groups
+ if IGroup.providedBy(group)]
+ else:
+ groups = list(ISchoolToolApplication(None)['groups'])
+
+ for group in sorted(groups):
+ yield group
+
+def gradeClassVocabularyFactory():
+ return GradeClassSource
+
+
+class AdvisorSource(object):
+ implements(IBasicPersonSource)
+
+ def __init__(self, context):
+ self.context = context
+
+ def __contains__(self, value):
+ return True
+
+ def __len__(self):
+ len(self.context.groups)
+
+ def __iter__(self):
+ app = ISchoolToolApplication(None)
+ persons = app['groups']['teachers'].members
+ for person in sorted(persons, key=lambda p: p.__name__):
+ yield person
+
+def advisorVocabularyFactory():
+ return AdvisorSource
Propchange: schooltool/branches/upstream/current/src/schooltool/basicperson/vocabularies.py
------------------------------------------------------------------------------
svn:eol-style = native
Modified: schooltool/branches/upstream/current/src/schooltool/calendar/generate_vcal_dict.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/calendar/generate_vcal_dict.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/calendar/generate_vcal_dict.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/calendar/generate_vcal_dict.py Fri Jul 13 10:48:08 2007
@@ -1,5 +1,4 @@
-#!/usr/bin/env python
-"""A script that generates vcal_dict.py.
+"""A module that generates vcal_dict.py.
vcal_dict.py contains a dict of tuples (tzid, vcal_representation)
indexed by their pytz id.
Modified: schooltool/branches/upstream/current/src/schooltool/course/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/course/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/course/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/course/configure.zcml Fri Jul 13 10:48:08 2007
@@ -51,7 +51,7 @@
<class class=".section.SectionContainer">
<allow interface="zope.app.container.interfaces.ISimpleReadContainer" />
<require permission="schooltool.view"
- attributes="keys values items __iter__ __len__" />
+ attributes="keys values items __iter__ __len__ has_key" />
<require permission="schooltool.edit"
interface="zope.app.container.interfaces.IWriteContainer" />
</class>
Modified: schooltool/branches/upstream/current/src/schooltool/demographics/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/demographics/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/demographics/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/demographics/configure.zcml Fri Jul 13 10:48:08 2007
@@ -96,6 +96,18 @@
/>
</class>
+ <!-- sample data -->
+ <configure
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have devmode">
+
+ <utility
+ factory=".sampledata.SamplePersonalEvents"
+ provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
+ name="personal_events"
+ />
+ </configure>
+
<include package=".browser" />
</configure>
Modified: schooltool/branches/upstream/current/src/schooltool/demographics/overrides.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/demographics/overrides.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/demographics/overrides.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/demographics/overrides.zcml Fri Jul 13 10:48:08 2007
@@ -47,12 +47,6 @@
name="teachers"
/>
- <utility
- factory=".sampledata.SamplePersonalEvents"
- provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
- name="personal_events"
- />
-
</configure>
<!-- install catalog -->
Modified: schooltool/branches/upstream/current/src/schooltool/demographics/sampledata.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/demographics/sampledata.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/demographics/sampledata.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/demographics/sampledata.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Person sample data generation
-$Id: sampledata.py 6507 2006-11-30 13:18:21Z ignas $
+$Id: sampledata.py 7035 2007-07-12 15:19:06Z ignas $
"""
import datetime
@@ -57,6 +57,20 @@
# Number of persons to generate
power = 1000
+ def personFactory(self, namegen, prefixgen, gendergen, count):
+ first_name, last_name, full_name = namegen.generate()
+ person_id = 'student%03d' % count
+ person = Person(person_id, title=full_name)
+ person.nameinfo.prefix = prefixgen.generate()
+ person.nameinfo.first_name = first_name
+ person.nameinfo.last_name = last_name
+ person.setPassword(person_id)
+ person.demographics.gender = gendergen.generate()
+ person.schooldata.id = person.__name__
+ person.parent1.name = namegen.generate()[2]
+ person.parent2.name = namegen.generate()[2]
+ return person
+
def generate(self, app, seed=None):
namegen = NameGenerator(str(seed) + self.name)
prefixgen = ChoiceGenerator(str(seed), ['Mr', 'Mrs', 'Miss', ''])
@@ -71,24 +85,13 @@
stud_group = True
except KeyError:
stud_group = False
- for i in range(self.power):
- first_name, last_name, full_name = namegen.generate()
- person_id = 'student%03d' % i
- person = Person(person_id, title=full_name)
- person.nameinfo.prefix = prefixgen.generate()
- person.nameinfo.first_name = first_name
- person.nameinfo.last_name = last_name
- person.setPassword(person_id)
+ for count in range(self.power):
+ person = self.personFactory(namegen, prefixgen, gendergen, count)
# Without removeSecurityProxy we can't add members a
# group.
if stud_group:
removeSecurityProxy(students.members).add(person)
-
- person.demographics.gender = gendergen.generate()
- person.schooldata.id = person_id
- person.parent1.name = namegen.generate()[2]
- person.parent2.name = namegen.generate()[2]
- app['persons'][person_id] = person
+ app['persons'][person.__name__] = person
class SampleTeachers(object):
@@ -100,20 +103,24 @@
# Number of teachers to generate
power = 48
+ def personFactory(self, namegen, count):
+ first_name, last_name, full_name = namegen.generate()
+ person_id = 'teacher%03d' % count
+ person = Person(person_id, title=full_name)
+ person.nameinfo.first_name = first_name
+ person.nameinfo.last_name = last_name
+ person.setPassword(person_id)
+ return person
+
def generate(self, app, seed=None):
namegen = NameGenerator(str(seed) + self.name)
teachers = app['groups']['teachers']
- for i in range(self.power):
- first_name, last_name, full_name = namegen.generate()
- person_id = 'teacher%03d' % i
- person = Person(person_id, title=full_name)
- person.nameinfo.first_name = first_name
- person.nameinfo.last_name = last_name
- person.setPassword(person_id)
+ for count in range(self.power):
+ person = self.personFactory(namegen, count)
# Without removeSecurityProxy we can't add members a
# group.
removeSecurityProxy(teachers.members).add(person)
- app['persons'][person_id] = person
+ app['persons'][person.__name__] = person
class SamplePersonalEvents(object):
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/person-csvimport.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/person-csvimport.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/person-csvimport.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/person-csvimport.pt Fri Jul 13 10:48:08 2007
@@ -6,6 +6,11 @@
</title>
</head>
<body>
+
+ <span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+ </span>
<metal:block metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/person.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/person.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/person.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/person.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Person browser views.
-$Id: person.py 6967 2007-06-04 15:01:11Z ignas $
+$Id: person.py 7017 2007-07-11 19:32:00Z ignas $
"""
from zope.interface import Interface
from zope.publisher.interfaces import NotFound
@@ -46,6 +46,7 @@
from zope.component import queryAdapter
from zope.component import adapts
from zope.app.catalog.interfaces import ICatalog
+from zope.app.intid.interfaces import IIntIds
from schooltool import SchoolToolMessage as _
from schooltool.skin.form import BasicForm
@@ -228,9 +229,11 @@
if 'SEARCH_GROUP' in self.request:
group = ISchoolToolApplication(None)['groups'].get(self.request['SEARCH_GROUP'])
if group:
- keys = set([person.__name__ for person in group.members])
+ int_ids = getUtility(IIntIds)
+ keys = set([int_ids.queryId(person)
+ for person in group.members])
items = [item for item in items
- if item['key'] in keys]
+ if item['id'] in keys]
catalog = ICatalog(self.context)
index = catalog['title']
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/person_add.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/person_add.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/person_add.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/person_add.pt Fri Jul 13 10:48:08 2007
@@ -4,6 +4,12 @@
<title metal:fill-slot="title" i18n:translate="">Add person</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
+
<metal:nothing metal:fill-slot="content-header" />
<metal:block metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/person_container_delete.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/person_container_delete.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/person_container_delete.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/person_container_delete.pt Fri Jul 13 10:48:08 2007
@@ -6,6 +6,11 @@
</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
<h1 metal:fill-slot="content-header" i18n:translate="">
Are you sure you want to delete selected items?
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/person_edit.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/person_edit.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/person_edit.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/person_edit.pt Fri Jul 13 10:48:08 2007
@@ -4,6 +4,12 @@
<title metal:fill-slot="title" i18n:translate="">Edit person</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
+
<metal:nothing metal:fill-slot="content-header" />
<metal:block metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/person_preferences.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/person_preferences.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/person_preferences.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/person_preferences.pt Fri Jul 13 10:48:08 2007
@@ -4,6 +4,12 @@
<title metal:fill-slot="title" i18n:translate="">Edit person preferences</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
+
<metal:nothing metal:fill-slot="content-header" />
<metal:block metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/person/browser/tests.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/browser/tests.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/browser/tests.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/browser/tests.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Tests for Person views.
-$Id: tests.py 6851 2007-04-13 12:02:20Z ignas $
+$Id: tests.py 7017 2007-07-11 19:32:00Z ignas $
"""
import unittest
@@ -486,7 +486,8 @@
Some persons:
>>> class PersonStub(object):
- ... def __init__(self, title, groups):
+ ... def __init__(self, title, groups, person_id):
+ ... self.id = person_id
... self.title = title
... self.__name__ = title
... for group in groups:
@@ -514,7 +515,7 @@
... ('beta', [b, c]),
... ('lambda', [b])]
... for id, (title, groups) in enumerate(persons):
- ... self[title] = PersonStub(title, groups)
+ ... self[title] = PersonStub(title, groups, id)
... index.documents_to_values[id] = title
... def __conform__(self, iface):
... if iface == ICatalog:
@@ -567,28 +568,35 @@
>>> from zope.component import provideAdapter
>>> provideAdapter(StubApplication)
- >>> items = [{'id': 0, 'key': 'alpha'},
- ... {'id': 1, 'key': 'beta'},
- ... {'id': 2, 'key': 'lambda'}]
+ >>> items = [{'id': 0},
+ ... {'id': 1},
+ ... {'id': 2}]
>>> request.form = {'SEARCH_TITLE': 'lamb'}
>>> widget.filter(items)
- [{'id': 2, 'key': 'lambda'}]
+ [{'id': 2}]
+
+ >>> from zope.component import provideUtility
+ >>> from zope.app.intid.interfaces import IIntIds
+ >>> class IntIdsStub(object):
+ ... def queryId(self, obj):
+ ... return obj.id
+ >>> provideUtility(IntIdsStub(), IIntIds)
>>> request.form = {'SEARCH_GROUP': 'b'}
>>> widget.filter(items)
- [{'id': 1, 'key': 'beta'}, {'id': 2, 'key': 'lambda'}]
+ [{'id': 1}, {'id': 2}]
>>> request.form = {'SEARCH_GROUP': 'b',
... 'SEARCH_TITLE': 'bet'}
>>> widget.filter(items)
- [{'id': 1, 'key': 'beta'}]
+ [{'id': 1}]
The search is case insensitive:
>>> request.form = {'SEARCH_TITLE': 'AlphA'}
>>> widget.filter(items)
- [{'id': 0, 'key': 'alpha'}]
+ [{'id': 0}]
If clear search button is clicked, the form attribute is cleared,
and all items are displayed:
@@ -596,7 +604,7 @@
>>> request.form['CLEAR_SEARCH'] = 'Yes'
>>> widget.filter(items)
- [{'id': 0, 'key': 'alpha'}, {'id': 1, 'key': 'beta'}, {'id': 2, 'key': 'lambda'}]
+ [{'id': 0}, {'id': 1}, {'id': 2}]
>>> request.form['SEARCH_TITLE']
''
Modified: schooltool/branches/upstream/current/src/schooltool/person/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/person/configure.zcml Fri Jul 13 10:48:08 2007
@@ -101,6 +101,24 @@
factory=".person.getPersonContainerCatalog"
provides="zope.app.catalog.interfaces.ICatalog" />
+ <configure
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have devmode">
+
+ <utility
+ factory=".sampledata.SampleStudents"
+ provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
+ name="students"
+ />
+
+ <utility
+ factory=".sampledata.SampleTeachers"
+ provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
+ name="teachers"
+ />
+
+ </configure>
+
<include package=".browser" />
<include package=".rest" />
Added: schooltool/branches/upstream/current/src/schooltool/person/sampledata.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/person/sampledata.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/person/sampledata.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/person/sampledata.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,46 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2007 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Basic person sample data generation
+
+$Id: sampledata.py 7040 2007-07-12 16:50:03Z ignas $
+"""
+from schooltool.demographics.sampledata import SampleStudents
+from schooltool.demographics.sampledata import SampleTeachers
+from schooltool.person.person import Person
+
+
+class SampleStudents(SampleStudents):
+
+ def personFactory(self, namegen, prefixgen, gendergen, count):
+ first_name, last_name, full_name = namegen.generate()
+ person_id = 'student%03d' % count
+ person = Person(person_id, full_name)
+ person.setPassword(person_id)
+ return person
+
+
+class SampleTeachers(SampleTeachers):
+
+ def personFactory(self, namegen, count):
+ first_name, last_name, full_name = namegen.generate()
+ person_id = 'teacher%03d' % count
+ person = Person(person_id, full_name)
+ person.setPassword(person_id)
+ return person
Propchange: schooltool/branches/upstream/current/src/schooltool/person/sampledata.py
------------------------------------------------------------------------------
svn:eol-style = native
Modified: schooltool/branches/upstream/current/src/schooltool/skin/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/configure.zcml Fri Jul 13 10:48:08 2007
@@ -57,6 +57,7 @@
template="templates/actionsbar.pt"
/>
+
<!-- Skin and resources -->
<zope:interface
@@ -142,37 +143,51 @@
file="resources/editor_config.js"
layer="schooltool.skin.ISchoolToolLayer" />
+
+ <resource name="zonki-regular.png" file="resources/zonki-regular.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
+ <resource name="zonki-reading.png" file="resources/zonki-reading.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
+ <resource name="zonki-question.png" file="resources/zonki-question.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
+ <resource name="zonki-pointing.png" file="resources/zonki-pointing.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
+ <resource name="zonki-angry.png" file="resources/zonki-angry.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
+
+
+
<resource name="layout.css" file="resources/layout.css"
- layer="schooltool.skin.ISchoolToolLayer" />
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="print.css" file="resources/print.css"
- layer="schooltool.skin.ISchoolToolLayer" />
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="schooltool.js" file="resources/schooltool.js"
- layer="schooltool.skin.ISchoolToolLayer" />
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="jquery.js" file="resources/jquery.js"
- layer="schooltool.skin.ISchoolToolLayer" />
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="favicon.ico" file="resources/favicon.ico"
- layer="schooltool.skin.ISchoolToolLayer" />
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="toolbar-background.png"
- file="resources/toolbar-background.png"
- layer="schooltool.skin.ISchoolToolLayer" />
+ file="resources/toolbar-background.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="toolbar-background-hover.png"
- file="resources/toolbar-background-hover.png"
- layer="schooltool.skin.ISchoolToolLayer" />
+ file="resources/toolbar-background-hover.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="sidebar-background.png"
- file="resources/sidebar-background.png"
- layer="schooltool.skin.ISchoolToolLayer" />
+ file="resources/sidebar-background.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="sidebar-background-top.png"
- file="resources/sidebar-background-top.png"
- layer="schooltool.skin.ISchoolToolLayer" />
-
+ file="resources/sidebar-background-top.png"
+ layer="schooltool.skin.ISchoolToolLayer" />
+
<resource name="previous.png" file="resources/previous.png"
- layer="schooltool.skin.ISchoolToolLayer" />
+ layer="schooltool.skin.ISchoolToolLayer" />
<resource name="next.png" file="resources/next.png"
- layer="schooltool.skin.ISchoolToolLayer" />
-
+ layer="schooltool.skin.ISchoolToolLayer" />
+
<resource name="printer.png" file="resources/printer.png"
- layer="schooltool.skin.ISchoolToolLayer" />
-
+ layer="schooltool.skin.ISchoolToolLayer" />
+
<resource name="delete.png" file="resources/delete.png"
layer="schooltool.skin.ISchoolToolLayer" />
Modified: schooltool/branches/upstream/current/src/schooltool/skin/containers.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/containers.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/containers.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/containers.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
SchoolTool skin containers
-$Id: containers.py 6863 2007-04-16 14:50:03Z ignas $
+$Id: containers.py 7048 2007-07-13 08:47:12Z ignas $
"""
import urllib
@@ -50,7 +50,8 @@
searchstr = self.request['SEARCH'].lower()
results = [item for item in self.context.values()
if searchstr in item.title.lower()]
- extra_url = "&SEARCH=%s" % urllib.quote(self.request['SEARCH'])
+ search_string = self.request['SEARCH'].encode('utf-8')
+ extra_url = "&SEARCH=%s" % urllib.quote_plus(search_string)
else:
self.request.form['SEARCH'] = ''
results = self.context.values()
Modified: schooltool/branches/upstream/current/src/schooltool/skin/resources/favicon.ico
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/favicon.ico?rev=935&op=diff
==============================================================================
Binary files - no diff available.
Modified: schooltool/branches/upstream/current/src/schooltool/skin/resources/layout.css
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/layout.css?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/resources/layout.css (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/resources/layout.css Fri Jul 13 10:48:08 2007
@@ -138,6 +138,25 @@
#header .logo H1 {
margin: 0;
+}
+
+#header .logo .main_logo {
+ text-decoration: none;
+ color: #000;
+ font-size: 3em;
+}
+
+#schooltool-name {
+ margin: 3px 0 0 70px;
+ padding: 0;
+ font-size: .75em;
+}
+
+#school-title {
+ margin-top: -2px;
+ margin-left: 70px;
+ color: #444;
+ font-size: .5em;
}
#header .tools {
Modified: schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.css
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.css?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.css (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.css Fri Jul 13 10:48:08 2007
@@ -326,6 +326,7 @@
}
div .dropdown .title{
+ cursor: default;
font-size: 1em;
padding-right: .5ex;
padding-left: 15px;
@@ -333,7 +334,6 @@
}
div .dropdown:hover .title{
- border-bottom:1px solid #aaa;
background: #ddd url('++resource++downarrow.png') no-repeat center left;
}
Modified: schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.js
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.js?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.js (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/resources/schooltool.js Fri Jul 13 10:48:08 2007
@@ -18,7 +18,7 @@
//
// Javascript for Schoolbell calendar
//
-// $Id: schooltool.js 6887 2007-04-24 11:14:07Z ignas $
+// $Id: schooltool.js 7016 2007-07-11 19:22:57Z pcardune $
//
// Generic PopUp window function for calendar forms
@@ -79,3 +79,32 @@
tip.style.visibility = 'hidden';
tip = null;
}
+
+
+
+
+// Set up event handling for action bar drop downs.
+function initializeEventBindings(){
+
+ $(document).click(function(){
+ if (justClicked == false){
+ $("div.dropdown")
+ .removeClass("expanded")
+ .addClass("contracted");
+ }
+ else {
+ justClicked = false;
+ }
+ });
+
+ $("div.dropdown").each(function(i){
+ $(this).click(function() {
+ $(this)
+ .toggleClass("contracted")
+ .toggleClass("expanded");
+ justClicked = true;
+ });
+ });
+}
+
+$(document).ready(initializeEventBindings);
Added: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-angry.png
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-angry.png?rev=935&op=file
==============================================================================
Binary file - no diff available.
Propchange: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-angry.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-pointing.png
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-pointing.png?rev=935&op=file
==============================================================================
Binary file - no diff available.
Propchange: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-pointing.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-question.png
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-question.png?rev=935&op=file
==============================================================================
Binary file - no diff available.
Propchange: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-question.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-reading.png
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-reading.png?rev=935&op=file
==============================================================================
Binary file - no diff available.
Propchange: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-reading.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-regular.png
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-regular.png?rev=935&op=file
==============================================================================
Binary file - no diff available.
Propchange: schooltool/branches/upstream/current/src/schooltool/skin/resources/zonki-regular.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/actionsbar.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/actionsbar.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/actionsbar.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/actionsbar.pt Fri Jul 13 10:48:08 2007
@@ -3,9 +3,7 @@
tal:define="url view/context/@@absolute_url;
actions view/context/@@view_get_menu/schooltool_actions">
- <div class="dropdown contracted"
- onmouseover="this.className='dropdown expanded'"
- onmouseout="this.className='dropdown contracted'">
+ <div class="dropdown contracted">
<h3 class="title">Actions</h3>
<!-- old-style menu actions (obsolete) -->
<a tal:repeat="view actions"
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/container.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/container.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/container.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/container.pt Fri Jul 13 10:48:08 2007
@@ -6,6 +6,11 @@
</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-reading.png" />
+</span>
<h1 metal:fill-slot="content-header"
tal:content="view/index_title" i18n:translate="">Contents</h1>
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/container_delete.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/container_delete.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/container_delete.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/container_delete.pt Fri Jul 13 10:48:08 2007
@@ -6,6 +6,11 @@
</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
<h1 metal:fill-slot="content-header" i18n:translate="">
Are you sure you want to delete selected items?
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/edit_form.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/edit_form.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/edit_form.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/edit_form.pt Fri Jul 13 10:48:08 2007
@@ -1,5 +1,9 @@
<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
<body>
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
<metal:nothing metal:fill-slot="content-header" />
<metal:block metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/error.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/error.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/error.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/error.pt Fri Jul 13 10:48:08 2007
@@ -3,11 +3,17 @@
<title metal:fill-slot="title" i18n:translate="">Server Error</title>
</head>
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-angry.png" />
+</span>
+
<h1 metal:fill-slot="content-header" i18n:translate="">Server Error</h1>
<metal:block metal:fill-slot="body">
<p i18n:translate="">An internal server error has occurred. This most likely
-means that you have found a bug in SchoolBell. Please report it on <a
+means that you have found a bug in SchoolTool. Please report it on <a
href="http://issues.schooltool.org">the issue tracker</a>.</p>
<h2 i18n:translate="">Exception</h2>
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/navigation.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/navigation.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/navigation.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/navigation.pt Fri Jul 13 10:48:08 2007
@@ -1,6 +1,4 @@
-<div class="dropdown contracted"
- onmouseover="this.className='dropdown expanded'"
- onmouseout="this.className='dropdown contracted'">
+<div class="dropdown contracted">
<h3 class="title">Navigation</h3>
<tal:block repeat="viewlet options/viewlets"
content="structure viewlet/render" />
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/notfound.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/notfound.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/notfound.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/notfound.pt Fri Jul 13 10:48:08 2007
@@ -3,6 +3,11 @@
<title metal:fill-slot="title" i18n:translate="">Not Found</title>
</head>
<body>
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-pointing.png" />
+</span>
+
<h1 metal:fill-slot="content-header" i18n:translate="">Not Found</h1>
<metal:block metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_add.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_add.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_add.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_add.pt Fri Jul 13 10:48:08 2007
@@ -1,5 +1,11 @@
<html metal:use-macro="context/@@standard_macros/page" i18n:domain="schooltool">
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
+
<div metal:fill-slot="body">
<div metal:define-macro="addform">
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_edit.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_edit.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_edit.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/simple_edit.pt Fri Jul 13 10:48:08 2007
@@ -2,6 +2,12 @@
<html metal:use-macro="context/@@standard_macros/view"
i18n:domain="schooltool">
<body>
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-question.png" />
+</span>
+
<div metal:fill-slot="body">
<div metal:define-macro="body">
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/table_container.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/table_container.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/table_container.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/table_container.pt Fri Jul 13 10:48:08 2007
@@ -7,9 +7,13 @@
</head>
<body>
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-reading.png" />
+</span>
+
<h1 metal:fill-slot="content-header"
tal:content="view/index_title" i18n:translate="">Contents</h1>
-
<metal:block metal:fill-slot="body"
tal:define="canModify view/canModify">
<tal:block replace="structure view/table/batch/render" />
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/unauthorized.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/unauthorized.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/unauthorized.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/unauthorized.pt Fri Jul 13 10:48:08 2007
@@ -3,6 +3,11 @@
/><html metal:use-macro="context/@@standard_macros/page"
i18n:domain="zope">
<body i18n:domain="zope">
+
+<span metal:fill-slot="zonki" i18n:translate="">
+ <img src="zonki.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-angry.png" />
+</span>
<div metal:fill-slot="body">
Modified: schooltool/branches/upstream/current/src/schooltool/skin/templates/view_macros.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/skin/templates/view_macros.pt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/skin/templates/view_macros.pt (original)
+++ schooltool/branches/upstream/current/src/schooltool/skin/templates/view_macros.pt Fri Jul 13 10:48:08 2007
@@ -32,11 +32,15 @@
<body>
<div id="header">
<div class="logo">
- <a href=""
+ <a class="main_logo" href=""
tal:define="url context/schooltool:app/@@absolute_url"
tal:attributes="href url">
- <img src="logo.png" alt="SchoolTool" i18n:attributes="alt"
- tal:attributes="src context/++resource++logo.png"/>
+ <metal:block metal:define-slot="zonki">
+ <img src="logo.png" alt="SchoolTool" i18n:attributes="alt"
+ tal:attributes="src context/++resource++zonki-regular.png"/>
+ </metal:block>
+ <div id="schooltool-name"><span id="logo-left">School</span><span id="logo-right">Tool</span></div>
+ <div tal:content="context/schooltool:app/title" id="school-title">My Own School</div>
</a>
<tal:block replace="structure provider:schooltool.Header" />
</div>
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/README.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/README.txt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/README.txt (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/README.txt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,10 @@
+Base SchoolTool
+---------------
+
+This package contains the configuration and tests for an extemely minimal
+schooltool configuration.
+
+It's main purpose is to gather the dependencies and define a zcml
+configuration.
+
+Literally it defines the server.
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/__init__.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/__init__.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/__init__.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,1 @@
+# import this
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/configure.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/configure.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/configure.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="schooltool">
+
+ <include package="schooltool.help" file="meta.zcml" />
+
+ <include package="schooltool" />
+
+ <include package="schooltool.course" />
+ <include xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have devmode"
+ package="schooltool.devmode" />
+ <include package="schooltool.help" />
+ <include package="schooltool.term" />
+ <include package="schooltool.timetable" />
+
+ <!-- Provide local overrides of standard configurations-->
+ <includeOverrides package="schooltool.devmode" file="overrides.zcml" />
+
+</configure>
+
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/configure.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,33 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional Testing Utilities for stapp2005
+
+$Id: ftesting.py 7052 2007-07-13 10:04:17Z jfroche $
+"""
+import os
+
+from schooltool.testing.functional import ZCMLLayer
+
+dir = os.path.abspath(os.path.dirname(__file__))
+filename = os.path.join(dir, 'ftesting.zcml')
+
+stapp2005_functional_layer = ZCMLLayer(filename,
+ __name__,
+ 'stapp2005_functional_layer')
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,6 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope">
+
+ <include package="schooltool.stapp2005" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftesting.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/__init__.py?rev=935&op=file
==============================================================================
(empty)
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/stapp2005.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/stapp2005.txt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/stapp2005.txt (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/stapp2005.txt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,15 @@
+Teh Schooltool Application 2005
+===============================
+
+A manager logs in
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> manager = Browser()
+ >>> manager.addHeader('Authorization', 'Basic manager:schooltool')
+ >>> manager.handleErrors = False
+ >>> manager.open('http://localhost/')
+
+Create a Basic Person
+
+ >>> manager.getLink('Persons').click()
+
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/stapp2005.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/test_all.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/test_all.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/test_all.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/test_all.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,35 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional tests for schooltool.stapp2005
+
+$Id: test_all.py 7052 2007-07-13 10:04:17Z jfroche $
+"""
+
+import unittest
+
+from schooltool.testing.functional import collect_ftests
+from schooltool.stapp2005.ftesting import stapp2005_functional_layer
+
+def test_suite():
+ return collect_ftests(layer=stapp2005_functional_layer)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2005/ftests/test_all.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/README.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/README.txt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/README.txt (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/README.txt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,10 @@
+Standard SchoolTool
+-------------------
+
+This package contains the configuration and tests for a standard
+schooltool configuration.
+
+It's main purpose is to gather the dependencies and define a zcml
+configuration.
+
+Literally it defines the server.
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/__init__.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/__init__.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/__init__.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,1 @@
+#
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/configure.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/configure.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/configure.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="schooltool">
+
+ <include package="schooltool.help" file="meta.zcml" />
+
+ <include package="schooltool" />
+
+ <include package="schooltool.course" />
+ <include xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="have devmode"
+ package="schooltool.devmode" />
+ <include package="schooltool.help" />
+ <include package="schooltool.term" />
+ <include package="schooltool.timetable" />
+ <include package="schooltool.basicperson" />
+
+ <!-- Provide local overrides of standard configurations-->
+ <includeOverrides package="schooltool.basicperson" file="overrides.zcml" />
+ <includeOverrides package="schooltool.devmode" file="overrides.zcml" />
+
+</configure>
+
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/configure.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,33 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional Testing Utilities for stapp2007
+
+$Id: ftesting.py 7053 2007-07-13 10:07:30Z jfroche $
+"""
+import os
+
+from schooltool.testing.functional import ZCMLLayer
+
+dir = os.path.abspath(os.path.dirname(__file__))
+filename = os.path.join(dir, 'ftesting.zcml')
+
+stapp2007_functional_layer = ZCMLLayer(filename,
+ __name__,
+ 'stapp2007_functional_layer')
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,6 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope">
+
+ <include package="schooltool.stapp2007" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftesting.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/__init__.py?rev=935&op=file
==============================================================================
(empty)
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/stapp2007.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/stapp2007.txt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/stapp2007.txt (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/stapp2007.txt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,15 @@
+Teh Schooltool Application 2007
+===============================
+
+A manager logs in
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> manager = Browser()
+ >>> manager.addHeader('Authorization', 'Basic manager:schooltool')
+ >>> manager.handleErrors = False
+ >>> manager.open('http://localhost/')
+
+Create a Basic Person
+
+ >>> manager.getLink('Persons').click()
+
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/stapp2007.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/test_all.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/test_all.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/test_all.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/test_all.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,35 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional tests for schooltool.stapp2007
+
+$Id: test_all.py 7053 2007-07-13 10:07:30Z jfroche $
+"""
+
+import unittest
+
+from schooltool.testing.functional import collect_ftests
+from schooltool.stapp2007.ftesting import stapp2007_functional_layer
+
+def test_suite():
+ return collect_ftests(layer=stapp2007_functional_layer)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/stapp2007/ftests/test_all.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/__init__.py?rev=935&op=file
==============================================================================
(empty)
Propchange: schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/term.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/term.txt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/term.txt (added)
+++ schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/term.txt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,225 @@
+Without existing timetables related to the term
+===============================================
+
+A manager logs in
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> manager = Browser()
+ >>> manager.addHeader('Authorization', 'Basic manager:schooltool')
+ >>> manager.handleErrors = False
+ >>> manager.open('http://localhost/')
+
+Create a term
+ >>> manager.getLink('Terms').click()
+ >>> manager.getLink('New Term').click()
+ >>> manager.getControl('Title').value = 'Term 1'
+ >>> manager.getControl('Start date').value = '2007-07-01'
+ >>> manager.getControl('End date').value = '2007-07-12'
+ >>> manager.getControl('Next').click()
+ >>> manager.getControl('Saturday').click()
+ >>> manager.getControl('Sunday').click()
+ >>> manager.getControl('Add term').click()
+
+So now we have one term
+
+ >>> 'Term 1' in manager.contents
+ True
+ >>> manager.getControl(name='delete.term-1').value = True
+ >>> manager.getControl('Delete').click()
+ >>> 'Are you sure you want to delete the selected terms?' in manager.contents
+ True
+ >>> 'Term 1' in manager.contents
+ True
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ Are you sure you want to delete the selected terms?
+ ...
+ This term is used by 0 individual timetables.
+ ...
+ >>> manager.getControl('Confirm').click()
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ <h1>Terms</h1>
+ ...
+ <p>There are none.</p>
+ ...
+
+What now if we cancel the deletion ?
+
+Create a term
+ >>> manager.getLink('Terms').click()
+ >>> manager.getLink('New Term').click()
+ >>> manager.getControl('Title').value = 'Term 2'
+ >>> manager.getControl('Start date').value = '2007-07-01'
+ >>> manager.getControl('End date').value = '2007-07-12'
+ >>> manager.getControl('Next').click()
+ >>> manager.getControl('Saturday').click()
+ >>> manager.getControl('Sunday').click()
+ >>> manager.getControl('Add term').click()
+
+So now we have one term
+
+ >>> 'Term 2' in manager.contents
+ True
+ >>> manager.getControl(name='delete.term-2').value = True
+ >>> manager.getControl('Delete').click()
+ >>> manager.getControl('Cancel').click()
+
+We cancel so the term is still there:
+
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ <h1>Terms</h1>
+ ...
+ <a href="http://localhost/terms/term-2">Term 2</a>
+ ...
+
+
+With existing timetables related to the term
+============================================
+
+Create the timetable:
+
+ >>> manager.getLink('School Timetables').click()
+ >>> manager.getLink('New Timetable').click()
+ >>> manager.getLink('simple weekly timetable schema').click()
+ >>> manager.getControl(name='field.title').value = 'Simple Timetable'
+ >>> manager.getControl(name='field.period_name_1').value = 'A'
+ >>> manager.getControl(name='field.period_start_1').value = '9:00'
+ >>> manager.getControl(name='field.period_finish_1').value = '10:00'
+ >>> manager.getControl(name='field.period_name_2').value = 'B'
+ >>> manager.getControl(name='field.period_start_2').value = '10:30'
+ >>> manager.getControl(name='field.period_finish_2').value = '11:30'
+ >>> manager.getControl('Create').click()
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ <h1>School Timetables</h1>
+ ...
+ <a href="http://localhost/ttschemas/simple-timetable">Simple Timetable</a>
+ ...
+
+Create a course:
+
+ >>> manager.getLink('Courses').click()
+ >>> manager.getLink('New Course').click()
+ >>> manager.getControl(name='field.title').value = 'Math course'
+ >>> manager.getControl('Add').click()
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ <h1>Course index</h1>
+ ...
+ <a href="http://localhost/courses/math-course">Math course</a>
+ ...
+
+Create a section from the course:
+
+ >>> manager.getLink('Math course').click()
+ >>> manager.getLink('New Section').click()
+ >>> manager.getControl(name='field.title').value = 'Math 5'
+ >>> manager.getControl(name='add_input_name').value = 'MA5'
+ >>> manager.getControl('Add').click()
+
+Schedule the section in the timetable:
+
+ >>> manager.getLink('-- Math course (Math 5)').click()
+ >>> manager.getLink('Schedule').click()
+ >>> manager.getControl(name='Monday.A').value = True
+ >>> manager.getControl(name='Friday.B').value = True
+ >>> manager.getControl('Save').click()
+ >>> manager.getLink('Math 5').click()
+ >>> manager.getLink('View Timetables').click()
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ Timetables for Math 5
+ ...
+ <a href="http://localhost/sections/MA5/timetables/term-2.simple-timetable">term-2.simple-timetable</a>
+ ...
+
+Let's do the edit:
+ >>> manager.getLink('Term').click()
+ >>> manager.getLink('Term 2').click()
+ >>> manager.getLink('Edit').click()
+ >>> print analyze.queryHTML('id("content-body")', manager.contents)[0]
+ <div id="content-body">
+ <BLANKLINE>
+ <BLANKLINE>
+ <form class="plain" method="post" action="http://localhost/terms/term-2/@@edit.html">
+ <BLANKLINE>
+ <BLANKLINE>
+ <BLANKLINE>
+ <div class="row">
+ <BLANKLINE>
+ <div class="label">
+ <label for="field.title" title="">Title</label>
+ </div>
+ <p class="hint"></p>
+ <div class="field">
+ <input class="textType" id="field.title" name="field.title" size="20" type="text" value="Term 2"></div>
+ <div class="clear"> </div>
+ <BLANKLINE>
+ <BLANKLINE>
+ </div>
+ <BLANKLINE>
+ <div class="controls">
+ <input type="submit" class="button-ok" name="BASIC_UPDATE_SUBMIT" value="Save changes"></div>
+ <BLANKLINE>
+ </form>
+ <BLANKLINE>
+ <BLANKLINE>
+ </div>
+
+We just get the edition of the title as there is timetable related to this term.
+
+ >>> manager.getControl(name='field.title').value = 'Term 4'
+ >>> manager.getControl('Save changes').click()
+ >>> 'Saved changes.' in manager.contents
+ True
+ >>> manager.getControl(name='field.title').value
+ 'Term 4'
+
+Let's try to delete:
+
+ >>> manager.getLink('Terms').click()
+ >>> manager.getControl(name='delete.term-2').value = True
+ >>> manager.getControl('Delete').click()
+ >>> 'Are you sure you want to delete the selected terms?' in manager.contents
+ True
+ >>> 'Term 4' in manager.contents
+ True
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ Are you sure you want to delete the selected terms?
+ ...
+ This term is used by 1 individual timetables.
+ ...
+ >>> manager.getControl('Confirm').click()
+
+So the timetables should be also deleted:
+
+ >>> manager.getLink('Section').click()
+ >>> manager.getLink('Math 5').click()
+ >>> manager.getLink('View Timetables').click()
+ >>> print manager.contents
+ <BLANKLINE>
+ <BLANKLINE>
+ ...
+ <h3>Timetables</h3>
+ <ul>
+ </ul>
+ ...
+
+
Propchange: schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/term.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/test_all.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/test_all.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/test_all.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/test_all.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,35 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional tests for schooltool.term
+
+$Id: test_all.py 7036 2007-07-12 15:54:22Z jfroche $
+"""
+
+import unittest
+
+from schooltool.testing.functional import collect_ftests
+from schooltool.term.ftesting import term_functional_layer
+
+def test_suite():
+ return collect_ftests(layer=term_functional_layer)
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Propchange: schooltool/branches/upstream/current/src/schooltool/term/browser/ftests/test_all.py
------------------------------------------------------------------------------
svn:eol-style = native
Modified: schooltool/branches/upstream/current/src/schooltool/term/browser/term.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/browser/term.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/browser/term.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/term/browser/term.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Timetabling Term views.
-$Id: term.py 6602 2007-01-26 13:17:25Z ignas $
+$Id: term.py 7047 2007-07-13 08:40:46Z jfroche $
"""
import datetime
import itertools
@@ -45,13 +45,11 @@
from schooltool.timetable import findRelatedTimetables
from schooltool.term.interfaces import ITermContainer, ITerm
from schooltool.term.term import Term
-
from schooltool import SchoolToolMessage as _
class TermContainerView(TableContainerView):
"""Term container view."""
- # XXX ftest deletion!
__used_for__ = ITermContainer
@@ -65,11 +63,7 @@
def update(self):
if 'CONFIRM' in self.request:
for key in self.listIdsForDeletion():
- for tt in findRelatedTimetables(self.context[key]):
- ttdict = getParent(tt)
- del ttdict[getName(tt)]
del self.context[key]
-
class ITermForm(Interface):
"""Form schema for ITerm add/edit views."""
@@ -135,6 +129,9 @@
update_status = None
+ edit_template = ViewPageTemplateFile('term_add_edit.pt')
+ basic_edit_template = ViewPageTemplateFile('term_basic_add_edit.pt')
+
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
setUpEditWidgets(self, ITermForm)
@@ -143,6 +140,13 @@
title = _("Change Term: $title",
mapping={'title': self.context.title})
return title
+
+ def __call__(self):
+ relatedTT = findRelatedTimetables(self.context)
+ if relatedTT:
+ return self.basic_edit_template()
+ else:
+ return self.edit_template()
def update(self):
if self.update_status is not None:
@@ -151,13 +155,18 @@
self.term = self._buildTerm()
if self.term is None:
self.term = self.context
- elif Update in self.request:
+ if Update in self.request:
self.context.reset(self.term.first, self.term.last)
for day in self.term:
if self.term.isSchoolday(day):
self.context.add(day)
modified(self.context)
self.update_status = _("Saved changes.")
+ elif 'BASIC_UPDATE_SUBMIT' in self.request:
+ title = self.request.get('field.title')
+ if title:
+ self.context.title = title
+ self.update_status = _("Saved changes.")
return self.update_status
def calendar(self):
@@ -186,9 +195,22 @@
_set_before_add = ()
_set_after_add = ()
+ def setDefaultHoliday(self):
+ """
+ Set Saturday and Sunday as default holiday
+ """
+ date = self.term.first
+ while date <= self.term.last:
+ if date.isoweekday() in [6, 7]:
+ if self.term.isSchoolday(date):
+ self.term.remove(date)
+ date += datetime.date.resolution
+
def update(self):
"""Process the form."""
self.term = self._buildTerm()
+ if self.term: # we process the term after clicking the next button
+ self.setDefaultHoliday()
return AddView.update(self)
def create(self):
Added: schooltool/branches/upstream/current/src/schooltool/term/browser/term_basic_add_edit.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/browser/term_basic_add_edit.pt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/browser/term_basic_add_edit.pt (added)
+++ schooltool/branches/upstream/current/src/schooltool/term/browser/term_basic_add_edit.pt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,33 @@
+<tal:defs define="dummy view/update" />
+<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
+<head>
+ <title metal:fill-slot="title"
+ tal:content="view/title" i18n:translate="">Term</title>
+</head>
+<body>
+ <h1 metal:fill-slot="content-header"
+ tal:content="view/title" i18n:translate="">Term</h1>
+
+<metal:block metal:fill-slot="body">
+
+<form class="plain" method="post" tal:attributes="action request/URL">
+
+<div class="error" tal:condition="view/update_status"
+ tal:content="view/update_status" i18n:translate="">
+ [Status message]
+</div>
+
+ <div class="row" tal:define="widget nocall:view/title_widget">
+ <div metal:use-macro="context/@@form_macros/widget_row" />
+ </div>
+
+ <div class="controls" tal:condition="not:view/creating">
+ <input type="submit" class="button-ok" name="BASIC_UPDATE_SUBMIT"
+ value="Save changes" i18n:attributes="value" />
+ </div>
+
+</form>
+
+</metal:block>
+</body>
+</html>
Propchange: schooltool/branches/upstream/current/src/schooltool/term/browser/term_basic_add_edit.pt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: schooltool/branches/upstream/current/src/schooltool/term/browser/tests.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/browser/tests.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/browser/tests.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/term/browser/tests.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Tests for schooltool term views.
-$Id: tests.py 5999 2006-04-28 09:28:36Z faassen $
+$Id: tests.py 7047 2007-07-13 08:40:46Z jfroche $
"""
import datetime
import unittest
@@ -458,6 +458,23 @@
Week 34: 16 17 18 19 20 21 22
Week 35: 23 24 25 26 27 28 29
Week 36: 30 31
+
+ By Default, Saturday and Sunday are not school days:
+ >>> view.setDefaultHoliday()
+ >>> date = view.term.first
+ >>> while date <= view.term.last:
+ ... if not view.term.isSchoolday(date):
+ ... print date
+ ... date += datetime.date.resolution
+ 2004-08-01
+ 2004-08-07
+ 2004-08-08
+ 2004-08-14
+ 2004-08-15
+ 2004-08-21
+ 2004-08-22
+ 2004-08-28
+ 2004-08-29
'''
Modified: schooltool/branches/upstream/current/src/schooltool/term/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/term/configure.zcml Fri Jul 13 10:48:08 2007
@@ -42,6 +42,11 @@
set_schema=".interfaces.ITerm" />
</class>
+ <subscriber
+ for=".interfaces.ITerm
+ zope.app.container.interfaces.IObjectRemovedEvent"
+ handler="schooltool.timetable.schema.clearTimetablesOnDeletion" />
+
<!-- sample data -->
<configure
xmlns:zcml="http://namespaces.zope.org/zcml"
Added: schooltool/branches/upstream/current/src/schooltool/term/ftesting.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/ftesting.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/ftesting.py (added)
+++ schooltool/branches/upstream/current/src/schooltool/term/ftesting.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,33 @@
+#
+# SchoolTool - common information systems platform for school administration
+# Copyright (c) 2005 Shuttleworth Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""
+Functional Testing Utilities for terms
+
+$Id: ftesting.py 7036 2007-07-12 15:54:22Z jfroche $
+"""
+import os
+
+from schooltool.testing.functional import ZCMLLayer
+
+dir = os.path.abspath(os.path.dirname(__file__))
+filename = os.path.join(dir, 'ftesting.zcml')
+
+term_functional_layer = ZCMLLayer(filename,
+ __name__,
+ 'term_functional_layer')
Propchange: schooltool/branches/upstream/current/src/schooltool/term/ftesting.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/term/ftesting.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/ftesting.zcml?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/ftesting.zcml (added)
+++ schooltool/branches/upstream/current/src/schooltool/term/ftesting.zcml Fri Jul 13 10:48:08 2007
@@ -1,0 +1,9 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope">
+
+ <include package="schooltool" />
+ <include package="schooltool.course" />
+ <include package="schooltool.timetable" />
+ <include package="schooltool.term" />
+
+</configure>
Propchange: schooltool/branches/upstream/current/src/schooltool/term/ftesting.zcml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: schooltool/branches/upstream/current/src/schooltool/term/term.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/term/term.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/term/term.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/term/term.py Fri Jul 13 10:48:08 2007
@@ -19,9 +19,8 @@
"""
Term implementation
-$Id: term.py 6507 2006-11-30 13:18:21Z ignas $
+$Id: term.py 7043 2007-07-12 17:14:18Z jfroche $
"""
-import datetime
import persistent
import zope.interface
@@ -32,6 +31,7 @@
from schooltool.common import DateRange
from schooltool.term import interfaces
+from schooltool.timetable import findRelatedTimetables
class Term(DateRange, contained.Contained, persistent.Persistent):
@@ -134,3 +134,5 @@
if before:
return max(before)[1]
return None
+
+
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/browser/__init__.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/__init__.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/__init__.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/__init__.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
SchoolTool timetabling views.
-$Id: __init__.py 6887 2007-04-24 11:14:07Z ignas $
+$Id: __init__.py 7042 2007-07-12 16:59:55Z pcardune $
"""
import datetime
import sets
@@ -555,6 +555,67 @@
return group_sections
+class TimetableAddForm(TimetableSetupViewBase):
+
+ template = ViewPageTemplateFile('templates/timetable-add.pt')
+
+ def getTerms(self):
+ """Return the chosen term."""
+ if 'terms' in self.request:
+ terms = getSchoolToolApplication()['terms']
+ requested_terms = []
+
+ # request['terms'] may be a list of strings or a single string, we
+ # need to handle both cases
+ try:
+ requested_terms = requested_terms + self.request['terms']
+ except TypeError:
+ requested_terms.append(self.request['terms'])
+ return [terms[term] for term in requested_terms]
+ else:
+ return [getNextTermForDate(datetime.date.today()),]
+
+ def __call__(self):
+ context = removeSecurityProxy(self.context)
+ self.app = getSchoolToolApplication()
+ self.has_timetables = bool(self.app["terms"] and self.app["ttschemas"])
+ if not self.has_timetables:
+ return self.template()
+ self.terms = self.getTerms()
+ self.ttschema = self.getSchema()
+ self.ttkeys = ['.'.join((term.__name__, self.ttschema.__name__))
+ for term in self.terms]
+ if 'SUBMIT' in self.request:
+ section = removeSecurityProxy(self.context)
+ for key in self.ttkeys:
+ if context.get(key, None):
+ timetable = context[key]
+ else:
+ timetable = self.ttschema.createTimetable()
+ context[key] = timetable
+## for day_id, day in timetable.items():
+## for period_id, period in list(day.items()):
+## if '.'.join((day_id, period_id)) in self.request:
+## if not period:
+## # XXX Resource list is being copied
+## # from section as this view can't do
+## # proper resource booking
+## act = TimetableActivity(title=course_title,
+## owner=section,
+## resources=section.resources)
+## day.add(period_id, act)
+## else:
+## if period:
+## for act in list(period):
+## day.remove(period_id, act)
+
+ # TODO: find a better place to redirect to
+ self.request.response.redirect(
+ zapi.absoluteURL(self.context, self.request))
+ return self.template()
+
+
+# XXX: remove this class soon!
class SectionTimetableSetupView(TimetableSetupViewBase):
__used_for__ = ISection
@@ -662,6 +723,105 @@
zapi.absoluteURL(
ITimetables(self.context).timetables[self.ttkeys[0]],
self.request))
+
+ return self.template()
+
+
+class TimetableEditView(TimetableSetupViewBase):
+
+ __used_for__ = ISection
+
+ template = ViewPageTemplateFile('templates/timetable-edit.pt')
+
+ def getTerms(self):
+ """Return the chosen term."""
+ if 'terms' in self.request:
+ terms = getSchoolToolApplication()['terms']
+ requested_terms = []
+
+ # request['terms'] may be a list of strings or a single string, we
+ # need to handle both cases
+ try:
+ requested_terms = requested_terms + self.request['terms']
+ except TypeError:
+ requested_terms.append(self.request['terms'])
+ return [terms[term] for term in requested_terms]
+ else:
+ return [getNextTermForDate(datetime.date.today()),]
+
+ def getDays(self, ttschema):
+ """Return the current selection.
+
+ Returns a list of dicts with the following keys
+
+ title -- title of the timetable day
+ periods -- list of timetable periods in that day
+
+ Each period is represented by a dict with the following keys
+
+ title -- title of the period
+ selected -- a boolean whether that period is in self.context's tt
+ for this shcema
+
+ """
+ def days(schema):
+ for day_id, day in schema.items():
+ yield {'title': day_id,
+ 'periods': list(periods(day_id, day))}
+
+ def periods(day_id, day):
+ for period_id in day.periods:
+ selected = self.context[day_id][period_id]
+ yield {'title': period_id,
+ 'selected': selected}
+
+ return list(days(ttschema))
+
+ def __call__(self):
+ self.app = getSchoolToolApplication()
+ self.has_timetables = bool(self.app["terms"] and self.app["ttschemas"])
+ if not self.has_timetables:
+ return self.template()
+ self.terms = self.getTerms()
+ self.ttschema = self.getSchema()
+ self.ttkeys = ['.'.join((term.__name__, self.ttschema.__name__))
+ for term in self.terms]
+ self.days = self.getDays(self.ttschema)
+ #XXX dumb, this doesn't space course names
+ section = removeSecurityProxy(self.context.__parent__.__parent__)
+ course_title = ''.join([course.title
+ for course in section.courses])
+
+ if 'CANCEL' in self.request:
+ self.request.response.redirect(
+ zapi.absoluteURL(self.context, self.request))
+ if 'SAVE' in self.request:
+ for key in self.ttkeys:
+ if ITimetables(section).timetables.get(key, None):
+ timetable = ITimetables(section).timetables[key]
+ else:
+ timetable = self.ttschema.createTimetable()
+ ITimetables(section).timetables[key] = timetable
+ for day_id, day in timetable.items():
+ for period_id, period in list(day.items()):
+ if '.'.join((day_id, period_id)) in self.request:
+ if not period:
+ # XXX Resource list is being copied
+ # from section as this view can't do
+ # proper resource booking
+ act = TimetableActivity(title=course_title,
+ owner=section,
+ resources=section.resources)
+ day.add(period_id, act)
+ else:
+ if period:
+ for act in list(period):
+ day.remove(period_id, act)
+
+ # TODO: find a better place to redirect to
+ self.request.response.redirect(
+ zapi.absoluteURL(self.context,
+ self.request))
return self.template()
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/browser/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/configure.zcml Fri Jul 13 10:48:08 2007
@@ -48,6 +48,26 @@
<configure package="schooltool.skin">
<navigationViewlet
+ name="edit-section-timetable"
+ for="schooltool.timetable.interfaces.ITimetable"
+ manager="schooltool.skin.IActionMenuManager"
+ template="templates/actionsViewlet.pt"
+ permission="schooltool.edit"
+ link="edit.html"
+ title="Edit"
+ order="10"
+ />
+ <navigationViewlet
+ name="add-timetable"
+ for="schooltool.timetable.interfaces.ITimetableDict"
+ manager="schooltool.skin.IActionMenuManager"
+ template="templates/actionsViewlet.pt"
+ permission="schooltool.edit"
+ link="addTimetable.html"
+ title="Add Timetable"
+ order="10"
+ />
+ <navigationViewlet
name="schedule-section"
for="schooltool.course.interfaces.ISection"
manager="schooltool.skin.IActionMenuManager"
@@ -163,11 +183,25 @@
/>
<page
+ name="edit.html"
+ for="schooltool.timetable.interfaces.ITimetable"
+ class=".TimetableEditView"
+ permission="schooltool.edit"
+ />
+
+ <page
name="index.html"
for="schooltool.timetable.interfaces.ITimetableDict"
template="templates/timetable_list.pt"
permission="schooltool.view"
menu="zmi_views" title="View"
+ />
+
+ <page
+ name="addTimetable.html"
+ for="schooltool.timetable.interfaces.ITimetableDict"
+ class=".TimetableAddForm"
+ permission="schooltool.edit"
/>
<!-- ttwizard -->
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetable-events.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetable-events.txt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetable-events.txt (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetable-events.txt Fri Jul 13 10:48:08 2007
@@ -71,3 +71,43 @@
>>> print_table_cell_for_day('2005-09-12')
<a href="http://localhost/persons/frog/calendar/2005-09-12" class="cal_yearly_day_busy">12</a>
+
+Tests for Time Table editing
+----------------------------
+
+First log in as manager.
+
+ >>> manager = setup.logInManager()
+
+Now check the calendar for the history6a section. We should have a
+class from 9:30 to 10:25.
+
+ >>> manager.open('http://localhost/sections/history6a/calendar/2006-01-02')
+ >>> events = analyze.queryHTML('//span[@class="start-end"]', manager.contents)
+ >>> for event in events: print event
+ <BLANKLINE>
+ ...09:30...
+ ...10:25...
+ >>> for event in events: '10:30' not in event
+ True
+
+Now we will go and modify the schedule for history6a and see if the
+calendar events are updated
+
+ >>> manager.open('http://localhost/sections/history6a/@@schedule.html')
+ >>> manager.getControl(name="Monday.09:30-10:25").value = False
+ >>> manager.getControl(name="Monday.10:30-11:25").value = True
+ >>> manager.getControl("Save").click()
+ >>> print manager.contents
+ <BLANKLINE>
+ ...<th class="period" width="2%">10:30-11:25</th>
+ <td class="activity" width="18%">History 6</td>...
+
+ >>> manager.open('http://localhost/sections/history6a/calendar/2006-01-02')
+ >>> events = analyze.queryHTML('//span[@class="start-end"]', manager.contents)
+ >>> for event in events: print event
+ <BLANKLINE>
+ ...10:30...
+ ...11:25...
+ >>> for event in events: '09:30' not in event
+ True
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetabling.txt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetabling.txt?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetabling.txt (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/ftests/timetabling.txt Fri Jul 13 10:48:08 2007
@@ -297,11 +297,87 @@
<td class="activity" width="18%"></td>
</tr>
+We can also edit the timetable from the time table view.
+
+ >>> manager.getLink("Edit").click()
+ >>> manager.getControl(name="Wednesday.A").value = True
+ >>> manager.getControl(name="Monday.A").value = False
+ >>> manager.getControl(name="Thursday.B").value = True
+ >>> manager.getControl(name="Tuesday.B").value = False
+ >>> manager.getControl("Save").click()
+
+And now the timetable is updated.
+
+ >>> print analyze.queryHTML('//table/tr[2]', manager.contents)[0]
+ <tr><th class="period" width="2%">A</th>
+ <td class="activity" width="18%"></td>
+ <BLANKLINE>
+ <th class="period" width="2%">A</th>
+ <td class="activity" width="18%"></td>
+ <BLANKLINE>
+ <th class="period" width="2%">A</th>
+ <td class="activity" width="18%">Swimming</td>
+ <BLANKLINE>
+ <th class="period" width="2%">A</th>
+ <td class="activity" width="18%"></td>
+ <BLANKLINE>
+ <th class="period" width="2%">A</th>
+ <td class="activity" width="18%"></td>
+ </tr>
+
+ >>> print analyze.queryHTML('//table/tr[3]', manager.contents)[0]
+ <tr><th class="period" width="2%">B</th>
+ <td class="activity" width="18%"></td>
+ <BLANKLINE>
+ <th class="period" width="2%">B</th>
+ <td class="activity" width="18%"></td>
+ <BLANKLINE>
+ <th class="period" width="2%">B</th>
+ <td class="activity" width="18%"></td>
+ <BLANKLINE>
+ <th class="period" width="2%">B</th>
+ <td class="activity" width="18%">Swimming</td>
+ <BLANKLINE>
+ <th class="period" width="2%">B</th>
+ <td class="activity" width="18%"></td>
+ </tr>
+
+We can add another timetable schema and then add another timetable for
+this section based on the new schema.
+
+ >>> manager.open('http://localhost/ttschemas')
+ >>> manager.getLink('New Timetable').click()
+
+ >>> manager.getControl('Title').value = 'single-period'
+ >>> manager.getControl('Next').click()
+ >>> manager.getControl('Days of the week').click()
+ >>> manager.getControl('Same time each day').click()
+ >>> manager.getControl(name='field.times').value = """
+ ... 9:30-21:30
+ ... 21:35-21:45
+ ... """
+ >>> manager.getControl('Next').click()
+ >>> manager.getControl('Have names').click()
+ >>> manager.getControl(name='field.periods').value = """
+ ... A
+ ... B
+ ... """
+ >>> manager.getControl('Next').click()
+ >>> manager.getControl('Same').click()
+ >>> manager.getControl('Next').click()
+ >>> manager.getControl('No').click()
+
+ >>> manager.open('http://localhost:8000/sections/swimming--frog/timetables/addTimetable.html')
+ >>> manager.getControl(name='ttschema').value = ['singleperiod']
+ >>> manager.getControl('Add').click()
+ >>> manager.getLink('2005-fall.singleperiod').click()
+ >>> manager.getLink('Edit').click()
+
The activities should show up in the calendar of the users that are in
this section too:
>>> manager.open('http://localhost/'
- ... 'persons/frog/calendar/2005-09-05')
+ ... 'persons/frog/calendar/2005-09-07')
>>> print analyze.queryHTML('//h6[fn:contains(text(), "Swimming")]',
... manager.contents)[0]
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/browser/schema.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/schema.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/schema.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/schema.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Timetabling Schema views.
-$Id: schema.py 6602 2007-01-26 13:17:25Z ignas $
+$Id: schema.py 7043 2007-07-12 17:14:18Z jfroche $
"""
from zope.i18n import translate
from zope.component import adapts
@@ -238,9 +238,6 @@
def update(self):
if 'CONFIRM' in self.request:
for key in self.listIdsForDeletion():
- for tt in findRelatedTimetables(self.context[key]):
- ttdict = getParent(tt)
- del ttdict[getName(tt)]
del self.context[key]
self.request.response.redirect(self.nextURL())
elif 'CANCEL' in self.request:
Added: schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-add.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-add.pt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-add.pt (added)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-add.pt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,46 @@
+<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
+ <head>
+ <title metal:fill-slot="title" tal:content="context/__parent__/title" />
+ </head>
+ <body>
+ <metal:block metal:fill-slot="body">
+
+ <p tal:condition="not:view/has_timetables"
+ i18n:translate="">There are no terms or timetable schemas defined.</p>
+
+ <tal:if tal:condition="view/has_timetables">
+ <form tal:attributes="action request/URL" class="standalone" method="post">
+ <h3 i18n:translate="">Create a New Timetable</h3>
+ <fieldset tal:define="terms view/app/terms/values;
+ ttschemas view/app/ttschemas/values">
+ <legend i18n:translate="">Choose schedule template</legend>
+
+ <p i18n:translate="">For term(s):</p>
+
+ <tal:loop tal:repeat="term terms/sortby:first">
+ <input type="radio" name="terms"
+ tal:attributes="value term/__name__;
+ checked python:term in view.terms
+ and 'checked' or None" />
+ <span tal:content="term/title" i18n:translate="" />
+ </tal:loop>
+ <p i18n:translate="">Using timetable:</p>
+
+ <tal:loop tal:repeat="ttschema ttschemas/sortby:title">
+ <input type="radio" name="ttschema"
+ tal:attributes="value ttschema/__name__;
+ checked python:ttschema is view.ttschema
+ and 'checked' or None" />
+ <span tal:content="ttschema/title" i18n:translate="" />
+ </tal:loop>
+ </fieldset>
+ <div class="controls">
+ <input class="button-ok" type="submit" name="SUBMIT" value="Add"
+ i18n:attributes="value" />
+ </div>
+
+ </form>
+ </tal:if>
+ </metal:block>
+ </body>
+</html>
Propchange: schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-add.pt
------------------------------------------------------------------------------
svn:eol-style = native
Added: schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-edit.pt
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-edit.pt?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-edit.pt (added)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-edit.pt Fri Jul 13 10:48:08 2007
@@ -1,0 +1,87 @@
+<html metal:use-macro="view/@@standard_macros/page" i18n:domain="schooltool">
+<head>
+ <title metal:fill-slot="title" i18n:translate="">
+ Scheduling for <span i18n:name="section"
+ tal:define="section context/__parent__/__parent__"
+ tal:replace="section/label" i18n:translate="" />
+ </title>
+</head>
+<body>
+
+<h1 metal:fill-slot="content-header" i18n:translate="">
+ Scheduling for <span i18n:name="section"
+ tal:define="section context/__parent__/__parent__"
+ tal:replace="section/label" i18n:translate="" />
+</h1>
+
+<metal:block metal:fill-slot="body">
+
+<p tal:condition="not:view/has_timetables"
+ i18n:translate="">There are no terms or timetable schemas defined.</p>
+
+<tal:if tal:condition="view/has_timetables">
+
+ <div tal:define="terms view/app/terms/values;
+ ttschemas view/app/ttschemas/values">
+ <div i18n:translate="">For term(s):</div>
+ <strong tal:repeat="term terms/sortby:first"
+ tal:content="term/title" i18n:translate="" />
+
+ <div i18n:translate="">Using timetable:</div>
+
+ <strong tal:repeat="ttschema ttschemas/sortby:title"
+ tal:content="ttschema/title" i18n:translate="" />
+ </div>
+
+<form tal:attributes="action request/URL" class="plain" method="post">
+
+ <tal:loop repeat="term view/terms">
+ <input type="hidden" name="terms"
+ tal:attributes="value term/__name__" />
+ </tal:loop>
+ <input type="hidden" name="ttschema"
+ tal:attributes="value view/ttschema/__name__" />
+
+ <table class="timetable">
+ <tr>
+ <tal:block repeat="day view/days">
+ <th class="day" tal:content="day/title" i18n:translate="">Day N</th>
+ </tal:block>
+ </tr>
+ <tr>
+ <tal:block repeat="day view/days">
+ <td >
+ <ul>
+ <tal:block tal:repeat="period day/periods">
+ <li>
+ <input class="activity" type="checkbox"
+ tal:attributes="checked period/selected;
+ id string:${day/title}.${period/title};
+ name string:${day/title}.${period/title};
+ value string:${day/title}.${period/title}" />
+ <label class="period"
+ tal:attributes="for string:${day/title}.${period/title}"
+ tal:content="period/title">
+ Period N
+ </label>
+ </li>
+ </tal:block>
+ </ul>
+ </td>
+ </tal:block>
+ </tr>
+ </table>
+
+ <div class="controls">
+ <input class="button-ok" type="submit" name="SAVE" value="Save"
+ i18n:attributes="value" />
+ <input type="submit" class="button-cancel" name="CANCEL" value="Cancel"
+ i18n:attributes="value cancel-button" />
+ </div>
+
+</form>
+</tal:if>
+
+</metal:block>
+</body>
+</html>
Propchange: schooltool/branches/upstream/current/src/schooltool/timetable/browser/templates/timetable-edit.pt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/browser/tests/test_schema.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/browser/tests/test_schema.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/browser/tests/test_schema.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/browser/tests/test_schema.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Tests for schooltool timetable schema views.
-$Id: test_schema.py 6602 2007-01-26 13:17:25Z ignas $
+$Id: test_schema.py 7043 2007-07-12 17:14:18Z jfroche $
"""
import unittest
@@ -880,6 +880,11 @@
>>> ztapi.provideAdapter(IAttributeAnnotatable, ITimetables,
... TimetablesAdapter)
>>> setup.setUpAnnotations()
+ >>> from schooltool.timetable.schema import clearTimetablesOnDeletion
+ >>> from schooltool.timetable.interfaces import ITimetableSchema
+ >>> from zope.app.container.interfaces import IObjectRemovedEvent
+ >>> ztapi.subscribe([ITimetableSchema, IObjectRemovedEvent], None,
+ ... clearTimetablesOnDeletion)
Now, let's create a couple of timetables to operate on:
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/configure.zcml
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/configure.zcml?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/configure.zcml (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/configure.zcml Fri Jul 13 10:48:08 2007
@@ -192,6 +192,12 @@
handler=".model.addEventsToCalendar" />
<subscriber
+ for=".interfaces.ITimetableSchema
+ zope.app.container.interfaces.IObjectRemovedEvent"
+ handler=".schema.clearTimetablesOnDeletion" />
+
+
+ <subscriber
for="schooltool.timetable.interfaces.ITimetableActivityRemovedEvent"
handler=".model.removeEventsFromCalendar" />
Modified: schooltool/branches/upstream/current/src/schooltool/timetable/schema.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/timetable/schema.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/timetable/schema.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/timetable/schema.py Fri Jul 13 10:48:08 2007
@@ -19,7 +19,7 @@
"""
Timetable Schemas
-$Id: schema.py 6233 2006-06-12 17:52:59Z ignas $
+$Id: schema.py 7043 2007-07-12 17:14:18Z jfroche $
"""
from persistent import Persistent
from persistent.dict import PersistentDict
@@ -27,10 +27,12 @@
from zope.interface import implements
from zope.annotation.interfaces import IAttributeAnnotatable
+from zope.app import zapi
from zope.app.container.btree import BTreeContainer
from zope.app.container.contained import Contained
-from schooltool.timetable import Timetable, TimetableDay
+from schooltool.timetable import Timetable, TimetableDay, findRelatedTimetables
+
from schooltool.timetable.interfaces import ITimetableSchema
from schooltool.timetable.interfaces import ITimetableSchemaContained
from schooltool.timetable.interfaces import ITimetableSchemaContainer
@@ -160,3 +162,13 @@
def getDefault(self):
return self[self.default_id]
+
+def clearTimetablesOnDeletion(obj, event):
+ """
+ This event subscriber for term and schema will remove all timetable
+ related to the term
+ """
+ object = event.object
+ for tt in findRelatedTimetables(obj):
+ ttdict = zapi.getParent(tt)
+ del ttdict[zapi.getName(tt)]
Modified: schooltool/branches/upstream/current/src/schooltool/widget/password.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/src/schooltool/widget/password.py?rev=935&op=diff
==============================================================================
--- schooltool/branches/upstream/current/src/schooltool/widget/password.py (original)
+++ schooltool/branches/upstream/current/src/schooltool/widget/password.py Fri Jul 13 10:48:08 2007
@@ -35,14 +35,17 @@
style=self.style,
size=self.displayWidth,
extra=self.extra)
- # XXX we don't want label in the translatable string
- return translate(
- _(u'${password} <label for="${label}" title="">Confirm</label> ${confirm}',
- mapping={
- 'label': confirm_name,
- 'password': password_tag,
- 'confirm': confirm_tag}),
- context=self.request)
+
+ confirm_label = translate(_("confirm password", default="Confirm"),
+ context=self.request)
+ return u"""<div><div>%s</div>
+ <br />
+ <div class="label">
+ <label for="%s" title="">%s</label>
+ </div>
+ <div>%s</div>
+ </div>""" % (
+ password_tag, confirm_name, confirm_label, confirm_tag)
def _toFieldValue(self, input):
"""Check whether the confirmation field value is identical to
Added: schooltool/branches/upstream/current/utilities/generate_vcal_dict.py
URL: http://svn.debian.org/wsvn/pkg-zope/schooltool/branches/upstream/current/utilities/generate_vcal_dict.py?rev=935&op=file
==============================================================================
--- schooltool/branches/upstream/current/utilities/generate_vcal_dict.py (added)
+++ schooltool/branches/upstream/current/utilities/generate_vcal_dict.py Fri Jul 13 10:48:08 2007
@@ -1,0 +1,30 @@
+#!/usr/bin/env python
+"""A script that generates vcal_dict.py.
+
+vcal_dict.py contains a dict of tuples (tzid, vcal_representation)
+indexed by their pytz id.
+
+To generate the file when new version of Olson database appears follow
+these steps:
+
+1. Download vzic source code from:
+
+ http://dspace.dial.pipex.com/prod/dialspace/town/pipexdsl/s/asbm26/vzic/
+
+2. Apply vzic.patch to it (the patch was created for version 1.2 of
+ vzic).
+
+3. Follow the instructions in vzic README file to generate a set of
+ ics files.
+
+4. Run this script passing the name of the generated zoneinfo
+ directory as the first and only parameter.
+
+"""
+
+import os
+import sys
+from schooltool.calendar.generate_vcal_dict import main
+
+if __name__ == "__main__":
+ main(sys.argv)
Propchange: schooltool/branches/upstream/current/utilities/generate_vcal_dict.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: schooltool/branches/upstream/current/utilities/generate_vcal_dict.py
------------------------------------------------------------------------------
svn:executable = *
More information about the pkg-zope-commits
mailing list