Exemple #1
0
class ITaskInfo(Interface):
    """Scheduler task interface"""

    containers('.IScheduler')

    name = TextLine(title=_("Task name"),
                    description=_("Descriptive name given to this task"),
                    required=True)

    schedule_mode = Choice(
        title=_("Scheduling mode"),
        description=_("Scheduling mode defines how task will be scheduled"),
        vocabulary=TASK_SCHEDULING_MODES_VOCABULARY,
        required=True)

    keep_empty_reports = Bool(
        title=_("Keep empty reports history?"),
        description=_("If 'Yes', empty reports will be kept in task "
                      "history"),
        required=True,
        default=False)

    history_duration = Int(
        title=_("History duration"),
        description=_("Number of days during which execution reports are "
                      "kept in history; enter 0 to remove limit"),
        required=False)

    history_length = Int(
        title=_("History max length"),
        description=_(
            "Number of execution reports to keep in history; enter 0 "
            "to remove limit"),
        required=False)
Exemple #2
0
class IActivity(interfaces.IRequirement):
    '''An activity to be graded'''

    due_date = zope.schema.Date(
        title=_("Due Date"),
        description=_("The date the activity is due to be graded."),
        required=False)

    label = zope.schema.TextLine(
        title=_(u"Label"),
        description=_("The column label for the activity in the gradebook."),
        required=False)

    description = zope.schema.Text(title=_("Description"), required=False)

    category = zope.schema.Choice(
        title=_("Category"),
        description=_("The activity category"),
        vocabulary="schooltool.gradebook.category-vocabulary",
        required=True)

    scoresystem = scoresystem.ScoreSystemField(
        title=_("Scoresystem"),
        description=_("The activity scoresystem."),
        required=True)

    date = zope.schema.Date(
        title=_("Date"),
        description=_("The date the activity was created."),
        required=True)

    containers(IActivityWorksheet)
Exemple #3
0
class IActivityWorksheet(IWorksheet, IWorksheetAnnotatableMixin):
    '''A list of activities that must be fulfilled in a course or section.'''
    def canAverage():
        """return True if activities have scoresystems that can be averaged"""

    containers(IActivities)
    contains('.IActivity')
Exemple #4
0
class IReportWorksheet(interfaces.IRequirement, IWorksheetAnnotatableMixin):
    '''A worksheet template to get copied into section gradebooks.'''

    containers(IGradebookTemplates, IGradebookDeployed)
    contains('.IReportActivity')

    title = zope.schema.TextLine(
        title=_(u'Title'),
        description=_(u'Identifies the report sheet in teacher gradebooks.'))
Exemple #5
0
class IWorksheet(interfaces.IRequirement):
    '''A list of requirements that must be fulfilled in a course or section.'''

    deployed = zope.schema.Bool(title=u"Deployed Worksheet", required=False)

    hidden = zope.schema.Bool(title=u"Hidden Worksheet", required=False)

    containers(IWorksheets)
    contains('interfaces.IRequirement')
Exemple #6
0
class IDocument(IWorkflowManagedContent):
    """Document interface"""

    containers('.IDocumentFolder')

    oid = TextLine(title="Document OID",
                   description=_("Document unique identifier"),
                   readonly=True)

    def get_oid(self):
        """Generate new unique ID"""
Exemple #7
0
class IReportLayout(Interface):
    '''The layout of the report card for the school year'''

    columns = zope.schema.List(
        title=_('Columns'),
        description=_('Columns to be printed in the report card.'))

    outline_activities = zope.schema.List(
        title=_('Outline Activities'),
        description=_('Activities to be printed in the outline section.'))

    containers(IGradebookLayouts)
Exemple #8
0
class ITaskHistory(Interface):
    """Scheduler task history item interface"""

    containers(ITaskHistoryContainer)

    status = TextLine(title=_("Execution status"))

    date = Datetime(title=_("Execution start date"), required=True)

    duration = Float(title=_("Execution duration"), required=True)

    report = Text(title=_("Execution report"), required=True)
class IComment(IContained, ICommentaryBase):
    """Unified comment."""

    containers('.ICommentContainer')

    about = Relation(
        title = _('icomment-about-title',
                  u"About"),
        description = _('icomment-about-desc',
                        u"The item the comment is about."),
        precondition = [ICommentable],
        required = True,
        )
class ICommentAboutFigure(ICommentaryBase):
    """A comment about a figure."""

    containers('.ICommentAboutFigureContainer')

    figure = Relation(
        title = _('icommentaboutfigure-figure-title',
                  u"Figure"),
        description = _('icommentaboutfigure-figure-desc',
                        u"The item, the comment is about."),
        precondition = [zope.interface.Interface],
        required = True,
        )
