index.html 9.8 KB

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