Example #1
0
    def _delete(self, id):
        c.proposal_status = ProposalStatus.find_by_id(id)
        meta.Session.delete(c.proposal_status)
        meta.Session.commit()

        h.flash("Proposal Status has been deleted.")
        redirect_to('index')
Example #2
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')
Example #3
0
    def _delete(self, id):
        c.fulfilment = Fulfilment.find_by_id(id)
        meta.Session.delete(c.fulfilment)
        meta.Session.commit()

        h.flash("Fulfilment has been deleted.")
        redirect_to('index', id=None)
Example #4
0
    def _delete(self, id):
        c.travel = Travel.find_by_id(id)
        meta.Session.delete(c.travel)
        meta.Session.commit()

        h.flash("Travel has been deleted.")
        redirect_to("index")
Example #5
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)

        c.review = Review.find_by_proposal_reviewer(id, c.signed_in_person.id, abort_404=False)
        if c.review:
            for key in self.form_result['review']:
                setattr(c.review, key, self.form_result['review'][key])

            # update the objects with the validated form data
            meta.Session.commit()
            h.flash("Review Updated Successfully")
            return redirect_to(controller='review', action='view', id=c.review.id)

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

            meta.Session.add(review)
            review.proposal = c.proposal
            review.reviewer = c.signed_in_person

            meta.Session.commit()
            h.flash("Review Added Successfully")

        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')
Example #6
0
    def index(self):
        # Check access and redirect
        if not h.auth.authorized(h.auth.has_organiser_role):
            redirect_to(action='new')

        c.volunteer_collection = Volunteer.find_all()
        return render('volunteer/list.mako')
Example #7
0
    def delete_folder(self):
        try:
            if request.GET['folder'] is not None:
                c.folder += request.GET['folder']
                c.current_folder += request.GET['current_path']
        except KeyError:
           abort(404)

        directory = file_paths['public_path']
        defaults = dict(request.POST)
        if defaults:
            c.no_theme = 'false'
            if request.GET.has_key('no_theme'):
                if request.GET['no_theme'] == 'true':
                    c.no_theme = 'true'
            try:
                os.rmdir(directory + c.folder)
            except OSError:
                h.flash("Can not delete. The folder contains items.", 'error')
                redirect_to(action="list_files", folder=c.current_folder, no_theme = c.no_theme)
            h.flash("Folder deleted.")
            redirect_to(action="list_files", folder=c.current_folder, no_theme = c.no_theme)
        c.no_theme = False
        if request.GET.has_key('no_theme'):
            if request.GET['no_theme'] == 'true':
                c.no_theme = True
        return render('/db_content/delete_folder.mako')
Example #8
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)
Example #9
0
    def view(self, id):
        c.review = FundingReview.find_by_id(id)

        if c.review is None:
            redirect_to(action='index')

        return render('funding_review/view.mako')
Example #10
0
    def _delete(self, id):
        c.db_content = DbContent.find_by_id(id)
        meta.Session.delete(c.db_content)
        meta.Session.commit()

        h.flash("Content Deleted.")
        redirect_to('index')
Example #11
0
    def _delete(self, id):
        c.fulfilment = Fulfilment.find_by_id(id)
        meta.Session.delete(c.fulfilment)
        meta.Session.commit()

        h.flash("Fulfilment has been deleted.")
        redirect_to("index", id=None)
Example #12
0
    def _delete(self, id):
        c.proposal_type = ProposalType.find_by_id(id)
        meta.Session.delete(c.proposal_type)
        meta.Session.commit()

        h.flash("Proposal type has been deleted.")
        redirect_to('index')
Example #13
0
    def _delete(self, id):
        c.rego_note = RegoNote.find_by_id(id)
        meta.Session.delete(c.rego_note)
        meta.Session.commit()

        h.flash("Rego note has been deleted.")
        redirect_to('index')
