
! script name: archive.d/viewarchpics
! topic: View archival pics files.

!A
!A NAME:
!A
!A 	View archive pics files.
!A
!A DESCRIPTION:
!A
!A 	This script allows archive pic files to be viewed.
!A
!B INSTRUCTIONS:
!B
!B
!# see also - htdocs/help.d/archive.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: view archive pics file ")

DIM Answer$[256],Destination$[256]
DIM Ques$[256]
DIM D_label$[256]
DIM Choice$[256]
DIM Archive$[512]
DIM Project$[512]
DIM Prefix$[256]
DIM Archive_dir$[512]
DIM Project_dir$[512]
DIM Current_dir$[512]
DIM Revision_dir$[512]
DIM Last_rev$[512]
DIM Filename$[512]
DIM Namelist1$[10000]
DIM Namelist2$[10000]
DIM A$[512]
DEG

DeActivateUndo
Stat= NamedVarStr("archive dir",WsSystemVars,"/usr/weber/archive/",Archive$)

IF NOT DoesFileExist(Archive$) THEN Leave
Archive_dir$= Archive$
Prefix$= "revision"


Start:!

Project_dir:!
Ques$= "SELECT PROJECT"
D_label$= "PROJECTS"
Choice$= "selected project"
Answer$= SelectDirectory(Archive_dir$,"*",Ques$,D_label$,Choice$,Prefix$,Current_dir$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "New", "CANCEL"
        GOTO Leave
END SELECT
Answer$= TRIM$(Answer$)
Project$= PathNameFile(Answer$)
Project_dir$= Answer$
IF NOT DoesFileExist(Project_dir$) THEN
        GOTO Project_dir
ELSE
        A$= CurrRevisionName(Project_dir$,Prefix$,"info.txt")
	Revision_dir$= PathNameDirectory(A$)
END IF
IF NOT LEN(Revision_dir$) THEN Project_dir

D_label$= "PICS FILES"
Choice$= "selected file"
Mask$="*"
Namelist1$=DirectoryNamesStr(Revision_dir$,Mask$,WsAscending,"",".gif")
Namelist2$=DirectoryNamesStr(Revision_dir$,Mask$,WsAscending,"",".jpg")

IF LEN(Namelist1$)+ LEN(Namelist2$) < 1 THEN Project_dir
Stat=GeneralListBox(D_label$,Choice$,Namelist1$&Namelist2$)

Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT TEXT FILE",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="CANCEL" THEN Leave
LowerSelectBox
Filename$=FileNameString(Revision_dir$,Answer$)

LowerSelectBox

Stat=DisplayMessage("LOADING PICS VIEWER")
Stat=StartProcess("/usr/weber/bin/xv "&Filename$&" &" )

Stat= SynergySleep(2)


Leave:!
LowerSelectBox

Stat=SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
         LOAD "typecontrol"
ELSE
         LOAD Destination$
END IF
END

