Ejemplo n.º 1
0
def _create_view(un, vtitle, pid=None, vname=""):
    if vname=="":
        vname="cat_"+__newid()
    view=__create_viewdict(un+"_"+vname, vtitle, [])
    core.setdoc('task-views', view)
    if pid:
        _change_view_path(pid, view['_id'])
    return view['_id']
Ejemplo n.º 2
0
def _change_view_path(pvid, cvid, called_recursive=False):
    new_parent=core.getdoc('task-views', pvid)
    child=core.getdoc('task-views', cvid)
    old_path=child['path'][:]
    new_parent['subviews'].append(cvid)
    child['path']=new_parent['path']+[new_parent['_id']]
    core.setdoc('task-views', new_parent)
    core.setdoc('task-views', child)
    if not called_recursive:
        toclean=[]
        for i in old_path:
            if not i in new_parent['path']:
                toclean.append(i)
        for i in child['tasks']:
            _del_task_from_views(toclean, i)
    for i in child['subviews']:
        _change_view_path(cvid, i, called_recursive=True)
Ejemplo n.º 3
0
def _new_user(un, pw):
    userdoc=__create_userdict(un, pw)
    core.setdoc('users', userdoc)
Ejemplo n.º 4
0
def _create_group(bossid, name):
    glob=core.getdoc('groups', "glob")
    glob['counter']=glob['counter']+1
    temp=__create_group_dict(bossid, name, glob['counter'])
    core.setdoc('groups', glob)
    return core.setdoc('groups', temp)
Ejemplo n.º 5
0
def _add_member(uid, gid):
    group=core.getdoc('groups', str(gid))
    group['members'].append(uid)
    core.setdoc('groups', group)
Ejemplo n.º 6
0
def _del_task_from_view(vid, tid):
    view=core.getdoc('task-views', vid)
    if tid in view['tasks']:
        view['tasks'].remove(tid)
        core.setdoc('task-views', view)
Ejemplo n.º 7
0
def _add_task_to_view(vid, tid, dest="tasks"):
    view=core.getdoc('task-views', vid)
    view[dest].append(tid)
    core.setdoc('task-views', view)
Ejemplo n.º 8
0
def _create_proj(un, ptitle, pid):
    pname="proj_"+__newid()
    proj=__create_projdict(un+"_"+pname, ptitle, [])
    core.setdoc('task-views', proj)
    _change_view_path(pid, proj['_id'])
    return proj['_id']
Ejemplo n.º 9
0
def _set_task(task):
    core.setdoc('tasks', task)
Ejemplo n.º 10
0
def _upd_task_order(vid, neworder):
    newview=core.getdoc('task-views', vid)
    newview['tasks']=neworder
    core.setdoc('task-views', newview)