
! script name: archive.d/deletearchfile
! topic: delete from the project archive

!A
!A NAME:
!A
!A 	Remove Project
!A
!A DESCRIPTION:
!A
!A 	Delete from the project archive
!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 A$[512]

Stat=ChangeLabelStr("ScriptNameStatus","Function: delete from the archive ")

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 PROJECT TO BE DELETED,  List "
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
 	Stat=SetInputFormat("a1",",Y,N,")
        Stat=GetValue("DELETE: "&Project$&" Yes or No ",Answer$)
        IF (ExitScript(Destination$)) THEN Leave
	IF Answer$= "Y" THEN
		IF LEN(Project_dir$) THEN
			Stat= RemoveDirTree(Project_dir$)
		END IF
	END IF
END IF
LowerSelectBox
GOTO Project_dir


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