diff --git a/ELAB-RFID-locks.sublime-workspace b/ELAB-RFID-locks.sublime-workspace index 9e26dfe..dc71a94 100644 --- a/ELAB-RFID-locks.sublime-workspace +++ b/ELAB-RFID-locks.sublime-workspace @@ -1 +1,1063 @@ -{} \ No newline at end of file +{ + "auto_complete": + { + "selected_items": + [ + [ + "eve", + "eventHistory" + ], + [ + "dat", + "dateString" + ], + [ + "ta", + "text-align" + ], + [ + "mar", + "margin-right" + ], + [ + "for", + "for\tfor (…) {…}" + ], + [ + "thet", + "theta" + ], + [ + "x", + "x0" + ], + [ + "pu", + "push_back" + ], + [ + "t_", + "t_init" + ], + [ + "ge", + "geometry_msgs" + ], + [ + "y", + "y_init" + ], + [ + "ra", + "ranges" + ], + [ + "curre", + "current_laser_scan" + ], + [ + "curr", + "current_laser_scan" + ], + [ + "mark", + "marker_pub_lines" + ], + [ + "rvi", + "rviz_lines" + ], + [ + "si", + "size" + ], + [ + "part", + "particle" + ], + [ + "par", + "particle" + ], + [ + "d_th", + "d_theta_left" + ], + [ + "d_Te", + "d_theta_right" + ], + [ + "pa", + "particles" + ], + [ + "particle_", + "particle_cloud" + ], + [ + "Poin", + "PointXYZ" + ], + [ + "point", + "points" + ], + [ + "some", + "some_cloud" + ], + [ + "Po", + "PointXYZ" + ], + [ + "parti", + "particle_quantity" + ], + [ + "exp", + "expected" + ], + [ + "Point", + "PointXYZ" + ], + [ + "C", + "Controls" + ], + [ + "line", + "linear" + ], + [ + "res", + "resample_index" + ], + [ + "uni", + "uniform_real_distribution" + ], + [ + "cumu", + "cumultaive_sum" + ], + [ + "to", + "totalWeight" + ], + [ + "s", + "scan" + ], + [ + "we", + "weight" + ], + [ + "lase", + "laser_min_range" + ], + [ + "laser", + "laser_variance" + ], + [ + "get", + "getParam" + ], + [ + "the", + "theta" + ], + [ + "odo", + "odoPoseDiff" + ], + [ + "no", + "noise_z" + ], + [ + "noi", + "noise_y" + ], + [ + "nois", + "noise_x" + ], + [ + "moti", + "motion_variance_x" + ], + [ + "do", + "double" + ], + [ + "motio", + "motion_variance_x" + ], + [ + "mot", + "motion_variance_x" + ], + [ + "Las", + "LaserScan" + ], + [ + "g", + "geometry_msgs" + ], + [ + "wall", + "wall_thickness" + ], + [ + "l", + "linear" + ], + [ + "pose", + "pose_diff" + ], + [ + "map", + "_map_file" + ], + [ + "tf", + "tf_listener" + ], + [ + "ma", + "map_frame" + ], + [ + "i", + "inc\t#include <…>" + ], + [ + "imag", + "image_msg" + ], + [ + "ima", + "image" + ], + [ + "Pro", + "Processed" + ], + [ + "im", + "image" + ], + [ + "image", + "imageTransport" + ], + [ + "obje", + "objectPoint" + ], + [ + "z", + "z_error" + ], + [ + "move", + "moveRelative" + ], + [ + "ob", + "objectPoint" + ], + [ + "moev", + "moveaAbs" + ], + [ + "gra", + "grabServer" + ], + [ + "uarm", + "uarm_controller" + ], + [ + "Ser", + "ServiceServer" + ], + [ + "gr", + "grab_object" + ], + [ + "uar", + "uarm_controller" + ], + [ + "ROS", + "ROS_INFO" + ], + [ + "obj", + "objectPose" + ], + [ + "upp", + "UpperV" + ], + [ + "v", + "V" + ], + [ + "lo", + "LowerV" + ], + [ + "up", + "UpperH" + ], + [ + "lower", + "LowerH" + ], + [ + "Cm", + "Cmax" + ], + [ + "dep", + "depth_registered" + ], + [ + "pcl", + "pclDepthRegistered" + ], + [ + "dept", + "depthImage" + ], + [ + "CvIma", + "CvImagePtr" + ], + [ + "wh", + "white_pixels" + ], + [ + "mea", + "y_mean" + ], + [ + "cv", + "cv_ptr" + ], + [ + "dpe", + "depth_data" + ], + [ + "Image", + "ImageConstPtr" + ], + [ + "depth", + "depthDataCallback" + ], + [ + "sub", + "subscribe" + ], + [ + "hi", + "history_out" + ], + [ + "histor", + "history_in" + ], + [ + "histo", + "history_in" + ], + [ + "w", + "w1_int_error" + ], + [ + "es", + "estimated_w2" + ], + [ + "des", + "desired_w2" + ], + [ + "time", + "timeString" + ], + [ + "card", + "cardID" + ], + [ + "ove", + "overlay_out" + ], + [ + "pos", + "position" + ], + [ + "pad", + "padding-left" + ], + [ + "font", + "font-size" + ], + [ + "ca", + "card-id" + ], + [ + "fun", + "function" + ], + [ + "se", + "send_from_directory" + ], + [ + "fn", + "function" + ], + [ + "fu", + "function" + ], + [ + "bak", + "background-color" + ], + [ + "poi", + "position" + ], + [ + "di", + "display" + ], + [ + "p", + "position" + ], + [ + "fon", + "font-size" + ], + [ + "inl", + "inline-block" + ], + [ + "back", + "background-color" + ], + [ + "wid", + "width" + ], + [ + "tran", + "transition" + ], + [ + "in", + "inline-block" + ], + [ + "json", + "json_data" + ], + [ + "en", + "event" + ], + [ + "if", + "ifmain\tif __name__ == '__main__'" + ], + [ + "d", + "d_theta_left" + ], + [ + "a", + "angular" + ], + [ + "d_", + "d_theta_right" + ], + [ + "coun", + "count_change_right" + ], + [ + "cou", + "count_change" + ] + ] + }, + "buffers": + [ + { + "file": "server.py", + "settings": + { + "buffer_size": 2820, + "encoding": "UTF-8", + "line_ending": "Unix" + } + }, + { + "file": "templates/status.html", + "settings": + { + "buffer_size": 1399, + "encoding": "UTF-8", + "line_ending": "Unix" + } + }, + { + "file": "static/style.css", + "settings": + { + "buffer_size": 2273, + "encoding": "UTF-8", + "line_ending": "Unix" + } + }, + { + "file": "static/script.js", + "settings": + { + "buffer_size": 2195, + "encoding": "UTF-8", + "line_ending": "Unix" + } + } + ], + "build_system": "", + "build_system_choices": + [ + ], + "build_varint": "", + "command_palette": + { + "height": 368.0, + "last_filter": "xml", + "selected_items": + [ + [ + "xml", + "Set Syntax: XML" + ], + [ + "rein", + "Indentation: Reindent Lines" + ], + [ + "reinde", + "Indentation: Reindent Lines" + ], + [ + "syntax xml", + "Set Syntax: XML" + ], + [ + "sftp syn", + "SFTP: Sync Local -> Remote…" + ], + [ + "prv", + "PackageResourceViewer: Open Resource" + ], + [ + "syntak", + "Set Syntax: CMake" + ], + [ + "pcip", + "Package Control: Install Package" + ], + [ + "rei", + "Indentation: Reindent Lines" + ] + ], + "width": 453.0 + }, + "console": + { + "height": 188.0, + "history": + [ + "import urllib.request,os,hashlib; h = '261dd1222b4693ce6d4f85f9c827ac06' + '6d5ab8ebdd020086947172a8a1356bb6'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)" + ] + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "expanded_folders": + [ + "/home/davide/ELAB-RFID-locks", + "/home/davide/ELAB-RFID-locks/cards", + "/home/davide/ELAB-RFID-locks/static", + "/home/davide/ELAB-RFID-locks/templates" + ], + "file_history": + [ + "/home/davide/ELAB-RFID-locks/templates/history.html", + "/home/davide/ELAB-RFID-locks/static/history_script.js", + "/home/davide/ELAB-RFID-locks/static/script.js", + "/home/davide/catkin_ws/src/ras_vornoi_builder/launch/vornoi_visualize.launch", + "/home/davide/catkin_ws/src/ras_vornoi_builder/src/vornoi.cpp", + "/home/davide/catkin_ws/src/ras_localization/launch/tracking.launch", + "/home/davide/catkin_ws/src/ras_maze/ras_maze_map/src/maze_map_node.cpp", + "/home/davide/catkin_ws/src/ras_localization/src/localization.cpp", + "/home/davide/catkin_ws/src/ras_vornoi_builder/CMakeLists.txt", + "/home/davide/catkin_ws/src/ras_odometry/src/ras_odometry_node.cpp", + "/home/davide/catkin_ws/src/ras_localization/CMakeLists.txt", + "/home/davide/catkin_ws/src/ras_localization/package.xml", + "/home/davide/catkin_ws/src/ras_color_detection/CMakeLists.txt", + "/home/davide/catkin_ws/src/ras_color_calibration/package.xml", + "/home/davide/catkin_ws/src/ras_color_calibration/CMakeLists.txt", + "/home/davide/catkin_ws/src/ras_color_calibration/src/color_calibration.cpp", + "/home/davide/catkin_ws/src/ras_robot8_launch/launch/milestone1.launch", + "/home/davide/catkin_ws/src/ras_color_detection/src/color_detection_node.cpp", + "/home/davide/catkin_ws/src/ras_color_detection/package.xml", + "/home/davide/catkin_ws/src/ras_robot8_launch/launch/milestone2.launch", + "/home/davide/catkin_ws/src/ras_target_recognition/src/target_recognition.cpp", + "/home/davide/catkin_ws/src/ras_target_recognition/CMakeLists.txt", + "/home/davide/catkin_ws/src/ras_uarm_controller/src/uarm_controller.cpp", + "/home/davide/catkin_ws/src/sftp-config.json", + "/home/davide/catkin_ws/src/ras_uarm_controller/CMakeLists.txt", + "/home/davide/.config/sublime-text-3/Packages/CMake/CMake.tmLanguage", + "/home/davide/.config/sublime-text-3/Packages/C++/C++.sublime-syntax", + "/home/davide/.config/sublime-text-3/Packages/C++/C++.sublime-settings", + "/home/davide/.config/sublime-text-3/Packages/C++/Comments (C++).tmPreferences", + "/tmp/fz3temp-1/uarm_controller.cpp", + "/tmp/fz3temp-1/color_detection_node.cpp", + "/home/davide/fridge_lock/static/style.css", + "/home/davide/fridge_lock/static/script.js", + "/home/davide/fridge_lock/server.py", + "/home/davide/fridge_lock/history.json", + "/home/davide/fridge_lock/cards/2924385363.json", + "/home/davide/fridge_lock/cards/0967437296.json", + "/home/davide/.config/sublime-text-3/Packages/User/Preferences.sublime-settings", + "/tmp/fz3temp-1/milestone1.launch", + "/tmp/fz3temp-1/motor_controller.cpp", + "/tmp/fz3temp-1/ras_odometry_node.cpp", + "/home/davide/fridge_lock/templates/status.html", + "/home/davide/fridge_lock/static/colors", + "/home/davide/fridge_lock/cards/1993135003.json", + "/home/davide/fridge_lock/cards/13245678.json", + "/home/davide/fridge_lock/cardlistener.py", + "/home/davide/fridge_lock/templates/some.html", + "/home/davide/catkin_ws/src/ras_odometry/package.xml", + "/home/davide/catkin_ws/src/ras_odometry/CMakeLists.txt", + "/home/davide/catkin_ws/src/ras_odometry/src/odometry.cpp", + "/home/davide/solar_music/main.c", + "/home/davide/solar_music/makefile", + "/home/davide/crap.json", + "/home/davide/script.py" + ], + "find": + { + "height": 32.0 + }, + "find_in_files": + { + "height": 0.0, + "where_history": + [ + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + "someEvent", + "event", + "e90", + "e0", + "y_init", + "x_init", + "rviz_lines", + "walls", + "resample_index", + "getexp", + "360", + "for", + "map_frame", + "string", + "double", + "motion_variance_x", + "localization", + "particle_quantity", + "x_init", + "linear", + "set", + "current_pos", + "my_tf_listener", + "toPos", + "moveTo", + "cv_ptr", + "Image", + "cv_ptr", + "tm_hour", + "odometry", + "talker", + "angular" + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "selected": 1, + "sheets": + [ + { + "buffer": 0, + "file": "server.py", + "semi_transient": false, + "settings": + { + "buffer_size": 2820, + "regions": + { + }, + "selection": + [ + [ + 973, + 973 + ] + ], + "settings": + { + "color_scheme": "Packages/User/Color Highlighter/themes/predawn.tmTheme", + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/Python/Python.sublime-syntax", + "translate_tabs_to_spaces": false + }, + "translation.x": 0.0, + "translation.y": 264.0, + "zoom_level": 1.0 + }, + "stack_index": 3, + "type": "text" + }, + { + "buffer": 1, + "file": "templates/status.html", + "semi_transient": false, + "settings": + { + "buffer_size": 1399, + "regions": + { + }, + "selection": + [ + [ + 557, + 557 + ] + ], + "settings": + { + "color_scheme": "Packages/User/Color Highlighter/themes/predawn.tmTheme", + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/HTML/HTML.sublime-syntax", + "translate_tabs_to_spaces": false + }, + "translation.x": 0.0, + "translation.y": 66.0, + "zoom_level": 1.0 + }, + "stack_index": 0, + "type": "text" + }, + { + "buffer": 2, + "file": "static/style.css", + "semi_transient": false, + "settings": + { + "buffer_size": 2273, + "regions": + { + }, + "selection": + [ + [ + 527, + 527 + ] + ], + "settings": + { + "color_scheme": "Packages/User/Color Highlighter/themes/predawn.tmTheme", + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/CSS/CSS.sublime-syntax", + "translate_tabs_to_spaces": false + }, + "translation.x": 0.0, + "translation.y": 2178.0, + "zoom_level": 1.0 + }, + "stack_index": 2, + "type": "text" + }, + { + "buffer": 3, + "file": "static/script.js", + "semi_transient": false, + "settings": + { + "buffer_size": 2195, + "regions": + { + }, + "selection": + [ + [ + 2125, + 2125 + ] + ], + "settings": + { + "color_scheme": "Packages/User/Color Highlighter/themes/predawn.tmTheme", + "incomplete_sync": null, + "remote_loading": false, + "synced": false, + "syntax": "Packages/JavaScript/JavaScript.sublime-syntax", + "translate_tabs_to_spaces": false + }, + "translation.x": 0.0, + "translation.y": 990.0, + "zoom_level": 1.0 + }, + "stack_index": 1, + "type": "text" + } + ] + } + ], + "incremental_find": + { + "height": 32.0 + }, + "input": + { + "height": 37.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "output.find_results": + { + "height": 0.0 + }, + "output.sftp": + { + "height": 0.0 + }, + "pinned_build_system": "", + "project": "ELAB-RFID-locks.sublime-project", + "replace": + { + "height": 60.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + [ + "local", + "ras_localization/src/localization.cpp" + ], + [ + "tracki", + "ras_localization/launch/tracking.launch" + ], + [ + "map", + "ras_maze/ras_maze_map/src/maze_map_node.cpp" + ], + [ + "vornoi", + "ras_vornoi_builder/launch/vornoi_visualize.launch" + ], + [ + "track", + "ras_localization/launch/tracking.launch" + ], + [ + "odome", + "ras_odometry/src/ras_odometry_node.cpp" + ], + [ + "pack", + "ras_localization/package.xml" + ], + [ + "cmak", + "ras_localization/CMakeLists.txt" + ], + [ + "launch", + "ras_robot8_launch/launch/milestone1.launch" + ], + [ + "odo", + "ras_odometry/src/ras_odometry_node.cpp" + ], + [ + "colo", + "ras_color_detection/src/color_detection_node.cpp" + ], + [ + "localpack", + "ras_localization/package.xml" + ], + [ + "colorpa", + "ras_color_detection/package.xml" + ], + [ + "locali", + "ras_localization/CMakeLists.txt" + ], + [ + "tar", + "ras_target_recognition/src/target_recognition.cpp" + ], + [ + "mile", + "ras_robot8_launch/launch/milestone2.launch" + ], + [ + "uarm", + "ras_uarm_controller/src/uarm_controller.cpp" + ], + [ + "miles", + "ras_robot8_launch/launch/milestone2.launch" + ], + [ + "ua", + "ras_uarm_controller/CMakeLists.txt" + ], + [ + "color", + "ras_color_detection/CMakeLists.txt" + ] + ], + "width": 0.0 + }, + "select_project": + { + "height": 500.0, + "last_filter": "", + "selected_items": + [ + [ + "", + "~/fridge_lock/fridge_lock.sublime-workspace" + ] + ], + "width": 380.0 + }, + "select_symbol": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "selected_group": 0, + "settings": + { + }, + "show_minimap": true, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": true, + "side_bar_width": 228.0, + "status_bar_visible": true, + "template_settings": + { + } +} diff --git a/server.py b/server.py index a3d167e..1075013 100644 --- a/server.py +++ b/server.py @@ -26,13 +26,13 @@ def index(): @app.route('/status') @requires_auth def somehtml(): - history = [] - with open('history.json', 'r') as json_data: - history = json.load(json_data) - history = history[-15:] - for event in history: - event['time'] = epochFormat(event['time']) - return render_template('status.html', events = history[::-1]) + #history = [] + #with open('history.json', 'r') as json_data: + # history = json.load(json_data) + #history = history[-15:] + #for event in history: + # event['time'] = epochFormat(event['time']) + return render_template('status.html') @app.route('/users') @requires_auth @@ -42,7 +42,12 @@ def users(): @app.route('/history') @requires_auth def history(): - return 'You have reached history' + return render_template('history.html') + +@app.route('/gethistory') +@requires_auth +def getHistory(): + return send_from_directory('.', 'history.json') @app.route('/getcardinfo/') @requires_auth diff --git a/server.pyc b/server.pyc index c74721d..8f47eb9 100644 Binary files a/server.pyc and b/server.pyc differ diff --git a/static/history_script.js b/static/history_script.js new file mode 100644 index 0000000..1ed6467 --- /dev/null +++ b/static/history_script.js @@ -0,0 +1,3 @@ +$('.search-bar').change(function() { + alert('text changed'); +}); \ No newline at end of file diff --git a/static/script.js b/static/script.js index 8770237..510debb 100644 --- a/static/script.js +++ b/static/script.js @@ -1,3 +1,5 @@ +var eventHistory = [] + function overlay_in() { $('.shadow').css({'display' : 'block'}); $('.overlay').css({'display' : 'block'}); @@ -29,8 +31,27 @@ function save() { } $(document).ready(function() { - $('.event').click(function() { - var cardID = $(this).attr('card-id') + jQuery.ajaxSetup({ cache: false }); + $.getJSON('http://127.0.0.1:5000/gethistory', function(data) { + eventHistory = data; + + for (var i = 0; i < data.length; i++) { + var dateString = (new Date(data[i].time*1000)).toLocaleString(); + var newElement = '
\ +
' + dateString + '
\ +
'; + if (data[i].name == "") + newElement += '' + data[i].cardID + ''; + else + newElement += data[i].name; + newElement += '
\ +
'; + var toInsert = $(newElement); + $('.search-bar').after(toInsert); + } + }); + $('.recent').on('click', '.event', function() { + var cardID = $(this).attr('card-id'); $('.card-id').text(cardID); $.getJSON('http://127.0.0.1:5000/getcardinfo/' + cardID, function(data) { $('#name').val(data.name); @@ -49,5 +70,10 @@ $(document).ready(function() { $('#tools').prop('checked', false); }); overlay_in(); - }) + }); + $('.search-bar').on('keyup', function() { + if (eventHistory[1].name.match($('.search-bar').val())) { + alert('match'); + } + }); }) \ No newline at end of file diff --git a/static/style.css b/static/style.css index 1e1ab95..d26b433 100644 --- a/static/style.css +++ b/static/style.css @@ -10,6 +10,7 @@ html { position: absolute; top: 0; width: 30%; + text-align: center; } .event { @@ -26,12 +27,14 @@ html { } .history-header { + display: inline-block; background-color: #013A3A; color: #D7E2E2; - margin: 0 -10pt 12pt 10pt; + margin: 0 0 8pt 0; padding: 10pt 0 10pt 0; text-align: center; font-size: 16pt; + width: 100%; } .time { diff --git a/templates/history.html b/templates/history.html new file mode 100644 index 0000000..047c604 --- /dev/null +++ b/templates/history.html @@ -0,0 +1,17 @@ + + + + + History + + + + + + + + + \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index f2d1a9f..7214f5b 100644 --- a/templates/status.html +++ b/templates/status.html @@ -13,19 +13,9 @@
-
History
- {% for event in events %} -
-
{{event.time}}
-
- {% if event.name == "" %} - {{event.cardID}} - {% else %} - {{event.name}} - {% endif %} -
-
- {% endfor %} +
History

+ +

Card access manager