Exemple #11
0
class ITerm(IDateRange, IContained):
    """A term is a set of school days inside a given date range."""
    containers('.ITermContainer')

    __name__ = zope.schema.TextLine(
        title=_("SchoolTool ID"),
        description=_("""An internal identifier of this term."""),
        required=True)

    title = zope.schema.TextLine(title=_("Title"))

    def isSchoolday(date):
        """Return whether the date is a schoolday.
Exemple #12
0
class ILocalizedFormattedEntry(IContained):

    containers('.ILocalizedFormattedEntriesContainer')

    __name__ = zope.interface.Attribute(
        """The language as latex style value.""")

    bibliographic_entries = zope.interface.Attribute(
        """This is a IFormattedBibliographicEntriesContainer.""")

    citations = zope.interface.Attribute(
        """This is a IFormattedCitationsContainer.""")

    citations_again = zope.interface.Attribute(
        """This is a IFormattedCitationsAgainContainer.""")
Exemple #13
0
class IFormattedString(IContained):
    """ A content object that stores a formatted bibliographic entry
    for a biblatex entry."""

    containers('.IFormattedStringsContainer')

    __name__ = zope.interface.Attribute(
        """Bibliography Style. There should be a bbx file with this
        name on the kpse path.""")

    formatted = zope.schema.Text(
        title=u"Formatted",
        description=u"The formatted bibliographic entry.",
        required=True,
        default=None,
    )
Exemple #14
0
class IPlugin(IContained, IAttributeAnnotatable):
    """Basic authentication plug-in interface"""

    containers('pyams_security.interfaces.IAuthentication')

    prefix = TextLine(
        title=_("Plug-in prefix"),
        description=_(
            "This prefix is mainly used by authentication plug-ins to "
            "mark principals"))

    title = TextLine(title=_("Plug-in title"), required=False)

    enabled = Bool(title=_("Enabled plug-in?"),
                   description=_("You can choose to disable any plug-in..."),
                   required=True,
                   default=True)
class IRequirement(IOrderedContainer, IContained):
    """Something a student can do.

    A requirement can contain further requirements that are needed to fulfill
    this requirement. You can think of those requirements as dependencies of
    this requirement. We will refer to those requirements from now on as
    dependencies or depoendency requirements.
    """

    contains('.IRequirement')
    containers('.IRequirement')

    title = zope.schema.TextLine(title=_(u"Title"),
                                 description=u'',
                                 required=True)

    def changePosition(name, pos):
        """Changes the requirement's position to the specified position."""
class IEvaluation(IScore, IContained):
    """An Evaluation"""

    containers(".IEvaluations")

    requirement = zope.schema.Object(
        title=u'Requirement',
        description=u'The requirement being evaluated.',
        schema=IRequirement)

    evaluatee = zope.schema.Object(
        title=u'Evaluatee',
        description=u'The entity receiving the evaluation',
        schema=zope.interface.Interface,
        readonly=True,
        required=True)

    evaluator = zope.schema.Object(
        title=u'Evaluator',
        description=u'The entity doing the evaluation',
        schema=zope.interface.Interface,
        required=True)
Exemple #17
0
class ILocalGroup(Interface):
    """Local principals group interface"""

    containers(IGroupsFolderPlugin)

    group_id = TextLine(
        title=_("Group ID"),
        description=_("This ID should be unique between all groups"),
        required=True,
        readonly=True)

    title = TextLine(title=_("Title"),
                     description=_("Public label of this group"),
                     required=True)

    description = Text(title=_("Description"), required=False)

    principals = PrincipalsSetField(
        title=_("Group principals"),
        description=_("IDs of principals contained in this group"),
        required=False,
        default=set())
Exemple #18
0
class ILevelContained(ILevel, IContained):
    """Level contained in an ILevelContainer."""

    containers(ILevelContainer)
Exemple #19
0
class IReportActivity(IActivity):
    '''A report card activity to be deployed to section activities'''

    containers(IReportWorksheet)
Exemple #20
0
class IDocumentFolder(IBTreeContainer):
    """Document folder interface"""

    containers('.IDocumentContainer', '.IDocumentFolder')
    contains(IDocument, '.IDocumentFolder')
