def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         text_line_id = TextLine.create(self.request.get('name'), int(card_id)).id()
         text_line = TextLine.find_by_id(text_line_id)
         template = JinjaEnv.get().get_template('templates/text_line/edit_row.html')
         self.response.out.write(template.render({'text_line': text_line}))
 def edit(self, card_id):
     # TODO: handle this some other way
     AppUser.record_access(users.get_current_user())
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/card/edit_form.html')
         self.response.out.write(template.render({'card': card}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         key_level_id = EvalKeyLevel.create(self.request.get('name'), int(self.request.get('score')), int(card_id)).id()
         key_level = EvalKeyLevel.find_by_id(key_level_id)
         template = JinjaEnv.get().get_template('templates/key_level/edit_row.html')
         self.response.out.write(template.render({'key_level': key_level}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         category_id = EvalCategory.create(self.request.get('name'), int(card_id)).id()
         category = EvalCategory.find_by_id(category_id)
         template = JinjaEnv.get().get_template('templates/category/edit_table.html')
         self.response.out.write(template.render({'category': category}))
 def add(self, category_id):
     category = EvalCategory.find_by_id(int(category_id))
     if category.card.is_authorized():
         item_id = EvalItem.create(self.request.get('name'), int(category_id)).id()
         item = EvalItem.find_by_id(item_id)
         template = JinjaEnv.get().get_template('templates/item/edit_row.html')
         self.response.out.write(template.render({'item': item}))
 def edit(self, signature_id):
     sig = Signature.find_by_id(int(signature_id))
     if sig.card.is_authorized():
         sig.name = self.request.get('name')
         sig.save()
         template = JinjaEnv.get().get_template('templates/signature/edit_row.html')
         self.response.out.write(template.render({'signature': sig}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         signature_id = Signature.create(self.request.get('name'), int(card_id)).id()
         signature = Signature.find_by_id(signature_id)
         template = JinjaEnv.get().get_template('templates/signature/edit_row.html')
         self.response.out.write(template.render({'signature': signature}))
 def edit(self, text_line_id):
     text_line = TextLine.find_by_id(int(text_line_id))
     if text_line.card.is_authorized():
         text_line.name = self.request.get('name')
         text_line.save()
         template = JinjaEnv.get().get_template('templates/text_line/edit_row.html')
         self.response.out.write(template.render({'text_line': text_line}))
 def edit(self, item_id):
     item = EvalItem.find_by_id(int(item_id))
     card = item.category.card
     if card.is_authorized():            
         item.name = self.request.get('name')
         item.save()
         template = JinjaEnv.get().get_template('templates/item/edit_row.html')
         self.response.out.write(template.render({'item': item}))
 def edit(self, category_id):
     category = EvalCategory.find_by_id(int(category_id))
     card = category.card
     if card.is_authorized():
         category.name = self.request.get('name')
         category.save()
         template = JinjaEnv.get().get_template('templates/category/edit_table.html')
         self.response.out.write(template.render({'category': category}))
 def edit(self, key_level_id):
     key_level = EvalKeyLevel.find_by_id(int(key_level_id))
     card = key_level.card
     if card.is_authorized():
         key_level.name = self.request.get('name')
         key_level.score = int(self.request.get('score'))
         key_level.save()
         template = JinjaEnv.get().get_template('templates/key_level/edit_row.html')
         self.response.out.write(template.render({'key_level': key_level}))
 def delete_form(self, key_level_id):
     key_level = EvalKeyLevel.find_by_id(int(key_level_id))
     card = key_level.card
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/key_level/delete_form.html')
         self.response.out.write(template.render({'key_level_id': key_level_id, 'key_level': key_level}))
 def delete_form(self, category_id):
     category = EvalCategory.find_by_id(int(category_id))
     card = category.card
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/category/delete_form.html')
         self.response.out.write(template.render({'category_id': category_id, 'category': category}))
 def delete_form(self, signature_id):
     sig = Signature.find_by_id(int(signature_id))
     if sig.card.is_authorized():
         template = JinjaEnv.get().get_template('templates/signature/delete_form.html')
         self.response.out.write(template.render({'signature_id': signature_id, 'signature': sig}))
 def add_owner_form(self, card_id):
     current_user = AppUser.for_user(users.get_current_user())
     if current_user.is_admin:
         template = JinjaEnv.get().get_template('templates/card/owner_add_form.html')
         self.response.out.write(template.render({'card': ReportCard.find_by_id(int(card_id)), 'users': AppUser.list()}))
 def preview(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/card/preview.html')
         self.response.out.write(template.render({'card': ReportCard.find_by_id(int(card_id))}))
 def delete_form(self, text_line_id):
     text_line = TextLine.find_by_id(int(text_line_id))
     if text_line.card.is_authorized():
         template = JinjaEnv.get().get_template('templates/text_line/delete_form.html')
         self.response.out.write(template.render({'text_line_id': text_line_id, 'text_line': text_line}))
 def delete_form(self, item_id):
     item = EvalItem.find_by_id(int(item_id))
     card = item.category.card
     if card.is_authorized():            
         template = JinjaEnv.get().get_template('templates/item/delete_form.html')
         self.response.out.write(template.render({'item_id': item_id, 'item': item}))
 def list(self, card_id):
     # TODO: handle this some other way
     AppUser.record_access(users.get_current_user())
     current_user = AppUser.for_user(users.get_current_user())
     template = JinjaEnv.get().get_template('templates/eval/list.html')
     self.response.out.write(template.render({'card': ReportCard.find_by_id(int(card_id)), 'current_user': current_user}))
 def preview(self, eval_id):
     eval = Evaluation.find_by_id(int(eval_id))
     if eval.card.is_authorized():
         template = JinjaEnv.get().get_template('templates/eval/preview.html')
         self.response.out.write(template.render({'eval': eval, 'data': eval.all_data()}))
 def add_form(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/category/add_form.html')
         self.response.out.write(template.render({'card_id': card_id}))
 def add_form(self):
     template = JinjaEnv.get().get_template('templates/card/add_form.html')
     self.response.out.write(template.render({}))