Пример #1
0
    def new(self):
        # A person can only volunteer once
        if h.signed_in_person() and h.signed_in_person().volunteer:
            return redirect_to(action='edit',
                               id=h.signed_in_person().volunteer.id)

        return render('/volunteer/new.mako')
Пример #2
0
    def _new(self):
        person_results = self.form_result['person']
        proposal_results = self.form_result['proposal']
        attachment_results = self.form_result['attachment']

        proposal_results['status'] = ProposalStatus.find_by_name('Pending')

        c.proposal = Proposal(**proposal_results)
        meta.Session.add(c.proposal)

        if not h.signed_in_person():
            c.person = model.Person(**person_results)
            meta.Session.add(c.person)
            email(c.person.email_address,
                  render('/person/new_person_email.mako'))
        else:
            c.person = h.signed_in_person()
            for key in person_results:
                setattr(c.person, key, self.form_result['person'][key])

        c.person.proposals.append(c.proposal)

        if attachment_results is not None:
            c.attachment = Attachment(**attachment_results)
            c.proposal.attachments.append(c.attachment)
            meta.Session.add(c.attachment)

        meta.Session.commit()
        email(c.person.email_address,
              render('proposal/thankyou_mini_email.mako'))

        h.flash("Proposal submitted!")
        return redirect_to(controller='proposal', action="index", id=None)
Пример #3
0
    def _new(self):
        person_results = self.form_result['person']
        proposal_results = self.form_result['proposal']
        attachment_results = self.form_result['attachment']

        proposal_results['status'] = ProposalStatus.find_by_name('Pending')

        c.proposal = Proposal(**proposal_results)
        meta.Session.add(c.proposal)

        if not h.signed_in_person():
            c.person = model.Person(**person_results)
            meta.Session.add(c.person)
            email(c.person.email_address, render('/person/new_person_email.mako'))
        else:
            c.person = h.signed_in_person()
            for key in person_results:
                setattr(c.person, key, self.form_result['person'][key])

        c.person.proposals.append(c.proposal)

        if attachment_results is not None:
            c.attachment = Attachment(**attachment_results)
            c.proposal.attachments.append(c.attachment)
            meta.Session.add(c.attachment)

        meta.Session.commit()
        email(c.person.email_address, render('proposal/thankyou_mini_email.mako'))

        h.flash("Proposal submitted!")
        return redirect_to(controller='proposal', action="index", id=None)
Пример #4
0
    def __before__(self, **kwargs):
        if h.signed_in_person():
            c.can_edit = h.signed_in_person().has_role('organiser')
        else:
            c.can_edit = False

        c.subsubmenu = []
        c.subsubmenu.append([ '/programme/sunday', 'Sunday' ])
        c.scheduled_dates = TimeSlot.find_scheduled_dates()
        for scheduled_date in c.scheduled_dates:
            c.subsubmenu.append(['/programme/schedule/' + scheduled_date.strftime('%A').lower(), scheduled_date.strftime('%A')])

        c.subsubmenu.append([ '/programme/open_day', 'Saturday' ])
Пример #5
0
    def _review(self, id):
        """Review a funding application.
        """
        c.funding = Funding.find_by_id(id)
        c.signed_in_person = h.signed_in_person()
        c.next_review_id = Funding.find_next_proposal(c.funding.id, c.funding.type.id, c.signed_in_person.id)

        person = c.signed_in_person
        if person in [ review.reviewer for review in c.funding.reviews]:
            h.flash('Already reviewed')
            return redirect_to(action='review', id=c.next_review_id)

        results = self.form_result['review']
        if results['score'] == 'null':
          results['score'] = None

        review = FundingReview(**results)

        meta.Session.add(review)
        c.funding.reviews.append(review)

        review.reviewer = person

        meta.Session.commit()
        if c.next_review_id:
            return redirect_to(action='review', id=c.next_review_id)

        h.flash("No more funding applications to review")

        return redirect_to(action='review_index')
Пример #6
0
    def _check_invoice(self, person, invoice, ignore_overdue = False):
        c.invoice = invoice
        if person.invoices:
            if invoice.paid() or invoice.bad_payments().count() > 0:
                c.status = []
                if invoice.total()==0:
                  c.status.append('zero balance')
                if invoice.good_payments().count() > 0:
                  c.status.append('paid')
                  if invoice.good_payments().count()>1:
                    c.status[-1] += ' (%d times)' % invoice.good_payments().count()
                if invoice.bad_payments().count() > 0:
                  c.status.append('tried to pay')
                  if invoice.bad_payments().count()>1:
                    c.status[-1] += ' (%d times)' % invoice.bad_payments().count()
                c.status = ' and '.join(c.status)
                return render('/invoice/already.mako')

        if invoice.is_void():
            c.signed_in_person = h.signed_in_person()
            return render('/invoice/invalid.mako')
        if not ignore_overdue and invoice.overdue():
            for ii in invoice.items:
                if ii.product and not ii.product.available():
                    return render('/invoice/expired.mako')

        return None # All fine