Example #14
0
    def void(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        if c.invoice.is_void:
            h.flash("Invoice was already voided.")
            return redirect_to(action='view', id=c.invoice.id)
        elif len(c.invoice.payment_received) and h.auth.authorized(h.auth.has_organiser_role):
            h.flash("Invoice has a payment applied to it, do you want to " + h.link_to('Refund', h.url_for(action='refund')) + " instead?")
            return redirect_to(action='view', id=c.invoice.id)
        elif len(c.invoice.payment_received):
            h.flash("Cannot void a paid invoice.")
            return redirect_to(action='view', id=c.invoice.id)
        elif h.auth.authorized(h.auth.has_organiser_role):
            c.invoice.void = "Administration Change"
            meta.Session.commit()
            h.flash("Invoice was voided.")
            return redirect_to(action='view', id=c.invoice.id)
        else:
            c.invoice.void = "User cancellation"
            c.person = c.invoice.person
            meta.Session.commit()
            email(Config.get('contact_email'), render('/invoice/user_voided.mako'))
            h.flash("Previous invoice was voided.")
            return redirect_to(controller='registration', action='pay', id=c.person.registration.id)
    def _delete(self, id):
        c.social_network = SocialNetwork.find_by_id(id)
        meta.Session.delete(c.social_network)
        meta.Session.commit()

        h.flash("Social Network has been deleted.")
        redirect_to('index')
Example #16
0
    def _new(self):
        # Do we allow account creation?
        if Config.get('account_creation'):
            """Create a new person submit.
            """

            # Remove fields not in class
            results = self.form_result['person']
            del results['password_confirm']
            c.person = Person(**results)
            c.person.email_address = c.person.email_address.lower()
            meta.Session.add(c.person)

            #for sn in self.form_result['social_network']:
            #   network = SocialNetwork.find_by_name(sn['name'])
            #   if sn['account_name']:
            #       c.person.social_networks[network] = sn['account_name']

            meta.Session.commit()

            if Config.get('confirm_email_address', category='rego') == 'no':
                redirect_to(controller='person', action='confirm', confirm_hash=c.person.url_hash)
            else:
                email(c.person.email_address, render('/person/new_person_email.mako'))
                # return render('/person/thankyou.mako')
                return self.finish_login(c.person.email_address)
        else:
            return render('/not_allowed.mako')
    def _delete(self, id):
        c.proposal_status = ProposalStatus.find_by_id(id)
        meta.Session.delete(c.proposal_status)
        meta.Session.commit()

        h.flash("Proposal Status has been deleted.")
        redirect_to('index')
Example #18
0
    def view(self, id):
        c.review = FundingReview.find_by_id(id)

        if c.review is None:
            redirect_to(action='index')

        return render('funding_review/view.mako')
Example #19
0
def ssl_check(ssl_required=[],
              ssl_allowed=[],
              ssl_required_all=False,
              ssl_allowed_all=False):

    if not asbool(config.get('enable_ssl_requirement', False)):
        return

    action = request.environ['pylons.routes_dict']['action']

    if action in ssl_allowed or ssl_allowed_all:  # We don't care if they use http or https
        return
    elif action in ssl_required or ssl_required_all:  # Must have ssl
        protocol = 'https'
    else:
        protocol = 'http'

    if current_protocol() == protocol:
        return

    if request.method.upper() != 'POST':
        log.debug('Redirecting to %s, request: %s', protocol,
                  request.path_info)
        host = config.get('ssl_host')
        if host:
            redirect_to(protocol=protocol, host=host)
        else:
            redirect_to(protocol=protocol)
    else:
        abort(405, headers=[('Allow', 'GET')])  # don't allow POSTs.
Example #20
0
    def _delete(self, id):
        c.time_slot = TimeSlot.find_by_id(id)
        meta.Session.delete(c.time_slot)
        meta.Session.commit()

        h.flash("Time Slot has been deleted.")
        redirect_to('index')
Example #21
0
    def _delete(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)
        meta.Session.delete(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer has been deleted.")
        redirect_to('index')
Example #22
0
 def _edit(self, id):
     results = self.form_result['volunteer']
     c.volunteer = Volunteer.find_by_id(id)
     for key in self.form_result['volunteer']:
         setattr(c.volunteer, key, self.form_result['volunteer'][key])
     meta.Session.commit()
     redirect_to(action='view', id=c.volunteer.id)
Example #23
0
    def _delete(self, id):
        c.proposal_type = ProposalType.find_by_id(id)
        meta.Session.delete(c.proposal_type)
        meta.Session.commit()

        h.flash("Proposal type has been deleted.")
        redirect_to("index")
Example #24
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')
Example #25
0
    def _delete(self, id):
        c.social_network = SocialNetwork.find_by_id(id)
        meta.Session.delete(c.social_network)
        meta.Session.commit()

        h.flash("Social Network has been deleted.")
        redirect_to('index')
Example #26
0
    def _delete(self, id):
        c.rego_room = RegoRoom.find_by_id(id)
        meta.Session.delete(c.rego_room)
        meta.Session.commit()

        h.flash("Rego room has been deleted.")
        redirect_to('index')
Example #27
0
    def _delete(self, id):
        c.stream = Stream.find_by_id(id)
        meta.Session.delete(c.stream)
        meta.Session.commit()

        h.flash("Stream has been deleted.")
        redirect_to('index')
Example #28
0
    def _delete(self, id):
        c.ceiling = Ceiling.find_by_id(id)
        meta.Session.delete(c.ceiling)
        meta.Session.commit()

        h.flash("Ceiling has been deleted.")
        redirect_to('index')
Example #29
0
    def _delete(self, id):
        c.schedule = Schedule.find_by_id(id)
        meta.Session.delete(c.schedule)
        meta.Session.commit()

        h.flash("Schedule has been deleted.")
        redirect_to('index')
Example #30
0
    def void(self, id):
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zkpylons_attendee(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.invoice = Invoice.find_by_id(id, True)
        if c.invoice.is_void:
            h.flash("Invoice was already voided.")
            return redirect_to(action='view', id=c.invoice.id)
        elif len(c.invoice.payment_received) and h.auth.authorized(
                h.auth.has_organiser_role):
            h.flash("Invoice has a payment applied to it, do you want to " +
                    h.link_to('Refund', h.url_for(action='refund')) +
                    " instead?")
            return redirect_to(action='view', id=c.invoice.id)
        elif len(c.invoice.payment_received):
            h.flash("Cannot void a paid invoice.")
            return redirect_to(action='view', id=c.invoice.id)
        elif h.auth.authorized(h.auth.has_organiser_role):
            c.invoice.void = "Administration Change"
            meta.Session.commit()
            h.flash("Invoice was voided.")
            return redirect_to(action='view', id=c.invoice.id)
        else:
            c.invoice.void = "User cancellation"
            c.person = c.invoice.person
            meta.Session.commit()
            email(lca_info['contact_email'],
                  render('/invoice/user_voided.mako'))
            h.flash("Previous invoice was voided.")
            return redirect_to(controller='registration',
                               action='pay',
                               id=c.person.registration.id)
    def _delete(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)
        meta.Session.delete(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer has been deleted.")
        redirect_to('index')
Example #32
0
    def signout_confirm(self, id=None):
        """ Confirm user wants to sign out
        """
        if id is not None:
            redirect_to(action='signout_confirm', id=None)

        return render('/person/signout.mako')
Example #33
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)

        c.review = Review.find_by_proposal_reviewer(id, c.signed_in_person.id, abort_404=False)
        if c.review:
            for key in self.form_result['review']:
                setattr(c.review, key, self.form_result['review'][key])

            # update the objects with the validated form data
            meta.Session.commit()
            h.flash("Review Updated Successfully")
            return redirect_to(controller='review', action='view', id=c.review.id)

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

            meta.Session.add(review)
            review.proposal = c.proposal
            review.reviewer = c.signed_in_person

            meta.Session.commit()
            h.flash("Review Added Successfully")

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

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

        return redirect_to(action='review_index')
Example #34
0
 def _new_incomplete(self):
     results = self.form_result['person']
     c.person = Person(**results)
     c.person.email_address = c.person.email_address.lower()
     meta.Session.add(c.person)
     meta.Session.commit()
     redirect_to(controller='person', action='index')
Example #35
0
    def _delete(self, id):
        c.travel = Travel.find_by_id(id)
        meta.Session.delete(c.travel)
        meta.Session.commit()

        h.flash("Travel has been deleted.")
        redirect_to('index')
Example #36
0
def ssl_check(ssl_required=[], ssl_allowed=[], ssl_required_all=False, ssl_allowed_all=False):

    if not asbool(config.get('enable_ssl_requirement', False)):
        return

    action = request.environ['pylons.routes_dict']['action']

    if action in ssl_allowed or ssl_allowed_all:             # We don't care if they use http or https
        return
    elif action in ssl_required or ssl_required_all:     # Must have ssl
        protocol = 'https'
    else:
        protocol = 'http'

    if current_protocol() == protocol:
        return

    if request.method.upper() != 'POST':
        log.debug('Redirecting to %s, request: %s', protocol, request.path_info)
        host = config.get('ssl_host')
        if host:
            redirect_to(protocol=protocol, host=host)
        else:
            redirect_to(protocol=protocol)
    else:
        abort(405, headers=[('Allow', 'GET')]) # don't allow POSTs.
Example #37
0
    def _delete(self, id):
        c.rego_note = RegoNote.find_by_id(id)
        meta.Session.delete(c.rego_note)
        meta.Session.commit()

        h.flash("Rego note has been deleted.")
        redirect_to('index')
Example #38
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)
Example #39
0
    def _delete(self, id):
        c.location = Location.find_by_id(id)
        meta.Session.delete(c.location)
        meta.Session.commit()

        h.flash("Location has been deleted.")
        redirect_to('index')
Example #40
0
    def _delete(self, id):
        c.time_slot = TimeSlot.find_by_id(id)
        meta.Session.delete(c.time_slot)
        meta.Session.commit()

        h.flash("Time Slot has been deleted.")
        redirect_to('index')
Example #41
0
    def _delete(self, id):
        c.db_content = DbContent.find_by_id(id)
        meta.Session.delete(c.db_content)
        meta.Session.commit()

        h.flash("Content Deleted.")
        redirect_to('index')
Example #42
0
    def _delete(self, id):
        c.location = Location.find_by_id(id)
        meta.Session.delete(c.location)
        meta.Session.commit()

        h.flash("Location has been deleted.")
        redirect_to('index')
Example #43
0
    def delete_folder(self):
        try:
            if request.GET['folder'] is not None:
                c.folder += request.GET['folder']
                c.current_folder += request.GET['current_path']
        except KeyError:
            abort(404)

        directory = get_path('public_path')
        defaults = dict(request.POST)
        if defaults:
            c.no_theme = 'false'
            if request.GET.has_key('no_theme'):
                if request.GET['no_theme'] == 'true':
                    c.no_theme = 'true'
            try:
                os.rmdir(directory + c.folder)
            except OSError:
                h.flash("Can not delete. The folder contains items.", 'error')
                redirect_to(action="list_files",
                            folder=c.current_folder,
                            no_theme=c.no_theme)
            h.flash("Folder deleted.")
            redirect_to(action="list_files",
                        folder=c.current_folder,
                        no_theme=c.no_theme)
        c.no_theme = False
        if request.GET.has_key('no_theme'):
            if request.GET['no_theme'] == 'true':
                c.no_theme = True
        return render('/db_content/delete_folder.mako')
Example #44
0
 def pending(self, id):
     volunteer = Volunteer.find_by_id(id)
     volunteer.accepted = None
     volunteer.ticket_type = None
     meta.Session.commit()
     h.flash('Status Updated')
     redirect_to(action='index', id=None)
Example #45
0
    def delete_file(self):
        try:
            if request.GET['file'] is not None:
                c.file += request.GET['file']
                c.current_folder += request.GET['folder']
        except KeyError:
            abort(404)

        directory = get_path('public_path')
        defaults = dict(request.POST)
        if defaults:
            os.remove(directory + c.file)
            h.flash("File Removed")
            c.no_theme = 'false'
            if request.GET.has_key('no_theme'):
                if request.GET['no_theme'] == 'true':
                    c.no_theme = 'true'
            redirect_to(action="list_files",
                        folder=c.current_folder,
                        no_theme=c.no_theme)
        c.no_theme = False
        if request.GET.has_key('no_theme'):
            if request.GET['no_theme'] == 'true':
                c.no_theme = True
        return render('/db_content/delete_file.mako')
Example #46
0
    def _delete(self, id):
        c.event = Event.find_by_id(id)
        meta.Session.delete(c.event)
        meta.Session.commit()

        h.flash("Event has been deleted.")
        redirect_to('index')
Example #47
0
    def _delete(self, id):
        c.rego_room = RegoRoom.find_by_id(id)
        meta.Session.delete(c.rego_room)
        meta.Session.commit()

        h.flash("Rego room has been deleted.")
        redirect_to('index')
Example #48
0
    def _delete(self, id):
        c.fulfilment_status = FulfilmentStatus.find_by_id(id)
        meta.Session.delete(c.fulfilment_status)
        meta.Session.commit()

        h.flash("Fulfilment Status has been deleted.")
        redirect_to('index', id=None)
Example #49
0
    def index(self):
        # Check access and redirect
        if not h.auth.authorized(h.auth.has_organiser_role):
            redirect_to(action='new')

        c.volunteer_collection = Volunteer.find_all()
        return render('volunteer/list.mako')
Example #50
0
    def _delete(self, id):
        c.schedule = Schedule.find_by_id(id)
        meta.Session.delete(c.schedule)
        meta.Session.commit()

        h.flash("Schedule has been deleted.")
        redirect_to('index')
Example #51
0
 def pending(self, id):
     volunteer = Volunteer.find_by_id(id)
     volunteer.accepted = None
     volunteer.ticket_type = None
     meta.Session.commit()
     h.flash('Status Updated')
     redirect_to(action='index', id=None)
Example #52
0
    def _delete(self, id):
        c.fulfilment_group = FulfilmentGroup.find_by_id(id)
        meta.Session.delete(c.fulfilment_group)
        meta.Session.commit()

        h.flash("Fulfilment Group has been deleted.")
        redirect_to('index', id=None)
Example #53
0
 def _edit(self, id):
     results = self.form_result['volunteer']
     c.volunteer = Volunteer.find_by_id(id)
     for key in self.form_result['volunteer']:
         setattr(c.volunteer, key, self.form_result['volunteer'][key])
     meta.Session.commit()
     redirect_to(action='view', id=c.volunteer.id)
Example #54
0
    def _delete(self, id):
        c.event = Event.find_by_id(id)
        meta.Session.delete(c.event)
        meta.Session.commit()

        h.flash("Event has been deleted.")
        redirect_to('index')
Example #55
0
    def edit(self, id):
        c.review = Review.find_by_id(id)

        redirect_to(
            h.url_for(controller='proposal',
                      id=c.review.proposal.id,
                      action='review'))