home.twig 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {#
  2. /**
  3. * Public Printer Control System
  4. *
  5. * Copyright © 2018 - 2019, Aaron Speer, aaron.speerfamily.ie ajamesspeer@gmail.com.
  6. * All Rights Reserved.
  7. */
  8. #}
  9. {% extends "templates/app.twig" %}
  10. {% block content %}
  11. <div class="page-header">
  12. <h1>Welcome to the {{name}} Public Printing Web App</h1>
  13. </div>
  14. {% for message in messages %}
  15. {{ makeError(message[0], message[1], message[2]) | raw }}
  16. {% endfor %}
  17. <div class="row">
  18. <div class="col-md-6">
  19. <div class="panel panel-warning">
  20. <div class="panel-heading">Printing Instructions</div>
  21. <div class="panel-body">
  22. <ol>
  23. <li>Select the file you wish to print using the button on this page. PDFs work best, however most simple Word files should work.</li>
  24. <li>{{instr}}</li>
  25. <li>Press the "Preview and Print" button</li>
  26. <li>You will then be prompted to view the file, enter number of copies and select printer</li>
  27. <li>Your document will then be added to the print queue</li>
  28. </ol>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="col-md-6">
  33. <div id="upbox" class="panel panel-info">
  34. <div class="panel-heading">Please select the file you wish to print</div>
  35. <div class="panel-body">
  36. <span class="text-success" style="font-weight: bold;">Supported Formats:</span> PDF (.pdf) and most image files (.png), etc<br>
  37. <span class="text-info" style="font-weight: bold;">Partially Supported Formats:</span> Microsoft Word (.docx), Microsoft Word (.doc), Open Office (.odt) and most other document formats.<br>
  38. <span class="text-danger" style="font-weight: bold;">Unsupported Formats:</span> Apple Pages (.pages)
  39. <br><br>
  40. <form action="/upload" method="post" enctype="multipart/form-data">
  41. <label id="button" class="btn btn-success btn-file">
  42. Select File<input type="file" name="file" size="500" style="display: none;">
  43. </label>
  44. <br>
  45. <p id="uploaded"></p>
  46. <input type="submit" class="btn btn-success" value="Preview and Print" />
  47. </form>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. {% endblock %}
  53. {% block js %}
  54. <script>
  55. $(function() {
  56. $(document).on('change', ':file', function() {
  57. var input = $(this),
  58. numFiles = input.get(0).files ? input.get(0).files.length : 1,
  59. label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
  60. input.trigger('fileselect', [numFiles, label]);
  61. });
  62. $(document).ready( function() {
  63. $(':file').on('fileselect', function(event, numFiles, label) {
  64. var input = $(this).parents('.input-group').find(':text'),
  65. log = numFiles > 1 ? numFiles + ' files selected' : label;
  66. if( input.length ) {
  67. input.val(log);
  68. } else {
  69. var str2 = "File Selected: "
  70. if( log ) {
  71. document.getElementById("uploaded").innerHTML = str2.concat(log);
  72. document.getElementById("button").classList.remove('btn-success');
  73. document.getElementById("button").classList.add('btn-default');
  74. document.getElementById("button").classList.add('disabled');
  75. document.getElementById("upbox").classList.remove('panel-info');
  76. document.getElementById("upbox").classList.add('panel-success');
  77. }
  78. }
  79. });
  80. });
  81. });
  82. </script>
  83. {% endblock %}