Changeset 3557 for waeup/branches


Ignore:
Timestamp:
2 Jul 2008, 11:16:58 (16 years ago)
Author:
hraban
Message:

display viewlets work, forms don't

Location:
waeup/branches/hraban/src/waeup
Files:
2 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/hraban/src/waeup/app.py

    r3530 r3557  
    11import grok
    2 from grok import index
    3 from zope.interface import Interface
    4 from interfaces import IUniversity
     2#from zope.interface import Interface
     3from waeup.interfaces import IUniversity
    54from setup import app_setup
    6 from viewlets import MainArea
     5from waeup.viewlets import MainArea
    76
    87class University(grok.Application, grok.Container):
  • waeup/branches/hraban/src/waeup/basecontainer.py

    r3530 r3557  
    11import grok
    2 from baseitem import BaseItem
     2from waeup.interfaces import IBaseContainer
     3from waeup.baseitem import BaseItem
    34from waeup.viewlets import MainArea
    45
     
    89    base methods and templates attached to it
    910    """
    10    
     11    grok.implements(IBaseContainer)
    1112    name = u"BaseContainer"
    1213    childClass = None
     
    1415   
    1516class Content(grok.Viewlet):
    16     grok.viewletmanager(MainArea)
    1717    """
    1818    Base viewlet
    1919    """
     20    grok.viewletmanager(MainArea)
     21    #grok.context(grok.interfaces.IContainer)
    2022   
    2123class Add(grok.AddForm):
  • waeup/branches/hraban/src/waeup/basecontainer_templates/content.pt

    r3530 r3557  
    1     <h1 tal:content="context/name"></h1>
    2     <a href="" tal:attributes="href python:view.url(context.__parent__)">Up</a>
    3     <table>
    4         <tr>
    5             <th>Name</th>
    6         </tr>
    7         <tr tal:repeat="item context/values">
    8             <td><a href="" tal:content="item/name"
    9                            tal:attributes="href python:view.url(item)"></a></td>
    10         </tr>
    11     </table>
    12     <a href="" tal:attributes="href python:view.url(context, 'add')">Add</a>
    13     <a href=""
    14         tal:repeat="action context/specialActions"
    15         tal:attributes="href python:view.url(context, action)"
    16         tal:content="action">Add</a>
     1<div class="menubar">
     2        <ul>
     3                <li><a href="" tal:attributes="href python:view.url(context.__parent__)">Up</a></li>
     4                <li><a href="" tal:attributes="href python:view.url(context, 'add')">Add</a>
     5                <li tal:repeat="action context/specialActions">
     6                        <a href="" tal:attributes="href python:view.url(context, action)"
     7                        tal:content="action">Add</a>
     8                </li>
     9        </ul>
     10</div>
     11
     12<h2 tal:content="context/name"></h2>
     13<table class="datatable">
     14        <tr>
     15                <th>Name</th>
     16        </tr>
     17        <tr tal:repeat="item context/values">
     18                <td tal:repeat="prop item/items">
     19                        <a href="" tal:content="prop"
     20                        tal:attributes="href python:view.url(item)"></a>
     21                </td>
     22                <!--
     23                <td><a href="" tal:content="item/name"
     24                        tal:attributes="href python:view.url(item)"></a></td>
     25                -->
     26        </tr>
     27</table>
  • waeup/branches/hraban/src/waeup/baseitem.py

    r3545 r3557  
    1515class Content(grok.Viewlet):
    1616    grok.viewletmanager(MainArea)
     17    #grok.context(grok.interfaces.IContainer)
    1718
  • waeup/branches/hraban/src/waeup/catalog.py

    r3527 r3557  
    44from datetime import datetime
    55import os
    6 import grok
    7 from grok import index
     6import grok, grok.index
    87from hurry.query.query import Query, Text
    98from hurry.query import Eq
    10 from app import University
    11 from students.interfaces import IStudent
    12 from students.student import Student
     9from waeup.app import University
     10from waeup.students.interfaces import IStudent
     11from waeup.students.student import Student
     12from waeup.viewlets import MainArea, LeftSidebar
    1313
    1414class StudentIndexes(grok.Indexes):
     
    1717     grok.context(IStudent)
    1818
    19      name = index.Field(attribute='name')
     19     name = grok.index.Field(attribute='name')
    2020
    2121
    22 class StudentSearch(grok.View):
    23     grok.context(University)
     22class StudentSearch(grok.Viewlet):
     23    grok.context(IStudent)
     24    grok.viewletmanager(LeftSidebar)
     25    #grok.view(Student)
    2426
    2527    def update(self, query=None):
  • waeup/branches/hraban/src/waeup/catalog_templates/studentsearch.pt

    r3521 r3557  
    1 <html>
    2 <body>
     1<div class="portlet">
    32  <form>
    43    <div>
     
    1110       tal:content="item/name" >
    1211  </div>
    13 </body>
    14 </html>
     12</div>
  • waeup/branches/hraban/src/waeup/hostel/hostel.py

    r3531 r3557  
    11import grok
    22from waeup.baseitem import BaseItem
    3 from interfaces import IHostel
     3from waeup.hostel.interfaces import IHostel
    44
    55
  • waeup/branches/hraban/src/waeup/hostel/interfaces.py

    r3531 r3557  
    11##
    22## interfaces.py
    3 from zope.interface import Interface
     3import grok
    44from zope import schema
    55
    6 class IHostel(Interface):
    7     """Representation of a student.
     6class IHostel(grok.interfaces.IContainer):
     7    """Representation of a hostel (AKA hall).
    88    """
    99    name = schema.TextLine(
    1010        title = u'Name of Hostel',
    11         default = u'Nobody',
     11        default = u'Unnamed',
    1212        required = True,
    1313        )
  • waeup/branches/hraban/src/waeup/interfaces.py

    r3526 r3557  
    11##
    22## interfaces.py
    3 from zope.interface import Interface
     3import grok
     4#from zope.interface import Interface
    45from zope import schema
    56
    6 class IUniversity(Interface):
     7class IUniversity(grok.interfaces.IContainer):
    78    """Representation of a university.
    89    """
     
    1213        required = True,
    1314        )
     15
     16class IBaseContainer(grok.interfaces.IContainer):
     17    name = schema.TextLine(
     18        title = u'Name of Container',
     19        default = u'Unnamed Container',
     20        required = True
     21        )
     22   
  • waeup/branches/hraban/src/waeup/students/interfaces.py

    r3526 r3557  
    11##
    22## interfaces.py
    3 from zope.interface import Interface
     3import grok
    44from zope import schema
    55
    6 class IStudent(Interface):
     6class IStudent(grok.interfaces.IContainer):
    77    """Representation of a student.
    88    """
  • waeup/branches/hraban/src/waeup/students/student.py

    r3529 r3557  
    11import grok
    2 from grok import index
    32from interfaces import IStudent
    4 
    53from waeup.baseitem import BaseItem
    64
     
    86    #Factory method
    97    student = Student("Dummy")
    10     student.entry_mode, student.end_level, student.name, student.jamb_reg_no, student.level, student.id, student.lga, student.entry_session, student.matric_no, student.sex, student.phone, student.session, student.course, student.mode, student.faculty, student.department, student.verdict, student.review_state,  student.perm_address, student.email = a
     8    student.entry_mode, student.end_level, student.name, \
     9    student.jamb_reg_no, student.level, student.id, \
     10    student.lga, student.entry_session, student.matric_no, \
     11    student.sex, student.phone, student.session, \
     12    student.course, student.mode, student.faculty, \
     13    student.department, student.verdict, student.review_state, \
     14    student.perm_address, student.email = a
    1115    return student
    1216
  • waeup/branches/hraban/src/waeup/students/studentcontainer.py

    r3551 r3557  
    11import grok
    22import os
    3 
    43from waeup.basecontainer import BaseContainer
    54from student import Student, fromCsv
  • waeup/branches/hraban/src/waeup/university/faculty.py

    r3529 r3557  
    11import grok
    22from waeup.basecontainer import BaseContainer
    3 from interfaces import IFaculty
     3from waeup.university.interfaces import IFaculty
    44
    55class Faculty(BaseContainer):
  • waeup/branches/hraban/src/waeup/university/facultycontainer.py

    r3527 r3557  
    11import grok
    22from waeup.basecontainer import BaseContainer
    3 from interfaces import IFaculty
    4 from faculty import Faculty
     3from waeup.university.interfaces import IFaculty
     4from waeup.university.faculty import Faculty
    55
    66class FacultyContainer(BaseContainer):
    7    
     7    #grok.implements(grok.interfaces.IContainer)
    88    name = u'Faculties'
    99    childClass = Faculty
  • waeup/branches/hraban/src/waeup/university/interfaces.py

    r3526 r3557  
    1 from zope.interface import Interface
     1import grok
    22from zope import schema
    33
    4 class IFaculty(Interface):
     4class IFaculty(grok.interfaces.IContainer):
    55    """Representation of a university faculty.
    66    """
  • waeup/branches/hraban/src/waeup/viewlets.py

    r3530 r3557  
    11# -*- coding: utf-8 -*-
     2# viewlets.py
    23import grok
    3 import zope.interface
     4from grok.interfaces import IContainer
     5from zope.interface import Interface
    46from interfaces import IUniversity
    57
    6 grok.context(zope.interface.Interface)
     8grok.context(Interface)
    79
    810class Index(grok.View):
     
    1416
    1517class Head(grok.ViewletManager):
    16     """additions to HTML head"""
     18    """viewlet manager for the HTML head area"""
    1719    grok.name('head')
    1820
    1921class Title(grok.Viewlet):
     22    """defines html/head/title"""
    2023    grok.viewletmanager(Head)
    2124
    2225class AppCSS(grok.Viewlet):
     26    """loads the default application CSS (static/app.css)"""
    2327    grok.viewletmanager(Head)
    2428
    2529class Header(grok.ViewletManager):
     30    """viewlet manager for the head area of the page"""
    2631    grok.name('header')
    2732
    2833class Logo(grok.Viewlet):
     34    """display the logo"""
    2935    grok.viewletmanager(Header)
    3036    grok.order(1)
    3137
    3238class NavigationBar(grok.Viewlet):
     39    """display the menu bar
     40    (at the moment uses objects of the site as menu items)"""
    3341    grok.viewletmanager(Header)
    3442    grok.order(2)
     
    3846
    3947class LeftSidebar(grok.ViewletManager):
     48    """viewlet manager for the lefthand side bar
     49    that will contain some essential information
     50    about the displayed item"""
    4051    grok.name('left')
    4152
    4253class AuthUser(grok.Viewlet):
     54    """display the current user's name"""
    4355    grok.viewletmanager(LeftSidebar)
    4456    grok.view(Index)
     
    4658
    4759class Login(grok.Viewlet):
     60    """display an useless login form"""
    4861    grok.viewletmanager(LeftSidebar)
    4962    grok.context(IUniversity)
     
    5265
    5366class MainArea(grok.ViewletManager):
     67    """viewlet manager for the main content area"""
    5468    grok.name('main')
    55 
     69    #grok.context(IContainer)
    5670
    5771class Footer(grok.ViewletManager):
     72    """viewlet manager for the foot bar"""
    5873    grok.name('footer')
    5974
    6075class Copyright(grok.Viewlet):
     76    """display a copyright notice"""
    6177    grok.viewletmanager(Footer)
  • waeup/branches/hraban/src/waeup/viewlets_templates/logo.pt

    r3530 r3557  
    11<div id="logo">
    22    <img tal:attributes="src static/logo_waeup.gif" alt="WAeUp logo" />
    3     <h1>Sample University</h1>
     3    <h1 tal:content="context/name">Sample University</h1>
    44</div>
Note: See TracChangeset for help on using the changeset viewer.