Esempio n. 1
0
    def _reject_post(self, group, thread, redirecturl=None, ajax=False):
        success = False
        if thread.in_moderation_queue:
            thread.reject()
            meta.Session.commit()
            success = True

        if ajax:
            if success:
                return render_mako_def('mailinglist/administration.mako',
                                       'rejectedMessage')
            else:
                return render_mako_def('mailinglist/administration.mako',
                                       'warningMessage')

        if success:
            h.flash(_("Message %(link_to_message)s has been rejected.") % {
                'link_to_message': h.link_to(thread.subject, thread.url())
            })
        else:
            h.flash(_("Could not reject %(link_to_message)s as it was already approved.") % {
                'link_to_message': h.link_to(thread.subject, thread.url())
            })

        if redirecturl is None:
            redirecturl = group.url(controller='mailinglist', action='administration')

        redirect(redirecturl)
Esempio n. 2
0
 def render(self):
     if not self.page.isDeleted():
         return _("Page %(page)s of a subject %(subject)s was updated") % {
             'subject': self.context.title,
             'page': self.page.title}
     else:
         return _("Page %(link_to_page)s of a subject %(link_to_subject)s was updated") % {
             'link_to_subject': link_to(self.context.title, self.context.url()),
             'link_to_page': link_to(self.page.title, self.page.url())}
Esempio n. 3
0
 def html_news(self):
     if not self.file.isDeleted():
         return _('File %(file_title)s was uploaded.') % {
                'file_title': link_to(self.file.title,
                                      self.file.url(qualified=True))}
     else:
         return _('File %(file_title)s was uploaded.') % {'file_title': self.file.title}
Esempio n. 4
0
 def html_news(self):
     if not self.page.isDeleted():
         return _('Page %(page_title)s was updated.') % {
             'page_title': link_to(self.page.title,
                                   self.page.url(qualified=True))}
     else:
         return _('Page %(page_title)s was updated.') % {
             'page_title': self.page.title}
Esempio n. 5
0
 def render(self):
     if self.file.md5 is not None:
         if isinstance(self.context, Subject):
             return _("A new file %(link_to_file)s for a subject %(link_to_subject)s was uploaded") % {
                 'link_to_subject': link_to(self.context.title, self.context.url()),
                 'link_to_file': self.file_link()}
         elif isinstance(self.context, Group):
             return _("A new file %(link_to_file)s for a group %(link_to_group)s was uploaded") % {
                 'link_to_group': link_to(self.context.title, self.context.url()),
                 'link_to_file': self.file_link()}
     else:
         if isinstance(self.context, Subject):
             return _("A new folder '%(folder_title)s' for a subject %(link_to_subject)s was created") % {
                 'link_to_subject': link_to(self.context.title, self.context.url()),
                 'folder_title': self.file.folder}
         elif isinstance(self.context, Group):
             return _("A new folder '%(folder_title)s' for a group %(link_to_group)s was uploaded") % {
                 'link_to_group': link_to(self.context.title, self.context.url()),
                 'folder_title': self.file.folder}
Esempio n. 6
0
 def _protected_action(self, *args, **kwargs):
     if not check_crowds(['subject_accessor'], c.user, c.subject):
         location_link = ((c.subject.location.url(), ' '.join(c.subject.location.full_title_path))
                          if c.subject.visibility == 'department_members'
                          else (c.subject.location.root.url(), c.subject.location.root.title))
         deny(h.literal(_('Only %(location)s members can access see this subject.')
                        % dict(location=h.link_to(location_link[1], location_link[0]))), 401)
     c.user_can_edit_settings = c.user and (c.subject.edit_settings_perm == 'everyone' or check_crowds(['teacher', 'moderator'], c.user))
     c.user_can_post_discussions = c.user and (c.subject.post_discussion_perm == 'everyone' or check_crowds(['teacher', 'moderator'], c.user))
     return method(self, *args, **kwargs)
Esempio n. 7
0
 def render(self):
     return _("%(link_to_author)s sent an SMS: <em>%(text)s</em>") % {
         'link_to_author': link_to(self.outgoing_sms.sender.fullname, self.outgoing_sms.sender.url()),
         'text': self.sms_text()}