Пример #7
0
    def _review(self, id):
        """Review a proposal.
        """
        c.proposal = Proposal.find_by_id(id)
        c.signed_in_person = h.signed_in_person()
        c.next_review_id = Proposal.find_next_proposal(c.proposal.id, c.proposal.type.id, c.signed_in_person.id)

        # TODO: currently not enough (see TODOs in model/proposal.py)
        #if not h.auth.authorized(h.auth.has_organiser_role):
        #    # You can't review your own proposal
        #    for person in c.proposal.people:
        #        if person.id == c.signed_in_person.id:
        #            h.auth.no_role()

        person = c.signed_in_person
        if person in [ review.reviewer for review in c.proposal.reviews]:
            h.flash('Already reviewed')
            return redirect_to(action='review', id=c.next_review_id)

        results = self.form_result['review']
        review = Review(**results)

        meta.Session.add(review)
        c.proposal.reviews.append(review)

        review.reviewer = person

        meta.Session.commit()

        if c.next_review_id:
            return redirect_to(action='review', id=c.next_review_id)

        h.flash("No more papers to review")

        return redirect_to(action='review_index')
Пример #8
0
    def _edit(self, id):
        # We need to recheck auth in here so we can pass in the id
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_submitter(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        if not h.auth.authorized(h.auth.has_organiser_role):
            if c.paper_editing == 'closed' and not h.auth.authorized(h.auth.has_late_submitter_role):
                return render("proposal/editing_closed.mako")
            elif c.paper_editing == 'not_open':
                return render("proposal/editing_not_open.mako")

        c.proposal = Proposal.find_by_id(id)
        for key in self.form_result['proposal']:
            setattr(c.proposal, key, self.form_result['proposal'][key])

        c.proposal.abstract = self.clean_abstract(c.proposal.abstract)

        c.person = self.form_result['person_to_edit']
        if (c.person.id == h.signed_in_person().id or
                             h.auth.authorized(h.auth.has_organiser_role)):
            for key in self.form_result['person']:
                setattr(c.person, key, self.form_result['person'][key])
            p_edit = "and author"
        else:
            p_edit = "(but not author)"

        meta.Session.commit()

        if lca_info['proposal_update_email'] != '':
            body = "Subject: %s Proposal Updated\n\nID:    %d\nTitle: %s\nType:  %s\nURL:   %s" % (h.lca_info['event_name'], c.proposal.id, c.proposal.title, c.proposal.type.name.lower(), "http://" + h.host_name() + h.url_for(action="view"))
            email(lca_info['proposal_update_email'], body)

        h.flash("Proposal %s edited!"%p_edit)
        return redirect_to('/proposal')
Пример #9
0
    def new(self):
        # call for miniconfs has closed
        if c.cfmini_status == 'closed':
            return render("proposal/closed_mini.mako")
        elif c.cfmini_status == 'not_open':
            return render("proposal/not_open_mini.mako")

        c.proposal_type = ProposalType.find_by_name('Miniconf')
        c.person = h.signed_in_person()

        defaults = {
            'proposal.type': c.proposal_type.id,
            'proposal.technical_requirements': "",
            'proposal.accommodation_assistance': 1,
            'proposal.travel_assistance': 1,
            'proposal.video_release': 0,
            'proposal.slides_release': 0,
            'person.name' : c.person.firstname + " " + c.person.lastname,
            'person.mobile' : c.person.mobile,
            'person.experience' : c.person.experience,
            'person.bio' : c.person.bio,
        }
 
        form = render("proposal/new_mini.mako")
        return htmlfill.render(form, defaults)
Пример #10
0
    def new(self):
        c.signed_in_person = h.signed_in_person()
        c.events = Event.find_all()
        c.schedule = Schedule.find_all()
        c.time_slot = TimeSlot.find_all()
        if not c.signed_in_person.registration:
          return render('/vote/no_rego.mako')
        c.votes = Vote.find_by_rego(c.signed_in_person.registration.id)
        defaults = {
            'vote.vote_value': 1 
        }
        args = request.GET
        eventid = args.get('eventid',0)
        revoke = args.get('revoke',0)
        c.eventid = eventid
        if int(eventid) != 0 and c.votes.count() < 4 and revoke == 0:
            c.vote = Vote()
            c.vote.rego_id = c.signed_in_person.registration.id
            c.vote.vote_value = 1
            c.vote.event_id = eventid
            meta.Session.add(c.vote)
            meta.Session.commit()
        if int(eventid) != 0 and int(revoke) != 0:
            c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id)
            meta.Session.delete(c.vote)
            meta.Session.commit()
            redirect_to('new')
  

        form = render('/vote/new.mako')
        return htmlfill.render(form, defaults)
