Esempio n. 1
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')
Esempio n. 2
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')
Esempio n. 3
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')
    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)
Esempio n. 5
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)
Esempio n. 6
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")
Esempio n. 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)
Esempio n. 8
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')
Esempio n. 9
0
    def _delete(self, id):
        c.funding_type = FundingType.find_by_id(id)
        meta.Session.delete(c.funding_type)
        meta.Session.commit()

        h.flash("Funding type has been deleted.")
        redirect_to('index')
Esempio n. 10
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')
Esempio n. 11
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')
Esempio n. 12
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")
Esempio n. 13
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')
Esempio n. 14
0
    def _delete(self, id):
        c.product = Product.find_by_id(id)
        meta.Session.delete(c.product)
        meta.Session.commit()

        h.flash("Product has been deleted.")
        redirect_to('index')
Esempio n. 15
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)
Esempio n. 16
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')
Esempio n. 17
0
    def _new(self):
        results = self.form_result['invoice']
        del (results['item_count'])

        items = results['items']
        results['items'] = []
        c.invoice = Invoice(**results)

        for i in items:
            item = InvoiceItem()
            if i['description'] != "":
                item.description = i['description']
            else:
                product = Product.find_by_id(i['product'].id)
                category = product.category
                item.product = i['product']
                item.description = product.category.name + ' - ' + product.description
            item.cost = i['cost']
            item.qty = i['qty']
            c.invoice.items.append(item)

        c.invoice.manual = True
        c.invoice.void = None
        meta.Session.add(c.invoice)
        meta.Session.commit()

        h.flash("Manual invoice created")
        return redirect_to(action='view', id=c.invoice.id)
Esempio n. 18
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')
Esempio n. 19
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')
Esempio n. 20
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')
Esempio n. 21
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')
Esempio n. 22
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')
Esempio n. 23
0
 def unvoid(self, id):
     c.invoice = Invoice.find_by_id(id, True)
     c.invoice.void = None
     c.invoice.manual = True
     meta.Session.commit()
     h.flash("Invoice was un-voided.")
     return redirect_to(action='view', id=c.invoice.id)
Esempio n. 24
0
    def _new(self):
        results = self.form_result['invoice']
        del(results['item_count'])

        items = results['items']
        results['items'] = []
        c.invoice = Invoice(**results)

        for i in items:
            item = InvoiceItem()
            if i['description'] != "":
                item.description = i['description']
            else:
                product = Product.find_by_id(i['product'].id)
                category = product.category
                item.product = i['product']
                item.description = product.category.name + ' - ' + product.description
            item.cost = i['cost']
            item.qty = i['qty']
            c.invoice.items.append(item)

        c.invoice.manual = True
        c.invoice.void = None
        meta.Session.add(c.invoice)
        meta.Session.commit()

        h.flash("Manual invoice created")
        return redirect_to(action='view', id=c.invoice.id)
Esempio n. 25
0
    def _delete(self, id):
        c.product_category = ProductCategory.find_by_id(id)
        meta.Session.delete(c.product_category)
        meta.Session.commit()

        h.flash("Category has been deleted.")
        redirect_to('index')
Esempio n. 26
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')
Esempio n. 27
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')
Esempio n. 28
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')
Esempio n. 29
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')
Esempio n. 30
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')
Esempio n. 31
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_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')
Esempio n. 32
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')
Esempio n. 33
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')
Esempio n. 34
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')
Esempio n. 35
0
 def unvoid(self, id):
     c.invoice = Invoice.find_by_id(id, True)
     c.invoice.void = None
     c.invoice.manual = True
     meta.Session.commit()
     h.flash("Invoice was un-voided.")
     return redirect_to(action='view', id=c.invoice.id)
Esempio n. 36
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_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')
Esempio n. 37
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')
Esempio n. 38
0
    def _delete(self, id):
        c.product_category = ProductCategory.find_by_id(id)
        meta.Session.delete(c.product_category)
        meta.Session.commit()

        h.flash("Category has been deleted.")
        redirect_to('index')
Esempio n. 39
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')
Esempio n. 40
0
    def signout(self):
        """ Sign the user out
            Authikit actually does the work after this finished
        """

        # return home
        h.flash('You have signed out')
        redirect_to('home')
Esempio n. 41
0
    def signout(self):
        """ Sign the user out
            Authikit actually does the work after this finished
        """

        # return home
        h.flash('You have signed out')
        redirect_to('home')