Exemple #21
0
class IExample(IQuotation, IContained):
    """An example"""

    containers(IExampleContainerContainer)

    quid = TextLine(
        title=_('iexample-quid-title', u"Example"),
        description=_('iexample-quid-desc', u"What is given as example?"),
        required=True,
        default=u'',
        missing_value=u'',
    )

    pro_quo = TextLine(
        title=_('iexample-proquo-title', u"Denotation/Meaning"),
        description=_(
            'iexample-proquo-desc',
            u"What is the example associated with? What does it stand for?"),
        required=True,
        default=u'',
        missing_value=u'',
    )

    marker = TextLine(
        title=_('iexample-marker-title', u"Marker"),
        description=_(
            'iexample-marker-desc',
            u"How is the example indicated? ('e.g.', 'for instance', paranthesis etc.)"
        ),
        required=False,
        default=u'',
        missing_value=u'',
    )

    @zope.interface.invariant
    def assertQuidProQuo(example):
        if not (example.quid or example.pro_quo):
            raise zope.interface.Invalid(
                _('neitherquidnorproquo',
                  u"Either 'Example' or 'Denotation/Meaning' must be given!"))

    @zope.interface.invariant
    def assertTagsInHTMLQuotation(example):
        if example.source_type != 'html':
            return
        has_quid = has_proquo = False
        if quid_html_tag.search(example.quotation):
            has_quid = True
        if proquo_html_tag.search(example.quotation):
            has_proquo = True
        if not (has_quid or has_proquo):
            raise zope.interface.Invalid(
                _(
                    'nether-quid-nor-proquo-tag',
                    u"Missing tags for 'Example' and for 'Denotation/Meaning' in the quotation"
                ))
        if not has_quid:
            raise zope.interface.Invalid(
                _('no-quid-tag', u"Missing 'Example' tag in the quotation"))
        if not has_proquo:
            raise zope.interface.Invalid(
                _('no-proquo-tag',
                  u"Missing 'Denotation/Meaning' tag in the quotation"))
Exemple #22
0
class IContact(IContained):
    containers('.IContacts')
Exemple #23
0
class IBuddy(IContained):
    containers(IBuddyFolder)
Exemple #24
0
class ISectionContained(ISection, IContained):
    """Sections in a SectionContainer."""

    containers(ISectionContainer)
Exemple #25
0
class IGroupContained(IGroup, IContained):
    """Group contained in an IGroupContainer."""

    containers(IGroupContainer)
Exemple #26
0
class ICourseContained(ICourse, IContained):
    """Courses contained in an ICourseContainer."""

    containers(ICourseContainer)
Exemple #27
0
class IBaseResourceContained(IBaseResource, IContained):
    """Resource contained in an IResourceContainer."""

    containers(IResourceContainer)
Exemple #28
0
class IPersonContained(IPerson, IContained):
    """Person contained in an IPersonContainer."""

    containers(IPersonContainer)
Exemple #29
0
class IEmailContained(IEmail, IContained):
    """An IEmail object that is contained in a IEmailContainer"""

    containers(IEmailContainer)
Exemple #30
0
class ILocalUser(IAttributeAnnotatable):
    """Local user interface"""

    containers(IUsersFolderPlugin)

    login = TextLine(title=USER_LOGIN_TITLE, required=True, readonly=True)

    @invariant
    def check_login(self):
        """Set login as mail when missing"""
        if not self.login:
            self.login = self.email

    email = TextLine(title=_("User email address"), required=True)

    @invariant
    def check_email(self):
        """Check for invalid email address"""
        if not EMAIL_REGEX.match(self.email):
            raise Invalid(_("Given email address is not valid!"))

    firstname = TextLine(title=_("First name"), required=True)

    lastname = TextLine(title=_("Last name"), required=True)

    title = Attribute("User full name")

    company_name = TextLine(title=_("Company name"), required=False)

    password_manager = Choice(
        title=_("Password manager name"),
        description=_("Utility used to encrypt user password"),
        required=True,
        vocabulary=PASSWORD_MANAGERS_VOCABULARY_NAME,
        default='PBKDF2')

    password = EncodedPasswordField(title=_("Password"),
                                    min_length=8,
                                    required=False)

    confirmed_password = EncodedPasswordField(title=_("Confirmed password"),
                                              min_length=8,
                                              required=False)

    wait_confirmation = Bool(
        title=_("Wait confirmation?"),
        description=_("If 'no', user will be activated immediately without "
                      "waiting email confirmation"),
        required=True,
        default=True)

    @invariant
    def check_activated_user(self):
        """Check for missing password of activated user"""
        if not self.password and not self.wait_confirmation:
            raise Invalid(
                _("You can't activate an account without setting a password!"))

    self_registered = Bool(title=_("Self-registered profile?"),
                           required=True,
                           default=True,
                           readonly=True)

    activation_secret = TextLine(
        title=_("Activation secret key"),
        description=_("This private secret is used to create and check "
                      "activation hash"))

    activation_hash = TextLine(
        title=_("Activation hash"),
        description=_("This hash is provided into activation message URL. "
                      "Activation hash is missing for local users which "
                      "were registered without waiting their "
                      "confirmation."))

    activated = Bool(title=_("Activated"), required=True, default=False)

    activation_date = Datetime(title=_("Activation date"), required=False)

    def check_password(self, password):
        """Check user password against provided one"""

    def generate_secret(self, notify=True, request=None):
        """Generate secret key of this profile"""

    def refresh_secret(self, notify=True, request=None):
        """Refresh secret key of this profile"""

    def check_activation(self, hash, login, password):  # pylint: disable=redefined-builtin
        """Check activation for given settings"""

    def to_dict(self):
        """Get main user properties as mapping"""