Esempio n. 8
0
 def render(self):
     return _("New forum post %(link_to_message)s posted on %(link_to_group)s forums") % {
         'link_to_group': link_to(self.context.title, self.context.url(new=True)),
         'link_to_message': link_to(self.post.title, self.post.url(new=True))}
Esempio n. 9
0
 def render(self):
     return _("New email post %(link_to_message)s was posted in %(link_to_group)s moderation queue") % {
         'link_to_group': link_to(self.context.title, self.context.url()),
         'link_to_message': link_to(self.message.subject, self.message.url())}
Esempio n. 10
0
 def render(self):
     return _("Teacher %(link_to_author)s sent message to the group %(link_to_group)s.") % {
         'link_to_author': link_to(self.user.fullname, self.user.url()),
         'link_to_group': link_to(self.context.title, self.context.url())}
Esempio n. 11
0
 def link_to_author(self):
     """Should be deprecated, when the old wall is gone."""
     info_dict = self.message.info_dict()
     return link_to(info_dict['author']['title'], info_dict['author']['url'])
Esempio n. 12
0
 def render(self):
     return _("%(link_to_author)s wrote on %(link_to_location)s wall.") % {
         'link_to_author': link_to(self.user.fullname, self.user.url()),
         'link_to_location': link_to(self.context.target_location.title, self.context.target_location.url())}
Esempio n. 13
0
 def render(self):
     return _("Group %(link_to_group)s stopped watching subject %(link_to_subject)s") % {
         'link_to_group': link_to(self.context.title, self.context.url()),
         'link_to_subject': link_to(self.subject.title, self.subject.url())}
Esempio n. 14
0
 def render(self):
     return _("%(link_to_author)s sent an private message: <em>%(text)s</em>") % {
         'link_to_author': link_to(self.private_message.sender.fullname, self.private_message.sender.url()),
         'text': self.message_text()}
Esempio n. 15
0
 def html_news(self):
     return _('Page %(page_title)s was created.') % {
         'page_title': link_to(self.context.title,
                               self.context.url(qualified=True))}
Esempio n. 16
0
 def file_link(self, short=False):
     limit = 23 if short else None
     if self.file.isDeleted():
         return ellipsis(self.file.title, limit) if short else self.file.title
     else:
         return link_to(self.file.title, self.file.url(qualified=False), limit)
Esempio n. 17
0
 def render(self):
     return _("New page %(link_to_page)s of a subject %(link_to_subject)s was created") % {
         'link_to_subject': link_to(self.context.title, self.context.url()),
         'link_to_page': link_to(self.page.title, self.page.url())}
Esempio n. 18
0
 def render(self):
     return _("Member %(link_to_user)s left the group %(link_to_group)s") % {
         'link_to_group': link_to(self.context.title, self.context.url()),
         'link_to_user': link_to(self.user.fullname, self.user.url())}
Esempio n. 19
0
 def render(self):
     return _("New subject %(link_to_subject)s was created") % {
         'link_to_subject': link_to(self.context.title, self.context.url())}
Esempio n. 20
0
 def render(self):
     return _("%(link_to_author)s wrote on %(link_to_subject)s wall.") % {
         'link_to_author': link_to(self.user.fullname, self.user.url()),
         'link_to_subject': link_to(self.context.subject.title, self.context.subject.url())}
Esempio n. 21
0
 def render(self):
     return _("New group %(link_to_group)s was created") % {
         'link_to_group': link_to(self.context.title, self.context.url())}
Esempio n. 22
0
 def render(self):
     return _('%(link_to_author)s wrote a blog post %(link_to_post)s.') % {
         'link_to_author': link_to(self.user.fullname, self.user.url()),
         'link_to_post': link_to(self.context.title, self.context.url())}
Esempio n. 23
0
 def render(self):
     return _("Subject %(link_to_subject)s was modified") % {
         'link_to_subject': link_to(self.context.title, self.context.url())}