// -*- Java -*- // Copyright 1999 Greg Spencer (greg_spencer@acm.org) function byName (a, b) { if (a.name < b.name) return -1; if (a.name > b.name) return 1; return 0; } function byDate (a, b) { if (a.mod_date.getTime() < b.mod_date.getTime()) return -1; if (a.mod_date.getTime() > b.mod_date.getTime()) return 1; return byName(a, b); } function byType (a, b) { if (a.file_type < b.file_type) return -1; if (a.file_type > b.file_type) return 1; return byName(a, b); } function byIsDir (a, b) { if (a.isdir < b.isdir) return 1; if (a.isdir > b.isdir) return -1; return byName(a, b); } function byVersion (a, b) { if (a.version == b.version) return byName(a, b); if (a.version == -1) return -1; if (b.version == -1) return 1; if (a.version < b.version) return 1; if (a.version > b.version) return -1; return byName(a, b); } function byAction (a, b) { if (a.action == b.action) return byName(a, b); if (a.action == ' ') return -1; if (b.action == ' ') return 1; if (a.action < b.action) return 1; if (a.action > b.action) return -1; return byName(a, b); } function byChange (a, b) { if (a.change_num == b.change_num) return byName(a, b); if (a.change_num == -1) return -1; if (b.change_num == -1) return 1; if (a.change_num < b.change_num) return 1; if (a.change_num > b.change_num) return -1; return byName(a, b); } function printList() { var tmpHtml; tmpHtml = '<TABLE border=0 cellspacing=0 cellpadding=0 width=100%>'; var i=0; for (i = 0; i< theColumns.length; ++i) { tmpHtml += '<TD align='; if (i == 0) { tmpHtml += 'left colspan=2'; } else { tmpHtml += 'center'; } tmpHtml += '><B>'; if (sortOrder == i) { tmpHtml += '<U>' + theColumns[i] + '</U>'; } else { if (document.layers) { tmpHtml += '<A HREF="javascript:document.listDiv.resort(' + i + ');">' + theColumns[i] + '</A>'; } else { if (document.all) { tmpHtml += '<A HREF="javascript:resort(' + i + ');">' + theColumns[i] + '</A>'; } else { tmpHtml += theColumns[i]; } } } tmpHtml += '</B></TD>'; } tmpHtml += '<TR size=1 ><TD colspan=7><font size=1><HR size=1 noshade></font></TD></TR>'; for (i = 0; i < theArray.length; ++i) { rec = theArray[i]; bgcolor = '#ffffff'; if (i%2 == 0) { bgcolor = '#e0e0e0'; } tmpHtml += '<TR bgcolor=' + bgcolor + '><TD align=right>'; if (inBrowseMode) { // no magnifiers in browse mode. if (rec.file_type == 'directory') { tmpHtml += '<A HREF="http:' + cgiDir + '/' + p4dirbrowseName + '/' + rec.path + '"><IMG SRC="http:' + imageDir + '/p4folder.gif" border=0></A>'; } else { tmpHtml += ' '; } } else { switch (rec.file_type) { case 'directory': tmpHtml += '<A HREF="http:' + cgiDir + '/' + p4dirName + '/' + rec.path + '"><IMG SRC="http:' + imageDir + '/p4folder.gif" border=0></A>'; break; case 'binary': case 'xbinary': case 'symlink': case 'resource': tmpHtml += ' '; break; case 'text': case 'ltext': case 'xtext': case 'ktext': case 'kxtext': tmpHtml += '<A HREF="http:' + cgiDir + '/' + p4file2htmldataName + '/' + rec.path + '"><IMG SRC="http:' + imageDir + '/p4magnify.gif" border=0></A>'; break; } } tmpHtml += ' </TD><TD align=left>'; if (inBrowseMode) { processor = p4dirbrowseName; } else { if (rec.file_type == "binary" || rec.file_type == "xbinary") { processor = p4dirbrowseName; } else { processor = p4dirName; } } tmpHtml += '<A HREF="http:' + cgiDir + '/' + processor + '/' + rec.path + '">' + rec.name + '</A>'; tmpHtml += '</TD><TD align=right>' + rec.date_string + '</TD>'; if (rec.version >= 0) { tmpHtml += '<TD align=right><A HREF="http:' + cgiDir + '/' + p4browseName + '?@filelog+//depot/' + rec.path + '">' + rec.version + '</A></TD>'; } else { tmpHtml += '<TD align=right> </TD>'; } if (rec.action == 'edit') { tmpHtml += '<TD align=right><A HREF="http:' + cgiDir + '/' + p4browseName + '?@diff+//depot/' + rec.path + '+' + rec.version + '+' + rec.action + '">' + rec.action + '</A></TD>'; } else { if (rec.action == 'branch') { tmpHtml += '<TD align=right><A HREF="http:' + cgiDir + '/' + p4browseName + '?@filelog+' + rec.branch_path + '">' + rec.action + '</A></TD>'; } else { tmpHtml += '<TD align=right>' + rec.action + '</TD>'; } } if (rec.change_num >=0) { tmpHtml += '<TD align=right><A HREF="http:' + cgiDir + '/' + p4browseName + '?@describe+' + rec.change_num + '">' + rec.change_num + '</A></TD>'; } else { tmpHtml += '<TD align=right> </TD>'; } tmpHtml += '<TD align=right>' + rec.file_type + '</TD></TR>'; } tmpHtml += '<TR size=1 ><TD colspan=7><font size=1><HR size=1 noshade></font></TD></TR>'; tmpHtml += '</TABLE>'; if (document.all) { document.all.listDiv.innerHTML = tmpHtml; } if (document.layers) { document.write(tmpHtml); document.close(); } } // which field to sort by // 0 : by isdir, then name // 1 : by name // 2 : by date, then name // 3 : by type, then name function resort(bywhat) { with (document) { if (!theArray.sort) { return; } if (bywhat == 0) { theArray.sort(byIsDir); } if (bywhat == 1) { theArray.sort(byDate); } if (bywhat == 2) { theArray.sort(byVersion); } if (bywhat == 3) { theArray.sort(byAction); } if (bywhat == 4) { theArray.sort(byChange); } if (bywhat == 5) { theArray.sort(byType); } } sortOrder = bywhat; printList(); } function start() { resort(0); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 80 | Greg Spencer |
This adds the file-centric perforce browser to the guest depot. I rewrote it (again) this week to split out a simpler, non-javascript version that is easier to install (and doesn't need the CGI package). Both are included here. I still need to rewrite the INSTALL.txt file to reflect this, and update the README. I'd love to have a MakeMaker script to install this, but I haven't done that before, so I've got some trepidation. |