From 9453269684b8d17411d8bbc4ecd0c7958670ff42 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 21 Dec 2009 19:59:59 +0100 Subject: log view, progressbar test --- module/web/pyload/views.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'module/web/pyload/views.py') diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 1fa9d45b7..e38a0abf5 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Create your views here. import mimetypes from django.http import HttpResponse @@ -136,5 +138,12 @@ def download(request,path): @login_required @permission('pyload.user.can_see_logs') @check_server -def logs(request): - return render_to_response(join(settings.TEMPLATE,'logs.html'), RequestContext(request,{},[status_proc])) \ No newline at end of file +def logs(request, page=0): + + log = file(join(settings.LOG_ROOT, "log.txt")).readlines() + data = [] + page = int(page) + for i in range(page, page+20): + data.append({'line': i+1 , 'content' :log[i]}) + + return render_to_response(join(settings.TEMPLATE,'logs.html'), RequestContext(request,{'log': data, 'next': str(page+20) , 'prev': 0 if page-20 < 0 else page-20},[status_proc])) \ No newline at end of file -- cgit v1.2.3