- Timestamp:
- 26 Apr 2011, 10:35:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py
r5951 r5977 1 1 """Interfaces of academics specific objects. 2 2 """ 3 from zc.sourcefactory.basic import BasicSourceFactory4 3 from zope import schema 5 try:6 from zope.catalog.interfaces import ICatalog7 except ImportError:8 # BBB9 from zope.app.catalog.interfaces import ICatalog10 from zope.component import getUtility11 4 from zope.interface import Attribute 12 from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer, 13 SimpleWAeUPVocabulary) 14 15 class CourseSource(BasicSourceFactory): 16 """A course source delivers all courses inside the portal by looking 17 up a catalog. 18 """ 19 def getValues(self): 20 catalog = getUtility(ICatalog, name='courses_catalog') 21 return list(catalog.searchResults(code=('', 'z*'))) 22 23 def getToken(self, value): 24 return value.code 25 26 def getTitle(self, value): 27 return "%s - %s" % (value.code, value.title[:64]) 5 from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer) 6 7 from waeup.sirp.university.vocabularies import (course_levels, 8 semester, CourseSource) 28 9 29 10 class IFaculty(IWAeUPContainer): … … 151 132 title = u'Semester/Term', 152 133 default = 0, 153 vocabulary = SimpleWAeUPVocabulary( 154 ('N/A', 0), ('First Semester', 1), 155 ('Second Semester', 2), ('Combined', 3)), 134 vocabulary = semester, 156 135 required = True, 157 136 ) … … 199 178 ) 200 179 201 start_level = schema. TextLine(180 start_level = schema.Choice( 202 181 title = u'Start Level', 203 default = u'100', 204 required = True, 205 ) 206 207 end_level = schema.TextLine( 182 #source = LevelSource(), 183 vocabulary = course_levels, 184 default = 100, 185 required = True, 186 ) 187 188 end_level = schema.Choice( 208 189 title = u'End Level', 209 default = u'500', 190 #source = LevelSource(), 191 vocabulary = course_levels, 192 default = 500, 210 193 required = True, 211 194 ) … … 240 223 241 224 class ICertificateCourse(IWAeUPObject): 242 """A certificatecourse is a course referenced by a certificate, which225 """A certificatecourse is referring a course and 243 226 provides some own attributes. 244 227 """ 245 228 course = schema.Choice( 246 title = u'Course refer enced',229 title = u'Course referrer', 247 230 source = CourseSource(), 248 231 readonly = True, 249 232 ) 250 233 251 level = schema. Int(234 level = schema.Choice( 252 235 title = u'Level', 253 236 required = True, 254 default = 100, 237 #source = LevelSource(), 238 vocabulary = course_levels, 255 239 readonly = False, 256 240 ) … … 263 247 264 248 def getCourseCode(): 265 """Return the code of the referenced course.249 """Return the code of the course referred to. 266 250 267 251 This is needed for cataloging. … … 270 254 271 255 class ICertificateCourseAdd(ICertificateCourse): 272 """A certificatecourse is a course referenced by a certificate, which256 """A certificatecourse is referring a course and 273 257 provides some own attributes. 274 258 """ 275 259 course = schema.Choice( 276 title = u'Course to be referenced',260 title = u'Course', 277 261 source = CourseSource(), 278 262 readonly = False,
Note: See TracChangeset for help on using the changeset viewer.