Browse Source

cleaned code

bscheibel 3 years ago
parent
commit
13cf86339d
53 changed files with 189 additions and 46084 deletions
  1. 0 16
      Pipfile
  2. 0 128
      Pipfile.lock
  3. 1 1
      app/static/js/js_libs/cdp_ui.css
  4. 101 31
      app/static/css/style.css
  5. 0 0
      app/static/css/ui.css
  6. 0 168
      app/static/js/highlight_save.js
  7. 0 98
      app/static/js/js_libs/layout.css
  8. 0 59
      app/static/js/js_libs/tests/dataelements.html
  9. 0 8
      app/static/js/js_libs/tests/dataelements.rng
  10. 0 3
      app/static/js/js_libs/tests/dataelements.xml
  11. 0 185
      app/static/js/js_libs/tests/relaxngui.css
  12. 0 485
      app/static/js/js_libs/tests/relaxngui.js
  13. 0 64
      app/static/js/js_libs/tests/rngtest1.html
  14. 0 147
      app/static/js/js_libs/tests/rngtest1.rng
  15. 0 13
      app/static/js/js_libs/tests/rngtest1.xml
  16. 0 60
      app/static/js/js_libs/tests/rngtest2.html
  17. 0 6
      app/static/js/js_libs/tests/rngtest2.rng
  18. 0 3
      app/static/js/js_libs/tests/rngtest2.xml
  19. 0 60
      app/static/js/js_libs/tests/rngtest3.html
  20. 0 23
      app/static/js/js_libs/tests/rngtest3.rng
  21. 0 9
      app/static/js/js_libs/tests/rngtest3.xml
  22. 0 60
      app/static/js/js_libs/tests/rngtest4.html
  23. 0 19
      app/static/js/js_libs/tests/rngtest4.rng
  24. 0 12
      app/static/js/js_libs/tests/rngtest4.xml
  25. 0 60
      app/static/js/js_libs/tests/rngtest5.html
  26. 0 75
      app/static/js/js_libs/tests/rngtest5.rng
  27. 0 40
      app/static/js/js_libs/tests/rngtest5.xml
  28. 0 60
      app/static/js/js_libs/tests/rngtest6.html
  29. 0 24
      app/static/js/js_libs/tests/rngtest6.rng
  30. 0 6
      app/static/js/js_libs/tests/rngtest6.xml
  31. 0 60
      app/static/js/js_libs/tests/rngtest8.html
  32. 0 13
      app/static/js/js_libs/tests/rngtest8.rng
  33. 0 2
      app/static/js/js_libs/tests/rngtest8.xml
  34. 0 60
      app/static/js/js_libs/tests/rngtest9.html
  35. 0 35
      app/static/js/js_libs/tests/rngtest9.rng
  36. 0 8
      app/static/js/js_libs/tests/rngtest9.xml
  37. 35 11
      app/static/js/js_libs/ui.js
  38. 0 232
      app/static/js/js_libs/ui.js~
  39. 0 41461
      app/static/js/pdf.js
  40. 32 0
      app/static/js/redis_set_get.js
  41. 0 919
      app/static/js/ui_utils.js
  42. 0 12
      app/static/js/url.js
  43. 0 131
      app/static/js/viewer.css
  44. 0 225
      app/static/js/viewer.js
  45. 4 72
      app/templates/index.html
  46. 0 325
      app/templates/index.html~
  47. 0 252
      app/templates/index_old.html
  48. 0 32
      app/templates/public/public_template.html
  49. 16 18
      app/views.py
  50. BIN
      app/views.pyc
  51. 0 292
      app/views.py~
  52. 0 1
      wsgi.py
  53. BIN
      wsgi.pyc

+ 0 - 16
Pipfile

@@ -1,16 +0,0 @@
-[[source]]
-name = "pypi"
-url = "https://pypi.org/simple"
-verify_ssl = true
-
-[dev-packages]
-
-[packages]
-flask = "*"
-flask-cors = "*"
-redis = "*"
-pypdf2 = "*"
-gunicorn = "*"
-
-[requires]
-python_version = "3.7"

+ 0 - 128
Pipfile.lock

@@ -1,128 +0,0 @@
-{
-    "_meta": {
-        "hash": {
-            "sha256": "5f17619d53616852fd5e1e3175ccee0c0d8ba17d529ce735e1f421ece2274517"
-        },
-        "pipfile-spec": 6,
-        "requires": {
-            "python_version": "3.7"
-        },
-        "sources": [
-            {
-                "name": "pypi",
-                "url": "https://pypi.org/simple",
-                "verify_ssl": true
-            }
-        ]
-    },
-    "default": {
-        "click": {
-            "hashes": [
-                "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
-                "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
-            ],
-            "version": "==7.0"
-        },
-        "flask": {
-            "hashes": [
-                "sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52",
-                "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6"
-            ],
-            "index": "pypi",
-            "version": "==1.1.1"
-        },
-        "flask-cors": {
-            "hashes": [
-                "sha256:72170423eb4612f0847318afff8c247b38bd516b7737adfc10d1c2cdbb382d16",
-                "sha256:f4d97201660e6bbcff2d89d082b5b6d31abee04b1b3003ee073a6fd25ad1d69a"
-            ],
-            "index": "pypi",
-            "version": "==3.0.8"
-        },
-        "gunicorn": {
-            "hashes": [
-                "sha256:5a3bf56a1d44c2ed15dae2f9d2a9e7c87acc3517f7225e27e4ece3098a2b5efc",
-                "sha256:fe457b7093b353cefcb2ebc40d192fc7c8a62bba49da648c9e1fa0671fa654d1"
-            ],
-            "index": "pypi",
-            "version": "==20.0.2"
-        },
-        "itsdangerous": {
-            "hashes": [
-                "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
-                "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"
-            ],
-            "version": "==1.1.0"
-        },
-        "jinja2": {
-            "hashes": [
-                "sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f",
-                "sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de"
-            ],
-            "version": "==2.10.3"
-        },
-        "markupsafe": {
-            "hashes": [
-                "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473",
-                "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161",
-                "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235",
-                "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5",
-                "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff",
-                "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b",
-                "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1",
-                "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e",
-                "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183",
-                "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66",
-                "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1",
-                "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1",
-                "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e",
-                "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b",
-                "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905",
-                "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735",
-                "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d",
-                "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e",
-                "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d",
-                "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c",
-                "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21",
-                "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2",
-                "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5",
-                "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b",
-                "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6",
-                "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f",
-                "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f",
-                "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"
-            ],
-            "version": "==1.1.1"
-        },
-        "pypdf2": {
-            "hashes": [
-                "sha256:e28f902f2f0a1603ea95ebe21dff311ef09be3d0f0ef29a3e44a932729564385"
-            ],
-            "index": "pypi",
-            "version": "==1.26.0"
-        },
-        "redis": {
-            "hashes": [
-                "sha256:3613daad9ce5951e426f460deddd5caf469e08a3af633e9578fc77d362becf62",
-                "sha256:8d0fc278d3f5e1249967cba2eb4a5632d19e45ce5c09442b8422d15ee2c22cc2"
-            ],
-            "index": "pypi",
-            "version": "==3.3.11"
-        },
-        "six": {
-            "hashes": [
-                "sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd",
-                "sha256:30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66"
-            ],
-            "version": "==1.13.0"
-        },
-        "werkzeug": {
-            "hashes": [
-                "sha256:7280924747b5733b246fe23972186c6b348f9ae29724135a6dfc1e53cea433e7",
-                "sha256:e5f4a1f98b52b18a93da705a7458e55afb26f32bff83ff5d19189f92462d65c4"
-            ],
-            "version": "==0.16.0"
-        }
-    },
-    "develop": {}
-}

+ 1 - 1
app/static/js/js_libs/cdp_ui.css

@@ -15,7 +15,7 @@
   width: 4.2em;
 }
 [is=x-ui] #main ui-tabbar ui-before .logo {
-  content: url(/static/img/logo.png);
+  content: url( "/img/logo.png" );
   background-size: contain;
   background-repeat: no-repeat;
   width: 4.2em;

+ 101 - 31
app/static/css/style.css

@@ -1,28 +1,3 @@
-
-/* If you want the content centered horizontally and vertically */
-/*.centered {
-  position: absolute;
-  top: 50%;
-  left: 40%;
-  transform: translate(-50%, -50%);
-  text-align: center;
-  margin: 10;
-}
-
-.header_centered {
-  position: absolute;
-  top: 8%;
-  left: 50%;
-  transform: translate(-50%, -50%);
-  text-align: center;
-  margin: 10;
-}
-.thick-border {
-        border: 3px solid black;
-        border-collapse: collapse;
-}*/
-
-/* Style the image inside the centered container, if needed */
 img {
   max-width: 100%;
 }
@@ -34,11 +9,6 @@ img {
   max-width: 2000px;
 }
 
-/*.container {
-    display: flex;
-    flex-wrap: row wrap;
-}*/
-
 .column {
     flex: 1;
     background: #f2f2f2;
@@ -57,7 +27,6 @@ img {
 }
 
 .red{
-/*padding: 10;*/
 background: red;
 opacity: 0.4;
 position: absolute;
@@ -88,3 +57,104 @@ table {
   }
 
 #datacolumn { padding: 0; }
+/*
+
+#graphcolumn {
+  flex: 7.5 1 0%;
+  padding: 0;
+  margin: 0;
+}
+
+#detailcolumn {
+  flex: 2.5 1 0%;
+  padding: 1em 1em 1em 2em;
+  margin: 0;
+}
+
+.optcontent input {
+  width: 8em;
+}
+
+.optcontent .stuff, #detailcolumn .new {
+  padding-left: 1em;
+  padding-bottom: 1em;
+  padding-top: 0.5em;
+}
+.optcontent .stuff > div {
+  padding-bottom: 0.2em;
+}
+
+.optcontent .heading {
+  font-weight: bold;
+}
+
+.draw {
+  width: 1253px;
+  height: 1023px;
+  background-image: url("uebersicht.png");
+  background-repeat: no-repeat;
+  background-position: left top;
+  background-size: contain;
+}
+
+.draw g.node rect {
+  stroke: #a4a4a4;
+  stroke-width: 0.01em;
+  fill: rgba(255, 255, 255, 1);
+}
+
+.draw .station {
+  font-size: 0.06em;
+  padding: 0.2em;
+  border: 0.2em solid #a4a4a4;
+  border-radius: 0.5em;
+  background-color: rgba(255, 255, 255, 1);
+  z-index: 99;
+  width: 7.1em;
+  white-space: pre-line;
+  word-wrap: break-word;
+  overflow-wrap: break-word;
+  overflow: hidden;
+}
+
+.draw g.node:hover rect {
+  fill: rgba(255, 189, 189, 1);
+}
+.draw g.node.active rect {
+  fill: rgba(255, 189, 189, 1);
+}
+
+.draw polyline.conn-red {
+  stroke:rgb(255,0,0);
+  stroke-width:0.2;
+  fill:none;
+}
+.draw polyline.conn-green {
+  stroke:rgb(0,255,0);
+  stroke-width:0.2;
+  fill:none;
+}
+
+.station-condition {
+  padding-left: 2em;
+}
+.station-id {
+  font-weight: bold;
+}
+
+input.c2 {
+  width: 15em;
+}
+input.c3 {
+  width: 4em;
+}
+input.c4 {
+  width: 25em;
+}
+input.c5 {
+  width: 21em;
+}
+input.c6 {
+  width: 2em;
+}
+*/

app/static/js/js_libs/ui.css → app/static/css/ui.css


+ 0 - 168
app/static/js/highlight_save.js

@@ -1,168 +0,0 @@
-    function log(){
-      console.log("test");
-
-    }
-
-    function set_redis(key, value) {
-
-        $.ajax({
-            type: "POST",
-            url: "/redis/set/" + key,
-            data: JSON.stringify({ value: value }),
-            dataType: "json",
-            contentType: "json",
-            success: function(data)
-            {
-                (data.GET);
-            }
-        });
-    }
-
-     function get_redis(key) {
-        $.ajax({
-            type: "GET",
-            url: "redis/get/" + key,
-            data: "format=json",
-            dataType: "text",
-            success: function(data)
-            {
-                $("#result").text(data.GET);
-            }
-        });
-       }
-
-      function split_string(string) {
-            var string = str.split(" ",2);
-            return string;
-        };
-
-
-    $(document).ready(function(){
-
-        $("input[type=number]").on("change keyup input", function(){
-            var array_value = [];
-            array_value[0] = $(this).attr('name');
-            array_value[1] = $(this).val();
-
-            var key = 'last' + "_" +'{{og_filename}}';
-
-            //console.log({{ dim }});
-            set_redis(key, array_value);
-        });
-
-        $("input[type=checkbox]").change(function(){
-
-           // Print entered value in a div box
-           $("#result").text($(this).attr('name'));
-           var key1 = 'last' + "_" +'{{og_filename}}';
-           var array_value1 = [];
-
-           if ($(this).is(':checked')) {
-                console.log($(this).attr('name') + ' is now checked');
-                array_value1[0] = 'relevant.' + $(this).attr('name');
-                array_value1[1] = true;
-            } else {
-                console.log($(this).attr('name') + ' is now unchecked');
-                array_value1[0] = $(this).attr('name');
-                array_value1[1] = false;
-            }
-
-           set_redis(key1, array_value1);
-
-        });
-
-
-
-        $("input[type=number]").focus(function(){
-
-            // highlight values, does not work so far
-
-            var number = $(this).attr('name');
-            var coords = $(this).attr('data-coords');
-            highlight_areas(coords, "red");
-            var detail = $(this).attr('data-details');
-            console.log(detail, "green");
-            highlight_details(detail, "green");
-
-        });
-
-        $("input[type=number]").blur(function(){
-
-          $("div").removeClass("red");
-          $("div").removeClass("green");
-
-        });
-
-
-      function highlight_areas(coords, color){
-
-       let w = {{w}}
-       let h = {{h}}
-       let pos = $("#drawing").position();
-       let drawing_x = pos.left;
-       let drawing_y = pos.top;
-       let array_coords = coords.split(",");
-       let coords_x = parseFloat(array_coords[0]);
-       let coords_xmax = parseFloat(array_coords[2]);
-       let coords_y = parseFloat(array_coords[1]);
-       let coords_ymax = parseFloat(array_coords[3]);
-       let coords_width = (coords_xmax - coords_x);
-
-       let coords_height = (coords_ymax - coords_y);
-
-
-       let width = $("#drawing").width();
-       let height = $("#drawing").height();
-       let rel_width = coords_width/h*width*1.4;
-       let rel_height = coords_height/w*height*1.4;
-
-       let x = width*(coords_x*height/width/w);
-
-       let y = height*(coords_y*width/height/h);
-       console.log(w, h, rel_width, rel_height,x,y);
-
-       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});
-
-        $(".images").append($point1);
-
-        };
-
-       function highlight_details(coords, color){
-
-       let w = {{w}}
-       let h = {{h}}
-       let pos = $("#drawing").position();
-       let drawing_x = pos.left;
-       let drawing_y = pos.top;
-       let array_coords = coords.split(",");
-       let coords_x = parseFloat(array_coords[0]);
-       let coords_y = parseFloat(array_coords[1]);
-       let width_div = (parseFloat(array_coords[2]) - parseFloat(array_coords[0]));
-
-       let height_div = (parseFloat(array_coords[3]) - parseFloat(array_coords[1]));
-
-
-
-       let width = $("#drawing").width();
-       let rel_width = width_div/h*width;
-
-
-       let height = $("#drawing").height();
-       let rel_height = height*height_div/w;
-
-       let x = width*(coords_x*height/width/w);
-       let y= height*(coords_y*width/height/h);
-       console.log(rel_width, rel_height);
-       if (array_coords[3] > 10000) {
-           rel_height = height - y;
-
-       }
-
-
-       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'});
-
-        $(".images").append($point);
-
-        };
-
-     });

+ 0 - 98
app/static/js/js_libs/layout.css

@@ -1,98 +0,0 @@
-#graphcolumn {
-  flex: 7.5 1 0%;
-  padding: 0;
-  margin: 0;
-}
-
-#detailcolumn {
-  flex: 2.5 1 0%;
-  padding: 1em 1em 1em 2em;
-  margin: 0;
-}
-
-.optcontent input {
-  width: 8em;
-}
-
-.optcontent .stuff, #detailcolumn .new {
-  padding-left: 1em;
-  padding-bottom: 1em;
-  padding-top: 0.5em;
-}
-.optcontent .stuff > div {
-  padding-bottom: 0.2em;
-}
-
-.optcontent .heading {
-  font-weight: bold;
-}
-
-.draw {
-  width: 1253px;
-  height: 1023px;
-  background-image: url("uebersicht.png");
-  background-repeat: no-repeat;
-  background-position: left top;
-  background-size: contain;
-}
-
-.draw g.node rect {
-  stroke: #a4a4a4;
-  stroke-width: 0.01em;
-  fill: rgba(255, 255, 255, 1);
-}
-
-.draw .station {
-  font-size: 0.06em;
-  padding: 0.2em;
-  border: 0.2em solid #a4a4a4;
-  border-radius: 0.5em;
-  background-color: rgba(255, 255, 255, 1);
-  z-index: 99;
-  width: 7.1em;
-  white-space: pre-line;
-  word-wrap: break-word;
-  overflow-wrap: break-word;
-  overflow: hidden;
-}
-
-.draw g.node:hover rect {
-  fill: rgba(255, 189, 189, 1);
-}
-.draw g.node.active rect {
-  fill: rgba(255, 189, 189, 1);
-}
-
-.draw polyline.conn-red {
-  stroke:rgb(255,0,0);
-  stroke-width:0.2;
-  fill:none;
-}
-.draw polyline.conn-green {
-  stroke:rgb(0,255,0);
-  stroke-width:0.2;
-  fill:none;
-}
-
-.station-condition {
-  padding-left: 2em;
-}
-.station-id {
-  font-weight: bold;
-}
-
-input.c2 {
-  width: 15em;
-}
-input.c3 {
-  width: 4em;
-}
-input.c4 {
-  width: 25em;
-}
-input.c5 {
-  width: 21em;
-}
-input.c6 {
-  width: 2em;
-}

+ 0 - 59
app/static/js/js_libs/tests/dataelements.html

@@ -1,59 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Dataelements</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "dataelements.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "dataelements.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 8
app/static/js/js_libs/tests/dataelements.rng

@@ -1,8 +0,0 @@
-<element rngui:version="1.2" name="value" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <zeroOrMore rngui:label="Create Data Element">
-    <element rngui:label='Name'>
-      <anyName/>
-      <data type="string" rngui:label="Value"/>
-    </element>
-  </zeroOrMore>
-</element>

+ 0 - 3
app/static/js/js_libs/tests/dataelements.xml

@@ -1,3 +0,0 @@
-<value>
-  <a>b</a>
-</value>

+ 0 - 185
app/static/js/js_libs/tests/relaxngui.css

