예제 #1
0
 def export_success(result):
     if result["success"]:
         socketio.emit("doFlash", {"alert_type": "alert-success", "message": "Data successfully exported"},
                       namespace='/main', room=data_dict["main_id"])
     user_obj = load_user(data_dict["user_id"])
     collection_manager.update_selector_list(user_obj=user_obj)
     return
예제 #2
0
 def update_selector_list(self, select=None):
     if select is None:
         socketio.emit('update-selector-list',
                       {"html": self.request_update_selector_list(), "res_type": self.res_type},
                       namespace='/user_manage', room=current_user.get_id())
     else:
         socketio.emit('update-selector-list',
                       {"html": self.request_update_selector_list(), "select": select, "res_type": self.res_type},
                       namespace='/user_manage', room=current_user.get_id())
예제 #3
0
    def open_log_window(self, data):
        from tactic_app import socketio

        unique_id = str(uuid.uuid4())
        template_data = copy.copy(data)
        template_data["template_name"] = "log_window_template.html"
        self.temp_dict[unique_id] = template_data
        socketio.emit("window-open", {"the_id": unique_id}, namespace="/main", room=data["main_id"])
        return {"success": True}
예제 #4
0
def logout():
    socketio.emit('close-user-windows', {}, namespace='/user_manage', room=current_user.get_id())
    socketio.emit('close-user-windows', {}, namespace='/main', room=current_user.get_id())
    if current_user.username in user_tiles:
        del user_tiles[current_user.username]
    if current_user.username in loaded_user_modules:
        del loaded_user_modules[current_user.username]
    logout_user()
    return render_template('auth/login.html', show_message="yes",
                           message="You have been logged out.", alert_type="alert-info")
예제 #5
0
def logout(page_id):
    print "in logout"
    user_id = current_user.get_id()
    socketio.emit('close-user-windows', {"originator": page_id}, namespace='/user_manage', room=user_id)
    socketio.emit('close-user-windows', {"originator": page_id}, namespace='/main', room=user_id)
    global_tile_manager.remove_user(current_user.username)
    destroy_user_containers(user_id)  # They should be gone by this point. But make sure.
    logout_user()
    return render_template('auth/login.html', show_message="yes",
                           message="You have been logged out.", alert_type="alert-info")
예제 #6
0
    def open_error_window(self, data):
        from tactic_app import socketio

        unique_id = str(uuid.uuid4())
        template_data = copy.copy(data)
        template_data["template_name"] = "error_window_template.html"
        template_data["error_string"] = str(template_data["error_string"])
        self.temp_dict[unique_id] = template_data
        socketio.emit("window-open", {"the_id": unique_id}, namespace="/user_manage", room=data["user_manage_id"])
        socketio.emit("stop-spinner", {}, namespace="/user_manage", room=data["user_manage_id"])
        return {"success": True}
예제 #7
0
 def unload_all_tiles(self):
     try:
         loaded_user_modules[current_user.username] = set([])
         user_tiles[current_user.username] = {}
         socketio.emit('update-loaded-tile-list', {"html": self.render_loaded_tile_list()},
                       namespace='/user_manage', room=current_user.get_id())
         socketio.emit('update-menus', {}, namespace='/main', room=current_user.get_id())
         return jsonify({"message": "Tiles successfully unloaded", "alert_type": "alert-success"})
     except:
         error_string = "Error unloading tiles: " + str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1])
         return jsonify({"success": False, "message": error_string, "alert_type": "alert-warning"})
예제 #8
0
 def load_tile_module(self, tile_module_name):
     try:
         user_obj = current_user
         tile_module = user_obj.get_tile_module(tile_module_name)
         result = create_user_tiles(tile_module)
         if not result == "success":
             return jsonify({"success": False, "message": result, "alert_type": "alert-warning"})
         if user_obj.username not in loaded_user_modules:
             loaded_user_modules[current_user.username] = set([])
         loaded_user_modules[current_user.username].add(tile_module_name)
         socketio.emit('update-loaded-tile-list', {"html": self.render_loaded_tile_list()},
                       namespace='/user_manage', room=current_user.get_id())
         socketio.emit('update-menus', {}, namespace='/main', room=current_user.get_id())
         return jsonify({"success": True, "message": "Tile module successfully loaded", "alert_type": "alert-success"})
     except:
         error_string = "Error loading tile: " + str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1])
         return jsonify({"success": False, "message": error_string, "alert_type": "alert-warning"})
