Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
f653d78c
Commit
f653d78c
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
First somewhat-decent looking HTML results.
parent
121a2135
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/ftp-html.js
+174
-57
174 additions, 57 deletions
exec/ftp-html.js
with
174 additions
and
57 deletions
exec/ftp-html.js
+
174
−
57
View file @
f653d78c
// JavaScript HTML Index for Synchronet FTP Server
// $id$
var
title
=
system
.
name
+
"
FTP Server:
"
+
curdir
;
write
(
"
<HTML>
\r\n
"
);
write
(
"
<HEAD>
\r\n
"
);
write
(
"
<STYLE>
\r\n
"
);
write
(
"
<!--
\r\n
"
);
// write("* {font-family: Arial,Helvetica,sans-serif}\r\n");
// write("a {color: green}\r\n");
write
(
"
-->
\r\n
"
);
write
(
"
</STYLE>
\r\n
"
);
// Title
write
(
"
<TITLE>
"
);
load
(
"
sbbsdefs.js
"
);
var
title
=
system
.
name
+
"
FTP Server
"
;
if
(
curdir
.
name
!=
undefined
)
title
+=
"
-
"
+
curdir
.
name
;
else
if
(
curlib
.
name
!=
undefined
)
title
+=
"
-
"
+
curlib
.
name
;
write
(
'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
\r\n
'
);
write
(
"
<html>
\r\n
"
);
write
(
"
<head>
\r\n
"
);
write
(
"
<title>
"
);
write
(
title
);
write
(
"
</
TITLE
>
\r\n
"
);
write
(
"
</
title
>
\r\n
"
);
write
(
"
<META NAME='GENERATOR' content='
"
+
system
.
version
+
"
'>
\r\n
"
);
write
(
"
</
HEAD
>
\r\n
"
);
write
(
"
<
BODY
bgcolor=gray text=white link=
white
vlink=
silver
alink=
yellow
>
\r\n
"
);
write
(
"
<
FONT FACE
=Arial,Helvetica,sans-serif>
\r\n
"
);
write
(
"
</
head
>
\r\n
"
);
write
(
"
<
body
bgcolor=gray text=white link=
yellow
vlink=
lime
alink=
white
>
\r\n
"
);
write
(
"
<
font face
=Arial,Helvetica,sans-serif>
\r\n
"
);
write
(
"
<H1><I><FONT COLOR=lime>
"
+
title
+
"
</FONT></I></H1>
\r\n
"
);
if
(
libname
!=
""
)
write
(
"
<H3>Library:
"
+
libdesc
+
"
</H3>
\r\n
"
);
if
(
dirname
!=
""
)
write
(
"
<H3>Directory:
"
+
dirdesc
+
"
</H3>
\r\n
"
);
write
(
"
<h4>
"
);
var
prevdir
;
if
(
curlib
.
name
!=
undefined
)
{
write
(
"
<font color=silver>Library: </font>
"
+
curlib
.
description
+
"
<BR>
\r\n
"
);
prevdir
=
"
/
"
;
}
if
(
curdir
.
name
!=
undefined
)
{
write
(
"
<font color=silver>Directory: </font>
"
+
curdir
.
description
);
if
(
curdir
.
misc
&
DIR_FREE
)
write
(
"
<font color=silver> - FREE Downloads</font>
"
);
write
(
"
<BR>
\r\n
"
);
prevdir
=
"
/
"
+
curlib
.
name
+
"
/
"
;
}
if
(
prevdir
!=
undefined
)
{
write
(
"
<BR>
\r\n
"
);
write
(
format
(
"
[<a href=%s%s>prev</a>]
"
,
prevdir
,
html_index_file
));
write
(
format
(
"
[<a href=/%s>root</a>]
"
,
html_index_file
));
}
write
(
"
</h4>
"
);
/* Table Attributes */
var
hdr_background
=
"
white
"
;
var
hdr_font
=
"
<font size=-2><font color=black>
"
;
var
dat_font
=
"
<font size=-1>
"
;
var
cell_spacing
=
""
;
//"cellspacing=2 cellpadding=2";
/* Directory Listing */
if
(
dir
.
length
)
{
write
(
"
<table border=0 nowrap
"
+
cell_spacing
+
"
width=50%>
\r\n
"
);
/* header */
write
(
"
<thead>
"
);
write
(
"
<tr bgcolor=
"
+
hdr_background
+
"
>
"
);
write
(
"
<th>
"
+
hdr_font
+
"
Directory
"
);
write
(
"
<th>
"
+
hdr_font
+
"
Description
"
);
write
(
"
</thead>
"
);
/* body */
write
(
"
\r\n
<tbody>
\r\n
"
);
for
(
i
in
dir
)
{
write
(
"
<TR>
\r\n
"
);
/* filename */
write
(
"
<TD>
"
+
dat_font
+
format
(
"
<A HREF=%s
"
,
dir
[
i
].
link
)
+
"
>
"
+
dir
[
i
].
name
+
"
</A>
"
);
write
(
"
<TD>
"
+
dat_font
+
dir
[
i
].
description
);
}
write
(
"
</TABLE>
\r\n
"
);
write
(
"
<BR>
\r\n
"
);
}
function
date
(
time
)
{
var
mon
=
[
"
Jan
"
,
"
Feb
"
,
"
Mar
"
,
"
Apr
"
,
"
May
"
,
"
Jun
"
,
"
Jul
"
,
"
Aug
"
,
"
Sep
"
,
"
Oct
"
,
"
Nov
"
,
"
Dec
"
];
var
d
=
new
Date
(
time
*
1000
);
return
(
format
(
"
<TT>%02d-%s-%d %02d:%02d
"
,
d
.
getUTCDate
()
,
mon
[
d
.
getUTCMonth
()]
,
d
.
getUTCFullYear
()
,
d
.
getUTCHours
()
,
d
.
getUTCMinutes
()));
}
function
bytes
(
nbytes
)
{
return
(
Math
.
round
(
nbytes
/
1024
)
+
"
k
"
);
}
/* File Listing */
if
(
file
.
length
)
{
var
total_bytes
=
0
;
write
(
"
<TABLE BORDER='1' WIDTH='100%'>
\r\n
"
);
write
(
""
);
write
(
"
<TH ALIGN=LEFT><font size=-1>File
"
);
write
(
"
<TH ALIGN=RIGHT><font size=-1>Size
"
);
write
(
"
<TH><font size=-1>Description
"
);
write
(
"
<TH><font size=-1>Date/Time
"
);
write
(
"
<TH ALIGN=LEFT><font size=-1>Uploader
"
);
write
(
"
<TH ALIGN=RIGHT><font size=-1>Count
"
);
write
(
"
\r\n
"
);
var
mon
=
[
"
Jan
"
,
"
Feb
"
,
"
Mar
"
,
"
Apr
"
,
"
May
"
,
"
Jun
"
,
"
Jul
"
,
"
Aug
"
,
"
Sep
"
,
"
Oct
"
,
"
Nov
"
,
"
Dec
"
];
var
total_downloads
=
0
;
var
most_recent
=
0
;
write
(
"
<table border=0 nowrap
"
+
cell_spacing
+
"
width=100%>
\r\n
"
);
/* header */
write
(
"
<thead>
"
);
write
(
"
<tr bgcolor=
"
+
hdr_background
+
"
>
"
);
write
(
"
<th>
"
+
hdr_font
+
"
File
"
);
write
(
"
<th>
"
+
hdr_font
+
"
Size
"
);
write
(
"
<th>
"
+
hdr_font
+
"
Description
"
);
write
(
"
<th>
"
+
hdr_font
+
"
Date/Time
"
);
if
(
curdir
.
name
!=
undefined
)
{
/* not valid for aliased files in root */
write
(
"
<th>
"
+
hdr_font
+
"
Uploader
"
);
write
(
"
<th>
"
+
hdr_font
+
"
Count
"
);
}
write
(
"
</thead>
"
);
/* body */
write
(
"
\r\n
<tbody>
\r\n
"
);
for
(
i
in
file
)
{
total_bytes
+=
file
[
i
].
size
;
var
d
=
new
Date
(
file
[
i
].
time
*
1000
);
write
(
"
<TR bgcolor=gray>
\r\n
"
);
write
(
"
<TD><A HREF=
"
+
file
[
i
].
link
+
"
>
"
+
file
[
i
].
name
+
"
</A>
"
);
write
(
"
<TD align=right> <font color=black>
"
+
file
[
i
].
size
);
write
(
"
<TD>
"
+
file
[
i
].
description
);
write
(
"
<TD> <font color=black> <TT>
"
+
format
(
"
%02d-%s-%d %02d:%02d
"
,
d
.
getDate
()
,
mon
[
d
.
getMonth
()]
,
d
.
getFullYear
()
,
d
.
getHours
()
,
d
.
getMinutes
()
)
+
"
</tt>
"
);
var
uploader
=
file
[
i
].
uploader
;
if
(
uploader
==
"
-> ADDFILES <-
"
)
uploader
=
"
Sysop
"
;
write
(
"
<TD>
"
+
uploader
);
write
(
"
<TD align=right> <font color=black>
"
+
file
[
i
].
times_downloaded
);
total_downloads
+=
file
[
i
].
times_downloaded
;
if
(
file
[
i
].
time
>
most_recent
)
most_recent
=
file
[
i
].
time
;
write
(
"
<TR>
\r\n
"
);
/* filename */
write
(
"
<TD valign=top>
"
+
dat_font
+
"
<A HREF=
"
+
file
[
i
].
name
+
"
>
"
+
file
[
i
].
name
+
"
</A>
"
);
/* size */
write
(
"
<TD valign=top align=right>
"
+
dat_font
+
"
<font color=black>
"
+
bytes
(
file
[
i
].
size
));
/* description */
write
(
"
<TD valign=top>
"
+
dat_font
);
if
(
0
&&
file
[
i
].
misc
&
FM_EXTDESC
)
write
(
"
<PRE>
"
+
file
[
i
].
extended_description
);
else
write
(
"
<TT>
"
+
file
[
i
].
description
);
/* date/time */
write
(
"
<TD valign=top align=center nowrap>
"
+
dat_font
+
"
<font color=black>
"
+
date
(
file
[
i
].
time
));
if
(
curdir
.
name
!=
undefined
)
{
/* not valid for aliased files in root */
/* uploader */
var
uploader
=
file
[
i
].
uploader
;
if
(
file
[
i
].
misc
&
FM_ANON
)
uploader
=
"
Anonymous
"
;
else
if
(
uploader
==
"
-> ADDFILES <-
"
)
uploader
=
"
Sysop
"
;
write
(
"
<TD valign=top nowrap>
"
+
dat_font
+
uploader
);
/* download count */
write
(
"
<TD valign=top align=right>
"
+
dat_font
+
"
<font color=black>
"
+
file
[
i
].
times_downloaded
);
}
write
(
"
\r\n
"
);
}
/* Footer (with totals) */
write
(
"
<tfoot>
\r\n
"
);
write
(
format
(
"
<TR bgcolor=%s><TH>%s%lu files
"
+
"
<TH align=right>%s%s<TH>%s-<TH>%s<font color=black>%s
"
,
hdr_background
,
hdr_font
,
file
.
length
,
hdr_font
,
bytes
(
total_bytes
)
,
hdr_font
,
dat_font
,
date
(
most_recent
)
));
if
(
curdir
.
name
!=
undefined
)
/* not valid for aliased files in root */
write
(
format
(
"
<TH>%s-<TH align=right>%s%lu
"
,
hdr_font
,
hdr_font
,
total_downloads
));
write
(
"
</TABLE>
\r\n
"
);
write
(
format
(
"
%lu bytes in %lu files
"
,
total_bytes
,
file
.
length
));
write
(
"
<BR>
\r\n
"
);
}
if
(
!
file
.
length
&&
!
dir
.
length
)
write
(
"
No Files.<br>
"
);
if
(
dir
.
length
)
write
(
dir
.
length
+
"
sub-directories:<br>
\r\n
"
);
for
(
i
in
dir
)
{
write
(
"
<A HREF=
"
+
dir
[
i
].
link
+
"
>
"
+
dir
[
i
].
name
+
"
</A>
"
);
write
(
"
"
+
dir
[
i
].
description
+
"
<BR>
\r\n
"
);
}
/* Footer */
write
(
"
<BR><font size='-2'>Dynamically generated by
"
);
write
(
"
<A HREF=http://www.synchro.net>
"
+
system
.
version
+
"
</A>
"
);
write
(
"
on
"
+
Date
()
+
"
</font>
\r\n
"
);
write
(
"
<BR>
"
+
Date
()
+
"
</font>
\r\n
"
);
write
(
"
</BODY>
\r\n
"
);
write
(
"
</HTML>
\r\n
"
);
\ No newline at end of file
write
(
"
</HTML>
\r\n
"
);
/* End of ftp-html.js */
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment