Compare commits

..

6 Commits

Author SHA1 Message Date
bryner%uiuc.edu
666ff43be0 Updating for rdf branch. Not part of build.
git-svn-id: svn://10.0.0.236/branches/RDF_FILEPICKER_BRANCH@77603 18797224-902f-48f8-a5cc-f745e15eee43
2000-08-30 07:20:38 +00:00
(no author)
73f91c8955 This commit was manufactured by cvs2svn to create branch
'RDF_FILEPICKER_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/RDF_FILEPICKER_BRANCH@77601 18797224-902f-48f8-a5cc-f745e15eee43
2000-08-30 07:15:24 +00:00
bryner%uiuc.edu
4b41f7560f Adding filepicker.dtd on the branch.
git-svn-id: svn://10.0.0.236/branches/RDF_FILEPICKER_BRANCH@77170 18797224-902f-48f8-a5cc-f745e15eee43
2000-08-25 04:35:29 +00:00
(no author)
db8b93f218 This commit was manufactured by cvs2svn to create branch
'RDF_FILEPICKER_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/RDF_FILEPICKER_BRANCH@77148 18797224-902f-48f8-a5cc-f745e15eee43
2000-08-25 01:56:40 +00:00
bryner%uiuc.edu
790f0b060f RDF filepicker changes.
git-svn-id: svn://10.0.0.236/branches/RDF_FILEPICKER_BRANCH@77124 18797224-902f-48f8-a5cc-f745e15eee43
2000-08-24 22:38:19 +00:00
(no author)
bd57f5acca This commit was manufactured by cvs2svn to create branch
'RDF_FILEPICKER_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/RDF_FILEPICKER_BRANCH@76608 18797224-902f-48f8-a5cc-f745e15eee43
2000-08-18 02:32:10 +00:00
11 changed files with 652 additions and 33 deletions

View File

@@ -1,33 +0,0 @@
#
## hostname: bm-xserve08.build.mozilla.org
## uname: Darwin bm-xserve08.build.mozilla.org 8.8.4 Darwin Kernel Version 8.8.4: Sun Oct 29 15:26:54 PST 2006; root:xnu-792.16.4.obj~1/RELEASE_I386 i386 i386
#
# symbols for breakpad
export CFLAGS="-g -gfull"
export CXXFLAGS="-g -gfull"
. $topsrcdir/build/macosx/universal/mozconfig
mk_add_options MOZ_MAKE_FLAGS="-j4"
mk_add_options MOZ_CO_MODULE="mozilla/tools/update-packaging mozilla/tools/codesighs"
mk_add_options MOZ_CO_PROJECT="browser"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../build/universal
ac_add_options --enable-application=browser
ac_add_options --enable-update-channel=nightly
# Don't add explicit optimize flags here, set them in configure.in, see bug 407794.
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-update-packaging
ac_add_options --enable-libxul
ac_add_options --enable-shark
export MOZ_PKG_SPECIAL="shark"
ac_add_options --enable-debugger-info-modules
#ac_add_options --enable-dtrace
# ac_add_options --enable-official-branding
ac_add_app_options ppc --enable-prebinding
ac_add_options --enable-codesighs

View File

@@ -0,0 +1,41 @@
#! gmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
CHROME_DIR = packages/widget-toolkit
CHROME_CONTENT_DIR = global/content
CHROME_CONTENT = \
filepicker.xul \
filepicker.js \
filepicker.css \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,10 @@
/* This file is for non skin-specific rules for the filepicker dialog */
.tree-cell-twisty { display: none; }
treeitem[container="true"] > treerow > treecell {
list-style-image: url("chrome://global/skin/dir-closed.gif");
}

View File

