From b170b7948f6e1bddc0b84ff93fada5163ec48bc7 Mon Sep 17 00:00:00 2001 From: Bert Burgemeister Date: Tue, 31 May 2016 11:41:07 +0200 Subject: [PATCH] Add /set-cursor URI --- doc/index.org | 2 +- fasttrack.lisp | 2 +- make.lisp | 2 +- package-fasttrack.lisp | 2 +- phoros.asd | 4 ++-- phoros.lisp | 27 ++++++++++++++++++++++++++- 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/doc/index.org b/doc/index.org index 7c19902..92432f9 100644 --- a/doc/index.org +++ b/doc/index.org @@ -212,7 +212,7 @@ $ ./phoros --server \ PHOROS -- Photogrammetric Road Survey - Copyright (C) 2010, 2011, 2012, 2015 [[mailto:Bert Burgemeister ][Bert Burgemeister]] + Copyright (C) 2010, 2011, 2012, 2015, 2016 [[mailto:Bert Burgemeister ][Bert Burgemeister]] This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/fasttrack.lisp b/fasttrack.lisp index 4491e19..c0a9141 100644 --- a/fasttrack.lisp +++ b/fasttrack.lisp @@ -1,5 +1,5 @@ ;;; PHOROS -- Photogrammetric Road Survey -;;; Copyright (C) 2012 Bert Burgemeister +;;; Copyright (C) 2012, 2016 Bert Burgemeister ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by diff --git a/make.lisp b/make.lisp index 2941548..9eae977 100644 --- a/make.lisp +++ b/make.lisp @@ -1,5 +1,5 @@ ;;; PHOROS -- Photogrammetric Road Survey -;;; Copyright (C) 2010, 2011 Bert Burgemeister +;;; Copyright (C) 2010, 2011, 2016 Bert Burgemeister ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by diff --git a/package-fasttrack.lisp b/package-fasttrack.lisp index b91e942..0eabded 100644 --- a/package-fasttrack.lisp +++ b/package-fasttrack.lisp @@ -1,5 +1,5 @@ ;;; PHOROS -- Photogrammetric Road Survey -;;; Copyright (C) 2010, 2011, 2012 Bert Burgemeister +;;; Copyright (C) 2010, 2011, 2012, 2016 Bert Burgemeister ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by diff --git a/phoros.asd b/phoros.asd index 54b770c..385aaca 100644 --- a/phoros.asd +++ b/phoros.asd @@ -31,10 +31,10 @@ it available over a web interface." ;; There should be a corresponding git tag which marks the point this ;; version number becomes official. - "13.10.2" + "13.11.0" :licence ;goes with --licence output - "Copyright (C) 2010, 2011, 2012, 2015 Bert Burgemeister + "Copyright (C) 2010, 2011, 2012, 2015, 2016 Bert Burgemeister This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/phoros.lisp b/phoros.lisp index e53ce3e..3a7f089 100644 --- a/phoros.lisp +++ b/phoros.lisp @@ -1,5 +1,5 @@ ;;; PHOROS -- Photogrammetric Road Survey -;;; Copyright (C) 2010, 2011, 2012 Bert Burgemeister +;;; Copyright (C) 2010, 2011, 2012, 2016 Bert Burgemeister ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -412,6 +412,31 @@ current session." (pushnew (hunchentoot:create-regex-dispatcher "/logout" 'logout-handler) hunchentoot:*dispatch-table*) +(hunchentoot:define-easy-handler set-cursor-handler (bbox longitude latitude) + (assert-authentication) + (with-connection *postgresql-credentials* + (let ((presentation-project-name + (hunchentoot:session-value 'presentation-project-name)) + (sys-user-role + (get-dao 'sys-user-role + (hunchentoot:session-value 'user-id) + (hunchentoot:session-value 'presentation-project-id)))) + (when sys-user-role + (when bbox + (setf (bounding-box sys-user-role) bbox)) + (when (and longitude latitude) + (let* ;; kludge: should be done by some library, not by DB query + ((point-form (format nil "POINT(~F ~F)" longitude latitude)) + (point-wkb (query (:select + (:st_geomfromtext point-form)) + :single))) + (setf (cursor sys-user-role) point-wkb))) + (update-dao sys-user-role)))) + "cursor set") + +(pushnew (hunchentoot:create-regex-dispatcher "/set-cursor" 'set-cursor-handler) + hunchentoot:*dispatch-table*) + (define-condition superseded () () (:documentation "Tell a thread to finish as soon as possible taking any shortcuts -- 2.11.4.GIT