예제 #1
0
파일: webui.py 프로젝트: PierrePaul/Orgapp
def save_new_wiki_page(project):
    auth.require(role='edit', fail_redirect='/login')
    content = request.forms.content
    pagename = request.forms.pagename
    o[project].create_doc(pagename, content, 'md')
    pagename = '/' + project + '/doc/' + pagename
    redirect(pagename + "/edit")
예제 #2
0
def add_task():
    _redirect = '/tasks/add',
    auth.require(
        role='edit',
        fail_redirect='/login?redirect=' + _redirect[0])
    menu = make_tasks_menu()
    statuses = Statuses.select()
    print [x.name for x in statuses]
예제 #3
0
def post_tasks_to_sync(guid):
    """The client forces the server to get new list of tasks
    ie: {'status': [{'id': 0, ...},] }
    """
    #datas = request.post.data
    #print datas
    print dir(request.json.keys())
    auth.require(role='edit', fail_redirect='/login')
    t.save_from_json(request.json)
예제 #4
0
파일: webui.py 프로젝트: PierrePaul/Orgapp
def new_wiki_page(project):
    _redirect = '/' + project + '/doc/new',
    auth.require(
        role='edit',
        fail_redirect='/login?redirect=' + _redirect[0])
    menu = make_wiki_menu(project)
    return(
        dict(
            project=project,
            title="New wiki page",
            leftmenu=menu))
예제 #5
0
def update_task(tid):
    auth.require(role='edit', fail_redirect='/login')
    new_pos = request.query.new_pos
    new_status = request.query.new_status
    #new_description = request.query.description
    # change status before position, moving position is relative to statuses
    # FIXME: reduce number of commits/writes
    if new_status != 'null':
        _count = o.count_tasks_by_status(tid)
        o.set_position(tid, _count - 1)
        o.set_status(tid, new_status)
        _count = o.count_tasks_by_status(tid)
        o.force_position(tid, _count - 1)
    o.set_position(tid, new_pos)
예제 #6
0
def create_task():
    auth.require(role='edit', fail_redirect='/login')
    name = request.forms.name
    description = request.forms.description
    #position = request.forms.position
    status = request.forms.status
    project = request.forms.project
    # do something with tasklists
    #t.create(name, position, status)
    print "name: " + name
    print "projects :" + str(o[project])
    print "project path: " + o[project].r.path
    o.add_task(name, status, description, project)
    redirect('/tasks')
예제 #7
0
파일: webui.py 프로젝트: PierrePaul/Orgapp
def save_wiki_page(project, path):
    _redirect = '/' + project + '/doc/' + path + '/edit',
    auth.require(
        role='edit',
        fail_redirect='/login?redirect=' + _redirect[0])
    menu = make_wiki_menu(project, path)
    content = request.forms.content
    o[project].create_doc(path, content, 'md')
    pagename = '/' + project + '/doc/' + path
    return(
        dict(
            project=project,
            pagename=pagename,
            content=content,
            title="Edit {0}".format(path),
            leftmenu=menu))
예제 #8
0
파일: webui.py 프로젝트: PierrePaul/Orgapp
def edit_wiki_page(project, path):
    _redirect = '/' + project + '/doc/' + path + '/edit',
    auth.require(
        role='edit',
        fail_redirect='/login?redirect=' + _redirect[0])
    pagename = '/' + project + '/doc/' + path
    menu = make_wiki_menu(project, path)
    # get raw content
    # FIXME: how to not force .md?
    # find a way to identify rendered cache and map it to their original
    # - cache only render-able content
    # - put render somewhere different
    # - keep the extension for cached file
    # - use db :(
    content = o[project].doc_files.get_doc(path + '.md', False)
    return(
        dict(
            pagename=pagename,
            content=content,
            project=project,
            title="Edit {0}".format(path),
            leftmenu=menu))
예제 #9
0
def show_to_sync():
    auth.require(role='edit', fail_redirect='/login')
    return {'local': t.sync_tasks()[0], 'remote': t.sync_tasks()[1]}
예제 #10
0
def delete_task(tid):
    auth.require(role='edit', fail_redirect='/login')
    return o.delete(tid)
예제 #11
0
def update_task_ajax(tid):
    auth.require(role='edit', fail_redirect='/login')
    # TODO clear html from title
    o.set_title(tid, request.params.title)
    o.set_description(tid, request.params.description)