def admin_text_edit(id): if logged_in(request): text = Text().by_id(id) stringdict = {} # set sizestring depending on `size` (int) in db if text['size'] == 1: stringdict['sizestring'] = 'small' elif text['size'] == 2: stringdict['sizestring'] = 'mid' elif text['size'] == 3: stringdict['sizestring'] = 'big' # set formatstring depending on `format` (int) in db if text['format'] == 0: stringdict['formatstring'] = "landscape" elif text['format'] == 1: stringdict['formatstring'] = "portrait" # set alignmentstring depending on `alignment` (int) in db if text['alignment'] == -1: stringdict['alignmentstring'] = "left" elif text['alignment'] == 0: stringdict['alignmentstring'] = "center" elif text['alignment'] == 1: stringdict['alignmentstring'] = "right" # set overlapstring depending on `overlap` (int) in db if text['overlap'] == 1: stringdict['overlapstring'] = "light" elif text['overlap'] == 2: stringdict['overlapstring'] = "medium" elif text['overlap'] == 3: stringdict['overlapstring'] = "strong" return template('admin/text/edit', text = text, textinfo = stringdict, categories = Category().text_categories())
def admin_category_new(): if logged_in(request): if saved(request): Category().create(request.GET) redirect('/admin/category') else: return template('admin/category/new', types = Category().types(), parents=Category().all())
def admin_text_edit(): if logged_in(request): request.POST['home'] = request.forms.get('home') request.POST['footer'] = request.forms.get('footer') request.POST['sidebar'] = request.forms.get('sidebar') Text().update(request.POST) redirect('/admin/text')
def admin_category_edit(id): if logged_in(request): if saved(request): Category().update(request.GET) redirect('/admin/category') else: return template('admin/category/edit', types = Category().types(), category = Category().by_id(id), parents = Category().all())
def meta_show(): if logged_in(request): f = open('app/route/meta.txt', 'r') d= f.readline() k= f.readline() a= f.readline() f.close() return template('admin/keywords/edit', description = d, keywords = k, author = a)
def meta_update(): if logged_in(request): description = request.POST.get('description', '').strip() keywords = request.POST.get('keywords', '').strip() author = request.POST.get('author', '').strip() f = open('app/route/meta.txt', 'w') f.write(description + "\n" + keywords + "\n" + author) f.close() redirect('/admin/meta')
def meta_update(): if logged_in(request): description = request.POST.get('description', '').strip() keywords = request.POST.get('keywords', '').strip() author= request.POST.get('author', '').strip() f = open('app/route/meta.txt', 'w') f.write(description + "\n" + keywords + "\n" + author) f.close() redirect('/admin/meta')
def admin_category_new(): if logged_in(request): if saved(request): Category().create(request.GET) redirect('/admin/category') else: return template('admin/category/new', types=Category().types(), parents=Category().all())
def admin_category_edit(id): if logged_in(request): if saved(request): Category().update(request.GET) redirect('/admin/category') else: return template('admin/category/edit', types=Category().types(), category=Category().by_id(id), parents=Category().all())
def meta_show(): if logged_in(request): f = open('app/route/meta.txt', 'r') d = f.readline() k = f.readline() a = f.readline() f.close() return template('admin/keywords/edit', description=d, keywords=k, author=a)
def password_update(): if logged_in(request): password = request.POST.get('oldpassword', '').strip() newpass = request.POST.get('newpassword', '').strip() newpass2 = request.POST.get('newpassword2', '').strip() f = open('app/route/password.txt', 'r') currentpassword = f.read().strip() f.close() if password == currentpassword and newpass == newpass2: f = open('app/route/password.txt', 'w') f.write(newpass) f.close() redirect('/admin/password')
def impressum(): if logged_in(request): impressum = request.POST.get('impressum', '').strip() footer = request.POST.get('footer', '').strip() description = request.POST.get('description', '').strip() keywords = request.POST.get('keywords', '').strip() author= request.POST.get('author', '').strip() f = open('app/route/impressum.txt', 'w') f.write(impressum) f.close() f = open('app/route/footer.txt', 'w') f.write(footer) f.close() f = open('app/route/meta.txt', 'w') f.write(description + "\n" + keywords + "\n" + author) f.close() redirect('/admin/stuff')
def impressum(): if logged_in(request): f = open('app/route/impressum.txt', 'r') g = open('app/route/footer.txt', 'r') h = open('app/route/meta.txt', 'r') d= h.readline() k= h.readline() a= h.readline() impressum = f.read() footer = g.read() data = f.read() return template('admin/stuff.tpl', impressum = impressum, description = d, keywords = k, author = a, footer = footer )
def admin_video_edit(id): if logged_in(request): Video().update(request.POST) redirect('/admin/video')
def admin_video_new(): if logged_in(request): Video().insert(request.POST) redirect('/admin/video')
def admin_video_category(id): if logged_in(request): return template('admin/video/all', videos=Video().by_category(id), categories=Category().video_categories(), sortable=True)
def admin_link_new_form(): if logged_in(request): return template('admin/link/new')
def admin_picture_category(id): if logged_in(request): return template('admin/picture/all', pictures = Picture().by_category(id), categories = Category().picture_categories(), sortable=True)
def admin_picture_edit(id): if logged_in(request): return template('admin/picture/edit', picture = Picture().by_id(id), categories = Category().picture_categories())
def admin_text(): if logged_in(request): return template('admin/text/all.tpl', texts = Text().get_metas(), categories = Category().text_categories(), sortable = False)
def admin_link_edit(): if logged_in(request): Link().update(request.POST) redirect('/admin/link')
def admin_text_delete(id): if logged_in(request): Text().delete(id) redirect('/admin/text')
def admin_link_delete(id): if logged_in(request): Link().delete(id) redirect('/admin/link')
def admin_link(): if logged_in(request): return template('admin/link/all', links = Link().get_metas(), sortable = False)
def admin_text_new_form(): if logged_in(request): return template('admin/text/new', categories = Category().text_categories())
def admin_text_category(id): if logged_in(request): return template('admin/text/all', texts = Text().by_category(id), categories = Category().text_categories(), sortable=True)
def admin_category(): if logged_in(request): return template('admin/category/all', categories=Category().text_categories(), sortable=True)
def admin_link_edit(id): if logged_in(request): return template('admin/link/edit', link = Link().by_id(id))
def admin_picture_new(): if logged_in(request): Picture().insert(request.POST) redirect('/admin/picture')
def admin_category_delete(id): if logged_in(request): Category().delete(id) redirect('/admin/category')
def admin_picture_edit(): if logged_in(request): Picture().update(request.POST) redirect('/admin/picture')
def admin_category(): if logged_in(request): return template('admin/category/all', categories = Category().text_categories(), sortable=True )
def admin_picture_delete(id): if logged_in(request): Picture().delete(id) redirect('/admin/picture')
def admin_link_new(): if logged_in(request): Link().insert(request.POST) redirect('/admin/link')
def admin_video_delete(id): if logged_in(request): Video().delete(id) redirect('/admin/video')
def admin_video_new_form(): if logged_in(request): return template('admin/video/new', categories=Category().video_categories())
def admin_link_edit(id): if logged_in(request): return template('admin/link/edit', link=Link().by_id(id))
def admin_video_edit_form(id): if logged_in(request): return template('admin/video/edit', categories=Category().video_categories(), video=Video().by_id(id))
def password_edit(): if logged_in(request): return template('admin/password/edit')
def admin_picture_new_form(): if logged_in(request): return template('admin/picture/new', categories = Category().picture_categories())
def admin_link(): if logged_in(request): return template('admin/link/all', links=Link().get_metas(), sortable=False)