Example #1
0
    def _forgotten_password(self):
        """Action to let the user request a password change.

        GET returns a form for emailing them the password change
        confirmation.

        POST checks the form and then creates a confirmation record:
        date, email_address, and a url_hash that is a hash of a
        combination of date, email_address, and a random nonce.

        The email address must exist in the person database.

        The second half of the password change operation happens in
        the ``confirm`` action.
        """
        c.email = self.form_result['email_address']
        c.person = Person.find_by_email(c.email)

        if c.person is not None:
            # Check if there is already a password recovery in progress
            reset = PasswordResetConfirmation.find_by_email(c.email)
            if reset is not None:
                return render('person/in_progress.mako')

            # Ok kick one off
            c.conf_rec = PasswordResetConfirmation(email_address=c.email)
            meta.Session.add(c.conf_rec)
            meta.Session.commit()

        email(c.email, render('person/confirmation_email.mako'))

        return render('person/password_confirmation_sent.mako')
Example #2
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()
        h.check_for_incomplete_profile(c.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.fullname,
            'person.phone': c.person.phone,
            '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.fullname
        defaults['proposal.event_targets'] = [et.id for et in ProposalEventTarget.find_all()]
        log.debug("new eventtar: {}".format(defaults['proposal.event_targets']))

        form = render("proposal/new.mako")
        return htmlfill.render(form, defaults)
Example #3
0
    def _check_invoice(self, person, invoice, ignore_overdue = False):
        c.invoice = invoice
        if person.invoices:
            if invoice.is_paid or len(invoice.bad_payments) > 0:
                c.status = []
                if invoice.total==0:
                  c.status.append('zero balance')
                if len(invoice.good_payments) > 0:
                  c.status.append('paid')
                  if len(invoice.good_payments)>1:
                    c.status[-1] += ' (%d times)' % len(invoice.good_payments)
                if len(invoice.bad_payments) > 0:
                  c.status.append('tried to pay')
                  if len(invoice.bad_payments)>1:
                    c.status[-1] += ' (%d times)' % len(invoice.bad_payments)
                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.is_overdue:
            for ii in invoice.items:
                if ii.product and not ii.product.available():
                    return render('/invoice/expired.mako')

        return None # All fine
Example #4
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()
        h.check_for_incomplete_profile(c.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)
Example #5
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 #6
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()
        h.check_for_incomplete_profile(c.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)
Example #7
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)
Example #8
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")

        funding_results = self.form_result['funding']
        attachment_results1 = self.form_result['attachment']

        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)

        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)