@@ -1,185 +0,0 @@
-/*
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
-*/
-
-.relaxngui_table { }
-.relaxngui_table .relaxngui_table { }
-
-.relaxngui_table.closed > .relaxngui_table,
-.relaxngui_table.closed > .relaxngui_dyn,
-.relaxngui_table.closed > .relaxngui_row,
-.relaxngui_table.closed > .relaxngui_control {
-  display: none;
-}
-.relaxngui_header.fold  {
-  cursor: pointer;
-}
-.relaxngui_table.closed .relaxngui_fold:after {
-  content: "▶";
-  font-weight: bold;
-  vertical-align:top;
-  margin-right: 0.5em;
-  position: relative;
-  top: -0.13em;
-}
-.relaxngui_table .relaxngui_fold:after {
-  content: "▽";
-  font-weight: bold;
-  vertical-align:top;
-  margin-right: 0.5em;
-  position: relative;
-  top: -0.13em;
-}
-
-.relaxngui_table > .relaxngui_table > .relaxngui_table {
-  padding: 0;
-  padding-top: 0.2em;
-  padding-bottom: 0.5em;
-  padding-left: 1em;
-}
-.relaxngui_dyn {
-  margin: 0;
-  padding: 0;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  padding-bottom: 0.25em;
-  padding-top: 0.25em;
-  margin-left: 0.5em;
-}
-.relaxngui_dyn > *:nth-child(1) {
-  margin: 0;
-  padding: 0;
-  font-size: 1em;
-  margin-right: 0.2em;
-  margin-left: 0.2em;
-  vertical-align: baseline;
-  cursor: pointer;
-  display: inline-block;
-}
-.relaxngui_dyn > *:nth-child(2) {
-  flex: 1 1 auto;
-}
-
-.relaxngui_dyn > .relaxngui_table { padding: 0; margin: 0; }
-.relaxngui_dyn:nth-child(even) { background-color: #fff; }
-.relaxngui_dyn:nth-child(odd)  { background-color: #e9e9e9; }
-.relaxngui_table.even > .relaxngui_row:nth-child(even) { background-color: #fff; }
-.relaxngui_table.even > .relaxngui_row:nth-child(odd)  { background-color: #e9e9e9; }
-.relaxngui_table.odd  > .relaxngui_row:nth-child(even) { background-color: #e9e9e9; }
-.relaxngui_table.odd  > .relaxngui_row:nth-child(odd)  { background-color: #fff; }
-.relaxngui_table.even > .relaxngui_hint:nth-child(odd) { background-color: #fff; }
-.relaxngui_table.even > .relaxngui_hint:nth-child(even)  { background-color: #e9e9e9; }
-.relaxngui_table.odd  > .relaxngui_hint:nth-child(odd)  { background-color: #e9e9e9; }
-.relaxngui_table.odd  > .relaxngui_hint:nth-child(even)  { background-color: #fff; }
-
-.relaxngui_dyn:nth-child(even) > .relaxngui_table > .relaxngui_row:nth-child(1):nth-last-child(1) {
-  background-color: #fff;
-}
-.relaxngui_dyn:nth-child(odd) > .relaxngui_table > .relaxngui_row:nth-child(1):nth-last-child(1) {
-  background-color: #e9e9e9;
-}
-
-.relaxngui_table.even { background-color: #e9e9e9; }
-.relaxngui_table.odd  { background-color: #fff; }
-
-.relaxngui_row {
-  width: 100%;
-  display: flex;
-  flex-direction: row;
-}
-.relaxngui_hint {
-  padding-left: 0.2em;
-}
-.relaxngui_hint::before {
- 	content: "↳ ";
-}
-.relaxngui_header {
-  margin: 0;
-  padding: 0;
-  padding-top: 0.7em;
-  padding-bottom: 0.2em;
-  padding-left: 0.1em;
-  display: block;
-  font-weight: bold;
-}
-.relaxngui_header[data-relaxngui-level="1"] {
-  font-size: 1.2em;
-}
-.relaxngui_dyn .relaxngui_header {
-  font-size: 1em;
-}
-button.relaxngui_control {
-  margin: 0.5em 0;
-  align-self: flex-start;
-}
-
-.relaxngui_cell { }
-
-.relaxngui_cell.optional { text-decoration: line-through; }
-
-.relaxngui_cell:nth-child(1), .relaxngui_cell:nth-child(2) {
-  margin: 0;
-  padding: 0.1em 0.2em;
-  font-size: 1em;
-  font-family: sans-serif;
-}
-input.relaxngui_cell:nth-child(1) {
-  border: 0 none;
-  background: none;
-}
-.relaxngui_cell:nth-child(3) {
-  margin: 0;
-  padding: 0.1em 0.2em;
-  flex: 1 1 auto;
-  font-size: 1em;
-  font-family: sans-serif;
-}
-select.relaxngui_cell:nth-child(3) {
-  -webkit-appearance: none;  /*Removes default chrome and safari style*/
-  -moz-appearance: none; /* Removes Default Firefox style*/
-  padding: 0;
-}
-select.relaxngui_cell:nth-child(3), button.relaxngui_cell:nth-child(3), textarea.relaxngui_cell:nth-child(3), input.relaxngui_cell:nth-child(3), [contenteditable].relaxngui_cell:nth-child(3) {
-  border: 0 none;
-  background: none;
-}
-
-[contenteditable].relaxngui_cell:nth-child(3) {
-  overflow-x: auto;
-  overflow-wrap: normal;
-  white-space: pre;
-  font-family: monospace,monospace;
-}
-[contenteditable][data-relaxngui-wrap='true'].relaxngui_cell:nth-child(3) {
-  white-space: normal;
-}
-[contenteditable].relaxngui_cell:focus {
-  outline: 0px solid transparent;
-}
-[contenteditable].relaxngui_cell:empty:before {
-  font-family: sans-serif;
-  color: #a1a1a1;
-  white-space: normal;
-  content: attr(placeholder);
-  display: block;
-}
-
-.relaxngui_template {
-  display: none;
-}
-
-.relaxngui_hidden { display: none; }

+ 0 - 485
app/static/js/js_libs/tests/relaxngui.js

@@ -1,485 +0,0 @@
-/*
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
-*/
-
-var RelaxNGui = function(rng,target,ceval,ignore=false) {
-  if (!(rng instanceof XMLDocument)) { // rng has to be XMLDocument //{{{
-    rng = $XR($(rng).serializeXML());
-  } //}}}
-
-  var lenextract = function(tag, lencount) { //{{{
-    $.each(tag.attributes,function(k,v){
-      if ((v.localName == 'label') && (v.namespaceURI == 'http://rngui.org')) { lencount = v.nodeValue.length > lencount ? v.nodeValue.length : lencount; }
-    });
-    return lencount;
-  }; //}}}
-
-  var labextract = function(type,tag) { //{{{
-    var ret = { 'type': type, 'wrap': false, 'readonly': false, 'label': '', default: '' };
-    $.each(tag.attributes,function(k,v){
-      if ((v.localName == 'label') && (v.namespaceURI == 'http://rngui.org')) { ret['label'] = v.nodeValue; }
-      if ((v.localName == 'readonly') && (v.namespaceURI == 'http://rngui.org')) { ret['readonly'] = v.nodeValue == 'true' ? true : false; }
-      if ((v.localName == 'wrap') && (v.namespaceURI == 'http://rngui.org')) { ret['wrap'] = v.nodeValue == 'true' ? true : false; }
-    });
-    $.each(tag.children,function(k,v){
-      if ((v.localName == 'param') && (v.namespaceURI == 'http://relaxng.org/ns/structure/1.0')) {
-        $.each(v.attributes,function(l,w){
-          if ((w.localName == 'name') && (w.nodeValue == 'minInclusive')) {
-            ret['min'] = v.lastChild.nodeValue;
-          }
-          if ((w.localName == 'name') && (w.nodeValue == 'maxInclusive')) {
-            ret['max'] = v.lastChild.nodeValue;
-          }
-        });
-      }
-    });
-    return ret;
-  }; //}}}
-
-  var addelements = function(target,container) { //{{{
-    var template = target.parent().find('> .relaxngui_template').clone(true,true);
-    template.removeClass('relaxngui_template');
-    template.find('[data-relaxngui-template]').each(function(j,t){
-      $(t).attr('data-relaxngui-template',false);
-    });
-    template.find('.relaxngui_template [data-relaxngui-template]').each(function(j,t){
-      $(t).attr('data-relaxngui-template',true);
-    });
-    template.addClass('relaxngui_dyn');
-    template.on('click', '> *:first-child', function(ev){ delelements($(ev.target)); });
-
-    if (container.find('> .relaxngui_dyn').length % 2 == 1) {
-      var evens = template.find('.even');
-      var odds = template.find('.odd');
-      evens.each(function(k,v){
-        $(v).removeClass('even');
-        $(v).addClass('odd');
-      });
-      odds.each(function(k,v){
-        $(v).removeClass('odd');
-        $(v).addClass('even');
-      });
-    }
-
-    container.append(template);
-  }; //}}}
-
-  var delelements = function(target) { //{{{
-    var it = target.parent();
-    var par = target.parent().parent();
-    it.remove();
-    par.trigger('relaxngui_remove');
-  }; //}}}
-
-  var recshow_header = function(tag,ret,level){ //{{{
-    var header;
-    var fold;
-    $.each(tag.attributes,function(k,v){
-      if ((v.localName == 'header') && (v.namespaceURI == 'http://rngui.org')) { header = v.nodeValue; }
-      if ((v.localName == 'fold') && (v.namespaceURI == 'http://rngui.org')) { fold = v.nodeValue; }
-    });
-    if (header) {
-      if (fold != undefined) {
-        var xxx = $("<div data-relaxngui-level='" + level + "' class='relaxngui_header fold'>" + header + "</div>");
-            xxx.prepend($("<span class='relaxngui_fold'></span>"));
-        ret.append(xxx);
-        if (fold == 'closed' || fold == 'closed_conditional') {
-          ret.addClass('closed');
-        }
-        if (fold == 'closed_conditional') {
-          ret.addClass(fold);
-        }
-      } else {
-        ret.append($("<div data-relaxngui-level='" + level + "' class='relaxngui_header'>" + header + "</div>"));
-      }
-    }
-    return fold;
-  } //}}}
-
-  var recshow_single = function(tag,ret,template,path,lencount,optional){ //{{{
-    var node = $('<div class="relaxngui_row"/>');
-    var name;
-    var label;
-    var labeltype;
-    var second = {};
-    var datalist = [];
-    var defaul = '';
-    var hint = '';
-    var retcount = 0;
-    $.each(tag.attributes,function(k,v){
-      if ((v.localName == 'label')     && (v.namespaceURI == 'http://rngui.org')) { label  = v.nodeValue; }
-      if ((v.localName == 'date')      && (v.namespaceURI == 'http://rngui.org')) { label  = v.nodeValue; }
-      if ((v.localName == 'labeltype') && (v.namespaceURI == 'http://rngui.org')) { labeltype  = v.nodeValue; }
-      if ((v.localName == 'default')   && (v.namespaceURI == 'http://rngui.org')) { defaul = v.nodeValue; }
-      if ((v.localName == 'hint')      && (v.namespaceURI == 'http://rngui.org')) { hint   = v.nodeValue; }
-      if  (v.localName == 'name')                                                 { name   = v.nodeValue.replace(/:/,'\\:'); }
-    });
-
-    $.each($(tag).children('data[type=string]'), function(k,v) { second = labextract('string',v); });
-    $.each($(tag).children('data[type=integer]'), function(k,v) { second = labextract('integer',v); });
-    $.each($(tag).children('data[type=nonNegativeInteger]'), function(k,v) { second = labextract('nonNegativeInteger',v); });
-    $.each($(tag).children('data[type=positiveInteger]'), function(k,v) { second = labextract('positiveInteger',v); });
-    $.each($(tag).children('data[type=float]'), function(k,v) { second = labextract('float',v); });
-    $.each($(tag).children('data[type=date]'), function(k,v) { second = labextract('date',v); });
-    $.each($(tag).children('text'), function(k,v) { second = labextract('text',v); });
-    $.each($(tag).find('choice > value'), function(k,v) {
-      second = labextract('datalist',$(v).parent()[0]);
-      datalist.push(v.textContent);
-    });
-    if (name && label) {
-      node.append($("<label class='relaxngui_cell" + (optional && defaul == '' ? " optional": "") + "' style='min-width: " + (lencount+1) + "ex' for=''>" + label + "</label><span class='relaxngui_cell'>⇒</span>"));
-    } else if (name) {
-      // a tag without information is ignored
-      node.addClass('relaxngui_hidden');
-    } else if (label) {
-      if (labeltype == 'xml') {
-        node.append($("<input data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + path + " > *[data-name]' class='relaxngui_cell' type='text' pattern='^[a-zA-Z_][a-zA-Z0-9_-]*$' id='' placeholder='" + label + "'></input><span class='relaxngui_cell'>⇒</span>"));
-      } else {
-        node.append($("<input data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + path + " > *[data-name]' class='relaxngui_cell' type='text' pattern='^[a-z_][a-zA-Z0-9_]*$' id='' placeholder='" + label + "'></input><span class='relaxngui_cell'>⇒</span>"));
-      }
-    }
-
-    var tpath = ((typeof name === 'undefined') ? path + ' > *' : (tag.localName == 'element' ? path + ' > ' + name : path + '[' + name + ']'));
-    if (label) {
-      if (defaul && typeof defaul == 'string' && defaul.match(/^javascript:/)) {
-        defaul = defaul.replace(/^javascript:/,'');
-        defaul = ceval ? ceval(defaul) : eval(defaul);
-      }
-      var os = (optional ? " onkeyup='var sl = $(this).siblings(\"label\"); if ($(this).get_val() == \"\") { if (!sl.hasClass(\"optional\")) { sl.addClass(\"optional\") } } else { sl.removeClass(\"optional\") }' data-optional='true'" : " data-optional='false'");
-      if (second.readonly)
-        node.append($("<input      " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='text'              id='' readonly='readonly'" + os + "></input>"));
-      else {
-        if (second.type == 'string') {
-          node.append($("<input    " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='text'              id='' placeholder='" + second.label + "'" + os + "></input>"));
-        } else if (second.type == 'integer') {
-          node.append($("<input    " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='number'            id='' placeholder='" + second.label + "'" + (second.min != undefined ? (" min='" + second.min + "'") : '') + (second.max != undefined ? (" max='" + second.max + "'") : '') + os + "></input>"));
-        } else if (second.type == 'positiveInteger') {
-          if (second.min == undefined) second.min = 1;
-          node.append($("<input    " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='number'            id='' placeholder='" + second.label + "'" + (second.min != undefined ? (" min='" + second.min + "'") : '') + (second.max != undefined ? (" max='" + second.max + "'") : '') + os + "></input>"));
-        } else if (second.type == 'nonNegativeInteger') {
-          if (second.min == undefined) second.min = 0;
-          node.append($("<input    " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='number'            id='' placeholder='" + second.label + "'" + (second.min != undefined ? (" min='" + second.min + "'") : '') + (second.max != undefined ? (" max='" + second.max + "'") : '') + os + "></input>"));
-        } else if (second.type == 'date') {
-          node.append($("<input    " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='date'              id='' placeholder='" + second.label + "'" + os + "></input>"));
-        } else if (second.type == 'float') {
-          node.append($("<input    " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell' type='number' step='any' id='' placeholder='" + second.label + "'" + (second.min != undefined ? (" min='" + second.min + "'") : '') + (second.max != undefined ? (" max='" + second.max + "'") : '') + os + "></input>"));
-        } else if (second.type == 'text') {
-          node.append($("<div contenteditable='true' data-relaxngui-wrap='" + second.wrap + "' " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell'               id='' placeholder='" + second.label + "'" + os + "></div>"));
-        } else if (second.type == 'datalist') {
-          var tnode = $("<select   " + (defaul && typeof defaul == 'string' ? 'value="' + defaul + '"' : '') + " data-relaxngui-template='" + template + "' data-relaxngui-parent='" + path + "' data-relaxngui-path='" + tpath + "' class='relaxngui_cell'               id='' size='1'" + os + "></select>");
-          $.each(datalist,function(didx,dname){
-            if (dname == defaul)
-              tnode.append('<option value="' + dname + '" selected="selected">' + dname + '</value>');
-            else
-              tnode.append('<option value="' + dname + '">' + dname + '</value>');
-          });
-          node.append(tnode);
-        }
-      }
-      ret.append(node);
-      retcount += 1;
-    } else {
-      if (tag.localName != 'element') { // its an attribute, simulate its empty-ness
-        node.attr('data-relaxngui-template',template);
-        node.attr('data-relaxngui-parent',path);
-        node.attr('data-relaxngui-path',tpath);
-        ret.append(node);
-        retcount += 1;
-      }
-    }
-    if (hint) {
-      var n  = $('<div class="relaxngui_hint"/>');
-      var s1 = $('<em>Hint: </em>');
-      var s2 = $('<span/>');
-          s2.text(hint);
-
-      n.append(s1);
-      n.append(s2);
-      ret.append(n);
-      retcount += 1;
-    }
-    return retcount;
-  } //}}}
-
-  var recshow = function(elements,template,path,attr) { //{{{
-    // delete all elements with relaxngui:ignore
-    if (attr.ignore) {
-      var tele = $.grep(elements,function(tagv){
-        var include = true;
-        $.each(tagv.attributes,function(k,v){
-          if ((v.localName == 'ignore') && (v.namespaceURI == 'http://rngui.org')) {
-            include = false;
-          }
-        });
-        return include;
-      });
-      elements = $(tele);
-    }
-
-    var ret = $('<div/>');
-
-    var lencount = 0;
-    $.each(elements,function(k,v){
-      var tag = $(v)[0];
-      if ((tag.localName == 'element') && (tag.namespaceURI == 'http://relaxng.org/ns/structure/1.0')) {
-        $(tag).children('attribute').each(function(l,w){
-          lencount = lenextract($(w)[0],lencount);
-        });
-        lencount = lenextract(tag,lencount);
-      }
-    });
-    $.each(elements,function(k,v){
-      if (attr.mode == 'even') { attr.mode = 'odd' }
-      else { attr.mode = 'even'; }
-
-      var tag = $(v)[0];
-      if ((tag.localName == 'element') && (tag.namespaceURI == 'http://relaxng.org/ns/structure/1.0')) {
-        var xxx;
-        if (template) {
-          var yyy = $('<div class="relaxngui_table ' + attr.mode + '" data-relaxngui-template="true" data-relaxngui-parent="' + path + '" data-relaxngui-path="' + (path == '' ? ' > '  + (typeof elements.attr('name') === 'undefined' ? '*' : elements.attr('name')) : path + ' > ' + (typeof $(tag).attr('name') === 'undefined' ? '*' : $(tag).attr('name'))) + '[data-main]">');
-          xxx = $('<div class="relaxngui_template"><span>✖</span></div>');
-          xxx.append(yyy);
-          ret.append(xxx);
-          xxx = yyy;
-        } else {
-          xxx = $('<div class="relaxngui_table ' + attr.mode + '" data-relaxngui-template="false" data-relaxngui-parent="' + path + '" data-relaxngui-path="' + (path == '' ? ' > '  + elements.attr('name') : path + ' > ' + $(tag).attr('name')) + '[data-main]">');
-          ret.append(xxx);
-        }
-
-        recshow_header(tag,xxx,attr.level);
-        var rcount = 0;
-        $(tag).children('attribute').each(function(l,w){
-          var ttag = $(w)[0];
-          rcount += recshow_single(ttag,xxx,template,path + ' > ' + $(tag).attr('name'),lencount,attr.optional ? true : false);
-        });
-        rcount += recshow_single(tag,xxx,template,path,lencount,attr.optional ? true : false);
-
-        var sub;
-        if (sub = recshow($(tag).children('element, zeroOrMore, optional, choice'),false,path + ' > ' + $(tag).attr('name'),{ ignore: attr.ignore, mode: (attr.mode == 'even' && rcount % 2 == 0 ? 'odd' : 'even' ), level: attr.level + 1 })) {
-          var inode = xxx.append(sub);
-          if (template) {
-            inode.find('[data-relaxngui-template]').each(function(j,t){
-              $(t).attr('data-relaxngui-template',true);
-            });
-          }
-        }
-      } else if ((tag.localName == 'zeroOrMore') && (tag.namespaceURI == 'http://relaxng.org/ns/structure/1.0')) {
-        var label;
-        $.each(tag.attributes,function(k,v){
-          if ((v.localName == 'label') && (v.namespaceURI == 'http://rngui.org')) { label = v.nodeValue; }
-        });
-        var but = $('<button class="relaxngui_control">' + label + '</button>');
-            but.on('click',function(ev){ addelements($(ev.target),$(ev.target).parent()); });
-
-        ret.append(recshow($(tag).children(),true,path,{ ignore: attr.ignore, mode: attr.mode, level: attr.level }));
-        ret.append(but);
-      } else if ((tag.localName == 'optional') && (tag.namespaceURI == 'http://relaxng.org/ns/structure/1.0')) {
-        ret.append(recshow($(tag).children('element, zeroOrMore'),false,path,{ ignore: attr.ignore, mode: (attr.mode == 'even' ? 'odd' : 'even'), optional: true, level: attr.level + 1 }));
-      } else if ((tag.localName == 'choice') && (tag.namespaceURI == 'http://relaxng.org/ns/structure/1.0')) {
-        if (!($(tag).children()[0].localName == 'value' && $(tag).children()[0].namespaceURI)) {
-          $.each($(tag).children(),function(j,u){
-            var label;
-            $.each(u.attributes,function(k,v){
-              if ((v.localName == 'label') && (v.namespaceURI == 'http://rngui.org')) { label = v.nodeValue; }
-            });
-            var but = $('<button class="relaxngui_control">' + label + '</button>');
-                but.on('click',function(ev){ addelements($(ev.target),$(ev.target).parent().parent()); });
-            var col = $('<span></span');
-            col.append(recshow($(u).children(),true,path,{ ignore: attr.ignore, mode: attr.mode }));
-            col.append(but);
-            ret.append(col);
-          });
-        }
-      }
-    });
-    return ret.children().length > 0 ? ret.children() : undefined;
-  }; //}}}
-
-  var serializeXML = function (xml) { //{{{
-    var out = '';
-    if (typeof XMLSerializer == 'function') {
-        var xs = new XMLSerializer();
-        $(xml).each(function() {
-            out += xs.serializeToString(this);
-        });
-    } else if (xml && xml.xml != 'undefined') {
-        $(xml).each(function() {
-            out += this.xml;
-        });
-    }
-    return out;
-  }; //}}}
-  this.save = function() { //{{{
-    var xml;
-    var curr;
-    var tar = target.find('[data-relaxngui-path]:not([data-relaxngui-template=true])');
-    for (var i = 0; i<tar.length;) {
-      var path = $(tar[i]).attr('data-relaxngui-path');
-      var parent_path = $(tar[i]).attr('data-relaxngui-parent');
-      if (i == 0) {
-        var par = path.replace(/\[data-main\]/,'').replace(/ > /,'');
-        xml = $XR('<' + par + '/>');
-      } else {
-        var ma = path.match(/([^\s]+)$/)[1];
-        var att;
-        if (ma.match(/\*\[data-main\]/)) {
-          // do nothing. seriously. explicitly.
-        } else if (ma.match(/\[data-main\]/)) {
-          var par = ma.replace(/\[data-main\]/,'');
-          var curr = $($XR('<' + par + '/>').documentElement);
-          $(parent_path,xml).last().append(curr);
-        } else if (ma.match(/\[data-name\]/)) {
-          if ($(tar[i]).get_val()) {
-            var nn =  $($XR('<' + $(tar[i]).get_val() + '/>').documentElement).text($(tar[i+1]).get_val());
-            $(parent_path,xml).append(nn);
-          }
-          i+=1;
-        } else if (att = ma.match(/\[([^\]]+)\]$/)) {
-          att[1] = att[1].replace(/\\/,'');
-          $(parent_path + ':last-child',xml).last().attr(att[1],$(tar[i]).get_val());
-        } else {
-          if ($(tar[i]).attr('data-optional') == 'true' && $(tar[i]).get_val() == '') {
-            $(path + ':last-child',xml).last().remove();
-          } else {
-            $(path + ':last-child',xml).last().text($(tar[i]).get_val())
-          }
-        }
-      }
-      i+=1;
-    }
-    return xml;
-  }; //}}}
-  this.save_text = function() { //{{{
-    return serializeXML(self.save());
-  } //}}}
-
-  this.content = function(data) { //{{{
-    if (!(data instanceof XMLDocument)) { // data has to be XMLDocument //{{{
-      data = $XR($(data).serializeXML());
-    } //}}}
-
-    if (data) {
-      var x = $(data).serializePrettyXML();
-      x = x.replace(/\s+xmlns(:[a-zA-Z0-9]+)?=\"[^\"]+\"/g, "");
-      x = x.replace(/<\?[^>]+>/g, "");
-      x = x.trim();
-      y = $(self.save()).serializePrettyXML();
-      if (x != y) {
-        target.find('.relaxngui_dyn').remove();
-        target.find('[data-relaxngui-path]').each(function(k,pa){
-          var path = $(pa).attr('data-relaxngui-path');
-          if (!path.match(/data-\w+\]$/)) {
-            if ($(pa).attr('data-relaxngui-template') == 'true' && path.match(/\*$/)) {
-              $(data).find(path).each(function(index,ele){
-                $(target.find('[data-relaxngui-path="' + path + '[data-name]"][data-relaxngui-template="false"]').get(index)).set_val(ele.localName);
-                $(target.find('[data-relaxngui-path="' + path + '"][data-relaxngui-template="false"]').get(index)).set_val($(ele).text());
-              });
-            } else if ($(pa).attr('data-relaxngui-template') == 'true' && !path.match(/\*$/)) {
-              $(data).find(path).each(function(index,ele){
-                var att;
-                var val;
-                if (att = path.match(/(.*)\[([^\]]+)\]$/)) {
-                  val = $(ele).attr(att[2]);
-                } else {
-                  val = $(ele).text();
-                }
-                if (val && val != '') {
-                  $(target.find('[data-relaxngui-path="' + path + '"][data-relaxngui-template="false"]').get(index)).set_val(val);
-                }
-              });
-            } else {
-              var att;
-              var val;
-              if (att = path.match(/(.*)\[([^\]]+)\]$/)) {
-                val = $(data).find(att[1]).attr(att[2]);
-              } else {
-                val = $(data).find(path).text();
-              }
-              if (val && val != '') {
-                var t = target.find('[data-relaxngui-path="' + path + '"]');
-                t.set_val(val);
-                if (t.attr('data-optional') == 'true') {
-                  t.siblings('label').removeClass('optional');
-                }
-              }
-            }
-          } else {
-            console.log('-----');
-            console.log(path);
-            console.log(target);
-            console.log($(pa).attr('data-relaxngui-template'));
-            if ($(pa).attr('data-relaxngui-template') == 'true') {
-              var but = [];
-              var but1 = target.find('.relaxngui_table[data-relaxngui-template="false"] > .relaxngui_template > [data-relaxngui-path="' + path + '"][data-relaxngui-template="true"]').parent().parent().find('> button');
-              var but2 = target.find('.relaxngui_table[data-relaxngui-template="false"] > span > .relaxngui_template > [data-relaxngui-path="' + path + '"][data-relaxngui-template="true"]').parent().parent().find('> button');
-              if (but1.length > 0) { but = but1; }
-              if (but2.length > 0) { but = but2; }
-              console.log(but.length);
-              if (but.length > 0) {
-                var dpath = path.replace(/\[data-main\]$/,'');
-                var par = undefined;
-                var ind = -1;
-                $(data).find(dpath).each(function(ke,ele){
-                  if (par != $(ele).parent()[0]) {
-                    ind += 1;
-                    par = $(ele).parent()[0];
-                  }
-                  if ($(but.get(ind)).attr('disabled')) {
-                    $(but.get(ind)).removeAttr('disabled');
-                    but.get(ind).click();
-                    $(but.get(ind)).attr('disabled','disabled');
-                  } else {
-                    but.get(ind).click();
-                  }
-                });
-              }
-            }
-          }
-        });
-        self.set_checkpoint();
-      }
-      target.find('.relaxngui_table.closed_conditional').each(function(k,e) {
-        $(e).find('input:not([readonly]), [contenteditable]:not([readonly])').each(function(l,f) {
-          if ($(f).get_val() != '') {
-            $(e).removeClass('closed');
-          }
-        });
-      });
-    }
-  }; //}}}
-
-  // stuff to determine if user changed something
-  var orig = '';
-  this.set_checkpoint = function() { //{{{
-    orig = self.save_text();
-  } //}}}
-  this.has_changed = function() { //{{{
-    if (orig != self.save_text()) {
-      return true;
-    } else {
-      return false;
-    }
-  } //}}}
-
-  target.append(recshow($(rng.documentElement),false,'',{ ignore: ignore, mode: 'even', level: 0}));
-
-  var self = this;
-
-  target.unbind('click.relaxngui');
-  target.on('click.relaxngui','.relaxngui_header.fold',function(){
-    $(this).parent().toggleClass('closed');
-  });
-};

+ 0 - 64
app/static/js/js_libs/tests/rngtest1.html

@@ -1,64 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 1</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      function get_free_id() {
-        return 'a1';
-      }
-
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest1.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest1.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 147
app/static/js/js_libs/tests/rngtest1.rng

@@ -1,147 +0,0 @@
-<element rngui:version="1.2" name="call" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <attribute name="id" rngui:label="ID" rngui:default="javascript:get_free_id()">
-    <data type="string" rngui:readonly="true"/>
-  </attribute>
-  <attribute name="endpoint" rngui:label="Endpoint">
-    <data type="string"/>
-  </attribute>
-  <element name='parameters' rngui:header="Properties">
-    <element name="label" rngui:label="Label">
-      <data type="string" rngui:label="Short description of the task"/>
-    </element>
-    <element name="method" rngui:label="Method">
-      <choice>
-        <value>:post</value>
-        <value>:get</value>
-        <value>:put</value>
-        <value>:delete</value>
-      </choice>
-    </element>
-    <element name="arguments" rngui:header="Arguments">
-      <zeroOrMore rngui:label="Create Argument Pair">
-        <element rngui:label='Name'>
-          <anyName/>
-          <data type="string" rngui:label="Value"/>
-        </element>
-      </zeroOrMore>
-    </element>
-    <element name="stream" rngui:header="Data Stream Handling" rngui:fold="closed">
-      <element name="sensors" rngui:header="Sensors" rngui:fold="closed">
-        <zeroOrMore rngui:label="Add Sensor">
-          <element name="sensor">
-            <element name="name" rngui:label="Label">
-              <data type="string" rngui:label="Label"/>
-            </element>
-            <element name="extractor_url" rngui:label="Extractor Url">
-              <data type="string" rngui:label="Service Url"/>
-            </element>
-            <element name="extractor_arg" rngui:label="Extractor Argument">
-              <data type="string" rngui:label="Value / Json"/>
-            </element>
-            <element name="visualizer_url" rngui:label="Visualizer Url">
-              <data type="string" rngui:label="Service Url"/>
-            </element>
-            <element name="visualizer_params" rngui:header="Visualizer Arguments">
-              <zeroOrMore rngui:label="Create Visualizer Argument Pairs">
-                <element rngui:label='Name'>
-                  <anyName/>
-                  <data type="string" rngui:label="Value / Json"/>
-                </element>
-              </zeroOrMore>
-            </element>
-          </element>
-        </zeroOrMore>
-      </element>
-      <element name="aggregators" rngui:header="Aggregators" rngui:fold="closed">
-        <zeroOrMore rngui:label="Add Aggregator">
-          <element name="aggregator">
-            <element name="name" rngui:label="Label">
-              <data type="string" rngui:label="Label"/>
-            </element>
-            <element name="aggregator_url" rngui:label="Aggregator Url">
-              <data type="string" rngui:label="Service Url"/>
-            </element>
-            <element name="aggregator_arg" rngui:label="Aggregator Argument">
-              <data type="string" rngui:label="Value / Json"/>
-            </element>
-          </element>
-        </zeroOrMore>
-      </element>
-      <element name="_cost" rngui:header="Costs" rngui:fold="closed">
-        <zeroOrMore rngui:label="Create Cost Factor">
-          <element name='_cost_factor'>
-            <element name="name" rngui:label="Label">
-              <data type="string" rngui:label="Label"/>
-            </element>
-            <element name="target" rngui:label="Target Value">
-              <data type="string" rngui:label="Value"/>
-            </element>
-            <element name="vfunc_url" rngui:label="Violation Function Url">
-              <data type="string" rngui:label="Service Url"/>
-            </element>
-            <element name="vfunc_arg" rngui:label="Violation Function Argument">
-              <data type="string" rngui:label="Service Url"/>
-            </element>
-            <element name="vcost" rngui:label="Violation Cost">
-              <data type="string" rngui:label="Value"/>
-            </element>
-          </element>
-        </zeroOrMore>
-      </element>
-    </element>
-  </element>
-  <element name="code" rngui:header="Implementation">
-    <element name="prepare" rngui:header="Prepare" rngui:label="Code" rngui:fold='closed_conditional'>
-      <text rngui:label='Script that is executed, before a service call'/>
-    </element>
-    <element name="finalize" rngui:header="Finalize" rngui:label="Code" rngui:fold='closed_conditional'>
-      <attribute name="output" rngui:label="Access Variable" rngui:default="result">
-        <data type="string" rngui:readonly="true"/>
-      </attribute>
-      <text rngui:label='Script that is executed, when a service returns data'/>
-    </element>
-    <element name="update" rngui:header="Update" rngui:label="Code" rngui:fold='closed_conditional'>
-      <attribute name="output" rngui:label="Access Variable" rngui:default="result">
-        <data type="string" rngui:readonly="true"/>
-      </attribute>
-      <text rngui:label='Script that is executed, when a service sends intermediate data'/>
-    </element>
-    <element name="rescue" rngui:header="Rescue" rngui:label="Code" rngui:fold='closed_conditional'>
-      <attribute name="output" rngui:label="Access Variable" rngui:default="result">
-        <data type="string" rngui:readonly="true"/>
-      </attribute>
-      <text rngui:label='Script that is executed, if a service call fails'/>
-    </element>
-  </element>
-  <element name="annotations" rngui:header="Annotations">
-    <element name="_timing" rngui:header="Timing" rngui:fold="closed">
-      <element name="_timing_min" rngui:label='Min in min'>
-        <data type='float' rngui:label='Minutes'/>
-      </element>
-      <element name="_timing_max" rngui:label='Max in min'>
-        <data type='float' rngui:label='Minutes'/>
-      </element>
-      <element name="_timing_avg" rngui:label='Avg in min'>
-        <data type='float' rngui:label='Minutes'/>
-      </element>
-    </element>
-    <element name="_notes" rngui:header="Notes" rngui:fold="closed">
-      <element name="_notes_general" rngui:label='General'>
-        <text rngui:wrap='true' rngui:label='Notes'/>
-      </element>
-      <element name="_notes_output" rngui:label='Output'>
-        <text rngui:wrap='true' rngui:label='Notes'/>
-      </element>
-      <element name="_attachments">
-        <zeroOrMore rngui:label="Create Attachment">
-          <element name='_attachment' rngui:label='Attachment'>
-            <attribute name="label" rngui:label="Note">
-              <data type="string"/>
-            </attribute>
-            <data type="string" rngui:label="Url"/>
-          </element>
-        </zeroOrMore>
-      </element>
-    </element>
-  </element>
-</element>

+ 0 - 13
app/static/js/js_libs/tests/rngtest1.xml

@@ -1,13 +0,0 @@
-<call id="a1" endpoint="timeout">
-  <parameters>
-    <label></label>
-    <method>:post</method>
-    <arguments>
-      <timeout>2</timeout>
-    </arguments>
-  </parameters>
-  <code>
-    <finalize output="result">  data.x += "a1,"</finalize>
-    <update output="result">  data.x += "a1,"</update>
-  </code>
-</call>

+ 0 - 60
app/static/js/js_libs/tests/rngtest2.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 2</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest2.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest2.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 6
app/static/js/js_libs/tests/rngtest2.rng

@@ -1,6 +0,0 @@
-<element rngui:version="1.2" name="manipulate" rngui:label="Script" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <attribute name="id" rngui:label="ID">
-    <data type="string" rngui:readonly="true" rngui:default="javascript:generate_id()"/>
-  </attribute>
-  <text rngui:label='Script that is executed'/>
-</element>

+ 0 - 3
app/static/js/js_libs/tests/rngtest2.xml

@@ -1,3 +0,0 @@
-<manipulate id="a1">
-  data.x += "a1,"
-</manipulate>

+ 0 - 60
app/static/js/js_libs/tests/rngtest3.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 3</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest3.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest3.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 23
app/static/js/js_libs/tests/rngtest3.rng

@@ -1,23 +0,0 @@
-<element rngui:version="1.2" name="call" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <element name="arguments" rngui:header="Arguments">
-    <zeroOrMore rngui:label="Create Argument Pair">
-      <element rngui:label='Name'>
-        <anyName/>
-        <data type="string" rngui:label="Value"/>
-      </element>
-    </zeroOrMore>
-  </element>
-  <element name="_attachments">
-    <zeroOrMore rngui:label="Create Attachment">
-      <element name='_attachment' rngui:label='Attachment'>
-        <attribute name="label" rngui:label="Note">
-          <data type="string"/>
-        </attribute>
-        <attribute name="xxx" rngui:label="XXX">
-          <data type="string"/>
-        </attribute>
-        <data type="string" rngui:label="Url"/>
-      </element>
-    </zeroOrMore>
-  </element>
-</element>

+ 0 - 9
app/static/js/js_libs/tests/rngtest3.xml

@@ -1,9 +0,0 @@
-<call>
-  <arguments>
-    <timeout>2</timeout>
-  </arguments>
-  <_attachments>
-    <_attachment label="a" xxx="1">b</_attachment>
-    <_attachment label="c" xxx="2">d</_attachment>
-  </_attachments>
-</call>

+ 0 - 60
app/static/js/js_libs/tests/rngtest4.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 4</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest4.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest4.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 19
app/static/js/js_libs/tests/rngtest4.rng

@@ -1,19 +0,0 @@
-<element rngui:version="1.2" name="call" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <element name="_workorders">
-    <zeroOrMore rngui:label="Create Work Order">
-      <element name='_workorder'>
-        <attribute name="label" rngui:label="Note">
-          <data type="string"/>
-        </attribute>
-        <attribute name="duration" rngui:label="Duration">
-          <data type="string"/>
-        </attribute>
-        <zeroOrMore rngui:label="Add Attachment">
-          <element name='_attachment' rngui:label='Attachment'>
-            <data type="string"/>
-          </element>
-        </zeroOrMore>
-      </element>
-    </zeroOrMore>
-  </element>
-</element>

+ 0 - 12
app/static/js/js_libs/tests/rngtest4.xml

@@ -1,12 +0,0 @@
-<call>
-  <_workorders>
-    <_workorder label="a" duration="b">
-      <_attachment>1</_attachment>
-      <_attachment>2</_attachment>
-    </_workorder>
-    <_workorder label="c" duration="d">
-      <_attachment>3</_attachment>
-      <_attachment>4</_attachment>
-    </_workorder>
-  </_workorders>
-</call>

+ 0 - 60
app/static/js/js_libs/tests/rngtest5.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 5</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest5.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest5.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 75
app/static/js/js_libs/tests/rngtest5.rng

@@ -1,75 +0,0 @@
-<element rngui:version="1.2" name="call" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <element name='parameters' rngui:header="Parameters">
-    <element name="label" rngui:label="Label">
-      <data type="string" rngui:label="Short description of the task"/>
-    </element>
-    <element name="method" rngui:label="Method">
-      <choice>
-        <value>:post</value>
-        <value>:get</value>
-        <value>:put</value>
-        <value>:delete</value>
-      </choice>
-    </element>
-    <element name="arguments" rngui:header="Arguments">
-      <element name="nc-program" rngui:label="NC Program">
-        <data type="string" rngui:label="Unique ID of the NC Program"/>
-      </element>
-      <element name="material-name" rngui:label="Material Name">
-        <data type="string" rngui:label="Name of the raw material"/>
-      </element>
-      <element name="material-pic" rngui:label="Material Picture">
-        <data type="string" rngui:label="Picture of the raw material"/>
-      </element>
-      <element name="result-pic" rngui:label="Result Picture">
-        <data type="string" rngui:label="Picture of the result"/>
-      </element>
-      <element name="comment" rngui:label="Comment">
-        <text rngui:wrap='true' rngui:label='Additional comments for the operator'/>
-      </element>
-      <element name="tools" rngui:header="Tools">
-        <zeroOrMore rngui:label="Add Tool">
-          <element name="tool">
-            <element name="place" rngui:label="Position">
-              <data type="integer" rngui:label="Position in Tool Magazine"/>
-            </element>
-            <element name="tool-name" rngui:label="Tool">
-              <data type="string" rngui:label="Name of Tool"/>
-            </element>
-            <element name="tool-holder" rngui:label="Holder">
-              <data type="string" rngui:label="Name of Tool Holder"/>
-            </element>
-            <element name="tool-orientation" rngui:label="Orientation">
-              <data type="string" rngui:label="Orientation in Tool Holder"/>
-            </element>
-            <element name="corrections" rngui:header="Corrections">
-              <zeroOrMore rngui:label="Add Correction">
-                <element name="correction">
-                  <attribute name="length-x" rngui:label="Length X">
-                    <data type="float"/>
-                  </attribute>
-                  <attribute name="length-z" rngui:label="Length Y">
-                    <data type="float"/>
-                  </attribute>
-                  <attribute name="radius" rngui:label="Radius">
-                    <data type="float"/>
-                  </attribute>
-                </element>
-              </zeroOrMore>
-            </element>
-            <element name="attachments" rngui:header="Attachments">
-              <zeroOrMore rngui:label="Add Attachment">
-                <element name="attachment" rngui:label="URL">
-                  <attribute name="label" rngui:label="Label">
-                    <data type="string" rngui:label="Label"/>
-                  </attribute>
-                  <data type="string" rngui:label="URL"/>
-                </element>
-              </zeroOrMore>
-            </element>
-          </element>
-        </zeroOrMore>
-      </element>
-    </element>
-  </element>
-</element>

+ 0 - 40
app/static/js/js_libs/tests/rngtest5.xml

@@ -1,40 +0,0 @@
-<call>
-  <parameters>
-    <label></label>
-    <method>:post</method>
-    <arguments>
-      <nc-program>Kuli</nc-program>
-      <material-name>3</material-name>
-      <material-pic>http://centurio.work/customers/prime/part.jpg</material-pic>
-      <result-pic>http://centurio.work/customers/prime/result.jpg</result-pic>
-      <comment>Hallo</comment>
-      <tools>
-        <tool>
-          <place>1</place>
-          <tool-name>Schrupper (500)</tool-name>
-          <tool-holder>x3</tool-holder>
-          <tool-orientation>gegenspindel axial</tool-orientation>
-          <corrections>
-            <correction length-x="0" length-z="0" radius="70"/>
-            <correction length-x="1" length-z="1" radius="60"/>
-          </corrections>
-          <attachments>
-            <attachment label="Bla">http://centurio.work/customers/prime/attachment1.jpg</attachment>
-          </attachments>
-        </tool>
-        <tool>
-          <place>2</place>
-          <tool-name>Schaftfräser d6</tool-name>
-          <tool-holder>SK45</tool-holder>
-          <tool-orientation>-</tool-orientation>
-          <corrections>
-            <correction length-x="2" length-z="1" radius="2"/>
-          </corrections>
-          <attachments>
-            <attachment label="Tool">https://centurio.work/customers/prime/schaftfraeser.jpg</attachment>
-          </attachments>
-        </tool>
-      </tools>
-    </arguments>
-  </parameters>
-</call>

+ 0 - 60
app/static/js/js_libs/tests/rngtest6.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 6</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest6.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest6.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 24
app/static/js/js_libs/tests/rngtest6.rng

@@ -1,24 +0,0 @@
-<element rngui:version="1.2" rngui:header="Arguments" name="arguments" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <element name="behavior" rngui:label="Mode">
-    <choice>
-      <value>wait_running</value>
-      <value>fork_running</value>
-      <value>wait_ready</value>
-      <value>fork_ready</value>
-    </choice>
-  </element>
-  <element name="url" rngui:label="Process">
-    <data type="string" rngui:label="Link to centurio.work testset"/>
-  </element>
-  <element name="date" rngui:label="Due Date">
-    <data type="date" rngui:label="Due Date"/>
-  </element>
-  <element name="init" rngui:header="Initialize">
-    <zeroOrMore rngui:label="New Argument Pair">
-      <element rngui:label='Name'>
-        <anyName/>
-        <data type="string" rngui:label="Value"/>
-      </element>
-    </zeroOrMore>
-  </element>
-</element>

+ 0 - 6
app/static/js/js_libs/tests/rngtest6.xml

@@ -1,6 +0,0 @@
-<arguments>
-  <behavior>wait_runnig</behavior>
-  <url>3</url>
-  <date/>
-  <init/>
-</arguments>

+ 0 - 60
app/static/js/js_libs/tests/rngtest8.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 8</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest8.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest8.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 13
app/static/js/js_libs/tests/rngtest8.rng

@@ -1,13 +0,0 @@
-<element rngui:version="1.2" name="parallel" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <attribute name="wait" rngui:label="Wait" rngui:default="-1" rngui:hint="-1 to wait for all branches.">
-    <data type="integer"/>
-  </attribute>
-  <element name="parallel_branch">
-    <attribute name="pass"><data type="string"/></attribute>
-    <attribute name="local"><data type="string"/></attribute>
-  </element>
-  <element name="parallel_branch">
-    <attribute name="pass"><data type="string"/></attribute>
-    <attribute name="local"><data type="string"/></attribute>
-  </element>
-</element>

+ 0 - 2
app/static/js/js_libs/tests/rngtest8.xml

@@ -1,2 +0,0 @@
-<choose mode="exclusive"/>
-

+ 0 - 60
app/static/js/js_libs/tests/rngtest9.html

@@ -1,60 +0,0 @@
-<!--
-  This file is part of RelaxNGui.
-
-  RelaxNGui is free software: you can redistribute it and/or modify it under
-  the terms of the GNU General Public License as published by the Free Software
-  Foundation, either version 3 of the License, or (at your option) any later
-  version.
-
-  RelaxNGui is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  RelaxNGui (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>RelaxNGui Test 9</title>
-
-    <!-- libs, do not modify -->
-    <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-
-    <script type="text/javascript" src="relaxngui.js"></script>
-    <link rel="stylesheet" href="relaxngui.css" type="text/css"/>
-
-    <!-- custom stuff, play arround  -->
-
-    <script type="text/javascript">
-      $("body").ready(function(){
-        $.ajax({
-          type: "GET",
-          url: "rngtest9.rng",
-          success: function(rng){
-            $.ajax({
-              type: "GET",
-              url: "rngtest9.xml",
-              success: function(data){
-                var rngui = new RelaxNGui(rng,$('#show'));
-                rngui.content(data);
-                $('#saveall').on('click',function(){
-                  console.log($(rngui.save()).serializePrettyXML());
-                });
-              }
-            });
-          }
-        });
-      });
-    </script>
-  </head>
-  <body>
-    <div id="show"></div>
-    <button id='saveall'>save it all to console</button>
-  </body>
-</html>

+ 0 - 35
app/static/js/js_libs/tests/rngtest9.rng

@@ -1,35 +0,0 @@
-<element rngui:version="1.2" name="element" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:rngui="http://rngui.org">
-  <attribute name="name" rngui:readonly="true" rngui:default="arguments">
-    <data type="string"/>
-  </attribute>
-  <choice>
-    <zeroOrMore rngui:label="Create Unnamed Element">
-      <element name="element">
-        <element name="anyname"/>
-        <element name="data">
-          <attribute name="type" rngui:label="Type">
-            <choice>
-              <value>integer</value>
-              <value>string</value>
-            </choice>
-          </attribute>
-        </element>
-      </element>
-    </zeroOrMore>
-    <zeroOrMore rngui:label="Create Named Element">
-      <element name="element">
-        <attribute name="name" rngui:label="Name">
-          <data type="string"/>
-        </attribute>
-        <element name="data">
-          <attribute name="type" rngui:label="Type">
-            <choice>
-              <value>integer</value>
-              <value>string</value>
-            </choice>
-          </attribute>
-        </element>
-      </element>
-    </zeroOrMore>
-  </choice>
-</element>

+ 0 - 8
app/static/js/js_libs/tests/rngtest9.xml

@@ -1,8 +0,0 @@
-<element name="argument">
-  <element name="test">
-    <data type="integer"/>
-  </element>
-  <element name="aaa">
-    <data type="string"/>
-  </element>
-</element>

+ 35 - 11
app/static/js/js_libs/ui.js

@@ -13,10 +13,42 @@
   CPEE (file COPYING in the main directory).  If not, see
   <http://www.gnu.org/licenses/>.
 */
+function set_redis(key, value) {
 
-function ui_click_tab(moi) { // {{{
+        $.ajax({
+            type: "POST",
+            url: "/redis/set/" + key,
+            data: JSON.stringify({ value: value }),
+            dataType: "json",
+            contentType: "json",
+            success: function(data)
+            {
+                (data.GET);
+            }
+        });
+    }
+
+function get_redis(key) {
+    $.ajax({
+        type: "GET",
+        url: "redis/get/" + key,
+        data: "format=json",
+        dataType: "text",
+        success: function(data)
+        {
+            $("#result").text(data.GET);
+        }
+    });
+}
+
+function split_string(string) {
+    var string = str.split(" ",2);
+    return string;
+};
+
+function ui_click_tab(moi) {
   $(moi).trigger('click');
-} // }}}
+}
 
 function ui_close_tab(moi){
   var active = $(moi).parent().attr('data-tab');
@@ -52,12 +84,9 @@ function ui_add_tab(tabbed,title,id,closeable,additionalclasses) {
 }
 
 function create_new_tab(title, id,terms) {
-    //console.log(title,id);
     if (terms != "empty"){
     var terms = atob(terms);
     var theDiv = document.getElementById(id);
-    //var content = document.createTextNode("Test");
-    //var content = document.createTextNode(terms);
     var newElement = document.createElement('div');
     var textElement = document.createElement('div');
     var array_terms = JSON.parse(terms);
@@ -66,7 +95,6 @@ function create_new_tab(title, id,terms) {
     textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO document </a><br>";
     for (var key in array_terms) {
         console.log(key);
-        //theDiv.appendChild(document.createTextNode(terms[key]));
         textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','"+array_terms[key]+"')>"+key+" </a><br>";
     }
     newElement.setAttribute('id', "iso_"+id);
@@ -82,9 +110,7 @@ function create_new_tab(title, id,terms) {
         var textElement = document.createElement('div');
         textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO File. </a><br>";
         newElement.setAttribute('id', "iso_"+id);
-        //console.log(terms);
         newElement.innerHTML = "<iframe width=100% height=1000px src= '+{{ url_for('static', filename='isos/') }}"+ id  + ".PDF)'> </iframe>";
-        //newElement.innerHTML ="<h1> hallooo </>"
         theDiv.appendChild(textElement);
         theDiv.appendChild(newElement);
     }
@@ -96,7 +122,7 @@ function change_isos_tab(id, term){
     if (term == "start"){
         term = 1;
     }
-    theDiv.innerHTML = "<iframe width=100% height=1000px src= '{{ url_for('static', filename='isos/') }}+" id  + ".PDF#page="+ term+"')'> </iframe>";
+    theDiv.innerHTML = "<iframe width=100% height=1000px src= '{{ url_for('static', filename='isos/') }}+" + id  + ".PDF#page="+ term+ "')'> </iframe>";
     console.log(id,term);
     return true;
 }
@@ -141,8 +167,6 @@ function ui_clone_tab(tabbar,original,title,id,closeable,additionalclasses) {
       if (!drag.hasClass('draggable'))
         return;
 
-      // Assume 50/50 split between prev and next then adjust to
-      // the next X for prev
       var total = prev.outerWidth() + next.outerWidth();
       var pos = e.pageX - prev.offset().left;
       if (pos > total) {

+ 0 - 232
app/static/js/js_libs/ui.js~

@@ -1,232 +0,0 @@
-/*
-  This file is part of CPEE.
-
-  CPEE is free software: you can redistribute it and/or modify it under the terms
-  of the GNU General Public License as published by the Free Software Foundation,
-  either version 3 of the License, or (at your option) any later version.
-
-  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-  PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  CPEE (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
-*/
-
-function ui_click_tab(moi) { // {{{
-  $(moi).trigger('click');
-} // }}}
-
-function ui_close_tab(moi){
-  var active = $(moi).parent().attr('data-tab');
-  var tabbed = $(moi).parent().parent().parent();
-  var is_inactive = $(moi).parent().hasClass('inactive');
-  $('*[data-tab=' + active + ']').remove();
-  $('*[data-belongs-to-tab=' + active + ']').remove();
-  if (!is_inactive)
-    ui_click_tab($('ui-tabbar ui-tab.default'));
-}
-
-function ui_add_close(moi) {
-  $(moi).append($('<ui-close>✖</ui-close>'));
-}
-
-function ui_empty_tab_contents(id) {
-  $('ui-content ui-area[data-belongs-to-tab=' + id + ']').empty();
-}
-
-function ui_add_tab(tabbed,title,id,closeable,additionalclasses) {
-  additionalclasses = typeof additionalclasses !== 'undefined' ? additionalclasses : '';
-  if ($('ui-tabbar ui-tab[data-tab=' + id + ']').length > 0) {
-    ui_activate_tab($('ui-tabbar ui-tab[data-tab=' + id + ']'));
-    return false;
-  } else {
-    var instab = $("<ui-tab class='inactive" + (closeable ? ' closeable' : '') + (additionalclasses == '' ? '' : ' ' + additionalclasses) + "' data-tab='" + id + "'>" + title + "</ui-tab>");
-    var insarea = $("<ui-area data-belongs-to-tab='" + id + "' class='inactive' id="+ id +"></ui-area>");
-    $(tabbed).find('ui-behind').before(instab);
-    $(tabbed).find('ui-content').append(insarea);
-    ui_add_close($('ui-tabbar ui-tab[data-tab=' + id + ']'));
-    return true;
-  }
-}
-
-function create_new_tab(title, id,terms) {
-    //console.log(title,id);
-    if (terms != "empty"){
-    var terms = atob(terms);
-    var theDiv = document.getElementById(id);
-    //var content = document.createTextNode("Test");
-    //var content = document.createTextNode(terms);
-    var newElement = document.createElement('div');
-    var textElement = document.createElement('div');
-    var array_terms = JSON.parse(terms);
-    var len = Object.keys(array_terms).length;
-    console.log(len);
-    textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO document </a><br>";
-    for (var key in array_terms) {
-        console.log(key);
-        //theDiv.appendChild(document.createTextNode(terms[key]));
-        textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','"+array_terms[key]+"')>"+key+" </a><br>";
-    }
-    newElement.setAttribute('id', "iso_"+id);
-    console.log(terms);
-    console.log(textElement)
-    newElement.innerHTML = "<iframe width=100% height=1000px src= '/edi2/isos/" + id  + ".PDF')'> </iframe>";
-    theDiv.appendChild(textElement);
-    theDiv.appendChild(newElement);
-    }
-    else{
-        var theDiv = document.getElementById(id);
-        var newElement = document.createElement('div');
-        var textElement = document.createElement('div');
-        textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO File. </a><br>";
-        newElement.setAttribute('id', "iso_"+id);
-        //console.log(terms);
-        newElement.innerHTML = "<iframe width=100% height=1000px src= '/edi2/isos/" + id  + ".PDF')'> </iframe>";
-        newElement.innerHTML ="<h1> hallooo </>"
-        theDiv.appendChild(textElement);
-        theDiv.appendChild(newElement);
-    }
-    return true;
-}
-
-function change_isos_tab(id, term){
-    var theDiv = document.getElementById("iso_"+id);
-    if (term == "start"){
-        term = 1;
-    }
-    theDiv.innerHTML = "<iframe width=100% height=1000px src= '/edi2/isos/" + id  + ".PDF#page="+ term+"')'> </iframe>";
-    console.log(id,term);
-    return true;
-}
-
-function ui_add_tab_active(tabbed,title,id,closeable,additionalclasses, terms) {
-  var state = ui_add_tab(tabbed,title,id,closeable,additionalclasses);
-  console.log("test");
-  if (state) { create_new_tab(title, id, terms); }
-  if (state) { ui_activate_tab($('ui-tabbar ui-tab[data-tab=' + id + ']')); }
-  return state;
-}
-
-
-
-function ui_clone_tab(tabbar,original,title,id,closeable,additionalclasses) {
-  additionalclasses = typeof additionalclasses !== 'undefined' ? additionalclasses : '';
-  var instab = $("<ui-tab class='inactive" + (closeable ? ' closeable' : '') + (additionalclasses == '' ? '' : ' ' + additionalclasses) + "' data-tab='" + id + "' id='tab_" + id + "'>" + title + "</ui-tab>");
-  var insarea = original.clone();
-  insarea.attr("data-belongs-to-tab",id);
-  insarea.attr("class","inactive");
-  $(tabbar).find('ui-behind').before(instab);
-  $(tabbar).parent().append(insarea);
-  ui_add_close($('ui-tabbed ui-tab[data-tab=' + id + ']'));
-}
-
-(function($) { //{{{
-  $.fn.dragcolumn = function() {
-    var drag = $(this);
-    var prev = drag.prev();
-    var next = drag.next();
-
-    this.on("mousedown", function(e) {
-      drag.addClass('draggable');
-      $(document).one("mouseup", function(e) {
-        drag.removeClass('draggable');
-        e.preventDefault();
-      });
-      e.preventDefault();
-    });
-
-    $(document).on("mousemove", function(e) {
-      if (!drag.hasClass('draggable'))
-        return;
-
-      // Assume 50/50 split between prev and next then adjust to
-      // the next X for prev
-      var total = prev.outerWidth() + next.outerWidth();
-      var pos = e.pageX - prev.offset().left;
-      if (pos > total) {
-        pos = total;
-      }
-
-      var leftPercentage = pos / total;
-      var rightPercentage = 1 - leftPercentage;
-
-      prev.css('flex', leftPercentage.toString());
-      next.css('flex', rightPercentage.toString());
-
-      e.preventDefault();
-    });
-  }
-  $.fn.dragresize = function() {
-    var drag = $(this);
-    var prev = drag.prev();
-    var initpos = 0;
-    var initheight = $("ui-content",prev).height();
-
-    this.on("mousedown", function(e) {
-      drag.addClass('draggable');
-      initpos = e.pageY;
-      $(document).one("mouseup", function(e) {
-        drag.removeClass('draggable');
-        e.preventDefault();
-      });
-      e.preventDefault();
-    });
-
-    $(document).on("mousemove", function(e) {
-      if (!drag.hasClass('draggable'))
-        return;
-
-      var pos = initheight - (initpos - e.pageY);
-      if (pos < 0)
-        return;
-
-      $("ui-content",prev).css('height', pos.toString());
-
-      e.preventDefault();
-    });
-  }
-})(jQuery); //}}}
-
-function ui_activate_tab(moi) { // {{{
-  var active = $(moi).attr('data-tab');
-  var tabbed = $(moi).parent().parent();
-  var tabs = [];
-  $("ui-tabbar > ui-tab",tabbed).each(function(){
-    if (!$(this).attr('class').match(/switch/)) {
-      tabs.push($(this).attr('data-tab'));
-    }
-  });
-  $(".inactive",tabbed).removeClass("inactive");
-  $.each(tabs,function(a,b){
-    if (b != active) {
-      $("ui-tabbar ui-tab[data-tab=" + b + "]",tabbed).addClass("inactive");
-      $("ui-content *[data-belongs-to-tab=" + b + "]",tabbed).addClass("inactive");
-    }
-  });
-} // }}}
-function ui_toggle_vis_tab(moi) {// {{{
-  if ($(moi)[0].nodeName == 'UI-TABBED') {
-    var tabbed = $(moi);
-  }
-  if ($(moi)[0].nodeName == 'UI-TAB') {
-    var tabbed = $(moi).parent().parent();
-  }
-  if (tabbed) {
-    tabbed.toggleClass('off');
-  }
-}// }}}
-
-$(document).ready(function() {
-  if (!($.browser.name == "Firefox" && $.browser.version >= 20) && !($.browser.name == "Chrome" && $.browser.version >= 30)) {
-    $('body').children().remove();
-    $('body').append('Sorry, only Firefox >= 20.0 and Chrom(e|ium) >= 17 for now.');
-  }
-  $('ui-rest ui-content ui-resizehandle').dragcolumn();
-  $('*[is=x-ui] > ui-resizehandle').dragresize();
-  $(document).on('click','ui-tabbar ui-tab.switch',function(){ui_toggle_vis_tab(this);});
-  $(document).on('click','ui-tabbar ui-tab:not(.switch)',function(){ui_activate_tab(this);});
-  ui_add_close($('ui-tabbar ui-tab.closeable'));
-  $(document).on('click','ui-tabbar ui-tab.closeable ui-close',function(){ui_close_tab(this);});
-});

File diff suppressed because it is too large
+ 0 - 41461
app/static/js/pdf.js


+ 32 - 0
app/static/js/redis_set_get.js

@@ -0,0 +1,32 @@
+    function set_redis(key, value) {
+        console.log("test")
+        $.ajax({
+            type: "POST",
+            url: "/redis/set/" + key,
+            data: JSON.stringify({ value: value }),
+            dataType: "json",
+            contentType: "json",
+            success: function(data)
+            {
+                (data.GET);
+            }
+        });
+    }
+
+     function get_redis(key) {
+        $.ajax({
+            type: "GET",
+            url: "redis/get/" + key,
+            data: "format=json",
+            dataType: "text",
+            success: function(data)
+            {
+                $("#result").text(data.GET);
+            }
+        });
+       }
+
+      function split_string(string) {
+            var string = str.split(" ",2);
+            return string;
+        };

+ 0 - 919
app/static/js/ui_utils.js

@@ -1,919 +0,0 @@
-/* Copyright 2012 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const CSS_UNITS = 96.0 / 72.0;
-const DEFAULT_SCALE_VALUE = 'auto';
-const DEFAULT_SCALE = 1.0;
-const MIN_SCALE = 0.10;
-const MAX_SCALE = 10.0;
-const UNKNOWN_SCALE = 0;
-const MAX_AUTO_SCALE = 1.25;
-const SCROLLBAR_PADDING = 40;
-const VERTICAL_PADDING = 5;
-
-const PresentationModeState = {
-  UNKNOWN: 0,
-  NORMAL: 1,
-  CHANGING: 2,
-  FULLSCREEN: 3,
-};
-
-const RendererType = {
-  CANVAS: 'canvas',
-  SVG: 'svg',
-};
-
-const TextLayerMode = {
-  DISABLE: 0,
-  ENABLE: 1,
-  ENABLE_ENHANCE: 2,
-};
-
-const ScrollMode = {
-  UNKNOWN: -1,
-  VERTICAL: 0, // Default value.
-  HORIZONTAL: 1,
-  WRAPPED: 2,
-};
-
-const SpreadMode = {
-  UNKNOWN: -1,
-  NONE: 0, // Default value.
-  ODD: 1,
-  EVEN: 2,
-};
-
-// Replaces {{arguments}} with their values.
-function formatL10nValue(text, args) {
-  if (!args) {
-    return text;
-  }
-  return text.replace(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => {
-    return (name in args ? args[name] : '{{' + name + '}}');
-  });
-}
-
-/**
- * No-op implementation of the localization service.
- * @implements {IL10n}
- */
-let NullL10n = {
-  async getLanguage() {
-    return 'en-us';
-  },
-
-  async getDirection() {
-    return 'ltr';
-  },
-
-  async get(property, args, fallback) {
-    return formatL10nValue(fallback, args);
-  },
-
-  async translate(element) { },
-};
-
-/**
- * Returns scale factor for the canvas. It makes sense for the HiDPI displays.
- * @return {Object} The object with horizontal (sx) and vertical (sy)
-                    scales. The scaled property is set to false if scaling is
-                    not required, true otherwise.
- */
-function getOutputScale(ctx) {
-  let devicePixelRatio = window.devicePixelRatio || 1;
-  let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
-                          ctx.mozBackingStorePixelRatio ||
-                          ctx.msBackingStorePixelRatio ||
-                          ctx.oBackingStorePixelRatio ||
-                          ctx.backingStorePixelRatio || 1;
-  let pixelRatio = devicePixelRatio / backingStoreRatio;
-  return {
-    sx: pixelRatio,
-    sy: pixelRatio,
-    scaled: pixelRatio !== 1,
-  };
-}
-
-/**
- * Scrolls specified element into view of its parent.
- * @param {Object} element - The element to be visible.
- * @param {Object} spot - An object with optional top and left properties,
- *   specifying the offset from the top left edge.
- * @param {boolean} skipOverflowHiddenElements - Ignore elements that have
- *   the CSS rule `overflow: hidden;` set. The default is false.
- */
-function scrollIntoView(element, spot, skipOverflowHiddenElements = false) {
-  // Assuming offsetParent is available (it's not available when viewer is in
-  // hidden iframe or object). We have to scroll: if the offsetParent is not set
-  // producing the error. See also animationStarted.
-  let parent = element.offsetParent;
-  if (!parent) {
-    console.error('offsetParent is not set -- cannot scroll');
-    return;
-  }
-  let offsetY = element.offsetTop + element.clientTop;
-  let offsetX = element.offsetLeft + element.clientLeft;
-  while ((parent.clientHeight === parent.scrollHeight &&
-          parent.clientWidth === parent.scrollWidth) ||
-         (skipOverflowHiddenElements &&
-          getComputedStyle(parent).overflow === 'hidden')) {
-    if (parent.dataset._scaleY) {
-      offsetY /= parent.dataset._scaleY;
-      offsetX /= parent.dataset._scaleX;
-    }
-    offsetY += parent.offsetTop;
-    offsetX += parent.offsetLeft;
-    parent = parent.offsetParent;
-    if (!parent) {
-      return; // no need to scroll
-    }
-  }
-  if (spot) {
-    if (spot.top !== undefined) {
-      offsetY += spot.top;
-    }
-    if (spot.left !== undefined) {
-      offsetX += spot.left;
-      parent.scrollLeft = offsetX;
-    }
-  }
-  parent.scrollTop = offsetY;
-}
-
-/**
- * Helper function to start monitoring the scroll event and converting them into
- * PDF.js friendly one: with scroll debounce and scroll direction.
- */
-function watchScroll(viewAreaElement, callback) {
-  let debounceScroll = function(evt) {
-    if (rAF) {
-      return;
-    }
-    // schedule an invocation of scroll for next animation frame.
-    rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
-      rAF = null;
-
-      let currentX = viewAreaElement.scrollLeft;
-      let lastX = state.lastX;
-      if (currentX !== lastX) {
-        state.right = currentX > lastX;
-      }
-      state.lastX = currentX;
-      let currentY = viewAreaElement.scrollTop;
-      let lastY = state.lastY;
-      if (currentY !== lastY) {
-        state.down = currentY > lastY;
-      }
-      state.lastY = currentY;
-      callback(state);
-    });
-  };
-
-  let state = {
-    right: true,
-    down: true,
-    lastX: viewAreaElement.scrollLeft,
-    lastY: viewAreaElement.scrollTop,
-    _eventHandler: debounceScroll,
-  };
-
-  let rAF = null;
-  viewAreaElement.addEventListener('scroll', debounceScroll, true);
-  return state;
-}
-
-/**
- * Helper function to parse query string (e.g. ?param1=value&parm2=...).
- */
-function parseQueryString(query) {
-  let parts = query.split('&');
-  let params = Object.create(null);
-  for (let i = 0, ii = parts.length; i < ii; ++i) {
-    let param = parts[i].split('=');
-    let key = param[0].toLowerCase();
-    let value = param.length > 1 ? param[1] : null;
-    params[decodeURIComponent(key)] = decodeURIComponent(value);
-  }
-  return params;
-}
-
-/**
- * Use binary search to find the index of the first item in a given array which
- * passes a given condition. The items are expected to be sorted in the sense
- * that if the condition is true for one item in the array, then it is also true
- * for all following items.
- *
- * @returns {Number} Index of the first array element to pass the test,
- *                   or |items.length| if no such element exists.
- */
-function binarySearchFirstItem(items, condition) {
-  let minIndex = 0;
-  let maxIndex = items.length - 1;
-
-  if (items.length === 0 || !condition(items[maxIndex])) {
-    return items.length;
-  }
-  if (condition(items[minIndex])) {
-    return minIndex;
-  }
-
-  while (minIndex < maxIndex) {
-    let currentIndex = (minIndex + maxIndex) >> 1;
-    let currentItem = items[currentIndex];
-    if (condition(currentItem)) {
-      maxIndex = currentIndex;
-    } else {
-      minIndex = currentIndex + 1;
-    }
-  }
-  return minIndex; /* === maxIndex */
-}
-
-/**
- *  Approximates float number as a fraction using Farey sequence (max order
- *  of 8).
- *  @param {number} x - Positive float number.
- *  @returns {Array} Estimated fraction: the first array item is a numerator,
- *                   the second one is a denominator.
- */
-function approximateFraction(x) {
-  // Fast paths for int numbers or their inversions.
-  if (Math.floor(x) === x) {
-    return [x, 1];
-  }
-  let xinv = 1 / x;
-  let limit = 8;
-  if (xinv > limit) {
-    return [1, limit];
-  } else if (Math.floor(xinv) === xinv) {
-    return [1, xinv];
-  }
-
-  let x_ = x > 1 ? xinv : x;
-  // a/b and c/d are neighbours in Farey sequence.
-  let a = 0, b = 1, c = 1, d = 1;
-  // Limiting search to order 8.
-  while (true) {
-    // Generating next term in sequence (order of q).
-    let p = a + c, q = b + d;
-    if (q > limit) {
-      break;
-    }
-    if (x_ <= p / q) {
-      c = p; d = q;
-    } else {
-      a = p; b = q;
-    }
-  }
-  let result;
-  // Select closest of the neighbours to x.
-  if (x_ - a / b < c / d - x_) {
-    result = x_ === x ? [a, b] : [b, a];
-  } else {
-    result = x_ === x ? [c, d] : [d, c];
-  }
-  return result;
-}
-
-function roundToDivide(x, div) {
-  let r = x % div;
-  return r === 0 ? x : Math.round(x - r + div);
-}
-
-/**
- * Gets the size of the specified page, converted from PDF units to inches.
- * @param {Object} An Object containing the properties: {Array} `view`,
- *   {number} `userUnit`, and {number} `rotate`.
- * @return {Object} An Object containing the properties: {number} `width`
- *   and {number} `height`, given in inches.
- */
-function getPageSizeInches({ view, userUnit, rotate, }) {
-  const [x1, y1, x2, y2] = view;
-  // We need to take the page rotation into account as well.
-  const changeOrientation = rotate % 180 !== 0;
-
-  const width = (x2 - x1) / 72 * userUnit;
-  const height = (y2 - y1) / 72 * userUnit;
-
-  return {
-    width: (changeOrientation ? height : width),
-    height: (changeOrientation ? width : height),
-  };
-}
-
-/**
- * Helper function for getVisibleElements.
- *
- * @param {number} index - initial guess at the first visible element
- * @param {Array} views - array of pages, into which `index` is an index
- * @param {number} top - the top of the scroll pane
- * @returns {number} less than or equal to `index` that is definitely at or
- *   before the first visible element in `views`, but not by too much. (Usually,
- *   this will be the first element in the first partially visible row in
- *   `views`, although sometimes it goes back one row further.)
- */
-function backtrackBeforeAllVisibleElements(index, views, top) {
-  // binarySearchFirstItem's assumption is that the input is ordered, with only
-  // one index where the conditions flips from false to true: [false ...,
-  // true...]. With vertical scrolling and spreads, it is possible to have
-  // [false ..., true, false, true ...]. With wrapped scrolling we can have a
-  // similar sequence, with many more mixed true and false in the middle.
-  //
-  // So there is no guarantee that the binary search yields the index of the
-  // first visible element. It could have been any of the other visible elements
-  // that were preceded by a hidden element.
-
-  // Of course, if either this element or the previous (hidden) element is also
-  // the first element, there's nothing to worry about.
-  if (index < 2) {
-    return index;
-  }
-
-  // That aside, the possible cases are represented below.
-  //
-  //     ****  = fully hidden
-  //     A*B*  = mix of partially visible and/or hidden pages
-  //     CDEF  = fully visible
-  //
-  // (1) Binary search could have returned A, in which case we can stop.
-  // (2) Binary search could also have returned B, in which case we need to
-  // check the whole row.
-  // (3) Binary search could also have returned C, in which case we need to
-  // check the whole previous row.
-  //
-  // There's one other possibility:
-  //
-  //     ****  = fully hidden
-  //     ABCD  = mix of fully and/or partially visible pages
-  //
-  // (4) Binary search could only have returned A.
-
-  // Initially assume that we need to find the beginning of the current row
-  // (case 1, 2, or 4), which means finding a page that is above the current
-  // page's top. If the found page is partially visible, we're definitely not in
-  // case 3, and this assumption is correct.
-  let elt = views[index].div;
-  let pageTop = elt.offsetTop + elt.clientTop;
-
-  if (pageTop >= top) {
-    // The found page is fully visible, so we're actually either in case 3 or 4,
-    // and unfortunately we can't tell the difference between them without
-    // scanning the entire previous row, so we just conservatively assume that
-    // we do need to backtrack to that row. In both cases, the previous page is
-    // in the previous row, so use its top instead.
-    elt = views[index - 1].div;
-    pageTop = elt.offsetTop + elt.clientTop;
-  }
-
-  // Now we backtrack to the first page that still has its bottom below
-  // `pageTop`, which is the top of a page in the first visible row (unless
-  // we're in case 4, in which case it's the row before that).
-  // `index` is found by binary search, so the page at `index - 1` is
-  // invisible and we can start looking for potentially visible pages from
-  // `index - 2`. (However, if this loop terminates on its first iteration,
-  // which is the case when pages are stacked vertically, `index` should remain
-  // unchanged, so we use a distinct loop variable.)
-  for (let i = index - 2; i >= 0; --i) {
-    elt = views[i].div;
-    if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
-      // We have reached the previous row, so stop now.
-      // This loop is expected to terminate relatively quickly because the
-      // number of pages per row is expected to be small.
-      break;
-    }
-    index = i;
-  }
-  return index;
-}
-
-/**
- * Generic helper to find out what elements are visible within a scroll pane.
- *
- * Well, pretty generic. There are some assumptions placed on the elements
- * referenced by `views`:
- *   - If `horizontal`, no left of any earlier element is to the right of the
- *     left of any later element.
- *   - Otherwise, `views` can be split into contiguous rows where, within a row,
- *     no top of any element is below the bottom of any other element, and
- *     between rows, no bottom of any element in an earlier row is below the
- *     top of any element in a later row.
- *
- * (Here, top, left, etc. all refer to the padding edge of the element in
- * question. For pages, that ends up being equivalent to the bounding box of the
- * rendering canvas. Earlier and later refer to index in `views`, not page
- * layout.)
- *
- * @param scrollEl {HTMLElement} - a container that can possibly scroll
- * @param views {Array} - objects with a `div` property that contains an
- *   HTMLElement, which should all be descendents of `scrollEl` satisfying the
- *   above layout assumptions
- * @param sortByVisibility {boolean} - if true, the returned elements are sorted
- *   in descending order of the percent of their padding box that is visible
- * @param horizontal {boolean} - if true, the elements are assumed to be laid
- *   out horizontally instead of vertically
- * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`
- */
-function getVisibleElements(scrollEl, views, sortByVisibility = false,
-                            horizontal = false) {
-  const top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;
-  const left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;
-
-  // Throughout this "generic" function, comments will assume we're working with
-  // PDF document pages, which is the most important and complex case. In this
-  // case, the visible elements we're actually interested is the page canvas,
-  // which is contained in a wrapper which adds no padding/border/margin, which
-  // is itself contained in `view.div` which adds no padding (but does add a
-  // border). So, as specified in this function's doc comment, this function
-  // does all of its work on the padding edge of the provided views, starting at
-  // offsetLeft/Top (which includes margin) and adding clientLeft/Top (which is
-  // the border). Adding clientWidth/Height gets us the bottom-right corner of
-  // the padding edge.
-  function isElementBottomAfterViewTop(view) {
-    const element = view.div;
-    const elementBottom =
-      element.offsetTop + element.clientTop + element.clientHeight;
-    return elementBottom > top;
-  }
-  function isElementRightAfterViewLeft(view) {
-    const element = view.div;
-    const elementRight =
-      element.offsetLeft + element.clientLeft + element.clientWidth;
-    return elementRight > left;
-  }
-
-  const visible = [], numViews = views.length;
-  let firstVisibleElementInd = numViews === 0 ? 0 :
-    binarySearchFirstItem(views, horizontal ? isElementRightAfterViewLeft :
-                                              isElementBottomAfterViewTop);
-
-  // Please note the return value of the `binarySearchFirstItem` function when
-  // no valid element is found (hence the `firstVisibleElementInd` check below).
-  if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews &&
-      !horizontal) {
-    // In wrapped scrolling (or vertical scrolling with spreads), with some page
-    // sizes, isElementBottomAfterViewTop doesn't satisfy the binary search
-    // condition: there can be pages with bottoms above the view top between
-    // pages with bottoms below. This function detects and corrects that error;
-    // see it for more comments.
-    firstVisibleElementInd =
-      backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
-  }
-
-  // lastEdge acts as a cutoff for us to stop looping, because we know all
-  // subsequent pages will be hidden.
-  //
-  // When using wrapped scrolling or vertical scrolling with spreads, we can't
-  // simply stop the first time we reach a page below the bottom of the view;
-  // the tops of subsequent pages on the same row could still be visible. In
-  // horizontal scrolling, we don't have that issue, so we can stop as soon as
-  // we pass `right`, without needing the code below that handles the -1 case.
-  let lastEdge = horizontal ? right : -1;
-
-  for (let i = firstVisibleElementInd; i < numViews; i++) {
-    const view = views[i], element = view.div;
-    const currentWidth = element.offsetLeft + element.clientLeft;
-    const currentHeight = element.offsetTop + element.clientTop;
-    const viewWidth = element.clientWidth, viewHeight = element.clientHeight;
-    const viewRight = currentWidth + viewWidth;
-    const viewBottom = currentHeight + viewHeight;
-
-    if (lastEdge === -1) {
-      // As commented above, this is only needed in non-horizontal cases.
-      // Setting lastEdge to the bottom of the first page that is partially
-      // visible ensures that the next page fully below lastEdge is on the
-      // next row, which has to be fully hidden along with all subsequent rows.
-      if (viewBottom >= bottom) {
-        lastEdge = viewBottom;
-      }
-    } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
-      break;
-    }
-
-    if (viewBottom <= top || currentHeight >= bottom ||
-        viewRight <= left || currentWidth >= right) {
-      continue;
-    }
-
-    const hiddenHeight = Math.max(0, top - currentHeight) +
-                         Math.max(0, viewBottom - bottom);
-    const hiddenWidth = Math.max(0, left - currentWidth) +
-                        Math.max(0, viewRight - right);
-    const percent = ((viewHeight - hiddenHeight) * (viewWidth - hiddenWidth) *
-                     100 / viewHeight / viewWidth) | 0;
-    visible.push({
-      id: view.id,
-      x: currentWidth,
-      y: currentHeight,
-      view,
-      percent,
-    });
-  }
-
-  const first = visible[0], last = visible[visible.length - 1];
-
-  if (sortByVisibility) {
-    visible.sort(function(a, b) {
-      let pc = a.percent - b.percent;
-      if (Math.abs(pc) > 0.001) {
-        return -pc;
-      }
-      return a.id - b.id; // ensure stability
-    });
-  }
-  return { first, last, views: visible, };
-}
-
-/**
- * Event handler to suppress context menu.
- */
-function noContextMenuHandler(evt) {
-  evt.preventDefault();
-}
-
-function isDataSchema(url) {
-  let i = 0, ii = url.length;
-  while (i < ii && url[i].trim() === '') {
-    i++;
-  }
-  return url.substring(i, i + 5).toLowerCase() === 'data:';
-}
-
-/**
- * Returns the filename or guessed filename from the url (see issue 3455).
- * @param {string} url - The original PDF location.
- * @param {string} defaultFilename - The value returned if the filename is
- *   unknown, or the protocol is unsupported.
- * @returns {string} Guessed PDF filename.
- */
-function getPDFFileNameFromURL(url, defaultFilename = 'document.pdf') {
-  if (typeof url !== 'string') {
-    return defaultFilename;
-  }
-  if (isDataSchema(url)) {
-    console.warn('getPDFFileNameFromURL: ' +
-                 'ignoring "data:" URL for performance reasons.');
-    return defaultFilename;
-  }
-  const reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
-  //            SCHEME        HOST         1.PATH  2.QUERY   3.REF
-  // Pattern to get last matching NAME.pdf
-  const reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
-  let splitURI = reURI.exec(url);
-  let suggestedFilename = reFilename.exec(splitURI[1]) ||
-                          reFilename.exec(splitURI[2]) ||
-                          reFilename.exec(splitURI[3]);
-  if (suggestedFilename) {
-    suggestedFilename = suggestedFilename[0];
-    if (suggestedFilename.includes('%')) {
-      // URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf
-      try {
-        suggestedFilename =
-          reFilename.exec(decodeURIComponent(suggestedFilename))[0];
-      } catch (ex) { // Possible (extremely rare) errors:
-        // URIError "Malformed URI", e.g. for "%AA.pdf"
-        // TypeError "null has no properties", e.g. for "%2F.pdf"
-      }
-    }
-  }
-  return suggestedFilename || defaultFilename;
-}
-
-function normalizeWheelEventDelta(evt) {
-  let delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);
-  let angle = Math.atan2(evt.deltaY, evt.deltaX);
-  if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
-    // All that is left-up oriented has to change the sign.
-    delta = -delta;
-  }
-
-  const MOUSE_DOM_DELTA_PIXEL_MODE = 0;
-  const MOUSE_DOM_DELTA_LINE_MODE = 1;
-  const MOUSE_PIXELS_PER_LINE = 30;
-  const MOUSE_LINES_PER_PAGE = 30;
-
-  // Converts delta to per-page units
-  if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
-    delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
-  } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
-    delta /= MOUSE_LINES_PER_PAGE;
-  }
-  return delta;
-}
-
-function isValidRotation(angle) {
-  return Number.isInteger(angle) && angle % 90 === 0;
-}
-
-function isValidScrollMode(mode) {
-  return (Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) &&
-          mode !== ScrollMode.UNKNOWN);
-}
-
-function isValidSpreadMode(mode) {
-  return (Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) &&
-          mode !== SpreadMode.UNKNOWN);
-}
-
-function isPortraitOrientation(size) {
-  return size.width <= size.height;
-}
-
-const WaitOnType = {
-  EVENT: 'event',
-  TIMEOUT: 'timeout',
-};
-
-/**
- * @typedef {Object} WaitOnEventOrTimeoutParameters
- * @property {Object} target - The event target, can for example be:
- *   `window`, `document`, a DOM element, or an {EventBus} instance.
- * @property {string} name - The name of the event.
- * @property {number} delay - The delay, in milliseconds, after which the
- *   timeout occurs (if the event wasn't already dispatched).
- */
-
-/**
- * Allows waiting for an event or a timeout, whichever occurs first.
- * Can be used to ensure that an action always occurs, even when an event
- * arrives late or not at all.
- *
- * @param {WaitOnEventOrTimeoutParameters}
- * @returns {Promise} A promise that is resolved with a {WaitOnType} value.
- */
-function waitOnEventOrTimeout({ target, name, delay = 0, }) {
-  return new Promise(function(resolve, reject) {
-    if (typeof target !== 'object' || !(name && typeof name === 'string') ||
-        !(Number.isInteger(delay) && delay >= 0)) {
-      throw new Error('waitOnEventOrTimeout - invalid parameters.');
-    }
-
-    function handler(type) {
-      if (target instanceof EventBus) {
-        target.off(name, eventHandler);
-      } else {
-        target.removeEventListener(name, eventHandler);
-      }
-
-      if (timeout) {
-        clearTimeout(timeout);
-      }
-      resolve(type);
-    }
-
-    const eventHandler = handler.bind(null, WaitOnType.EVENT);
-    if (target instanceof EventBus) {
-      target.on(name, eventHandler);
-    } else {
-      target.addEventListener(name, eventHandler);
-    }
-
-    const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
-    let timeout = setTimeout(timeoutHandler, delay);
-  });
-}
-
-/**
- * Promise that is resolved when DOM window becomes visible.
- */
-let animationStarted = new Promise(function (resolve) {
-  if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('LIB')) &&
-      typeof window === 'undefined') {
-    // Prevent "ReferenceError: window is not defined" errors when running the
-    // unit-tests in Node.js/Travis.
-    setTimeout(resolve, 20);
-    return;
-  }
-  window.requestAnimationFrame(resolve);
-});
-
-/**
- * Simple event bus for an application. Listeners are attached using the
- * `on` and `off` methods. To raise an event, the `dispatch` method shall be
- * used.
- */
-class EventBus {
-  constructor({ dispatchToDOM = false, } = {}) {
-    this._listeners = Object.create(null);
-    this._dispatchToDOM = dispatchToDOM === true;
-  }
-
-  on(eventName, listener) {
-    let eventListeners = this._listeners[eventName];
-    if (!eventListeners) {
-      eventListeners = [];
-      this._listeners[eventName] = eventListeners;
-    }
-    eventListeners.push(listener);
-  }
-
-  off(eventName, listener) {
-    let eventListeners = this._listeners[eventName];
-    let i;
-    if (!eventListeners || ((i = eventListeners.indexOf(listener)) < 0)) {
-      return;
-    }
-    eventListeners.splice(i, 1);
-  }
-
-  dispatch(eventName) {
-    let eventListeners = this._listeners[eventName];
-    if (!eventListeners || eventListeners.length === 0) {
-      if (this._dispatchToDOM) {
-        const args = Array.prototype.slice.call(arguments, 1);
-        this._dispatchDOMEvent(eventName, args);
-      }
-      return;
-    }
-    // Passing all arguments after the eventName to the listeners.
-    const args = Array.prototype.slice.call(arguments, 1);
-    // Making copy of the listeners array in case if it will be modified
-    // during dispatch.
-    eventListeners.slice(0).forEach(function (listener) {
-      listener.apply(null, args);
-    });
-    if (this._dispatchToDOM) {
-      this._dispatchDOMEvent(eventName, args);
-    }
-  }
-
-  /**
-   * @private
-   */
-  _dispatchDOMEvent(eventName, args = null) {
-    const details = Object.create(null);
-    if (args && args.length > 0) {
-      const obj = args[0];
-      for (let key in obj) {
-        const value = obj[key];
-        if (key === 'source') {
-          if (value === window || value === document) {
-            return; // No need to re-dispatch (already) global events.
-          }
-          continue; // Ignore the `source` property.
-        }
-        details[key] = value;
-      }
-    }
-    const event = document.createEvent('CustomEvent');
-    event.initCustomEvent(eventName, true, true, details);
-    document.dispatchEvent(event);
-  }
-}
-
-let globalEventBus = null;
-function getGlobalEventBus(dispatchToDOM = false) {
-  if (!globalEventBus) {
-    globalEventBus = new EventBus({ dispatchToDOM, });
-  }
-  return globalEventBus;
-}
-
-function clamp(v, min, max) {
-  return Math.min(Math.max(v, min), max);
-}
-
-class ProgressBar {
-  constructor(id, { height, width, units, } = {}) {
-    this.visible = true;
-
-    // Fetch the sub-elements for later.
-    this.div = document.querySelector(id + ' .progress');
-    // Get the loading bar element, so it can be resized to fit the viewer.
-    this.bar = this.div.parentNode;
-
-    // Get options, with sensible defaults.
-    this.height = height || 100;
-    this.width = width || 100;
-    this.units = units || '%';
-
-    // Initialize heights.
-    this.div.style.height = this.height + this.units;
-    this.percent = 0;
-  }
-
-  _updateBar() {
-    if (this._indeterminate) {
-      this.div.classList.add('indeterminate');
-      this.div.style.width = this.width + this.units;
-      return;
-    }
-
-    this.div.classList.remove('indeterminate');
-    let progressSize = this.width * this._percent / 100;
-    this.div.style.width = progressSize + this.units;
-  }
-
-  get percent() {
-    return this._percent;
-  }
-
-  set percent(val) {
-    this._indeterminate = isNaN(val);
-    this._percent = clamp(val, 0, 100);
-    this._updateBar();
-  }
-
-  setWidth(viewer) {
-    if (!viewer) {
-      return;
-    }
-    let container = viewer.parentNode;
-    let scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
-    if (scrollbarWidth > 0) {
-      this.bar.setAttribute('style', 'width: calc(100% - ' +
-                                     scrollbarWidth + 'px);');
-    }
-  }
-
-  hide() {
-    if (!this.visible) {
-      return;
-    }
-    this.visible = false;
-    this.bar.classList.add('hidden');
-    document.body.classList.remove('loadingInProgress');
-  }
-
-  show() {
-    if (this.visible) {
-      return;
-    }
-    this.visible = true;
-    document.body.classList.add('loadingInProgress');
-    this.bar.classList.remove('hidden');
-  }
-}
-
-/**
- * Moves all elements of an array that satisfy condition to the end of the
- * array, preserving the order of the rest.
- */
-function moveToEndOfArray(arr, condition) {
-  const moved = [], len = arr.length;
-  let write = 0;
-  for (let read = 0; read < len; ++read) {
-    if (condition(arr[read])) {
-      moved.push(arr[read]);
-    } else {
-      arr[write] = arr[read];
-      ++write;
-    }
-  }
-  for (let read = 0; write < len; ++read, ++write) {
-    arr[write] = moved[read];
-  }
-}
-
-export {
-  CSS_UNITS,
-  DEFAULT_SCALE_VALUE,
-  DEFAULT_SCALE,
-  MIN_SCALE,
-  MAX_SCALE,
-  UNKNOWN_SCALE,
-  MAX_AUTO_SCALE,
-  SCROLLBAR_PADDING,
-  VERTICAL_PADDING,
-  isValidRotation,
-  isValidScrollMode,
-  isValidSpreadMode,
-  isPortraitOrientation,
-  PresentationModeState,
-  RendererType,
-  TextLayerMode,
-  ScrollMode,
-  SpreadMode,
-  NullL10n,
-  EventBus,
-  getGlobalEventBus,
-  ProgressBar,
-  getPDFFileNameFromURL,
-  noContextMenuHandler,
-  parseQueryString,
-  backtrackBeforeAllVisibleElements, // only exported for testing
-  getVisibleElements,
-  roundToDivide,
-  getPageSizeInches,
-  approximateFraction,
-  getOutputScale,
-  scrollIntoView,
-  watchScroll,
-  binarySearchFirstItem,
-  normalizeWheelEventDelta,
-  animationStarted,
-  WaitOnType,
-  waitOnEventOrTimeout,
-  moveToEndOfArray,
-};

+ 0 - 12
app/static/js/url.js

@@ -1,12 +0,0 @@
-
-function submit_save(k)
-{
-    //The variable to be returned
-    var URL;
-
-
-    return URL;
-}
-
-
-

+ 0 - 131
app/static/js/viewer.css

@@ -1,131 +0,0 @@
-/* Copyright 2014 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@import url(text_layer_builder.css);
-@import url(annotation_layer_builder.css);
-
-.pdfViewer .canvasWrapper {
-  overflow: hidden;
-}
-
-.pdfViewer .page {
-  direction: ltr;
-  width: 816px;
-  height: 1056px;
-  margin: 1px auto -8px auto;
-  position: relative;
-  overflow: visible;
-  border: 9px solid transparent;
-  background-clip: content-box;
-  border-image: url(images/shadow.png) 9 9 repeat;
-  background-color: white;
-}
-
-.pdfViewer.removePageBorders .page {
-  margin: 0px auto 10px auto;
-  border: none;
-}
-
-.pdfViewer.singlePageView {
-  display: inline-block;
-}
-
-.pdfViewer.singlePageView .page {
-  margin: 0;
-  border: none;
-}
-
-.pdfViewer.scrollHorizontal, .pdfViewer.scrollWrapped, .spread {
-  margin-left: 3.5px;
-  margin-right: 3.5px;
-  text-align: center;
-}
-
-.pdfViewer.scrollHorizontal, .spread {
-  white-space: nowrap;
-}
-
-.pdfViewer.removePageBorders,
-.pdfViewer.scrollHorizontal .spread,
-.pdfViewer.scrollWrapped .spread {
-  margin-left: 0;
-  margin-right: 0;
-}
-
-.spread .page,
-.pdfViewer.scrollHorizontal .page,
-.pdfViewer.scrollWrapped .page,
-.pdfViewer.scrollHorizontal .spread,
-.pdfViewer.scrollWrapped .spread {
-  display: inline-block;
-  vertical-align: middle;
-}
-
-.spread .page,
-.pdfViewer.scrollHorizontal .page,
-.pdfViewer.scrollWrapped .page {
-  margin-left: -3.5px;
-  margin-right: -3.5px;
-}
-
-.pdfViewer.removePageBorders .spread .page,
-.pdfViewer.removePageBorders.scrollHorizontal .page,
-.pdfViewer.removePageBorders.scrollWrapped .page {
-  margin-left: 5px;
-  margin-right: 5px;
-}
-
-.pdfViewer .page canvas {
-  margin: 0;
-  display: block;
-}
-
-.pdfViewer .page canvas[hidden] {
-  display: none;
-}
-
-.pdfViewer .page .loadingIcon {
-  position: absolute;
-  display: block;
-  left: 0;
-  top: 0;
-  right: 0;
-  bottom: 0;
-  background: url('images/loading-icon.gif') center no-repeat;
-}
-
-.pdfPresentationMode .pdfViewer {
-  margin-left: 0;
-  margin-right: 0;
-}
-
-.pdfPresentationMode .pdfViewer .page,
-.pdfPresentationMode .pdfViewer .spread {
-  display: block;
-}
-
-.pdfPresentationMode .pdfViewer .page,
-.pdfPresentationMode .pdfViewer.removePageBorders .page {
-  margin-left: auto;
-  margin-right: auto;
-}
-
-.pdfPresentationMode:-ms-fullscreen .pdfViewer .page {
-  margin-bottom: 100% !important;
-}
-
-.pdfPresentationMode:fullscreen .pdfViewer .page {
-  margin-bottom: 100%;
-  border: 0;
-}

+ 0 - 225
app/static/js/viewer.js

@@ -1,225 +0,0 @@
-/* Copyright 2016 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* globals chrome */
-
-'use strict';
-
-if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
-  var defaultUrl; // eslint-disable-line no-var
-
-  (function rewriteUrlClosure() {
-    // Run this code outside DOMContentLoaded to make sure that the URL
-    // is rewritten as soon as possible.
-    let queryString = document.location.search.slice(1);
-    let m = /(^|&)file=([^&]*)/.exec(queryString);
-    defaultUrl = m ? decodeURIComponent(m[2]) : '';
-
-    // Example: chrome-extension://.../http://example.com/file.pdf
-    let humanReadableUrl = '/' + defaultUrl + location.hash;
-    history.replaceState(history.state, '', humanReadableUrl);
-    if (top === window) {
-      chrome.runtime.sendMessage('showPageAction');
-    }
-  })();
-}
-
-let pdfjsWebApp, pdfjsWebAppOptions;
-if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {
-  pdfjsWebApp = require('./app.js');
-  pdfjsWebAppOptions = require('./app_options.js');
-}
-
-if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
-  require('./firefoxcom.js');
-  require('./firefox_print_service.js');
-}
-if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) {
-  require('./genericcom.js');
-}
-if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
-  require('./chromecom.js');
-}
-if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME || GENERIC')) {
-  require('./pdf_print_service.js');
-}
-
-function getViewerConfiguration() {
-  return {
-    appContainer: document.body,
-    mainContainer: document.getElementById('viewerContainer'),
-    viewerContainer: document.getElementById('viewer'),
-    eventBus: null, // Using global event bus with (optional) DOM events.
-    toolbar: {
-      container: document.getElementById('toolbarViewer'),
-      numPages: document.getElementById('numPages'),
-      pageNumber: document.getElementById('pageNumber'),
-      scaleSelectContainer: document.getElementById('scaleSelectContainer'),
-      scaleSelect: document.getElementById('scaleSelect'),
-      customScaleOption: document.getElementById('customScaleOption'),
-      previous: document.getElementById('previous'),
-      next: document.getElementById('next'),
-      zoomIn: document.getElementById('zoomIn'),
-      zoomOut: document.getElementById('zoomOut'),
-      viewFind: document.getElementById('viewFind'),
-      openFile: document.getElementById('openFile'),
-      print: document.getElementById('print'),
-      presentationModeButton: document.getElementById('presentationMode'),
-      download: document.getElementById('download'),
-      viewBookmark: document.getElementById('viewBookmark'),
-    },
-    secondaryToolbar: {
-      toolbar: document.getElementById('secondaryToolbar'),
-      toggleButton: document.getElementById('secondaryToolbarToggle'),
-      toolbarButtonContainer:
-        document.getElementById('secondaryToolbarButtonContainer'),
-      presentationModeButton:
-        document.getElementById('secondaryPresentationMode'),
-      openFileButton: document.getElementById('secondaryOpenFile'),
-      printButton: document.getElementById('secondaryPrint'),
-      downloadButton: document.getElementById('secondaryDownload'),
-      viewBookmarkButton: document.getElementById('secondaryViewBookmark'),
-      firstPageButton: document.getElementById('firstPage'),
-      lastPageButton: document.getElementById('lastPage'),
-      pageRotateCwButton: document.getElementById('pageRotateCw'),
-      pageRotateCcwButton: document.getElementById('pageRotateCcw'),
-      cursorSelectToolButton: document.getElementById('cursorSelectTool'),
-      cursorHandToolButton: document.getElementById('cursorHandTool'),
-      scrollVerticalButton: document.getElementById('scrollVertical'),
-      scrollHorizontalButton: document.getElementById('scrollHorizontal'),
-      scrollWrappedButton: document.getElementById('scrollWrapped'),
-      spreadNoneButton: document.getElementById('spreadNone'),
-      spreadOddButton: document.getElementById('spreadOdd'),
-      spreadEvenButton: document.getElementById('spreadEven'),
-      documentPropertiesButton: document.getElementById('documentProperties'),
-    },
-    fullscreen: {
-      contextFirstPage: document.getElementById('contextFirstPage'),
-      contextLastPage: document.getElementById('contextLastPage'),
-      contextPageRotateCw: document.getElementById('contextPageRotateCw'),
-      contextPageRotateCcw: document.getElementById('contextPageRotateCcw'),
-    },
-    sidebar: {
-      // Divs (and sidebar button)
-      outerContainer: document.getElementById('outerContainer'),
-      viewerContainer: document.getElementById('viewerContainer'),
-      toggleButton: document.getElementById('sidebarToggle'),
-      // Buttons
-      thumbnailButton: document.getElementById('viewThumbnail'),
-      outlineButton: document.getElementById('viewOutline'),
-      attachmentsButton: document.getElementById('viewAttachments'),
-      // Views
-      thumbnailView: document.getElementById('thumbnailView'),
-      outlineView: document.getElementById('outlineView'),
-      attachmentsView: document.getElementById('attachmentsView'),
-    },
-    sidebarResizer: {
-      outerContainer: document.getElementById('outerContainer'),
-      resizer: document.getElementById('sidebarResizer'),
-    },
-    findBar: {
-      bar: document.getElementById('findbar'),
-      toggleButton: document.getElementById('viewFind'),
-      findField: document.getElementById('findInput'),
-      highlightAllCheckbox: document.getElementById('findHighlightAll'),
-      caseSensitiveCheckbox: document.getElementById('findMatchCase'),
-      entireWordCheckbox: document.getElementById('findEntireWord'),
-      findMsg: document.getElementById('findMsg'),
-      findResultsCount: document.getElementById('findResultsCount'),
-      findPreviousButton: document.getElementById('findPrevious'),
-      findNextButton: document.getElementById('findNext'),
-    },
-    passwordOverlay: {
-      overlayName: 'passwordOverlay',
-      container: document.getElementById('passwordOverlay'),
-      label: document.getElementById('passwordText'),
-      input: document.getElementById('password'),
-      submitButton: document.getElementById('passwordSubmit'),
-      cancelButton: document.getElementById('passwordCancel'),
-    },
-    documentProperties: {
-      overlayName: 'documentPropertiesOverlay',
-      container: document.getElementById('documentPropertiesOverlay'),
-      closeButton: document.getElementById('documentPropertiesClose'),
-      fields: {
-        'fileName': document.getElementById('fileNameField'),
-        'fileSize': document.getElementById('fileSizeField'),
-        'title': document.getElementById('titleField'),
-        'author': document.getElementById('authorField'),
-        'subject': document.getElementById('subjectField'),
-        'keywords': document.getElementById('keywordsField'),
-        'creationDate': document.getElementById('creationDateField'),
-        'modificationDate': document.getElementById('modificationDateField'),
-        'creator': document.getElementById('creatorField'),
-        'producer': document.getElementById('producerField'),
-        'version': document.getElementById('versionField'),
-        'pageCount': document.getElementById('pageCountField'),
-        'pageSize': document.getElementById('pageSizeField'),
-        'linearized': document.getElementById('linearizedField'),
-      },
-    },
-    errorWrapper: {
-      container: document.getElementById('errorWrapper'),
-      errorMessage: document.getElementById('errorMessage'),
-      closeButton: document.getElementById('errorClose'),
-      errorMoreInfo: document.getElementById('errorMoreInfo'),
-      moreInfoButton: document.getElementById('errorShowMore'),
-      lessInfoButton: document.getElementById('errorShowLess'),
-    },
-    printContainer: document.getElementById('printContainer'),
-    openFileInputName: 'fileInput',
-    debuggerScriptPath: './debugger.js',
-  };
-}
-
-function webViewerLoad() {
-  let config = getViewerConfiguration();
-  if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
-    Promise.all([
-      SystemJS.import('pdfjs-web/app'),
-      SystemJS.import('pdfjs-web/app_options'),
-      SystemJS.import('pdfjs-web/genericcom'),
-      SystemJS.import('pdfjs-web/pdf_print_service'),
-    ]).then(function([app, appOptions, ...otherModules]) {
-      window.PDFViewerApplication = app.PDFViewerApplication;
-      window.PDFViewerApplicationOptions = appOptions.AppOptions;
-      app.PDFViewerApplication.run(config);
-    });
-  } else {
-    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {
-      pdfjsWebAppOptions.AppOptions.set('defaultUrl', defaultUrl);
-    }
-
-    window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication;
-    window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions;
-
-    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) {
-      // Give custom implementations of the default viewer a simpler way to
-      // set various `AppOptions`, by dispatching an event once all viewer
-      // files are loaded but *before* the viewer initialization has run.
-      const event = document.createEvent('CustomEvent');
-      event.initCustomEvent('webviewerloaded', true, true, {});
-      document.dispatchEvent(event);
-    }
-
-    pdfjsWebApp.PDFViewerApplication.run(config);
-  }
-}
-
-if (document.readyState === 'interactive' ||
-    document.readyState === 'complete') {
-  webViewerLoad();
-} else {
-  document.addEventListener('DOMContentLoaded', webViewerLoad, true);
-}

+ 4 - 72
app/templates/index.html

@@ -34,13 +34,12 @@
     <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/underscore.min.js') }}"></script>
     <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.caret.min.js') }}"></script>
     <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.cookie.js') }}"></script>
+    <script type="text/javascript" src="{{ url_for('static', filename='js/redis_set_get.js') }}"></script>
+      <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/ui.js') }}"></script>
 
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/ui.js') }}"></script>
-    <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/ui.css') }}" type="text/css"/>
-      <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/cdp_ui.css') }}" type="text/css"/>
-
+     <link   rel="stylesheet"      href="{{ url_for('static', filename='css/ui.css') }}" type="text/css"/>
+      <link   rel="stylesheet"      href="{{ url_for('static', filename='css/cdp_ui.css') }}" type="text/css"/>
       <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css"/>
-    <link rel="stylesheet" href="{{ url_for('static', filename='css/layout.css') }}" type="text/css"/>
 
   <body is="x-ui">
     <ui-rest id="main">
@@ -110,52 +109,8 @@
 
       </ui-content>
     </ui-rest>
-
-
-    <script>
-    function log(){
-      console.log("test");
-
-    }
-
-    function set_redis(key, value) {
-
-        $.ajax({
-            type: "POST",
-            url: "/redis/set/" + key,
-            data: JSON.stringify({ value: value }),
-            dataType: "json",
-            contentType: "json",
-            success: function(data)
-            {
-                (data.GET);
-            }
-        });
-    }
-
-     function get_redis(key) {
-        $.ajax({
-            type: "GET",
-            url: "redis/get/" + key,
-            data: "format=json",
-            dataType: "text",
-            success: function(data)
-            {
-                $("#result").text(data.GET);
-            }
-        });
-       }
-
-      function split_string(string) {
-            var string = str.split(" ",2);
-            return string;
-        };
-
-    </script>
-
 <script>
 
-
     $(document).ready(function(){
 
         $("input[type=number]").on("change keyup input", function(){
@@ -185,18 +140,12 @@
                 array_value1[0] = $(this).attr('name');
                 array_value1[1] = false;
             }
-
            set_redis(key1, array_value1);
-
         });
 
 
 
         $("input[type=number]").focus(function(){
-
-
-
-
             var number = $(this).attr('name');
             var coords = $(this).attr('data-coords');
             highlight_areas(coords, "red");
@@ -234,10 +183,7 @@
        let coords_y = parseFloat(array_coords[1]);
        let coords_ymax = parseFloat(array_coords[3]);
        let coords_width = (coords_xmax - coords_x);
-
        let coords_height = (coords_ymax - coords_y);
-
-
        let width = $("#drawing").width();
        let height = $("#drawing").height();
        let rel_width = coords_width/h*width*1.4;
@@ -258,17 +204,11 @@
             y = height*(coords_y/h);
        }
 
-
-       console.log(w, h, rel_width, rel_height,x,y);
-
        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});
-
         $(".images").append($point1);
-
         };
 
        function highlight_details(coords, color){
-
        let w = {{w}}
        let h = {{h}}
        let pos = $("#drawing").position();
@@ -280,16 +220,10 @@
        let width_div = (parseFloat(array_coords[2]) - parseFloat(array_coords[0]));
 
        let height_div = (parseFloat(array_coords[3]) - parseFloat(array_coords[1]));
-
-
-
        let width = $("#drawing").width();
        let rel_width = width_div/h*width;
-
-
        let height = $("#drawing").height();
        let rel_height = height*height_div/w;
-
        let x = width*(coords_x*height/width/w);
        let y= height*(coords_y*width/height/h);
        console.log(rel_width, rel_height);
@@ -300,9 +234,7 @@
        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'});
 
         $(".images").append($point);
-
         };
-
      });
 
   </script>

+ 0 - 325
app/templates/index.html~

@@ -1,325 +0,0 @@
-<!--This file is part of centurio.work/edi.
-
-  centurio.work/edi is free software: you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by the Free
-  Software Foundation, either version 3 of the License, or (at your option) any
-  later version.
-
-  centurio.work/edi is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-  more details.
-
-  You should have received a copy of the GNU General Public License along with
-  centurio.work/edi (file COPYING in the main directory).  If not, see
-  <http://www.gnu.org/licenses/>.
--->
-
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>Resources</title>
-
-    <!-- libs, do not modify. When local than load local libs. -->
-     <script type="text/javascript" src="/js_libs/jquery.min.js"></script>
-    <script type="text/javascript" src="/js_libs/jquery.browser.js"></script>
-    <script type="text/javascript" src="/js_libs/jquery.svg.min.js"></script>
-    <script type="text/javascript" src="/js_libs/jquery.svgdom.min.js"></script>
-    <script type="text/javascript" src="/js_libs/vkbeautify.js"></script>
-    <script type="text/javascript" src="/js_libs/util.js"></script>
-    <script type="text/javascript" src="/js_libs/printf.js"></script>
-    <script type="text/javascript" src="/js_libs/strftime.min.js"></script>
-    <script type="text/javascript" src="/js_libs/parsequery.js"></script>
-    <script type="text/javascript" src="/js_libs/underscore.min.js"></script>
-    <script type="text/javascript" src="/js_libs/jquery.caret.min.js"></script>
-    <script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
-
-    <script type="text/javascript" src="/edi2/js_libs/ui.js"></script>
-    <link   rel="stylesheet"      href="/js_libs/ui.css" type="text/css"/>
-
-    <link   rel="stylesheet"      href="/cdp_ui/ui.css" type="text/css"/>
-
-    <link   rel="stylesheet"      href="/edi2/css/ui.css" type="text/css"/>
-    
-	<!--<script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.min.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.browser.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.svg.min.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.svgdom.min.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/vkbeautify.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/util.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/printf.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs//strftime.min.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/parsequery.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/underscore.min.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.caret.min.js') }}"></script>
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/jquery.cookie.js') }}"></script>
-
-    <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/ui.js') }}"></script>
-    <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/ui.css') }}" type="text/css"/>
-
-    <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/cdp_ui.css') }}" type="text/css"/>
-
-    <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/css/ui.css') }}" type="text/css"/>-->
-    <link rel="stylesheet" href="/edi2/css/style.css" type="text/css"/>
-    <link rel="stylesheet" href="/edi2/css/layout.css" type="text/css"/>
-
-  <body is="x-ui">
-    <ui-rest id="main">
-      <ui-content>
-        <ui-area id='datacolumn'>
-          <!-- <ui-rest id="sub">  with this the content does not work for other tabs -->
-            <ui-tabbar>
-              <ui-before>
-                <a class="logo" href="/"> </a>
-              </ui-before>
-              <ui-tab class="default" data-tab="drawing" >Drawing
-
-              </ui-tab>
-
-              <ui-behind                                       ></ui-behind>
-            </ui-tabbar>
-         <!--</ui-rest>-->
-          <ui-content>
-              <ui-area data-belongs-to-tab="drawing" >
-                  <div class="images">
-                  <img  class="optcontent" id="drawing" src="{{ url_for('static', filename='edi2/out.jpg') }}" alt="Drawing">
-                  </div>
-
-              </ui-area>
-
-          </ui-content>
-        </ui-area>
-
-        <ui-resizehandle data-label="drag to resize"></ui-resizehandle>
-        <ui-area id="detailcolumn1" data-minsize="20em">
-            <h3 style="text-align:center"> General Information</h3>
-            <div id="dat_details" class='x-ui-layout'>
-
-                <div class="column-one" style="width:50%;float:left">
-
-                  {{ html_links | safe }}
-
-                {% for iso in isos_names %}
-                    {{ iso }} (Document not available)<br>
-                {% endfor %}
-
-                </div>
-                <div class="column-two" style="width:50%;float:right">
-
-                {{ html_general | safe }}
-                </div>
-            </div>
-          <div id="measurements">
-                <font >
-                <form>
-                <table>
-                    <tr>
-                        <td style="text-align:center"><h3>Key Value</h3></td>
-                        <td style="text-align:center"><h3>Target Value</h3></td>
-                        <td style="text-align:center"><h3>Actual Value</h3></td>
-                        <td style="text-align:center"><h3>Relevant Isos</h3></td>
-                    </tr>
-
-                        {{ text | safe}}
-
-                </table>
-                </form>
-                </font>
-
-           </div>
-        </ui-area>
-
-      </ui-content>
-    </ui-rest>
-
-
-    <script>
-    function log(){
-      console.log("test");
-
-    }
-
-    function set_redis(key, value) {
-
-        $.ajax({
-            type: "POST",
-            url: "/redis/set/" + key,
-            data: JSON.stringify({ value: value }),
-            dataType: "json",
-            contentType: "json",
-            success: function(data)
-            {
-                (data.GET);
-            }
-        });
-    }
-
-     function get_redis(key) {
-        $.ajax({
-            type: "GET",
-            url: "redis/get/" + key,
-            data: "format=json",
-            dataType: "text",
-            success: function(data)
-            {
-                $("#result").text(data.GET);
-            }
-        });
-       }
-
-      function split_string(string) {
-            var string = str.split(" ",2);
-            return string;
-        };
-
-    </script>
-
-<script>
-
-
-    $(document).ready(function(){
-
-        $("input[type=number]").on("change keyup input", function(){
-            var array_value = [];
-            array_value[0] = $(this).attr('name');
-            array_value[1] = $(this).val();
-
-            var key = 'last' + "_" +'{{og_filename}}';
-
-            //console.log({{ dim }});
-            set_redis(key, array_value);
-        });
-
-        $("input[type=checkbox]").change(function(){
-
-           // Print entered value in a div box
-           $("#result").text($(this).attr('name'));
-           var key1 = 'last' + "_" +'{{og_filename}}';
-           var array_value1 = [];
-
-           if ($(this).is(':checked')) {
-                console.log($(this).attr('name') + ' is now checked');
-                array_value1[0] = 'relevant.' + $(this).attr('name');
-                array_value1[1] = true;
-            } else {
-                console.log($(this).attr('name') + ' is now unchecked');
-                array_value1[0] = $(this).attr('name');
-                array_value1[1] = false;
-            }
-
-           set_redis(key1, array_value1);
-
-        });
-
-
-
-        $("input[type=number]").focus(function(){
-
-
-
-
-            var number = $(this).attr('name');
-            var coords = $(this).attr('data-coords');
-            highlight_areas(coords, "red");
-            var detail = $(this).attr('data-details');
-            console.log(detail, "green");
-            highlight_details(detail, "green");
-
-        });
-
-        $("input[type=number]").blur(function(){
-
-          $("div").removeClass("red");
-          $("div").removeClass("green");
-
-        });
-
-
-      function highlight_areas(coords, color){
-
-       let w = {{w}}
-       let h = {{h}}
-       let pos = $("#drawing").position();
-       let drawing_x = pos.left;
-       let drawing_y = pos.top;
-       let array_coords = coords.split(",");
-       let coords_x = parseFloat(array_coords[0]);
-       let coords_xmax = parseFloat(array_coords[2]);
-       let coords_y = parseFloat(array_coords[1]);
-       let coords_ymax = parseFloat(array_coords[3]);
-       let coords_width = (coords_xmax - coords_x);
-
-       let coords_height = (coords_ymax - coords_y);
-
-
-       let width = $("#drawing").width();
-       let height = $("#drawing").height();
-       let rel_width = coords_width/h*width*1.4;
-       let rel_height = coords_height/w*height*1.4;
-       var orientation = "{{orientation}}";
-       var x = 0;
-       var y = 0;
-
-       if (orientation == "landscape"){
-            x = width*(coords_x*height/width/w);
-            y = height*(coords_y*width/height/h);
-       }
-       else {
-
-            x = width*(coords_x/w);
-            y = height*(coords_y/h);
-       }
-
-
-       console.log(w, h, rel_width, rel_height,x,y);
-
-       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});
-
-        $(".images").append($point1);
-
-        };
-
-       function highlight_details(coords, color){
-
-       let w = {{w}}
-       let h = {{h}}
-       let pos = $("#drawing").position();
-       let drawing_x = pos.left;
-       let drawing_y = pos.top;
-       let array_coords = coords.split(",");
-       let coords_x = parseFloat(array_coords[0]);
-       let coords_y = parseFloat(array_coords[1]);
-       let width_div = (parseFloat(array_coords[2]) - parseFloat(array_coords[0]));
-
-       let height_div = (parseFloat(array_coords[3]) - parseFloat(array_coords[1]));
-
-
-
-       let width = $("#drawing").width();
-       let rel_width = width_div/h*width;
-
-
-       let height = $("#drawing").height();
-       let rel_height = height*height_div/w;
-
-       let x = width*(coords_x*height/width/w);
-       let y= height*(coords_y*width/height/h);
-       console.log(rel_width, rel_height);
-       if (array_coords[3] > 10000) {
-           rel_height = height - y;
-
-       }
-
-
-       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'});
-
-        $(".images").append($point);
-
-        };
-
-     });
-
-  </script>
-  </body>
-</html>

+ 0 - 252
app/templates/index_old.html

@@ -1,252 +0,0 @@
-<!doctype html>
-<head>
-  <title>Dimension Extraction</title>
-  <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}"/>
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
-<script src="https://unpkg.com/pdfjs-dist@latest/build/pdf.min.js"></script>
-</head>
-
-<body>
-<!--<div class="split left">-->
-<div class="container">
-    <div class="column column-one">
-           <!-- <h1 style='text-align:center' >Drawing</h1>-->
-
-            <p> <a href="http://localhost:5000/"> Upload another drawing </a> </p>
-
-        <table style='text-align:left'>
-            {% for link in links %}
-            <tr>
-                    {% set l=links[link] %}
-                 <td style='text-align:left'>  <a href=" {{ url_for('static', filename=l) }}" > {{ link }} </a> </td>
-             </tr>
-            {% endfor %}
-            {% for iso in isos_names %}
-            <tr>
-                 <td style='text-align:left'> {{ iso }}</td>
-             </tr>
-            {% endfor %}
-
-        </table>
-        {% if filename %}
-             <div class="images">
-                <img id="drawing" src="{{ url_for('send_file', filename=filename) }}">
-             </div>
-        {% else %}
-            <h1>no image for whatever reason</h1>
-        {% endif %}
-
-    </div>
-<!--<div class="split middle">-->
-    <div class="column column-two" id="measurements">
-            <!--<h1 style='text-align:center' >Extracted Measurements</h1>-->
-                <font size="3" face="Courier New" >
-                <form>
-                <table>
-                    <tr>
-                        <td style="text-align:center"><h3>Key Value</h3></td>
-                        <td style="text-align:center"><h3>Target Value</h3></td>
-                        <td style="text-align:center"><h3>Actual Value</h3></td>
-                        <td style="text-align:center"><h3>Relevant Isos</h3></td>
-                    </tr>
-
-                        {{ text | safe}}
-
-
-                 <!--  {% for key in dims %}
-                    <td><h4> {{key}} </h4></td>
-                        {% for d in dims[key] %}
-                    <tr>
-                        <td style="text-align:center"><input type="checkbox" name="relevant[]" value="checked"></td>
-                        <td style="text-align:center"> {{ d }}</td>
-                        <td style="text-align:center"><input type="text" name="{{ d }}" size="10"></td>
-                    </tr>
-                        {% endfor %}
-                    {% endfor %}-->
-
-
-                </table>
-                </form>
-                </font>
-      <!--  </div> <div id="result">Result {{ number }}</div>-->
-
-    <!--<div class="split right">
-    <div class="column column-three">
-            <h1 style='text-align:center' >Additional Infos</h1>-->
-
-    </div>
-
-</div>
-
-    <script>
-    function set_redis(key, value) {
-
-        $.ajax({
-            type: "POST",
-            url: "/redis/set/" + key,
-            data: JSON.stringify({ value: value }),
-            dataType: "json",
-            contentType: "json",
-            success: function(data)
-            {
-                (data.GET);
-            }
-        });
-    }
-
-     function get_redis(key) {
-        $.ajax({
-            type: "GET",
-            url: "redis/get/" + key,
-            data: "format=json",
-            dataType: "text",
-            success: function(data)
-            {
-                $("#result").text(data.GET);
-            }
-        });
-
-      function split_string(string) {
-            var string = str.split(" ",2);
-            return string;
-        });
-
-    </script>
-
-<script>
-
-
-    $(document).ready(function(){
-
-        $("input[type=number]").on("change keyup input", function(){
-            var array_value = [];
-            array_value[0] = $(this).attr('name');
-            array_value[1] = $(this).val();
-
-            var key = 'last' + "_" +'{{og_filename}}';
-
-            //console.log({{ dim }});
-            set_redis(key, array_value);
-        });
-
-        $("input[type=checkbox]").change(function(){
-
-           // Print entered value in a div box
-           $("#result").text($(this).attr('name'));
-           var key1 = 'last' + "_" +'{{og_filename}}';
-           var array_value1 = [];
-
-           if ($(this).is(':checked')) {
-                console.log($(this).attr('name') + ' is now checked');
-                array_value1[0] = 'relevant.' + $(this).attr('name');
-                array_value1[1] = true;
-            } else {
-                console.log($(this).attr('name') + ' is now unchecked');
-                array_value1[0] = $(this).attr('name');
-                array_value1[1] = false;
-            }
-
-           set_redis(key1, array_value1);
-
-        });
-
-
-
-        $("input[type=number]").focus(function(){
-
-            // highlight values, does not work so far
-
-            var number = $(this).attr('name');
-            var coords = $(this).attr('data-coords');
-            highlight_areas(coords, "red");
-            var detail = $(this).attr('data-details');
-            console.log(detail, "green");
-            highlight_details(detail, "green");
-
-        });
-
-        $("input[type=number]").blur(function(){
-
-          $("div").removeClass("red");
-          $("div").removeClass("green");
-
-        });
-
-
-      function highlight_areas(coords, color){
-
-       let w = {{w}}
-       let h = {{h}}
-       let pos = $("#drawing").position();
-       let drawing_x = pos.left;
-       let drawing_y = pos.top;
-       let array_coords = coords.split(",");
-       let coords_x = parseFloat(array_coords[0]);
-       let coords_xmax = parseFloat(array_coords[2]);
-       let coords_y = parseFloat(array_coords[1]);
-       let coords_ymax = parseFloat(array_coords[3]);
-       let coords_width = (coords_xmax - coords_x);
-
-       let coords_height = (coords_ymax - coords_y);
-
-
-       let width = $("#drawing").width();
-       let height = $("#drawing").height();
-       let rel_width = coords_width/h*width*1.4;
-       let rel_height = coords_height/w*height*1.4;
-
-       let x = width*(coords_x*height/width/w);
-
-       let y = height*(coords_y*width/height/h);
-       console.log(w, h, rel_width, rel_height,x,y);
-
-       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});
-
-        $(".images").append($point1);
-
-        };
-
-       function highlight_details(coords, color){
-
-       let w = {{w}}
-       let h = {{h}}
-       let pos = $("#drawing").position();
-       let drawing_x = pos.left;
-       let drawing_y = pos.top;
-       let array_coords = coords.split(",");
-       let coords_x = parseFloat(array_coords[0]);
-       let coords_y = parseFloat(array_coords[1]);
-       let width_div = (parseFloat(array_coords[2]) - parseFloat(array_coords[0]));
-
-       let height_div = (parseFloat(array_coords[3]) - parseFloat(array_coords[1]));
-
-
-
-       let width = $("#drawing").width();
-       let rel_width = width_div/h*width;
-
-
-       let height = $("#drawing").height();
-       let rel_height = height*height_div/w;
-
-       let x = width*(coords_x*height/width/w);
-       let y= height*(coords_y*width/height/h);
-       console.log(rel_width, rel_height);
-       if (array_coords[3] > 10000) {
-           rel_height = height - y;
-
-       }
-
-
-       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'});
-
-        $(".images").append($point);
-
-        };
-
-     });
-
- </script>
-
-
-</body>

+ 0 - 32
app/templates/public/public_template.html

@@ -1,32 +0,0 @@
-<!doctype html>
-<html lang="en">
-
-<head>
-  <!-- Required meta tags -->
-  <meta charset="utf-8">
-  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-
-  <!-- Import the Bootstrap stylesheet -->
-  <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
-  <!-- Import our custom stylesheet -->
-  <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
-
-  <title>{% block title %}{% endblock %}</title>
-</head>
-
-<body>
-
-  <main>
-    {% block main %}{% endblock %}
-  </main>
-
-  <!-- Import jquery 3.3.1 slim min -->
-  <script src="{{ url_for('static', filename='js/jquery.slim.min.js') }}"></script>
-  <!-- Import Bootstrap bundle -->
-  <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
-  <!-- Import our custom JavaScript -->
-  <script src="{{ url_for('static', filename='js/app.js') }}"></script>
-  {% block script %}{% endblock %}
-</body>
-
-</html>

+ 16 - 18
app/views.py

@@ -1,4 +1,3 @@
-#encoding
 from app import app
 from flask import request, redirect, url_for, send_from_directory, render_template
 import subprocess
@@ -11,16 +10,15 @@ import re
 import base64
 
 path = "/home/bscheibel/app/app"
-#path = "/home/centurio/Projects/engineering_drawings_ui/app"
-#db_params = "unix_socket_path='/tmp/redis.sock',db=7"
-#path_image = "/home/centurio/web/edi2/out"
 path_image = "/home/bscheibel/app/app/temporary/out"
 db_params = "localhost"
 path_extraction = '/home/bscheibel/technical_drawings_extraction/main.py'
+#path = "/home/centurio/Projects/engineering_drawings_ui/app"
+#db_params = "unix_socket_path='/tmp/redis.sock',db=7"
+#path_image = "/home/centurio/web/edi2/out"
 #path_extraction = "/home/centurio/Projects/engineering_drawings_extraction/main.py"
 
 
-
 UPLOAD_FOLDER = path + "/temporary/"
 app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
 ALLOWED_EXTENSIONS = set(['pdf', 'png', 'jpg', 'jpeg', 'PDF'])
@@ -30,6 +28,7 @@ def allowed_file(filename):
     return '.' in filename and \
            filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
 
+
 def convert_pdf_img(filename):
     PDFFILE = UPLOAD_FOLDER +"/" + filename
     subprocess.call(['pdftoppm', '-jpeg', '-singlefile',
@@ -37,23 +36,23 @@ def convert_pdf_img(filename):
 
 
 def extract_all(uuid, filename, db):
-    #order_bounding_boxes_in_each_block.main(uuid, UPLOAD_FOLDER + "/" + filename)
     subprocess.call(['python3', path_extraction, str(uuid),UPLOAD_FOLDER + "/" + filename, db, str(0)])
 
+
 def get_file_size(file):
     pdf = PyPDF2.PdfFileReader(file)
     p = pdf.getPage(0)
-
     w = p.mediaBox.getWidth()
     h= p.mediaBox.getHeight()
-    OrientationDegrees = p.get('/Rotate')
-    if OrientationDegrees != 0 :
+    orientation_degrees = p.get('/Rotate')
+    if orientation_degrees != 0 :
         orientation = "landscape"
     else:
         orientation = "portrait"
 
-    print(w,h,OrientationDegrees)
-    return w,h, orientation
+    print(w, h, orientation_degrees)
+    return w, h, orientation
+
 
 def check_links(isos):
     link_names = {}
@@ -105,6 +104,7 @@ def upload_file():
     </form>
     '''
 
+
 @app.route('/show/<filename>&<uuid>')
 def uploaded_file(filename, uuid):
     file_out = "out.jpg"
@@ -124,7 +124,7 @@ def uploaded_file(filename, uuid):
         html_general = ""
         reg = r"(-?\d{1,}\.?\d*)"
         det_coords= "0,0,0,0"
-        with open(path +'/static/config.json') as f:
+        with open(path + '/static/config.json') as f:
             config_file = json.load(f)
             print(config_file)
 
@@ -158,9 +158,6 @@ def uploaded_file(filename, uuid):
                             search_terms["Beginn"] = 1
                         terms = json.dumps(search_terms)
                         terms = base64.b64encode(terms.encode()).decode('utf-8')
-
-
-
                 try:
                     number = re.search(reg, d)
                     number = number.group(1)
@@ -190,7 +187,7 @@ def uploaded_file(filename, uuid):
                 html_code += "</tr>"
                 html_links = ""
                 for link in links:
-                    html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link +"',true,'isotab','empty')> Open " + link + "</a> <br>"
+                    html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link + "',true,'isotab','empty')> Open " + link + "</a> <br>"
         return render_template('index.html', filename=file_out, isos=isos, dims=dims, text=html_code,html_general=html_general, number=number_blocks, og_filename=filename, w=w, h=h, html_links=html_links, isos_names=isos_names, orientation=orientation)
 
 
@@ -209,12 +206,14 @@ def add_header(response):
     response.headers.add("Access-Control-Allow-Methods", "*")
     return response
 
+
 @app.route('/redis/get/<key>',methods=['GET'])
 def redis_get(key):
     db = redis.Redis(db_params)
     result = json.loads(db.get(key))
     return result
 
+
 @app.route('/redis/set/<key>',methods=['POST'])
 def redis_set(key):
     value = request.get_json(force=True)
@@ -229,8 +228,7 @@ def redis_set(key):
         json_res = json.dumps(result)
         db.set(key,json_res)
     except:
-        dict_res = {}
-        dict_res[value_name] = value_v
+        dict_res = {value_name: value_v}
         json_dict = json.dumps(dict_res)
         db.set(key, json_dict)
     return "OK"

BIN
app/views.pyc


+ 0 - 292
app/views.py~

@@ -1,292 +0,0 @@
-#encoding
-from app import app
-from flask import request, redirect, url_for, send_from_directory, render_template
-import subprocess
-import redis
-import random
-import PyPDF2
-import json
-import base64
-import os
-import json
-import re
-import base64
-#https://medium.com/@emerico/convert-pdf-to-image-using-python-flask-2864fb655e01
-
-#path = "/home/bscheibel/app/app"
-path = "/home/centurio/Projects/engineering_drawings_ui/app"
-
-#path_extraction = '/home/bscheibel/PycharmProjects/dxf_reader/main.py'
-path_extraction = "/home/centurio/Projects/engineering_drawings_extraction/main.py"
-UPLOAD_FOLDER = path + "/temporary/"
-app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
-ALLOWED_EXTENSIONS = set(['pdf', 'png', 'jpg', 'jpeg', 'PDF'])
-
-
-def allowed_file(filename):
-    return '.' in filename and \
-           filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
-
-def convert_pdf_img(filename):
-    PDFFILE = UPLOAD_FOLDER +"/" + filename
-    subprocess.call(['pdftoppm', '-jpeg', '-singlefile',
-                     PDFFILE,  '/edi2/out'])
-
-def extract_all(uuid, filename, db):
-    #order_bounding_boxes_in_each_block.main(uuid, UPLOAD_FOLDER + "/" + filename)
-    subprocess.call(['python3', path_extraction, str(uuid),UPLOAD_FOLDER + "/" + filename, db, str(0)])
-
-def get_file_size(file):
-    pdf = PyPDF2.PdfFileReader(file)
-    p = pdf.getPage(0)
-
-    w = p.mediaBox.getWidth()
-    h= p.mediaBox.getHeight()
-    OrientationDegrees = p.get('/Rotate')
-    if OrientationDegrees != 0 :
-        orientation = "landscape"
-    else:
-        orientation = "portrait"
-
-    print(w,h,OrientationDegrees)
-    return w,h, orientation
-
-
-
-
-def check_config_file(d):
-    reg_search = d
-    #print(reg_search)
-
-    for conf in d:
-        print(conf)
-
-    return "blub"
-
-
-def check_links(isos):
-    link_names = {}
-    isos_names = []
-    isos = list(set(isos))
-    reg_isos = r"(ISO\s\d*)\s1\-(\d?)"
-    print(isos)
-    isos_new = []
-    for name in isos:
-        if re.search(reg_isos, name):
-            n = 1
-            #print(name)
-            new_isos = re.search(reg_isos,name).group(1)
-            number = re.search(reg_isos,name).group(2)
-            while n <= int(number):
-                isos_new.append(new_isos+"-"+str(n))
-                n += 1
-        else:
-            isos_new.append(name)
-    for name in isos_new:
-        try:
-            name = name.replace(" ", "")
-            #name = name.replace("-"," ")
-            url1 = name + ".PDF"
-            #print(url)
-            file = send_from_directory("static/isos",url1)
-            url = "isos/" + url1
-            #link_names.append(url)
-            link_names[name] = url
-            #print(link_names)
-        except:
-            #print(name)
-            isos_names.append(name)
-    return link_names, isos_names
-
-
-@app.route('/', methods=['GET', 'POST'])
-def upload_file():
-    if request.method == 'POST':
-        file = request.files['file']
-        if file and allowed_file(file.filename):
-            filename = file.filename
-            basedir = os.path.abspath(os.path.dirname(__file__))
-            file.save(os.path.join(basedir,app.config["UPLOAD_FOLDER"], filename))
-            uuid = random.randint(100,10000000)
-            extract_all(uuid, filename, 'localhost')
-            return redirect(url_for('uploaded_file', filename=filename, uuid=uuid))
-    return '''
-    <!doctype html>
-    <title>Upload new File</title>
-    <h1>Upload new File</h1>
-    <form action="" method=post enctype=multipart/form-data>
-      <p><input type=file name=file>
-         <input type=submit value=Upload>
-    </form>
-    '''
-
-@app.route('/show/<filename>&<uuid>')
-def uploaded_file(filename, uuid):
-    file_out = "out.jpg"
-    #file_out = filename
-    #if request.method == 'POST':
-    #    uuid = 433
-    if filename.endswith(".pdf") or filename.endswith(".PDF"):
-        w,h, orientation = get_file_size(UPLOAD_FOLDER +"/" + filename)
-        convert_pdf_img(filename)
-        db = redis.Redis(unix_socket_path='/tmp/redis.sock',db=7)
-        #db = redis.Redis("unix_socket_path='127.0.0.1',6379,db=7")
-        #isos = db.get(uuid+"dims")
-        #print(iso)
-        gen_tol = db.get(str(uuid)+"tol")
-        print(gen_tol)
-        isos = json.loads(db.get(str(uuid)+"isos"))
-        links, isos_names = check_links(isos)
-        dims = json.loads(db.get(str(uuid)+"dims"))
-        details = json.loads(db.get(str(uuid) + "details"))
-        number_blocks = db.get(str(uuid)+"eps")
-        html_code = "General tolerances according to: " + str(gen_tol) + "<br>"
-        html_general = ""
-        reg = r"(-?\d{1,}\.?\d*)"
-        #re_gewinde = r"M\d{1,2}"
-        #re_passungen = r"h\d{1,2}|H\d{1,2}"
-        det_coords= "0,0,0,0"
-        with open(path +'/static/config.json') as f:
-            config_file = json.load(f)
-            print(config_file)
-
-        for dim in sorted(dims):
-            #print(dim)
-            for det in details:
-                #print(det)
-                try:
-                    if dim == det:
-                        det_coords = details[det]
-                        det_coords = ",".join(str(det) for det in det_coords)
-                except:
-                    det_coords = "0,0,0,0"
-            if "ZZZZ" in dim:
-                for d in dims[dim]:
-                    html_general += d + "<br>"
-                continue
-            else:
-                html_code += "<td><h4>" + dim + "</h4></td>"
-            for d in dims[dim]:
-                relevant_isos = []
-                search_terms = {}
-                terms = ''
-                #if "Ra" in d or "Rz" in d or "Rpk" in d:
-                #    relevant_isos.append("ISO4287.PDF")
-                #if u"\u27C2" in d or u"\u25CE" in d or u"\u232D" in d or u"\u2225" in d or u"\u232F" in d or u"\u2316" in d or u"\u2313" in d or u"\u23E5" in d:
-                #    relevant_isos.append("ISO1101.PDF")
-                #if re.search(re_gewinde,d):
-                #    relevant_isos.append("ISO6410.PDF")
-                #if "GG" in d or "CT" in d or "GX" in d:
-                #    relevant_isos.append("ISO14405-1.PDF")
-                #if re.search(re_passungen,d):
-                #    relevant_isos.append("ISO286-1.PDF")
-                for conf in config_file:
-                    if re.search(conf,d):
-                        iso = config_file[conf]
-                        for key in iso:
-                            relevant_isos.append(key)
-                            for blub in iso[key]:
-                                search_terms[blub] = iso[key][blub]
-
-                        #terms = '{"Symbole":1,"Tabelle":2,"Definition":3}'
-                        if len(search_terms) < 1:
-                            search_terms["Beginn"] = 1
-                        terms = json.dumps(search_terms)
-                        #print(terms)
-                        terms = base64.b64encode(terms.encode()).decode('utf-8')
-                        #terms = "blub"
-
-
-
-                try:
-                    number = re.search(reg, d)
-                    number = number.group(1)
-                    try:
-                        floats = len(number.split(".")[1])
-                        if floats <= 1:
-                            steps = 0.1
-                        elif floats == 2:
-                            steps = 0.01
-                        elif floats == 3:
-                            steps = 0.001
-                        else:
-                            steps = 0.001
-                    except:
-                        steps = 0.1
-                except:
-                    number = d
-                    steps = 0.1
-                coords = ",".join(str(e) for e in dims[dim][d])
-                html_code += "<tr><td style='text-align:center'> <input type='checkbox' name='relevant." + d + "' value='checked'> </td>" + \
-                             "<td style='text-align:center'>" + d + "</td>" + \
-                             "<td max='3' style='text-align:center'> <input type='number' step='" + str(steps) + "' data-coords='" + coords + " 'data-details='" + det_coords  +"'' name='" + d + "' value='" + number + "'> </td>"
-
-                relevant_isos = list(set(relevant_isos))
-                for x in relevant_isos:
-                    #html_code += "<td style='text-align:left'> <a href=" + url_for('static', filename="isos/"+x) + " >"+ x.partition(".")[0]  +"</a>  </td>"
-                    html_code += "<td style='text-align:left' data-terms='" + terms + "'> <a onclick=ui_add_tab_active('#main','" + x.partition(".")[0] + "','" + x.partition(".")[0] +"',true,'isotab','"+terms+"')>" + x.partition(".")[0] + "</a>  </td>"
-                #print(html_code)
-                html_code += "</tr>"
-                html_links = ""
-                for link in links:
-                    html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link +"',true,'isotab','empty')> Open " + link + "</a> <br>"
-                    #html_links += "<tr> <td> <a onclick =ui_add_tab_active('#main','iso1','iso1',true,'isotab')> Open " + link + " in Tab </a> </td> </tr>"""
-        #print("teeest")
-        return render_template('index.html', filename=file_out, isos=isos, dims=dims, text=html_code,html_general=html_general, number=number_blocks, og_filename=filename, w=w, h=h, html_links=html_links, isos_names=isos_names, orientation=orientation)
-    #return render_template('test_pdfjs_textlayer.html', og_filename=filename)
-
-    #else:
-    #    filename = filename
-    #    return render_template('show_image.html', filename=filename)
-
-
-@app.route('/uploads/<filename>')
-def send_file(filename):
-    return send_from_directory(UPLOAD_FOLDER, filename)
-
-# No caching at all for API endpoints.
-@app.after_request
-def add_header(response):
-    # response.cache_control.no_store = True
-    response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
-    response.headers['Pragma'] = 'no-cache'
-    response.headers['Expires'] = '-1'
-    response.headers['Access-Control-Allow-Origin'] = '*'
-    response.headers.add("Access-Control-Allow-Headers", "*")
-    response.headers.add("Access-Control-Allow-Methods", "*")
-    return response
-
-
-
-@app.route('/redis/get/<key>',methods=['GET'])
-def redis_get(key):
-    db = redis.Redis(unix_socket_path='/tmp/redis.sock',db=7)
-    result = json.loads(db.get(key))
-    return result
-
-@app.route('/redis/set/<key>',methods=['POST'])
-def redis_set(key):
-    value = request.get_json(force=True)
-    value = value["value"]
-    db = redis.Redis(unix_socket_path='/tmp/redis.sock',db=7)
-
-    value_name = value[0]
-    value_v = value[1]
-    try:
-        result = json.loads(db.get(key))
-        result[value_name] = value_v
-        json_res = json.dumps(result)
-        db.set(key,json_res)
-    except:
-        dict_res = {}
-        dict_res[value_name] = value_v
-        json_dict = json.dumps(dict_res)
-        db.set(key, json_dict)
-    return "OK"
-
-
-
-@app.route('/index')
-def test():
-    return render_template('index.html')
-

+ 0 - 1
wsgi.py

@@ -1,5 +1,4 @@
 from app import app
 
 if __name__ == "__main__":
-    #app.run()
     server = Flask(__name__, static_url_path="", static_folder="static")

BIN
wsgi.pyc