1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Fix bugs on file upload page

This commit is contained in:
Starbeamrainbowlabs 2017-08-27 16:48:36 +01:00
parent 179c4b500d
commit f393fa88ea
4 changed files with 11 additions and 10 deletions

View file

@ -15,6 +15,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Fixed paths when generating previews in certain environments - Fixed paths when generating previews in certain environments
- Fixed handling of pages and tags with single quotes in the name - Fixed handling of pages and tags with single quotes in the name
- Fixed weirdness on some pages rendered by the Pepperminty Wiki core - Fixed weirdness on some pages rendered by the Pepperminty Wiki core
- Fixed a few minor usability issues on the upload file page.
### Changed ### Changed
- Make `invindex-rebuild` admin-only, but allow access if the POST param `secret` is set to your secret in `peppermint.json` - Make `invindex-rebuild` admin-only, but allow access if the POST param `secret` is set to your secret in `peppermint.json`

View file

@ -4262,7 +4262,7 @@ function stats_save($stats)
register_module([ register_module([
"name" => "Uploader", "name" => "Uploader",
"version" => "0.5.9", "version" => "0.5.10",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.", "description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.",
"id" => "feature-upload", "id" => "feature-upload",
@ -4338,10 +4338,10 @@ register_module([
<p>Select an image or file below, and then type a name for it in the box. This server currently supports uploads up to " . human_filesize(get_max_upload_size()) . " in size.</p> <p>Select an image or file below, and then type a name for it in the box. This server currently supports uploads up to " . human_filesize(get_max_upload_size()) . " in size.</p>
<p>$settings->sitename currently supports uploading of the following file types: " . implode(", ", $settings->upload_allowed_file_types) . ".</p> <p>$settings->sitename currently supports uploading of the following file types: " . implode(", ", $settings->upload_allowed_file_types) . ".</p>
<form method='post' action='?action=upload' enctype='multipart/form-data'> <form method='post' action='?action=upload' enctype='multipart/form-data'>
<label for='file'>Select a file to upload.</label> <label for='file-upload-selector'>Select a file to upload.</label>
<input type='file' name='file' id='file-upload-selector' tabindex='1' /> <input type='file' name='file' id='file-upload-selector' tabindex='1' />
<br /> <br />
<label for='name'>Name:</label> <label for='file-upload-name'>Name:</label>
<input type='text' name='name' id='file-upload-name' tabindex='5' /> <input type='text' name='name' id='file-upload-name' tabindex='5' />
<br /> <br />
<label for='description'>Description:</label> <label for='description'>Description:</label>
@ -4350,7 +4350,7 @@ register_module([
<input type='submit' value='Upload' tabindex='20' /> <input type='submit' value='Upload' tabindex='20' />
</form> </form>
<script> <script>
document.getElementById('file-upload-selector').addEventListener('change', function() { document.getElementById('file-upload-selector').addEventListener('change', function(event) {
var newName = event.target.value.substring(event.target.value.lastIndexOf(\"\\\\\") + 1, event.target.value.lastIndexOf(\".\")); var newName = event.target.value.substring(event.target.value.lastIndexOf(\"\\\\\") + 1, event.target.value.lastIndexOf(\".\"));
console.log('Changing content of name box to:', newName); console.log('Changing content of name box to:', newName);
document.getElementById('file-upload-name').value = newName; document.getElementById('file-upload-name').value = newName;

View file

@ -118,11 +118,11 @@
}, },
{ {
"name": "Uploader", "name": "Uploader",
"version": "0.5.9", "version": "0.5.10",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.", "description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.",
"id": "feature-upload", "id": "feature-upload",
"lastupdate": 1501320696, "lastupdate": 1503848840,
"optional": false "optional": false
}, },
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Uploader", "name" => "Uploader",
"version" => "0.5.9", "version" => "0.5.10",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.", "description" => "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File/' prefix.",
"id" => "feature-upload", "id" => "feature-upload",
@ -77,10 +77,10 @@ register_module([
<p>Select an image or file below, and then type a name for it in the box. This server currently supports uploads up to " . human_filesize(get_max_upload_size()) . " in size.</p> <p>Select an image or file below, and then type a name for it in the box. This server currently supports uploads up to " . human_filesize(get_max_upload_size()) . " in size.</p>
<p>$settings->sitename currently supports uploading of the following file types: " . implode(", ", $settings->upload_allowed_file_types) . ".</p> <p>$settings->sitename currently supports uploading of the following file types: " . implode(", ", $settings->upload_allowed_file_types) . ".</p>
<form method='post' action='?action=upload' enctype='multipart/form-data'> <form method='post' action='?action=upload' enctype='multipart/form-data'>
<label for='file'>Select a file to upload.</label> <label for='file-upload-selector'>Select a file to upload.</label>
<input type='file' name='file' id='file-upload-selector' tabindex='1' /> <input type='file' name='file' id='file-upload-selector' tabindex='1' />
<br /> <br />
<label for='name'>Name:</label> <label for='file-upload-name'>Name:</label>
<input type='text' name='name' id='file-upload-name' tabindex='5' /> <input type='text' name='name' id='file-upload-name' tabindex='5' />
<br /> <br />
<label for='description'>Description:</label> <label for='description'>Description:</label>
@ -89,7 +89,7 @@ register_module([
<input type='submit' value='Upload' tabindex='20' /> <input type='submit' value='Upload' tabindex='20' />
</form> </form>
<script> <script>
document.getElementById('file-upload-selector').addEventListener('change', function() { document.getElementById('file-upload-selector').addEventListener('change', function(event) {
var newName = event.target.value.substring(event.target.value.lastIndexOf(\"\\\\\") + 1, event.target.value.lastIndexOf(\".\")); var newName = event.target.value.substring(event.target.value.lastIndexOf(\"\\\\\") + 1, event.target.value.lastIndexOf(\".\"));
console.log('Changing content of name box to:', newName); console.log('Changing content of name box to:', newName);
document.getElementById('file-upload-name').value = newName; document.getElementById('file-upload-name').value = newName;