
! script name: archive.d/listdirdata
! topic: list the information in a directory of projects.

!A
!A NAME:
!A
!A	Directory Data
!A
!A DESCRIPTION:
!A
!A	List the information in a directory of projects.
!A
!# see also - htdocs/help.d/archive.htm

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 Last_rev$[512]
DIM A$[512]

Stat=ChangeLabelStr("ScriptNameStatus","Function: list project information ")


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

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

Project_dir:!
Ques$= "SELECT DIRECTORY   Select this one "
D_label$= "PROJECTS"
Choice$= "selected directory"
Answer$= SelectDirectory(Archive_dir$,"*",Ques$,D_label$,Choice$,Prefix$,Current_dir$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "New", "CANCEL"
        GOTO Leave
CASE "Select"
        Project_dir$= Current_dir$
CASE ELSE
        Answer$= TRIM$(Answer$)
        Project_dir$= PathNameDirectory(Answer$)
END SELECT


IF NOT DoesFileExist(Project_dir$) THEN
	GOTO Project_dir
ELSE
	Last_rev$=FileNameString(Project_dir$,"dinfo.txt")
	DirInfo= ReadUserData(WsArchiveFileInfo,"Directory information",Last_rev$)
	IF ValidGeometry(DirInfo) THEN
		Stat= OutputUserData(DirInfo,"tempdata",WsNewFile)
		Stat=MessageFileBox("tempdata",Project_dir$)
		stat= DeleteEntity(DirInfo)
	END IF
END IF
LowerSelectBox
GOTO Project_dir


Leave:!
Stat= DeleteEntity(DirInfo)
LowerSelectBox
Stat=ChangeLabelStr("Status"," ")
Stat=SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
