def get(self): list = FileManager.getFiles() template_values = { 'file_list': list, } self.response.write( load_template('download_file.html', template_values))
def get(self): parent_note_id = self.request.get('parent_note_id', '') template_values = { 'parent_note_id': parent_note_id, } return self.response.write( load_template('add_note.html', template_values))
def post(self): self.response.write('%s' % self.request.POST.multi['upload_file']) field = self.request.POST.multi['upload_file'] filename = field.filename self.response.write('\n%s' % filename) content = field.file.read() FileManager.writeFile(filename, content) template_values = { 'to_url': 'download_file_form', } self.response.write( load_template('refresh_to_list_notes.html', template_values))
def get(self): note_id = self.request.get('note_id') note = NoteManager.getNote(note_id) if note.user_id != get_user_id(): self.response.write("note doesn't belong to current user!") return NoteManager.removeNote(note) template_values = { 'to_url': 'list_notes', } self.response.write( load_template('refresh_to_list_notes.html', template_values))
def get(self): note_id = self.request.get('note_id') note = NoteManager.getNote(note_id) if not note.canBeVisitedByCurrentUser(): self.response.write("note doesn't belong to current user!") return template_values = { 'note_id': str(note.note_id), } logging.info("priority is %s" % note.priority) self.response.write(load_template('change_note2.html', template_values))
def get(self): need_tag = self.request.get('tag', 'ALL') tag_values = set() for note in NoteManager.getNotes(): for tag in note.getTags(): tag_values.add(tag) template_values = { 'is_admin': is_admin(), 'tag_values': tag_values, 'need_tag': need_tag, } self.response.write(load_template('list_notes2.html', template_values))
def post(self): file_content = self.request.POST.multi['backup_file'].file.read() items = file_content.split('\n') # map from old_note_id to new_note_id note_id_map = dict() notes = [] for item in items: if not item: continue json_obj = json.loads(item) note_id = json_obj.get('note_id', '') note = NoteManager.getNote(note_id) if note: note_id_map[note_id] = note_id else: user_id = json_obj.get('user_id', '') priority = json_obj.get('priority', '') title = json_obj.get('title', '') task = json_obj.get('task', '') parent_note_id = json_obj.get('parent_note_id', '') tag = json_obj.get('tag', '') date_time = json_obj.get('date_time', '') date_time = datetime.datetime.strptime(date_time, '%Y-%m-%d %H:%M:%S.%f') state = json_obj.get('state', '') children_note_ids = json_obj.get('children_note_ids', '') note = NoteManager.createNote(user_id, priority, title, task, parent_note_id, tag, date_time, state, children_note_ids) note_id_map[note_id] = note.note_id notes.append(note) for note in notes: if note.parent_note_id: note.parent_note_id = note_id_map[note.parent_note_id] child_ids = note.getChildrenNoteIds() note.children_note_ids = '' for child_id in child_ids: note.addChildNote(note_id_map[child_id]) NoteManager.updateNote(note) template_values = { 'to_url' : 'list_notes', } self.response.write(load_template('refresh_to_list_notes.html', template_values))
def get(self): self.response.write(load_template('frontend-app/build/index.html'))
def get(self): backup_all = "?backup_all=true" if self.request.get("backup_all") else "" template_values = { 'backup_all' : backup_all, } return self.response.write(load_template('restore_notes.html', template_values))