Пример #11
0
    def review(self, id):
        c.funding = Funding.find_by_id(id)
        c.signed_in_person = h.signed_in_person()

        c.next_review_id = Funding.find_next_proposal(c.funding.id, c.funding.type.id, c.signed_in_person.id)

        return render('/funding/review.mako')
Пример #12
0
    def new(self):
        if c.cfp_status == 'closed':
           if not h.auth.authorized(h.auth.Or(h.auth.has_organiser_role, h.auth.has_late_submitter_role)):
              return render("proposal/closed.mako")
        elif c.cfp_status == 'not_open':
           return render("proposal/not_open.mako")

        c.person = h.signed_in_person()

        defaults = {
            'proposal.type': 1,
            'proposal.video_release': 1,
            'proposal.slides_release': 1,
            'proposal.travel_assistance' : 1,
            'proposal.accommodation_assistance' : 1,
            'person.name': c.person.firstname + " " + c.person.lastname,
            'person.mobile': c.person.mobile,
            'person.experience': c.person.experience,
            'person.bio': c.person.bio,
            'person.url': c.person.url,
        }
        defaults['person_to_edit'] = c.person.id
        defaults['name'] = c.person.firstname + " " + c.person.lastname
        form = render("proposal/new.mako")
        return htmlfill.render(form, defaults)
Пример #13
0
    def _check_invoice(self, person, invoice, ignore_overdue=False):
        c.invoice = invoice
        if person.invoices:
            if invoice.paid() or invoice.bad_payments().count() > 0:
                c.status = []
                if invoice.total() == 0:
                    c.status.append('zero balance')
                if invoice.good_payments().count() > 0:
                    c.status.append('paid')
                    if invoice.good_payments().count() > 1:
                        c.status[-1] += ' (%d times)' % invoice.good_payments(
                        ).count()
                if invoice.bad_payments().count() > 0:
                    c.status.append('tried to pay')
                    if invoice.bad_payments().count() > 1:
                        c.status[-1] += ' (%d times)' % invoice.bad_payments(
                        ).count()
                c.status = ' and '.join(c.status)
                return render('/invoice/already.mako')

        if invoice.is_void():
            c.signed_in_person = h.signed_in_person()
            return render('/invoice/invalid.mako')
        if not ignore_overdue and invoice.overdue():
            for ii in invoice.items:
                if ii.product and not ii.product.available():
                    return render('/invoice/expired.mako')

        return None  # All fine
Пример #14
0
    def new(self):
        # call for miniconfs has closed
        if c.cfmini_status == 'closed':
            return render("proposal/closed_mini.mako")
        elif c.cfmini_status == 'not_open':
            return render("proposal/not_open_mini.mako")

        c.proposal_type = ProposalType.find_by_name('Miniconf')
        c.person = h.signed_in_person()

        defaults = {
            'proposal.type': c.proposal_type.id,
            'proposal.technical_requirements': "",
            'proposal.accommodation_assistance': 1,
            'proposal.travel_assistance': 1,
            'proposal.video_release': 0,
            'proposal.slides_release': 0,
            'person.name': c.person.firstname + " " + c.person.lastname,
            'person.mobile': c.person.mobile,
            'person.experience': c.person.experience,
            'person.bio': c.person.bio,
        }

        form = render("proposal/new_mini.mako")
        return htmlfill.render(form, defaults)
Пример #15
0
    def _review(self, id):
        """Review a funding application.
        """
        c.funding = Funding.find_by_id(id)
        c.signed_in_person = h.signed_in_person()
        c.next_review_id = Funding.find_next_proposal(c.funding.id,
                                                      c.funding.type.id,
                                                      c.signed_in_person.id)

        person = c.signed_in_person
        if person in [review.reviewer for review in c.funding.reviews]:
            h.flash('Already reviewed')
            return redirect_to(action='review', id=c.next_review_id)

        results = self.form_result['review']
        if results['score'] == 'null':
            results['score'] = None

        review = FundingReview(**results)

        meta.Session.add(review)
        c.funding.reviews.append(review)

        review.reviewer = person

        meta.Session.commit()
        if c.next_review_id:
            return redirect_to(action='review', id=c.next_review_id)

        h.flash("No more funding applications to review")

        return redirect_to(action='review_index')
Пример #16
0
    def new(self):
        if c.cfp_status == 'closed':
            if not h.auth.authorized(
                    h.auth.Or(h.auth.has_organiser_role,
                              h.auth.has_late_submitter_role)):
                return render("proposal/closed.mako")
        elif c.cfp_status == 'not_open':
            return render("proposal/not_open.mako")

        c.person = h.signed_in_person()

        defaults = {
            'proposal.type': 1,
            'proposal.video_release': 1,
            'proposal.slides_release': 1,
            'proposal.travel_assistance': 1,
            'proposal.accommodation_assistance': 1,
            'person.name': c.person.firstname + " " + c.person.lastname,
            'person.mobile': c.person.mobile,
            'person.experience': c.person.experience,
            'person.bio': c.person.bio,
            'person.url': c.person.url,
        }
        defaults['person_to_edit'] = c.person.id
        defaults['name'] = c.person.firstname + " " + c.person.lastname
        form = render("proposal/new.mako")
        return htmlfill.render(form, defaults)