Example #9
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_zkpylons_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')
Example #10
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_zkpylons_funding_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.funding_editing == 'closed':
                return render("funding/editing_closed.mako")
            elif c.funding_editing == 'not_open':
                return render("funding/editing_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

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

        c.person = c.funding.person

        meta.Session.commit()

        h.flash("Funding for %s edited!"%c.person.firstname)
        return redirect_to('/funding')
Example #11
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_zkpylons_funding_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.funding_editing == 'closed':
                return render("funding/editing_closed.mako")
            elif c.funding_editing == 'not_open':
                return render("funding/editing_not_open.mako")

        c.funding = Funding.find_by_id(id)

        defaults = {}
        defaults.update(h.object_to_defaults(c.funding, 'funding'))
        # This is horrible, don't know a better way to do it
        if c.funding.type:
            defaults['funding.type'] = defaults['funding.funding_type_id']
        if c.funding.male:
            defaults['funding.male'] = 1
        else:
            defaults['funding.male'] = 0

        form = render('/funding/edit.mako')
        return htmlfill.render(form, defaults)
Example #12
0
    def pay(self, id):
        """Request confirmation from user
        """
        invoice = Invoice.find_by_id(id, True)
        person = invoice.person

        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_user(person.id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        #return render('/registration/really_closed.mako')

        error = self._check_invoice(person, invoice)
        if error is not None:
            return error

        c.payment = Payment()
        c.payment.amount = invoice.total
        c.payment.invoice = invoice

        meta.Session.commit()
        if c.payment.gateway == 'securepay':
            return render("/invoice/securepay.mako")
        else:
            return render("/invoice/payment.mako")
Example #13
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')
Example #14
0
    def table(self, day=None):
        filter = dict(request.GET)

        if len(c.scheduled_dates) == 0:
            return render('/schedule/no_schedule_available.mako')

        c.display_date = None

        available_days = {}
        for scheduled_date in c.scheduled_dates:
            available_days[scheduled_date.strftime('%A').lower()] = scheduled_date

        if day in available_days:
            c.display_date = available_days[day]

        if c.display_date is None:
            if date.today() in c.scheduled_dates:
                c.display_date = date.today()
            else:
                c.display_date = c.scheduled_dates[0]

        c.time_slots = TimeSlot.find_by_date(c.display_date)
        c.primary_times = {}
        for time_slot in TimeSlot.find_by_date(c.display_date, primary=True):
            c.primary_times[time_slot.start_time] = time_slot

        event_type = EventType.find_by_name('presentation')
        c.locations = Location.find_scheduled_by_date_and_type(c.display_date, event_type)
        event_type = EventType.find_by_name('mini-conf')
        c.locations = c.locations + Location.find_scheduled_by_date_and_type(c.display_date, event_type)

        c.schedule_collection = Schedule.find_by_date(c.display_date)

        c.time_increment = timedelta(minutes=5)

        c.programme = OrderedDict()

        for time_slot in c.time_slots:
            time = time_slot.start_time
            while time < time_slot.end_time:
                c.programme[time] = {}
                time = time + c.time_increment

        for schedule in c.schedule_collection:
            exclusive_event = schedule.time_slot.exclusive_event()
            time = schedule.time_slot.start_time
            if exclusive_event:
                c.programme[time]['exclusive'] = exclusive_event
            else:
                c.programme[time][schedule.location] = schedule

        if filter.has_key('raw'):
            return render('/schedule/table_raw.mako')
        else:
            return render('/schedule/table.mako')
Example #15
0
    def index(self):
        c.DAYS_OPEN = DAYS_OPEN
        c.open_date =  lca_info.lca_info['date']
        days_open = (datetime.date.today() - c.open_date.date()).days
        photo_db = PhotoCompEntry.read_db()
        photos = [
            photo
            for days in photo_db.values()
            for entries in days
            for photo in entries
            if photo is not None and photo.day < days_open]
        c.no_photos = not photos
        day_filter = request.GET.get('day', 'All')
        if day_filter and day_filter != 'All':
            photos = [p for p in photos if str(p.day) == day_filter]
        person_filter = request.GET.get('person', 'All')
        if person_filter and person_filter != 'All':
            photos = [p for p in photos if str(p.person_id) == person_filter]
        submitted = request.GET.get('s', None)
        randomise = not submitted or 'randomise' in request.GET
        if randomise:
            random.shuffle(photos)
        else:
            photos.sort(key=lambda p: (p.day, p.person_id, p.entry_id))
        person_map = {}
        for photo in photos:
            photo.write_scaled()
            person_map[photo.person_id] = None
        c.all_person = []
        for person_id in person_map:
            person = Person.find_by_id(person_id)
            person_map[person_id] = person
            c.all_person.append(person)
        c.all_person.sort(key=lambda person: (person.firstname + " " + person.lastname).lower())
        c.photos = photos
        def photo_title(photo):
            return "%s %s, %s entry %s, %s" % (
                person_map[photo.person_id].firstname,
                person_map[photo.person_id].lastname,
                (c.open_date + datetime.timedelta(photo.day)).strftime('%A'),
                ENTRY_NAMES[photo.entry_id],
                photo.image_name,)
        c.photo_title = photo_title
        field_values = {
            'day':      day_filter,
            'person':   person_filter,
        }
        if randomise:
            field_values['randomise'] = '1'
	if submitted == 'Full Screen' and photos:
            html = render('/photocomp/index-fullscreen.mako')
        else:
            html = render('/photocomp/index.mako')
        return htmlfill.render(html, field_values)
Example #16
0
 def view_talk(self, id):
     try:
         c.day = request.GET['day']
     except:
         c.day = 'all'
     try:
         c.talk = Proposal.find_accepted_by_id(id)
     except:
         c.talk_id = id
         c.webmaster_email = lca_info['webmaster_email']	
         return render('/schedule/invalid_talkid.mako')
     return render('/schedule/table_view.mako')
Example #17
0
    def table(self, day=None):
        # Check if we have any schedule information to display and tell people if we don't
        if len(c.scheduled_dates) == 0:
            return render('/schedule/no_schedule_available.mako')

        # Which day should we be showing now?
        c.display_date = None
        available_days = { scheduled_date.strftime('%A').lower(): scheduled_date for scheduled_date in c.scheduled_dates }
        if day in available_days:
            c.display_date = available_days[day]

        if c.display_date is None:
            if date.today() in c.scheduled_dates:
                c.display_date = date.today()
            else:
                c.display_date = c.scheduled_dates[0]

        # Work out which times we should be displaying on the left hand time scale
        c.time_slots = TimeSlot.find_by_date(c.display_date)
        c.primary_times = { time_slot.start_time: time_slot  for time_slot in TimeSlot.find_by_date(c.display_date, primary=True) }

        # Find all locations that have non-exclusive events
        start = datetime.combine(c.display_date, time.min)
        end   = datetime.combine(c.display_date, time.max)
        c.locations = Location.query().join(Schedule).join(Event).join(TimeSlot).filter(TimeSlot.start_time.between(start, end)).filter(Event.exclusive != True).all()

        # Find the list of scheduled items for the required date
        c.schedule_collection = Schedule.find_by_date(c.display_date)

        # What time period will we break the time scale on the left into
        c.time_increment = timedelta(minutes=5)

        # Build up the programme for the requested day
        c.programme = OrderedDict()
        for time_slot in c.time_slots:
            mytime = time_slot.start_time
            while mytime < time_slot.end_time:
                c.programme[mytime] = {}
                mytime = mytime + c.time_increment
        for schedule in c.schedule_collection:
            exclusive_event = schedule.time_slot.exclusive_event()
            mytime = schedule.time_slot.start_time
            if exclusive_event:
                c.programme[mytime]['exclusive'] = exclusive_event
            else:
                c.programme[mytime][schedule.location] = schedule

        if 'raw' in request.GET:
            c.raw = True
        return render('/schedule/table.mako')
Example #18
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)
Example #19
0
    def index(self):
        """The home page of the website.

        If the user has not signed in, then they are presented with the
        default page.

        Otherwise, they're shown the customised page.

        We rely on `c.signed_in_person` containing the Person object for
        the currently signed in user, but we don't want to redirect to
        the signin action if we're not signed in so we duplicate the
        __before__ code from SecureController here.
        """

        if 'signed_in_person_id' in session:
            c.signed_in_person = self.dbsession.query(Person).filter_by(id=session['signed_in_person_id']).one()
        c.db_content = DbContent.find_by_url('/home', abort_404=False)

        c.tiered_sponsors = Sponsor.find_all_tiered()

        c.venue_photos = Photo.find_all_by_gallery("Venue")

        venue_text_url = '/venue'
        c.venue_text = DbContent.find_by_url(
            venue_text_url, abort_404=False).body
        if not c.venue_text:
            c.venue_text = 'To put content here create a page with a URL of '
            '<u>{venue_text_url}</u> in the <a href="{page_database_url}">page '
            'database</a>.'.format(
                venue_text_url = venue_text_url,
                page_database_url = h.url_for(
                    controller='db_content', action='new'))

        return render('/home.mako')
Example #20
0
    def summary(self):
        for ft in c.funding_types:
            stuff = Funding.find_all_by_funding_type_id(ft.id, include_withdrawn=False)
            stuff.sort(self._score_sort)
            setattr(c, '%s_collection' % ft.name, stuff)

        return render('funding/summary.mako')
Example #21
0
    def edit(self, id):
        c.travel = Travel.find_by_id(id)

        defaults = h.object_to_defaults(c.travel, "travel")

        form = render("/travel/edit.mako")
        return htmlfill.render(form, defaults)
Example #22
0
 def edit(self, id):
     # A person can only volunteer once
     c.form = 'edit'
     c.volunteer = Volunteer.find_by_id(id)
     defaults = h.object_to_defaults(c.volunteer, 'volunteer')
     form = render('/volunteer/edit.mako')
     return htmlfill.render(form, defaults)
Example #23
0
    def activate(self):
        c.person = h.signed_in_person()
        if c.person.activated:
            # We've since activated, lets go back to where we were
            self._redirect_user_optimally()

        return render('/person/activate.mako')
Example #24
0
    def withdraw(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.proposal = Proposal.find_by_id(id)
        return render("/proposal/withdraw.mako")
Example #25
0
    def edit(self, id):
        c.vote = Vote.find_by_id(id)

        defaults = h.object_to_defaults(c.vote, 'vote')

        form = render('vote/edit.mako')
        return htmlfill.render(form, defaults)
Example #26
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 #27
0
    def edit(self, id):
        c.location = Location.find_by_id(id)

        defaults = h.object_to_defaults(c.location, 'location')

        form = render('/location/edit.mako')
        return htmlfill.render(form, defaults)
Example #28
0
    def _badge(self, id):
        c.fulfilment = Fulfilment.find_by_id(id)

        xml_s = render('/fulfilment/badge.mako')
        xsl_f = app_globals.mako_lookup.get_template('/fulfilment/badge.xsl').filename
        pdf_data = pdfgen.generate_pdf(xml_s, xsl_f)
        return pdf_data
Example #29
0
    def withdraw(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_funding_submitter(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.funding = Funding.find_by_id(id)
        return render("/funding/withdraw.mako")
Example #30
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')
Example #31
0
    def delete(self, id):
        """Delete the fulfilment

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.fulfilment = Fulfilment.find_by_id(id)
        return render('/fulfilment/confirm_delete.mako')
Example #32
0
    def latex(self):
        c.proposal_type = ProposalType.find_all()

        for type in c.proposal_type:
            print type

        response.headers['Content-type'] = 'text/plain; charset=utf-8'

        return render('/proposal/latex.mako')
Example #33
0
    def delete(self, id):
        """Delete the event_type

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.event_type = EventType.find_by_id(id)
        return render('/event_type/confirm_delete.mako')
Example #34
0
 def new(self, cat_id=None):
     form = render('/product/new.mako')
     if cat_id is None:
         return form
     else:
         return htmlfill.render(form, {
             'product.category': cat_id,
             'product.category_id': cat_id
         })
Example #35
0
    def delete(self, id):
        """Delete the rego room

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.rego_room = RegoRoom.find_by_id(id)
        return render('rego_room/confirm_delete.mako')
Example #36
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)
Example #37
0
    def withdraw(self, id):
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zkpylons_funding_submitter(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.funding = Funding.find_by_id(id)
        return render("/funding/withdraw.mako")
Example #38
0
    def delete(self, id):
        """Delete the role

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.role = Role.find_by_id(id)
        return render('role/confirm_delete.mako')
Example #39
0
    def delete(self, id):
        """Delete the ceiling

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.ceiling = Ceiling.find_by_id(id)
        return render('/ceiling/confirm_delete.mako')
Example #40
0
    def delete(self, id):
        """Delete the stream

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.stream = Stream.find_by_id(id)
        return render('/stream/confirm_delete.mako')
Example #41
0
    def delete(self, id):
        """Delete the voucher

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.voucher = Voucher.find_by_id(id)
        return render('/voucher/confirm_delete.mako')
Example #42
0
    def withdraw(self, id):
        if not h.auth.authorized(
                h.auth.Or(h.auth.is_same_zkpylons_submitter(id),
                          h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.proposal = Proposal.find_by_id(id)
        return render("/proposal/withdraw.mako")
Example #43
0
    def delete(self, id):
        """Delete the social_network

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.social_network = SocialNetwork.find_by_id(id)
        return render('/social_network/confirm_delete.mako')
Example #44
0
    def delete(self, id):
        """Delete the product

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.product = Product.find_by_id(id)
        return render('/product/confirm_delete.mako')
Example #45
0
    def delete(self, id):
        """Delete the time_slot

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.time_slot = TimeSlot.find_by_id(id)
        return render('/time_slot/confirm_delete.mako')
Example #46
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')
Example #47
0
    def delete(self, id):
        """Delete the funding type

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.funding_type = FundingType.find_by_id(id)
        return render('/funding_type/confirm_delete.mako')
Example #48
0
    def delete(self, id):
        """Delete the proposal type

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.proposal_type = ProposalType.find_by_id(id)
        return render('/proposal_type/confirm_delete.mako')
Example #49
0
    def new(self):
        c.time_slots = TimeSlot.find_all()
        c.locations = Location.find_all()
        c.events = Event.find_all()

        form = render('/schedule/new.mako')
        object = {'schedule': self.form_result}
        defaults = NewScheduleSchema().from_python(object)
        return htmlfill.render(form, defaults)
Example #50
0
    def delete(self, id):
        """Delete the travel

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.travel = Travel.find_by_id(id)
        return render('/travel/confirm_delete.mako')
Example #51
0
    def delete(self, id):
        """Delete the location

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.location = Location.find_by_id(id)
        return render('/location/confirm_delete.mako')
Example #52
0
    def _offer(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_zkpylons_user(id), h.auth.has_reviewer_role, h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()
        c.person = Person.find_by_id(id)
        c.offers = c.person.proposal_offers
        c.travel_assistance = reduce(lambda a, b: a or ('Travel' in b.status.name), c.offers, False) or False
        c.accommodation_assistance = reduce(lambda a, b: a or ('Accommodation' in b.status.name), c.offers, False) or False

        # What status are we moving all proposals to?
        if self.form_result['status'] == 'accept':
            c.status = ProposalStatus.find_by_name('Accepted')
        elif self.form_result['status'] == 'withdraw':
            c.status = ProposalStatus.find_by_name('Withdrawn')
        elif self.form_result['status'] == 'contact':
            c.status = ProposalStatus.find_by_name('Contact')
        else:
            c.status = None

        emails = [c.person.email_address]
        for offer in c.offers:
            offer.status = c.status
            if offer.type.notify_email and offer.type.notify_email not in emails:
                emails.append(offer.type.notify_email)

        if c.travel_assistance:
            if not c.person.travel:
                self.form_result['travel']['flight_details'] = ''
                travel = Travel(**self.form_result['travel'])
                meta.Session.add(travel)
                c.person.travel = travel
            else:
                for key in self.form_result['travel']:
                    setattr(c.person.travel, key, self.form_result['travel'][key])

        if c.status.name == 'Accepted':
            email(c.person.email_address, render('/person/offer_email.mako'))
        else:
            email(emails, render('/person/offer_email.mako'))

        # update the objects with the validated form data
        meta.Session.commit()
        return render('person/offer.mako')
Example #53
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_zkpylons_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.proposal_editing == 'closed' and not h.auth.authorized(
                    h.auth.has_late_submitter_role):
                return render("proposal/editing_closed.mako")
            elif c.proposal_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)
Example #54
0
    def delete_folder(self):
        try:
            c.folder = request.GET['folder']
            c.current_folder = request.GET['current_path']
        except KeyError:
            abort(404)

        directory = get_path('public_path')
        c.no_theme = request.GET.get('no_theme') == 'true'
        return render('/db_content/delete_folder.mako')
Example #55
0
    def delete_file(self):
        try:
            c.file = request.GET['file']
            c.current_folder = request.GET['folder']
        except KeyError:
            abort(404)

        c.no_theme = request.GET.get('no_theme') == 'true'

        return render('/db_content/delete_file.mako')
Example #56
0
 def rss_news(self):
     news_id = DbContentType.find_by_name("News")
     c.db_content_collection = []
     if news_id is not None:
         c.db_content_collection = meta.Session.query(DbContent).filter_by(
             type_id=news_id.id).filter(
                 DbContent.publish_timestamp <= datetime.now()).order_by(
                     DbContent.publish_timestamp.desc()).limit(20).all()
     response.headers['Content-type'] = 'application/rss+xml; charset=utf-8'
     return render('/db_content/rss_news.mako')
Example #57
0
 def reject(self, id):
     volunteer = Volunteer.find_by_id(id)
     volunteer.accepted = False
     volunteer.ticket_type = None
     meta.Session.commit()
     c.volunteer = volunteer
     c.person = volunteer.person
     email(c.person.email_address, render('volunteer/response.mako'))
     h.flash('Status Updated and Rejection Email Sent')
     redirect_to(action='index', id=None)
Example #58
0
    def edit(self, id):
        c.fulfilment = Fulfilment.find_by_id(id)

        defaults = h.object_to_defaults(c.fulfilment, 'fulfilment')
        defaults['fulfilment.person'] = c.fulfilment.person_id
        defaults['fulfilment.type'] = c.fulfilment.type_id
        defaults['fulfilment.status'] = c.fulfilment.status_id

        form = render('/fulfilment/edit.mako')
        return htmlfill.render(form, defaults)
Example #59
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')
Example #60
0
    def view(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_zkpylons_user(id), h.auth.has_reviewer_role, h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()

        c.registration_status = h.config['app_conf'].get('registration_status')
        c.person = Person.find_by_id(id)

        return render('person/view.mako')