Beispiel #1
0
def delete2(request):
    if request.POST:
        if request.GET.has_key('next'):
            next = request.GET['next']
        else:
            next = ''
        for key in request.POST.keys():
            try:
                fmoper.move(request.POST[key], "%s/%s" % (BASKET_FOLDER, os.path.basename(request.POST[key])))
            except Exception, msg:
                return raise_error(request, [str(msg)])
            createHistory(request.user, "destraction", request.POST[key])
        if request.is_ajax():
            return json({"status": "success"})
        return HttpResponseRedirect('/fm/list/%s' % next)
Beispiel #2
0
def rename(request, path=None, newName=None):
    if path is None:
        return raise_error(request,
                [_(u"Input error")])
    if newName is None:
        if request.GET.has_key('newname'):
            newName = request.GET['newname']
        else:
            return raise_error(request,
                    [_(u"Input error")])
    path = toString(path)
    newName = toString(newName)
    dest = os.path.join(os.path.dirname(path), newName)
    fmoper.move(path, dest)
    createHistory(request.user, "rename", path, dest)
    if request.GET.has_key('next'):
        next = request.GET['next']
    else:
        next = ''
    if request.is_ajax():
        return json({"status": "success", "path": dest})
    return HttpResponseRedirect('/fm/list/%s' % next)
Beispiel #3
0
def delete(request, path, inside=False):
    path = toString(path)
    try:
        fmoper.move(path, "%s/%s" % (BASKET_FOLDER, os.path.basename(path)))
    except Exception, msg:
        return raise_error(request, [str(msg)])