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.

373 lines
12 KiB

  1. <%@LANGUAGE=JScript%>
  2. <!-- #INCLUDE FILE='Global_ServerUtils.asp' -->
  3. <!-- #INCLUDE FILE='Global_DBUtils.asp' -->
  4. <%
  5. var Language = new String( Request.QueryString("Lang") );
  6. if ( Language == "ja" )
  7. {
  8. Session.CodePage = 932;
  9. Response.CharSet = "shift-jis";
  10. }
  11. else
  12. {
  13. Session.CodePage = 1252
  14. Response.CharSet="iso-8859-1"
  15. }
  16. var TemplateID = Request.QueryString("Val");
  17. var TemplateName = "";
  18. var TemplateDescription = new String();
  19. var LangButtons = "";
  20. var TemplateData = { en : { BtnColor : "red"},
  21. ja : { BtnColor : "red" },
  22. de : { BtnColor : "red" },
  23. fr : { BtnColor : "red" }
  24. };
  25. //get database connection object g_DBConn
  26. var g_DBConn = GetDBConnection( Application("SOLUTIONS3") )
  27. function fnCleanText ( text )
  28. {
  29. try
  30. {
  31. text = text.replace( /\n|\r/g, "" );
  32. text = text.replace( /"/g, "'" );
  33. }
  34. catch( err )
  35. {
  36. return "undefined"
  37. }
  38. return text
  39. }
  40. if ( TemplateID != -1 )
  41. {
  42. try
  43. {
  44. rsTemplateData = g_DBConn.Execute( "SEP_GetTemplateData " + TemplateID )
  45. TemplateName = String(rsTemplateData("TemplateName")).replace( /\n|\r/g, "" );
  46. //Response.Write("What the hell: " + rsTemplateData("Description") + "<BR>" )
  47. while ( !rsTemplateData.EOF )
  48. {
  49. //Response.Write("Language: " + Language + " rsTemplatedata: " + rsTemplateData("Lang") + "<BR>");
  50. //Response.Write("Language: " + String( Language ).length + " rsTemplatedata: " + String(rsTemplateData("Lang")).length + "<BR>");
  51. //var rsLang = new String( rsTemplateData("Lang") )
  52. //Response.Write("rslang: " + typeof( rsLang ) + " typeof language: " + typeof( Language ) + " desc: " + rsTemplateData("Description") )
  53. //if ( rsLang.toString() == Language.toString() )
  54. if ( rsTemplateData("Lang") == Language.toString() )
  55. {
  56. var TemplateDescription = new String( rsTemplateData("Description") )
  57. //Response.Write("<BR>Set description: " + TemplateDescription );
  58. }
  59. TemplateData[ String(rsTemplateData("Lang"))].BtnColor = ""
  60. //pTemplateDescription = TemplateDescription.replace( /\n|\r/g, "" );
  61. //pTemplateDescription = pTemplateDescription.replace( /"/g, "'" );
  62. //TemplateData[ String(rsTemplateData("Lang"))].TemplateName = new String(rsTemplateData("TemplateName")).replace( /\n|\r/g, "" );
  63. //TemplateData[ String(rsTemplateData("Lang"))].BodyText = new String( pTemplateDescription )
  64. //TemplateData[ String(rsTemplateData("Lang"))].BtnColor = ""
  65. rsTemplateData.moveNext();
  66. }
  67. g_DBConn.Close()
  68. }
  69. catch ( err )
  70. {
  71. Response.Write( "Could not execute SEP_GetTemplateData(...)<BR>" )
  72. Response.Write( "[" + err.number + "] " + err.description )
  73. Response.End
  74. }
  75. }
  76. else
  77. {
  78. TemplateName = "New template";
  79. TemplateDescription="<p class='clsPTitle'>Place Template Title Here</p>\n<p>Place prelim text here</p>\n<p class='clsPSubTitle'>Analysis</p>\n<p>Place analysis text here</p>\n<p class='clsPSubTitle'>Getting Help</p>\n<p>Place additional help text here</p>"
  80. }
  81. %>
  82. <html>
  83. <head>
  84. <title>template</title>
  85. <link rel="stylesheet" TYPE="text/css" HREF="/main.css">
  86. <link rel="stylesheet" TYPE="text/css" HREF="/CustomStyles.css">
  87. </head>
  88. <body bgcolor='#ffffff' topmargin='0' leftmargin='0' marginheight='0' marginwidth='0' tabindex=0>
  89. <form ID='frmTemplate' action='SEP_GoSubmitTemplate.asp' method='post'>
  90. <input type='hidden' id='TemplateID' name='TemplateID' readonly value='<%=TemplateID%>'>
  91. <input type='hidden' id='Lang' name='Lang' readonly value='<%=Language%>'>
  92. <table cellspacing='0' class='ContentArea' border='0'>
  93. <tr>
  94. <td colspan='2' nowrap>
  95. <p class='clsPTitle'>Create/Edit Template - Template ID : <%=TemplateID%></p>
  96. <% if ( TemplateID == "-1" )
  97. Response.Write("<p>NOTE: You must create an english response before you can create localized responses.</p>")
  98. %>
  99. </td>
  100. <td align='right'>
  101. <input type='button' value='en' style='width:35px;color:<%=TemplateData[ "en" ].BtnColor%>' OnClick="window.location.href='http://<%=g_ServerName%>/sep_EditTemplate.asp?Val=<%=TemplateID%>&Lang=en'">
  102. <% if ( TemplateID != "-1" ) { %>
  103. <input type='button' value='fr' style='width:35px;color:<%=TemplateData[ "fr" ].BtnColor%>' OnClick="window.location.href='http://<%=g_ServerName%>/sep_EditTemplate.asp?Val=<%=TemplateID%>&Lang=fr'">
  104. <input type='button' value='de' style='width:35px;color:<%=TemplateData[ "de" ].BtnColor%>' OnClick="window.location.href='http://<%=g_ServerName%>/sep_EditTemplate.asp?Val=<%=TemplateID%>&Lang=de'">
  105. <input type='button' value='ja' style='width:35px;color:<%=TemplateData[ "ja" ].BtnColor%>' OnClick="window.location.href='http://<%=g_ServerName%>/sep_EditTemplate.asp?Val=<%=TemplateID%>&Lang=ja'">
  106. <% } %>
  107. </td>
  108. </tr>
  109. <tr>
  110. <td nowrap colspan='2'>
  111. <p>Please enter a descriptive template name:
  112. <input class='textbox' id='TemplateName' name='TemplateName' type=text maxlength=32 size=32 value="<%=TemplateName%>" style='width:200px'>
  113. </p>
  114. </td>
  115. <td nowrap>
  116. <p>Cur. Lang: <%=Language%></p>
  117. </td>
  118. </tr>
  119. <tr>
  120. <td colspan='2'>
  121. <input type='button' value='Blue Title' style='color:blue' onClick="fnAddFormatting('<p class=\'clsPTitle\'>', '</p>' )">
  122. <input type='button' value='Sub Title' onClick="fnAddFormatting('<p class=\'clsPSubTitle\'>', '</p>' )">
  123. <input type='button' value='Bullet List' onClick="fnAddFormatting('<ul>', '</ul>')">
  124. <input type='button' value='#-d List' onClick="fnAddFormatting('<ol>', '</ol>')">
  125. <input type='button' value='BR(CR)' onClick="fnAddFormatting('<br>', '' )">
  126. <input type='button' value='Paragraph' onClick="fnAddFormatting('<p>', '</p>' )">
  127. <input type='button' value='Link' onClick="fnAddFormatting('<a class=\'clsALinkNormal\' href=\'ADD_DESTINATION\'>', '</a>')">
  128. </td>
  129. </tr>
  130. <TR>
  131. <td width='1%' valign='top'>
  132. <input type='button' value='Contact Link' onClick="fnAddFormatting('<CONTACT>', '</CONTACT>' )"><br>
  133. <input type='button' value='Contact' onClick="fnAddFormatting('<CONTACTNOURL>', '</CONTACTNOURL>' )"><br>
  134. <input type='button' value='Contact URL' onClick="fnAddFormatting('<URL>', '</URL>' )"><br>
  135. <input type='button' value='Module' onClick="fnAddFormatting('<MODULE>', '</MODULE>' )"><br>
  136. <input type='button' value='Product' onClick="fnAddFormatting('<PRODUCT>', '</PRODUCT>' )"><br>
  137. <input type='button' value='Phone' onClick="fnAddFormatting('<PHONE>', '</PHONE>' )">
  138. </td>
  139. <TD COLSPAN=2>
  140. <TEXTAREA class='clsSEPTextArea' ROWS='10' COLS='100%' NAME='TemplateDescription' ID='TemplateDescription' OnKeyUp="fnUpdate(this.value)" OnChange="fnUpdate(this.value)" ><%=Server.HTMLEncode( TemplateDescription )%></TEXTAREA>
  141. </td>
  142. </tr>
  143. <tr>
  144. <td>
  145. </td>
  146. <td colspan=2>
  147. <INPUT TYPE=BUTTON VALUE=Submit OnClick="SubmitTemplate()">
  148. <INPUT TYPE=reset VALUE=Clear>
  149. </td>
  150. </tr>
  151. </table>
  152. </form>
  153. <table width='100%'>
  154. <tr>
  155. <td>
  156. <p class='clsPSubTitle'>
  157. Template Preview
  158. <HR>
  159. </p>
  160. </td>
  161. </tr>
  162. <tr>
  163. <td>
  164. <div name='pPreview' id='pPreview'>
  165. </div>
  166. </td>
  167. </tr>
  168. </table>
  169. <pre>
  170. <%
  171. //Response.Write( "name En: " + TemplateData[en].TemplateName + "<BR><BR>" )
  172. //Response.Write("<script language='javascript'>" )
  173. //Response.Write("var TemplateData = {\n")
  174. //for ( element in TemplateData )
  175. //{
  176. //Response.Write("Element: " + element + "<BR>\n\n" )
  177. //Response.Write( element + " : { TemplateName : \" " + TemplateData[String(element)].TemplateName + "\", BodyText : \"" + TemplateData[String(element)].BodyText + "\" },\n\n" )
  178. //}
  179. //Response.Write(" na : { TemplateName : \"\", BodyText : \"\" } };" )
  180. //var TemplateData = { en : { Description : "" , BodyText : "" },
  181. // ja : { Description : "" , BodyText : "" },
  182. //de : { Description : "" , BodyText : "" },
  183. //fr : { Description : "" , BodyText : "" }
  184. //};
  185. //Response.Write("</script>" )
  186. %>
  187. </Pre>
  188. <script language='javascript' type='text/javascript'>
  189. //local data structures holding the important stuff
  190. var CustomFields = { "CONTACT" : "ContactID",
  191. "MODULE" : "ModuleID",
  192. "PRODUCT" : "ProductID",
  193. "PHONE" : "TestPhoneNumber",
  194. "URL" : "WebSite",
  195. "CONTACTNOURL" : "ContactID"
  196. };
  197. var ProductID
  198. var ModuleID
  199. var ContactID
  200. var TestPhoneNumber = "[xxx]555-1212";
  201. var WebSite = "http://www.TestWebSite.com/"
  202. fnUpdate()
  203. function SubmitTemplate()
  204. {
  205. if ( frmTemplate.TemplateName.value == "" || frmTemplate.TemplateName.value == "New Template" )
  206. {
  207. alert("You must enter a template name")
  208. return
  209. }
  210. frmTemplate.submit()
  211. }
  212. function fnAddFormatting( sStart, sEnd )
  213. {
  214. document.all.TemplateDescription.setActive()
  215. var t = document.selection.createRange()
  216. var temp = ""
  217. if ( sStart == "<ol>" || sStart == "<ul>" )
  218. {
  219. liArray = t.text.split( "\n" )
  220. temp += "\n"
  221. for ( element in liArray )
  222. {
  223. liArray[element] = liArray[element].replace( /\n|\r/g, "" )
  224. temp += "<li>" + liArray[element] + "</li>\n"
  225. }
  226. temp += "\n";
  227. }
  228. else
  229. temp = t.text;
  230. t.text = sStart + temp + sEnd;
  231. fnUpdate()
  232. }
  233. function fnUpdate()
  234. {
  235. ModuleID = window.parent.frames("sepLeftNav").document.getElementsByName( "ModuleID" ).ModuleID.selectedIndex
  236. ModuleID = window.parent.frames("sepLeftNav").document.getElementsByName( "ModuleID" ).ModuleID.options(ModuleID).text
  237. ContactID = window.parent.frames("sepLeftNav").document.getElementsByName( "ContactID" ).ContactID.selectedIndex
  238. ContactID = window.parent.frames("sepLeftNav").document.getElementsByName( "ContactID" ).ContactID.options(ContactID).text
  239. ProductID = window.parent.frames("sepLeftNav").document.getElementsByName( "ProductID" ).ProductID.selectedIndex
  240. ProductID = window.parent.frames("sepLeftNav").document.getElementsByName( "ProductID" ).ProductID.options(ProductID).text
  241. templateText = fnReplaceSolutionFields( document.all.TemplateDescription.value );
  242. document.all.pPreview.innerHTML = templateText;
  243. }
  244. //var ContactID = window.parent.frames("sepLeftNav").document.getElementsByName( "ContactID" )
  245. //var window.parent.frames("sepLeftNav").document.getElementsByName( "TemplateID" )
  246. //var shiz = window.parent.frames("sepLeftNav").document.getElementsByName( "TemplateID" )
  247. function fnReplaceSolutionFields ( szData )
  248. {
  249. var pattern;
  250. var newDescription = new String( szData );
  251. var szCompanyWebSite="this_url_does_not_work_in_template_view_mode"
  252. try
  253. {
  254. for ( field in CustomFields )
  255. {
  256. var pattern = new RegExp( "<" + field + "><\/" + field + ">", "gi" );
  257. try
  258. {
  259. if( field.toString() == "CONTACT" || field.toString() == "URL" )
  260. {
  261. //test to see if the url starts out with http: if not, add it
  262. var regUrlTestPattern = /^http:/i
  263. //var szCompanyWebSite = new String( rsData( "CompanyWebSite" ) )
  264. if ( !regUrlTestPattern.test( szCompanyWebSite ) )
  265. var szCompanyWebSite = "http://" + szCompanyWebSite
  266. var FieldData = new String( "<A CLASS='clsALinkNormal' HREF='" + szCompanyWebSite + "'>" + eval( CustomFields[ field ] ) + "</A>" )
  267. }
  268. else
  269. {
  270. var FieldData = eval( CustomFields[ field ] )
  271. }
  272. }
  273. catch( err )
  274. {
  275. var FieldData = new String( "[xxx]555-1212" );
  276. }
  277. var newDescription = newDescription.replace( pattern, FieldData ) ;
  278. }
  279. }
  280. catch ( err )
  281. {
  282. return ( false );
  283. }
  284. return ( newDescription );
  285. }
  286. function fnCleanText ( text )
  287. {
  288. try
  289. {
  290. text = text.replace( /\n|\r/g, "" );
  291. text = text.replace( /"/g, "'" );
  292. }
  293. catch( err )
  294. {
  295. return "undefined"
  296. }
  297. return text
  298. }
  299. </script>
  300. </BODY>
  301. </HTML>