
! script name: archive.d/archdirtable
! topic: Table representing the project tree.

!A
!A NAME:
!A
!A 	Project Table
!A
!A DESCRIPTION:
!A
!A 	Table showing the hierarchial structure of the archived projects.
!A
!B INSTRUCTIONS:
!B
!B 	The following options are available:
!B
!B 		File_type= 0     Full list.
!B 		File_type= 1     Directories with revision files.
!B 		File_type= 2     Files only.
!B 		File_type= 3     Project List with Directories.
!B
!B 		List_type= 0	 List with spaces
!B 		List_type= 1	 Full path list
!B 		List_type= 2	 List with tabs
!B
!# see also - htdocs/help.d/archive.htm

DIM Answer$[256],Destination$[256]
DIM Archive$[512]
DIM Filename$[512]
DIM Table_name$[512]
DIM Table_title$[512]

DeActivateUndo
Html_table= 0
IF ARGC > 1 THEN
        Answer$= ARGV(1)
        Html_table= VAL(Answer$)
END IF

Table_name$= "PROJECT TABLE"
Table_title$= "PROJECT TABLE"

Stat=ChangeLabelStr("ScriptNameStatus","Function: project table  ")

Filename$= "tempdata"
Tab$= CHR$(9)

File_type=3
List_type=2

Grid_color= 18
Entry_color= 12
Entry_text_height= GetDefault(WsTextHeight)
Entry_text_width= GetDefault(WsTextWidth)

Header_color= 17
Head_text_height= 1.2*Entry_text_height
Head_text_width= 1.2*Entry_text_width
Header_slant= TAN(20)

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

Stat= DirTreeListFile(Archive$,Filename$,List_type,File_type)

Table_pos:!
IF Html_table THEN
        Pc= PointXYZ(0,0,0)
ELSE
        Stat=SetInputFormat("n4","")
        Pc=XyzInput("TABLE LOCATION ",WsXyzInput)
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT ValidGeometry(Pc) THEN Table_pos
END IF

Table1= FindNamedEntity(Table_name$)
IF Table1 THEN Stat= DeleteEntity(Table1)

PlotOff
Table1= ImportTable(Filename$,Pc,WsUpperLeft,Tab$)

Set_table_props:!
Stat= TableTextOrigin(Table1,0,1,WsLeftCenter)
Stat= SetTableColors(Table1,0,0,Entry_color)
Stat= SetTableColors(Table1,0,1,Header_color)
Stat= TableTextSizes(Table1,0,1,Head_text_width,Head_text_height,Header_slant)
Stat= SetColor(Table1,Grid_color)
Stat= NameEntity(Table1,Table_name$)
PlotOn
Stat= DeleteEntity(Pc)

IF Html_table THEN
        LOAD "datatable.d/exporthtml: 0,"&Table_name$&",1,"&Table_title$
ELSE
        Stat= PlotEntity(Table1)
END IF


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