Ejemplo n.º 1
0
def notice_new():
    form = forms.NoticePostForm()
    if form.validate_on_submit():
        models.post_notice(form.title.data,
                           form.mosttop.data,
                           form.start_date.data,
                           form.end_date.data,
                           form.content.data)
        models.admin_log(session['user_id'], u'[%s] 공지사항 생성: %s (%s ~ %s)' % (request.remote_addr, form.title.data, form.start_date.data, form.end_date.data))
        return redirect(url_for('operate.notice'))

    return render_template('operate/notice_edit.html', 
                           form=form, h=helpers)
Ejemplo n.º 2
0
def maintenance():
    if request.args.has_key('unlock'):
        models.admin_log(session['user_id'], u"[%s] 점검 즉시 해지를 수행하였습니다." % (request.remote_addr))
        models.end_maintenance()

    # 이미 메인터넌스 모드일 경우, 점검 정보를 보여주고, 해지 여부 결정
    maint = models.maintenance()
    if maint:
        return render_template('operate/maintenance_unlock.html', 
                               maint = maint)

    form = forms.MaintenanceForm()
    if form.validate_on_submit():
        models.admin_log(session['user_id'], u"[%s] 점검 시작(종료예정:%s):%s" % (request.remote_addr, form.end_date.data, form.reason.data))
        models.start_maintenance(form.reason.data, form.end_date.data)
        return redirect(url_for('operate.maintenance'))

    return render_template('operate/maintenance_lock.html', 
                           form=form, h=helpers)
Ejemplo n.º 3
0
def notice_edit(notice_id):
    form = forms.NoticePostForm()
    if form.validate_on_submit():
        models.update_notice(notice_id,
                             form.title.data,
                             form.mosttop.data,
                             form.start_date.data,
                             form.end_date.data,
                             form.content.data)
        models.admin_log(session['user_id'], u"[%s] 공지사항 수정: %s" % (request.remote_addr, notice_id))
        return redirect(url_for('operate.notice'))
    else:
        notice = models.notice(notice_id)
        if not notice:
            return abort(404)

        form.title.data = notice['title']
        form.mosttop.data = notice['mosttop']
        form.start_date.data = notice['start_date']
        form.end_date.data = notice['finish_date']
        form.content.data = notice['content']

    return render_template('operate/notice_edit.html', 
                           form=form, h=helpers)
Ejemplo n.º 4
0
def notice_delete(notice_id):
    models.delete_notice(notice_id)
    models.admin_log(session['user_id'], u"[%s] 공지사항 삭제: %s" % (request.remote_addr, notice_id))
    return redirect(url_for('operate.notice'))