Пример #17
0
 def _revoke(self):
     args = request.GET
     eventid = int(args.get('eventid',0))
     c.signed_in_person = h.signed_in_person()
     c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id)
     meta.Session.delete(c.vote)
     meta.Session.commit()
     redirect_to('new')
Пример #18
0
    def delete(self, id):
        c.review = Review.find_by_id(id)
        
        if c.review.reviewer.id != h.signed_in_person().id:
            # Raise a no_auth error
            h.auth.no_role()

        return render('/review/confirm_delete.mako')
Пример #19
0
    def index(self):
        c.admin = h.auth.authorized(h.auth.has_organiser_role)
        if c.admin:
            c.vouchers = Voucher.find_all()
        else:
            c.vouchers = h.signed_in_person().vouchers

        return render('/voucher/list.mako')
Пример #20
0
    def index(self):
        c.admin = h.auth.authorized(h.auth.has_organiser_role)
        if c.admin:
            c.vouchers = Voucher.find_all()
        else:
            c.vouchers = h.signed_in_person().vouchers

        return render('/voucher/list.mako')
Пример #21
0
    def delete(self, id):
        c.review = Review.find_by_id(id)

        if c.review.reviewer.id != h.signed_in_person().id:
            # Raise a no_auth error
            h.auth.no_role()

        return render('/review/confirm_delete.mako')
Пример #22
0
    def new(self):
        defaults = {'rego_note.by': h.signed_in_person().id}
        raw_params = request.params
        if 'rego_id' in raw_params:
            c.rego_id = int(raw_params['rego_id'])
            defaults['rego_note.rego'] = c.rego_id

        form = render('/rego_note/new.mako')
        return htmlfill.render(form, defaults)
Пример #23
0
    def delete(self, id):
        c.attachment = FundingAttachment.find_by_id(id)
        c.funding = Funding.find_by_id(c.attachment.funding_id)
        
        if not (h.auth.authorized(h.auth.has_organiser_role) or c.funding.person == h.signed_in_person()):
            # Raise a no_auth error
            h.auth.no_role()

        return render('/funding_attachment/confirm_delete.mako')
Пример #24
0
    def new(self):
        defaults = {"rego_note.by": h.signed_in_person().id}
        raw_params = request.params
        if "rego_id" in raw_params:
            c.rego_id = int(raw_params["rego_id"])
            defaults["rego_note.rego"] = c.rego_id

        form = render("/rego_note/new.mako")
        return htmlfill.render(form, defaults)
Пример #25
0
    def review(self, id):
        c.funding = Funding.find_by_id(id)
        c.signed_in_person = h.signed_in_person()

        c.next_review_id = Funding.find_next_proposal(c.funding.id,
                                                      c.funding.type.id,
                                                      c.signed_in_person.id)

        return render('/funding/review.mako')
Пример #26
0
    def signin(self):

        role_error = session.pop('role_error', None)
        if role_error:
            h.flash(role_error)
        elif h.signed_in_person():
            h.flash("You're already logged in")
            redirect_to('home')

        return render('/person/signin.mako')
Пример #27
0
    def signin(self):

        role_error = session.pop('role_error', None)
        if role_error:
            h.flash(role_error)
        elif h.signed_in_person():
            h.flash("You're already logged in")
            redirect_to('home')

        return render('/person/signin.mako')
Пример #28
0
    def delete(self, id):
        c.attachment = FundingAttachment.find_by_id(id)
        c.funding = Funding.find_by_id(c.attachment.funding_id)

        if not (h.auth.authorized(h.auth.has_organiser_role)
                or c.funding.person == h.signed_in_person()):
            # Raise a no_auth error
            h.auth.no_role()

        return render('/funding_attachment/confirm_delete.mako')
