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.

429 lines
14 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' Namespace='UDDI.Web' Assembly='uddi.web' %>
  7. <%@ Register Tagprefix='uddi' Tagname='Footer' Src='../controls/footer.ascx' %>
  8. <%@ Register Tagprefix='uddi' Tagname='Header' Src='../controls/header.ascx' %>
  9. <%@ Register Tagprefix='uddi' Tagname='BreadCrumb' Src='../controls/breadcrumb.ascx' %>
  10. <%@ Register Tagprefix='uddi' Tagname='Descriptions' Src='../controls/descriptions.ascx' %>
  11. <%@ Register TagPrefix='uddi' Tagname='InstanceInfos' Src='../controls/instanceinfos.ascx' %>
  12. <%@ Import Namespace='UDDI' %>
  13. <%@ Import Namespace='UDDI.API' %>
  14. <%@ Import Namespace='UDDI.API.Business' %>
  15. <%@ Import Namespace='UDDI.API.Binding' %>
  16. <%@ Import Namespace='UDDI.API.ServiceType' %>
  17. <%@ Import Namespace='System.Data' %>
  18. <script language='C#' runat='server'>
  19. protected BindingTemplate binding = new BindingTemplate();
  20. protected TModelInstanceInfoCollection bindingInstanceInfos = new TModelInstanceInfoCollection();
  21. protected bool frames = false;
  22. protected string key;
  23. protected string mode;
  24. protected void Page_Init( object sender, EventArgs e )
  25. {
  26. frames = ( "true" == Request[ "frames" ] );
  27. key = Request[ "key" ];
  28. mode = Request[ "mode" ];
  29. if( null == key )
  30. {
  31. #if never
  32. throw new UDDIException(
  33. ErrorType.E_fatalError,
  34. "Missing required parameter 'key'." );
  35. #endif
  36. throw new UDDIException( ErrorType.E_fatalError, "UDDI_ERROR_MISSING_REQUIRED_KEY_PARAMETER" );
  37. }
  38. switch( mode )
  39. {
  40. case "add":
  41. binding.AccessPoint.Value = "http://";
  42. binding.AccessPoint.URLType = URLType.Http;
  43. binding.ServiceKey = key;
  44. binding.Save();
  45. if( frames )
  46. {
  47. //
  48. // Reload explorer and view panes.
  49. //
  50. Response.Write(
  51. ClientScripts.ReloadExplorerAndViewPanes(
  52. "editbinding.aspx?key=" + binding.BindingKey + ( frames ? "&frames=true" : "" ),
  53. binding.BindingKey ) );
  54. Response.End();
  55. }
  56. else
  57. {
  58. Response.Redirect( "editbinding.aspx?key=" + binding.BindingKey + ( frames ? "&frames=true" : "" ) );
  59. Response.End();
  60. }
  61. break;
  62. case "delete":
  63. binding.BindingKey = key;
  64. binding.Get();
  65. if( null == Request[ "confirm" ] )
  66. {
  67. //
  68. // The user has not yet confirmed the delete operation, so display
  69. // a confirmation dialog.
  70. //
  71. string message = String.Format(
  72. Localization.GetString( "TEXT_DELETE_CONFIRMATION" ),
  73. UDDI.Utility.StringEmpty( binding.AccessPoint.Value ) ? Localization.GetString( "HEADING_BINDING" ) : binding.AccessPoint.Value );
  74. Page.RegisterStartupScript(
  75. "Confirm",
  76. ClientScripts.Confirm(
  77. message,
  78. "editbinding.aspx?key=" + key + ( frames ? "&frames=true" : "" ) + "&mode=delete&confirm=true",
  79. "editbinding.aspx?key=" + key + ( frames ? "&frames=true" : "" ) ) );
  80. break;
  81. }
  82. //
  83. // The user has confirmed the delete, so go ahead and delete
  84. // the entity. Then reload the tree view.
  85. //
  86. if( !frames )
  87. {
  88. binding.Delete();
  89. Response.Redirect( "editservice.aspx?frames=false&key=" + binding.ServiceKey + ( null != Request[ "tab" ] ? "&tab=" + Request[ "tab" ] : "" ) );
  90. }
  91. else
  92. {
  93. Response.Write(
  94. ClientScripts.ReloadExplorerAndViewPanes(
  95. "editservice.aspx?frames=true&key=" + binding.ServiceKey + ( null != Request[ "tab" ] ? "&tab=" + Request[ "tab" ] : "" ),
  96. binding.ServiceKey ) );
  97. binding.Delete();
  98. }
  99. Response.End();
  100. break;
  101. default:
  102. binding.BindingKey = key;
  103. binding.Get();
  104. bindingInstanceInfos.Get( key );
  105. bindingKey.Text = key;
  106. break;
  107. }
  108. }
  109. protected void Page_Load( object sender, EventArgs e )
  110. {
  111. if( !Page.IsPostBack )
  112. {
  113. Label link = (Label)bindDetail.ActiveControl.FindControl( "displayAccessPoint" );
  114. link.Text = HttpUtility.HtmlEncode( binding.AccessPoint.Value );
  115. Label labelUrlType = (Label)bindDetail.ActiveControl.FindControl( "displayUrlType" );
  116. labelUrlType.Text = binding.AccessPoint.URLType.ToString().ToLower();
  117. }
  118. descriptions.Initialize( binding.Descriptions, binding );
  119. instanceInfos.Initialize( bindingInstanceInfos, binding, true );
  120. if( !Page.IsPostBack && null != Request[ "tab" ] )
  121. tabs.SelectedIndex = Convert.ToInt32( Request[ "tab" ] );
  122. if( null!=Request[ "refreshExplorer" ] && frames )
  123. {
  124. Response.Write(
  125. ClientScripts.ReloadExplorerPane( binding.BindingKey )
  126. );
  127. }
  128. }
  129. protected void Page_PreRender( object sender, EventArgs e )
  130. {
  131. breadcrumb.Initialize( BreadCrumbType.Edit, EntityType.BindingTemplate, key );
  132. }
  133. public void Edit_OnClick( object sender, CommandEventArgs e )
  134. {
  135. bindDetail.SetEditMode();
  136. TextBox textBox = (TextBox)bindDetail.ActiveControl.FindControl( "editAccessPoint" );
  137. textBox.Text = binding.AccessPoint.Value;
  138. DropDownList list = (DropDownList)bindDetail.ActiveControl.FindControl( "editUrlType" );
  139. ListItem item = list.Items.FindByValue( ((int)binding.AccessPoint.URLType).ToString() );
  140. item.Selected = true;
  141. RequiredFieldValidator requiredName = (RequiredFieldValidator)bindDetail.ActiveControl.FindControl( "requiredAccessPoint" );
  142. requiredName.ErrorMessage = Localization.GetString( "ERROR_FIELD_REQUIRED" );
  143. }
  144. protected void Update_OnClick( object sender, EventArgs e )
  145. {
  146. Update_OnClick( sender, null );
  147. }
  148. public void Update_OnClick( object sender, CommandEventArgs e )
  149. {
  150. Page.Validate();
  151. if( Page.IsValid )
  152. {
  153. TextBox textBox = (TextBox)bindDetail.ActiveControl.FindControl( "editAccessPoint" );
  154. binding.AccessPoint.Value = textBox.Text;
  155. ListItem listItem = ((DropDownList)bindDetail.ActiveControl.FindControl( "editUrlType" )).SelectedItem;
  156. binding.AccessPoint.URLType = (URLType)Convert.ToInt32( listItem.Value );
  157. binding.Save();
  158. bindDetail.CancelEditMode();
  159. Label link = (Label)bindDetail.ActiveControl.FindControl( "displayAccessPoint" );
  160. link.Text = HttpUtility.HtmlEncode( binding.AccessPoint.Value );
  161. Label labelUrlType = (Label)bindDetail.ActiveControl.FindControl( "displayUrlType" );
  162. labelUrlType.Text = binding.AccessPoint.URLType.ToString().ToLower();
  163. Page.RegisterStartupScript(
  164. "Reload",
  165. ClientScripts.ReloadExplorerPane(
  166. binding.BindingKey ) );
  167. }
  168. }
  169. public void Cancel_OnClick( object sender, CommandEventArgs e )
  170. {
  171. bindDetail.CancelEditMode();
  172. }
  173. protected DataView GetUrlTypes()
  174. {
  175. DataTable table = new DataTable();
  176. DataRow row;
  177. table.Columns.Add( new DataColumn( "Name", typeof( string ) ) );
  178. table.Columns.Add( new DataColumn( "Value", typeof( string ) ) );
  179. Array names = Enum.GetNames( typeof( URLType ) );
  180. Array values = Enum.GetValues( typeof( URLType ) );
  181. for( int i = 0; i < names.Length; i ++ )
  182. {
  183. row = table.NewRow();
  184. row[ 0 ] = names.GetValue( i ).ToString().ToLower();
  185. row[ 1 ] = ((int)values.GetValue( i )).ToString();
  186. table.Rows.Add( row );
  187. }
  188. return table.DefaultView;
  189. }
  190. </script>
  191. <uddi:StyleSheetControl
  192. Runat='server'
  193. Default='../stylesheets/uddi.css'
  194. Downlevel='../stylesheets/uddidl.css'
  195. />
  196. <uddi:PageStyleControl
  197. Runat='server'
  198. OnClientContextMenu='Document_OnContextMenu()'
  199. Title="TITLE"
  200. AltTitle="TITLE_ALT"
  201. />
  202. <uddi:ClientScriptRegister
  203. Runat='server'
  204. Source='../client.js'
  205. Language='javascript'
  206. />
  207. <uddi:SecurityControl
  208. PublisherRequired='true'
  209. Runat='server'
  210. />
  211. <form runat='server'>
  212. <table width='100%' border='0' height='100%' cellpadding='0' cellspacing='0'>
  213. <asp:PlaceHolder
  214. Id='HeaderBag'
  215. Runat='server'
  216. >
  217. <tr height='95'>
  218. <td>
  219. <!-- Header Control Here -->
  220. <uddi:Header
  221. Runat='server'
  222. />
  223. </td>
  224. </tr>
  225. </asp:PlaceHolder>
  226. <tr height='100%' valign='top'>
  227. <td>
  228. <uddi:BreadCrumb
  229. Id='breadcrumb'
  230. Runat='server'
  231. />
  232. <table cellpadding='10' cellspacing='0' border='0' width='100%'>
  233. <tr>
  234. <td>
  235. <uddi:UddiLabel Text='[[HELP_BLOCK_PUBLISH_BINDING]]' CssClass='helpBlock' Runat='server' /><br>
  236. <br>
  237. <uddi:TabControl ID='tabs' Runat='server'>
  238. <uddi:TabPage Name='TAB_DETAILS' Runat='server'>
  239. <uddi:ContextualHelpControl
  240. Runat='Server'
  241. Text='[[HELP_BLOCK_PUBLISH_BINDING_DETAILS]]'
  242. HelpFile='publish.context.publishbindingdetails'
  243. CssClass='tabHelpBlock'
  244. BorderWidth='0'
  245. />
  246. <br>
  247. <uddi:UddiLabel Text='[[TAG_BINDING_KEY]]' CssClass='header' Runat='server' /><br>
  248. <asp:Label id='bindingKey' Runat='server' /><br>
  249. <br>
  250. <uddi:EditControl id='bindDetail'
  251. OnEditCommand='Edit_OnClick'
  252. OnUpdateCommand='Update_OnClick'
  253. OnCancelCommand='Cancel_OnClick'
  254. Runat='server' >
  255. <EditItemTemplate>
  256. <table width='100%' cellpadding='4' cellspacing='0' border='0'>
  257. <colgroup>
  258. <col width='0*'>
  259. <col width='154'>
  260. </colgroup>
  261. <tr>
  262. <td class='tableHeader'>
  263. <uddi:StringResource Name='HEADING_ACCESS_POINT' Runat='Server' /></td>
  264. <td class='tableHeader'>
  265. <uddi:StringResource Name='HEADING_ACTIONS' Runat='Server' /></td>
  266. </tr>
  267. <tr valign='top'>
  268. <td class='tableEditItem'>
  269. <uddi:LocalizedLabel
  270. Name='TAG_ACCESS_POINT'
  271. CssClass='lightHeader'
  272. Runat='Server' /><br>
  273. <uddi:UddiTextBox
  274. id='editAccessPoint'
  275. Width='200px'
  276. Columns='43'
  277. CssClass='textBox'
  278. MaxLength='255'
  279. Selected='true'
  280. OnEnterKeyPressed='Update_OnClick'
  281. Runat='server'/><br>
  282. <asp:RequiredFieldValidator
  283. id='requiredAccessPoint'
  284. ControlToValidate='editAccessPoint'
  285. Display='Dynamic'
  286. Runat='server'/>
  287. <br>
  288. <uddi:LocalizedLabel
  289. Name='TAG_URL_TYPE'
  290. CssClass='lightHeader'
  291. Runat='Server' /><br>
  292. <asp:DropDownList
  293. id='editUrlType'
  294. DataSource='<%# GetUrlTypes() %>'
  295. DataTextField='Name'
  296. DataValueField='Value'
  297. columns='43'
  298. CssClass='textBox'
  299. Runat='server' />
  300. </td>
  301. <td class='tableEditItem'>
  302. <uddi:UddiButton
  303. Text='<%# Localization.GetString( "BUTTON_UPDATE" )%>'
  304. CommandName='update'
  305. Width='70px'
  306. CssClass='button'
  307. Runat='server' />&nbsp;<uddi:UddiButton Text='<%# Localization.GetString( "BUTTON_CANCEL" )%>' CommandName='cancel' Width='70px' CssClass='button' Runat='server' /></td>
  308. </tr>
  309. </table>
  310. </EditItemTemplate>
  311. <ItemTemplate>
  312. <table width='100%' cellpadding='4' cellspacing='0' border='0'>
  313. <colgroup>
  314. <col width='0*'>
  315. <col width='154'>
  316. </colgroup>
  317. <tr>
  318. <td class='tableHeader'>
  319. <uddi:StringResource Name='HEADING_ACCESS_POINT' Runat='Server' /></td>
  320. <td class='tableHeader'>
  321. <uddi:StringResource Name='HEADING_ACTIONS' Runat='Server' /></td>
  322. </tr>
  323. <tr valign='top'>
  324. <td class='tableItem'>
  325. <asp:Label ID='displayAccessPoint' width='255' Runat='server' /><br>
  326. (<asp:Label ID='displayUrlType' Runat='server' />)</td>
  327. <td class='tableItem'>
  328. <uddi:UddiButton
  329. Text='<%# Localization.GetString( "BUTTON_EDIT" )%>'
  330. CommandName='edit'
  331. Width='70px'
  332. CssClass='button'
  333. Runat='server' /></td>
  334. </tr>
  335. </table>
  336. </ItemTemplate>
  337. </uddi:EditControl><br>
  338. <br>
  339. <uddi:Descriptions ID='descriptions' Runat='server' />
  340. </uddi:TabPage>
  341. <uddi:TabPage Name='TAB_INSTANCES' Runat='server'>
  342. <uddi:ContextualHelpControl
  343. Runat='Server'
  344. Text='[[HELP_BLOCK_PUBLISH_BINDING_INSTANCES]]'
  345. HelpFile='publish.context.bindinginstanceinfo'
  346. CssClass='tabHelpBlock'
  347. BorderWidth='0'
  348. />
  349. <br>
  350. <uddi:InstanceInfos Id='instanceInfos' Runat='server' />
  351. </uddi:TabPage>
  352. </uddi:TabControl>
  353. </td>
  354. </tr>
  355. </table>
  356. </td>
  357. </tr>
  358. <asp:PlaceHolder
  359. Id='FooterBag'
  360. Runat='server'
  361. >
  362. <tr height='95'>
  363. <td>
  364. <!-- Footer Control Here -->
  365. <uddi:Footer
  366. Runat='server'
  367. />
  368. </td>
  369. </tr>
  370. </asp:PlaceHolder>
  371. </table>
  372. </form>