1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 09:18:08 +00:00

Update upload template.

This commit is contained in:
grossmj 2014-04-19 18:37:10 -06:00
parent f5d1184b29
commit 2ebac2f20a
3 changed files with 11 additions and 5 deletions

View File

@ -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):
"""

View File

@ -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>

View File

@ -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)