Changed xmlterm/ui/Makefile.in to use CHROME vars to handle content/skin resources (bug 34416); eliminated directories xmlterm/ui/content and xmlterm/ui/skin.
This commit is contained in:
svn%xmlterm.org 2000-04-15 04:45:36 +00:00
Родитель 1c0c62281d
Коммит 62ec840bf2
28 изменённых файлов: 1028 добавлений и 621 удалений

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

@ -1,83 +0,0 @@
xmlterm --- A graphical command line interface
==============================================
An early prototype of XMLterm, an XTERM-like terminal program implemented
using the open source Mozilla layout engine, is now available to tinker
with. XMLterm aims to add graphical and hypertext capabilities to the XTERM
command line interface, while maintaining backwards compatibility.
The basic design philosophy of XMLterm is that the user interface is a dynamic
XML document. The user and the computer interact by taking turns at appending
to this XML document. The plain text content of the XML document, i.e.,
excluding any markup, corresponds to the plain text that would be displayed by
a plain XTERM. The markup in the XML document is used to add graphical and
hypertext features. XMLterm uses the Mozilla layout engine to display the XML
document.
XMLterm is an open source project in its early stages. Comments and
contributions are welcome!
R. Saravanan <svn@xmlterm.org>
7 Mar 2000 <http://xmlterm.org>
==========
QUICK SET-UP INSTRUCTIONS (Linux/Solaris)
-----------------------------------------
If you have already built mozilla from the source, then type the following
commands in the "mozilla" directory to build XMLterm:
a) configure --with-extensions=xmlterm <other-configure-options>
b) cd extensions/xmlterm
c) make
[Skip step (b) for a fresh build of mozilla from the source tarball]
To execute XMLterm, type one of the following commands in
the mozilla/dist/bin directory:
./xmlterm
OR
./mozilla -chrome chrome://xmlterm/content/xmlterm.xul
NOTES:
1. See the INSTALL file for detailed configuration/installation instructions.
2. See the file doc/INSTALL.xmlterm for binary installation instructions.
3. Check the XMLterm web site <http://xmlterm.org> for updates.
===========================================================================
DOCUMENTATION
a. There is a README file in each directory that provides some basic
information.
b. The file "base/README" provides a brief overview of the XMLterm code
architecture.
c. The header files (*.idl, *.h) have comments describing class methods
and member variables in JAVADOC format. Look at them before delving
into the *.cpp files
===========================================================================
FILES:
INSTALL installation instructions
README this file
UUID.txt list of UUIDs used by XMLterm
The main subdirectories of the "xmlterm" directory are:
base/ base source code for XMLterm libraries
config/ make rules for stand-alone mode
dist/ holds include and library file for stand-alone LineTerm only
doc/ some documentation
geckoterm/ lightweight XMLterm executable
linetest/ stand-alone line terminal testing executables
scripts/ XMLterm scripts (xls, xcat, ...)
tests/ XMLterm test programs (HelloWorld pagelet, ...)
ui/* user interface/chrome files
--

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

@ -3117,7 +3117,7 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
imgElement->SetAttribute(attName, attValue);
attName = "src";
attValue = "chrome://xmlterm/skin/images/wheel.gif";
attValue = "chrome://xmlterm/skin/wheel.gif";
imgElement->SetAttribute(attName, attValue);
attName = "align";

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

@ -0,0 +1,4 @@
xmlterm.css
xmltpage.css
ficon.gif
wheel.gif

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

@ -33,21 +33,33 @@
# makefile for xmlterm/ui directory
ifdef STAND_ALONE
DEPTH = ..
topsrcdir = ..
VPATH = .
srcdir = .
include $(topsrcdir)/config/autoconf.mk
else
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
endif
DIRS = content skin
CHROME_DIR = xmlterm
CHROME_CONTENT = \
xmlterm.html \
xmlterm.xul \
xmlterm2.xul \
XMLTermChrome.js \
XMLTermCommands.js \
xmltermTips.html \
xmltermAbout.html \
xmltblank.html \
$(NULL)
CHROME_SKIN = \
xmlterm.css \
xmltpage.css \
wheel.gif \
$(NULL)
CHROME_L10N = \
$(NULL)
include $(topsrcdir)/config/config.mk

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

@ -1 +1,21 @@
ui --- User Interface stuff for XMLterm
ui --- User interface stuff for XMLterm
CONTENT
xmlterm.html XMLterm startup file containing HTML and Javascript
Uses mozIXMLTermShell to create XMLterm
Uses xmltpage.css for stylesheets
xmlterm.xul XUL wrapper for xmlterm.html
xmlterm2.xul XUL wrapper for xmlterm.html, with additional browser frame
XMLTermCommands.js Javascript commands used by XUL wrappers
SKIN
xmlterm.css Stylesheet for XUL file xmlterm.xul
xmltpage.css Stylesheet for XMLterm startup file xmlterm.html
wheel.gif Wheel icon used for prompt

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

@ -0,0 +1,41 @@
// XMLTerm Chrome Commands
function StartupXMLTerm() {
dump("StartupXMLTerm:\n");
dump("StartupXMLTerm:"+window.frames.length+"\n");
dump("StartupXMLTerm:"+window.frames[0].name+"\n");
if (window.frames.length == 2) {
xmltwin = window.frames[1];
xmltwin.xmltbrowser = window.frames[0];
} else {
xmltwin = window.frames[0];
}
dump("StartupXMLterm: WINDOW.ARGUMENTS="+window.arguments+"\n");
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in current window and in the XMLTerm frame
window.xmlterm = xmltshell;
xmltwin.xmlterm = xmltshell;
if (window.arguments != null)
window.title = "xmlterm: "+window.arguments;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(xmltwin, "", window.arguments);
}

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

@ -0,0 +1,737 @@
// XMLTerm Page Commands
// CONVENTION: All pre-defined XMLTerm Javascript functions and global
// variables should begin with an upper-case letter.
// This would allow them to be easily distinguished from
// user defined functions, which should begin with a lower case
// letter.
// Global variables
var AltWin; // Alternate (browser) window
var Tips = new Array(); // Usage tip strings
var TipNames = new Array(); // Usage tip names
var TipCount = 0; // No. of tips
var SelectedTip = 0; // Selected random tip
// Set prompt using form entry
function DefineTip(tip, name) {
Tips[TipCount] = tip;
TipNames[TipCount] = name;
TipCount++;
return;
}
DefineTip('Click the new tip link to the left to get a new tip!',
'tips');
DefineTip('User level setting (at the top) controls amount of help information',
'level');
DefineTip('Beginner level setting displays keyboard shortcuts at the top of the page',
'level');
DefineTip('Icons setting controls whether directory listings use icons',
'icons');
DefineTip('Windows setting controls whether double-clicking creates new windows',
'windows');
DefineTip('Single click an explicit (underlined) hyperlink; double click implicit (usually blue) hyperlinks',
'clicking');
DefineTip('Clicking on command prompt expands/collapses command output display.',
'prompt');
DefineTip('Press F1 (or control-Home) key to collapse output of all commands.',
'prompt');
DefineTip('"js:SetPrompt(HTMLstring);" sets prompt to any HTML string.',
'prompt');
DefineTip('Beginners may click the SetPrompt button for a cool Mozilla prompt from dmoz.org!',
'prompt');
DefineTip('Double-clicking on a previous command line re-executes the command.',
'command');
DefineTip('Type "js:func(arg);" to execute inline Javascript function func.',
'js');
DefineTip('Inline Javascript ("js:...") can be used to produce HTML output.',
'js');
DefineTip('XMLterm supports full screen commands like "less", "vi", and "emacs -nw"".',
'full-screen');
DefineTip('"xls" produces a clickable listing of directory contents.',
'xls');
DefineTip('"xls -t" prevents display of icons even if Icons setting is "on".',
'xls');
DefineTip('"xcat text-file" displays a text file with clickable URLs.',
'xcat');
DefineTip('"xcat image.gif" displays an image file inline!',
'xcat');
DefineTip('"xcat http://mozilla.org" displays a web page inline using IFRAMEs.',
'xcat');
DefineTip('"xcat -h 1000 http://mozilla.org" displays using an IFRAME 1000 pixels high.',
'xcat');
DefineTip('"xcat doc.html" display an HTML document inline using IFRAMEs.',
'xcat');
// Display random usage tip
// (should cease to operate after a few cycles;
// need to use Prefs to keep track of that)
function NewTip() {
var ranval = Math.random();
SelectedTip = Math.floor(ranval * TipCount);
if (SelectedTip >= TipCount) SelectedTip = 0;
dump("xmlterm: NewTip "+SelectedTip+","+ranval+"\n");
var tipdata = document.getElementById('tipdata');
tipdata.firstChild.data = Tips[SelectedTip];
ShowHelp("",0);
return false;
}
// Explain tip
function ExplainTip(tipName) {
dump("xmlterm: ExplainTip("+tipName+")\n");
if (tipName) {
var tipdata = document.getElementById('tipdata');
tipdata.firstChild.data = "";
} else {
tipName = TipNames[SelectedTip];
}
ShowHelp('xmltermTips.html#'+tipName,0,120);
return false;
}
// F1 key - Hide all output
function F1Key(isShift, isControl) {
return DisplayAllOutput(false);
}
// F2 key - Show all output
function F2Key(isShift, isControl) {
return DisplayAllOutput(true);
}
// F7 - Explain tip
function F7Key(isShift, isControl) {
return ExplainTip();
}
// F8 - New tip
function F8Key(isShift, isControl) {
return NewTip();
}
// F9 key
function F9Key(isShift, isControl) {
return NewXMLTerm('');
}
// Scroll Home key
function ScrollHomeKey(isShift, isControl) {
dump("ScrollHomeKey("+isShift+","+isControl+")\n");
if (isControl) {
return F1Key(isShift, 0);
} else {
ScrollWin(isShift,isControl).scroll(0,0);
return false;
}
}
// Scroll End key
function ScrollEndKey(isShift, isControl) {
dump("ScrollEndKey("+isShift+","+isControl+")\n");
if (isControl) {
return F2Key(isShift, 0);
} else {
ScrollWin(isShift,isControl).scroll(0,99999);
return false;
}
}
// Scroll PageUp key
function ScrollPageUpKey(isShift, isControl) {
dump("ScrollPageUpKey("+isShift+","+isControl+")\n");
ScrollWin(isShift,isControl).scrollBy(0,-120);
return false;
}
// Scroll PageDown key
function ScrollPageDownKey(isShift, isControl) {
dump("ScrollPageDownKey("+isShift+","+isControl+")\n");
ScrollWin(isShift,isControl).scrollBy(0,120);
return false;
}
// Scroll Window
function ScrollWin(isShift, isControl) {
if (isShift && (window.frames.length > 0)) {
return window.frames[window.frames.length-1];
} else {
return window;
}
}
// Set history buffer size
function SetHistory(value) {
dump("SetHistory("+value+")\n");
window.xmlterm.SetHistory(value, document.cookie);
return (false);
}
// Set prompt
function SetPrompt(value) {
dump("SetPrompt("+value+")\n");
window.xmlterm.SetPrompt(value, document.cookie);
return (false);
}
// Create new XMLTerm window
function NewXMLTerm(firstcommand) {
newwin = window.openDialog( "chrome://xmlterm/content/xmlterm.xul",
"xmlterm", "chrome,dialog=no,resizable",
firstcommand);
dump("NewXMLTerm: "+newwin+"\n")
return (false);
}
// Handle resize events
function Resize(event) {
dump("Resize()\n");
window.xmlterm.Resize();
return (false);
}
// Form Focus (workaround for form input being transmitted to xmlterm)
function FormFocus() {
dump("FormFocus()\n");
window.xmlterm.IgnoreKeyPress(true, document.cookie);
return false;
}
// Form Blur (workaround for form input being transmitted to xmlterm)
function FormBlur() {
dump("FormBlur()\n");
window.xmlterm.IgnoreKeyPress(false, document.cookie);
return false;
}
// Set user level
function UpdateSettings() {
var oldUserLevel = window.userLevel;
window.userLevel = document.xmltform1.level.options[document.xmltform1.level.selectedIndex].value;
var oldShowIcons = window.showIcons;
window.showIcons = document.xmltform1.icons.options[document.xmltform1.icons.selectedIndex].value;
window.windowsMode = document.xmltform1.windows.options[document.xmltform1.windows.selectedIndex].value;
dump("UpdateSettings: userLevel="+window.userLevel+"\n");
dump("UpdateSettings: windowsMode="+window.windowsMode+"\n");
dump("UpdateSettings: showIcons="+window.showIcons+"\n");
if (window.userLevel != oldUserLevel) {
// Change icon display style in the style sheet
if (window.userLevel == "advanced") {
AlterStyle("DIV.beginner", "display", "none");
AlterStyle("DIV.intermediate", "display", "none");
} else if (window.userLevel == "intermediate") {
AlterStyle("DIV.intermediate", "display", "block");
AlterStyle("DIV.beginner", "display", "none");
} else {
AlterStyle("DIV.beginner", "display", "block");
AlterStyle("DIV.intermediate", "display", "block");
}
}
if (window.showIcons != oldShowIcons) {
// Change icon display style in the style sheet
if (window.showIcons == "on") {
AlterStyle("SPAN.noicons", "display", "none");
AlterStyle("SPAN.icons", "display", "inline");
AlterStyle("IMG.icons", "display", "inline");
AlterStyle("TR.icons", "display", "table-row");
} else {
AlterStyle("SPAN.noicons", "display", "inline");
AlterStyle("SPAN.icons", "display", "none");
AlterStyle("IMG.icons", "display", "none");
AlterStyle("TR.icons", "display", "none");
}
}
return false;
}
// Alter style in stylesheet of specified document doc, or current document
// if doc is omitted.
function AlterStyle(ruleName, propertyName, propertyValue, doc) {
dump("AlterStyle("+ruleName+"{"+propertyName+":"+propertyValue+"})\n");
if (!doc) doc = window.document;
var sheet = doc.styleSheets[0];
var r;
for (r = 0; r < sheet.cssRules.length; r++) {
//dump(sheet.cssRules[r].selectorText+"\n");
if (sheet.cssRules[r].selectorText == ruleName) {
var style = sheet.cssRules[r].style;
//dump("style="+style.getPropertyValue(propertyName)+"\n");
style.setProperty(propertyName,propertyValue,"");
}
}
return false;
}
// Handle default meta command
function MetaDefault(arg1) {
return Load("http://"+arg1);
}
// Load URL in XMLTermBrowser window
function Load(url) {
var succeeded = false;
if (window.xmltbrowser) {
dump("Load:xmltbrowser.location.href="+window.xmltbrowser.location.href+"\n");
if (window.xmltbrowser.location.href.length) {
window.xmltbrowser.location = url;
succeeded = true;
}
}
if (!succeeded) {
window.xmltbrowser = window.open(url, "xmltbrowser");
}
// Save browser window object in global variable
AltWin = window.xmltbrowser;
return (false);
}
// Control display of all output elements
function DisplayAllOutput(flag) {
var outputElements = document.getElementsByName("output");
for (i=0; i<outputElements.length-1; i++) {
var outputElement = outputElements[i];
outputElement.style.display = (flag) ? "block" : "none";
}
var promptElements = document.getElementsByName("prompt");
for (i=0; i<promptElements.length-1; i++) {
promptElement = promptElements[i];
promptElement.style.setProperty("text-decoration",
(flag) ? "none" : "underline", "")
}
if (!flag) {
ScrollHomeKey(0,0);
ScrollEndKey(0,0);
}
return (false);
}
// Centralized event handler
// eventType values:
// click
//
// targetType:
// textlink - hyperlink
// prompt - command prompt
// command - command line
//
// (Following are inline or in new window depending upon window.windowsMode)
// cdxls - change directory and list contents (doubleclick)
// xcat - display file (doubleclick)
// exec - execute file (doubleclick)
//
// send - transmit arg to LineTerm
// sendln - transmit arg+newline to LineTerm
// createln - transmit arg+newline as first command to new XMLTerm
//
// entryNumber: >=0 means process only if current entry
// <0 means process anytime
//
// arg1: relative pathname of file/directory
// arg2: absolute pathname prefix (for use outside current entry;
// use relative pathname in current working directory)
//
function HandleEvent(eventObj, eventType, targetType, entryNumber,
arg1, arg2) {
dump("HandleEvent("+eventObj+","+eventType+","+targetType+","+
entryNumber+","+arg1+","+arg2+")\n");
// Entry independent targets
if (action === "textlink") {
// Single click opens hyperlink
// Browser-style
dump("textlink = "+arg1+"\n");
Load(arg1);
} else if (targetType === "prompt") {
// Single click on prompt expands/collapses command output
var outputElement = document.getElementById("output"+entryNumber);
var helpElement = document.getElementById("help"+entryNumber);
var promptElement = document.getElementById("prompt"+entryNumber);
//dump(promptElement.style.getPropertyValue("text-decoration"));
if (outputElement.style.display == "none") {
outputElement.style.display = "block";
promptElement.style.setProperty("text-decoration","none","");
} else {
outputElement.style.display = "none";
promptElement.style.setProperty("text-decoration","underline","");
if (helpElement) {
ShowHelp("",entryNumber);
}
}
} else if (eventType === "click") {
dump("clickCount="+eventObj.clickCount+"\n");
var shiftClick = eventObj.shiftKey;
var dblClick = (eventObj.clickCount == 2);
// Execute shell commands only on double-click for safety
// Use single click for "selection" and prompt expansion only
// Windows-style
var currentEntryNumber = window.xmlterm.currentEntryNumber;
var currentCmdElement = document.getElementById("command"+currentEntryNumber);
var currentCommandEmpty = true;
if (currentCmdElement && currentCmdElement.hasChildNodes()) {
if (currentCmdElement.firstChild.nodeType == Node.TEXT_NODE) {
//dump("textLength = "+currentCmdElement.firstChild.data.length+"\n");
currentCommandEmpty = (currentCmdElement.firstChild.data.length == 0);
} else {
currentCommandEmpty = false;
}
}
//dump("empty = "+currentCommandEmpty+"\n");
if (targetType === "command") {
if (!dblClick)
return false;
var commandElement = document.getElementById(targetType+entryNumber);
var command = commandElement.firstChild.data;
if (currentCommandEmpty) {
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
} else {
window.xmlterm.SendText(command, document.cookie);
}
} else {
// Targets which may be qualified only for current entry
if ((entryNumber >= 0) &&
(window.xmlterm.currentEntryNumber != entryNumber)) {
dump("NOT CURRENT COMMAND\n");
return (false);
}
var action, sendStr;
if ( (targetType === "cdxls") ||
(targetType === "xcat") ||
(targetType === "exec") ) {
// Complex commands
if (!dblClick)
return false;
var filename;
var isCurrentCommand = (Math.abs(entryNumber)+1 ==
window.xmlterm.currentEntryNumber);
if ( (arg2 != null) &&
(!isCurrentCommand || (window.windowsMode === "on")) ) {
// Full pathname
filename = arg2+arg1;
} else {
// Short pathname
filename = arg1;
if (targetType === "exec")
filename = "./"+filename;
}
var prefix, suffix;
if (targetType === "cdxls") {
// Change directory and list contents
prefix = "cd ";
suffix = "; xls";
} else if (targetType === "xcat") {
// Display file
prefix = "xcat ";
suffix = "";
} else if (targetType === "exec") {
// Execute file
prefix = "";
suffix = "";
}
if (shiftClick || (window.windowsMode === "on")) {
action = "createln";
sendStr = prefix + filename + suffix;
} else if (currentCommandEmpty) {
action = "sendln";
sendStr = prefix + filename + suffix;
} else {
action = "send";
sendStr = filename + " ";
}
} else {
// Primitive action
action = targetType;
sendStr = arg1;
}
// Primitive actions
if (action === "send") {
dump("send = "+sendStr+"\n");
window.xmlterm.SendText(sendStr, document.cookie);
} else if (action === "sendln") {
dump("sendln = "+sendStr+"\n\n");
window.xmlterm.SendText("\025"+sendStr+"\n", document.cookie);
} else if (action === "createln") {
dump("createln = "+sendStr+"\n\n");
newwin = NewXMLTerm(sendStr+"\n");
}
}
}
return (false);
}
// Set history buffer count using form entry
function SetHistoryValue() {
var field = document.getElementById('inputvalue');
return SetHistory(field.value);
}
// Set prompt using form entry
function SetPromptValue() {
var field = document.getElementById('inputvalue');
return SetPrompt(field.value);
}
// Insert help element displaying URL in an IFRAME before output element
// of entryNumber, or before the SESSION element if entryNumber is zero.
// Height is the height of the IFRAME in pixels.
// If URL is the null string, simply delete the help element
function ShowHelp(url, entryNumber, height) {
if (!height) height = 120;
dump("xmlterm: ShowHelp("+url+","+entryNumber+","+height+")\n");
if (entryNumber) {
beforeID = "output"+entryNumber;
helpID = "help"+entryNumber;
} else {
beforeID = "session";
helpID = "help";
}
var beforeElement = document.getElementById(beforeID);
if (!beforeElement) {
dump("InsertIFrame: beforeElement ID="+beforeID+"not found\n");
return false;
}
var parentNode = beforeElement.parentNode;
var helpElement = document.getElementById(helpID);
if (helpElement) {
// Delete help element
parentNode.removeChild(helpElement);
helpElement = null;
// *NOTE* Need to flush display here to avoid black flash?
}
if (url.length > 0) {
// Create new help element
helpElement = document.createElement("div");
helpElement.setAttribute('id', helpID);
helpElement.setAttribute('class', 'help');
var closeElement = document.createElement("span");
closeElement.setAttribute('class', 'helplink');
closeElement.appendChild(document.createTextNode("Close help frame"));
//closeElement.appendChild(document.createElement("p"));
var iframe = document.createElement("iframe");
iframe.setAttribute('id', helpID+'frame');
iframe.setAttribute('class', 'helpframe');
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', height);
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('src', url);
helpElement.appendChild(iframe);
helpElement.appendChild(closeElement);
dump(helpElement);
// Insert help element
parentNode.insertBefore(helpElement, beforeElement);
// NOTE: Need to do this *after* node is inserted into document
closeElement.setAttribute('onClick', 'return ShowHelp("",'+entryNumber
+');');
}
return false;
}
// About XMLTerm
function AboutXMLTerm() {
dump("xmlterm: AboutXMLTerm\n");
var tipdata = document.getElementById('tipdata');
tipdata.firstChild.data = "";
ShowHelp('xmltermAbout.html',0,120);
return false;
}
// onLoad event handler
function LoadHandler() {
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
// Update settings
UpdateSettings();
NewTip();
if (window.xmlterm) {
// XMLTerm already initialized
return (false);
}
dump("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in the window
window.xmlterm = xmltshell;
// Content window same as current window
var contentWindow = window;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(contentWindow, "", "");
//dump("LoadHandler:"+document.cookie+"\n");
dump("contentWindow="+contentWindow+"\n");
dump("document="+document+"\n");
dump("documentElement="+document.documentElement+"\n");
// Handle resize events
//contentWindow.addEventListener("onresize", Resize);
contentWindow.onresize = Resize;
// Set focus to appropriate frame
contentWindow.focus();
//contentWindow.xmlterm = xmlterm;
//dump(contentWindow.xmlterm);
// The following code is for testing IFRAMEs only
dump("[Main] "+window+"\n");
dump(window.screenX+", "+window.screenY+"\n");
dump(window.scrollX+", "+window.scrollY+"\n");
dump(window.pageXOffset+", "+window.pageYOffset+"\n");
dump("IFRAME checks\n");
var iframe = document.getElementById('iframe1');
dump("iframe="+iframe+"\n");
frames=document.frames;
dump("frames="+frames+"\n");
dump("frames.length="+frames.length+"\n");
framewin = frames[0];
dump("framewin="+framewin+"\n");
dump("framewin.document="+framewin.document+"\n");
dump(framewin.screenX+", "+framewin.screenY+"\n");
dump(framewin.scrollX+", "+framewin.scrollY+"\n");
dump(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
var body = framewin.document.getElementsByTagName("BODY")[0];
dump("body="+body+"\n");
var height= body.scrollHeight;
dump("height="+height+"\n");
// iframe.height = 800;
// iframe.width = 700;
// framewin.sizeToContent();
framewin.xmltshell = xmltshell;
dump(framewin.xmltshell+"\n");
dump("xmlterm: LoadHandler completed\n");
return (false);
}

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

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

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

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

@ -1,460 +0,0 @@
<!-- xmlterm.html: XMLterm page -->
<HTML>
<HEAD>
<TITLE>XMLterm Page</TITLE>
<LINK TITLE="DefaultStyle" REL="stylesheet" TYPE="text/css"
HREF="chrome://xmlterm/skin/xmltpage.css">
<SCRIPT language="JavaScript">
// CONVENTION: All pre-defined XMLTerm Javascript functions
// begin with an upper letter. This allows
// an easy distinction with user defined functions,
// which should begin with a lower case letter.
// Show all output
function ShowAll() {
return DisplayAllOutput(true);
}
// Hide all output
function HideAll() {
return DisplayAllOutput(false);
}
// Set history buffer size
function SetHistory(value) {
dump("SetHistory("+value+")\n");
window.xmlterm.SetHistory(value, document.cookie);
return (false);
}
// Set prompt
function SetPrompt(value) {
dump("SetPrompt("+value+")\n");
window.xmlterm.SetPrompt(value, document.cookie);
return (false);
}
// Create new XMLTerm window
function NewXMLTerm(firstcommand) {
newwin = window.openDialog( "chrome://xmlterm/content/xmlterm.xul",
"xmlterm", "chrome,dialog=no,resizable",
firstcommand);
//newwin = window.xmlterm.NewXMLTermWindow(firstcommand);
dump("NewXMLTerm: "+newwin+"\n")
return (false);
}
// Handle resize events
function Resize(event) {
dump("Resize()\n");
window.xmlterm.Resize();
return (false);
}
// Scroll Home
function ScrollHome(isShift, isControl) {
dump("ScrollHome("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scroll(0,0);
} else {
window.scroll(0,0);
}
return false;
}
// Scroll End
function ScrollEnd(isShift, isControl) {
dump("ScrollEnd("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scroll(0,9999);
} else {
window.scroll(0,9999);
}
return false;
}
// Scroll PageUp
function ScrollPageUp(isShift, isControl) {
dump("ScrollPageUp("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scrollBy(0,-300);
} else {
window.scrollBy(0,-300);
}
return false;
}
// Scroll PageDown
function ScrollPageDown(isShift, isControl) {
dump("ScrollPageDown("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scrollBy(0,300);
} else {
window.scrollBy(0,300);
}
return false;
}
// Form Focus (workaround for form input being transmitted to xmlterm)
function FormFocus() {
dump("FormFocus()\n");
window.xmlterm.IgnoreKeyPress(true, document.cookie);
return false;
}
// Form Blur (workaround for form input being transmitted to xmlterm)
function FormBlur() {
dump("FormBlur()\n");
window.xmlterm.IgnoreKeyPress(false, document.cookie);
return false;
}
// Handle default meta command
function MetaDefault(arg1) {
return Load("http://"+arg1);
}
// Load URL in XMLTermBrowser window
function Load(url) {
var succeeded = false;
if (window.xmltbrowser) {
dump("Load:xmltbrowser.location.href="+window.xmltbrowser.location.href+"\n");
if (window.xmltbrowser.location.href.length) {
window.xmltbrowser.location = url;
succeeded = true;
}
}
if (!succeeded) {
window.xmltbrowser = window.open(url, "xmltbrowser");
}
return (false);
}
// Control display of all output elements
function DisplayAllOutput(flag) {
var outputElements = document.getElementsByName("output");
for (i=0; i<outputElements.length; i++) {
var outputElement = outputElements[i];
outputElement.style.display = (flag) ? "block" : "none";
}
var promptElements = document.getElementsByName("prompt");
for (i=0; i<promptElements.length; i++) {
promptElement = promptElements[i];
promptElement.style.setProperty("text-decoration",
(flag) ? "none" : "underline", "")
}
return (false);
}
// Centralized event handler
// eventType values:
// click
//
// targetType:
// textlink - hyperlink
// prompt - command prompt
// command - command line
// exec - execute command with sendln/createln
// (depending upon window.commandMode)
// send - transmit arg to LineTerm
// sendln - transmit arg+newline to LineTerm
// createln - transmit arg+newline as first command to new XMLTerm
//
// entryNumber: >=0 means process only if current entry
// <0 means process anytime
//
// arg1: command/pathname string (without newline)
// arg2: alternate command line (for use in current entry only;
// uses relative pathnames assuming current working directory)
//
function HandleEvent(eventObj, eventType, targetType, entryNumber,
arg1, arg2) {
dump("HandleEvent("+eventObj+","+eventType+","+targetType+","+
entryNumber+","+arg1+","+arg2+")\n");
// Entry independent targets
if (action === "textlink") {
dump("textlink = "+arg1+"\n");
Load(arg1);
} else if (eventType === "click") {
if (targetType === "prompt") {
var outputElement = document.getElementById("output"+entryNumber);
var promptElement = document.getElementById("prompt"+entryNumber);
//dump(promptElement.style.getPropertyValue("text-decoration"));
if (outputElement.style.display == "none") {
outputElement.style.display = "block";
promptElement.style.setProperty("text-decoration","none","");
} else {
outputElement.style.display = "none";
promptElement.style.setProperty("text-decoration","underline","");
}
} else if (targetType === "command") {
var commandElement = document.getElementById(targetType+entryNumber);
var command = commandElement.firstChild.data;
dump("command = "+command+"\n\n");
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
} else {
// Targets which may be qualified only for current entry
if ((entryNumber >= 0) &&
(window.xmlterm.currentEntryNumber != entryNumber)) {
dump("NOT CURRENT COMMAND\n");
return (false);
}
var action = targetType;
if (action === "exec") {
if (window.commandMode === "window") {
action = "createln";
} else {
action = "sendln";
}
}
if (action === "send") {
dump("send = "+arg1+"\n");
window.xmlterm.SendText(arg1, document.cookie);
} else if (action === "sendln") {
if ((Math.abs(entryNumber)+1 == window.xmlterm.currentEntryNumber) &&
(arg2 != null)) {
// Current command
dump("sendln = "+arg2+"\n\n");
window.xmlterm.SendText("\025"+arg2+"\n", document.cookie);
} else {
// Not current command
dump("sendln = "+arg1+"\n\n");
window.xmlterm.SendText("\025"+arg1+"\n", document.cookie);
}
} else if (action === "createln") {
dump("createln = "+arg1+"\n\n");
newwin = NewXMLTerm(arg1+"\n");
}
}
}
return (false);
}
// Set history buffer count using form entry
function SetHistoryValue() {
var field = document.getElementById('InputValue');
return SetHistory(field.value);
}
// Set prompt using form entry
function SetPromptValue() {
var field = document.getElementById('InputValue');
return SetPrompt(field.value);
}
// Usage tips
var tips = new Array();
tips[0] = 'Click the SetPrompt button to use a cool Mozilla prompt from dmoz.org!';
tips[1] = '"js:SetPrompt(HTMLstring);" sets prompt to HTML string.';
tips[2] = 'Type "js:func(arg);" to execute inline Javascript function func.';
tips[3] = 'Inline Javascript ("js:...") can be used to produce HTML output.';
tips[4] = 'XMLterm supports full screen commands like "vi", "emacs -nw", and "less".';
tips[5] = 'Use "xls -i" for iconic display of directory contents.';
tips[6] = 'Use "xcat file" to display file.';
// Display random usage tip
// (should cease to operate after a few cycles;
// need to use Prefs to keep track of that)
function UsageTip() {
var tipCount = tips.length;
var ranval = Math.random();
var tipIndex = Math.floor(ranval * tipCount);
if (tipIndex >= tipCount) tipIndex = 0;
dump("xmlterm: UsageTip "+tipIndex+","+ranval+"\n");
var tiphead = document.getElementById('tiphead');
var tipdata = document.getElementById('tipdata');
tiphead.firstChild.data = "Tip:";
tipdata.firstChild.data = tips[tipIndex];
return false;
}
// Display more tips
function MoreTips() {
dump("xmlterm: MoreTips\n");
var moreTipsElement = document.getElementById('moretips');
var moreTipsFrame = document.getElementById('moretipsframe');
if (moreTipsFrame) {
// Remove more tips iframe
document.body.removeChild(moreTipsFrame);
moreTipsElement.firstChild.data = "More tips/news";
} else {
// Create more tips iframe
moreTipsFrame = document.createElement("iframe");
moreTipsFrame.setAttribute('ID', 'moretipsframe');
moreTipsFrame.setAttribute('CLASS', 'moretipsframe');
moreTipsFrame.setAttribute('WIDTH', '100%');
moreTipsFrame.setAttribute('SRC', 'http://xmlterm.org/newstips.html');
dump(moreTipsFrame);
// Insert more tips iframe in body
var sessionElement = document.getElementById('session');
document.body.insertBefore(moreTipsFrame, sessionElement);
moreTipsElement.firstChild.data = "Hide tips/news";
}
return false;
}
// onLoad event handler
function LoadHandler() {
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
UsageTip();
if (window.xmlterm) {
// XMLTerm already initialized
return (false);
}
dump("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in the window
window.xmlterm = xmltshell;
// Content window same as current window
var contentWindow = window;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(contentWindow, "", "");
//dump("LoadHandler:"+document.cookie+"\n");
dump("contentWindow="+contentWindow+"\n");
dump("document="+document+"\n");
dump("documentElement="+document.documentElement+"\n");
// Handle resize events
//contentWindow.addEventListener("onresize", Resize);
contentWindow.onresize = Resize;
// Set focus to appropriate frame
contentWindow.focus();
//contentWindow.xmlterm = xmlterm;
//dump(contentWindow.xmlterm);
// The following code is for testing IFRAMEs only
dump("[Main] "+window+"\n");
dump(window.screenX+", "+window.screenY+"\n");
dump(window.scrollX+", "+window.scrollY+"\n");
dump(window.pageXOffset+", "+window.pageYOffset+"\n");
dump("IFRAME checks\n");
var iframe = document.getElementById('iframe1');
dump("iframe="+iframe+"\n");
frames=document.frames;
dump("frames="+frames+"\n");
dump("frames.length="+frames.length+"\n");
framewin = frames[0];
dump("framewin="+framewin+"\n");
dump("framewin.document="+framewin.document+"\n");
dump(framewin.screenX+", "+framewin.screenY+"\n");
dump(framewin.scrollX+", "+framewin.scrollY+"\n");
dump(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
var body = framewin.document.getElementsByTagName("BODY")[0];
dump("body="+body+"\n");
var height= body.scrollHeight;
dump("height="+height+"\n");
// iframe.height = 800;
// iframe.width = 700;
// framewin.sizeToContent();
framewin.xmltshell = xmltshell;
dump(framewin.xmltshell+"\n");
dump("xmlterm: LoadHandler completed\n");
return (false);
}
</SCRIPT>
</HEAD>
<BODY onLoad="return LoadHandler();">
<TABLE FRAME=none BORDER=0>
<TBODY>
<TR><TD ALIGN=center>
<FORM NAME="XMLTERM form">
<INPUT TYPE="button" VALUE="Hide all output"
onClick="return HideAll();">
<INPUT TYPE="button" VALUE="Show all output"
onClick="return ShowAll();">
<INPUT TYPE="button" VALUE="SetHistory"
onClick="return SetHistoryValue();">
<INPUT TYPE="button" VALUE="SetPrompt" onClick="return SetPromptValue();">
<INPUT TYPE="button" VALUE="NewXMLTerm" onClick="return NewXMLTerm('');">
<BR>
Input Value:
<INPUT SIZE=50 TYPE="text" ID="InputValue"
VALUE="<img src='http:/dmoz.org/img/lizard2a.gif'>"
onFocus="return FormFocus();" onBlur="return FormBlur();">
</FORM>
</TABLE>
<SPAN CLASS="tiphead" ID="tiphead" STYLE="font-weight:bold"> &nbsp; </SPAN>
<SPAN CLASS="tipdata" ID="tipdata"> &nbsp; </SPAN>
<SPAN CLASS="moretips" ID="moretips" onClick="return MoreTips();">
More tips/news
</SPAN>
<P>
<!--
<IFRAME NAME="iframet" SRC="chrome://xmlterm/content/xmltblank.html"
FRAMEBORDER=0>
</IFRAME>
-->
<DIV CLASS="session" ID="session">
</DIV>
</BODY>
</HTML>

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

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

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

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

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

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

@ -1,67 +0,0 @@
/* xmltpage.css: default style sheet for xmlterm.html */
BODY { font-family: monaco, courier, elite, monospace;
background-color: #FFFFFF;
}
DIV, PRE, SPAN { margin: 0; padding-top: 0; padding-bottom: 0 }
PRE { font-family: monaco;
line-height: 120% }
/* Input components */
SPAN.prompt { color: blue }
SPAN.command { color: blue }
/* Error messages */
DIV.errmsg { color: red }
/* Explicit hyperlinks (underlined) */
DIV.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }
SPAN.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }
/* Imlicit hyperlinks (highlighted) */
SPAN.highlight { font-family: monaco; color: blue; cursor: hand }
SPAN.directory { font-family: monaco; color: blue; cursor: hand }
SPAN.executable { font-family: monaco; color: blue; cursor: hand }
SPAN.plainfile { font-family: monaco; color: blue; cursor: hand }
SPAN.imagefile { font-family: monaco; color: blue; cursor: hand }
SPAN.urlfile { font-family: monaco; color: blue; cursor: hand }
/* Screen display */
PRE.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.boldstyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.underlinestyle { text-decoration: underline; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.blinkstyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.inversestyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
/* Forms */
FORM { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.formhead { font-family: sans-serif; font-weight: bold }
/* Tips */
SPAN.tipdata { font-family: sans-serif; background-color: #DDDDDD }
TABLE.tiptable { background-color: #DDDDDD }
DIV.tipelement { font-family: sans-serif }
/* Help links */
SPAN.helphighlight { font-family: sans-serif; color: green; cursor: hand }
SPAN.helplink { font-family: sans-serif; color: blue; cursor: hand;
text-decoration: underline }
/* Level style */
DIV.intermediate {display: block}
DIV.beginner {display: none}
/* Icons style */
SPAN.noicons {display: inline}
SPAN.icons {display: none}
IMG.icons {display: none}
TR.icons {display: none}

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

@ -0,0 +1,124 @@
<!-- xmlterm.html: xmlterm page -->
<html>
<head>
<title>xmlterm page</title>
<link title="defaultstyle" rel="stylesheet" type="text/css"
href="chrome://xmlterm/skin/xmltpage.css">
<script language="JavaScript" src="XMLTermCommands.js">
</script>
</head>
<body onload="return LoadHandler();">
<form name="xmltform1">
<input type="button" value="New XMLTerm"
onClick="return NewXMLTerm('');">
<span class="helplink" onclick="return ExplainTip('level');">
Level:</span>
<select name="level" size=1 onchange="return UpdateSettings();">
<option value="beginner">beginner</option>
<option value="intermediate" selected>intermediate</option>
<option value="advanced">advanced</option>
</select>
&nbsp;
<span class="helplink" onclick="return ExplainTip('icons');">
Icons:</span>
<select name="icons" size=1 onchange="return UpdateSettings();">
<option value="off" selected>off</option>
<option value="on">on</option>
</select>
&nbsp;
<span class="helplink" onclick="return ExplainTip('windows');">
Windows:</span>
<select name="windows" size=1 onchange="return UpdateSettings();">
<option value="off" selected>off</option>
<option value="on">on</option>
</select>
<!--
<input type="button" value="Save Settings"
onClick="return SaveSettings();">
-->
<span class="helplink" id="aboutxmlterm" onclick="return AboutXMLTerm();">
About XMLTerm
</span>
<hr>
</form>
<div class="intermediate">
<div class="beginner">
<form name="xmltform2">
<center> <span class="formhead">Keyboard shortcuts</span> </center>
<table align=center>
<tr>
<td align=center> <span class="formhead">F1</span>
<td align=center> <span class="formhead">F2</span>
<td align=center> <span class="formhead">F7</span>
<td align=center> <span class="formhead">F8</span>
<td align=center> <span class="formhead">F9</span>
<tr>
<td align=center> <span class="formhead">ctl-Home</span>
<td align=center> <span class="formhead">ctl-End</span>
<tr>
<td><input type="button" value="Hide all output"
onClick="return F1Key();">
<td><input type="button" value="Show all output"
onClick="return F2Key();">
<td><input type="button" value="Explain tip"
onClick="return F7Key();">
<td><input type="button" value="New tip"
onClick="return F8Key();">
<td><input type="button" value="New XMLTerm"
onClick="return F9Key();">
</table>
<br>
<input type="button" value="Set History"
onClick="return SetHistoryValue();">
<input type="button" value="Set Prompt"
onClick="return SetPromptValue();">
<span class="formhead">Value:</span>
<input size=45 type="text" id="inputvalue"
value="<img src='http:/dmoz.org/img/lizard2a.gif'>"
onFocus="return FormFocus();" onBlur="return FormBlur();">
</form>
<hr>
</div>
<table id="xmlttip" width=100%>
<tr><td align=left valign=top nowrap>
<span class="helplink" id="tiphead" onclick="return NewTip();">
New Tip:
</span>
<td align=left valign=top>
<span class="tipdata" id="tipdata">
&nbsp;
</span>
<td align=right valign=top nowrap>
<span class="helplink" id="explaintip" onclick="return ExplainTip();">
Explain Tip
</span>
</table>
</div>
<br>
<!--
<iframe name="iframet" src="chrome://xmlterm/content/xmltblank.html"
frameborder=0>
</iframe>
-->
<div class="session" id="session">
</div>
</body>
</html>

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

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "MPL"); you may not use this file
except in compliance with the MPL. You may obtain a copy of
the MPL at http://www.mozilla.org/MPL/
Software distributed under the MPL is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the MPL for the specific language governing
rights and limitations under the MPL.
The Original Code is lineterm.
The Initial Developer of the Original Code is Ramalingam Saravanan.
Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
Contributor(s):
-->
<?xml-stylesheet href="chrome://xmlterm/skin/xmlterm.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<!DOCTYPE window>
<window id="xmlterm-window" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="StartupXMLTerm();"
title="xmlterm" align="vertical" width="586" height="412">
<html:script src="chrome://xmlterm/content/XMLTermChrome.js"></html:script>
<html:iframe id="content-frame" type="content" html:name="content"
html:src="chrome://xmlterm/content/xmlterm.html" flex="100%"/>
</window>

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

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "MPL"); you may not use this file
except in compliance with the MPL. You may obtain a copy of
the MPL at http://www.mozilla.org/MPL/
Software distributed under the MPL is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the MPL for the specific language governing
rights and limitations under the MPL.
The Original Code is lineterm.
The Initial Developer of the Original Code is Ramalingam Saravanan.
Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
Contributor(s):
-->
<?xml-stylesheet href="chrome://xmlterm/skin/xmlterm.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<!DOCTYPE window>
<window id="xmlterm-window" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="StartupXMLTerm();"
title="xmlterm2" align="vertical" width="740" height="484">
<html:script src="chrome://xmlterm/content/XMLTermChrome.js"></html:script>
<html:iframe id="content-frame2" type="content" html:name="content2"
html:src="about:blank" flex="100%"/>
<html:iframe id="content-frame" type="content" html:name="content"
html:src="chrome://xmlterm/content/xmlterm.html" flex="100%"/>
</window>