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.

257 lines
7.5 KiB

  1. <!-- ############################################################################ -->
  2. <!-- ## UDDI Services ## -->
  3. <!-- ## Copyright (c) Microsoft Corporation. All rights reserved. ## -->
  4. <!-- ############################################################################ -->
  5. <%@ Page Language='C#' Inherits='UDDI.Web.UddiPage' %>
  6. <%@ Register Tagprefix='uddi' Tagname='Header' Src='../controls/header.ascx' %>
  7. <%@ Register Tagprefix='uddi' Tagname='Footer' Src='../controls/footer.ascx' %>
  8. <%@ Register Tagprefix='uddi' Tagname='BreadCrumb' Src='../controls/breadcrumb.ascx' %>
  9. <%@ Register TagPrefix='uddi' Namespace='UDDI.Web' Assembly='uddi.web' %>
  10. <%@ Import Namespace='System.Data' %>
  11. <%@ Import Namespace='System.Data.SqlClient' %>
  12. <%@ Import Namespace='System.Xml.Serialization' %>
  13. <%@ Import Namespace='UDDI' %>
  14. <%@ Import Namespace='UDDI.API.Extensions' %>
  15. <script language='C#' runat='server'>
  16. protected bool frames;
  17. protected void Page_Init( object sender, EventArgs e )
  18. {
  19. frames = ( "true" == Request[ "frames" ] );
  20. breadcrumb.AddBlurb( Localization.GetString( "HEADING_TAXONOMY" ), null, null, null, false );
  21. breadcrumb.AddBlurb( Localization.GetString( "HEADING_ADMINISTER" ), "../admin/admin.aspx?refreshExplorer=&frames=" + ( frames ? "true" : "false" ), null, null, true );
  22. requiredkeyValue.ErrorMessage = Localization.GetString( "ERROR_FIELD_REQUIRED" ) + "<br>";
  23. }
  24. protected void Page_Load( object sender, EventArgs e )
  25. {
  26. if( null!=Request[ "refreshExplorer" ] && frames )
  27. {
  28. Response.Write(
  29. ClientScripts.ReloadExplorerPane( "_dataimport" )
  30. );
  31. }
  32. }
  33. protected void Taxonomy_OnDelete( object sender, DataGridCommandEventArgs e )
  34. {
  35. CategorizationScheme taxonomy = new CategorizationScheme();
  36. taxonomy.TModelKey = "uuid:" + e.Item.Cells[ 0 ].Text;
  37. taxonomy.Delete();
  38. Response.Redirect( "taxonomy.aspx?frames=" + ( frames ? "true" : "false" ) );
  39. }
  40. protected void ImportTaxonomy_OnSubmit( object sender, EventArgs e )
  41. {
  42. if( null == taxonomyFile.PostedFile || Utility.StringEmpty( taxonomyFile.PostedFile.FileName ) )
  43. {
  44. Page.Validate();
  45. }
  46. else
  47. {
  48. try
  49. {
  50. XmlSerializer serializer = new XmlSerializer( typeof( Resources ) );
  51. //UDDI.Context.User.ID = UDDI.Utility.GetDefaultPublisher();
  52. UDDI.Context.ContextType = ContextType.Replication;
  53. UDDI.Context.User.AllowPreassignedKeys = true;
  54. //
  55. // Do Schema Validation.
  56. //
  57. UDDI.SchemaCollection.Validate( taxonomyFile.PostedFile.InputStream );
  58. //
  59. // Deserialize the object
  60. //
  61. Resources resources = (Resources)serializer.Deserialize( taxonomyFile.PostedFile.InputStream );
  62. //
  63. // Save the object
  64. //
  65. resources.Save();
  66. importPanel.Visible = false;
  67. successPanel.Visible = true;
  68. }
  69. catch( SqlException se )
  70. {
  71. ErrorType type = ErrorType.E_fatalError;
  72. int num = se.Number - 50000;
  73. //
  74. // if we recognize the error number as a uddi error, cast the type
  75. //
  76. if( Enum.IsDefined( typeof( ErrorType ),num ) )
  77. {
  78. type = (ErrorType)num;
  79. }
  80. throw new UDDIException( type,"ERROR_DATAIMPORT_INVALIDKEY" );
  81. }
  82. catch( Exception er )
  83. {
  84. throw new UDDIException( ErrorType.E_fatalError,"ERROR_DATAIMPORT" );
  85. }
  86. }
  87. }
  88. protected string FlagToString( int flag )
  89. {
  90. switch( flag )
  91. {
  92. case 1:
  93. return Localization.GetString( "HEADING_YES" );
  94. case 2:
  95. return Localization.GetString( "HEADING_NO" );
  96. }
  97. return Localization.GetString( "HEADING_UNKNOWN" );
  98. }
  99. protected bool IsUddiTypesTaxonomy( object tModelKey )
  100. {
  101. return 0 == String.Compare(
  102. "C1ACF26D-9672-4404-9D70-39B756E62AB4",
  103. tModelKey.ToString(),
  104. true );
  105. }
  106. </script>
  107. <uddi:StyleSheetControl
  108. Runat='server'
  109. Default='../stylesheets/uddi.css'
  110. Downlevel='../stylesheets/uddidl.css'
  111. />
  112. <uddi:PageStyleControl
  113. Runat='server'
  114. OnClientContextMenu='Document_OnContextMenu()'
  115. Title="TITLE"
  116. AltTitle="TITLE_ALT"
  117. />
  118. <uddi:ClientScriptRegister
  119. Runat='server'
  120. Source='../client.js'
  121. Language='javascript'
  122. />
  123. <uddi:SecurityControl
  124. AdminRequired='true'
  125. Runat='server'
  126. />
  127. <form enctype='multipart/form-data' Runat='server'>
  128. <table width='100%' border='0' height='100%' cellpadding='0' cellspacing='0'>
  129. <asp:PlaceHolder
  130. Id='HeaderBag'
  131. Runat='server'
  132. >
  133. <tr height='95'>
  134. <td>
  135. <!-- Header Control Here -->
  136. <uddi:Header
  137. Runat='server'
  138. />
  139. </td>
  140. </tr>
  141. </asp:PlaceHolder>
  142. <tr height='100%' valign='top'>
  143. <td>
  144. <uddi:BreadCrumb
  145. Id='breadcrumb'
  146. Runat='server'
  147. />
  148. <table cellpadding='10' cellspacing='0' border='0' width='100%'>
  149. <tr>
  150. <td>
  151. <uddi:UddiLabel Text='[[HELP_BLOCK_ADMIN]]' CssClass='helpBlock' Runat='server' /><br>
  152. <br>
  153. <uddi:TabControl ID='tabs' Runat='server'>
  154. <uddi:TabPage Name='TAB_IMPORT' Runat='server'>
  155. <asp:Panel ID='importPanel' Runat='server'>
  156. <uddi:ContextualHelpControl
  157. Runat='Server'
  158. Text='[[HELP_BLOCK_ADMIN_TAXONOMY_IMPORT]]'
  159. HelpFile='coordinate.context.importdata'
  160. CssClass='tabHelpBlock'
  161. />
  162. <table width='100%' cellpadding='0' cellpadding='0' border='0' >
  163. <tr>
  164. <td valign='bottom'>
  165. <uddi:UddiLabel
  166. Text='[[TAG_TAXONOMY_FILE]]'
  167. CssClass='boldBlue'
  168. Runat='server'
  169. />
  170. <br>
  171. <input
  172. id='taxonomyFile'
  173. type='file'
  174. style='width: 400px'
  175. runat='server'>
  176. <br>
  177. <asp:RequiredFieldValidator
  178. id='requiredkeyValue'
  179. ControlToValidate='taxonomyFile'
  180. Display='Dynamic'
  181. Runat='server'
  182. />
  183. </td>
  184. <td valign='bottom'>
  185. <uddi:UddiButton
  186. Text='[[BUTTON_IMPORT]]'
  187. CssClass='button'
  188. OnClick='ImportTaxonomy_OnSubmit'
  189. Width='60px'
  190. Runat='server'
  191. />
  192. </td>
  193. </tr>
  194. </table>
  195. </asp:Panel>
  196. <asp:Panel ID='successPanel' Runat='server' Visible='false'>
  197. <hr>
  198. <uddi:UddiLabel Text='[[TEXT_IMPORT_SUCCESS_MESSAGE]]' CssClass='boldBlue' Runat='server' />
  199. <br>
  200. <br>
  201. <a href='<%=HyperLinkManager.GetSecureHyperLink( "/admin/taxonomy.aspx?frames=" + ( frames ? "true" : "false" ) )%>'><uddi:LocalizedLabel Name='TEXT_IMPORT_ANOTHER_TAXONOMY' Runat='server' /></a>
  202. <br>
  203. <br>
  204. <a href='<%=HyperLinkManager.GetSecureHyperLink( "/admin/categorization.aspx?refreshExplorer=&frames=" + ( frames ? "true" : "false" ) )%>'><uddi:LocalizedLabel Name='TEXT_IMPORT_VIEW_CATEGORIZATION' Runat='server' /></a><br>
  205. <hr>
  206. </asp:Panel>
  207. </uddi:TabPage>
  208. </uddi:TabControl>
  209. </td>
  210. </tr>
  211. </table>
  212. </td>
  213. </tr>
  214. <asp:PlaceHolder
  215. Id='FooterBag'
  216. Runat='server'
  217. >
  218. <tr height='95'>
  219. <td>
  220. <!-- Footer Control Here -->
  221. <uddi:Footer
  222. Runat='server'
  223. />
  224. </td>
  225. </tr>
  226. </asp:PlaceHolder>
  227. </table>
  228. </form>