index.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <!--This file is part of centurio.work/edi.
  2. centurio.work/edi is free software: you can redistribute it and/or modify it
  3. under the terms of the GNU General Public License as published by the Free
  4. Software Foundation, either version 3 of the License, or (at your option) any
  5. later version.
  6. centurio.work/edi is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  8. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  9. more details.
  10. You should have received a copy of the GNU General Public License along with
  11. centurio.work/edi (file COPYING in the main directory). If not, see
  12. <http://www.gnu.org/licenses/>.
  13. -->
  14. <!DOCTYPE html>
  15. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  16. <head>
  17. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  18. <title>Resources</title>
  19. <!-- libs, do not modify. When local than load local libs. -->
  20. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.min.js') }}"></script>
  21. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.browser.js') }}"></script>
  22. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.svg.min.js') }}"></script>
  23. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.svgdom.min.js') }}"></script>
  24. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/vkbeautify.js') }}"></script>
  25. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/util.js') }}"></script>
  26. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/printf.js') }}"></script>
  27. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs//strftime.min.js') }}"></script>
  28. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/parsequery.js') }}"></script>
  29. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/underscore.min.js') }}"></script>
  30. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.caret.min.js') }}"></script>
  31. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.cookie.js') }}"></script>
  32. <script type="text/javascript" src="{{ url_for('static', filename='js/redis_set_get.js') }}"></script>
  33. <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/ui.js') }}"></script>
  34. <link rel="stylesheet" href="{{ url_for('static', filename='css/ui.css') }}" type="text/css"/>
  35. <link rel="stylesheet" href="{{ url_for('static', filename='css/cdp_ui.css') }}" type="text/css"/>
  36. <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css"/>
  37. <body is="x-ui">
  38. <ui-rest id="main">
  39. <ui-content>
  40. <ui-area id='datacolumn'>
  41. <!-- <ui-rest id="sub"> with this the content does not work for other tabs -->
  42. <ui-tabbar>
  43. <ui-before>
  44. <a class="logo" href="/"> </a>
  45. </ui-before>
  46. <ui-tab class="default" data-tab="drawing" >Drawing
  47. </ui-tab>
  48. <ui-behind ></ui-behind>
  49. </ui-tabbar>
  50. <!--</ui-area>
  51. </ui-rest>-->
  52. <ui-content>
  53. <ui-area data-belongs-to-tab="drawing" >
  54. <div class="images">
  55. <img class="optcontent" id="drawing" src="{{ url_for('send_file', filename=filename) }}" alt="Drawing">
  56. </div>
  57. </ui-area>
  58. </ui-content>
  59. </ui-area>
  60. <ui-resizehandle data-label="drag to resize"></ui-resizehandle>
  61. <ui-area id="detailcolumn1" data-minsize="20em">
  62. <h3 style="text-align:center"> General Information</h3>
  63. <div id="dat_details" class='x-ui-layout'>
  64. <div class="column-one" style="width:50%;float:left">
  65. {{ html_links | safe }}
  66. {% for iso in isos_names %}
  67. {{ iso }} (Document not available)<br>
  68. {% endfor %}
  69. </div>
  70. <div class="column-two" style="width:50%;float:right">
  71. {{ html_general | safe }}
  72. </div>
  73. </div>
  74. <div id="measurements">
  75. <font >
  76. <form>
  77. <table>
  78. <tr>
  79. <td style="text-align:center"><h3>Key Value</h3></td>
  80. <td style="text-align:center"><h3>Target Value</h3></td>
  81. <td style="text-align:center"><h3>Actual Value</h3></td>
  82. <td style="text-align:center"><h3>Relevant Isos</h3></td>
  83. </tr>
  84. {{ text | safe}}
  85. </table>
  86. </form>
  87. </font>
  88. </div>
  89. </ui-area>
  90. </ui-content>
  91. </ui-rest>
  92. <script>
  93. $(document).ready(function(){
  94. $("input[type=number]").on("change keyup input", function(){
  95. var array_value = [];
  96. array_value[0] = $(this).attr('name');
  97. array_value[1] = $(this).val();
  98. var key = 'last' + "_" +'{{og_filename}}';
  99. //console.log({{ dim }});
  100. set_redis(key, array_value);
  101. });
  102. $("input[type=checkbox]").change(function(){
  103. // Print entered value in a div box
  104. $("#result").text($(this).attr('name'));
  105. var key1 = 'last' + "_" +'{{og_filename}}';
  106. var array_value1 = [];
  107. if ($(this).is(':checked')) {
  108. console.log($(this).attr('name') + ' is now checked');
  109. array_value1[0] = 'relevant.' + $(this).attr('name');
  110. array_value1[1] = true;
  111. } else {
  112. console.log($(this).attr('name') + ' is now unchecked');
  113. array_value1[0] = $(this).attr('name');
  114. array_value1[1] = false;
  115. }
  116. set_redis(key1, array_value1);
  117. });
  118. $("input[type=number]").focus(function(){
  119. var number = $(this).attr('name');
  120. var coords = $(this).attr('data-coords');
  121. highlight_areas(coords, "red");
  122. var detail = $(this).attr('data-details');
  123. console.log(detail, "green");
  124. highlight_details(detail, "green");
  125. });
  126. $("input[type=number]").blur(function(){
  127. $("div").removeClass("red");
  128. $("div").removeClass("green");
  129. });
  130. $("ui-area").scroll(function(){
  131. $("input[type=number]").blur();
  132. $("div").removeClass("red");
  133. $("div").removeClass("green");
  134. });
  135. function highlight_areas(coords, color){
  136. let w = {{w}}
  137. let h = {{h}}
  138. let pos = $("#drawing").position();
  139. let drawing_x = pos.left;
  140. let drawing_y = pos.top;
  141. let array_coords = coords.split(",");
  142. let coords_x = parseFloat(array_coords[0]);
  143. let coords_xmax = parseFloat(array_coords[2]);
  144. let coords_y = parseFloat(array_coords[1]);
  145. let coords_ymax = parseFloat(array_coords[3]);
  146. let coords_width = (coords_xmax - coords_x);
  147. let coords_height = (coords_ymax - coords_y);
  148. let width = $("#drawing").width();
  149. let height = $("#drawing").height();
  150. let rel_width = coords_width/h*width*1.4;
  151. let rel_height = coords_height/w*height*1.4;
  152. var orientation = "{{orientation}}";
  153. var x = 0;
  154. var y = 0;
  155. if (orientation == "landscape"){
  156. // x = width*(coords_x*height/width/w);
  157. x = (coords_x*height/w);
  158. // y = height*(coords_y*width/height/h);
  159. y = (coords_y*width/h);
  160. }
  161. else {
  162. x = width*(coords_x/w);
  163. y = height*(coords_y/h);
  164. }
  165. let $point1 = jQuery("<div class="+color+"/>").css({top: (drawing_y + y -5) + 'px', left: (drawing_x + x-5) + 'px', width: rel_width , height: rel_height});
  166. $(".images").append($point1);
  167. };
  168. function highlight_details(coords, color){
  169. let w = {{w}}
  170. let h = {{h}}
  171. let pos = $("#drawing").position();
  172. let drawing_x = pos.left;
  173. let drawing_y = pos.top;
  174. let array_coords = coords.split(",");
  175. let coords_x = parseFloat(array_coords[0]);
  176. let coords_y = parseFloat(array_coords[1]);
  177. let width_div = (parseFloat(array_coords[2]) - parseFloat(array_coords[0]));
  178. let height_div = (parseFloat(array_coords[3]) - parseFloat(array_coords[1]));
  179. let width = $("#drawing").width();
  180. let rel_width = width_div/h*width;
  181. let height = $("#drawing").height();
  182. let rel_height = height*height_div/w;
  183. let x = width*(coords_x*height/width/w);
  184. let y= height*(coords_y*width/height/h);
  185. console.log(rel_width, rel_height);
  186. if (array_coords[3] > 10000) {
  187. rel_height = height - y;
  188. }
  189. let $point = jQuery("<div class="+color+"/>").css({top: (drawing_y + y) + 'px', left: (drawing_x + x) + 'px', width: (rel_width) + 'px', height: (rel_height) + 'px'});
  190. $(".images").append($point);
  191. };
  192. });
  193. </script>
  194. </body>
  195. </html>