diff options
-rw-r--r-- | core/views/other.py | 12 | ||||
-rw-r--r-- | media/css/trog3.css | 73 | ||||
-rw-r--r-- | templates/scanuploadform.html | 37 |
3 files changed, 90 insertions, 32 deletions
diff --git a/core/views/other.py b/core/views/other.py index 0d096f2..c7d7eda 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -200,8 +200,7 @@ def ajax_test(request): -class MyForm(forms.Form): # not a model-form - title = forms.CharField(max_length=20) +class MyForm(forms.Form): # not a model-form, just a form-form scanfiles = forms.FileField() @login_required_if_public @@ -218,8 +217,13 @@ def scanupload(request, wallet=None): wallet = "2021:01" # improve this later year = wallet[:4] + if int(year) < 1977: + year = "1977" + if int(year) > 2050: + year = "2050" nexty = f'{int(year)+1}' prevy = f'{int(year)-1}' + wnumber = wallet[5:] next = f'{int(wnumber)+1:02d}' prev = f'{int(wnumber)-1:02d}' @@ -235,11 +239,9 @@ def scanupload(request, wallet=None): if request.method == 'POST': form = MyForm(request.POST,request.FILES) if form.is_valid(): - #form.save() # comment out so nothing saved in MEDIA_ROOT/fileuploads f = request.FILES["scanfiles"] - w = request.POST["title"] multiple = request.FILES.getlist('scanfiles') - fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, w)) + fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, wallet)) actual_saved = [] if multiple: diff --git a/media/css/trog3.css b/media/css/trog3.css index ad33b47..a3e622a 100644 --- a/media/css/trog3.css +++ b/media/css/trog3.css @@ -171,6 +171,12 @@ hr{ div.centre img { vertical-align: middle; }
h1 { text-align: center; font-size: 210%; display: inline;}
+h1 {
+ margin-top:0;
+ margin-left:10px;
+ vertical-align:top;
+}
+
h2 { }
h3 { color: #000 text-align:left; Dborder-bottom:thin solid black; margin-bottom:1em; margin-top:1em; font-weight:bold}
h4 { color: #0d664c; }
@@ -344,12 +350,6 @@ body { }
-h1 {
- margin-top:0;
- margin-left:10px;
- vertical-align:top;
-}
-
.rightMargin {
position:absolute;
@@ -428,8 +428,69 @@ div#difflistajax border: thin green solid;
}
+.fancybutton {
+ color: #ffffff;
+ font: 18px Georgia, "Times New Roman", Times, serif;
+ letter-spacing: 1px;
+
+ text-shadow: 0 1px 1px #000000;
+
+ #display: block;
+/* margin: auto; */
+ font-size: 1.2em;
+ line-height: 1.25em;
+
+ padding: 7px 25px;
+ cursor: pointer;
+ position: static;
+ background: #bf3700;
+ border: 1px solid #60AABF;
+/* -moz-border-radius: 20px;
+ -webkit-border-radius: 20px;
+ -khtml-border-radius: 20px;*/
+ border-radius: 20px;
+ /*
+ -webkit-box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;
+ -moz-box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;
+ -o-box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;*/
+ box-shadow: rgba(0, 0, 0, .25) 0 1px 1px;
+ background: #39b2e5;
+ background: -webkit-gradient(linear, left top, left bottom, from(#39b2e5), to(#6083BF));
+ background: -moz-linear-gradient(top, #39b2e5, #6083BF);
+ background: -o-linear-gradient(top, #39b2e5, #6083BF);
+ background: linear-gradient(top, #39b2e5, #6083BF);
+ }
+
+.fancybutton:hover,
+.fancybutton:focus {
+ cursor: pointer;
+ border-color: blue;
+/* -webkit-box-shadow: aqua 0 0 8px;
+ -moz-box-shadow: aqua 0 0 8px;
+ -o-box-shadow: aqua 0 0 8px; */
+ box-shadow: aqua 0 0 8px;
+}
+
+.fancybutton:active {
+ background: #39b2e5;
+/* background: -webkit-gradient(linear, left bottom, left top, from(#39b2e5), to(#6083BF));
+ background: -moz-linear-gradient(bottom, #39b2e5, #6083BF);
+ background: -o-linear-gradient(bottom, #39b2e5, #6083BF); */
+ background: linear-gradient(bottom, #39b2e5, #6083BF);
+}
+
+/* For the Scan upload form - to be used with a phone */
+::-webkit-file-upload-button {
+ padding: 0.3em;
+ font: 18px Georgia, "Times New Roman", Times, serif;
+width:55%;
+margin-left:20px;
+margin-right:20px;
+margin-top:5px;
+margin-bottom: 5px;
}
+
/*The below are stolen from django admin css*/
.addlink {
background:transparent url("../icon_addlink.gif") no-repeat scroll 0 0.2em;
diff --git a/templates/scanuploadform.html b/templates/scanuploadform.html index 4beae89..af14fbd 100644 --- a/templates/scanuploadform.html +++ b/templates/scanuploadform.html @@ -4,7 +4,7 @@ {% block content %} -<h2>Scanned notes or survey upload into wallet </h2> +<h2>Upload scan into wallet {{wallet}}</h2> <p style="font-family: monospace; font-weight: bold; font-size: 130%; text-align: center"> <a style="font-weight: normal;" href="/scanupload/{{prevy}}:01">{{prevy}}</a> ... @@ -15,39 +15,34 @@ <a style="font-weight: normal;" href="/scanupload/{{nexty}}:01">{{nexty}}</a> </p> - -<div style = "max-width:40%;"> +<div style = "max-width:35%; margin-left:20%; text-align: center; " > <form method ='post' enctype ="multipart/form-data"> {% csrf_token %} - <br> - <input type = "file" multiple="multiple" style = "margin-left:20%;" - placeholder = "Scanfiles" name = "scanfiles" id="scanfiles"> - <br> <br> - <input type = "text" size = "8" style = "margin-left:20%;" - placeholder = "Wallet id e.g. 2021#23" name = "title" value='{{wallet}}'id="wallet"><label for="wallet"> Wallet id</label> - - <center> - <button style = "color: #fff; border:1px; background-color:#999; margin-top:8%; - height:35px; width:80%; margin-left:19%;" type = "submit" value = "Upload" > - <strong>Upload</strong> + <br> + <input class="fancybutton" type = "file" multiple="multiple" + placeholder = "Scanfiles" name = "scanfiles" id="scanfiles" /> + + <br><br><br> + <button class="fancybutton" style="padding: 0.5em 25px; margin-left: 155px" type = "submit" value = "Upload" > + Upload </button> - </center> </form> +</div> +<div style = "max-width:29%; margin-left:20%; text-align: left" > {% if filesaved %} - <p style="margin-left:20%;"> - <b>File(s) saved as + <p> + <b>File(s) saved as <br> {% for f in actual_saved %} - <em>'{{f}}'</em> + <em>{{f}}</em> <br> {% endfor %} <br><br>Upload more?</b> </p> <br> {% endif %} -</div> - <p style="margin-left:20%;"> +<p> {% for f in files %} <a href="/expofiles/surveyscans/{{year}}/{{wallet|urlencode}}/{{f}}">{{ f}}</a><br /> {% endfor %} </p> - {% endblock %} +</div> {% endblock %} |