index.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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-rest>-->
  51. <ui-content>
  52. <ui-area data-belongs-to-tab="drawing" >
  53. <div class="images">
  54. <img class="optcontent" id="drawing" src="{{ url_for('send_file', filename=filename) }}" alt="Drawing">
  55. </div>
  56. </ui-area>
  57. </ui-content>
  58. </ui-area>
  59. <ui-resizehandle data-label="drag to resize"></ui-resizehandle>
  60. <ui-area id="detailcolumn1" data-minsize="20em">
  61. <h3 style="text-align:center"> General Information</h3>
  62. <div id="dat_details" class='x-ui-layout'>
  63. <div class="column-one" style="width:50%;float:left">
  64. {{ html_links | safe }}
  65. {% for iso in isos_names %}
  66. {{ iso }} (Document not available)<br>
  67. {% endfor %}
  68. </div>
  69. <div class="column-two" style="width:50%;float:right">
  70. {{ html_general | safe }}
  71. </div>
  72. </div>
  73. <div id="measurements">
  74. <font >
  75. <form>
  76. <table>
  77. <tr>
  78. <td style="text-align:center"><h3>Key Value</h3></td>
  79. <td style="text-align:center"><h3>Target Value</h3></td>
  80. <td style="text-align:center"><h3>Actual Value</h3></td>
  81. <td style="text-align:center"><h3>Relevant Isos</h3></td>
  82. </tr>
  83. {{ text | safe}}
  84. </table>
  85. </form>
  86. </font>
  87. </div>
  88. </ui-area>
  89. </ui-content>
  90. </ui-rest>
  91. <script>
  92. $(document).ready(function(){
  93. $("input[type=number]").on("change keyup input", function(){
  94. var array_value = [];
  95. array_value[0] = $(this).attr('name');
  96. array_value[1] = $(this).val();
  97. var key = 'last' + "_" +'{{og_filename}}';
  98. //console.log({{ dim }});
  99. set_redis(key, array_value);
  100. });
  101. $("input[type=checkbox]").change(function(){
  102. // Print entered value in a div box
  103. $("#result").text($(this).attr('name'));
  104. var key1 = 'last' + "_" +'{{og_filename}}';
  105. var array_value1 = [];
  106. if ($(this).is(':checked')) {
  107. console.log($(this).attr('name') + ' is now checked');
  108. array_value1[0] = 'relevant.' + $(this).attr('name');
  109. array_value1[1] = true;
  110. } else {
  111. console.log($(this).attr('name') + ' is now unchecked');
  112. array_value1[0] = $(this).attr('name');
  113. array_value1[1] = false;
  114. }
  115. set_redis(key1, array_value1);
  116. });
  117. $("input[type=number]").focus(function(){
  118. var number = $(this).attr('name');
  119. var coords = $(this).attr('data-coords');
  120. highlight_areas(coords, "red");
  121. var detail = $(this).attr('data-details');
  122. console.log(detail, "green");
  123. highlight_details(detail, "green");
  124. });
  125. $("input[type=number]").blur(function(){
  126. $("div").removeClass("red");
  127. $("div").removeClass("green");
  128. });
  129. $("ui-area").scroll(function(){
  130. $("input[type=number]").blur();
  131. $("div").removeClass("red");
  132. $("div").removeClass("green");
  133. });
  134. function highlight_areas(coords, color){
  135. let w = {{w}}
  136. let h = {{h}}
  137. let pos = $("#drawing").position();
  138. let drawing_x = pos.left;
  139. let drawing_y = pos.top;
  140. let array_coords = coords.split(",");
  141. let coords_x = parseFloat(array_coords[0]);
  142. let coords_xmax = parseFloat(array_coords[2]);
  143. let coords_y = parseFloat(array_coords[1]);
  144. let coords_ymax = parseFloat(array_coords[3]);
  145. let coords_width = (coords_xmax - coords_x);
  146. let coords_height = (coords_ymax - coords_y);
  147. let width = $("#drawing").width();
  148. let height = $("#drawing").height();
  149. let rel_width = coords_width/h*width*1.4;
  150. let rel_height = coords_height/w*height*1.4;
  151. var orientation = "{{orientation}}";
  152. var x = 0;
  153. var y = 0;
  154. if (orientation == "landscape"){
  155. // x = width*(coords_x*height/width/w);
  156. x = (coords_x*height/w);
  157. // y = height*(coords_y*width/height/h);
  158. y = (coords_y*width/h);
  159. }
  160. else {
  161. x = width*(coords_x/w);
  162. y = height*(coords_y/h);
  163. }
  164. 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});
  165. $(".images").append($point1);
  166. };
  167. function highlight_details(coords, color){
  168. let w = {{w}}
  169. let h = {{h}}
  170. let pos = $("#drawing").position();
  171. let drawing_x = pos.left;
  172. let drawing_y = pos.top;
  173. let array_coords = coords.split(",");
  174. let coords_x = parseFloat(array_coords[0]);
  175. let coords_y = parseFloat(array_coords[1]);
  176. let width_div = (parseFloat(array_coords[2]) - parseFloat(array_coords[0]));
  177. let height_div = (parseFloat(array_coords[3]) - parseFloat(array_coords[1]));
  178. let width = $("#drawing").width();
  179. let rel_width = width_div/h*width;
  180. let height = $("#drawing").height();
  181. let rel_height = height*height_div/w;
  182. let x = width*(coords_x*height/width/w);
  183. let y= height*(coords_y*width/height/h);
  184. console.log(rel_width, rel_height);
  185. if (array_coords[3] > 10000) {
  186. rel_height = height - y;
  187. }
  188. 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'});
  189. $(".images").append($point);
  190. };
  191. });
  192. </script>
  193. </body>
  194. </html>