зеркало из https://github.com/mozilla/pjs.git
--NOT PART OF DEFAULT BUILD--
XMLterm changes only. Cleaned up and updated the code.
This commit is contained in:
Родитель
292209737d
Коммит
e32e4ec978
|
@ -51,48 +51,57 @@ interface mozIXMLTermShell : nsISupports
|
|||
* @param args argument string to be passed to XMLterm
|
||||
* (at the moment this just contains any initial input data)
|
||||
*/
|
||||
void Init(in nsIDOMWindowInternal aContentWin, in wstring URL, in wstring args);
|
||||
void init(in nsIDOMWindowInternal aContentWin, in wstring URL, in wstring args);
|
||||
|
||||
/** Closes XMLterm, freeing resources
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
void Close(in wstring aCookie);
|
||||
void close(in wstring aCookie);
|
||||
|
||||
/** Polls for readable data from XMLterm
|
||||
*/
|
||||
void Poll();
|
||||
void poll();
|
||||
|
||||
/** Resizes XMLterm to match a resized window.
|
||||
*/
|
||||
void Resize();
|
||||
void resize();
|
||||
|
||||
/** Writes string to terminal as if the user had typed it (command input)
|
||||
* @param buf string to be transmitted to terminal
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
void SendText(in wstring aString, in wstring aCookie);
|
||||
void sendText(in wstring aString, in wstring aCookie);
|
||||
|
||||
/** Sets command history buffer count
|
||||
* @param aHistory history buffer count
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
void SetHistory(in long aHistory, in wstring aCookie);
|
||||
void setHistory(in long aHistory, in wstring aCookie);
|
||||
|
||||
/** Sets command prompt
|
||||
* @param aPrompt command prompt string (HTML)
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
void SetPrompt(in wstring aPrompt, in wstring aCookie);
|
||||
void setPrompt(in wstring aPrompt, in wstring aCookie);
|
||||
|
||||
/** Exports HTML to file, with META REFRESH, if refreshSeconds is non-zero.
|
||||
* Nothing is done if display has not changed since last export, unless
|
||||
* forceExport is true. Returns true if export actually takes place.
|
||||
* If filename is a null string, HTML is written to STDERR.
|
||||
*/
|
||||
boolean exportHTML(in wstring aFilename, in long permissions,
|
||||
in wstring style, in unsigned long refreshSeconds,
|
||||
in boolean forceRefresh, in wstring aCookie);
|
||||
|
||||
/** Ignore key press events
|
||||
* (workaround for form input being transmitted to xmlterm)
|
||||
* @param aIgnore ignore flag (true/false)
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
void IgnoreKeyPress(in boolean aIgnore, in wstring aCookie);
|
||||
void ignoreKeyPress(in boolean aIgnore, in wstring aCookie);
|
||||
|
||||
/** Exit browser, closing all windows (not yet implemented)
|
||||
*/
|
||||
void Exit();
|
||||
void exit();
|
||||
};
|
||||
|
||||
|
|
|
@ -131,7 +131,16 @@ interface mozIXMLTerminal : nsISupports
|
|||
*/
|
||||
void resize();
|
||||
|
||||
/** Shows the caret and make it editable.
|
||||
/** Exports HTML to file, with META REFRESH, if refreshSeconds is non-zero.
|
||||
* Nothing is done if display has not changed since last export, unless
|
||||
* forceExport is true. Returns true if export actually takes place.
|
||||
* If filename is a null string, HTML is written to STDERR.
|
||||
*/
|
||||
boolean exportHTML(in wstring aFilename, in long permissions,
|
||||
in wstring style, in unsigned long refreshSeconds,
|
||||
in boolean forceRefresh);
|
||||
|
||||
/** Shows the caret and make it editable.
|
||||
*/
|
||||
void showCaret();
|
||||
|
||||
|
|
|
@ -624,7 +624,8 @@ mozXMLTermMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
XMLT_LOG(mozXMLTermMouseListener::MouseClick,50, ("buttonCode=%d\n",
|
||||
buttonCode));
|
||||
|
||||
#ifndef NO_WORKAROUND
|
||||
#if 0
|
||||
// NO MORE NEED FOR THIS WORKAROUND!
|
||||
// Without this workaround, clicking on the xmlterm window to give it
|
||||
// focus fails position the cursor at the end of the last line
|
||||
// (For some reason, the MouseDown event causes the cursor to be positioned
|
||||
|
@ -646,6 +647,18 @@ mozXMLTermMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
if (NS_FAILED(result) || !selection)
|
||||
return NS_OK; // Do not consume mouse event
|
||||
|
||||
PRBool isCollapsed;
|
||||
result = selection->GetIsCollapsed(&isCollapsed);
|
||||
if (NS_FAILED(result))
|
||||
return NS_OK; // Do not consume mouse event
|
||||
|
||||
XMLT_LOG(mozXMLTermMouseListener::MouseClick,50, ("isCollapsed=%d\n",
|
||||
isCollapsed));
|
||||
|
||||
// If non-collapsed selection, do not collapse it
|
||||
if (!isCollapsed)
|
||||
return NS_OK;
|
||||
|
||||
// Locate selection range
|
||||
nsCOMPtr<nsIDOMNSUIEvent> uiEvent (do_QueryInterface(mouseEvent));
|
||||
if (!uiEvent)
|
||||
|
@ -662,7 +675,7 @@ mozXMLTermMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK; // Do not consume mouse event
|
||||
|
||||
(void)selection->Collapse(parentNode, offset);
|
||||
#endif // !NO_WORKAROUND
|
||||
#endif
|
||||
|
||||
return NS_OK; // Do not consume mouse event
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIFileStreams.h"
|
||||
|
||||
#include "nsITextContent.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
|
@ -64,6 +67,7 @@
|
|||
// mozXMLTermSession definition
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
static const char* kWhitespace=" \b\t\r\n";
|
||||
static const PRUnichar kNBSP = 160;
|
||||
|
||||
const char* const mozXMLTermSession::sessionElementNames[] = {
|
||||
"session",
|
||||
|
@ -113,6 +117,7 @@ mozXMLTermSession::mozXMLTermSession() :
|
|||
mXMLTerminal(nsnull),
|
||||
|
||||
mBodyNode(nsnull),
|
||||
mMenusNode(nsnull),
|
||||
mSessionNode(nsnull),
|
||||
mCurrentDebugNode(nsnull),
|
||||
|
||||
|
@ -125,7 +130,7 @@ mozXMLTermSession::mozXMLTermSession() :
|
|||
|
||||
mEntryHasOutput(PR_FALSE),
|
||||
|
||||
mPromptSpanNode(nsnull),
|
||||
mPromptTextNode(nsnull),
|
||||
mCommandSpanNode(nsnull),
|
||||
mInputTextNode(nsnull),
|
||||
|
||||
|
@ -158,6 +163,9 @@ mozXMLTermSession::mozXMLTermSession() :
|
|||
|
||||
mRestoreInputEcho(PR_FALSE),
|
||||
|
||||
mCountExportHTML(0),
|
||||
mLastExportHTML(nsAutoString()),
|
||||
|
||||
mShellPrompt(nsAutoString()),
|
||||
mPromptHTML(nsAutoString()),
|
||||
mFragmentBuffer(nsAutoString())
|
||||
|
@ -224,6 +232,15 @@ NS_IMETHODIMP mozXMLTermSession::Init(mozIXMLTerminal* aXMLTerminal,
|
|||
if (NS_FAILED(result) || !mBodyNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> menusElement;
|
||||
nsAutoString menusID( NS_LITERAL_STRING("menus") );
|
||||
result = vDOMHTMLDocument->GetElementById(menusID,
|
||||
getter_AddRefs(menusElement));
|
||||
|
||||
if (NS_SUCCEEDED(result) && menusElement) {
|
||||
mMenusNode = do_QueryInterface(menusElement);
|
||||
}
|
||||
|
||||
// Use body node as session node by default
|
||||
mSessionNode = mBodyNode;
|
||||
|
||||
|
@ -275,7 +292,7 @@ NS_IMETHODIMP mozXMLTermSession::Finalize(void)
|
|||
|
||||
mXMLTermStream = nsnull;
|
||||
|
||||
mPromptSpanNode = nsnull;
|
||||
mPromptTextNode = nsnull;
|
||||
mCommandSpanNode = nsnull;
|
||||
mInputTextNode = nsnull;
|
||||
|
||||
|
@ -283,6 +300,7 @@ NS_IMETHODIMP mozXMLTermSession::Finalize(void)
|
|||
mCurrentEntryNode = nsnull;
|
||||
|
||||
mBodyNode = nsnull;
|
||||
mMenusNode = nsnull;
|
||||
mSessionNode = nsnull;
|
||||
mCurrentDebugNode = nsnull;
|
||||
|
||||
|
@ -509,9 +527,24 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
|
|||
XMLT_LOG(mozXMLTermSession::ReadAll,62,
|
||||
("Terminating screen mode\n"));
|
||||
|
||||
// Uncollapse non-screen stuff
|
||||
nsAutoString attName(NS_LITERAL_STRING("xmlt-block-collapsed"));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> menusElement = do_QueryInterface(mMenusNode);
|
||||
|
||||
if (NS_SUCCEEDED(result) && menusElement) {
|
||||
menusElement->RemoveAttribute(attName);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> sessionElement = do_QueryInterface(mSessionNode);
|
||||
|
||||
if (sessionElement) {
|
||||
sessionElement->RemoveAttribute(attName);
|
||||
}
|
||||
|
||||
// Delete screen element
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
mSessionNode->RemoveChild(mScreenNode, getter_AddRefs(resultNode));
|
||||
mBodyNode->RemoveChild(mScreenNode, getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
mScreenNode = nsnull;
|
||||
|
@ -613,7 +646,7 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
|
|||
opvals, buf_row));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
result = mSessionNode->RemoveChild(mScreenNode,
|
||||
result = mBodyNode->RemoveChild(mScreenNode,
|
||||
getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(result))
|
||||
break;
|
||||
|
@ -1107,6 +1140,7 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
|
|||
|
||||
selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
|
||||
nsISelectionController::SELECTION_FOCUS_REGION);
|
||||
|
||||
}
|
||||
|
||||
// Show caret
|
||||
|
@ -1119,6 +1153,115 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
|
|||
}
|
||||
|
||||
|
||||
/** Exports HTML to file, with META REFRESH, if refreshSeconds is non-zero.
|
||||
* Nothing is done if display has not changed since last export, unless
|
||||
* forceExport is true. Returns true if export actually takes place.
|
||||
* If filename is a null string, HTML is written to STDERR.
|
||||
*/
|
||||
NS_IMETHODIMP mozXMLTermSession::ExportHTML(const PRUnichar* aFilename,
|
||||
PRInt32 permissions,
|
||||
const PRUnichar* style,
|
||||
PRUint32 refreshSeconds,
|
||||
PRBool forceExport,
|
||||
PRBool* exported)
|
||||
{
|
||||
nsresult result;
|
||||
|
||||
if (!aFilename || !exported)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*exported = PR_FALSE;
|
||||
|
||||
if (forceExport)
|
||||
mLastExportHTML.SetLength(0);
|
||||
|
||||
nsAutoString indentString; indentString.SetLength(0);
|
||||
nsAutoString htmlString;
|
||||
result = ToHTMLString(mBodyNode, indentString, htmlString,
|
||||
PR_TRUE, PR_FALSE );
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (htmlString.Equals(mLastExportHTML))
|
||||
return NS_OK;
|
||||
|
||||
mLastExportHTML.Assign( htmlString );
|
||||
mCountExportHTML++;
|
||||
|
||||
nsAutoString filename( aFilename );
|
||||
|
||||
if (filename.Length() == 0) {
|
||||
// Write to STDERR
|
||||
char* htmlCString = ToNewCString(htmlString);
|
||||
fprintf(stderr, "mozXMLTermSession::ExportHTML:\n%s\n\n", htmlCString);
|
||||
nsCRT::free(htmlCString);
|
||||
|
||||
*exported = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Copy HTML to local file
|
||||
nsCOMPtr<nsILocalFile> localFile = do_CreateInstance( NS_LOCAL_FILE_CONTRACTID, &result);
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
XMLT_LOG(mozXMLTermSession::ExportHTML,0,
|
||||
("Exporting %d\n", mCountExportHTML));
|
||||
|
||||
result = localFile->InitWithUnicodePath(filename.get());
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 ioFlags = PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE;
|
||||
|
||||
nsCOMPtr<nsIOutputStream> outStream;
|
||||
result = NS_NewLocalFileOutputStream(getter_AddRefs(outStream),
|
||||
localFile, ioFlags, permissions);
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 writeCount;
|
||||
|
||||
nsCAutoString cString( "<html>\n<head>\n" );
|
||||
|
||||
if (refreshSeconds > 0) {
|
||||
cString.Append("<META HTTP-EQUIV='refresh' content='");
|
||||
cString.AppendInt(refreshSeconds);
|
||||
cString.Append("'>");
|
||||
}
|
||||
|
||||
cString.Append("<title>xmlterm page</title>\n");
|
||||
cString.Append("<link title='defaultstyle' rel='stylesheet' type='text/css' href='xmlt.css'>\n");
|
||||
|
||||
if (style) {
|
||||
cString.Append("<style type='text/css'>\n");
|
||||
cString.AppendWithConversion(style);
|
||||
cString.Append("</style>\n");
|
||||
}
|
||||
|
||||
cString.Append("<script language='JavaScript'>var exportCount=");
|
||||
cString.AppendInt(mCountExportHTML);
|
||||
cString.Append(";</script>\n");
|
||||
cString.Append("<script language='JavaScript' src='xmlt.js'></script>\n</head>");
|
||||
|
||||
cString.AppendWithConversion(htmlString);
|
||||
|
||||
cString.Append("</html>\n");
|
||||
|
||||
result = outStream->Write(cString.get(), cString.Length(),
|
||||
&writeCount);
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
result = outStream->Flush();
|
||||
|
||||
result = outStream->Close();
|
||||
|
||||
*exported = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** Aborts session by closing LineTerm and displays an error message
|
||||
* @param lineTermAux LineTermAux object to be closed
|
||||
* @param abortCode abort code string to dbe displayed
|
||||
|
@ -1182,7 +1325,14 @@ NS_IMETHODIMP mozXMLTermSession::DisplayInput(const nsString& aString,
|
|||
|
||||
XMLT_LOG(mozXMLTermSession::DisplayInput,70,("cursorCol=%d\n", cursorCol));
|
||||
|
||||
result = SetDOMText(mInputTextNode, aString);
|
||||
// If string terminates in whitespace, append NBSP for cursor positioning
|
||||
nsAutoString tempString( aString );
|
||||
if (aString.Last() == PRUnichar(' '))
|
||||
tempString += kNBSP;
|
||||
|
||||
// Display string
|
||||
result = SetDOMText(mInputTextNode, tempString);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -1218,20 +1368,15 @@ NS_IMETHODIMP mozXMLTermSession::DisplayInput(const nsString& aString,
|
|||
|
||||
} else {
|
||||
// Get the last bit of text in the prompt
|
||||
nsCOMPtr<nsIDOMNode> promptTextNode;
|
||||
result = mPromptSpanNode->GetLastChild(getter_AddRefs(promptTextNode));
|
||||
nsCOMPtr<nsIDOMText> domText (do_QueryInterface(mPromptTextNode));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDOMText> domText (do_QueryInterface(promptTextNode));
|
||||
|
||||
if (domText) {
|
||||
PRUint32 textLength;
|
||||
result = domText->GetLength(&textLength);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
XMLT_LOG(mozXMLTermSession::DisplayInput,72,
|
||||
("textLength=%d\n", textLength));
|
||||
result = selection->Collapse(promptTextNode, textLength);
|
||||
}
|
||||
if (domText) {
|
||||
PRUint32 textLength;
|
||||
result = domText->GetLength(&textLength);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
XMLT_LOG(mozXMLTermSession::DisplayInput,72,
|
||||
("textLength=%d\n", textLength));
|
||||
result = selection->Collapse(mPromptTextNode, textLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1899,8 +2044,13 @@ NS_IMETHODIMP mozXMLTermSession::AppendOutput(const nsString& aString,
|
|||
mOutputTextNode = textNode;
|
||||
mOutputTextOffset = 0;
|
||||
|
||||
// If string terminates in whitespace, append NBSP for cursor positioning
|
||||
nsAutoString tempString( aString );
|
||||
if (newline || (aString.Last() == PRUnichar(' ')))
|
||||
tempString += kNBSP;
|
||||
|
||||
// Display incomplete line
|
||||
result = SetDOMText(mOutputTextNode, aString);
|
||||
result = SetDOMText(mOutputTextNode, tempString);
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -1988,7 +2138,7 @@ NS_IMETHODIMP mozXMLTermSession::AppendOutput(const nsString& aString,
|
|||
currentStyle = strStyle[0];
|
||||
|
||||
mOutputTextOffset = 0;
|
||||
tagName.Assign(NS_LITERAL_STRING("span"));
|
||||
tagName.Assign(NS_LITERAL_STRING("pre"));
|
||||
|
||||
PR_ASSERT(strLength > 0);
|
||||
|
||||
|
@ -2857,6 +3007,7 @@ void mozXMLTermSession::PositionOutputCursor(mozILineTermAux* lineTermAux)
|
|||
|
||||
XMLT_LOG(mozXMLTermSession::PositionOutputCursor,80,("\n"));
|
||||
|
||||
PRBool dummyOutput = PR_FALSE;
|
||||
if (!mOutputTextNode) {
|
||||
// Append dummy output line
|
||||
nsCOMPtr<nsIDOMNode> spanNode, textNode;
|
||||
|
@ -2868,6 +3019,12 @@ void mozXMLTermSession::PositionOutputCursor(mozILineTermAux* lineTermAux)
|
|||
if (NS_FAILED(result) || !spanNode || !textNode)
|
||||
return;
|
||||
|
||||
// Display NBSP for cursor positioning
|
||||
nsAutoString tempString;
|
||||
tempString += kNBSP;
|
||||
SetDOMText(textNode, tempString);
|
||||
dummyOutput = PR_TRUE;
|
||||
|
||||
mOutputDisplayType = SPAN_DUMMY_NODE;
|
||||
mOutputDisplayNode = spanNode;
|
||||
mOutputTextNode = textNode;
|
||||
|
@ -2891,6 +3048,8 @@ void mozXMLTermSession::PositionOutputCursor(mozILineTermAux* lineTermAux)
|
|||
domText->GetData(text);
|
||||
|
||||
PRInt32 textOffset = text.Length();
|
||||
if (textOffset && dummyOutput) textOffset--;
|
||||
|
||||
if (lineTermAux && (mOutputDisplayType == PRE_STDIN_NODE)) {
|
||||
// Get cursor column
|
||||
PRInt32 cursorCol = 0;
|
||||
|
@ -3152,20 +3311,25 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
|
|||
nsAutoString classAttribute;
|
||||
|
||||
// Create prompt element
|
||||
nsCOMPtr<nsIDOMNode> newPromptSpanNode;
|
||||
nsCOMPtr<nsIDOMNode> promptSpanNode;
|
||||
tagName.Assign(NS_LITERAL_STRING("span"));
|
||||
name.AssignWithConversion(sessionElementNames[PROMPT_ELEMENT]);
|
||||
result = NewElement(tagName, name, mCurrentEntryNumber,
|
||||
inputNode, newPromptSpanNode);
|
||||
if (NS_FAILED(result) || !newPromptSpanNode) {
|
||||
inputNode, promptSpanNode);
|
||||
if (NS_FAILED(result) || !promptSpanNode) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mPromptSpanNode = newPromptSpanNode;
|
||||
|
||||
// Add event attributes to prompt element
|
||||
result = SetEventAttributes(name, mCurrentEntryNumber,
|
||||
mPromptSpanNode);
|
||||
promptSpanNode);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
result = mXMLTerminal->GetDOMDocument(getter_AddRefs(domDoc));
|
||||
if (NS_FAILED(result) || !domDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
|
||||
if (mPromptHTML.Length() == 0) {
|
||||
|
||||
|
@ -3177,19 +3341,23 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
|
|||
tagName.Assign(NS_LITERAL_STRING("span"));
|
||||
name.Assign(NS_LITERAL_STRING("noicons"));
|
||||
result = NewElementWithText(tagName, name, -1,
|
||||
mPromptSpanNode, spanNode, textNode);
|
||||
promptSpanNode, spanNode, textNode);
|
||||
if (NS_FAILED(result) || !spanNode || !textNode) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Set prompt text
|
||||
result = SetDOMText(textNode, aPrompt);
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
// Strip single trailing space, if any, from prompt string
|
||||
int spaceOffset = aPrompt.Length();
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
result = mXMLTerminal->GetDOMDocument(getter_AddRefs(domDoc));
|
||||
if (NS_FAILED(result) || !domDoc)
|
||||
if ((spaceOffset > 0) && (aPrompt.Last() == ((PRUnichar) ' ')))
|
||||
spaceOffset--;
|
||||
|
||||
nsAutoString promptStr;
|
||||
aPrompt.Left(promptStr, spaceOffset);
|
||||
|
||||
// Set prompt text
|
||||
result = SetDOMText(textNode, promptStr);
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Create IMG element
|
||||
|
@ -3205,31 +3373,16 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
|
|||
imgElement->SetAttribute(attName, attValue);
|
||||
|
||||
attName.Assign(NS_LITERAL_STRING("src"));
|
||||
attValue.Assign(NS_LITERAL_STRING("chrome://xmlterm/content/wheel.gif"));
|
||||
attValue.Assign(NS_LITERAL_STRING("chrome://xmlterm/skin/wheel.gif"));
|
||||
imgElement->SetAttribute(attName, attValue);
|
||||
|
||||
attName.Assign(NS_LITERAL_STRING("align"));
|
||||
attValue.Assign(NS_LITERAL_STRING("middle"));
|
||||
imgElement->SetAttribute(attName, attValue);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
|
||||
// Append IMG element
|
||||
nsCOMPtr<nsIDOMNode> imgNode = do_QueryInterface(imgElement);
|
||||
result = mPromptSpanNode->AppendChild(imgNode,
|
||||
getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Append text node containing single space
|
||||
nsCOMPtr<nsIDOMText> stubText;
|
||||
nsAutoString spaceStr(NS_LITERAL_STRING(" "));
|
||||
result = domDoc->CreateTextNode(spaceStr, getter_AddRefs(stubText));
|
||||
if (NS_FAILED(result) || !stubText)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> stubNode = do_QueryInterface(stubText);
|
||||
result = mPromptSpanNode->AppendChild(stubNode,
|
||||
result = promptSpanNode->AppendChild(imgNode,
|
||||
getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -3237,7 +3390,7 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
|
|||
#else // !DEFAULT_ICON_PROMPT
|
||||
// Create text node as child of prompt element
|
||||
nsCOMPtr<nsIDOMNode> textNode;
|
||||
result = NewTextNode(mPromptSpanNode, textNode);
|
||||
result = NewTextNode(promptSpanNode, textNode);
|
||||
|
||||
if (NS_FAILED(result) || !textNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -3250,10 +3403,24 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
|
|||
|
||||
} else {
|
||||
// User-specified HTML prompt
|
||||
result = InsertFragment(mPromptHTML, mPromptSpanNode,
|
||||
result = InsertFragment(mPromptHTML, promptSpanNode,
|
||||
mCurrentEntryNumber);
|
||||
}
|
||||
|
||||
// Append text node containing single NBSP
|
||||
nsCOMPtr<nsIDOMText> stubText;
|
||||
nsAutoString spaceStr(kNBSP);
|
||||
result = domDoc->CreateTextNode(spaceStr, getter_AddRefs(stubText));
|
||||
if (NS_FAILED(result) || !stubText)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> stubNode = do_QueryInterface(stubText);
|
||||
result = inputNode->AppendChild(stubNode, getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(result))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mPromptTextNode = stubNode;
|
||||
|
||||
// Create command element
|
||||
nsCOMPtr<nsIDOMNode> newCommandSpanNode;
|
||||
tagName.Assign(NS_LITERAL_STRING("span"));
|
||||
|
@ -3315,13 +3482,29 @@ NS_IMETHODIMP mozXMLTermSession::NewScreen(void)
|
|||
nsAutoString tagName(NS_LITERAL_STRING("div"));
|
||||
nsAutoString name(NS_LITERAL_STRING("screen"));
|
||||
result = NewElement(tagName, name, 0,
|
||||
mSessionNode, divNode);
|
||||
mBodyNode, divNode);
|
||||
|
||||
if (NS_FAILED(result) || !divNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mScreenNode = divNode;
|
||||
|
||||
// Collapse non-screen stuff
|
||||
nsAutoString attName(NS_LITERAL_STRING("xmlt-block-collapsed"));
|
||||
nsAutoString attValue(NS_LITERAL_STRING("true"));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> menusElement = do_QueryInterface(mMenusNode);
|
||||
|
||||
if (NS_SUCCEEDED(result) && menusElement) {
|
||||
menusElement->SetAttribute(attName, attValue);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> sessionElement = do_QueryInterface(mSessionNode);
|
||||
|
||||
if (sessionElement) {
|
||||
sessionElement->SetAttribute(attName, attValue);
|
||||
}
|
||||
|
||||
// Create individual row elements
|
||||
nsCOMPtr<nsIDOMNode> resultNode;
|
||||
PRInt32 row;
|
||||
|
@ -4147,6 +4330,8 @@ NS_IMETHODIMP mozXMLTermSession::ToHTMLString(nsIDOMNode* aNode,
|
|||
if (domText) {
|
||||
// Text node
|
||||
domText->GetData(htmlString);
|
||||
htmlString.ReplaceChar(kNBSP, ' ');
|
||||
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(aNode);
|
||||
|
||||
|
|
|
@ -86,6 +86,18 @@ class mozXMLTermSession
|
|||
*/
|
||||
NS_IMETHOD ReadAll(mozILineTermAux* lineTermAux, PRBool& processedData);
|
||||
|
||||
/** Exports HTML to file, with META REFRESH, if refreshSeconds is non-zero.
|
||||
* Nothing is done if display has not changed since last export, unless
|
||||
* forceExport is true. Returns true if export actually takes place.
|
||||
* If filename is a null string, HTML is written to STDERR.
|
||||
*/
|
||||
NS_IMETHOD ExportHTML(const PRUnichar* aFilename,
|
||||
PRInt32 permissions,
|
||||
const PRUnichar* style,
|
||||
PRUint32 refreshSeconds,
|
||||
PRBool forceExport,
|
||||
PRBool* exported);
|
||||
|
||||
/** Aborts session by closing LineTerm and displays an error message
|
||||
* @param lineTermAux LineTermAux object to be closed
|
||||
* @param abortCode abort code string to be displayed
|
||||
|
@ -118,8 +130,8 @@ class mozXMLTermSession
|
|||
*/
|
||||
NS_IMETHOD SetPrompt(const PRUnichar* aPrompt);
|
||||
|
||||
/** Gets flag denoting whether terminal is in full screen mode
|
||||
* @param aFlag (output) screen mode flag
|
||||
/** Gets webcast filename
|
||||
* @param aFilename (output) webcast filename
|
||||
*/
|
||||
NS_IMETHOD GetScreenMode(PRBool* aFlag);
|
||||
|
||||
|
@ -593,6 +605,9 @@ protected:
|
|||
/** BODY node of document containing XMLterm */
|
||||
nsCOMPtr<nsIDOMNode> mBodyNode;
|
||||
|
||||
/** XMLterm menus node */
|
||||
nsCOMPtr<nsIDOMNode> mMenusNode;
|
||||
|
||||
/** XMLterm session node */
|
||||
nsCOMPtr<nsIDOMNode> mSessionNode;
|
||||
|
||||
|
@ -618,13 +633,13 @@ protected:
|
|||
/** flag indicating whether current entry has output data */
|
||||
PRBool mEntryHasOutput;
|
||||
|
||||
/** span node for current command prompt (is this necessary?) */
|
||||
nsCOMPtr<nsIDOMNode> mPromptSpanNode;
|
||||
/** text node terminating current command prompt */
|
||||
nsCOMPtr<nsIDOMNode> mPromptTextNode;
|
||||
|
||||
/** span node for current command input (is this necessary?) */
|
||||
/** span node for current command input */
|
||||
nsCOMPtr<nsIDOMNode> mCommandSpanNode;
|
||||
|
||||
/** text node for current command input (is this necessary?) */
|
||||
/** text node for current command input */
|
||||
nsCOMPtr<nsIDOMNode> mInputTextNode;
|
||||
|
||||
|
||||
|
@ -700,6 +715,14 @@ protected:
|
|||
/** restore input echo flag */
|
||||
PRBool mRestoreInputEcho;
|
||||
|
||||
|
||||
/** count of exported HTML */
|
||||
PRInt32 mCountExportHTML;
|
||||
|
||||
/** last exported HTML */
|
||||
nsString mLastExportHTML;
|
||||
|
||||
|
||||
/** shell prompt string */
|
||||
nsString mShellPrompt;
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ mozXMLTermShell::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|||
debugStr = nsnull;
|
||||
}
|
||||
|
||||
tlog_init(stderr);
|
||||
tlog_set_level(XMLT_TLOG_MODULE, messageLevel, debugStr);
|
||||
mLoggingInitialized = PR_TRUE;
|
||||
}
|
||||
|
@ -184,6 +185,33 @@ NS_IMETHODIMP mozXMLTermShell::SetPrompt(const PRUnichar* aPrompt,
|
|||
}
|
||||
|
||||
|
||||
/** Exports HTML to file, with META REFRESH, if refreshSeconds is non-zero.
|
||||
* Nothing is done if display has not changed since last export, unless
|
||||
* forceExport is true. Returns true if export actually takes place.
|
||||
* If filename is a null string, HTML is written to STDERR.
|
||||
*/
|
||||
NS_IMETHODIMP mozXMLTermShell::ExportHTML(const PRUnichar* aFilename,
|
||||
PRInt32 permissions,
|
||||
const PRUnichar* style,
|
||||
PRUint32 refreshSeconds,
|
||||
PRBool forceExport,
|
||||
const PRUnichar* aCookie,
|
||||
PRBool* exported)
|
||||
{
|
||||
if (!mXMLTerminal)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsresult result;
|
||||
PRBool matchesCookie;
|
||||
result = mXMLTerminal->MatchesCookie(aCookie, &matchesCookie);
|
||||
if (NS_FAILED(result) || !matchesCookie)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return mXMLTerminal->ExportHTML( aFilename, permissions, style,
|
||||
refreshSeconds, forceExport,
|
||||
exported);
|
||||
}
|
||||
|
||||
/** Ignore key press events
|
||||
* (workaround for form input being transmitted to xmlterm)
|
||||
* @param aIgnore ignore flag (PR_TRUE/PR_FALSE)
|
||||
|
|
|
@ -769,7 +769,7 @@ NS_IMETHODIMP mozXMLTerminal::Paste()
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// DataFlavors to get out of transferable
|
||||
trans->AddDataFlavor(kHTMLMime);
|
||||
// trans->AddDataFlavor(kHTMLMime); // Cannot handle HTML yet
|
||||
trans->AddDataFlavor(kUnicodeMime);
|
||||
|
||||
// Get data from clipboard
|
||||
|
@ -1015,6 +1015,26 @@ NS_IMETHODIMP mozXMLTerminal::Resize(void)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Exports HTML to file, with META REFRESH, if refreshSeconds is non-zero.
|
||||
* Nothing is done if display has not changed since last export, unless
|
||||
* forceExport is true. Returns true if export actually takes place.
|
||||
* If filename is a null string, HTML is written to STDERR.
|
||||
*/
|
||||
NS_IMETHODIMP mozXMLTerminal::ExportHTML(const PRUnichar* aFilename,
|
||||
PRInt32 permissions,
|
||||
const PRUnichar* style,
|
||||
PRUint32 refreshSeconds,
|
||||
PRBool forceExport,
|
||||
PRBool* exported)
|
||||
{
|
||||
if (!mXMLTermSession)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return mXMLTermSession->ExportHTML( aFilename, permissions, style,
|
||||
refreshSeconds, forceExport,
|
||||
exported);
|
||||
}
|
||||
|
||||
// nsIWebProgressListener methods
|
||||
NS_IMETHODIMP
|
||||
mozXMLTerminal::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
|
|
|
@ -68,10 +68,6 @@ ifeq ($(OS_ARCH),FreeBSD)
|
|||
DEFINES += -DBSDFAMILY
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk)
|
||||
USE_GTK_WIDGETS = 1
|
||||
endif
|
||||
|
||||
#
|
||||
# Netscape Portable Runtime options
|
||||
#
|
||||
|
@ -79,9 +75,15 @@ ifdef STAND_ALONE
|
|||
ifdef USE_NCURSES
|
||||
DEFINES += -DUSE_NCURSES
|
||||
endif
|
||||
|
||||
else
|
||||
# Use NSPR base
|
||||
USE_NSPR_BASE = 1
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk)
|
||||
USE_GTK_WIDGETS = 1
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifdef USE_GTK_WIDGETS
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
xmlterm.jar:
|
||||
content/xmlterm/contents.rdf (ui/content/contents.rdf)
|
||||
content/xmlterm/xmlterm.xul (ui/content/xmlterm.xul)
|
||||
content/xmlterm/xmlterm.html (ui/content/xmlterm.html)
|
||||
content/xmlterm/xmltermAbout.html (ui/content/xmltermAbout.html)
|
||||
content/xmlterm/xmltermTips.html (ui/content/xmltermTips.html)
|
||||
content/xmlterm/XMLTermChrome.js (ui/content/XMLTermChrome.js)
|
||||
content/xmlterm/XMLTermCommands.js (ui/content/XMLTermCommands.js)
|
||||
content/xmlterm/xmltermOverlay.xul (ui/content/xmltermOverlay.xul)
|
||||
content/xmlterm/xmltermOverlay.js (ui/content/xmltermOverlay.js)
|
||||
locale/en-US/xmlterm/contents.rdf (ui/locale/en-US/contents.rdf)
|
||||
locale/en-US/xmlterm/xmltermOverlay.dtd (ui/locale/en-US/xmltermOverlay.dtd)
|
||||
skin/modern/xmlterm/contents.rdf (ui/skin/contents.rdf)
|
||||
content/xmlterm/xmlterm.css (ui/skin/xmlterm.css)
|
||||
content/xmlterm/xmltpage.css (ui/skin/xmltpage.css)
|
||||
content/xmlterm/wheel.gif (ui/skin/wheel.gif)
|
|
@ -1143,18 +1143,49 @@ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf,
|
|||
param3 = (paramCount > 2) ? paramValues[2] : 0;
|
||||
|
||||
switch (termChar) {
|
||||
int streamOpcodes;
|
||||
int streamOpcodes, nRows, nCols, sprint_len;
|
||||
char sprint_buf[81];
|
||||
|
||||
case U_A_CHAR: /* Send XMLterm device attributes */
|
||||
case U_B_CHAR: /* Send XMLterm device attributes (Bourne shell format) */
|
||||
case U_C_CHAR: /* Send XMLterm device attributes (C shell format) */
|
||||
LTERM_LOG(ltermProcessXMLTermSequence,52,("Sending device attributes\n"));
|
||||
if (ltermSendChar(lts, "\033{?", 3) != 0)
|
||||
return -1;
|
||||
|
||||
|
||||
nRows = lts->nRows;
|
||||
nCols = lts->nCols;
|
||||
|
||||
if ((nRows >= 0) && (nRows < 10000) && (nCols >= 0) && (nCols < 10000)) {
|
||||
|
||||
if (termChar == U_C_CHAR) {
|
||||
/* C shell format */
|
||||
|
||||
sprint_len = sprintf(sprint_buf, "setenv LINES %d;setenv COLUMNS %d;setenv LTERM_COOKIE ", nRows, nCols);
|
||||
|
||||
} else {
|
||||
|
||||
sprint_len = sprintf(sprint_buf, "LINES=%d;COLUMNS=%d;LTERM_COOKIE=", nRows, nCols);
|
||||
}
|
||||
|
||||
if (sprint_len > 80) {
|
||||
LTERM_ERROR("ltermProcessXMLTermSequence: Error - sprintf buffer overflow\n");
|
||||
}
|
||||
|
||||
if (ltermSendChar(lts, sprint_buf, strlen(sprint_buf)) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(lts->cookie) > 0) {
|
||||
if (ltermSendChar(lts, lts->cookie, strlen(lts->cookie)) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (termChar == U_B_CHAR) {
|
||||
const char exportStr[] = ";export LINES COLUMNS LTERM_COOKIE";
|
||||
if (ltermSendChar(lts, exportStr, strlen(exportStr)) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ltermSendChar(lts, "\n", 1) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
/* TRACELOG global variable structure */
|
||||
TlogGlobal tlogGlobal;
|
||||
|
||||
static int initGlobal = 0;
|
||||
|
||||
/** Initializes all TRACELOG operations and sets filestream for trace/log
|
||||
* output. Setting filestream to NULL suppresses all output.
|
||||
* (documented in tracelog.h)
|
||||
|
@ -61,6 +63,12 @@ void tlog_init(FILE* fileStream)
|
|||
fprintf(stderr, "tlog_init:\n");
|
||||
#endif
|
||||
|
||||
/* Do not re-initialize */
|
||||
if (initGlobal)
|
||||
return;
|
||||
|
||||
initGlobal = 1;
|
||||
|
||||
/* Error output stream */
|
||||
tlogGlobal.errorStream = fileStream;
|
||||
|
||||
|
@ -71,6 +79,8 @@ void tlog_init(FILE* fileStream)
|
|||
tlogGlobal.messageLevel[imodule] = 0;
|
||||
tlogGlobal.functionList[imodule] = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,11 +102,6 @@ int tlog_set_level(int imodule, int messageLevel, const char *functionList)
|
|||
/* Message level */
|
||||
tlogGlobal.messageLevel[imodule] = messageLevel;
|
||||
|
||||
if (messageLevel > 0) {
|
||||
tlog_warning("tlog_set_level: module %d, messageLevel=%d\n",
|
||||
imodule, messageLevel);
|
||||
}
|
||||
|
||||
/* Free function list string */
|
||||
free(tlogGlobal.functionList[imodule]);
|
||||
|
||||
|
@ -135,6 +140,11 @@ int tlog_set_level(int imodule, int messageLevel, const char *functionList)
|
|||
}
|
||||
}
|
||||
|
||||
if (messageLevel > 0) {
|
||||
tlog_warning("tlog_set_level: module %d, messageLevel=%d\n",
|
||||
imodule, messageLevel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -151,11 +161,10 @@ int tlog_test(int imodule, char *procstr, int level)
|
|||
if ((imodule < 0) || (imodule >= TLOG_MAXMODULES))
|
||||
return 0;
|
||||
|
||||
if ( (level%10 <= tlogGlobal.messageLevel[imodule]%10) &&
|
||||
( (level <= tlogGlobal.messageLevel[imodule]) ||
|
||||
if ( (level <= tlogGlobal.messageLevel[imodule]) ||
|
||||
((tlogGlobal.functionList[imodule] != NULL) &&
|
||||
( (strstr(tlogGlobal.functionList[imodule],procstr) != NULL) ||
|
||||
(strstr(procstr,tlogGlobal.functionList[imodule]) != NULL)) ) )) {
|
||||
(strstr(procstr,tlogGlobal.functionList[imodule]) != NULL)) ) ) {
|
||||
/* Display message */
|
||||
#if defined(USE_NSPR_BASE) && !defined(DEBUG_LTERM)
|
||||
PR_LogPrint("%s%2d: ", procstr, level);
|
||||
|
|
|
@ -55,6 +55,10 @@ SIMPLE_PROGRAMS = lterm ptytest unitest utf8conv
|
|||
# Defines
|
||||
DEFINES =
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../lineterm \
|
||||
$(NULL)
|
||||
|
||||
# Libraries to be linked
|
||||
ifeq ($(OS_ARCH),FreeBSD)
|
||||
PTHREADLIBOPT = -pthread
|
||||
|
|
|
@ -80,6 +80,7 @@ XMLTERM_SCRIPTS = \
|
|||
$(srcdir)/xmlterm \
|
||||
$(srcdir)/xls \
|
||||
$(srcdir)/xcat \
|
||||
$(srcdir)/xenv \
|
||||
$(NULL)
|
||||
|
||||
libs::
|
||||
|
@ -89,7 +90,8 @@ xpi::
|
|||
zip $(DIST)/bin/$(XPIFILE) install.js
|
||||
cd $(DIST); zip -g bin/$(XPIFILE) \
|
||||
bin/xcat \
|
||||
bin/xls
|
||||
bin/xls \
|
||||
bin/xenv
|
||||
cd $(DIST)/bin; zip -g $(XPIFILE) \
|
||||
components/libxmlterm.so \
|
||||
components/xmlterm.xpt \
|
||||
|
|
|
@ -1,191 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# xcat: an XMLterm wrapper for the UNIX "cat" command
|
||||
# Usage: xcat [-h|--height]
|
||||
|
||||
use Cwd;
|
||||
use Getopt::Long;
|
||||
|
||||
Getopt::Long::config('bundling');
|
||||
|
||||
if (!@ARGV) {
|
||||
print STDERR "Usage: xcat [--height <pixels>] <file1> <URL2> ...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
&GetOptions("height|h=i");
|
||||
|
||||
my $height = 240;
|
||||
$height = $opt_height if $opt_height;
|
||||
|
||||
my $cookie = $ENV{LTERM_COOKIE}; # XMLTerm cookie
|
||||
|
||||
my $dir = cwd();
|
||||
|
||||
foreach my $url (@ARGV) { # for each argument
|
||||
my ($scheme, $username, $host, $port, $pathname);
|
||||
|
||||
# Check if argument is a valid URL
|
||||
if ( $url =~ m%\b # initiator
|
||||
([a-zA-Z]\w*)?: # scheme
|
||||
(?=/) # lookahead
|
||||
(?:// # slashpair
|
||||
(?:([\w.]+)@)? # username
|
||||
([\w\-]+(?:\.[\w\-]+)*)? # host
|
||||
(?::(\d+))? # port
|
||||
)?
|
||||
(/|/[^/\s]\S*?)? # pathname
|
||||
(?=>|\"|\'|\s|[.,!](?:\s|\Z)|\Z) # terminator (look ahead)
|
||||
%x ) {
|
||||
($scheme, $username, $host, $port, $pathname) = ($1, $2, $3, $4, $5);
|
||||
|
||||
## print STDERR "URL: scheme=$scheme, username=$username, host=$host, port=$port, pathname=$pathname\n";
|
||||
|
||||
} else {
|
||||
# Not an URL; assume it is a local file
|
||||
|
||||
# Prepend current working directory, if need be, to make full pathname
|
||||
$url = $dir . "/" . $url if ($url and !($url =~ m%\A/%));
|
||||
|
||||
## print STDERR "Not an URL; assume local file $url\n";
|
||||
|
||||
# Create a file URL
|
||||
($scheme, $username, $host, $port, $pathname) =
|
||||
("file", "", "", "", $url);
|
||||
}
|
||||
|
||||
if (($scheme ne "http") && ($scheme ne "file")) {
|
||||
print STDERR "xcat: Cannot handle URI scheme $scheme:\n";
|
||||
next;
|
||||
}
|
||||
|
||||
if ($scheme eq "file") { # Local filename
|
||||
|
||||
if (!(-e $pathname)) {
|
||||
print STDERR "xcat: File $pathname not found\n";
|
||||
next;
|
||||
}
|
||||
|
||||
if (!(-r $pathname)) {
|
||||
print STDERR "xcat: Unable to read file $pathname\n";
|
||||
next;
|
||||
}
|
||||
|
||||
if (-d $pathname) {
|
||||
print STDERR "xcat: Use the 'xls' command to list contents of directory $pathname\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
$pathname =~ m%\A(.*?) (\.[^/.]*)?\Z%x # Deconstruct pathname
|
||||
or die "xcat: Internal error; unable to deconstruct pathname\n";
|
||||
|
||||
($filename, $extension) = ($1, $2);
|
||||
|
||||
## print STDERR "Filename=$filename, extension=$extension\n";
|
||||
|
||||
if (($extension eq ".gif") ||
|
||||
($extension eq ".png") ||
|
||||
($extension eq ".jpg")) {
|
||||
## print STDERR "Image file\n";
|
||||
|
||||
print "\e{S$cookie\n"; # HTML stream escape sequence
|
||||
print "<IMG SRC='$scheme://${host}$pathname'>";
|
||||
print "\000"; # Terminate HTML stream
|
||||
|
||||
} elsif (($scheme eq "file") && ($extension eq ".ps")) {
|
||||
## print STDERR "PostScript local file\n";
|
||||
|
||||
system("ghostview $pathname&");
|
||||
|
||||
} elsif (($scheme eq "file") && ($extension eq ".url")) {
|
||||
# URL
|
||||
open INFILE, $pathname or next;
|
||||
$_ = <INFILE>;
|
||||
close INFILE;
|
||||
|
||||
my @urlvals;
|
||||
my $nurl = 0;
|
||||
while ( m%\b # initiator
|
||||
(http|file|mailto): # scheme
|
||||
(?=/) # lookahead
|
||||
(?:// # slashpair
|
||||
(?:([\w.]+)@)? # username
|
||||
([\w\-]+(?:\.[\w\-]+)*)? # host
|
||||
(?::(\d+))? # port
|
||||
)?
|
||||
(/|/[^/\s]\S*?)? # pathname
|
||||
(?=>|\"|\'|\s|[.,!](?:\s|\Z)|\Z) # URL terminator (look ahead)
|
||||
%x ) {
|
||||
$urlvals[$nurl] = $&;
|
||||
s%$&%%;
|
||||
$nurl++;
|
||||
}
|
||||
s%\A\s*(\S.*?)?\s*\Z%$1%;
|
||||
|
||||
if ($nurl >= 1) {
|
||||
my $urldesc = $_;
|
||||
my $urlstr = $urlvals[0];
|
||||
$urldesc = $urlstr if !$urldesc;
|
||||
|
||||
my $clickcmd =
|
||||
qq%onClick="return HandleEvent(event,'click','textlink',-\#,'$urlstr')"%;
|
||||
|
||||
print "\e{S$cookie\n"; # HTML stream escape sequence
|
||||
if ($nurl >= 2) {
|
||||
print "<img src='$urlvals[1]' $clickcmd><br>";
|
||||
}
|
||||
print "<div class='textlink' $clickcmd')\">$urldesc</div>";
|
||||
print "\000"; # Terminate HTML stream
|
||||
}
|
||||
|
||||
} elsif ( ($scheme eq "http") ||
|
||||
(($scheme eq "file") && (($extension eq ".htm") ||
|
||||
($extension eq ".html") ||
|
||||
($extension eq ".xml")) ) ) {
|
||||
## print STDERR "IFRAME\n";
|
||||
print "\e{S$cookie\n"; # HTML stream escape sequence
|
||||
print "<iframe frameborder=0 width='100%' height='$height' src='$scheme://${host}$pathname'></iframe>";
|
||||
print "<div class='beginner'>";
|
||||
print "Use shift-key + Home/End/PageUp/PageDown to scroll nested IFrame.";
|
||||
print "</div>";
|
||||
print "\000"; # Terminate HTML stream
|
||||
|
||||
} elsif ((-T $pathname) || ($extension eq "txt")) { # plain text file
|
||||
## print STDERR "Text file\n";
|
||||
|
||||
open INFILE, $pathname or next;
|
||||
print "\e{S$cookie\n"; # HTML stream escape sequence
|
||||
print "<pre>";
|
||||
|
||||
while (<INFILE>) {
|
||||
s/&/&/g; # Replace & with &
|
||||
s/</</g; # Replace < with <
|
||||
s/>/">"/g; # Temporarily replace > with ">"
|
||||
# to allow termination of <http://xyz.com> etc.
|
||||
|
||||
s%\b # URL word boundary
|
||||
([a-zA-Z]\w*)?: # scheme
|
||||
(?=/) # lookahead
|
||||
(?:// # slashpair
|
||||
(?:([\w.]+)@)? # username
|
||||
([\w\-]+(?:\.[\w\-]+)*)? # host
|
||||
(?::(\d+))? # port
|
||||
)?
|
||||
(/|/[^/\s]\S*?)? # pathname
|
||||
(?=>|\"|\'|\s|[.,!](?:\s|\Z)|\Z) # URL terminator (look ahead)
|
||||
%<span class="textlink" onClick="return HandleEvent(event,'click','textlink',-\#,'$&')">$&</span>%xg;
|
||||
|
||||
s/">"/>/g; # Replace ">" with > in the end
|
||||
|
||||
print $_;
|
||||
}
|
||||
|
||||
print "</pre>";
|
||||
print "\000"; # Terminate HTML stream
|
||||
close INFILE;
|
||||
|
||||
} else { # unknown file type
|
||||
print STDERR "xcat: File type unknown for $pathname\n";
|
||||
next;
|
||||
}
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# xls: an XMLterm wrapper for the UNIX "ls" command
|
||||
# Usage: xls [-c|--cols] [-h|help] [-t||--text] <files>
|
||||
|
||||
use Cwd;
|
||||
use Getopt::Long;
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
&GetOptions("cols|c=i", "help|h", "text|t");
|
||||
|
||||
if ($opt_help) {
|
||||
print "Usage: xls [-c|--cols] [-t|--text] [<files>]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Icon details
|
||||
#my $imgdir="chrome://xmlterm/skin/default/images"
|
||||
my $imgdir = "file:///usr/share/pixmaps/mc";
|
||||
|
||||
my %img;
|
||||
($img{'directory'}, $img{'executable'}, $img{'plainfile'}, $img{'urlfile'}) =
|
||||
('i-directory.png', 'i-executable.png', 'i-regular.png', 'i-regular.png');
|
||||
|
||||
my $ncols = 5;
|
||||
$ncols = $opt_cols if ($opt_cols);
|
||||
|
||||
my $dir = cwd();
|
||||
my $rowimg = "";
|
||||
my $rowtxt = "";
|
||||
my $nfile = 0;
|
||||
|
||||
my $filelist;
|
||||
|
||||
if (@ARGV) {
|
||||
if ((@ARGV == 1) && (-d $ARGV[0])) {
|
||||
@filelist = glob("$ARGV[0]/*"); # specified directory
|
||||
} else {
|
||||
@filelist = @ARGV; # specified file(s)
|
||||
}
|
||||
} else {
|
||||
@filelist = glob("*"); # all files in current directory
|
||||
}
|
||||
|
||||
my $cookie = $ENV{LTERM_COOKIE}; # XMLTerm cookie
|
||||
print "\e{S$cookie\012"; # HTML stream escape sequence
|
||||
print "<TABLE FRAME=none BORDER=0>";
|
||||
print "<COLGROUP COLSPAN=$ncols WIDTH=1*>";
|
||||
|
||||
foreach $file (@filelist) { # for each file in the list
|
||||
$file =~ m%\A(.*?) (\.[^/.]*)?\Z%x # Deconstruct file name
|
||||
or die "xls: Internal error; unable to deconstruct file name\n";
|
||||
|
||||
my ($filename, $extension) = ($1, $2);
|
||||
|
||||
my ($filetype, $fileimg, $sendcmd, $sendtxt1, $sendtxt2);
|
||||
|
||||
$sendtxt1 = $file;
|
||||
if ($dir eq "/") {
|
||||
$sendtxt2 = "/";
|
||||
} else {
|
||||
$sendtxt2 = "$dir/";
|
||||
}
|
||||
|
||||
if (-d $file) { # directory
|
||||
$filetype = "directory";
|
||||
$fileimg = "$imgdir/$img{$filetype}";
|
||||
$sendcmd = "cdxls";
|
||||
|
||||
} elsif (-x $file) { # executable
|
||||
$filetype = "executable";
|
||||
$fileimg = "$imgdir/$img{$filetype}";
|
||||
$sendcmd = "exec";
|
||||
|
||||
} elsif (($extension eq ".gif") ||
|
||||
($extension eq ".png") ||
|
||||
($extension eq ".jpg")) { # image
|
||||
$filetype = "imagefile";
|
||||
$fileimg = "file://$dir/$file";
|
||||
$sendcmd = "xcat";
|
||||
|
||||
} elsif ($extension eq ".ps") { # postscript
|
||||
$filetype = "plainfile";
|
||||
$fileimg = "$imgdir/$img{$filetype}";
|
||||
$sendcmd = "xcat";
|
||||
|
||||
} elsif ($extension eq ".url") { # URL
|
||||
open INFILE, $file or next;
|
||||
$_ = <INFILE>;
|
||||
close INFILE;
|
||||
|
||||
# Extract content URL and the icon URL (if any)
|
||||
my @urlvals;
|
||||
my $nurl = 0;
|
||||
while ( m%\b # URL word boundary
|
||||
(http|file|mailto): # protocol
|
||||
(?=/) # lookahead
|
||||
(?:// # slashpair
|
||||
(?:([\w.]+)@)? # username
|
||||
([\w\-]+(?:\.[\w\-]+)*)? # host
|
||||
(?::(\d+))? # port
|
||||
)?
|
||||
(/|/[^/\s]\S*?)? # pathname
|
||||
(?=>|\"|\'|\s|[.,!](?:\s|\Z)|\Z) # URL terminator (look ahead)
|
||||
%x ) {
|
||||
$urlvals[$nurl] = $&;
|
||||
s%$&%%;
|
||||
$nurl++;
|
||||
}
|
||||
s%\A\s*(\S.*?)?\s*\Z%$1%; # trim leading/trailing space
|
||||
|
||||
if ($nurl >= 1) {
|
||||
my $urldesc = $_;
|
||||
my $urlstr = $urlvals[0];
|
||||
$urldesc = $urlstr if !$urldesc;
|
||||
|
||||
$sendcmd = "textlink"; # override send command
|
||||
$sendtxt1 = "$urlstr";
|
||||
$sendtxt2 = "$urlstr";
|
||||
|
||||
$filetype = "urlfile";
|
||||
if ($nurl >= 2) {
|
||||
$fileimg = "$urlvals[1]"; # use icon URL
|
||||
} else {
|
||||
$fileimg = "$imgdir/$img{$filetype}"; #default URL icon
|
||||
}
|
||||
} else {
|
||||
$filetype = "plainfile";
|
||||
$fileimg = "$imgdir/$img{$filetype}";
|
||||
$sendcmd = "xcat";
|
||||
}
|
||||
|
||||
} else { # plain file
|
||||
$filetype = "plainfile";
|
||||
$fileimg = "$imgdir/$img{$filetype}";
|
||||
$sendcmd = "xcat";
|
||||
}
|
||||
|
||||
my @comps = split(m./.,$file);
|
||||
my $tail = $comps[$#comps]; # file name
|
||||
|
||||
my $clickcmd =
|
||||
qq%onClick="return HandleEvent(event,'click','$sendcmd',-\#,'$sendtxt1','$sendtxt2')"%;
|
||||
|
||||
$rowimg .= "<TD><IMG HEIGHT=48 WIDTH=48 SRC='$fileimg' $clickcmd>";
|
||||
$rowtxt .= "<TD><SPAN CLASS='$filetype' $clickcmd>";
|
||||
$rowtxt .= "$tail</SPAN>";
|
||||
$nfile++;
|
||||
|
||||
if (($nfile % $ncols) == 0) { # print complete table row
|
||||
print "<TR CLASS='icons'>$rowimg" unless $opt_text;
|
||||
print "<TR>$rowtxt";
|
||||
$rowimg = "";
|
||||
$rowtxt = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($rowtxt) {
|
||||
print "<TR CLASS='icons'>$rowimg" unless $opt_text;
|
||||
print "<TR>$rowtxt";
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
print "<div class='beginner'>";
|
||||
print "Double-click on file/directory name to execute file/open directory.";
|
||||
print "<span class='noicons'><br>Set <b>Icons</b> setting to <em>on</em> to enable icon display.</span>";
|
||||
print "<span class='icons'><br>Set <b>Icons</b> setting to <em>off</em> to disable icon display.</span>";
|
||||
print "</div>";
|
||||
print "\000"; # Terminate HTML stream
|
||||
|
|
@ -43,5 +43,5 @@ function StartupXMLTerm() {
|
|||
window.title = "xmlterm: "+window.arguments;
|
||||
|
||||
// Initialize XMLTerm shell in content window with argvals
|
||||
window.xmlterm.Init(xmltwin, "", window.arguments);
|
||||
window.xmlterm.init(xmltwin, "", window.arguments);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,25 @@
|
|||
// letter.
|
||||
|
||||
// Global variables
|
||||
var AltWin; // Alternate (browser) window
|
||||
///var gStyleRuleNames;
|
||||
|
||||
var gStyleRuleNames;
|
||||
WRITE_LOG = function (str) {};
|
||||
DEBUG_LOG = function (str) {};
|
||||
|
||||
if (navigator) {
|
||||
var userAgent = navigator.userAgent;
|
||||
|
||||
if (userAgent && (userAgent.search(/Mozilla\/4\./i) == -1)) {
|
||||
|
||||
if (dump) {
|
||||
WRITE_LOG = dump;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (dump) {
|
||||
WRITE_LOG = dump;
|
||||
}
|
||||
}
|
||||
|
||||
var Tips = new Array(); // Usage tip strings
|
||||
var TipNames = new Array(); // Usage tip names
|
||||
|
@ -95,7 +111,7 @@ function NewTip() {
|
|||
SelectedTip = Math.floor(ranval * TipCount);
|
||||
if (SelectedTip >= TipCount) SelectedTip = 0;
|
||||
|
||||
//dump("xmlterm: NewTip "+SelectedTip+","+ranval+"\n");
|
||||
DEBUG_LOG("xmlterm: NewTip "+SelectedTip+","+ranval+"\n");
|
||||
|
||||
var tipdata = document.getElementById('tipdata');
|
||||
tipdata.firstChild.data = Tips[SelectedTip];
|
||||
|
@ -107,7 +123,7 @@ function NewTip() {
|
|||
|
||||
// Explain tip
|
||||
function ExplainTip(tipName) {
|
||||
//dump("xmlterm: ExplainTip("+tipName+")\n");
|
||||
DEBUG_LOG("xmlterm: ExplainTip("+tipName+")\n");
|
||||
|
||||
if (tipName) {
|
||||
var tipdata = document.getElementById('tipdata');
|
||||
|
@ -148,7 +164,7 @@ function F9Key(isShift, isControl) {
|
|||
|
||||
// Scroll Home key
|
||||
function ScrollHomeKey(isShift, isControl) {
|
||||
//dump("ScrollHomeKey("+isShift+","+isControl+")\n");
|
||||
DEBUG_LOG("ScrollHomeKey("+isShift+","+isControl+")\n");
|
||||
|
||||
if (isControl) {
|
||||
return F1Key(isShift, 0);
|
||||
|
@ -160,7 +176,7 @@ function ScrollHomeKey(isShift, isControl) {
|
|||
|
||||
// Scroll End key
|
||||
function ScrollEndKey(isShift, isControl) {
|
||||
//dump("ScrollEndKey("+isShift+","+isControl+")\n");
|
||||
DEBUG_LOG("ScrollEndKey("+isShift+","+isControl+")\n");
|
||||
|
||||
if (isControl) {
|
||||
return F2Key(isShift, 0);
|
||||
|
@ -172,7 +188,7 @@ function ScrollEndKey(isShift, isControl) {
|
|||
|
||||
// Scroll PageUp key
|
||||
function ScrollPageUpKey(isShift, isControl) {
|
||||
//dump("ScrollPageUpKey("+isShift+","+isControl+")\n");
|
||||
DEBUG_LOG("ScrollPageUpKey("+isShift+","+isControl+")\n");
|
||||
|
||||
ScrollWin(isShift,isControl).scrollBy(0,-120);
|
||||
return false;
|
||||
|
@ -180,7 +196,7 @@ function ScrollPageUpKey(isShift, isControl) {
|
|||
|
||||
// Scroll PageDown key
|
||||
function ScrollPageDownKey(isShift, isControl) {
|
||||
//dump("ScrollPageDownKey("+isShift+","+isControl+")\n");
|
||||
DEBUG_LOG("ScrollPageDownKey("+isShift+","+isControl+")\n");
|
||||
|
||||
ScrollWin(isShift,isControl).scrollBy(0,120);
|
||||
return false;
|
||||
|
@ -197,16 +213,16 @@ function ScrollWin(isShift, isControl) {
|
|||
|
||||
// Set history buffer size
|
||||
function SetHistory(value) {
|
||||
//dump("SetHistory("+value+")\n");
|
||||
window.xmlterm.SetHistory(value, document.cookie);
|
||||
return (false);
|
||||
DEBUG_LOG("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);
|
||||
DEBUG_LOG("SetPrompt("+value+")\n");
|
||||
window.xmlterm.setPrompt(value, document.cookie);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create new XMLTerm window
|
||||
|
@ -214,40 +230,40 @@ function NewXMLTerm(firstcommand) {
|
|||
newwin = window.openDialog( "chrome://xmlterm/content/xmlterm.xul",
|
||||
"xmlterm", "chrome,dialog=no,resizable",
|
||||
firstcommand);
|
||||
dump("NewXMLTerm: "+newwin+"\n")
|
||||
return (false);
|
||||
WRITE_LOG("NewXMLTerm: "+newwin+"\n")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle resize events
|
||||
function Resize(event) {
|
||||
//dump("Resize()\n");
|
||||
window.xmlterm.Resize();
|
||||
return (false);
|
||||
DEBUG_LOG("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);
|
||||
DEBUG_LOG("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);
|
||||
DEBUG_LOG("FormBlur()\n");
|
||||
window.xmlterm.ignoreKeyPress(false, document.cookie);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set user level, icons mode etc.
|
||||
function UpdateSettings(selectName) {
|
||||
|
||||
//dump("UpdateSettings: "+selectName+"\n");
|
||||
DEBUG_LOG("UpdateSettings: "+selectName+"\n");
|
||||
|
||||
var selectedIndex = document.xmltform1[selectName].selectedIndex;
|
||||
var selectedOption = document.xmltform1[selectName].options[selectedIndex].value;
|
||||
|
||||
//dump("UpdateSettings: selectedOption=="+selectedOption+"\n");
|
||||
DEBUG_LOG("UpdateSettings: selectedOption=="+selectedOption+"\n");
|
||||
|
||||
switch(selectName) {
|
||||
case "userLevel":
|
||||
|
@ -288,37 +304,40 @@ function UpdateSettings(selectName) {
|
|||
break;
|
||||
|
||||
default:
|
||||
//dump("UpdateSettings: Unknown selectName "+selectName+"\n");
|
||||
DEBUG_LOG("UpdateSettings: Unknown selectName "+selectName+"\n");
|
||||
break;
|
||||
}
|
||||
|
||||
window.xmltform1Index[selectName] = selectedIndex;
|
||||
window.xmltform1Option[selectName] = selectedOption;
|
||||
|
||||
Webcast();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Alter style in stylesheet of specified document doc, or current document
|
||||
// if doc is omitted.
|
||||
// ****CSS DOM IS BROKEN****; selectorText seems to be null for all rules
|
||||
function AlterStyle(ruleName, propertyName, propertyValue, doc) {
|
||||
|
||||
//dump("AlterStyle("+ruleName+"{"+propertyName+":"+propertyValue+"})\n");
|
||||
DEBUG_LOG("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("selectorText["+r+"]="+sheet.cssRules[r].selectorText+"\n");
|
||||
DEBUG_LOG("selectorText["+r+"]="+sheet.cssRules[r].selectorText+"\n");
|
||||
|
||||
if (sheet.cssRules[r].selectorText.toLowerCase() == ruleName.toLowerCase()) {
|
||||
|
||||
//if (sheet.cssRules[r].selectorText == ruleName) {
|
||||
// Ugly workaround for accessing rules until bug 53448 is fixed
|
||||
if (gStyleRuleNames[r] == ruleName) {
|
||||
// (****CSS DOM IS BROKEN****; selectorText seems to be null for all rules)
|
||||
///if (gStyleRuleNames[r] == ruleName) {
|
||||
|
||||
//dump("cssText["+r+"]="+sheet.cssRules[r].cssText+"\n");
|
||||
DEBUG_LOG("cssText["+r+"]="+sheet.cssRules[r].cssText+"\n");
|
||||
var style = sheet.cssRules[r].style;
|
||||
//dump("style="+style.getPropertyValue(propertyName)+"\n");
|
||||
DEBUG_LOG("style="+style.getPropertyValue(propertyName)+"\n");
|
||||
|
||||
style.setProperty(propertyName,propertyValue,"");
|
||||
}
|
||||
|
@ -333,22 +352,10 @@ function MetaDefault(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");
|
||||
}
|
||||
DEBUG_LOG("Load:url="+url+"\n");
|
||||
window.open(url);
|
||||
|
||||
// Save browser window object in global variable
|
||||
AltWin = window.xmltbrowser;
|
||||
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Control display of all output elements
|
||||
|
@ -356,14 +363,24 @@ 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";
|
||||
///outputElement.style.display = (flag) ? "block" : "none";
|
||||
|
||||
if (flag)
|
||||
outputElement.removeAttribute('xmlt-block-collapsed');
|
||||
else
|
||||
outputElement.setAttribute('xmlt-block-collapsed', 'true');
|
||||
}
|
||||
|
||||
var promptElements = document.getElementsByName("prompt");
|
||||
for (i=0; i<promptElements.length-1; i++) {
|
||||
promptElement = promptElements[i];
|
||||
promptElement.style.setProperty("text-decoration",
|
||||
(flag) ? "none" : "underline", "")
|
||||
///promptElement.style.setProperty("text-decoration",
|
||||
/// (flag) ? "none" : "underline", "");
|
||||
|
||||
if (flag)
|
||||
promptElement.removeAttribute('xmlt-underline');
|
||||
else
|
||||
promptElement.setAttribute('xmlt-underline', 'true');
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
|
@ -371,7 +388,9 @@ function DisplayAllOutput(flag) {
|
|||
// ScrollEndKey(0,0);
|
||||
}
|
||||
|
||||
return (false);
|
||||
Webcast();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Centralized event handler
|
||||
|
@ -401,13 +420,13 @@ function DisplayAllOutput(flag) {
|
|||
//
|
||||
function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
||||
arg1, arg2) {
|
||||
//dump("HandleEvent("+eventObj+","+eventType+","+targetType+","+entryNumber+","+arg1+","+arg2+")\n");
|
||||
DEBUG_LOG("HandleEvent("+eventObj+","+eventType+","+targetType+","+entryNumber+","+arg1+","+arg2+")\n");
|
||||
|
||||
// Entry independent targets
|
||||
if (action === "textlink") {
|
||||
if (targetType === "textlink") {
|
||||
// Single click opens hyperlink
|
||||
// Browser-style
|
||||
//dump("textlink = "+arg1+"\n");
|
||||
DEBUG_LOG("textlink = "+arg1+"\n");
|
||||
Load(arg1);
|
||||
|
||||
} else if (targetType === "prompt") {
|
||||
|
@ -415,15 +434,24 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
|||
var outputElement = document.getElementById("output"+entryNumber);
|
||||
var helpElement = document.getElementById("help"+entryNumber);
|
||||
var promptElement = document.getElementById("prompt"+entryNumber);
|
||||
//dump(promptElement.style.getPropertyValue("text-decoration"));
|
||||
DEBUG_LOG(promptElement.style.getPropertyValue("text-decoration"));
|
||||
|
||||
if (outputElement.style.display == "none") {
|
||||
outputElement.style.display = "block";
|
||||
promptElement.style.setProperty("text-decoration","none","");
|
||||
var collapsed = outputElement.getAttribute('xmlt-block-collapsed');
|
||||
|
||||
if (collapsed) {
|
||||
///if (outputElement.style.display == "none") {
|
||||
///outputElement.style.display = "block";
|
||||
///promptElement.style.setProperty("text-decoration","none","");
|
||||
|
||||
outputElement.removeAttribute('xmlt-block-collapsed');
|
||||
promptElement.removeAttribute('xmlt-underline');
|
||||
|
||||
} else {
|
||||
outputElement.style.display = "none";
|
||||
promptElement.style.setProperty("text-decoration","underline","");
|
||||
///outputElement.style.display = "none";
|
||||
///promptElement.style.setProperty("text-decoration","underline","");
|
||||
|
||||
outputElement.setAttribute('xmlt-block-collapsed', 'true');
|
||||
promptElement.setAttribute('xmlt-underline', 'true');
|
||||
if (helpElement) {
|
||||
ShowHelp("",entryNumber);
|
||||
}
|
||||
|
@ -431,7 +459,7 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
|||
|
||||
} else if (eventType === "click") {
|
||||
|
||||
//dump("clickCount="+eventObj.detail+"\n");
|
||||
DEBUG_LOG("clickCount="+eventObj.detail+"\n");
|
||||
|
||||
var shiftClick = eventObj.shiftKey;
|
||||
var dblClick = (eventObj.detail == 2);
|
||||
|
@ -447,14 +475,14 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
|||
if (currentCmdElement && currentCmdElement.hasChildNodes()) {
|
||||
|
||||
if (currentCmdElement.firstChild.nodeType == Node.TEXT_NODE) {
|
||||
//dump("textLength = "+currentCmdElement.firstChild.data.length+"\n");
|
||||
DEBUG_LOG("textLength = "+currentCmdElement.firstChild.data.length+"\n");
|
||||
currentCommandEmpty = (currentCmdElement.firstChild.data.length == 0);
|
||||
|
||||
} else {
|
||||
currentCommandEmpty = false;
|
||||
}
|
||||
}
|
||||
//dump("empty = "+currentCommandEmpty+"\n");
|
||||
DEBUG_LOG("empty = "+currentCommandEmpty+"\n");
|
||||
|
||||
if (targetType === "command") {
|
||||
if (!dblClick)
|
||||
|
@ -462,9 +490,9 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
|||
var commandElement = document.getElementById(targetType+entryNumber);
|
||||
var command = commandElement.firstChild.data;
|
||||
if (currentCommandEmpty) {
|
||||
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
|
||||
window.xmlterm.sendText("\025"+command+"\n", document.cookie);
|
||||
} else {
|
||||
window.xmlterm.SendText(command, document.cookie);
|
||||
window.xmlterm.sendText(command, document.cookie);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -472,8 +500,8 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
|||
|
||||
if ((entryNumber >= 0) &&
|
||||
(window.xmlterm.currentEntryNumber != entryNumber)) {
|
||||
//dump("NOT CURRENT COMMAND\n");
|
||||
return (false);
|
||||
DEBUG_LOG("NOT CURRENT COMMAND\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
var action, sendStr;
|
||||
|
@ -537,21 +565,23 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
|||
|
||||
// Primitive actions
|
||||
if (action === "send") {
|
||||
//dump("send = "+sendStr+"\n");
|
||||
window.xmlterm.SendText(sendStr, document.cookie);
|
||||
DEBUG_LOG("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);
|
||||
DEBUG_LOG("sendln = "+sendStr+"\n\n");
|
||||
window.xmlterm.sendText("\025"+sendStr+"\n", document.cookie);
|
||||
|
||||
} else if (action === "createln") {
|
||||
//dump("createln = "+sendStr+"\n\n");
|
||||
DEBUG_LOG("createln = "+sendStr+"\n\n");
|
||||
newwin = NewXMLTerm(sendStr+"\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
Webcast();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set history buffer count using form entry
|
||||
|
@ -566,6 +596,54 @@ function SetPromptValue() {
|
|||
return SetPrompt(field.value);
|
||||
}
|
||||
|
||||
function Webcast() {
|
||||
if (!window.webcastIntervalId)
|
||||
return;
|
||||
|
||||
DEBUG_LOG("XMLTermCommands.js: Webcast: "+window.webcastFile+"\n");
|
||||
|
||||
var style = "";
|
||||
|
||||
if (window.xmltform1Option.showIcons == "on") {
|
||||
style += "SPAN.noicons {display: none}\n";
|
||||
style += "SPAN.icons {display: inline}\n";
|
||||
style += "IMG.icons {display: inline}\n";
|
||||
style += "TR.icons {display: table-row}\n";
|
||||
}
|
||||
|
||||
var exported = window.xmlterm.exportHTML(window.webcastFile, 0644, style,
|
||||
0, false, document.cookie);
|
||||
DEBUG_LOG("XMLTermCommands.js: exported="+exported+"\n");
|
||||
}
|
||||
|
||||
function InitiateWebcast() {
|
||||
var field = document.getElementById('inputvalue');
|
||||
|
||||
window.webcastFile = field.value ? field.value : "";
|
||||
window.webcastFile = "/var/www/html/users/xmlt.html";
|
||||
|
||||
WRITE_LOG("XMLTermCommands.js: InitiateWebcast: "+window.webcastFile+"\n");
|
||||
|
||||
Webcast();
|
||||
window.webcastIntervalId = window.setInterval(Webcast, 2000);
|
||||
}
|
||||
|
||||
function TerminateWebcast() {
|
||||
window.webcastFile = null;
|
||||
|
||||
if (window.webcastIntervalId) {
|
||||
window.clearInterval(window.webcastIntervalId);
|
||||
window.webcastIntervalId = null;
|
||||
}
|
||||
}
|
||||
|
||||
function ToggleWebcast() {
|
||||
if (window.webcastIntervalId)
|
||||
TerminateWebcast();
|
||||
else
|
||||
InitiateWebcast();
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
@ -575,7 +653,7 @@ function ShowHelp(url, entryNumber, height) {
|
|||
|
||||
if (!height) height = 120;
|
||||
|
||||
//dump("xmlterm: ShowHelp("+url+","+entryNumber+","+height+")\n");
|
||||
DEBUG_LOG("xmlterm: ShowHelp("+url+","+entryNumber+","+height+")\n");
|
||||
|
||||
if (entryNumber) {
|
||||
beforeID = "output"+entryNumber;
|
||||
|
@ -588,7 +666,7 @@ function ShowHelp(url, entryNumber, height) {
|
|||
var beforeElement = document.getElementById(beforeID);
|
||||
|
||||
if (!beforeElement) {
|
||||
//dump("InsertIFrame: beforeElement ID="+beforeID+"not found\n");
|
||||
DEBUG_LOG("InsertIFrame: beforeElement ID="+beforeID+"not found\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -611,7 +689,7 @@ function ShowHelp(url, entryNumber, height) {
|
|||
var closeElement = document.createElement("span");
|
||||
closeElement.setAttribute('class', 'helplink');
|
||||
closeElement.appendChild(document.createTextNode("Close help frame"));
|
||||
//closeElement.appendChild(document.createElement("p"));
|
||||
closeElement.appendChild(document.createElement("p"));
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.setAttribute('id', helpID+'frame');
|
||||
|
@ -624,7 +702,7 @@ function ShowHelp(url, entryNumber, height) {
|
|||
helpElement.appendChild(iframe);
|
||||
helpElement.appendChild(closeElement);
|
||||
|
||||
//dump(helpElement);
|
||||
DEBUG_LOG(helpElement);
|
||||
|
||||
// Insert help element
|
||||
parentNode.insertBefore(helpElement, beforeElement);
|
||||
|
@ -639,7 +717,7 @@ function ShowHelp(url, entryNumber, height) {
|
|||
|
||||
// About XMLTerm
|
||||
function AboutXMLTerm() {
|
||||
//dump("xmlterm: AboutXMLTerm\n");
|
||||
DEBUG_LOG("xmlterm: AboutXMLTerm\n");
|
||||
|
||||
var tipdata = document.getElementById('tipdata');
|
||||
tipdata.firstChild.data = "";
|
||||
|
@ -649,19 +727,39 @@ function AboutXMLTerm() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function Redirect() {
|
||||
window.location = window.redirectURL;
|
||||
}
|
||||
|
||||
|
||||
function GetQueryParam(paramName) {
|
||||
var url = document.location.href;
|
||||
|
||||
var paramExp = new RegExp("[?&]"+paramName+"=([^&]*)");
|
||||
|
||||
var matches = url.match(paramExp);
|
||||
|
||||
var paramVal = "";
|
||||
if (matches && (matches.length > 1)) {
|
||||
paramVal = matches[1];
|
||||
}
|
||||
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
// onLoad event handler
|
||||
function LoadHandler() {
|
||||
//dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
|
||||
WRITE_LOG("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
|
||||
|
||||
// Ugly workaround for accessing rules in stylesheet until bug 53448 is fixed
|
||||
var sheet = document.styleSheets[0];
|
||||
//dump("sheet.cssRules.length="+sheet.cssRules.length+"\n");
|
||||
///var sheet = document.styleSheets[0];
|
||||
//WRITE_LOG("sheet.cssRules.length="+sheet.cssRules.length+"\n");
|
||||
|
||||
var styleElement = (document.getElementsByTagName("style"))[0];
|
||||
var styleText = styleElement.firstChild.data;
|
||||
///var styleElement = (document.getElementsByTagName("style"))[0];
|
||||
///var styleText = styleElement.firstChild.data;
|
||||
|
||||
gStyleRuleNames = styleText.match(/\b[\w-.]+(?=\s*\{)/g);
|
||||
//dump("gStyleRuleNames.length="+gStyleRuleNames.length+"\n");
|
||||
///gStyleRuleNames = styleText.match(/\b[\w-.]+(?=\s*\{)/g);
|
||||
//WRITE_LOG("gStyleRuleNames.length="+gStyleRuleNames.length+"\n");
|
||||
|
||||
//NewTip();
|
||||
|
||||
|
@ -669,8 +767,8 @@ function LoadHandler() {
|
|||
window.xmltform1Index = new Object();
|
||||
window.xmltform1Option = new Object();
|
||||
|
||||
window.xmltform1Index.userLevel = 1;
|
||||
window.xmltform1Option.userLevel = "intermediate";
|
||||
window.xmltform1Index.userLevel = 2;
|
||||
window.xmltform1Option.userLevel = "advanced";
|
||||
|
||||
window.xmltform1Index.showIcons = 0;
|
||||
window.xmltform1Option.showIcons = "off";
|
||||
|
@ -678,6 +776,44 @@ function LoadHandler() {
|
|||
window.xmltform1Index.windowsMode = 0;
|
||||
window.xmltform1Option.windowsMode = "off";
|
||||
|
||||
if (!window.xmlterm && exportCount) {
|
||||
var redirectURL = document.location.href;
|
||||
var urlLen = redirectURL.indexOf("?");
|
||||
|
||||
if (urlLen > 0) redirectURL = redirectURL.substr(0,urlLen);
|
||||
|
||||
DEBUG_LOG("exportCount="+exportCount+"\n");
|
||||
|
||||
var minrefresh = GetQueryParam("minrefresh");
|
||||
var maxrefresh = GetQueryParam("maxrefresh");
|
||||
var refresh = GetQueryParam("refresh");
|
||||
var id = GetQueryParam("id");
|
||||
|
||||
if (minrefresh) {
|
||||
if (!maxrefresh) maxrefresh = 10*minrefresh;
|
||||
if (!refresh) refresh = minrefresh;
|
||||
if (!id) id = 0;
|
||||
|
||||
if (exportCount > id*1)
|
||||
refresh = minrefresh;
|
||||
else
|
||||
refresh = 2*refresh;
|
||||
|
||||
if (refresh > maxrefresh) refresh=maxrefresh;
|
||||
|
||||
var refreshTime = refresh*1000;
|
||||
|
||||
redirectURL += "?minrefresh="+minrefresh + "&maxrefresh="+maxrefresh +"&refresh="+refresh + "&id="+exportCount;
|
||||
|
||||
DEBUG_LOG("redirectURL="+redirectURL+"\n");
|
||||
|
||||
window.redirectURL = redirectURL;
|
||||
window.timeoutId = window.setTimeout(Redirect, refreshTime);
|
||||
}
|
||||
|
||||
window.scrollTo(0,4000); // Scroll to bottom of page
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
// The following code fragment is skipped because the chrome takes care of
|
||||
|
@ -687,17 +823,17 @@ function LoadHandler() {
|
|||
return false;
|
||||
}
|
||||
|
||||
//dump("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
|
||||
DEBUG_LOG("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
|
||||
|
||||
dump("Trying to make an XMLTerm Shell through the component manager...\n");
|
||||
WRITE_LOG("Trying to make an XMLTerm Shell through the component manager...\n");
|
||||
|
||||
var xmltshell = Components.classes["@mozilla.org/xmlterm/xmltermshell;1"].createInstance();
|
||||
|
||||
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
|
||||
//dump("Interface xmltshell2 = " + xmltshell + "\n");
|
||||
DEBUG_LOG("Interface xmltshell2 = " + xmltshell + "\n");
|
||||
|
||||
if (!xmltshell) {
|
||||
dump("Failed to create XMLTerm shell\n");
|
||||
WRITE_LOG("Failed to create XMLTerm shell\n");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
@ -709,13 +845,13 @@ function LoadHandler() {
|
|||
var contentWindow = window;
|
||||
|
||||
// Initialize XMLTerm shell in content window with argvals
|
||||
window.xmlterm.Init(contentWindow, "", "");
|
||||
window.xmlterm.init(contentWindow, "", "");
|
||||
|
||||
//dump("LoadHandler:"+document.cookie+"\n");
|
||||
DEBUG_LOG("LoadHandler:"+document.cookie+"\n");
|
||||
|
||||
//dump("contentWindow="+contentWindow+"\n");
|
||||
//dump("document="+document+"\n");
|
||||
//dump("documentElement="+document.documentElement+"\n");
|
||||
DEBUG_LOG("contentWindow="+contentWindow+"\n");
|
||||
DEBUG_LOG("document="+document+"\n");
|
||||
DEBUG_LOG("documentElement="+document.documentElement+"\n");
|
||||
|
||||
// Handle resize events
|
||||
//contentWindow.addEventListener("onresize", Resize);
|
||||
|
@ -726,37 +862,37 @@ function LoadHandler() {
|
|||
|
||||
//contentWindow.xmlterm = xmlterm;
|
||||
|
||||
//dump(contentWindow.xmlterm);
|
||||
DEBUG_LOG(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");
|
||||
DEBUG_LOG("[Main] "+window+"\n");
|
||||
DEBUG_LOG(window.screenX+", "+window.screenY+"\n");
|
||||
DEBUG_LOG(window.scrollX+", "+window.scrollY+"\n");
|
||||
DEBUG_LOG(window.pageXOffset+", "+window.pageYOffset+"\n");
|
||||
|
||||
//dump("IFRAME checks\n");
|
||||
DEBUG_LOG("IFRAME checks\n");
|
||||
var iframe = document.getElementById('iframe1');
|
||||
|
||||
//dump("iframe="+iframe+"\n");
|
||||
DEBUG_LOG("iframe="+iframe+"\n");
|
||||
|
||||
frames=document.frames;
|
||||
//dump("frames="+frames+"\n");
|
||||
//dump("frames.length="+frames.length+"\n");
|
||||
DEBUG_LOG("frames="+frames+"\n");
|
||||
DEBUG_LOG("frames.length="+frames.length+"\n");
|
||||
|
||||
framewin = frames[0];
|
||||
|
||||
//dump("framewin="+framewin+"\n");
|
||||
//dump("framewin.document="+framewin.document+"\n");
|
||||
DEBUG_LOG("framewin="+framewin+"\n");
|
||||
DEBUG_LOG("framewin.document="+framewin.document+"\n");
|
||||
|
||||
//dump(framewin.screenX+", "+framewin.screenY+"\n");
|
||||
//dump(framewin.scrollX+", "+framewin.scrollY+"\n");
|
||||
//dump(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
|
||||
DEBUG_LOG(framewin.screenX+", "+framewin.screenY+"\n");
|
||||
DEBUG_LOG(framewin.scrollX+", "+framewin.scrollY+"\n");
|
||||
DEBUG_LOG(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
|
||||
|
||||
var body = framewin.document.getElementsByTagName("BODY")[0];
|
||||
//dump("body="+body+"\n");
|
||||
DEBUG_LOG("body="+body+"\n");
|
||||
|
||||
var height= body.scrollHeight;
|
||||
//dump("height="+height+"\n");
|
||||
DEBUG_LOG("height="+height+"\n");
|
||||
|
||||
// iframe.height = 800;
|
||||
// iframe.width = 700;
|
||||
|
@ -764,9 +900,9 @@ function LoadHandler() {
|
|||
// framewin.sizeToContent();
|
||||
|
||||
framewin.xmltshell = xmltshell;
|
||||
//dump(framewin.xmltshell+"\n");
|
||||
DEBUG_LOG(framewin.xmltshell+"\n");
|
||||
|
||||
//dump("xmlterm: LoadHandler completed\n");
|
||||
return (false);
|
||||
DEBUG_LOG("xmlterm: LoadHandler completed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
<!-- xmlterm.html: xmlterm page -->
|
||||
<html>
|
||||
<head>
|
||||
<title>xmlterm page</title>
|
||||
|
||||
<!--
|
||||
<link title="defaultstyle" rel="stylesheet" type="text/css"
|
||||
href="chrome://xmlterm/content/xmltpage.css">
|
||||
-->
|
||||
<!--
|
||||
NOTE: Ugly workaround for modifying CSS rules until bug 53448 is fixed
|
||||
Put all the CSS stuff inline
|
||||
-->
|
||||
<style type="text/css">
|
||||
/* xmltpage.css: default style sheet for xmlterm.html */
|
||||
|
||||
BODY { font-family: monaco, courier, elite, monospace;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
DIV { margin: 0; padding-top: 0; padding-bottom: 0 }
|
||||
SPAN { margin: 0; padding-top: 0; padding-bottom: 0 }
|
||||
|
||||
PRE { margin: 0; padding-top: 0; padding-bottom: 0;
|
||||
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}
|
||||
</style>
|
||||
|
||||
<script language="JavaScript" src="XMLTermCommands.js">
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="return LoadHandler();">
|
||||
|
||||
<!-- PNG alpha meld demo
|
||||
<img src="file:///home/svn/ice.png" style="position:absolute; top:45px; right: 0px;">
|
||||
-->
|
||||
|
||||
<form name="xmltform1">
|
||||
|
||||
<span class="helplink" id="aboutxmlterm" onclick="return AboutXMLTerm();">
|
||||
About XMLTerm
|
||||
</span>
|
||||
|
||||
|
||||
<input type="button" size=4 value="New"
|
||||
onClick="return NewXMLTerm('');">
|
||||
|
||||
|
||||
<span class="helplink" onclick="return ExplainTip('level');">
|
||||
Level:</span>
|
||||
<select name="userLevel" size=1 onchange="return UpdateSettings('userLevel');">
|
||||
<option value="beginner">beginner</option>
|
||||
<option value="intermediate" selected>intermediate</option>
|
||||
<option value="advanced">advanced</option>
|
||||
</select>
|
||||
|
||||
|
||||
<span class="helplink" onclick="return ExplainTip('icons');">
|
||||
Icons:</span>
|
||||
<select name="showIcons" size=1 onchange="return UpdateSettings('showIcons');">
|
||||
<option value="off" selected>off</option>
|
||||
<option value="on">on</option>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
<span class="helplink" onclick="return ExplainTip('windows');">
|
||||
Windows:</span>
|
||||
<select name="windowsMode" size=1 onchange="return UpdateSettings('windowsMode');">
|
||||
<option value="off" selected>off</option>
|
||||
<option value="on">on</option>
|
||||
</select>
|
||||
|
||||
<input type="button" value="Save Settings"
|
||||
onClick="return SaveSettings();">
|
||||
-->
|
||||
|
||||
<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">
|
||||
|
||||
</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>
|
|
@ -25,7 +25,7 @@
|
|||
NOTE: Put all the skin stuff in the content directory for the moment
|
||||
(Otherwise every Mozilla skin will need to provide an xmlterm skin!)
|
||||
-->
|
||||
<?xml-stylesheet href="chrome://xmlterm/content/xmlterm.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://xmlterm/skin/xmlterm.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
/* xmltpage.css: default style sheet for xmlterm.html */
|
||||
|
||||
*[xmlt-block-collapsed="true"],
|
||||
*[xmlt-inline-collapsed="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
*[xmlt-underline="true"] {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
BODY { font-family: monaco, courier, elite, monospace;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
@ -56,7 +65,7 @@ SPAN.helplink { font-family: sans-serif; color: blue; cursor: hand;
|
|||
text-decoration: underline }
|
||||
|
||||
/* Level style */
|
||||
DIV.intermediate {display: block}
|
||||
DIV.intermediate {display: none}
|
||||
DIV.beginner {display: none}
|
||||
|
||||
/* Icons style */
|
||||
|
|
Загрузка…
Ссылка в новой задаче