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

LEXEDF1.m

Go to the documentation of this file.
  1. LEXEDF1 ;ISL/KER - Edit/Display a Definition (Part 1) ;04/21/2014
  1. ;;2.0;LEXICON UTILITY;**3,25,80**;Sep 23, 1996;Build 1
  1. ;
  1. ; Global Variables
  1. ; ^TMP("LEXDEF") SACC 2.3.2.5.1
  1. ;
  1. ; External References
  1. ; YN^DICN ICR 10009
  1. ; ^DIE ICR 10018
  1. ; ^XMD ICR 10070
  1. ;
  1. N DIC,DIE,DIR,DIROUT,DIRUT,DLAYGO,DR,DTOUT,DUOUT,DA,X,Y
  1. N LEX,LEXAID,LEXC,LEXDIC0,LEXE,LEXI,LEXL,LEXLC
  1. N LEXMC,LEXME,LEXMP,LEXS,LEXSAV,LEXST,LEXTY,LEXX
  1. K X I $D(DUZ)#2=0 G EXIT
  1. ASK ; Ask user to select an expression to edit the definition
  1. N LEXAP S DIC("A")="Enter a concept to edit definition: "
  1. S:'$D(DIC(0)) DIC(0)="QEAM" S LEXAP=1 D ^LEXA1 I X=""!(+Y'>0) G EXIT
  1. I +Y<3,+Y>0 D G EXIT
  1. . W !,"The definition for ",^LEX(757.01,+Y,0)," is not editable"
  1. S LEXE=$$EXP^LEXEDF2(+Y) G:'$D(LEXE) EXIT
  1. ;
  1. I LEXE="" D G:'$D(LEXE) ASK G:LEXE="" EXIT
  1. . W !!,"No selection made, try again using the same concept"
  1. AGAIN . ; Ask user to try again using the same expression
  1. . S %=2 D YN^DICN S DIC(0)=$S(%=1:"QEM",1:"QEAM")
  1. . S LEXE=$S(%=-1:"",%=2:"",1:%) K:LEXE=% LEXE W:%=1 ! Q:%'=0
  1. . I '% D G AGAIN
  1. . . W !!,"You were given various forms of an expression "
  1. . . W "(concept, synonyms and"
  1. . . W !,"lexical variants) to select from. "
  1. . . W "Do you wish to try again using"
  1. . . W !,"the same concept"
  1. D:+($G(LEXE))>1&($D(^LEX(757.01,+($G(LEXE)),0))) EDIT(LEXE) G EXIT ; PCH 3
  1. EDIT(LEXE) ; Edit the expression definition
  1. W !,$E(^LEX(757.01,LEXE,0),1,78),! K ^TMP("LEXDEF",$J)
  1. G:'$D(LEXE) EDITQ
  1. S LEXMP=0 I $D(^LEX(757.01,LEXE,3,0)) D
  1. . S ^TMP("LEXDEF",$J,4)="Old Definition:"
  1. . S ^TMP("LEXDEF",$J,5)=^LEX(757.01,LEXE,3,0),(LEXMP,LEXLC)=0
  1. . F S LEXLC=$O(^LEX(757.01,LEXE,3,LEXLC)) Q:+LEXLC=0 D
  1. . . S LEXMP=LEXLC+5
  1. . . S ^TMP("LEXDEF",$J,LEXMP)=^LEX(757.01,LEXE,3,LEXLC,0)
  1. N LEXDIC0 S DA=+LEXE,DIE="^LEX(757.01,",DR="6"
  1. S:DIC(0)'["L" DIC(0)=DIC(0)_"L" S LEXDIC0=DIC(0),DLAYGO=757
  1. L +^LEX(757.01,LEXE):1
  1. I '$T D G EDITQ
  1. . W !,"This record is being edited by "
  1. . W "another user, try again later"
  1. S LEXSAV=0 D SNAP^LEXEDF2(+LEXE),^DIE,SHOT^LEXEDF2(+LEXE)
  1. S LEX=$$CHANGE^LEXEDF2
  1. I +LEX>0 S LEXSAV=$$SAVE^LEXEDF2
  1. I 'LEXSAV,+LEX>0 D RESTORE^LEXEDF2(+LEXE)
  1. K DLAYGO,LEXDIC0 L -^LEX(757.01,LEXE) G:+LEX=0!(+LEXSAV=0) RESULTS
  1. I $D(^LEX(757.01,LEXE,3,0)) D
  1. . S ^TMP("LEXDEF",$J,1)="TXT: "_^LEX(757.01,LEXE,0)
  1. . S ^TMP("LEXDEF",$J,2)="IFN: "_LEXE,^TMP("LEXDEF",$J,3)=""
  1. S:LEXMP=0 LEXMP=2
  1. I $D(^LEX(757.01,LEXE,3,0)) D
  1. . S ^TMP("LEXDEF",$J,(LEXMP+1))=""
  1. . S ^TMP("LEXDEF",$J,LEXMP+2)="New Definition:"
  1. . S ^TMP("LEXDEF",$J,LEXMP+3)=^LEX(757.01,LEXE,3,0)
  1. . S LEXMP=LEXMP+4
  1. . S LEXLC=0 F S LEXLC=$O(^LEX(757.01,LEXE,3,LEXLC)) Q:+LEXLC=0 D
  1. . . S ^TMP("LEXDEF",$J,LEXMP)=^LEX(757.01,LEXE,3,LEXLC,0)
  1. . . S LEXMP=LEXMP+1
  1. D:+LEX>0&(+LEXSAV>0) SENDDEF
  1. RESULTS ; Display results of edit
  1. I +LEXSAV=0 D
  1. . I +LEX W !,"Changes to the definition were not saved" Q
  1. . W !,"No changes made"
  1. I +LEXSAV>0 W !,$P(LEX,U,2)
  1. EDITQ ; Quit edit
  1. K DIC,DIE,DIR,DLAYGO,DR,LEX,LEXAID,LEXC,LEXDIC0
  1. K LEXE,LEXI,LEXL,LEXLC,LEXMC,LEXME,LEXMP,LEXS
  1. K LEXSAV,LEXST,LEXTY,LEXX,^TMP("LEXDEF",$J) Q
  1. DISP(LEXX) ; Display a definition
  1. Q:+($G(LEXX))=0 I '$D(^LEX(757.01,LEXX,3,1,0)) Q
  1. N X S X=0 F S X=$O(^LEX(757.01,LEXX,3,X)) Q:+X=0 D
  1. . W:X=1 !!,"Definition: ",! W !,^LEX(757.01,LEXX,3,X,0)
  1. Q
  1. EXIT ; Clean up and exit
  1. K DIC,DIE,DIR,DLAYGO,DR,DA,X,Y,LEX,LEXAID,LEXC,LEXDIC0
  1. K LEXE,LEXI,LEXL,LEXLC,LEXMC,LEXME,LEXMP,LEXS
  1. K LEXSAV,LEXST,LEXTY,LEXX,^TMP("LEXDEF",$J) Q
  1. SENDDEF ; Send edited definition to ISC
  1. N DIFROM,LEXADR K XMZ Q:'$D(^TMP("LEXDEF",$J)) S LEXADR=$$ADR^LEXU Q:'$L(LEXADR)
  1. S XMSUB=$P(LEX,U,2)_" in Expression File (#757.01)"
  1. S XMY(("G.LEXICON@"_LEXADR))=""
  1. S XMTEXT="^TMP(""LEXDEF"",$J,",XMDUZ=.5 D ^XMD
  1. K ^TMP("LEXDEF",$J),XCNP,XMDUZ,XMY("G.LEXICON@ISC-SLC.DOMAIN.EXT"),XMZ
  1. K XMSUB,XMY,XMTEXT
  1. Q