Commit d1ff640e authored by Dave Griffiths's avatar Dave Griffiths
Browse files

added gps properly

parent e7421339
......@@ -570,3 +570,30 @@
(list-ref d 3)
(list-ref d 4)
(list-ref d 5)))))
(define (do-gps display-id key-prepend)
(let ((loc (get-current 'location '(0 0))))
(entity-add-value! (string-append key-prepend "-lat") "real" (car loc))
(entity-add-value! (string-append key-prepend "-lon") "real" (cadr loc))
(get-id (string-append (symbol->string display-id) "-lat"))
(number->string (car loc)))
(get-id (string-append (symbol->string display-id) "-lon"))
(number->string (cadr loc))))))
(define (mupdate-gps display-id key-prepend)
'text-view (get-id (string-append (symbol->string display-id) "-lat"))
'text (number->string
(entity-get-value (string-append key-prepend "-lat")) "real" 0))
'text-view (get-id (string-append (symbol->string display-id) "-lon"))
'text (number->string
(entity-get-value (string-append key-prepend "-lon")) "real" 0))))
......@@ -101,7 +101,8 @@
(list 'school (list "School"))
(list 'present (list "Present"))
(list 'closest-access (list "Closest place of access"))
(list 'gps (list "GPS"))
(list 'house-gps (list "GPS"))
(list 'toilet-gps (list "GPS"))
(list 'school (list "School"))
(list 'hospital (list "Hospital/Health care centre"))
(list 'post-office (list "Post Office"))
......@@ -441,7 +442,7 @@
(lambda (v)
((eqv? v 1)
(entity-set-value! "deleted" "int" 1)
(entity-add-value! "deleted" "int" 1)
(list (finish-activity 1)))
......@@ -484,14 +485,19 @@
(ktv "name" "varchar" (mtext-lookup 'default-village-name))
(ktv "block" "varchar" "")
(ktv "district" "varchar" "test")
(ktv "car" "int" 0)
(ktv "photo" "file" "none"))))
(ktv "car" "int" 0))))
(lambda (activity arg)
(set-current! 'activity-title "Main screen")
(activity-layout activity))
(lambda (activity arg)
(list (update-list-widget db "sync" "village" "village" #f)))
(gps-start "gps" (lambda (loc)
(set-current! 'location loc)
(list (toast (string-append
(number->string (car loc)) ", "
(number->string (cadr loc)))))))
(update-list-widget db "sync" "village" "village" #f)))
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
......@@ -521,12 +527,11 @@
(mtext-small 'test-num))))))
(medit-text 'village-name "normal"
(lambda (v) (entity-set-value! "name" "varchar" v) '()))
(medit-text 'block "normal" (lambda () '())))
(medit-text 'village-name "normal" (lambda (v) (entity-add-value! "name" "varchar" v) '()))
(medit-text 'block "normal" (lambda (v) (entity-add-value! "block" "varchar" v) '())))
(medit-text 'district "normal" (lambda () '()))
(mtoggle-button-scale 'car (lambda () '())))
(medit-text 'district "normal" (lambda (v) (entity-add-value! "district" "varchar" v) '()))
(mtoggle-button-scale 'car (lambda (v) (entity-add-value! "car" "int" v) '())))
(mbutton 'household-list
(lambda ()
......@@ -591,22 +596,20 @@
(medit-text 'household-name "normal" (lambda (v) '()))
(medit-text 'num-pots "numeric" (lambda (v) '())))
(medit-text 'household-name "normal" (lambda (v) (entity-add-value! "name" "varchar" v) '()))
(medit-text 'num-pots "numeric" (lambda (v) (entity-add-value! "num-pots" "int" v) '())))
(mtext 'location)
(mbutton 'house-gps (lambda () (do-gps 'house "house")))
(mtext-small 'house-lat)
(mtext-small 'house-lon))
(mbutton 'GPS (lambda () '()))
(mtext-small 'test-num)
(mtext-small 'test-num))
(medit-text 'elevation "numeric" (lambda (v) '())))
(mtext 'toilet-location)
(mbutton 'GPS (lambda () '()))
(mtext-small 'test-num)
(mtext-small 'test-num))
(medit-text 'elevation "numeric" (lambda (v) '())))
(mbutton 'toilet-gps (lambda () (do-gps 'toilet "toilet")))
(mtext-small 'toilet-lat)
(mtext-small 'toilet-lon)))
db "sync" 'individuals "individual" "individual" (lambda () (get-current 'household #f))
......@@ -627,10 +630,13 @@
(lambda (activity arg)
(entity-init! db "sync" "household" (get-entity-by-unique db "sync" arg))
(set-current! 'household arg)
(update-list-widget db "sync" "individual" "individual" arg)
(mupdate 'edit-text 'household-name "name")
(mupdate 'edit-text 'num-pots "num-pots")))
(mupdate 'edit-text 'num-pots "num-pots"))
(mupdate-gps 'house "house")
(mupdate-gps 'toilet "toilet")))
(lambda (activity) '())
(lambda (activity) '())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment