windows-nt/Source/XPSP1/NT/admin/activec/nodemgr/viewext/ctpcommon.htm
2020-09-26 16:20:57 +08:00

288 lines
9.3 KiB
HTML

<!--NOTE: this file is expected to be ANSI - do not add any localizable strings to it !!! -->
<HTML>
<head>
<style>
body {margin:0; font: clientTop:0; icon; color: windowtext; background:window; overflow:none}
.cInline {
display:inline; width:@@TASKWIDTH@@;
margin-right:5px;
vertical-align:top;
}
BottomPanel {overflow:auto}
#FolderIcon {height:expression(TaskpadName.clientHeight + 10); width:100%;}
#TaskpadName {font: caption; color:captiontext; margin-left:0; margin-right:0; margin-top: 0; width:100%; border:0; padding-left:3; padding-top:5; padding-bottom:7;}
#TaskpadDescription {font:icon; padding-left:5px; padding-top:5px; padding-bottom:3px; padding-right:5px}
p {font-weight:normal; border:0; margin-top:0}
table {font:icon; border:0 solid; padding:0; margin:0;} <!--cellpadding and cellspacing only apply to table, but are NOT CSS attributes. Set them on a per-tag basis -->
tr {margin:0; border:0; padding:0}
td {margin:0; border:0 solid; padding:0}
div {border:0; margin:0; padding:0; }
.Task {color:expression(document.linkColor); text-decoration:underline; cursor:hand;}
.TaskHover {color:expression(document.linkColor); text-decoration:underline; cursor:hand;} <!-- Cannot use the user's hover color because once a link has been visited, the hover color never appears. So it is better
to be consistent than correct only part of the time -->
</style>
</head>
<!--update the task states for all appropriate events -->
<script language="JavaScript" for="MMCEvents" EVENT="OnSelectionChange(V, N)">UpdateState();</script>
<script language="JavaScript" for="MMCEvents" EVENT="OnContextMenuExecuted(MI)">UpdateState();</script>
<script language="JavaScript" for="MMCEvents" EVENT="OnViewChange(V, N)">UpdateState();</script>
<script language="JavaScript" for="MMCEvents" EVENT="OnToolbarButtonClicked()">UpdateState();</script>
<script language="JavaScript" for="MMCEvents" EVENT="OnListUpdated(V)">UpdateState();</script>
<script language = "JavaScript">
// Prevent text from being selected and messing up the UI.
function document.onselectstart()
{
event.returnValue = false;
}
var reColumnPattern=/\$COL<([^>]+)>/;
var reNamePattern=/\$NAME<([^>]+)>/;
var reClipFmtPattern=/\$CLIPFMT_DATA<([^>]+)>/;
var regExpClipFmt = /(.*),(.*)/;
function GetCommandLineTaskState(s)
{
var iCol, iName, iClip, nName, nCol, cCol;
var Columns = external.Columns;
var bEnabled = true; // enabled by default
while (true) // search for COL tags
{
iCol = s.search(reColumnPattern);
if(iCol==-1) // no more $COL tags
break;
nCol=parseInt(RegExp.$1) + 1; // in console taskpads, the column is zero based. Convert it to one-based here.
cCol = Columns.count;
// make sure the column exists
if(cCol < nCol)
return false;
// make sure the column is visible
if(external.Columns(nCol).Hidden)
return false;
// must have exactly one item selected for command line tasks that contain column information
if(external.Selection.count != 1)
return false;
s = s.substr(iCol+1); // skip to the next occurrence
}
while (true) // search for CLIPFMT tags
{
iClip = s.search(reClipFmtPattern);
if(iClip==-1) // no more $CLIPFMT tags
break;
// Replace the clipfmt tags
strRep = RegExp.$1; // the format at this point is item,format where item = r Or R for the current result item, 0 for the current scope item, 1 for the parent, and so on.
strRep.search(regExpClipFmt);
curItem = RegExp.$1; // item
if(curItem=='r' || curItem=='R')
{
if(external.Selection.count != 1)
return false;
}
s = s.substr(iClip+1); // skip to the next occurrence
}
return true;
}
function UpdateState()
{
var oObject = document.all.tags("SPAN"); //get the collection of all hyperlinks on the page.
var str = "";
var thisObject;
var selectionmenu = null;
var scopemenu = null;
var menuItem = null;
var selection = external.Selection;
var enabled = false;
var count = selection.count;
// get the scope node menu
scopemenu = external.ScopeNodeContextMenu;
// get the selection menu
if(selection.Count != 0) // there is a selection
{
selectionmenu = external.SelectionContextMenu;
}
if(oObject != null)
{
for(i = 0; i!= oObject.length; i++)
{
thisObject = oObject(i);
enabled = false;
// set the state of result items
if(thisObject.id == "ResultTask")
{
menuItem = null;
if(selectionmenu != null)
menuItem = selectionmenu(thisObject.parameter); // see if the object exists
if(menuItem != null)
if(menuItem.Enabled)
enabled = true;
}
else if(thisObject.id == "TargetTask") // set the state of target item tasks
{
menuItem = null;
if(scopemenu != null)
menuItem = scopemenu(thisObject.parameter); // see if the object exists
if(menuItem != null)
if(menuItem.Enabled)
enabled = true;
}
else if(thisObject.id == "CommandLineTask") // set the state of target item tasks
{
enabled = GetCommandLineTaskState(thisObject.parameter);
}
else // all other tasks are always available.
enabled = true;
// enable/disable the task based on the enabled state - the cInline object is displayed or hidden
thisObject.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = enabled ? "" : "none" ;
}
}
}
</script>
<script language="JavaScript">
function GetNthParent(nNode)
{
var curNode = external.ActiveScopeNode;
for(i = 0; i != nNode; i++) // get the nth parent
curNode = external.Document.ScopeNamespace.GetParent(curNode);
return curNode;
}
/*+-------------------------------------------------------------------------*
*
* ParseParameters
*
* PURPOSE: Performs parameter substitution. Substitute parameters are
* specified as follows:
* $COL[columnName]: Substitutes the entry under the column
* labelled columnName for the currently selected item.
* $NAME[scopeNodeIndex]: Substitutes the name of the nth parent
* of the currently selected scope node. n=0 is the currently
* selected scope node itself.
* $CLIPFMT_DATA[node,fmt]: Substitutes the clipboard format specified
* by fmt of the object specified by node, where node =
* r or R: The currently selected result item
* 0, 1, 2...: The nth parent of the currently selected
* scope node
*
*
* NOTE: The actual incoming parameters use angle braces, not square braces.
* These are converted in a pre-process step to square braces because
* jscript-xml interaction makes it difficult to use them here.
*
* RETURNS:
* function
*
*+-------------------------------------------------------------------------*/
function ParseParameters(s)
{
var t;
var strRep;
var strTemp = "";
var re=/>/;
var iCol, iName, iClip, nName, nCol;
while (true) // search for COL tags
{
iCol = s.search(reColumnPattern);
if(iCol==-1) // no more $COL tags
break;
// Replace the column tags
nCol = parseInt(RegExp.$1) + 1; // in console taskpads, the column is zero based. Convert it to one-based here.
strRep = external.CellContents(external.Selection(1), nCol);
strTemp = s.substr(0, iCol) + strRep;
// move past the closing ">"
s = s.substr(iCol);
t = s.search(re);
s = strTemp + s.substr(t+1);
}
while (true) // search for NAME tags
{
iName = s.search(reNamePattern);
if(iName==-1) // no more $NAME tags
break;
// Replace the Name tags
curNode = GetNthParent(RegExp.$1);
strRep = curNode.Name;
strTemp = s.substr(0, iName) + strRep;
// move past the closing ">"
s = s.substr(iName);
t = s.search(re);
s = strTemp + s.substr(t+1);
}
while (true) // search for CLIPFMT tags
{
iClip = s.search(reClipFmtPattern);
if(iClip==-1) // no more $CLIPFMT tags
break;
// Replace the clipfmt tags
strRep = RegExp.$1; // the format at this point is item,format where item = r Or R for the current result item, 0 for the current scope item, 1 for the parent, and so on.
strRep.search(regExpClipFmt);
curItem = RegExp.$1; // item
clipfmt = RegExp.$2; // format
if(curItem=='r' || curItem=='R')
Node = external.Selection(1);
else
Node = GetNthParent(curItem);
strRep = Node.Property(clipfmt); // get the clipboard format
strTemp = s.substr(0, iClip) + strRep;
// move past the closing ">"
s = s.substr(iClip);
t = s.search(re);
s = strTemp + s.substr(t+1);
}
return s;
}
</script>
@@ORIENTATIONSPECIFICHTML@@
</HTML>