diff options
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-x | kpov_judge/web/kpov_judge/kpov_judge.py | 14 | ||||
-rw-r--r-- | kpov_judge/web/kpov_judge/templates/task_greeting.html | 27 |
2 files changed, 33 insertions, 8 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py index b832007..2231db0 100755 --- a/kpov_judge/web/kpov_judge/kpov_judge.py +++ b/kpov_judge/web/kpov_judge/kpov_judge.py @@ -250,7 +250,11 @@ def task_greeting(class_id, task_id, lang): # instructions = instructions.format(**public_params).encode('utf8') except Exception as e: instructions = str(e) - computer_list = db.student_computers.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}) + computer_list = list(db.student_computers.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id})) + backing_images = set() + for computer in computer_list: + for disk_url in computer.get('disk_urls', []): + backing_images |= set(disk_url['backing']) if request.args.get('narediStack', 'false') == 'true': #db.student_tasks.update({'task_id': task_id, 'student_id': student_id}, {'$set': {'create_openstack': True}}, upsert = True) openstackCreated = False # Spremeni na True, ko odkomentiras zgornjo vrstico. @@ -261,7 +265,13 @@ def task_greeting(class_id, task_id, lang): openstackCreated = True else: openstackCreated = False - return render_template('task_greeting.html', computers=computer_list, lang=lang, openstack=openstackCreated, instructions=instructions) + return render_template('task_greeting.html', + disk_base_url='/'.join([app.config['STUDENT_DISK_URL'], student_id, class_id, task_id, '']), + computers=computer_list, + backing_images=sorted(backing_images), + lang=lang, + openstack=openstackCreated, + instructions=instructions) @app.route('/tasks/<class_id>/<task_id>/params.json', methods=['GET', 'POST']) diff --git a/kpov_judge/web/kpov_judge/templates/task_greeting.html b/kpov_judge/web/kpov_judge/templates/task_greeting.html index 188145c..422f14b 100644 --- a/kpov_judge/web/kpov_judge/templates/task_greeting.html +++ b/kpov_judge/web/kpov_judge/templates/task_greeting.html @@ -2,9 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> <html> <body> -<h1> -{{task_id}} -</h1> +<h1>{{task_id}}</h1> <h2>Navodila</h2> <pre> {{instructions}} @@ -14,24 +12,40 @@ <a href='howto/'>Podrobna navodila (HOWTO)</a> </p> +<section class="images"> <h2>Računalniki v vaji</h2> +<section> {% for c in computers %} <h3>{{c['name']}}</h3> {% if 'disk_urls' in c %} <ul> {% for u in c['disk_urls'] %} - <li><a href={{u['url']}}>{{u['name']}}</a></li> + <li><a href={{disk_base_url+u['file']}}>{{u['name']}}</a></li> {% endfor %} </ul> {% else %} Slike navideznih diskov so v izdelavi in bodo kmalu na voljo. {% endif %} {% endfor %} -</p> + <p> -<img src="setup.png"/> +<img src="setup.png"> </p> +</section> + +<section> +{% if backing_images %} +<h3>Osnovne slike</h3> +<ul> +{% for b in backing_images %} + <li><a href={{disk_base_url+b}}>{{b}}</a></li> +{% endfor %} +</ul> +{% endif %} +</section> +</section> + <p> Lahko si ogledate surove: <ul> @@ -40,6 +54,7 @@ Lahko si ogledate surove: <li><a href='../task.html'>preverjalni program</a> (<a href='../task.py'>source</a>)</li> </ul> </p> + <p> {% if openstack %} Openstack projekt za to vajo je že ustvarjen ali v izdelavi (funkcionalnost še ne deluje). |