예제 #9
0
    def open_project_window(self, data):
        from tactic_app import socketio

        unique_id = str(uuid.uuid4())
        template_data = data["template_data"]
        template_data["template_name"] = "main.html"
        if data["doc_type"] == "table":
            template_data["is_table"] = True
        else:
            template_data["is_freeform"] = True
        doc_names = template_data["doc_names"]
        # why is this fix needed here when I did it upstream?
        fixed_doc_names = [str(doc_name) for doc_name in doc_names]
        fixed_doc_names.sort()
        template_data["doc_names"] = fixed_doc_names
        self.temp_dict[unique_id] = template_data
        socketio.emit("window-open", {"the_id": unique_id}, namespace="/user_manage", room=data["user_manage_id"])
        socketio.emit("stop-spinner", {}, namespace="/user_manage", room=data["user_manage_id"])
        return {"success": True}
예제 #10
0
 def show_main_status_message(self, data):
     socketio.emit("show-status-msg", data, namespace="/main", room=data["main_id"])
예제 #11
0
    def emit_tile_message(self, data):
        from tactic_app import socketio

        socketio.emit("tile-message", data, namespace="/main", room=data["main_id"])
        return {"success": True}
예제 #12
0
    def go_to_row_in_document(self, data):
        from tactic_app import socketio

        socketio.emit("change-doc", data, namespace="/main", room=data["main_id"])
예제 #13
0
def stop_spinner():
    socketio.emit('stop-spinner', {}, namespace='/user_manage', room=current_user.get_id())
예제 #14
0
 def stop_user_manage_spinner(self, data):
     socketio.emit("stop-spinner", {}, namespace="/user_manage", room=data["user_manage_id"])
예제 #15
0
 def show_um_status_message(self, msg, user_manage_id, timeout=3):
     if timeout is None:
         data = {"message": msg}
     else:
         data = {"message": msg, "timeout": timeout}
     socketio.emit("show-status-msg", data, namespace="/user_manage", room=user_manage_id)
예제 #16
0
 def clear_um_status_message(self, user_manage_id):
     socketio.emit("clear-status-msg", {}, namespace="/user_manage", room=user_manage_id)
예제 #17
0
 def go_to_row_in_document(self, doc_name, row_id):
     data = {}
     data["doc_name"] = doc_name
     data["row_id"] = row_id
     socketio.emit('change-doc', data, namespace='/main', room=self.main_id)
예제 #18
0
 def emit_tile_message(self, message, data=None):
     if data is None:
         data = {}
     data["message"] = message
     data["tile_id"] = self.tile_id
     socketio.emit("tile-message", data, namespace='/main', room=self.main_id)
예제 #19
0
 def clear_main_status_message(self, data):
     socketio.emit("clear-status-msg", {}, namespace="/main", room=data["main_id"])
예제 #20
0
def on_ready_to_finish(data):
    socketio.emit("finish-post-load", data, namespace='/main', room=data["room"])
예제 #21
0
 def show_um_status_message_task(self, data):
     socketio.emit("show-status-msg", data, namespace="/user_manage", room=data["user_manage_id"])
예제 #22
0
파일: main.py 프로젝트: technivore/tactic
 def emit_table_message(self, message, data=None):
     if data is None:
         data = {}
     data["message"] = message
     socketio.emit("table-message", data, namespace='/main', room=self._main_id)
예제 #23
0
 def clear_um_status_message_task(self, data):
     socketio.emit("clear-status-msg", {}, namespace="/user_manage", room=data["user_manage_id"])