@@ -0,0 +1,357 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
* Brian Ryner <bryner@netscape.com>
* Jan Varga <varga@utcru.sk>
* Peter Annema <disttsc@bart.nl>
*/
const nsILocalFile = Components.interfaces.nsILocalFile;
const nsILocalFile_PROGID = "component://mozilla/file/local";
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIDirectoryServiceProvider = Components.interfaces.nsIDirectoryServiceProvider;
const nsIDirectoryServiceProvider_PROGID = "component://netscape/file/directory_service";
const nsStdURL_PROGID = "component://netscape/network/standard-url";
const nsIFileURL = Components.interfaces.nsIFileURL;
const NC_NAMESPACE_URI = "http://home.netscape.com/NC-rdf#";
var sfile = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile);
var retvals;
var filePickerMode;
var currentFilter;
var lastClicked;
var dirHistory;
var homeDir;
var directoryTree;
var textInput;
var bundle = srGetStrBundle("chrome://global/locale/filepicker.properties");
function onLoad() {
dirHistory = new Array();
directoryTree = document.getElementById("directoryTree");
textInput = document.getElementById("textInput");
if (window.arguments) {
var o = window.arguments[0];
retvals = o.retvals; /* set this to a global var so we can set return values */
const title = o.title;
filePickerMode = o.mode;
if (o.displayDirectory)
const directory = o.displayDirectory.path;
const initialText = o.defaultString;
const filterTitles = o.filters.titles;
const filterTypes = o.filters.types;
const numFilters = filterTitles.length;
window.title = title;
if (initialText) {
textInput.value = initialText;
}
/* build filter popup */
var filterPopup = document.createElement("menupopup");
currentFilter = filterTypes[0];
applyFilter();
for (var i = 0; i < numFilters; i++) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("value", filterTitles[i] + " (" + filterTypes[i] + ")");
menuItem.setAttribute("filters", filterTypes[i]);
filterPopup.appendChild(menuItem);
}
var filterMenuList = document.getElementById("filterMenuList");
filterMenuList.appendChild(filterPopup);
}
// setup the dialogOverlay.xul button handlers
doSetOKCancel(onOK, onCancel);
// get the home dir
var dirServiceProvider = Components.classes[nsIDirectoryServiceProvider_PROGID].getService().QueryInterface(nsIDirectoryServiceProvider);
var persistent = new Object();
homeDir = dirServiceProvider.getFile("Home", persistent);
if (directory)
sfile.initWithPath(directory);
if (!directory || !(sfile.exists() && sfile.isDirectory())) {
// Start in the user's home directory
sfile.initWithPath(homeDir.path);
}
retvals.buttonStatus = nsIFilePicker.returnCancel;
gotoDirectory(sfile);
textInput.focus();
}
function onFilterChanged(target)
{
var filterTypes = target.getAttribute("filters");
currentFilter = filterTypes;
applyFilter();
}
function applyFilter()
{
/* This is where we manipulate the DOM to create new <rule>s */
var splitFilters = currentFilter.split("; ");
var matchAllFiles = false;
/* get just the extensions for each of the filters */
var extensions = new Array(splitFilters.length);
for (var j = 0; j < splitFilters.length; j++) {
var tmpStr = splitFilters[j];
if (tmpStr == "*") {
matchAllFiles = true;
break;
} else
extensions[j] = tmpStr.substring(1); /* chop off the '*' */
}
/* delete all rules except the first one */
for (var j = 1;; j++) {
var ruleNode = document.getElementById("matchRule."+j);
if (ruleNode) {
ruleNode.parentNode.removeChild(ruleNode);
} else {
break;
}
}
/* if we are matching all files, just clear the extension attribute
on the first match rule and we're done */
var rule0 = document.getElementById("matchRule.0");
if (matchAllFiles) {
rule0.removeAttributeNS(NC_NAMESPACE_URI, "extension");
directoryTree.builder.rebuild();
return;
}
/* rule 0 is special */
rule0.setAttributeNS(NC_NAMESPACE_URI, "extension" , extensions[0]);
/* iterate through the remaining extensions, creating new rules */
var ruleNode = document.getElementById("fileFilter");
for (var k=1; k < extensions.length; k++) {
var newRule = rule0.cloneNode(true);
newRule.setAttribute("id", "matchRule."+k);
newRule.setAttributeNS(NC_NAMESPACE_URI, "extension", extensions[k]);
ruleNode.appendChild(newRule);
}
directoryTree.builder.rebuild();
}
function onOK()
{
var ret = nsIFilePicker.returnCancel;
var isDir = false;
var isFile = false;
var input = textInput.value;
if (input[0] == '~') // XXX XP?
input = homeDir.path + input.substring(1);
var file = sfile.clone().QueryInterface(nsILocalFile);
if (!file)
return false;
/* XXX we need an XP way to test for an absolute path! */
if (input[0] == '/') /* an absolute path was entered */
file.initWithPath(input);
else {
try {
file.appendRelativePath(input);
} catch (e) {
dump("Can't append relative path '"+input+"':\n");
return false;
}
}
if (!file.exists() && (filePickerMode != nsIFilePicker.modeSave)) {
return false;
}
if (file.exists()) {
var isDir = file.isDirectory();
var isFile = file.isFile();
}
switch(filePickerMode) {
case nsIFilePicker.modeOpen:
if (isFile) {
retvals.directory = file.parent.path;
ret = nsIFilePicker.returnOK;
} else if (isDir) {
if (!sfile.equals(file)) {
gotoDirectory(file);
}
textInput.value = "";
ret = nsIFilePicker.returnCancel;
}
break;
case nsIFilePicker.modeSave:
if (isFile) {
// we need to pop up a dialog asking if you want to save
rv = window.confirm(file.path + " " + bundle.GetStringFromName("confirmFileReplacing"));
if (rv)
ret = nsIFilePicker.returnReplace;
else
ret = nsIFilePicker.returnCancel;
retvals.directory = file.parent.path;
} else if (!file.exists()) {
ret = nsIFilePicker.returnOK;
retvals.directory = file.parent.path;
}
break;
case nsIFilePicker.modeGetFolder:
if (isDir) {
retvals.directory = file.parent.path;
ret = nsIFilePicker.returnOK;
}
break;
}
retvals.file = file;
retvals.buttonStatus = ret;
if (ret == nsIFilePicker.returnCancel)
return false;
else
return true;
}
function onCancel()
{
// Close the window.
retvals.buttonStatus = nsIFilePicker.returnCancel;
return true;
}
function onClick(e) {
if ( e.detail == 2 ) {
var file = URLpathToFile(e.target.parentNode.getAttribute("path"));
if (file.isDirectory()) {
gotoDirectory(file);
}
else if (file.isFile()) {
/* what about symlinks? what if they symlink to a directory? */
return doOKButton();
}
}
}
function onKeypress(e) {
if (e.keyCode == 8) /* backspace */
goUp();
}
function onSelect(e) {
if (e.target.selectedItems.length != 1)
return;
var file = URLpathToFile(e.target.selectedItems[0].firstChild.getAttribute("path"));
if (file.isFile()) {
textInput.value = file.leafName;
lastClicked = file.leafName;
}
}
function onDirectoryChanged(target)
{
var path = target.getAttribute("value");
var file = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile);
file.initWithPath(path);
gotoDirectory(file);
}
function addToHistory(directoryName) {
var found = false;
var i = 0;
while (!found && i<dirHistory.length) {
if (dirHistory[i] == directoryName)
found = true;
else
i++;
}
if (found) {
if (i!=0) {
dirHistory.splice(i, 1);
dirHistory.splice(0, 0, directoryName);
}
} else {
dirHistory.splice(0, 0, directoryName);
}
var menu = document.getElementById("lookInMenu");
var children = menu.childNodes;
for (var i=0; i < children.length; i++)
menu.removeChild(children[i]);
for (var i=0; i < dirHistory.length; i++) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("value", dirHistory[i]);
menu.appendChild(menuItem);
}
var menuList = document.getElementById("lookInMenuList");
menuList.selectedIndex = 0;
}
function goUp() {
try {
var parent = sfile.parent;
} catch(ex) { dump("can't get parent directory\n"); }
if (parent) {
gotoDirectory(parent);
}
}
function gotoDirectory(directory) {
var newURL = fileToURL(directory);
addToHistory(directory.path);
directoryTree.setAttribute("ref", fileToURL(directory).spec);
sfile = directory;
}
function fileToURL(aFile) {
var newDirectoryURL = Components.classes[nsStdURL_PROGID].createInstance().QueryInterface(nsIFileURL);
newDirectoryURL.file = aFile;
return newDirectoryURL;
}
function URLpathToFile(aURLstr) {
var fileURL = Components.classes[nsStdURL_PROGID].createInstance().QueryInterface(nsIFileURL);
fileURL.spec = aURLstr;
return fileURL.file;
}

