Commit 7783bb0a authored by Dave Griffiths's avatar Dave Griffiths
Browse files

social fixes and cycle social type

parent 55422843
......@@ -585,8 +585,12 @@
(symbol->string (list-ref l i)))
(define (mupdate-spinner id-symbol key choices)
(let* ((val (entity-get-value key))
(index (index-find (string->symbol val) choices)))
(let* ((val (entity-get-value key)))
(if (not val)
(update-widget 'spinner
(get-id (string-append (symbol->string id-symbol) "-spinner"))
'selection 0)
(let ((index (index-find (string->symbol val) choices)))
(if index
(update-widget 'spinner
(get-id (string-append (symbol->string id-symbol) "-spinner"))
......@@ -595,19 +599,22 @@
(msg "spinner item in db " val " not found in list of items")
(update-widget 'spinner
(get-id (string-append (symbol->string id-symbol) "-spinner"))
'selection 0)))))
'selection 0)))))))
(define (mupdate-spinner-other id-symbol key choices)
(msg "update spinner other...")
(let* ((val (entity-get-value key))
(index (index-find (string->symbol val) choices)))
(let* ((val (dbg (entity-get-value key))))
(if (not val)
(update-widget 'spinner
(get-id (string-append (symbol->string id-symbol) "-spinner"))
'selection 0)
(let ((index (index-find (string->symbol val) choices)))
(if index
(update-widget 'spinner
(get-id (string-append (symbol->string id-symbol) "-spinner"))
'selection index)
(update-widget 'edit-text
(get-id (string-append (symbol->string id-symbol) "-edit-text"))
'selection index))))
'selection index))))))
;; (y m d h m s)
......@@ -417,7 +417,11 @@
(list (start-activity "individual-chooser" request-code ""))))))
(define (build-small-person-selector id key filter request-code)
0 'vertical
(layout 300 'wrap-content 1 'centre 10)
(list 0 0 0 0)
(mtitle id)
(image-view (make-id (string-append (symbol->string id) "-image"))
"face" (layout 120 160 -1 'centre 0))
......@@ -425,10 +429,10 @@
(make-id (string-append "change-" (symbol->string id)))
(mtext-lookup 'change-id)
40 (layout 'fill-parent 'wrap-content -1 'centre 5)
40 (layout 'wrap-content 'wrap-content -1 'centre 5)
(lambda ()
(filter-set! filter)
(list (start-activity "individual-chooser" request-code ""))))))
(list (start-activity "individual-chooser" request-code "")))))))
;; from activity on result with request id: choose-code
......@@ -456,10 +460,16 @@
(update-widget 'image-view id 'external-image
(string-append dirname "files/" (cadr image-name))))))))
(define (build-social-connection id key type request-code)
(define (build-social-connection id key type request-code shade)
(let ((id-text (string-append (symbol->string id))))
0 'horizontal
(layout 'wrap-content 'wrap-content 1 'centre 20)
(if shade colour-one colour-two)
(build-small-person-selector id key (list) request-code)
(string->symbol (string-append id-text "-relationship"))
......@@ -474,7 +484,7 @@
(lambda (v)
(entity-set-value! (string-append key "-residence") "varchar"
(spinner-choice social-residence-list v)) '()))
(spinner-choice social-residence-list v)) '())))
(text-view 0 (mtext-lookup 'social-strength)
30 (layout 'wrap-content 'wrap-content 1 'centre 10))
......@@ -484,7 +494,7 @@
(layout 'wrap-content 'wrap-content 1 'centre 0)
(lambda (v)
(entity-set-value! (string-append key "-strength") "varchar"
(spinner-choice social-strength-list v)) '()))))))
(spinner-choice social-strength-list v)) '()))))))))
(define (social-connection-return request-code key choose-code)
(when (eqv? request-code choose-code)
......@@ -724,13 +734,20 @@
db "sync" 'individuals "individual" "individual"
(lambda () (get-current 'household #f))
(lambda ()
(let ((photo-id (get/inc-setting "photo-id")))
(list (ktv "photo-id" "varchar"
(ktv "photo-id" "varchar"
(get-setting-value "user-id")
(number->string (get/inc-setting "photo-id"))))))))
(number->string photo-id)))
(ktv "social-type" "varchar"
(list-ref social-types-list
(modulo photo-id (length social-types-list)))))
......@@ -1140,8 +1157,6 @@
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity requestcode resultcode)
(msg "hello!!!")
(msg requestcode)
(person-selector-return requestcode "id-mother" mother-request-code)
(person-selector-return requestcode "id-father" father-request-code)
......@@ -1149,18 +1164,21 @@
(mspinner 'social-type social-types-list (lambda (v) (entity-set-value! "social-type" "varchar"
(mspinner 'social-type social-types-list
(lambda (v) (entity-set-value!
"social-type" "varchar"
(spinner-choice social-types-list v)) '()))
(build-social-connection 'social-one "social-one" "friend" social-request-code-one)
(build-social-connection 'social-two "social-two" "friend" social-request-code-two)
(build-social-connection 'social-three "social-three" "friend" social-request-code-three)
(build-social-connection 'social-four "social-four" "friend" social-request-code-four)
(build-social-connection 'social-five "social-five" "friend" social-request-code-five)
(build-social-connection 'social-one "social-one" "friend" social-request-code-one #t)
(build-social-connection 'social-two "social-two" "friend" social-request-code-two #f)
(build-social-connection 'social-three "social-three" "friend" social-request-code-three #t)
(build-social-connection 'social-four "social-four" "friend" social-request-code-four #f)
(build-social-connection 'social-five "social-five" "friend" social-request-code-five #t)
(lambda (activity arg)
(set-current! 'activity-title "Individual social network")
(activity-layout activity))
(lambda (activity arg)
(msg "wooooop")
(update-top-bar (entity-get-value "name") (entity-get-value "photo-id"))
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