-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilelistdata.aspx
More file actions
119 lines (74 loc) · 2.72 KB
/
Copy pathfilelistdata.aspx
File metadata and controls
119 lines (74 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<%@ Page Language="C#"
EnableEventValidation="false"
EnableViewState="false" %>
<%@ Import Namespace="edu.neu.ccis.rasala" %>
<%@ Import Namespace="System.Collections.Generic" %>
<!--
File: filelistdata.aspx
Copyright 2013,
Richard Rasala,
College of Computer and Information Science
Northeastern University, Boston, MA 02115
rasala@ccs.neu.edu
-->
<!--
First constructs a list of TildePathInfo objects
subject to the following constraints based on
query parameters.
Parameter: root=basepath
basepath is a tilde directory path that is the
root of the directory tree for the files
If missing then defaults to ~/
Parameter: start=somedate
somedate represents a date that can be read via
DateTimeExtensions.FromYMDHMS
If missing then defaults to first moment of the
current year
Parameter: end=somedate
somedate represents a date that can be read via
DateTimeExtensions.FromYMDHMS
If missing then defaults to now
Parameter: sort=compare_mode
compare_mode is one of "alpha", "size", "date"
If missing or incorrect the defaults to "alpha"
Once the list of TildePathInfo objects is built
and sorted, the data is output using the method
ToHtml of TildePathInfo for each list object.
-->
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
string root = Context.Request.QueryString.Get("root") ?? "~/";
string start = Context.Request.QueryString.Get("start") ?? "";
string end = Context.Request.QueryString.Get("end") ?? "now";
string sort = Context.Request.QueryString.Get("sort") ?? "alpha";
List<TildePathInfo> tildefileinfolist =
FileListTools.TildeFilePathList
(this.Server, root, start, end, sort);
StringBuilder builder = new StringBuilder();
int count = tildefileinfolist.Count;
builder.Append("<p><b>File count: ");
builder.Append(count);
builder.Append("</b></p>\n");
foreach (TildePathInfo tildefileinfo in tildefileinfolist)
{
builder.Append(tildefileinfo.ToHtml(this));
}
results.InnerHtml = builder.ToString();
}
</script>
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<meta name="viewport" content="initial-scale=1, minimum-scale=1">
<title>Files</title>
<link rel="stylesheet" type="text/css" href="source/source.css" />
<link rel="stylesheet" type="text/css" href="source/print.css" media="print" />
</head>
<body>
<form id="form1" runat="server" enableviewstate="false">
<div id="results" class="results" runat="server"></div>
</form>
</body>
</html>