demopdq ; Ed de Moel ; ; Macbeth demo using PDQ-Web q hdr(title) ; w "",!,"",! w "" w "",title,"",!,"" w !,"" w !,"

",title,"

" q ; ; FIRST n all,edit,hdr,f,fatal,i,l,mq,s,upd,x s mq="MSMWEB_QUERY",f=$g(%(mq,"Select")),s=$g(%(mq,"Search")) s hdr="",all="Display All Information",edit="Modify Information" s upd="Update Database",fatal="" ; d:$g(%(mq,"Button"))=upd . s i=$g(%(mq,"Store")) s:'i i=$o(^macbeth("Person",""),-1)+1 . k %(mq,"Store") . ; . s x=$g(%(mq,"P1")) i x="" s fatal="Name of person must be specified" q . s ^macbeth("Person",i)=x_"|"_$g(%(mq,"P2")) . f t="GIF","ICO","BMP" s x=$g(%(mq,t)) k ^macbeth(t,i) s:x'="" ^macbeth(t,i)=x . k ^macbeth("Address",i) . s l=$g(%(mq,"A1"))_"|"_$g(%(mq,"A2"))_"|"_$g(%(mq,"A3"))_"|"_$g(%(mq,"A4"))_"|"_$g(%(mq,"A5"))_"|"_$g(%(mq,"A6")) . s:$tr(l,"|")'="" ^macbeth("Address",i)=l . k ^macbeth("Phone",i) . k:i=$g(%(mq,"F8")) %(mq,"F8") . s l=$g(%(mq,"F1"))_"|"_$g(%(mq,"F2"))_"|"_$g(%(mq,"F3"))_"|"_$g(%(mq,"F4"))_"|"_$g(%(mq,"F5"))_"|"_$g(%(mq,"F6"))_"|"_$g(%(mq,"F7"))_"|"_$g(%(mq,"F8")) . s:$tr(l,"|")'="" ^macbeth("Phone",i)=l . k ^macbeth("EMail",i) . s l=$g(%(mq,"E1"))_"|"_$g(%(mq,"E2"))_"|"_$g(%(mq,"E3")) . s:$tr(l,"|")'="" ^macbeth("EMail",i)=l . q ; i $g(%(mq,"Store"))'="" s fatal="Cannot proceed, unsaved edited data in previous page." ; i fatal'="" d q . d hdr("Cannot store information") . w !,"

",fatal,"

" . q ; i f'="" d . s x=^macbeth("Person",f) . s hdr=$p(x,"|",1) s:$p(x,"|",2)'="" hdr=hdr_", "_$p(x,"|",2) . d hdr(hdr) . s x=$g(^macbeth("GIF",f)) . i x="" w !,"No picture available" . e w !,"" . w "


" . q:$g(%(mq,"Button"))'=all . ; . f t="GIF","ICO","BMP" d . . s x=$g(^macbeth(t,f)) q:x="" . . w !,"Picture of type "_t_" stored in "_x_"
" . . q . ; . s x=$g(^macbeth("Address",f)) . s l="",t=$p(x,"|",2) s:t'="" l=t ; Detail . s t=$p(x,"|",1) i t'="" s:l'="" l=l_", " s l=l_t ; Street . w:l'="" !,l,"
" . ; . s l="",t=$p(x,"|",3) s:t'="" l=t ; City . s t=$p(x,"|",4) i t'="" s:l'="" l=l_", " s l=l_t ; State . s t=$p(x,"|",5) i t'="" s:l'="" l=l_" " s l=l_t ; Zip . w:l'="" !,l,"
" . ; . w !,"" . s t=$p(x,"|",6) w:t'="" !,"" ; Title . ; . s x=$g(^macbeth("Phone",f)) . s t=$p(x,"|",1) w:t'="" !,"" . s t=$p(x,"|",2) w:t'="" !,"" . s t=$p(x,"|",3) w:t'="" !,"" . s t=$p(x,"|",4) w:t'="" !,"" . s t=$p(x,"|",5) w:t'="" !,"" . s t=$p(x,"|",6) w:t'="" !,"" . s l="",t=$p(x,"|",7) s:t'="" l="" . ; . s x=$g(^macbeth("EMail",f)) . s t=$p(x,"|",1) w:t'="" !,"" . s t=$p(x,"|",2) w:t'="" !,"" . s t=$p(x,"|",3) w:t'="" !,"" . w !,"
Title",t,"
Phone at work"_t_"
Fax"_t_"
Data line"_t_"
Pager"_t_"
Cell Phone"_t_"
Phone at home"_t_"
Emergency Phone"_t . s t=+$p(x,"|",8) d:t . . s x=$p($g(^macbeth("Address",t)),"|",6) . . s t=$p($g(^macbeth("Person",t)),"|",1) . . s:x'="" t=x_" "_t . . s:t'="" l=l_" ("_t_")" . . q . w:l'="" !,l_"
E-Mail at work"_t_"
E-Mail at home"_t_"
Home Page on WWW"_t_"
" . ; . w "


" . q ; d:hdr="" hdr("Macbeth Demonstration") ; w !,"

" w !,"" w !,"Search for " w "" w !,"Select from

" w !,"

" i $g(%(mq,"Button"))'=edit d . w:f'="" !,"" . w:f'="" !,"

" . q e d . i f="" d q . . w !,"No person selected.

" . . w !,"The value in the ""Search"" box must be characters" . . w !,"that are part of the name of the person to look for." . . w !,"This field is case-sensitive.

" . . q . w !,"" . w !,"" . s x=^macbeth("Person",f) . d line("Name","P1",$p(x,"|",1)) . d line("Comment","P2",$p(x,"|",2)) . f t="GIF","ICO","BMP" s x=$g(^macbeth(t,f)) d line(t_" file",t,x) . s x=$g(^macbeth("Address",f)) . d line("Street","A2",$p(x,"|",2)) . d line("Address-Detail","A1",$p(x,"|",1)) . d line("City","A3",$p(x,"|",3)) . d line("State","A4",$p(x,"|",4)) . d line("Zip-code","A5",$p(x,"|",5)) . d line("Title","A6",$p(x,"|",6)) . s x=$g(^macbeth("Phone",f)) . d line("Phone at work","F1",$p(x,"|",1)) . d line("Fax","F2",$p(x,"|",2)) . d line("Data line","F3",$p(x,"|",3)) . d line("Pager","F4",$p(x,"|",4)) . d line("Cell Phone","F5",$p(x,"|",5)) . d line("Phone at home","F6",$p(x,"|",6)) . d line("Emergency Phone","F7",$p(x,"|",7)) . s p=$p(x,"|",8) s:'p p=f . w !,"" . s x=$g(^macbeth("EMail",f)) . d line("E-Mail at work","E1",$p(x,"|",1)) . d line("E-Mail at home","E2",$p(x,"|",2)) . d line("Home Page on WWW","E3",$p(x,"|",3)) . w !,"
Next of Kin

" . w !,"" . q w !,"

",!,"


" q ; line(txt,name,value) ; w !,"",txt,"" q ;