Example #1
0
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())
Example #2
0
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())
Example #3
0
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')
Example #4
0
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())
Example #5
0
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)
Example #6
0
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')
Example #7
0
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')
Example #8
0
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())
Example #9
0
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())
Example #10
0
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)
Example #11
0
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')
Example #12
0
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')
Example #13
0
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')
Example #14
0
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
        )
Example #15
0
def admin_video_edit(id):
    if logged_in(request):
        Video().update(request.POST)
        redirect('/admin/video')
Example #16
0
def admin_video_new():
    if logged_in(request):
        Video().insert(request.POST)
        redirect('/admin/video')
Example #17
0
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)
Example #18
0
def admin_link_new_form():
    if logged_in(request):
        return template('admin/link/new')
Example #19
0
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)
Example #20
0
def admin_picture_edit(id):
    if logged_in(request):
        return template('admin/picture/edit', picture = Picture().by_id(id),
            categories = Category().picture_categories())
Example #21
0
def admin_text():
    if logged_in(request):
        return template('admin/text/all.tpl', 
            texts = Text().get_metas(),
            categories = Category().text_categories(),
            sortable = False)
Example #22
0
def admin_link_edit():
    if logged_in(request):
        Link().update(request.POST)
        redirect('/admin/link')
Example #23
0
def admin_text_delete(id):
    if logged_in(request):
        Text().delete(id)
        redirect('/admin/text')
Example #24
0
def admin_link_delete(id):
    if logged_in(request):
        Link().delete(id)
        redirect('/admin/link')
Example #25
0
def admin_link():
    if logged_in(request):
        return template('admin/link/all', links = Link().get_metas(), sortable = False)
Example #26
0
def admin_text_new_form():
    if logged_in(request):
        return template('admin/text/new', categories = Category().text_categories())
Example #27
0
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)
Example #28
0
def admin_video_edit(id):
    if logged_in(request):
        Video().update(request.POST)
        redirect('/admin/video')
Example #29
0
def admin_category():
    if logged_in(request):
        return template('admin/category/all',
                        categories=Category().text_categories(),
                        sortable=True)
Example #30
0
def admin_link_edit(id):
    if logged_in(request):
        return template('admin/link/edit', link = Link().by_id(id))
Example #31
0
def admin_picture_new():
    if logged_in(request):
        Picture().insert(request.POST)
        redirect('/admin/picture')
Example #32
0
def admin_category_delete(id):
    if logged_in(request):
        Category().delete(id)
        redirect('/admin/category')
Example #33
0
def admin_picture_edit():
    if logged_in(request):
        Picture().update(request.POST)
        redirect('/admin/picture')
Example #34
0
def admin_category():
    if logged_in(request):
        return template('admin/category/all', categories = Category().text_categories(), sortable=True )
Example #35
0
def admin_picture_delete(id):
    if logged_in(request):
        Picture().delete(id)
        redirect('/admin/picture')
Example #36
0
def admin_link_new():
    if logged_in(request):
        Link().insert(request.POST)
        redirect('/admin/link')
Example #37
0
def admin_video_delete(id):
    if logged_in(request):
        Video().delete(id)
        redirect('/admin/video')
Example #38
0
def admin_link_new():
    if logged_in(request):
        Link().insert(request.POST)
        redirect('/admin/link')
Example #39
0
def admin_video_new_form():
    if logged_in(request):
        return template('admin/video/new',
                        categories=Category().video_categories())
Example #40
0
def admin_link_edit(id):
    if logged_in(request):
        return template('admin/link/edit', link=Link().by_id(id))
Example #41
0
def admin_video_edit_form(id):
    if logged_in(request):
        return template('admin/video/edit',
                        categories=Category().video_categories(),
                        video=Video().by_id(id))
Example #42
0
def admin_link_edit():
    if logged_in(request):
        Link().update(request.POST)
        redirect('/admin/link')
Example #43
0
def admin_video_delete(id):
    if logged_in(request):
        Video().delete(id)
        redirect('/admin/video')
Example #44
0
def admin_link_delete(id):
    if logged_in(request):
        Link().delete(id)
        redirect('/admin/link')
Example #45
0
def password_edit():
    if logged_in(request):
        return template('admin/password/edit')
Example #46
0
def admin_picture_new_form():
    if logged_in(request):
        return template('admin/picture/new', categories = Category().picture_categories())
Example #47
0
def admin_link():
    if logged_in(request):
        return template('admin/link/all',
                        links=Link().get_metas(),
                        sortable=False)
Example #48
0
def password_edit():
    if logged_in(request):
        return template('admin/password/edit')
Example #49
0
def admin_category_delete(id):
    if logged_in(request):
        Category().delete(id)
        redirect('/admin/category')
Example #50
0
def admin_link_new_form():
    if logged_in(request):
        return template('admin/link/new')