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 admin_video_edit_form(id): if logged_in(request): return template('admin/video/edit', categories=Category().video_categories(), video=Video().by_id(id))
def admin_category(): if logged_in(request): return template('admin/category/all', categories=Category().text_categories(), sortable=True)
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_video_new_form(): if logged_in(request): return template('admin/video/new', categories=Category().video_categories())
def admin_picture_edit(id): if logged_in(request): return template('admin/picture/edit', picture = Picture().by_id(id), categories = Category().picture_categories())
def landing(): categories = Category().text_categories() c = categories[0] return template(c['template'], helper=Helper(c['name']))
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_picture_new_form(): if logged_in(request): return template('admin/picture/new', categories = Category().picture_categories())
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_text(): if logged_in(request): return template('admin/text/all.tpl', texts = Text().get_metas(), categories = Category().text_categories(), sortable = False)
def admin_category_delete(id): if logged_in(request): Category().delete(id) redirect('/admin/category')
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_category_sort(json_string): id_list = json.loads(urllib.unquote(json_string)) i = 1 for id in id_list: Category().update_position(id, i) i = i + 1
def landing_category(category): print category c = Category().by_name(category) return template(c['template'], helper=Helper(category))