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

  1. <HTML>
  2. <HEAD>
  3. </HEAD>
  4. <BODY>
  5. Please select one of the items from the list below. Fields marked in red as required, in blue as optional.
  6. <FORM name=launchAPI>
  7. <SELECT name=selector onchange="flip()"><OPTION VALUE="-1">&lt;Choice one format&gt;</SELECT>
  8. <TABLE id=idFields></TABLE>
  9. <HR>
  10. <BUTTON onClick="button_convert();">Generate URL</BUTTON><BR><P>
  11. <DIV style='font-size: 13pt' id=outputTxt></DIV>
  12. </FORM>
  13. </BODY>
  14. <SCRIPT LANGUAGE=javascript>
  15. ////////////////////////////////////////////////////////////////////////////////
  16. function Generic_NewRow( obj, tbl )
  17. {
  18. var row;
  19. row = tbl.insertRow();
  20. row.PAYLOAD = obj;
  21. return row;
  22. }
  23. function Generic_NewCell_Label( obj, row, label, fRight )
  24. {
  25. var cell;
  26. cell = row.insertCell();
  27. if(fRight)
  28. {
  29. cell.align = "right";
  30. }
  31. if(label)
  32. {
  33. cell.innerHTML = "<DIV NOWRAP>" + label + "</DIV>";
  34. }
  35. return cell;
  36. }
  37. function Generic_NewCell_Input( obj, row )
  38. {
  39. var cell;
  40. cell = row.insertCell();
  41. cell.style.width = "100%";
  42. cell.innerHTML = "<INPUT TYPE=TEXT SIZE=80 STYLE='WIDTH: 100%'>";
  43. return cell;
  44. }
  45. function Generic_NewDescription( obj, tbl )
  46. {
  47. var row;
  48. var cell;
  49. if(obj.description)
  50. {
  51. row = Generic_NewRow ( obj, tbl );
  52. cell = Generic_NewCell_Label( obj, row, "" , false );
  53. cell = Generic_NewCell_Label( obj, row, obj.description, false );
  54. }
  55. }
  56. function Generic_NewSeparator( obj, tbl )
  57. {
  58. var row;
  59. var cell;
  60. row = tbl.insertRow();
  61. row.PAYLOAD = obj;
  62. cell = row.insertCell();
  63. cell.style.height = "10px";
  64. cell.colSpan = 2;
  65. cell.innerHTML = "<hr>";
  66. }
  67. function Generic_SetColor( obj, elem )
  68. {
  69. elem.style.color = obj.fOptional ? "blue" : "red";
  70. }
  71. ////////////////////////////////////////////////////////////////////////////////
  72. function TextButton( text, desc, opt )
  73. {
  74. this.type = "TEXT";
  75. this.fOptional = opt;
  76. this.tagINPUT = null;
  77. this.label = text ? text : "";
  78. this.description = desc ? desc : "";
  79. this.Validate = function () { return true; };
  80. this.GetValue = function () { return this.tagINPUT.value; };
  81. this.Generate = TextButton_Generate;
  82. }
  83. function TextButton_Generate( tbl )
  84. {
  85. var row;
  86. var cell;
  87. Generic_NewSeparator( this, tbl );
  88. ////////////////////////////////////////
  89. row = Generic_NewRow ( this, tbl );
  90. cell = Generic_NewCell_Label( this, row, this.label, true ); Generic_SetColor( this, cell );
  91. cell = Generic_NewCell_Input( this, row ); this.tagINPUT = cell.all.tags("INPUT").item(0);
  92. ////////////////////////////////////////
  93. Generic_NewDescription( this, tbl );
  94. }
  95. ////////////////////////////////////////////////////////////////////////////////
  96. function TaxonomyButton( text, desc, opt )
  97. {
  98. this.type = "TAXONOMY";
  99. this.fOptional = opt;
  100. this.tagINPUT = null;
  101. this.label = text ? text : "";
  102. this.description = desc ? desc : "";
  103. this.Validate = TaxonomyButton_Validate;
  104. this.GetValue = TaxonomyButton_GetValue;
  105. this.Generate = TaxonomyButton_Generate;
  106. }
  107. function TaxonomyButton_Generate( tbl )
  108. {
  109. var html;
  110. var row;
  111. var cell;
  112. Generic_NewSeparator( this, tbl );
  113. ////////////////////////////////////////
  114. row = Generic_NewRow ( this, tbl );
  115. cell = Generic_NewCell_Label( this, row, this.label, true ); Generic_SetColor( this, cell );
  116. cell = Generic_NewCell_Input( this, row ); this.tagINPUT = cell.all.tags("INPUT").item(0);
  117. ////////////////////////////////////////
  118. Generic_NewDescription( this, tbl );
  119. }
  120. function TaxonomyButton_Validate( fPopup )
  121. {
  122. var value = this.GetValue();
  123. if(value == "" || value.match( / /ig ))
  124. {
  125. if(fPopup)
  126. {
  127. alert( "This is not a valid value for a taxonomy path" );
  128. this.tagINPUT.focus();
  129. }
  130. return false;
  131. }
  132. return true;
  133. }
  134. function TaxonomyButton_GetValue()
  135. {
  136. return this.tagINPUT.value;
  137. }
  138. ////////////////////////////////////////////////////////////////////////////////
  139. function HyperLinkButton( text, desc, opt )
  140. {
  141. this.type = "HYPERLINK";
  142. this.fOptional = opt;
  143. this.tagUSECHM = null;
  144. this.tagROW1 = null;
  145. this.tagROW2 = null;
  146. this.tagROW3 = null;
  147. this.tagROW4 = null;
  148. this.tagURL = null;
  149. this.tagCHM = null;
  150. this.tagPAGE = null;
  151. this.label = text ? text : "";
  152. this.description = desc ? desc : "";
  153. this.Validate = HyperLinkButton_Validate;
  154. this.GetValue = HyperLinkButton_GetValue;
  155. this.Generate = HyperLinkButton_Generate;
  156. }
  157. function HyperLinkButton_Validate( fPopup )
  158. {
  159. if(this.tagUSECHM.checked)
  160. {
  161. if(this.tagCHM.value == "")
  162. {
  163. if(fPopup)
  164. {
  165. alert( "You must enter the CHM name" );
  166. this.tagCHM.focus();
  167. }
  168. return false;
  169. }
  170. if(this.tagPAGE.value == "")
  171. {
  172. if(fPopup)
  173. {
  174. alert( "You must enter the page to display from the CHM" );
  175. this.tagPAGE.focus();
  176. }
  177. return false;
  178. }
  179. }
  180. else
  181. {
  182. if(this.tagURL.value == "")
  183. {
  184. if(fPopup)
  185. {
  186. alert( "You must enter something for the URL" );
  187. this.tagURL.focus();
  188. }
  189. return false;
  190. }
  191. }
  192. return true;
  193. }
  194. function HyperLinkButton_GetValue()
  195. {
  196. if(this.tagUSECHM.checked)
  197. {
  198. return "MS-ITS:%HELP_LOCATION%\\" + this.tagCHM.value + "::/" + this.tagPAGE.value;
  199. }
  200. else
  201. {
  202. return this.tagURL.value;
  203. }
  204. }
  205. function HyperLinkButton_Generate( tbl )
  206. {
  207. var html;
  208. var row;
  209. var cell;
  210. Generic_NewSeparator( this, tbl );
  211. ////////////////////////////////////////
  212. row = Generic_NewRow ( this, tbl ); this.tagROW1 = row;
  213. cell = Generic_NewCell_Label( this, row, this.label, true ); Generic_SetColor( this, cell );
  214. cell = row.insertCell();
  215. cell.innerHTML = "<INPUT type=checkbox id=idUSECHM onclick='HyperLinkButton_onClick();'><LABEL FOR=idUSECHM>Construct URL from CHM";
  216. this.tagUSECHM = cell.all.tags("INPUT").item(0);
  217. ////////////////////////////////////////
  218. row = Generic_NewRow ( this, tbl ); this.tagROW2 = row;
  219. cell = Generic_NewCell_Label( this, row, "" , false );
  220. cell = Generic_NewCell_Input( this, row ); this.tagURL = cell.all.tags("INPUT").item(0);
  221. cell = Generic_NewCell_Label( this, row, "&lt;&lt; Full URL", false );
  222. ////////////////////////////////////////
  223. row = Generic_NewRow ( this, tbl ); this.tagROW3 = row; row.style.display = "none";
  224. cell = Generic_NewCell_Label( this, row, "" , false );
  225. cell = Generic_NewCell_Input( this, row ); this.tagCHM = cell.all.tags("INPUT").item(0);
  226. cell = Generic_NewCell_Label( this, row, "&lt;&lt; CHM path", false );
  227. ////////////////////////////////////////
  228. row = Generic_NewRow ( this, tbl ); this.tagROW4 = row; row.style.display = "none";
  229. cell = Generic_NewCell_Label( this, row, "" , false );
  230. cell = Generic_NewCell_Input( this, row ); this.tagPAGE = cell.all.tags("INPUT").item(0);
  231. cell = Generic_NewCell_Label( this, row, "&lt;&lt; Page inside the CHM", false );
  232. ////////////////////////////////////////
  233. Generic_NewDescription( this, tbl );
  234. }
  235. function HyperLinkButton_onClick()
  236. {
  237. var elem = event.srcElement;
  238. while(elem && !elem.PAYLOAD)
  239. {
  240. elem = elem.parentElement;
  241. }
  242. if(elem)
  243. {
  244. var obj = elem.PAYLOAD;
  245. if(obj.tagUSECHM.checked)
  246. {
  247. obj.tagROW2.style.display = "none";
  248. obj.tagROW3.style.display = "";
  249. obj.tagROW4.style.display = "";
  250. }
  251. else
  252. {
  253. obj.tagROW2.style.display = "";
  254. obj.tagROW3.style.display = "none";
  255. obj.tagROW4.style.display = "none";
  256. }
  257. }
  258. }
  259. ////////////////////////////////////////////////////////////////////////////////
  260. function UrlType( base, desc, arr )
  261. {
  262. this.base = base;
  263. this.desc = desc;
  264. this.arr = arr;
  265. this.Generate = UrlType_Generate;
  266. this.GetValue = UrlType_GetValue;
  267. }
  268. function UrlType_Generate( tbl )
  269. {
  270. var i;
  271. Common_ClearTable( tbl );
  272. for(i in this.arr)
  273. {
  274. var ptr = this.arr[i];
  275. ptr[1].Generate( tbl );
  276. }
  277. g_SELECTED = this;
  278. }
  279. //
  280. // When start button pressed:
  281. //
  282. function UrlType_GetValue()
  283. {
  284. var res = this.base;
  285. var fSeen = false;
  286. var i;
  287. for(i in this.arr)
  288. {
  289. var ptr = this.arr[i];
  290. var obj = ptr[1];
  291. if(obj.fOptional == false && obj.Validate( true ) == false) return null;
  292. }
  293. for(i in this.arr)
  294. {
  295. var ptr = this.arr[i];
  296. var txt = ptr[0];
  297. var obj = ptr[1];
  298. var value = obj.GetValue();
  299. if(obj.fOptional && (obj.Validate( false ) == false || value == "")) continue;
  300. if(txt == "")
  301. {
  302. res += obj.GetValue();
  303. }
  304. else
  305. {
  306. var esc = Common_EscapeURL( obj.GetValue() );
  307. res += (fSeen ? "&" : "?"); fSeen = true;
  308. res += txt + "=" + esc;
  309. }
  310. }
  311. return res;
  312. }
  313. ////////////////////////////////////////////////////////////////////////////////
  314. function Common_ClearTable( tbl )
  315. {
  316. if(tbl == null) return;
  317. var i;
  318. var lCount = tbl.rows.length;
  319. for(i=0; i<lCount; i++)
  320. {
  321. tbl.deleteRow(0);
  322. }
  323. }
  324. function Common_UnescapeURL( url )
  325. {
  326. return unescape( url.replace( /\+/g , " " ) );
  327. }
  328. function Common_EscapeURL( url )
  329. {
  330. var esc;
  331. esc = url;
  332. esc = escape( esc );
  333. esc = esc.replace( /\+/g , "%2B" );
  334. esc = esc.replace( /\%20/g, "+" );
  335. return esc;
  336. }
  337. function Common_DecodeQueryString( url )
  338. {
  339. var obj = new Object();
  340. var pos;
  341. var arr;
  342. pos = url.indexOf( "?" );
  343. if(pos == -1)
  344. {
  345. obj.url = url;
  346. obj.query = {};
  347. }
  348. else
  349. {
  350. obj.query = {};
  351. obj.url = url.substr( 0 , pos );
  352. arr = url.substr( pos+1 ).split( "&" );
  353. for(pos in arr)
  354. {
  355. var subarr = arr[pos].split( "=" );
  356. obj.query[ Common_UnescapeURL( subarr[0] ) ] = Common_UnescapeURL( subarr[1] );
  357. }
  358. }
  359. return obj;
  360. }
  361. ////////////////////////////////////////////////////////////////////////////////
  362. function button_convert()
  363. {
  364. var res = g_SELECTED.GetValue();
  365. if(res) outputTxt.innerText = res;
  366. }
  367. function flip()
  368. {
  369. var obj = event.srcElement;
  370. var i = obj.options[obj.selectedIndex].value;
  371. if(i != -1)
  372. {
  373. g_LIST[i].Generate( idFields );
  374. outputTxt.innerText = "";
  375. }
  376. }
  377. ////////////////////////////////////////////////////////////////////////////////
  378. var g_CENTER_HOMEPAGE = new UrlType( "hcp://services/centers/homepage", "Center - HOMEPAGE", [ ] );
  379. var g_CENTER_SUPPORT = new UrlType( "hcp://services/centers/support" , "Center - SUPPORT" , [ [ "topic", new HyperLinkButton( "Optional topic to display", null, true ) ] ] );
  380. var g_CENTER_OPTIONS = new UrlType( "hcp://services/centers/options" , "Center - OPTIONS" , [ [ "topic", new HyperLinkButton( "Optional topic to display", null, true ) ] ] );
  381. var g_CENTER_UPDATE = new UrlType( "hcp://services/centers/update" , "Center - UPDATE" , [ ] );
  382. var g_CENTER_COMPAT = new UrlType( "hcp://services/centers/compat" , "Center - COMPAT" , [ ] );
  383. var g_CENTER_TOOLS = new UrlType( "hcp://services/centers/tools" , "Center - TOOLS" , [ [ "topic", new HyperLinkButton( "Optional topic to display", null, true ) ] ] );
  384. var g_CENTER_ERRMSG = new UrlType( "hcp://services/centers/errmsg" , "Center - ERRMSG" , [ ] );
  385. ////////////////////////////////////////
  386. var g_SEARCH = new UrlType( "hcp://services/search",
  387. "Query" ,
  388. [
  389. [ "query", new TextButton( "Query", "i.e.: Modem", false ) ] // query=<text to look up>
  390. ] );
  391. var g_INDEX = new UrlType( "hcp://services/index",
  392. "Index" ,
  393. [
  394. [ "scope" , new TextButton ( "List of scope names" , "i.e.: &lt;SYSTEM&gt;" , true ) ], // scope=<optional island of help ID>
  395. [ "select", new TextButton ( "Scope to display by default", "i.e.: Getting_Started/New_Features", true ) ], // select=<optional default scope>
  396. [ "topic" , new HyperLinkButton( "Topic to display" , null , true ) ] // topic=<url of the topic to display>
  397. ] );
  398. var g_SUBSITE = new UrlType( "hcp://services/subsite",
  399. "Subsite" ,
  400. [
  401. [ "node" , new TaxonomyButton ( "Root of the subsite", "i.e.: Getting_Started" , false ) ], // node=<subsite location>
  402. [ "topic" , new HyperLinkButton( "Topic to display" , null , true ) ], // topic=<url of the topic to display>
  403. [ "select", new TaxonomyButton ( "Node to highlight" , "i.e.: Getting_Started/New_Features", true ) ] // select=<subnode to highlight>
  404. ] );
  405. ////////////////////////////////////////
  406. var g_LAYOUT_FULLWINDOW = new UrlType( "hcp://services/layout/fullwindow",
  407. "Layout - FullWindow" ,
  408. [
  409. [ "topic", new HyperLinkButton( "Topic to display", null, false ) ] // topic=<url of the topic to display>
  410. ] );
  411. var g_LAYOUT_CONTENTONLY = new UrlType( "hcp://services/layout/contentonly",
  412. "Layout - Content Only" ,
  413. [
  414. [ "topic", new HyperLinkButton( "Topic to display", null, false ) ] // topic=<url of the topic to display>
  415. ] );
  416. var g_LAYOUT_KIOSK = new UrlType( "hcp://services/layout/kiosk",
  417. "Layout - Kiosk mode" ,
  418. [
  419. [ "topic", new HyperLinkButton( "Topic to display", null, false ) ] // topic=<url of the topic to display>
  420. ] );
  421. var g_LAYOUT_XML = new UrlType( "hcp://services/layout/xml",
  422. "Layout - XML definition",
  423. [
  424. [ "definition", new HyperLinkButton( "XML layout" , null, false ) ], // definition=<url of the layout definition>
  425. [ "topic" , new HyperLinkButton( "Topic to display", null, true ) ] // topic=<url of the topic to display>
  426. ] );
  427. ////////////////////////////////////////
  428. var g_REDIRECT = new UrlType( "hcp://services/redirect",
  429. "Offline redirection" ,
  430. [
  431. [ "online" , new HyperLinkButton( "Primary URL", "This is the URL to display when user is online", false ) ], // online=<url>
  432. [ "offline", new HyperLinkButton( "Backup URL" , "This is the URL to display in case of failure" , false ) ] // offline=<backup url>
  433. ] );
  434. var g_APPLICATION = new UrlType( "app:" ,
  435. "Application Launch",
  436. [
  437. [ "" , new TextButton ( "Application to launch" , "i.e.: %WINDIR%\Notepad.exe" , false ) ], // <application to launch>
  438. [ "arg" , new TextButton ( "Optional arguments" , null , true ) ], // arg=<optional arguments>
  439. [ "topic", new HyperLinkButton( "Optional topic to display", "i.e.: hcp://system/blurbs/note.htm", true ) ] // topic=<url of the topic to display>
  440. ] );
  441. ////////////////////////////////////////////////////////////////////////////////
  442. g_SELECTED = null;
  443. var g_LIST = [
  444. g_SUBSITE ,
  445. g_SEARCH ,
  446. g_APPLICATION ,
  447. g_REDIRECT ,
  448. g_LAYOUT_FULLWINDOW ,
  449. g_LAYOUT_CONTENTONLY,
  450. g_LAYOUT_KIOSK ,
  451. g_LAYOUT_XML ,
  452. g_INDEX ,
  453. g_CENTER_HOMEPAGE ,
  454. g_CENTER_SUPPORT ,
  455. g_CENTER_OPTIONS ,
  456. g_CENTER_UPDATE ,
  457. g_CENTER_COMPAT ,
  458. g_CENTER_TOOLS ,
  459. g_CENTER_ERRMSG ,
  460. ];
  461. for(var i in g_LIST)
  462. {
  463. var newElem = document.createElement( "OPTION" );
  464. var obj = g_LIST[i];
  465. newElem.text = obj.desc;
  466. newElem.value = i;
  467. document.launchAPI.selector.add(newElem);
  468. }
  469. </SCRIPT>
  470. </HTML>