View File

@@ -0,0 +1,110 @@
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
<!--
- The contents of this file are subject to the Mozilla Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
- The Original Code is mozilla.org code.
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 2000 Netscape Communications Corporation.
- All Rights Reserved.
- Contributor(s):
- Stuart Parmenter <pavlov@netscape.com>
- Brian Ryner <bryner@netscape.com>
- Jan Varga <varga@utcru.sk>
- Peter Annema <disttsc@bart.nl>
-->
<?xml-stylesheet href="chrome://global/skin/filepicker.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xml-stylesheet href="chrome://global/content/filepicker.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/filepicker.dtd" >
<window id="main-window"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
onload="onLoad();"
width="426" height="300"
class="dialog"
persist="screenX screenY">
<script src="chrome://global/content/strres.js"/>
<script src="chrome://global/content/filepicker.js"/>
<keyset id="keyset"/>
<box autostretch="never">
<text value="&lookInMenuList.label;"/>
<menulist id="lookInMenuList" flex="1" oncommand="onDirectoryChanged(event.target);">
<menupopup id="lookInMenu"/>
</menulist>
<button value=".." onclick="goUp();"/>
</box>
<box flex="1">
<tree id="directoryTree" flex="1" onkeypress="onKeypress(event)"
onselect="onSelect(event)" datasources="rdf:files">
<template id="fileFilter">
<!-- This is the rule for files matching the filter -->
<rule id="matchRule.0">
<treechildren flex="1">
<treeitem uri="..." empty="true"
type="rdf:http://home.netscape.com/NC-rdf#File-Type"
loading="rdf:http://home.netscape.com/NC-rdf#loading" >
<treerow path="rdf:http://home.netscape.com/NC-rdf#URL">
<treecell class="treecell-filename treecell-indent"
indent="true" type="rdf:http://home.netscape.com/NC-rdf#File-Type"
value="rdf:http://home.netscape.com/NC-rdf#Name"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Content-Length" />
<treecell value="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate" />
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecolgroup>
<treecol flex="1" id="FilenameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name" sortActive="true" sortDirection="ascending"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="ContentLengthColumn" rdf:resource="http://home.netscape.com/NC-rdf#ContentLength"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="LastModifiedDateColumn" rdf:resource="http//home.netscape.com/WEB-rdf#LastModifiedDate"/>
</treecolgroup>
<treehead>
<treerow>
<treecell class="treecell-header" value="&name.label;"/>
<treecell class="treecell-header" value="&size.label;"/>
<treecell class="treecell-header" value="&lastModified.label;"/>
</treerow>
</treehead>
<treechildren flex="1" onclick="onClick(event)"/>
</tree>
</box>
<box autostretch="never" style="margin-top: 5px">
<text value="&textInput.label;"/>
<textfield id="textInput" flex="1"/>
</box>
<box autostretch="never">
<text value="&filterMenuList.label;"/>
<menulist id="filterMenuList" flex="1" oncommand="onFilterChanged(event.target);"/>
</box>
<box id="okCancelButtons"/>
</window>

