Esempio n. 1
0
File: views.py Progetto: Gr1N/sc-web
def content(request):
    result = None
    if request.is_ajax():
        path = request.GET.get(u'path', '/')

        repo = Repository()
        result = repo.get_file_content(path)

    return HttpResponse(result, 'text/plain')
Esempio n. 2
0
File: views.py Progetto: Gr1N/sc-web
def unlock(request):
    result = False
    if request.is_ajax():
        
        path = request.GET.get(u'path', None)
        
        repo = Repository()
        result = repo.unlock(path, request.user.username)
        
    return HttpResponse(json.dumps( { 'success': result } ), 'application/json')
Esempio n. 3
0
File: views.py Progetto: Gr1N/sc-web
def update(request):
    result = False
    if request.is_ajax():
        
        path = request.GET.get(u'path', None)
        
        repo = Repository()
        result = repo.update(path, request.user.username)
        
    return HttpResponse(json.dumps( result ), 'application/json')
Esempio n. 4
0
def search_files(request):
    result = None
    if request.is_ajax:

        path = request.GET.get(u'path', None)
        query = request.GET.get(u'query', None)
        repo = Repository()
        result = repo.search_files(path, query)

    return HttpResponse(json.dumps(result), 'application/json')
Esempio n. 5
0
File: views.py Progetto: Gr1N/sc-web
def list_files(request):
    result = None
    if request.is_ajax():
        path = request.GET.get(u'path', '/')

        repo = Repository()
        tree = repo.tree(path)
        
        result = json.dumps(tree)

    return HttpResponse(result, 'application/json')
Esempio n. 6
0
File: views.py Progetto: Gr1N/sc-web
def commit_info(request):
    result = None
    if request.is_ajax():
        rev = request.GET.get(u'rev', None)

        repo = Repository()
        commit = repo.get_commit(rev)
        
        result = json.dumps(commit)

    return HttpResponse(result, 'application/json')
Esempio n. 7
0
File: views.py Progetto: Gr1N/sc-web
def save(request):
    result = False
    if request.is_ajax():
        
        path = request.POST.get(u'path', None)
        summary = request.POST.get(u'summary', None)
        data = request.POST.get(u'data', None)
        
        repo = Repository()
        result = repo.save(path, data, request.user.username, request.user.email, summary)
        
    return HttpResponse(json.dumps({ 'success': result }), 'application/json')
Esempio n. 8
0
File: views.py Progetto: Gr1N/sc-web
def create(request):
    result = False
    if request.is_ajax():
        
        path = request.POST.get(u'path', None)
        is_dir = request.POST.get(u'is_dir', False)
        
        if is_dir == u'true':
            is_dir = True
        else:
            is_dir = False
        
        repo = Repository()
        result = repo.create(path, is_dir, request.user.username, request.user.email)
        
    return HttpResponse(json.dumps({ 'success': result }), 'application/json')