diff options
-rw-r--r-- | module/config/default.py | 1 | ||||
-rw-r--r-- | module/web/pyload_app.py | 24 | ||||
-rw-r--r-- | module/web/static/css/default_mobile/images/ajax-loader.gif (renamed from module/web/static/css/images/ajax-loader.gif) | bin | 7825 -> 7825 bytes | |||
-rw-r--r-- | module/web/static/css/default_mobile/images/ajax-loader.png (renamed from module/web/static/css/images/ajax-loader.png) | bin | 340 -> 340 bytes | |||
-rw-r--r-- | module/web/static/css/default_mobile/images/icons-18-black.png (renamed from module/web/static/css/images/icons-18-black.png) | bin | 1767 -> 1767 bytes | |||
-rw-r--r-- | module/web/static/css/default_mobile/images/icons-18-white.png (renamed from module/web/static/css/images/icons-18-white.png) | bin | 1806 -> 1806 bytes | |||
-rw-r--r-- | module/web/static/css/default_mobile/images/icons-36-black.png (renamed from module/web/static/css/images/icons-36-black.png) | bin | 3611 -> 3611 bytes | |||
-rw-r--r-- | module/web/static/css/default_mobile/images/icons-36-white.png (renamed from module/web/static/css/images/icons-36-white.png) | bin | 3648 -> 3648 bytes | |||
-rw-r--r-- | module/web/static/css/default_mobile/jquery.mobile-1.1.1.min.css (renamed from module/web/static/css/jquery.mobile-1.1.1.min.css) | 0 | ||||
-rw-r--r-- | module/web/static/css/default_mobile/my.css (renamed from module/web/static/css/default/my.css) | 0 | ||||
-rw-r--r-- | module/web/static/img/default_mobile/fancy_deboss.png | bin | 0 -> 265 bytes | |||
-rw-r--r-- | module/web/static/js/default_mobile/jquery.mobile-1.1.1.min.js (renamed from module/web/static/js/libs/jquery.mobile-1.1.1.min.js) | 0 | ||||
-rw-r--r-- | module/web/static/js/default_mobile/my.js (renamed from module/web/static/js/libs/my.js) | 0 | ||||
-rw-r--r-- | module/web/templates/default/app.html | 19 | ||||
-rw-r--r-- | module/web/templates/default/login.html | 8 | ||||
-rw-r--r-- | module/web/templates/default/logout.html | 9 | ||||
-rw-r--r-- | module/web/templates/default_mobile/base.html | 84 | ||||
-rw-r--r-- | module/web/templates/default_mobile/login.html (renamed from module/web/templates/default/app_login.html) | 6 | ||||
-rw-r--r-- | module/web/utils.py | 9 | ||||
-rw-r--r-- | module/web/webinterface.py | 2 |
20 files changed, 110 insertions, 52 deletions
diff --git a/module/config/default.py b/module/config/default.py index 085061653..fc221ed3a 100644 --- a/module/config/default.py +++ b/module/config/default.py @@ -65,6 +65,7 @@ def make_config(config): config.addConfigSection("webinterface", _("Webinterface"), _("Description"), _("Long description"), [ ("template", "str", _("Template"), _("Tooltip"), "default"), + ("template_mobile", "str", _("Template_Mobile"), _("Tooltip"), "default_mobile"), ("activated", "bool", _("Activated"), _("Tooltip"), True), ("prefix", "str", _("Path Prefix"), _("Tooltip"), ""), ("server", "builtin;threaded;fastcgi;lightweight", _("Server"), _("Tooltip"), "builtin"), diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index eaaabd58e..92ad88944 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -96,13 +96,12 @@ def favicon(): @route('/login', method="GET") def login(): + # set mobilecookie to reduce is_mobile check-time + response.set_cookie("mobile", str(is_mobile())) if not PYLOAD and SETUP: redirect("/setup") else: - if is_mobile(): - return render_to_response("app_login.html", proc=[pre_processor]) - else: - return render_to_response("login.html", proc=[pre_processor]) + return render_to_response("login.html", proc=[pre_processor]) @route('/nopermission') def nopermission(): @@ -114,30 +113,21 @@ def login_post(): username = request.forms.get("username") password = request.forms.get("password") user = PYLOAD.checkAuth(username, password) - if is_mobile(): - response.set_cookie("mobile", str(True)) - if not user: - return render_to_response("app_login.html", {"errors": True}, [pre_processor]) - else: - response.set_cookie("mobile", str(False)) - if not user: - return render_to_response("login.html", {"errors": True}, [pre_processor]) - + if not user: + return render_to_response("login.html", {"errors": True}, [pre_processor]) set_session(request, user) return redirect("/") @route("/toggle_mobile") def toggle_mobile(): response.set_cookie("mobile", str(not is_mobile())) - return redirect("/login") + return redirect("/") @route("/logout") def logout(): s = request.environ.get('beaker.session') s.delete() - if is_mobile(): - return render_to_response("app_login.html", {"logout": True}, [pre_processor]) - return render_to_response("logout.html", proc=[pre_processor]) + return render_to_response("login.html", {"logout": True}, proc=[pre_processor]) @route("/queue") @login_required() diff --git a/module/web/static/css/images/ajax-loader.gif b/module/web/static/css/default_mobile/images/ajax-loader.gif Binary files differindex fd1a189c2..fd1a189c2 100644 --- a/module/web/static/css/images/ajax-loader.gif +++ b/module/web/static/css/default_mobile/images/ajax-loader.gif diff --git a/module/web/static/css/images/ajax-loader.png b/module/web/static/css/default_mobile/images/ajax-loader.png Binary files differindex 13b208ddd..13b208ddd 100644 --- a/module/web/static/css/images/ajax-loader.png +++ b/module/web/static/css/default_mobile/images/ajax-loader.png diff --git a/module/web/static/css/images/icons-18-black.png b/module/web/static/css/default_mobile/images/icons-18-black.png Binary files differindex ce1b758ad..ce1b758ad 100644 --- a/module/web/static/css/images/icons-18-black.png +++ b/module/web/static/css/default_mobile/images/icons-18-black.png diff --git a/module/web/static/css/images/icons-18-white.png b/module/web/static/css/default_mobile/images/icons-18-white.png Binary files differindex 1ab012723..1ab012723 100644 --- a/module/web/static/css/images/icons-18-white.png +++ b/module/web/static/css/default_mobile/images/icons-18-white.png diff --git a/module/web/static/css/images/icons-36-black.png b/module/web/static/css/default_mobile/images/icons-36-black.png Binary files differindex 1a59d7c37..1a59d7c37 100644 --- a/module/web/static/css/images/icons-36-black.png +++ b/module/web/static/css/default_mobile/images/icons-36-black.png diff --git a/module/web/static/css/images/icons-36-white.png b/module/web/static/css/default_mobile/images/icons-36-white.png Binary files differindex 5647bdc94..5647bdc94 100644 --- a/module/web/static/css/images/icons-36-white.png +++ b/module/web/static/css/default_mobile/images/icons-36-white.png diff --git a/module/web/static/css/jquery.mobile-1.1.1.min.css b/module/web/static/css/default_mobile/jquery.mobile-1.1.1.min.css index 3bbf55c66..3bbf55c66 100644 --- a/module/web/static/css/jquery.mobile-1.1.1.min.css +++ b/module/web/static/css/default_mobile/jquery.mobile-1.1.1.min.css diff --git a/module/web/static/css/default/my.css b/module/web/static/css/default_mobile/my.css index 2e73c1f35..2e73c1f35 100644 --- a/module/web/static/css/default/my.css +++ b/module/web/static/css/default_mobile/my.css diff --git a/module/web/static/img/default_mobile/fancy_deboss.png b/module/web/static/img/default_mobile/fancy_deboss.png Binary files differnew file mode 100644 index 000000000..926a762db --- /dev/null +++ b/module/web/static/img/default_mobile/fancy_deboss.png diff --git a/module/web/static/js/libs/jquery.mobile-1.1.1.min.js b/module/web/static/js/default_mobile/jquery.mobile-1.1.1.min.js index 70f71928f..70f71928f 100644 --- a/module/web/static/js/libs/jquery.mobile-1.1.1.min.js +++ b/module/web/static/js/default_mobile/jquery.mobile-1.1.1.min.js diff --git a/module/web/static/js/libs/my.js b/module/web/static/js/default_mobile/my.js index 41203e6c5..41203e6c5 100644 --- a/module/web/static/js/libs/my.js +++ b/module/web/static/js/default_mobile/my.js diff --git a/module/web/templates/default/app.html b/module/web/templates/default/app.html deleted file mode 100644 index 306f4b8bf..000000000 --- a/module/web/templates/default/app.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <title>{% block title %}pyLoad {{ _("Webinterface") }}{% endblock %}</title> - <link href="static/css/default/my.css" rel="stylesheet" type="text/css"/> - <link href="static/css/jquery.mobile-1.1.1.min.css" rel="stylesheet" type="text/css"/> - <script type="text/javascript" src="static/js/libs/jquery-1.8.0.min.js"></script> - <script type="text/javascript" src="static/js/libs/jquery.mobile-1.1.1.min.js"></script> - <script type="text/javascript" src="static/js/libs/my.js"></script> - {% block head %} - {% endblock %} - </head> - <body> - {% block content %} - {% endblock content %} - </body> -</html>
\ No newline at end of file diff --git a/module/web/templates/default/login.html b/module/web/templates/default/login.html index 035853a26..9454b709d 100644 --- a/module/web/templates/default/login.html +++ b/module/web/templates/default/login.html @@ -2,11 +2,17 @@ {% block title %}{{_("Login")}} - {{super()}} {% endblock %} {% block content %} <br> +{% if logout %} +<div id="logged_out"> + <b>{{_("You were successfully logged out.")}}</b> +</div> +{% endif %} +<br> <div class="login"> <div class="login_title"> {{_("Login")}} </div> - <form action="" method="post" accept-charset="utf-8" id="login"> + <form action="/login" method="post" accept-charset="utf-8" id="login"> <input type="hidden" name="do" value="login" /> <div class="login_user"> <span>{{_("Username")}}</span> diff --git a/module/web/templates/default/logout.html b/module/web/templates/default/logout.html deleted file mode 100644 index 8444c4b3f..000000000 --- a/module/web/templates/default/logout.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'default/base.html' %} - -{% block head %} - <meta http-equiv="refresh" content="3; url=/"> -{% endblock %} - -{% block content %} - <p><b>{{_("You were successfully logged out.")}}</b></p> -{% endblock %} diff --git a/module/web/templates/default_mobile/base.html b/module/web/templates/default_mobile/base.html new file mode 100644 index 000000000..d2fec8f2e --- /dev/null +++ b/module/web/templates/default_mobile/base.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <title>{% block title %}pyLoad {{ _("Webinterface") }}{% endblock %}</title> + <link href="static/css/default_mobile/my.css" rel="stylesheet" type="text/css"/> + <link href="static/css/default_mobile/jquery.mobile-1.1.1.min.css" rel="stylesheet" type="text/css"/> + <script type="text/javascript" src="static/js/libs/jquery-1.8.0.min.js"></script> + <script type="text/javascript" src="static/js/default_mobile/jquery.mobile-1.1.1.min.js"></script> + <script type="text/javascript" src="static/js/default_mobile/my.js"></script> + {% block head %} + {% endblock %} + </head> + <body> + +{% block content %} +<!-- home --> +<div data-role="page" id="page1" style="background: url('/static/img/default_mobile/fancy_deboss.png') repeat"> + <div data-role="content" style="padding: 1%"> + <div data-role="navbar" data-iconpos="bottom"> + <ul> + <li> + <a href="#page1" data-theme="a" data-icon="home" class="ui-btn-active ui-state-persist"> + Home + </a> + </li> + <li> + <a href="#page1" data-theme="a" data-icon="plus"> + Add + </a> + </li> + <li> + <a href="#page1" data-theme="a" data-icon="gear"> + Settings + </a> + </li> + <li> + <a href="/logout" data-ajax="false" data-theme="a" data-icon="arrow-r"> + Logout + </a> + </li> + </ul> + </div> + <div data-role="collapsible-set" data-theme="a" data-content-theme="d"> + <div data-role="collapsible" data-collapsed="true"> + <h3> + Package1 + </h3> + </div> + <div data-role="collapsible" data-collapsed="true"> + <h3> + Package2 + </h3> + </div> + <div data-role="collapsible" data-collapsed="false"> + <h3> + Package3 + </h3> + <ul data-role="listview" data-divider-theme="b" data-inset="true"> + <li data-theme="c"> + <a href="#page1" data-transition="slide"> + File1 + </a> + </li> + <li data-theme="c"> + <a href="#page1" data-transition="slide"> + File2 + </a> + </li> + <li data-theme="c"> + <a href="#page1" data-transition="slide"> + File3 + </a> + </li> + </ul> + </div> + </div> + </div> +</div> +{% endblock content %} + + </body> +</html>
\ No newline at end of file diff --git a/module/web/templates/default/app_login.html b/module/web/templates/default_mobile/login.html index ecc41ee92..b3cf4f691 100644 --- a/module/web/templates/default/app_login.html +++ b/module/web/templates/default_mobile/login.html @@ -1,4 +1,4 @@ -{% extends 'default/app.html' %} +{% extends 'default_mobile/base.html' %} {% block title %}{{_("Login")}} - {{super()}} {% endblock %} {% block content %} <!-- Login --> @@ -14,7 +14,7 @@ <b>{{_("You were successfully logged out.")}}</b> </div> {% endif %} - <form action="" method="POST" data-ajax="false"> + <form action="/login" method="POST" data-ajax="false"> <div data-role="fieldcontain"> <fieldset data-role="controlgroup"> <label for="textinput1"> @@ -40,7 +40,7 @@ </div> {% endif %} <div> - <a href="/toggle_mobile" > + <a href="/toggle_mobile" data-ajax="false"> {{_("Desktop Version")}} </a> </div> diff --git a/module/web/utils.py b/module/web/utils.py index 88cc75542..1a15a8a00 100644 --- a/module/web/utils.py +++ b/module/web/utils.py @@ -19,12 +19,15 @@ import re from bottle import request, HTTPError, redirect, ServerAdapter -from webinterface import env, TEMPLATE, PYLOAD - +from webinterface import env, TEMPLATE, TEMPLATE_MOBILE, PYLOAD +# TODO: useful but needs a rewrite, too def render_to_response(name, args={}, proc=[]): for p in proc: args.update(p()) - t = env.get_or_select_template((TEMPLATE + "/" + name, "default/" + name)) + if is_mobile(): + t = env.get_or_select_template((TEMPLATE_MOBILE + "/" + name,"default_mobile/" + name)) + else: + t = env.get_or_select_template((TEMPLATE + "/" + name, "default/" + name)) return t.render(**args) diff --git a/module/web/webinterface.py b/module/web/webinterface.py index d06ba0234..1bff21dbc 100644 --- a/module/web/webinterface.py +++ b/module/web/webinterface.py @@ -58,6 +58,7 @@ from module.common.JsEngine import JsEngine JS = JsEngine() TEMPLATE = config.get('webinterface', 'template') +TEMPLATE_MOBILE = config.get('webinterface', 'template_mobile') DL_ROOT = config.get('general', 'download_folder') LOG_ROOT = config.get('log', 'log_folder') PREFIX = config.get('webinterface', 'prefix') @@ -77,6 +78,7 @@ if not exists(cache): bcc = FileSystemBytecodeCache(cache, '%s.cache') loader = PrefixLoader({ "default": FileSystemLoader(join(PROJECT_DIR, "templates", "default")), + "default_mobile": FileSystemLoader(join(PROJECT_DIR, "templates", "default_mobile")), 'js': FileSystemLoader(join(PROJECT_DIR, 'media', 'js')) }) |