Update upload template.

pull/11/head
grossmj 10 years ago
parent f5d1184b29
commit 2ebac2f20a

@ -23,6 +23,7 @@ Simple file upload & listing handler.
import os
import stat
import tornado.web
from ..version import __version__
from ..config import Config
import logging
@ -44,6 +45,7 @@ class FileUploadHandler(tornado.web.RequestHandler):
server_config = config.get_default_section()
# default projects directory is "~/Documents/GNS3/images"
self._upload_dir = os.path.expandvars(os.path.expanduser(server_config.get("upload_directory", "~/Documents/GNS3/images")))
self._host = request.host
try:
os.makedirs(self._upload_dir)
@ -65,7 +67,11 @@ class FileUploadHandler(tornado.web.RequestHandler):
for filename in os.listdir(path):
items.append(filename)
self.render("upload.html", path=path, items=items)
self.render("upload.html",
version=__version__,
host=self._host,
path=path,
items=items)
def post(self):
"""

@ -1,10 +1,10 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Upload Form</title>
<title>Upload Form for GNS3 server {{version}}</title>
</head>
<body>
<p><h1>Select & Upload</h1></p>
<p><h1>Select & Upload (v{{version}})</h1></p>
<form enctype="multipart/form-data" action="/upload" method="post">
File: <input type="file" name="file" />
<br />
@ -12,7 +12,7 @@ File: <input type="file" name="file" />
<input type="submit" value="upload" />
</form>
{%if items%}
<h3>Files</h3>
<h3>Files on {{host}}</h3>
<ul>
{%for item in items%}
<li>{{path}}/{{item}}</a></li>

@ -23,5 +23,5 @@
# or negative for a release candidate or beta (after the base version
# number has been incremented)
__version__ = "1.0-alpha2"
__version__ = "1.0a3.dev1"
__version_info__ = (1, 0, 0, -99)

Loading…
Cancel
Save