Commit 870a616c authored by Dave Griffiths's avatar Dave Griffiths
Browse files

email local data etc

parent 32b75b45
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<activity android:name="ObservationsActivity" android:configChanges="orientation"></activity> <activity android:name="ObservationsActivity" android:configChanges="orientation"></activity>
<activity android:name="GroupCompositionActivity" android:configChanges="orientation"></activity> <activity android:name="GroupCompositionActivity" android:configChanges="orientation"></activity>
<activity android:name="PupFocalStartActivity" android:configChanges="orientation"></activity> <activity android:name="PupFocalStartActivity" android:noHistory="true" android:configChanges="orientation"></activity>
<activity android:name="PupFocalActivity" android:configChanges="orientation"></activity> <activity android:name="PupFocalActivity" android:configChanges="orientation"></activity>
<activity android:name="GroupEventsActivity" android:configChanges="orientation"></activity> <activity android:name="GroupEventsActivity" android:configChanges="orientation"></activity>
......
...@@ -1373,37 +1373,40 @@ ...@@ -1373,37 +1373,40 @@
(set-current! 'observation obs-gp) (set-current! 'observation obs-gp)
(mclear-toggles (list "choose-obs-pf" "choose-obs-gc")))))))) (mclear-toggles (list "choose-obs-pf" "choose-obs-gc"))))))))
(build-grid-selector "choose-obs-pack-selector" "single" "Choose pack") (build-grid-selector "choose-obs-pack-selector" "single" "Choose pack")
(mbutton2
"choose-obs-start" "Start" (horiz
(lambda () (mbutton2 "choose-obs-back" "Back" (lambda () (list (finish-activity 1))))
;; set up the observation fragments (mbutton2
(let ((obs (get-current 'observation "none"))) "choose-obs-start" "Start"
(when (not (equal? obs "none")) (lambda ()
(set-current! ;; set up the observation fragments
'observation-fragments (let ((obs (get-current 'observation "none")))
(when (not (equal? obs "none"))
(set-current!
'observation-fragments
(cond
((equal? obs obs-gc) gc-fragments)
(else '())))))
;; go to observation
(if (and (current-exists? 'pack)
(current-exists? 'observation))
(cond (cond
((equal? obs obs-gc) gc-fragments) ((eq? (get-current 'observation "none") obs-pf)
(else '()))))) (list (start-activity "pup-focal-start" 2 "")))
((eq? (get-current 'observation "none") obs-gp)
;; go to observation (list (start-activity "group-events" 2 "")))
(if (and (current-exists? 'pack) (else
(current-exists? 'observation)) (entity-reset!)
(cond (entity-add-value! "pack" "varchar" (ktv-get (get-current 'pack ()) "unique_id"))
((eq? (get-current 'observation "none") obs-pf) (set-current! 'group-composition-id (entity-record-values db "stream" "group-composition"))
(list (start-activity "pup-focal-start" 2 ""))) (list
((eq? (get-current 'observation "none") obs-gp) (start-activity "group-composition" 2 ""))))
(list (start-activity "group-events" 2 ""))) (list
(else (alert-dialog
(entity-reset!) "choose-obs-finish"
(entity-add-value! "pack" "varchar" (ktv-get (get-current 'pack ()) "unique_id")) "Need to specify a pack and an observation"
(set-current! 'group-composition-id (entity-record-values db "stream" "group-composition")) (lambda () '())))))))
(list
(start-activity "group-composition" 2 ""))))
(list
(alert-dialog
"choose-obs-finish"
"Need to specify a pack and an observation"
(lambda () '()))))))
) )
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
...@@ -1463,21 +1466,23 @@ ...@@ -1463,21 +1466,23 @@
(lambda (v) (entity-add-value! "pack-depth" "int" v) '()))) (lambda (v) (entity-add-value! "pack-depth" "int" v) '())))
(medit-text "pf1-count" "How many mongooses can you see?" "numeric" (medit-text "pf1-count" "How many mongooses can you see?" "numeric"
(lambda (v) (entity-add-value! "pack-count" "int" v) '())) (lambda (v) (entity-add-value! "pack-count" "int" v) '()))
(mbutton2 "pf1-done" "Done" (horiz
(lambda () (mbutton2 "choose-obs-back" "Back" (lambda () (list (finish-activity 1))))
(cond (mbutton2 "pf1-done" "Done"
((current-exists? 'individual) (lambda ()
(set-current! 'pup-focal-id (entity-record-values db "stream" "pup-focal")) (cond
(set-current! 'timer-minutes pf-length) ((current-exists? 'individual)
(set-current! 'timer-seconds 0) (set-current! 'pup-focal-id (entity-record-values db "stream" "pup-focal"))
(list (set-current! 'timer-minutes pf-length)
(start-activity "pup-focal" 2 ""))) (set-current! 'timer-seconds 0)
(else (list
(list (start-activity "pup-focal" 2 "")))
(alert-dialog (else
"pup-focal-check" (list
"You need to specify an pup for the focal" (alert-dialog
(lambda () '()))))))) "pup-focal-check"
"You need to specify an pup for the focal"
(lambda () '()))))))))
))) )))
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
...@@ -1525,7 +1530,18 @@ ...@@ -1525,7 +1530,18 @@
(list (delayed "timer" 1000 timer-cb)))))) (list (delayed "timer" 1000 timer-cb))))))
(build-fragment "pf-timer" (make-id "pf-top") (layout 'fill-parent 515 1 'left 0)) (build-fragment "pf-timer" (make-id "pf-top") (layout 'fill-parent 515 1 'left 0))
(build-fragment "events" (make-id "event-holder") (layout 'fill-parent 515 1 'left 0)) (build-fragment "events" (make-id "event-holder") (layout 'fill-parent 515 1 'left 0))
(mbutton "pf-done" "Done" (lambda () (list (finish-activity 0)))))) (mbutton "pf-done" "Done"
(lambda ()
(list
(alert-dialog
"pup-focal-end-done"
"Finish pup focal are you sure?"
(lambda (v)
(cond
((eqv? v 1)
(list (finish-activity 1)))
(else
(list))))))))))
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
...@@ -1546,11 +1562,10 @@ ...@@ -1546,11 +1562,10 @@
(activity (activity
"group-events" "group-events"
(linear-layout (linear-layout
0 'vertical wrap gp-col 0 'vertical fill gp-col
(list (list
(build-fragment "events" (make-id "event-holder") (layout 580 450 1 'left 0)) (build-fragment "events" (make-id "event-holder") (layout 'fill-parent 515 1 'left 0))
(horiz (horiz
(mbutton "gpe-save" "Save" (lambda () (list)))
(mbutton "gpe-done" "Done" (lambda () (list (finish-activity 0))))))) (mbutton "gpe-done" "Done" (lambda () (list (finish-activity 0)))))))
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
...@@ -1862,7 +1877,16 @@ ...@@ -1862,7 +1877,16 @@
(map (map
(lambda (e) (lambda (e)
(string-append "/sdcard/mongoose/" e ".csv")) (string-append "/sdcard/mongoose/" e ".csv"))
entity-types))))))) entity-types))))))
(mbutton2 "sync-export" "Email local data"
(lambda ()
(debug! "Sending mail")
(list
(send-mail
""
"From Mongoose2000" "Please find attached your local mongoose data"
(list "/sdcard/mongoose/local-mongoose.db")))))
)
(spacer 10) (spacer 10)
(mtitle "" "Debug") (mtitle "" "Debug")
(scroll-view-vert (scroll-view-vert
...@@ -1871,8 +1895,9 @@ ...@@ -1871,8 +1895,9 @@
(vert (vert
(debug-text-view (make-id "sync-debug") "..." 15 (layout 'fill-parent 400 1 'left 0))))) (debug-text-view (make-id "sync-debug") "..." 15 (layout 'fill-parent 400 1 'left 0)))))
(spacer 10) (spacer 10)
(mbutton2 "sync-send" "Done" (lambda () (list (finish-activity 2)))) (horiz
(mbutton2 "sync-send" "Prof" (lambda () (prof-print) (list))) (mbutton2 "choose-obs-back" "Back" (lambda () (list (finish-activity 1))))
(mbutton2 "sync-send" "[Prof]" (lambda () (prof-print) (list))))
) )
(lambda (activity arg) (lambda (activity arg)
......
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