Esempio n. 42
0
    def _new(self):
        results = self.form_result['db_content']
        c.db_content = DbContent(**results)
        meta.Session.add(c.db_content)
        meta.Session.commit()

        h.flash("New Page Created.")
        redirect_to(action='view', id=c.db_content.id)
Esempio n. 43
0
 def _remind(self):
     results = self.form_result
     for i in results['invoices']:
         c.invoice = i
         c.recipient = i.person
         email(c.recipient.email_address, render('invoice/remind_email.mako'))
         h.flash('Email sent to ' + c.recipient.firstname + ' ' + c.recipient.lastname + ' <' + c.recipient.email_address + '>')
     redirect_to(action='remind')
Esempio n. 44
0
    def _new(self):
        results = self.form_result['db_content']
        c.db_content = DbContent(**results)
        meta.Session.add(c.db_content)
        meta.Session.commit()

        h.flash("New Page Created.")
        redirect_to(action='view', id=c.db_content.id)
Esempio n. 45
0
    def new_proposals(self):
        for proposal in c.proposals:
            event = Event(type_id=1, proposal=proposal, publish=True, exclusive=False)
            meta.Session.add(event)
        meta.Session.commit()

        h.flash("Events successfully created from Proposals")
        redirect_to(action='index', id=None)
Esempio n. 46
0
    def _new(self):
        results = self.form_result['event_type']

        c.event_type = EventType(**results)
        meta.Session.add(c.event_type)
        meta.Session.commit()

        h.flash("Event Type created")
        redirect_to(action='index')
Esempio n. 47
0
    def _new(self):
        results = self.form_result['ceiling']

        c.ceiling = Ceiling(**results)
        meta.Session.add(c.ceiling)
        meta.Session.commit()

        h.flash("Ceiling created")
        redirect_to(action='view', id=c.ceiling.id)
Esempio n. 48
0
    def _new(self):
        results = self.form_result['product']

        c.product = Product(**results)
        meta.Session.add(c.product)
        meta.Session.commit()

        h.flash("Product created")
        redirect_to(action='view', id=c.product.id)
Esempio n. 49
0
    def _new(self):
        results = self.form_result["rego_note"]

        c.rego_note = RegoNote(**results)
        meta.Session.add(c.rego_note)
        meta.Session.commit()

        h.flash("Rego note created")
        redirect_to(action="view", id=c.rego_note.id)
Esempio n. 50
0
    def _new(self):
        results = self.form_result['funding_type']

        c.funding_type = FundingType(**results)
        meta.Session.add(c.funding_type)
        meta.Session.commit()

        h.flash("Funding type created")
        redirect_to(action='view', id=c.funding_type.id)
Esempio n. 51
0
    def _new(self):
        results = self.form_result['proposal_type']

        c.proposal_type = ProposalType(**results)
        meta.Session.add(c.proposal_type)
        meta.Session.commit()

        h.flash("Proposal type created")
        redirect_to(action='view', id=c.proposal_type.id)
Esempio n. 52
0
    def _new(self):
        results = self.form_result['special_offer']

        c.special_offer = SpecialOffer(**results)
        meta.Session.add(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer created")
        redirect_to(action='view', id=c.special_offer.id)
Esempio n. 53
0
    def _new(self):
        results = self.form_result['schedule']

        c.schedule = Schedule(**results)
        meta.Session.add(c.schedule)
        meta.Session.commit()

        h.flash("Schedule created")
        redirect_to(action='new', id=None)
Esempio n. 54
0
    def _new(self):
        results = self.form_result['event']

        c.event = Event(**results)
        meta.Session.add(c.event)
        meta.Session.commit()

        h.flash("Event created")
        redirect_to(action='index', id=None)
Esempio n. 55
0
    def _new(self):
        results = self.form_result['location']

        c.location = Location(**results)
        meta.Session.add(c.location)
        meta.Session.commit()

        h.flash("Location created")
        redirect_to(action='index', id=None)
Esempio n. 56
0
    def _new(self):
        results = self.form_result['event']

        c.event = Event(**results)
        meta.Session.add(c.event)
        meta.Session.commit()

        h.flash("Event created")
        redirect_to(action='index', id=None)
Esempio n. 57
0
    def _new(self):
        results = self.form_result['special_offer']

        c.special_offer = SpecialOffer(**results)
        meta.Session.add(c.special_offer)
        meta.Session.commit()

        h.flash("Special Offer created")
        redirect_to(action='view', id=c.special_offer.id)