View File

@@ -0,0 +1,34 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..\..
CHROME_DIR = packages\widget-toolkit
CHROME_CONTENT_DIR = global\content
CHROME_CONTENT = \
.\filepicker.xul \
.\filepicker.js \
.\filepicker.css \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,2 @@
filepicker.properties
filepicker.dtd

View File

@@ -0,0 +1,40 @@
#! gmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
CHROME_DIR = locales/en-US
CHROME_L10N_DIR = global/locale
CHROME_L10N = \
filepicker.properties \
filepicker.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,8 @@
<!ENTITY lookInMenuList.label "Look in:">
<!ENTITY textInput.label "File name:">
<!ENTITY filterMenuList.label "Files of type:">
<!ENTITY name.label "Name">
<!ENTITY size.label "Size">
<!ENTITY lastModified.label "Last Modified">
<!ENTITY permissions.label "Permissions">

View File

@@ -0,0 +1,16 @@
# LOCALIZATION NOTE FILE
# --do not localize the extensions, only the titles
allTitle=All Files
allFilter=*
htmlTitle=HTML Files
htmlFilter=*.html; *.htm; *.shtml; *.xhtml
textTitle=Text Files
textFilter=*.txt
imageTitle=Image Files
imageFilter=*.png; *.gif; *.jpeg; *.jpg
xmlTitle=XML Files
xmlFilter=*.xml
xulTitle=XUL Files
xulFilter=*.xul
confirmFileReplacing=already exists. Do you want to replace it?

View File

@@ -0,0 +1,34 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..\..\..\..
CHROME_DIR = locales\en-US
CHROME_L10N_DIR = global\locale
CHROME_L10N = \
.\filepicker.properties \
.\filepicker.dtd \
$(NULL)
include <$(DEPTH)\config\rules.mak>