Fix 49934: gopher support, minor restructuring of directory viewer. necko: r=darin,dougt sr=rpotts other: r=waterson,mstoltz,jag sr=alecf

Fix 70404: assertionsf or datetime and finger. r=dougt, sr=rpotts

Both patches by Bradley Baetz (bbaetz@cs.mcgill.ca)
This commit is contained in:
blakeross%telocity.com 2006-07-27 14:53:33 +00:00
Родитель 0a768ee88f
Коммит 9210ca7dab
2 изменённых файлов: 31 добавлений и 15 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: Java; tab-width: 4; c-basic-offset: 4; -*- /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*-
* *
* The contents of this file are subject to the Netscape Public * The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file * License Version 1.1 (the "License"); you may not use this file
@ -18,6 +18,7 @@
* Rights Reserved. * Rights Reserved.
* *
* Contributor(s): * Contributor(s):
* Bradley Baetz <bbaetz@student.usyd.edu.au>
*/ */
/* /*
@ -56,7 +57,7 @@ const nsISupportsWString = Components.interfaces.nsISupportsWString;
function debug(msg) function debug(msg)
{ {
// Uncomment to print out debug info. // Uncomment to print out debug info.
// dump(msg); //dump(msg);
} }
@ -167,9 +168,10 @@ function Init()
debug("append traiing slash to FTP directory URL\n"); debug("append traiing slash to FTP directory URL\n");
baseURI += "/"; baseURI += "/";
} }
}
if (baseURI && (baseURI.indexOf("file://") != 0)) {
// Note: DON'T add the HTTPIndex datasource into the tree // Note: DON'T add the HTTPIndex datasource into the tree
// for file URLs, only do it for FTP URLs; the "rdf:files" // for file URLs, only do it for FTP/Gopher/etc URLs; the "rdf:files"
// datasources handles file URLs // datasources handles file URLs
tree.database.AddDataSource(HTTPIndex.DataSource); tree.database.AddDataSource(HTTPIndex.DataSource);
} }
@ -209,8 +211,6 @@ function Init()
tree.setAttribute("ref", baseURI); tree.setAttribute("ref", baseURI);
} }
function DoUnload() function DoUnload()
{ {
var tree = document.getElementById("tree"); var tree = document.getElementById("tree");
@ -232,21 +232,33 @@ function OnClick(event, node)
return(false); return(false);
var tree = document.getElementById("tree"); var tree = document.getElementById("tree");
if( tree.selectedItems.length == 1 ) if( tree.selectedItems.length == 1 ) {
{
var selectedItem = tree.selectedItems[0]; var selectedItem = tree.selectedItems[0];
var theID = selectedItem.getAttribute("id"); var url = selectedItem.getAttribute("URL");
window._content.location.href = theID; window._content.location.href = url;
// set window title // set window title
var theWindow = window._content.parentWindow; var theWindow = window._content.parentWindow;
if (theWindow) if (theWindow)
theWindow.title = theID; theWindow.title = url;
} }
} }
function OnMouseOver(event, node)
{
if (node.nodeName != "treeitem")
return false;
var url = node.getAttribute("URL");
window._content.status = url;
return true;
}
function OnMouseOut(event, node)
{
window._content.status = "";
return true;
}
function doSort(sortColName) function doSort(sortColName)
{ {

Просмотреть файл

@ -43,6 +43,7 @@
<template> <template>
<treechildren flex="1"> <treechildren flex="1">
<treeitem uri="..." persist="open" <treeitem uri="..." persist="open"
URL="rdf:http://home.netscape.com/NC-rdf#URL"
type="rdf:http://home.netscape.com/NC-rdf#File-Type" type="rdf:http://home.netscape.com/NC-rdf#File-Type"
loading="rdf:http://home.netscape.com/NC-rdf#loading" > loading="rdf:http://home.netscape.com/NC-rdf#loading" >
<treerow> <treerow>
@ -83,7 +84,10 @@
<!-- Create the treechildren here so we can attach event handlers <!-- Create the treechildren here so we can attach event handlers
at this level (rather than at the tree level --> at this level (rather than at the tree level -->
<treechildren flex="1" onclick="OnClick(event, event.target.parentNode.parentNode);" onkeypress="OnClick(event, event.target.parentNode.parentNode);"/> <treechildren flex="1" onclick="OnClick(event, event.target.parentNode.parentNode);"
onkeypress="OnClick(event, event.target.parentNode.parentNode);"
onmouseover="OnMouseOver(event, event.target.parentNode.parentNode);"
onmouseout="OnMouseOut(event, event.target.parentNode.parentNode);" />
</tree> </tree>
</window> </window>