Пример #29
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('funding_reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for ft in c.funding_types:
            stuff = Funding.find_all_by_funding_type_id(ft.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % ft.name, stuff)

        return render('funding/list_review.mako')
Пример #30
0
    def new(self):
        defaults = {
            'rego_room.by': h.signed_in_person().id
        }
        raw_params = request.params
        if 'rego_id' in raw_params:
            c.rego_id = int(raw_params['rego_id'])
            defaults['rego_room.rego'] = c.rego_id

        form = render('/rego_room/new.mako')
        return htmlfill.render(form, defaults)
Пример #31
0
    def _new(self):
        if c.cfp_status == 'closed':
            if not h.auth.authorized(
                    h.auth.Or(h.auth.has_organiser_role,
                              h.auth.has_late_submitter_role)):
                return render("proposal/closed.mako")
        elif c.cfp_status == 'not_open':
            return render("proposal/not_open.mako")

        person_results = self.form_result['person']
        proposal_results = self.form_result['proposal']
        attachment_results = self.form_result['attachment']

        proposal_results['status'] = ProposalStatus.find_by_name('Pending')

        c.proposal = Proposal(**proposal_results)
        c.proposal.abstract = self.clean_abstract(c.proposal.abstract)
        meta.Session.add(c.proposal)

        if not h.signed_in_person():
            c.person = model.Person(**person_results)
            meta.Session.add(c.person)
            email(c.person.email_address,
                  render('/person/new_person_email.mako'))
        else:
            c.person = h.signed_in_person()
            for key in person_results:
                setattr(c.person, key, self.form_result['person'][key])

        c.person.proposals.append(c.proposal)

        if attachment_results is not None:
            attachment = Attachment(**attachment_results)
            c.proposal.attachments.append(attachment)
            meta.Session.add(attachment)

        meta.Session.commit()
        email(c.person.email_address, render('proposal/thankyou_email.mako'))

        h.flash("Proposal submitted!")
        return redirect_to(controller='proposal', action="index", id=None)
Пример #32
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('funding_reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for ft in c.funding_types:
            stuff = Funding.find_all_by_funding_type_id(
                ft.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % ft.name, stuff)

        return render('funding/list_review.mako')
Пример #33
0
    def _delete(self, id):
        c.review = Review.find_by_id(id)

        if c.review.reviewer.id != h.signed_in_person().id:
            # Raise a no_auth error
            h.auth.no_role()

        meta.Session.delete(c.review)
        meta.Session.commit()

        h.flash("Review Deleted")
        redirect_to(controller='review', action='index')
Пример #34
0
    def _new(self):
        results = self.form_result["volunteer"]

        c.volunteer = Volunteer(**results)
        c.volunteer.person = h.signed_in_person()
        c.person = c.volunteer.person
        meta.Session.add(c.volunteer)
        meta.Session.commit()

        h.flash("Thank you for volunteering. We will contact you shortly regarding your application")
        email(c.person.email_address, render("volunteer/response.mako"))
        redirect_to(action="view", id=c.volunteer.id)
Пример #35
0
    def _delete(self, id):
        c.review = Review.find_by_id(id)

        if c.review.reviewer.id != h.signed_in_person().id:
            # Raise a no_auth error
            h.auth.no_role()

        meta.Session.delete(c.review)
        meta.Session.commit()

        h.flash("Review Deleted")
        redirect_to(controller='review', action='index')
Пример #36
0
    def _delete(self, id):
        c.attachment = FundingAttachment.find_by_id(id)
        funding = Funding.find_by_id(c.attachment.funding_id)

        if not (h.auth.authorized(h.auth.has_organiser_role) or funding.person == h.signed_in_person()):
            # Raise a no_auth error
            h.auth.no_role()

        meta.Session.delete(c.attachment)
        meta.Session.commit()

        h.flash("Attachment Deleted")
        redirect_to(controller='funding', action='view', id=funding.id)
Пример #37
0
    def edit(self, id):
        c.form = 'edit'
        c.review = Review.find_by_id(id)
        self._is_reviewer()

        c.proposal = c.review.proposal
        defaults = h.object_to_defaults(c.review, 'review')
        if defaults['review.score'] == 1 or defaults['review.score'] == 2:
            defaults['review.score'] = '+%s'  % defaults['review.score']

        c.signed_in_person = h.signed_in_person()
        form = render('/review/edit.mako')
        return htmlfill.render(form, defaults)
Пример #38
0
    def edit(self, id):
        c.form = 'edit'
        c.review = Review.find_by_id(id)
        self._is_reviewer()

        c.proposal = c.review.proposal
        defaults = h.object_to_defaults(c.review, 'review')
        if defaults['review.score'] == 1 or defaults['review.score'] == 2:
            defaults['review.score'] = '+%s' % defaults['review.score']

        c.signed_in_person = h.signed_in_person()
        form = render('/review/edit.mako')
        return htmlfill.render(form, defaults)
Пример #39
0
    def _new(self):
        if c.cfp_status == 'closed':
           if not h.auth.authorized(h.auth.Or(h.auth.has_organiser_role, h.auth.has_late_submitter_role)):
              return render("proposal/closed.mako")
        elif c.cfp_status == 'not_open':
           return render("proposal/not_open.mako")

        person_results = self.form_result['person']
        proposal_results = self.form_result['proposal']
        attachment_results = self.form_result['attachment']

        proposal_results['status'] = ProposalStatus.find_by_name('Pending')

        c.proposal = Proposal(**proposal_results)
        c.proposal.abstract = self.clean_abstract(c.proposal.abstract)
        meta.Session.add(c.proposal)

        if not h.signed_in_person():
            c.person = model.Person(**person_results)
            meta.Session.add(c.person)
            email(c.person.email_address, render('/person/new_person_email.mako'))
        else:
            c.person = h.signed_in_person()
            for key in person_results:
                setattr(c.person, key, self.form_result['person'][key])

        c.person.proposals.append(c.proposal)

        if attachment_results is not None:
            attachment = Attachment(**attachment_results)
            c.proposal.attachments.append(attachment)
            meta.Session.add(attachment)

        meta.Session.commit()
        email(c.person.email_address, render('proposal/thankyou_email.mako'))

        h.flash("Proposal submitted!")
        return redirect_to(controller='proposal', action="index", id=None)
Пример #40
0
    def new(self):
        if c.funding_status == 'closed':
            if not h.auth.authorized(h.auth.has_late_submitter_role):
                return render("funding/closed.mako")
        elif c.funding_status == 'not_open':
            return render("funding/not_open.mako")

        c.person = h.signed_in_person()

        defaults = {
            'funding.type': 1,
        }
        form = render("funding/new.mako")
        return htmlfill.render(form, defaults)
Пример #41
0
    def new(self):
        if c.funding_status == 'closed':
           if not h.auth.authorized(h.auth.has_late_submitter_role):
              return render("funding/closed.mako")
        elif c.funding_status == 'not_open':
           return render("funding/not_open.mako")

        c.person = h.signed_in_person()

        defaults = {
            'funding.type': 1,
        }
        form = render("funding/new.mako")
        return htmlfill.render(form, defaults)
Пример #42
0
    def _new(self):
        results = self.form_result['volunteer']

        c.volunteer = Volunteer(**results)
        c.volunteer.person = h.signed_in_person()
        c.person = c.volunteer.person
        meta.Session.add(c.volunteer)
        meta.Session.commit()

        h.flash(
            "Thank you for volunteering. We will contact you shortly regarding your application"
        )
        email(c.person.email_address, render('volunteer/response.mako'))
        redirect_to(action='view', id=c.volunteer.id)
Пример #43
0
    def _delete(self, id):
        c.attachment = FundingAttachment.find_by_id(id)
        funding = Funding.find_by_id(c.attachment.funding_id)

        if not (h.auth.authorized(h.auth.has_organiser_role)
                or funding.person == h.signed_in_person()):
            # Raise a no_auth error
            h.auth.no_role()

        meta.Session.delete(c.attachment)
        meta.Session.commit()

        h.flash("Attachment Deleted")
        redirect_to(controller='funding', action='view', id=funding.id)
Пример #44
0
    def delete(self, id):
        c.attachment = Attachment.find_by_id(id)
        c.proposal = Proposal.find_by_id(c.attachment.proposal_id)

        if not h.auth.authorized(h.auth.has_organiser_role):
            authorized = False
            for person in c.proposal.people:
                if person.id == h.signed_in_person().id:
                    authorized = True
                    break
            if not authorized:
                # Raise a no_auth error
                h.auth.no_role()

        return render('/attachment/confirm_delete.mako')
Пример #45
0
    def edit(self, id):
        c.form = "edit"
        c.review = FundingReview.find_by_id(id)
        self._is_reviewer()

        c.funding = c.review.funding
        defaults = h.object_to_defaults(c.review, "review")
        if defaults["review.score"] == None:
            defaults["review.score"] = "null"
        if defaults["review.score"] == 1 or defaults["review.score"] == 2:
            defaults["review.score"] = "+%s" % defaults["review.score"]

        c.signed_in_person = h.signed_in_person()
        form = render("/funding_review/edit.mako")
        return htmlfill.render(form, defaults)
Пример #46
0
    def edit(self, id):
        c.form = 'edit'
        c.review = FundingReview.find_by_id(id)
        self._is_reviewer()

        c.funding = c.review.funding
        defaults = h.object_to_defaults(c.review, 'review')
        if defaults['review.score'] == None:
            defaults['review.score'] = 'null'
        if defaults['review.score'] == 1 or defaults['review.score'] == 2:
            defaults['review.score'] = '+%s' % defaults['review.score']

        c.signed_in_person = h.signed_in_person()
        form = render('/funding_review/edit.mako')
        return htmlfill.render(form, defaults)
Пример #47
0
    def delete(self, id):
        c.attachment = Attachment.find_by_id(id)
        c.proposal = Proposal.find_by_id(c.attachment.proposal_id)

        if not h.auth.authorized(h.auth.has_organiser_role):
            authorized = False
            for person in c.proposal.people:
                if person.id == h.signed_in_person().id:
                    authorized = True
                    break
            if not authorized:
                # Raise a no_auth error
                h.auth.no_role()

        return render("/attachment/confirm_delete.mako")
Пример #48
0
    def review(self, id):
        c.streams = Stream.select_values()
        c.proposal = Proposal.find_by_id(id)
        c.signed_in_person = h.signed_in_person()

        # TODO: currently not enough (see TODOs in model/proposal.py)
        #if not h.auth.authorized(h.auth.has_organiser_role):
        #    # You can't review your own proposal
        #    for person in c.proposal.people:
        #        if person.id == c.signed_in_person.id:
        #            h.auth.no_role()

        c.next_review_id = Proposal.find_next_proposal(c.proposal.id, c.proposal.type.id, c.signed_in_person.id)

        return render('/proposal/review.mako')
Пример #49
0
    def revoke(self):
        """Delete the rego note

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        args = request.GET
        eventid = int(args.get('eventid',0))
        c.signed_in_person = h.signed_in_person()
        c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id)
        meta.Session.delete(c.vote)
        meta.Session.commit()
        form = render('/vote/delete.mako')
        return htmlfill.render(form, defaults)
        redirect_to('new')
Пример #50
0
    def review(self, id):
        c.streams = Stream.select_values()
        c.proposal = Proposal.find_by_id(id)
        c.signed_in_person = h.signed_in_person()

        # TODO: currently not enough (see TODOs in model/proposal.py)
        #if not h.auth.authorized(h.auth.has_organiser_role):
        #    # You can't review your own proposal
        #    for person in c.proposal.people:
        #        if person.id == c.signed_in_person.id:
        #            h.auth.no_role()

        c.next_review_id = Proposal.find_next_proposal(c.proposal.id,
                                                       c.proposal.type.id,
                                                       c.signed_in_person.id)

        return render('/proposal/review.mako')
Пример #51
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for pt in c.proposal_types:
            stuff = Proposal.find_all_by_proposal_type_id(pt.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % pt.name, stuff)
        for aat in c.accommodation_assistance_types:
            stuff = Proposal.find_all_by_accommodation_assistance_type_id(aat.id)
            setattr(c, '%s_collection' % aat.name, stuff)
        for tat in c.travel_assistance_types:
            stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
            setattr(c, '%s_collection' % tat.name, stuff)

        return render('proposal/list_review.mako')
Пример #52
0
    def _withdraw(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_submitter(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.proposal = Proposal.find_by_id(id)
        status = ProposalStatus.find_by_name('Withdrawn')
        c.proposal.status = status
        meta.Session.commit()

        c.person = h.signed_in_person()

        # Make sure the organisers are notified of this
        c.email_address = h.lca_info['emails'][c.proposal.type.name.lower()]
        email(c.email_address, render('/proposal/withdraw_email.mako'))

        h.flash("Proposal withdrawn. The organisers have been notified.")
        return redirect_to(controller='proposal', action="index", id=None)
Пример #53
0
    def _delete(self, id):
        c.attachment = Attachment.find_by_id(id)
        proposal = Proposal.find_by_id(c.attachment.proposal_id)

        if not h.auth.authorized(h.auth.has_organiser_role):
            authorized = False
            for person in proposal.people:
                if person.id == h.signed_in_person().id:
                    authorized = True
                    break
            if not authorized:
                # Raise a no_auth error
                h.auth.no_role()

        meta.Session.delete(c.attachment)
        meta.Session.commit()

        h.flash("Attachment Deleted")
        redirect_to(controller='proposal', action='view', id=proposal.id)
Пример #54
0
    def edit(self, id):
        # We need to recheck auth in here so we can pass in the id
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zookeepr_submitter(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        if not h.auth.authorized(h.auth.has_organiser_role):
            if c.paper_editing == 'closed' and not h.auth.authorized(
                    h.auth.has_late_submitter_role):
                return render("proposal/editing_closed.mako")
            elif c.paper_editing == 'not_open':
                return render("proposal/editing_not_open.mako")

        c.proposal = Proposal.find_by_id(id)

        c.person = c.proposal.people[0]
        for person in c.proposal.people:
            if h.signed_in_person() == person:
                c.person = person

        defaults = h.object_to_defaults(c.proposal, 'proposal')
        defaults.update(h.object_to_defaults(c.person, 'person'))
        defaults['person.name'] = c.person.firstname + " " + c.person.lastname
        # This is horrible, don't know a better way to do it
        if c.proposal.type:
            defaults['proposal.type'] = defaults['proposal.proposal_type_id']
        if c.proposal.travel_assistance:
            defaults['proposal.travel_assistance'] = defaults[
                'proposal.travel_assistance_type_id']
        if c.proposal.accommodation_assistance:
            defaults['proposal.accommodation_assistance'] = defaults[
                'proposal.accommodation_assistance_type_id']
        if c.proposal.audience:
            defaults['proposal.audience'] = defaults[
                'proposal.target_audience_id']

        defaults['person_to_edit'] = c.person.id
        defaults['name'] = c.person.firstname + " " + c.person.lastname
        c.miniconf = (c.proposal.type.name == 'Miniconf')
        form = render('/proposal/edit.mako')
        return htmlfill.render(form, defaults)
Пример #55
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for pt in c.proposal_types:
            stuff = Proposal.find_all_by_proposal_type_id(
                pt.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % pt.name, stuff)
        for aat in c.accommodation_assistance_types:
            stuff = Proposal.find_all_by_accommodation_assistance_type_id(
                aat.id)
            setattr(c, '%s_collection' % aat.name, stuff)
        for tat in c.travel_assistance_types:
            stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
            setattr(c, '%s_collection' % tat.name, stuff)

        return render('proposal/list_review.mako')
Пример #56
0
 def edit(self, id=None):
     #
     # Helpfully redirect to the correct URL.
     #
     if id is None:
         return redirect_to(h.url_for(id=h.signed_in_person().id))
     #
     # Only an organiser can edit someone elses photos.
     #
     if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_user(id), h.auth.has_organiser_role)):
         h.auth.no_role()
     person_id = int(id, 10)
     c.open_date = lca_info.lca_info['date']
     c.days_open = (datetime.date.today() - c.open_date.date()).days
     photo_db = PhotoCompEntry.read_db()
     c.photo = lambda day, entry: PhotoCompEntry.get(photo_db, person_id, day, entry)
     c.is_organiser = h.auth.authorized(h.auth.has_organiser_role)
     c.DAYS_OPEN = DAYS_OPEN
     c.ENTRY_NAMES = ENTRY_NAMES
     return render('/photocomp/edit.mako')
Пример #57
0
    def _withdraw(self, id):
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zookeepr_submitter(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.proposal = Proposal.find_by_id(id)
        status = ProposalStatus.find_by_name('Withdrawn')
        c.proposal.status = status
        meta.Session.commit()

        c.person = h.signed_in_person()

        # Make sure the organisers are notified of this
        c.email_address = h.lca_info['emails'][c.proposal.type.name.lower()]
        email(c.email_address, render('/proposal/withdraw_email.mako'))

        h.flash("Proposal withdrawn. The organisers have been notified.")
        return redirect_to(controller='proposal', action="index", id=None)
Пример #58
0
    def _edit(self, id):
        # We need to recheck auth in here so we can pass in the id
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zookeepr_submitter(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        if not h.auth.authorized(h.auth.has_organiser_role):
            if c.paper_editing == 'closed' and not h.auth.authorized(
                    h.auth.has_late_submitter_role):
                return render("proposal/editing_closed.mako")
            elif c.paper_editing == 'not_open':
                return render("proposal/editing_not_open.mako")

        c.proposal = Proposal.find_by_id(id)
        for key in self.form_result['proposal']:
            setattr(c.proposal, key, self.form_result['proposal'][key])

        c.proposal.abstract = self.clean_abstract(c.proposal.abstract)

        c.person = self.form_result['person_to_edit']
        if (c.person.id == h.signed_in_person().id
                or h.auth.authorized(h.auth.has_organiser_role)):
            for key in self.form_result['person']:
                setattr(c.person, key, self.form_result['person'][key])
            p_edit = "and author"
        else:
            p_edit = "(but not author)"

        meta.Session.commit()

        if lca_info['proposal_update_email'] != '':
            body = "Subject: %s Proposal Updated\n\nID:    %d\nTitle: %s\nType:  %s\nURL:   %s" % (
                h.lca_info['event_name'], c.proposal.id, c.proposal.title,
                c.proposal.type.name.lower(),
                "http://" + h.host_name() + h.url_for(action="view"))
            email(lca_info['proposal_update_email'], body)

        h.flash("Proposal %s edited!" % p_edit)
        return redirect_to('/proposal')
Пример #59
0
    def _new(self):
        if c.funding_status == 'closed':
            return render("funding/closed.mako")
        elif c.funding_status == 'not_open':
            return render("funding/not_open.mako")

        if self.form_result['funding']['male'] == 1:
            self.form_result['funding']['male'] = True
        elif self.form_result['funding']['male'] == 0:
            self.form_result['funding']['male'] = False

        funding_results = self.form_result['funding']
        attachment_results1 = self.form_result['attachment1']
        attachment_results2 = self.form_result['attachment2']

        c.person = h.signed_in_person()

        c.funding = Funding(**funding_results)
        c.funding.status = FundingStatus.find_by_name('Pending')
        c.funding.person = c.person

        if not c.funding.type.available():
            return render("funding/type_unavailable.mako")

        meta.Session.add(c.funding)

        if attachment_results1 is not None:
            attachment = FundingAttachment(**attachment_results1)
            c.funding.attachments.append(attachment)
            meta.Session.add(attachment)
        if attachment_results2 is not None:
            attachment = FundingAttachment(**attachment_results2)
            c.funding.attachments.append(attachment)
            meta.Session.add(attachment)

        meta.Session.commit()
        email(c.funding.person.email_address,
              render('funding/thankyou_email.mako'))

        h.flash("Funding submitted!")
        return redirect_to(controller='funding', action="index", id=None)