-
Notifications
You must be signed in to change notification settings - Fork 7
/
svnBrowse.cfm
178 lines (157 loc) · 6.94 KB
/
svnBrowse.cfm
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<cfsetting enablecfoutputonly="true">
<cfprocessingdirective pageencoding="utf-8">
<cfif not StructKeyExists(url,'p')>
<cfoutput><h2>No Project Selected!</h2></cfoutput><cfabort>
</cfif>
<cfif session.user.admin>
<cfset project = application.project.get(projectID=url.p)>
<cfelse>
<cfset project = application.project.get(session.user.userid,url.p)>
</cfif>
<cfif not session.user.admin and not project.svn eq 1>
<cfoutput><h2>You do not have permission to access the repository!!!</h2></cfoutput>
<cfabort>
</cfif>
<cfparam name="url.act" default="browse">
<cfparam name="numRevisions" default="20">
<cfparam name="url.wd" default="">
<cfset numDirs = 0>
<cfset numFiles = 0>
<cfset totalFileSize = 0>
<cfset project = application.project.get(session.user.userid,url.p)>
<!--- Loads header/footer --->
<cfmodule template="#application.settings.mapping#/tags/layout.cfm" templatename="main" title="#application.settings.app_title# » #project.name#" project="#project.name#" projectid="#url.p#" svnurl="#project.svnurl#">
<cfoutput>
<div id="container">
<cfif project.recordCount>
<!--- left column --->
<div class="left full">
<div class="main">
<div class="header">
<span class="rightmenu">
<span class="b g">Browse Repository</span> |
<a href="svnLog.cfm?p=#url.p#">Last #numrevisions# Revisions</a>
</span>
<h2 class="svn">Subversion Source Browsing</h2>
</div>
<div class="content">
<div class="wrapper">
<!--- browse repository --->
<cftry>
<cfset svn = createObject("component", "cfcs.SVNBrowser").init(project.svnurl,project.svnuser,project.svnpass)>
<cfset list = svn.list('/' & url.wd)>
<cfset buildPath = "/">
<cfset listCount = listLen(url.wd, "/")>
<cfset loopCount = 0>
<table class="svn full">
<caption>#project.name#: <a href="#cgi.script_name#?p=#url.p#" class="nounder">root</a>
<cfloop list="#url.wd#" delimiters="/" index="i">
<cfset loopCount = loopCount + 1>
<cfset prevBuildPath = buildPath>
<cfif listCount NEQ loopCount>
<cfset buildPath = buildPath & i & "/">
<cfelse>
<cfset buildPath = buildPath & i>
</cfif>
/ <a href="#cgi.script_name#?p=#url.p#&wd=#buildPath#" class="nounder">#replace(replace(buildPath,prevBuildPath,''),'/','','all')#</a>
</cfloop>
</caption>
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Date Modified</th>
<th class="tac">Revision</th>
<th>Author</th>
</tr>
</thead>
<tbody>
<cfset thisrow = 0>
<cfif compare(url.wd,'')>
<cfset lastdirmarker = request.udf.RFind('/',url.wd)>
<cfif lastdirmarker lte 1><cfset pd = ""><cfelse><cfset pd = left(url.wd,lastdirmarker-1)></cfif>
<tr class="odd">
<td>
<img src="images/folder.gif" height="16" width="16" border="0" alt="Directory" />
<a href="#cgi.script_name#?p=#url.p#&act=browse&wd=#URLEncodedFormat(pd)#" class="nounder">..</a></td>
<td> </td><td> </td><td> </td><td> </td>
</tr>
<cfset thisrow = thisrow + 1>
</cfif>
<cfloop query="list">
<cfif not compareNoCase(kind,'Dir')>
<tr class="<cfif thisRow mod 2 eq 0>odd<cfelse>even</cfif>">
<td>
<cfif not compare(url.wd,'')>
<a href="#cgi.script_name#?p=#url.p#&act=browse&wd=#URLEncodedFormat(name)#" class="nounder">
<cfelse>
<a href="#cgi.script_name#?p=#url.p#&act=browse&wd=#URLEncodedFormat(url.wd & '/' & name)#" class="nounder">
</cfif>
<img src="images/folder.gif" height="16" width="16" border="0" alt="Directory" />
#name#</a></td>
<td>-----</td>
<!---<cfset dt = request.udf.DateConvertISO8601(list.date,-getTimeZoneInfo().utcHourOffset)>--->
<td>#LSDateFormat(date,"mm-dd-yyyy")# @ <cfif application.settings.clockHours eq 12>#LSTimeFormat(date,"hh:mm:ss tt")#<cfelse>#LSTimeFormat(date,"HH:mm:ss")#</cfif></td>
<td class="tac">#NumberFormat(revision)#</td>
<td>#author#</td>
</tr>
<cfset thisrow = thisrow + 1>
<cfset numDirs = numDirs + 1>
</cfif>
</cfloop>
<cfloop query="list">
<cfif not compareNoCase(kind,'File')>
<tr class="<cfif thisRow mod 2 eq 0>odd<cfelse>even</cfif>">
<td>
<a href="svnResource.cfm?p=#url.p#&wd=#URLEncodedFormat(url.wd)#&f=#URLEncodedFormat(name)#" class="nounder">
<cfif listFindNoCase('.cfm,.cfc',right(name,4))>
<img src="images/file_cf.gif" height="16" width="16" border="0" alt="ColdFusion File" />
<cfelseif listFindNoCase('.htm,html',right(name,4))>
<img src="images/file_htm.gif" height="16" width="16" border="0" alt="HTML File" />
<cfelseif not compareNoCase(right(name,3),'.js')>
<img src="images/file.gif" height="16" width="16" border="0" alt="Javascript File" />
<cfelseif not compareNoCase(right(name,4),'.css')>
<img src="images/file.gif" height="16" width="16" border="0" alt="CSS File" />
<cfelseif listFindNoCase('png,jpg,gif,exe,pdf,doc,rtf,xls,ppt',right(name,3))>
<img src="images/file.gif" height="16" width="16" border="0" alt="File" />
<cfelse>
<img src="images/file.gif" height="16" width="16" border="0" alt="File" />
</cfif>
#name#</a></td>
<td>#NumberFormat(size)# bytes</td>
<!---<cfset dt = request.udf.DateConvertISO8601(date,-getTimeZoneInfo().utcHourOffset)>--->
<td>#LSDateFormat(date,"mm-dd-yyyy")# @ <cfif application.settings.clockHours eq 12>#LSTimeFormat(date,"hh:mm:ss tt")#<cfelse>#LSTimeFormat(date,"HH:mm:ss")#</cfif></td>
<td class="tac">#NumberFormat(revision)#</td>
<td>#author#</td>
</tr>
<cfset thisrow = thisrow + 1>
<cfset numFiles = numFiles + 1>
<cfset totalFileSize = totalFileSize + size>
</cfif>
</cfloop>
</tbody>
<tfoot><tr><td colspan="5">#NumberFormat(totalFileSize)# bytes in <cfif numFiles gt 0>#numFiles# files</cfif><cfif numFiles gt 0 and numDirs gt 0> and </cfif><cfif numDirs gt 0> #numDirs# directories</cfif>.</tr></tfoot>
</table>
<cfcatch>
<div class="alert">There was a problem accessing the Subversion repository at #project.svnurl#</div>
<div class="fs80 g" style="margin-left:20px;">If your repository requires authentication, please ensure that your username and password are correct.</div>
</cfcatch>
</cftry>
</div>
</div>
</div>
<div class="bottom"> </div>
<div class="footer">
<cfinclude template="footer.cfm">
</div>
</div>
<!--- right column --->
<div class="right">
</div>
<cfelse>
<div class="alert">Project Not Found.</div>
</cfif>
</div>
</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly="false">