Esempio n. 1
0
def destraction2(request):
    if request.POST:
        if request.GET.has_key('next'):
            next = request.GET['next']
        else:
            next = ''
        for key in request.POST.keys():
            try:
                fmoper.remove(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)
Esempio n. 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)
Esempio n. 3
0
 def save(self, request):
     for file in self.files:
         self.handle_uploaded_file(file)
         createHistory(request.user, "add", os.path.join(self.path, file.name))
     return True
Esempio n. 4
0
        else:
            return raise_error(request,
                form.errors)
    else:
        return raise_error(request,
                [_(u"Empty form.")])

@permission_required('fileman.can_fm_del')
@rightPath()
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)])
    createHistory(request.user, "delete", path)
    if request.is_ajax():
        return json({"status": "success"})
    else:
        return ls(request, os.path.dirname(path))

@permission_required('fileman.can_fm_del')
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])))
Esempio n. 5
0
 def save(self, request):
     for file in self.files:
         self.handle_uploaded_file(file)
         createHistory(request.user, "add",
                       os.path.join(self.path, file.name))
     return True