Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

615 lines
18 KiB

<HTML>
<HEAD>
</HEAD>
<BODY>
Please select one of the items from the list below. Fields marked in red as required, in blue as optional.
<FORM name=launchAPI>
<SELECT name=selector onchange="flip()"><OPTION VALUE="-1">&lt;Choice one format&gt;</SELECT>
<TABLE id=idFields></TABLE>
<HR>
<BUTTON onClick="button_convert();">Generate URL</BUTTON><BR><P>
<DIV style='font-size: 13pt' id=outputTxt></DIV>
</FORM>
</BODY>
<SCRIPT LANGUAGE=javascript>
////////////////////////////////////////////////////////////////////////////////
function Generic_NewRow( obj, tbl )
{
var row;
row = tbl.insertRow();
row.PAYLOAD = obj;
return row;
}
function Generic_NewCell_Label( obj, row, label, fRight )
{
var cell;
cell = row.insertCell();
if(fRight)
{
cell.align = "right";
}
if(label)
{
cell.innerHTML = "<DIV NOWRAP>" + label + "</DIV>";
}
return cell;
}
function Generic_NewCell_Input( obj, row )
{
var cell;
cell = row.insertCell();
cell.style.width = "100%";
cell.innerHTML = "<INPUT TYPE=TEXT SIZE=80 STYLE='WIDTH: 100%'>";
return cell;
}
function Generic_NewDescription( obj, tbl )
{
var row;
var cell;
if(obj.description)
{
row = Generic_NewRow ( obj, tbl );
cell = Generic_NewCell_Label( obj, row, "" , false );
cell = Generic_NewCell_Label( obj, row, obj.description, false );
}
}
function Generic_NewSeparator( obj, tbl )
{
var row;
var cell;
row = tbl.insertRow();
row.PAYLOAD = obj;
cell = row.insertCell();
cell.style.height = "10px";
cell.colSpan = 2;
cell.innerHTML = "<hr>";
}
function Generic_SetColor( obj, elem )
{
elem.style.color = obj.fOptional ? "blue" : "red";
}
////////////////////////////////////////////////////////////////////////////////
function TextButton( text, desc, opt )
{
this.type = "TEXT";
this.fOptional = opt;
this.tagINPUT = null;
this.label = text ? text : "";
this.description = desc ? desc : "";
this.Validate = function () { return true; };
this.GetValue = function () { return this.tagINPUT.value; };
this.Generate = TextButton_Generate;
}
function TextButton_Generate( tbl )
{
var row;
var cell;
Generic_NewSeparator( this, tbl );
////////////////////////////////////////
row = Generic_NewRow ( this, tbl );
cell = Generic_NewCell_Label( this, row, this.label, true ); Generic_SetColor( this, cell );
cell = Generic_NewCell_Input( this, row ); this.tagINPUT = cell.all.tags("INPUT").item(0);
////////////////////////////////////////
Generic_NewDescription( this, tbl );
}
////////////////////////////////////////////////////////////////////////////////
function TaxonomyButton( text, desc, opt )
{
this.type = "TAXONOMY";
this.fOptional = opt;
this.tagINPUT = null;
this.label = text ? text : "";
this.description = desc ? desc : "";
this.Validate = TaxonomyButton_Validate;
this.GetValue = TaxonomyButton_GetValue;
this.Generate = TaxonomyButton_Generate;
}
function TaxonomyButton_Generate( tbl )
{
var html;
var row;
var cell;
Generic_NewSeparator( this, tbl );
////////////////////////////////////////
row = Generic_NewRow ( this, tbl );
cell = Generic_NewCell_Label( this, row, this.label, true ); Generic_SetColor( this, cell );
cell = Generic_NewCell_Input( this, row ); this.tagINPUT = cell.all.tags("INPUT").item(0);
////////////////////////////////////////
Generic_NewDescription( this, tbl );
}
function TaxonomyButton_Validate( fPopup )
{
var value = this.GetValue();
if(value == "" || value.match( / /ig ))
{
if(fPopup)
{
alert( "This is not a valid value for a taxonomy path" );
this.tagINPUT.focus();
}
return false;
}
return true;
}
function TaxonomyButton_GetValue()
{
return this.tagINPUT.value;
}
////////////////////////////////////////////////////////////////////////////////
function HyperLinkButton( text, desc, opt )
{
this.type = "HYPERLINK";
this.fOptional = opt;
this.tagUSECHM = null;
this.tagROW1 = null;
this.tagROW2 = null;
this.tagROW3 = null;
this.tagROW4 = null;
this.tagURL = null;
this.tagCHM = null;
this.tagPAGE = null;
this.label = text ? text : "";
this.description = desc ? desc : "";
this.Validate = HyperLinkButton_Validate;
this.GetValue = HyperLinkButton_GetValue;
this.Generate = HyperLinkButton_Generate;
}
function HyperLinkButton_Validate( fPopup )
{
if(this.tagUSECHM.checked)
{
if(this.tagCHM.value == "")
{
if(fPopup)
{
alert( "You must enter the CHM name" );
this.tagCHM.focus();
}
return false;
}
if(this.tagPAGE.value == "")
{
if(fPopup)
{
alert( "You must enter the page to display from the CHM" );
this.tagPAGE.focus();
}
return false;
}
}
else
{
if(this.tagURL.value == "")
{
if(fPopup)
{
alert( "You must enter something for the URL" );
this.tagURL.focus();
}
return false;
}
}
return true;
}
function HyperLinkButton_GetValue()
{
if(this.tagUSECHM.checked)
{
return "MS-ITS:%HELP_LOCATION%\\" + this.tagCHM.value + "::/" + this.tagPAGE.value;
}
else
{
return this.tagURL.value;
}
}
function HyperLinkButton_Generate( tbl )
{
var html;
var row;
var cell;
Generic_NewSeparator( this, tbl );
////////////////////////////////////////
row = Generic_NewRow ( this, tbl ); this.tagROW1 = row;
cell = Generic_NewCell_Label( this, row, this.label, true ); Generic_SetColor( this, cell );
cell = row.insertCell();
cell.innerHTML = "<INPUT type=checkbox id=idUSECHM onclick='HyperLinkButton_onClick();'><LABEL FOR=idUSECHM>Construct URL from CHM";
this.tagUSECHM = cell.all.tags("INPUT").item(0);
////////////////////////////////////////
row = Generic_NewRow ( this, tbl ); this.tagROW2 = row;
cell = Generic_NewCell_Label( this, row, "" , false );
cell = Generic_NewCell_Input( this, row ); this.tagURL = cell.all.tags("INPUT").item(0);
cell = Generic_NewCell_Label( this, row, "&lt;&lt; Full URL", false );
////////////////////////////////////////
row = Generic_NewRow ( this, tbl ); this.tagROW3 = row; row.style.display = "none";
cell = Generic_NewCell_Label( this, row, "" , false );
cell = Generic_NewCell_Input( this, row ); this.tagCHM = cell.all.tags("INPUT").item(0);
cell = Generic_NewCell_Label( this, row, "&lt;&lt; CHM path", false );
////////////////////////////////////////
row = Generic_NewRow ( this, tbl ); this.tagROW4 = row; row.style.display = "none";
cell = Generic_NewCell_Label( this, row, "" , false );
cell = Generic_NewCell_Input( this, row ); this.tagPAGE = cell.all.tags("INPUT").item(0);
cell = Generic_NewCell_Label( this, row, "&lt;&lt; Page inside the CHM", false );
////////////////////////////////////////
Generic_NewDescription( this, tbl );
}
function HyperLinkButton_onClick()
{
var elem = event.srcElement;
while(elem && !elem.PAYLOAD)
{
elem = elem.parentElement;
}
if(elem)
{
var obj = elem.PAYLOAD;
if(obj.tagUSECHM.checked)
{
obj.tagROW2.style.display = "none";
obj.tagROW3.style.display = "";
obj.tagROW4.style.display = "";
}
else
{
obj.tagROW2.style.display = "";
obj.tagROW3.style.display = "none";
obj.tagROW4.style.display = "none";
}
}
}
////////////////////////////////////////////////////////////////////////////////
function UrlType( base, desc, arr )
{
this.base = base;
this.desc = desc;
this.arr = arr;
this.Generate = UrlType_Generate;
this.GetValue = UrlType_GetValue;
}
function UrlType_Generate( tbl )
{
var i;
Common_ClearTable( tbl );
for(i in this.arr)
{
var ptr = this.arr[i];
ptr[1].Generate( tbl );
}
g_SELECTED = this;
}
//
// When start button pressed:
//
function UrlType_GetValue()
{
var res = this.base;
var fSeen = false;
var i;
for(i in this.arr)
{
var ptr = this.arr[i];
var obj = ptr[1];
if(obj.fOptional == false && obj.Validate( true ) == false) return null;
}
for(i in this.arr)
{
var ptr = this.arr[i];
var txt = ptr[0];
var obj = ptr[1];
var value = obj.GetValue();
if(obj.fOptional && (obj.Validate( false ) == false || value == "")) continue;
if(txt == "")
{
res += obj.GetValue();
}
else
{
var esc = Common_EscapeURL( obj.GetValue() );
res += (fSeen ? "&" : "?"); fSeen = true;
res += txt + "=" + esc;
}
}
return res;
}
////////////////////////////////////////////////////////////////////////////////
function Common_ClearTable( tbl )
{
if(tbl == null) return;
var i;
var lCount = tbl.rows.length;
for(i=0; i<lCount; i++)
{
tbl.deleteRow(0);
}
}
function Common_UnescapeURL( url )
{
return unescape( url.replace( /\+/g , " " ) );
}
function Common_EscapeURL( url )
{
var esc;
esc = url;
esc = escape( esc );
esc = esc.replace( /\+/g , "%2B" );
esc = esc.replace( /\%20/g, "+" );
return esc;
}
function Common_DecodeQueryString( url )
{
var obj = new Object();
var pos;
var arr;
pos = url.indexOf( "?" );
if(pos == -1)
{
obj.url = url;
obj.query = {};
}
else
{
obj.query = {};
obj.url = url.substr( 0 , pos );
arr = url.substr( pos+1 ).split( "&" );
for(pos in arr)
{
var subarr = arr[pos].split( "=" );
obj.query[ Common_UnescapeURL( subarr[0] ) ] = Common_UnescapeURL( subarr[1] );
}
}
return obj;
}
////////////////////////////////////////////////////////////////////////////////
function button_convert()
{
var res = g_SELECTED.GetValue();
if(res) outputTxt.innerText = res;
}
function flip()
{
var obj = event.srcElement;
var i = obj.options[obj.selectedIndex].value;
if(i != -1)
{
g_LIST[i].Generate( idFields );
outputTxt.innerText = "";
}
}
////////////////////////////////////////////////////////////////////////////////
var g_CENTER_HOMEPAGE = new UrlType( "hcp://services/centers/homepage", "Center - HOMEPAGE", [ ] );
var g_CENTER_SUPPORT = new UrlType( "hcp://services/centers/support" , "Center - SUPPORT" , [ [ "topic", new HyperLinkButton( "Optional topic to display", null, true ) ] ] );
var g_CENTER_OPTIONS = new UrlType( "hcp://services/centers/options" , "Center - OPTIONS" , [ [ "topic", new HyperLinkButton( "Optional topic to display", null, true ) ] ] );
var g_CENTER_UPDATE = new UrlType( "hcp://services/centers/update" , "Center - UPDATE" , [ ] );
var g_CENTER_COMPAT = new UrlType( "hcp://services/centers/compat" , "Center - COMPAT" , [ ] );
var g_CENTER_TOOLS = new UrlType( "hcp://services/centers/tools" , "Center - TOOLS" , [ [ "topic", new HyperLinkButton( "Optional topic to display", null, true ) ] ] );
var g_CENTER_ERRMSG = new UrlType( "hcp://services/centers/errmsg" , "Center - ERRMSG" , [ ] );
////////////////////////////////////////
var g_SEARCH = new UrlType( "hcp://services/search",
"Query" ,
[
[ "query", new TextButton( "Query", "i.e.: Modem", false ) ] // query=<text to look up>
] );
var g_INDEX = new UrlType( "hcp://services/index",
"Index" ,
[
[ "scope" , new TextButton ( "List of scope names" , "i.e.: &lt;SYSTEM&gt;" , true ) ], // scope=<optional island of help ID>
[ "select", new TextButton ( "Scope to display by default", "i.e.: Getting_Started/New_Features", true ) ], // select=<optional default scope>
[ "topic" , new HyperLinkButton( "Topic to display" , null , true ) ] // topic=<url of the topic to display>
] );
var g_SUBSITE = new UrlType( "hcp://services/subsite",
"Subsite" ,
[
[ "node" , new TaxonomyButton ( "Root of the subsite", "i.e.: Getting_Started" , false ) ], // node=<subsite location>
[ "topic" , new HyperLinkButton( "Topic to display" , null , true ) ], // topic=<url of the topic to display>
[ "select", new TaxonomyButton ( "Node to highlight" , "i.e.: Getting_Started/New_Features", true ) ] // select=<subnode to highlight>
] );
////////////////////////////////////////
var g_LAYOUT_FULLWINDOW = new UrlType( "hcp://services/layout/fullwindow",
"Layout - FullWindow" ,
[
[ "topic", new HyperLinkButton( "Topic to display", null, false ) ] // topic=<url of the topic to display>
] );
var g_LAYOUT_CONTENTONLY = new UrlType( "hcp://services/layout/contentonly",
"Layout - Content Only" ,
[
[ "topic", new HyperLinkButton( "Topic to display", null, false ) ] // topic=<url of the topic to display>
] );
var g_LAYOUT_KIOSK = new UrlType( "hcp://services/layout/kiosk",
"Layout - Kiosk mode" ,
[
[ "topic", new HyperLinkButton( "Topic to display", null, false ) ] // topic=<url of the topic to display>
] );
var g_LAYOUT_XML = new UrlType( "hcp://services/layout/xml",
"Layout - XML definition",
[
[ "definition", new HyperLinkButton( "XML layout" , null, false ) ], // definition=<url of the layout definition>
[ "topic" , new HyperLinkButton( "Topic to display", null, true ) ] // topic=<url of the topic to display>
] );
////////////////////////////////////////
var g_REDIRECT = new UrlType( "hcp://services/redirect",
"Offline redirection" ,
[
[ "online" , new HyperLinkButton( "Primary URL", "This is the URL to display when user is online", false ) ], // online=<url>
[ "offline", new HyperLinkButton( "Backup URL" , "This is the URL to display in case of failure" , false ) ] // offline=<backup url>
] );
var g_APPLICATION = new UrlType( "app:" ,
"Application Launch",
[
[ "" , new TextButton ( "Application to launch" , "i.e.: %WINDIR%\Notepad.exe" , false ) ], // <application to launch>
[ "arg" , new TextButton ( "Optional arguments" , null , true ) ], // arg=<optional arguments>
[ "topic", new HyperLinkButton( "Optional topic to display", "i.e.: hcp://system/blurbs/note.htm", true ) ] // topic=<url of the topic to display>
] );
////////////////////////////////////////////////////////////////////////////////
g_SELECTED = null;
var g_LIST = [
g_SUBSITE ,
g_SEARCH ,
g_APPLICATION ,
g_REDIRECT ,
g_LAYOUT_FULLWINDOW ,
g_LAYOUT_CONTENTONLY,
g_LAYOUT_KIOSK ,
g_LAYOUT_XML ,
g_INDEX ,
g_CENTER_HOMEPAGE ,
g_CENTER_SUPPORT ,
g_CENTER_OPTIONS ,
g_CENTER_UPDATE ,
g_CENTER_COMPAT ,
g_CENTER_TOOLS ,
g_CENTER_ERRMSG ,
];
for(var i in g_LIST)
{
var newElem = document.createElement( "OPTION" );
var obj = g_LIST[i];
newElem.text = obj.desc;
newElem.value = i;
document.launchAPI.selector.add(newElem);
}
</SCRIPT>
</HTML>