Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGOWEB

BGOWEB.m

Go to the documentation of this file.
  1. BGOWEB ; IHS/BAO/TMD - Browser Util ;27-May-2008 11:02;PLS
  1. ;;1.1;BGO COMPONENTS;**1,3,5**;Mar 20, 2007
  1. ;---------------------------------------------
  1. ; Returns Web Reference Sites
  1. ; RET as a list of records in the format:
  1. ; Site [1] ^ File IEN [2] ^ URL [3]
  1. GETSITES(RET,DUMMY) ;EP
  1. N X,Y,CNT,IEN,URL,SITE
  1. S (X,CNT)=0
  1. F S X=$O(^BGOWEBS("AC",X)) Q:'X D
  1. .S IEN=0
  1. .F S IEN=$O(^BGOWEBS("AC",X,IEN)) Q:'IEN D
  1. ..S Y=^BGOWEBS(IEN,0)
  1. ..Q:$P(Y,U,4)
  1. ..S SITE=$P(Y,U),URL=$P(Y,U,2)
  1. ..D ADD(SITE_U_IEN_U_URL)
  1. Q
  1. ; Returns Web Links
  1. ; INP = User IEN ^ Category IEN
  1. ; RET returned as a list of web links
  1. GETREF(RET,INP) ;EP
  1. D GETLINKS(.RET,INP,"B")
  1. Q
  1. ; Returns Web Link categories
  1. ; USR = User IEN
  1. ; RET returned as a list of categories
  1. GETCATS(RET,USR) ;EP
  1. D GETLINKS(.RET,+USR,"C")
  1. Q
  1. ; Return list of entries from WEB LINKS file
  1. N X,Y,CNT,IEN,CAT,USR
  1. S USR=+INP
  1. S CAT=$P(INP,U,2)
  1. S X="",CNT=0
  1. F S X=$O(^BGOLINKS(XRF,X)) Q:X="" D
  1. .S IEN=$O(^BGOLINKS(XRF,X,0))
  1. .Q:'IEN
  1. .S Y=^BGOLINKS(IEN,0)
  1. .I $P(Y,U,3),$P(Y,U,3)'=USR Q
  1. .I CAT'="",$P(Y,U,2)'="",$P(Y,U,2)'=CAT Q
  1. .D ADD(X)
  1. Q
  1. ; Returns web ref links
  1. ; INP = Type [1] ^ Value [2] ^ Category [3] ^ URL [4]
  1. ; Returns list of records in the format
  1. ; Name [1]^ URL [2] ^ Link IEN [3] ^ Value [4] ^ Type [5]
  1. GET(RET,INP) ;EP
  1. N TYP,VAL,XREF,URL,NAM,CNT,X,Y
  1. S TYP=+INP
  1. S VAL=$P(INP,U,2)
  1. S CAT=$P(INP,U,3)
  1. S URL=$P(INP,U,4)
  1. S CNT=0
  1. I TYP D
  1. .S TYP=$$TYP2GBL(TYP),X=0
  1. .Q:TYP=""
  1. .F S X=$O(^BGOLINKS("AA",TYP,VAL,X)) Q:'X D G1
  1. E I CAT'="" D
  1. .S X=0
  1. .F S X=$O(^BGOLINKS("C",CAT,X)) Q:'X D G1
  1. E I URL'="" D
  1. .S X=0
  1. .F S X=$O(^BGOLINKS("AU",URL,X)) Q:'X D G1
  1. Q
  1. G1 N Y,NAM,CAT,URL
  1. S Y=$G(^BGOLINKS(X,0))
  1. I $P(Y,U,3),$P(Y,U,3)'=DUZ Q
  1. S NAM=$P(Y,U)
  1. Q:NAM=""
  1. S CAT=$P(Y,U,2)
  1. S URL=$P($G(^BGOLINKS(X,1)),U)
  1. Q:URL=""
  1. D ADD(NAM_U_URL_U_X_U_VAL_U_TYP)
  1. Q
  1. ; Delete a web link
  1. ; INP = IEN to delete [1] ^ Reference to delete [2] ^ Link Type [3]
  1. DEL(RET,INP) ;EP
  1. N REF,DA,DIK,Y,CAC,TYP
  1. S DA=$P(INP,U),REF=+$P(INP,U,2),TYP=+$P(INP,U,3)
  1. Q:'DA
  1. I '$$HASKEY^BEHOUSCX("BGOZ CAC"),$P(^BGOLINKS(DA,0),U,3),DUZ='$P(^(0),U,3) S RET=$$ERR^BGOUTL(1107) Q
  1. I 'REF S DIK="^BGOLINKS("
  1. E D
  1. .S DA(1)=DA
  1. .S REF=REF_";"_$$TYP2GBL(TYP)
  1. .S DA=$O(^BGOLINKS(DA,11,"B",REF,0))
  1. .S DIK="^BGOLINKS(DA(1),11,"
  1. S:DA RET=$$DELETE^BGOUTL(DIK,.DA)
  1. Q
  1. ; Set web reference
  1. ; INP = Type [1] ^ Value [2] ^ Name [3] ^ URL [4] ^ User IEN [5] ^ Value 2 [6] ^ Category [7]
  1. SET(RET,INP) ;EP
  1. N TYP,VAL,X,URL,NAM,I,LNKIEN,XREF,SUB,USR,VAL2,CAT,FDA,IEN,GBL
  1. S TYP=$$TYP2GBL(+INP),RET=""
  1. I TYP="" S RET=$$ERR^BGOUTL(1108) Q
  1. S VAL=+$P(INP,U,2)
  1. I 'VAL S RET=$$ERR^BGOUTL(1109) Q
  1. S NAM=$P(INP,U,3)
  1. S URL=$P(INP,U,4)
  1. S USR=$P(INP,U,5)
  1. S VAL2=+$P(INP,U,6)
  1. S CAT=$P(INP,U,7)
  1. S LNKIEN=$O(^BGOLINKS("AU",URL,0))
  1. S FDA=$NA(FDA(90362.21,$S(LNKIEN:LNKIEN,1:"+1")_","))
  1. S @FDA@(.01)=NAM
  1. S:CAT @FDA@(.02)="`"_CAT
  1. S:USR @FDA@(.03)="`"_USR
  1. S @FDA@(.11)=URL
  1. S RET=$$UPDATE^BGOUTL(.FDA,"E@",.IEN)
  1. Q:RET
  1. S:'LNKIEN LNKIEN=IEN(1)
  1. I 'VAL2 D S1(VAL) Q
  1. S GBL=$$CREF^DILF(U_TYP)
  1. S VAL=$P($G(@GBL@(VAL,0)),U)
  1. Q:VAL=""
  1. S VAL2=$P($G(@GBL@(VAL2,0)),U)
  1. Q:VAL2=""
  1. F D S VAL=$O(@GBL@("BA",VAL)) Q:VAL>VAL2!(VAL="")!RET
  1. .S X=$O(@GBL@("BA",VAL,0))
  1. .D:X S1(X)
  1. Q
  1. ; Add a pointer to web link
  1. S1(VAL) N FDA
  1. Q:$O(^BGOLINKS("AA",TYP,VAL,LNKIEN,0))
  1. S FDA=$NA(FDA(90362.2111,"+1,"_LNKIEN_","))
  1. S @FDA@(.01)=VAL_";"_TYP
  1. S RET=$$UPDATE^BGOUTL(.FDA)
  1. S:-RET=305 RET="" ; No data error is normal
  1. Q
  1. ; Convert type index to global reference
  1. TYP2GBL(X) ;
  1. Q $P("ICPT(^ICPT(^ICD9(^ICD9(^AUTTEDT(^AUTTEXAM(^AUTTIMM(^AUTTSK(",U,X+1)
  1. ; Add to output array
  1. ADD(X) S CNT=$G(CNT)+1,RET(CNT)=X
  1. Q
  1. ; Returns Default Search URL
  1. DEFSURL(RET,DUMMY) ;
  1. N UIEN
  1. S UIEN=$$GET^XPAR("ALL","BGO DEFAULT WEB SEARCH SITE")
  1. S RET=$S(UIEN:$P($G(^BGOWEBS(UIEN,0)),U,2),1:"")
  1. Q