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.

452 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='Header' Src='../controls/header.ascx' %>
  8. <%@ Register Tagprefix='uddi' Tagname='Footer' Src='../controls/footer.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='Email' Src='../controls/emails.ascx' %>
  12. <%@ Register Tagprefix='uddi' Tagname='Phone' Src='../controls/phones.ascx' %>
  13. <%@ Register Tagprefix='uddi' Tagname='Address' Src='../controls/address.ascx' %>
  14. <%@ Import Namespace='UDDI' %>
  15. <%@ Import Namespace='UDDI.API' %>
  16. <%@ Import Namespace='UDDI.API.Business' %>
  17. <%@ Import Namespace='System.Data' %>
  18. <script language='C#' runat='server'>
  19. protected BusinessEntity business = new BusinessEntity();
  20. protected Contact contact = new Contact();
  21. protected bool frames = false;
  22. protected string key;
  23. protected string mode;
  24. protected int contactIndex;
  25. protected void Page_Init( object sender, EventArgs e )
  26. {
  27. frames = ( "true" == Request[ "frames" ] );
  28. key = Request[ "key" ];
  29. mode = Request[ "mode" ];
  30. string requestIndex = Request[ "index" ];
  31. if( null == key )
  32. {
  33. #if never
  34. throw new UDDIException(
  35. ErrorType.E_fatalError,
  36. "Missing required parameter 'key'." );
  37. #endif
  38. throw new UDDIException( ErrorType.E_fatalError, "UDDI_ERROR_MISSING_REQUIRED_KEY_PARAMETER" );
  39. }
  40. if( null == requestIndex && "add" != mode )
  41. {
  42. #if never
  43. throw new UDDIException(
  44. ErrorType.E_fatalError,
  45. "Missing required parameter 'index'." );
  46. #endif
  47. throw new UDDIException( ErrorType.E_fatalError, "UDDI_ERROR_MISSING_REQUIRED_INDEX_PARAMETER" );
  48. }
  49. contactIndex = Convert.ToInt32( requestIndex );
  50. switch( mode )
  51. {
  52. case "add":
  53. business.BusinessKey = key;
  54. business.Get();
  55. contact.PersonName = Localization.GetString( "DEFAULT_CONTACT_NAME" );
  56. business.Contacts.Add( contact );
  57. business.Save();
  58. contactIndex = business.Contacts.Count - 1;
  59. if( frames )
  60. {
  61. //
  62. // Reload explorer and view panes.
  63. //
  64. Response.Write(
  65. ClientScripts.ReloadExplorerAndViewPanes(
  66. "editcontact.aspx?key=" + business.BusinessKey + "&index=" + contactIndex + ( frames ? "&frames=true" : "" ),
  67. business.BusinessKey + ":" + contactIndex ) );
  68. Response.End();
  69. }
  70. else
  71. {
  72. Response.Redirect( "editcontact.aspx?key=" + business.BusinessKey + "&index=" + contactIndex );
  73. Response.End();
  74. }
  75. break;
  76. case "delete":
  77. business.BusinessKey = key;
  78. business.Get();
  79. contact = business.Contacts[ contactIndex ];
  80. if( null == Request[ "confirm" ] )
  81. {
  82. //
  83. // The user has not yet confirmed the delete operation, so display
  84. // a confirmation dialog.
  85. //
  86. string message = String.Format( Localization.GetString( "TEXT_DELETE_CONFIRMATION" ), contact.PersonName );
  87. Page.RegisterStartupScript(
  88. "Confirm",
  89. ClientScripts.Confirm(
  90. message,
  91. "editcontact.aspx?key=" + key + "&index=" + contactIndex + ( frames ? "&frames=true" : "" ) + "&mode=delete&confirm=true",
  92. "editcontact.aspx?key=" + key + "&index=" + contactIndex + ( frames ? "&frames=true" : "" ) ) );
  93. break;
  94. }
  95. //
  96. // The user has confirmed the delete, so go ahead and delete
  97. // the entity. Then reload the tree view.
  98. //
  99. business.Contacts.Remove( contact );
  100. business.Save();
  101. if( frames )
  102. {
  103. Response.Write(
  104. ClientScripts.ReloadExplorerAndViewPanes(
  105. "editbusiness.aspx?frames=true&key=" + business.BusinessKey + ( null != Request[ "tab" ] ? "&tab=" + Request[ "tab" ] : "" ),
  106. business.BusinessKey ) );
  107. Response.End();
  108. }
  109. else
  110. {
  111. Response.Redirect( "editbusiness.aspx?frames=false&key=" + business.BusinessKey + ( null != Request[ "tab" ] ? "&tab=" + Request[ "tab" ] : "" ) );
  112. Response.End();
  113. }
  114. break;
  115. default:
  116. business.BusinessKey = key;
  117. business.Get();
  118. contact = business.Contacts[ contactIndex ];
  119. break;
  120. }
  121. }
  122. protected void Page_Load( object sender, EventArgs e )
  123. {
  124. descriptions.Initialize( contact.Descriptions, business );
  125. emails.Initialize( contact.Emails, business );
  126. phones.Initialize( contact.Phones, business );
  127. addresses.Initialize( contact.Addresses, business );
  128. }
  129. protected void Page_PreRender( object sender, EventArgs e )
  130. {
  131. breadcrumb.Initialize( BreadCrumbType.Edit, EntityType.Contact, key, contactIndex );
  132. }
  133. public void Edit_OnClick( object sender, CommandEventArgs e )
  134. {
  135. contactDetail.SetEditMode();
  136. TextBox textBox = (TextBox)contactDetail.ActiveControl.FindControl( "editName" );
  137. textBox.Text = contact.PersonName;
  138. TextBox textBoxUseType = (TextBox)contactDetail.ActiveControl.FindControl( "editUseType" );
  139. textBoxUseType.Text = contact.UseType;
  140. RequiredFieldValidator requiredName = (RequiredFieldValidator)contactDetail.ActiveControl.FindControl( "requiredName" );
  141. requiredName.ErrorMessage = Localization.GetString( "ERROR_FIELD_REQUIRED" );
  142. }
  143. public void Update_OnClick( object sender, EventArgs e )
  144. {
  145. //
  146. // BUG: 728086
  147. // Netscape isn't firing the validate code correctly in all cases,
  148. // so, we must call validate our selves. We do this in other places in the UI
  149. // already.
  150. //
  151. Page.Validate();
  152. Update_OnClick( sender, null );
  153. }
  154. public void Update_OnClick( object sender, CommandEventArgs e )
  155. {
  156. if( Page.IsValid )
  157. {
  158. TextBox textBox = (TextBox)contactDetail.ActiveControl.FindControl( "editName" );
  159. contact.PersonName = textBox.Text;
  160. TextBox textBoxUseType = (TextBox)contactDetail.ActiveControl.FindControl( "editUseType" );
  161. contact.UseType = textBoxUseType.Text;
  162. business.Save();
  163. contactDetail.CancelEditMode();
  164. Label label = (Label)contactDetail.ActiveControl.FindControl( "displayName" );
  165. label.Text = contact.PersonName;
  166. Label labelUseType = (Label)contactDetail.ActiveControl.FindControl( "displayUseType" );
  167. labelUseType.Text = Utility.StringEmpty( contact.UseType ) ? Localization.GetString( "HEADING_NONE" ) : contact.UseType;
  168. Page.RegisterStartupScript(
  169. "Reload",
  170. ClientScripts.ReloadExplorerPane(
  171. business.BusinessKey + ":" + contactIndex ) );
  172. }
  173. }
  174. public void Cancel_OnClick( object sender, CommandEventArgs e )
  175. {
  176. contactDetail.CancelEditMode();
  177. }
  178. </script>
  179. <uddi:StyleSheetControl
  180. Runat='server'
  181. Default='../stylesheets/uddi.css'
  182. Downlevel='../stylesheets/uddidl.css'
  183. />
  184. <uddi:PageStyleControl
  185. Runat='server'
  186. OnClientContextMenu='Document_OnContextMenu()'
  187. Title="TITLE"
  188. AltTitle="TITLE_ALT"
  189. />
  190. <uddi:ClientScriptRegister
  191. Runat='server'
  192. Source='../client.js'
  193. Language='javascript'
  194. />
  195. <uddi:SecurityControl
  196. PublisherRequired='true'
  197. Runat='server'
  198. />
  199. <form runat='server'>
  200. <table width='100%' border='0' height='100%' cellpadding='0' cellspacing='0'>
  201. <asp:PlaceHolder
  202. Id='HeaderBag'
  203. Runat='server'
  204. >
  205. <tr height='95'>
  206. <td>
  207. <!-- Header Control Here -->
  208. <uddi:Header
  209. Runat='server'
  210. />
  211. </td>
  212. </tr>
  213. </asp:PlaceHolder>
  214. <tr height='100%' valign='top'>
  215. <td>
  216. <uddi:BreadCrumb
  217. Id='breadcrumb'
  218. Runat='server'
  219. />
  220. <table cellpadding='10' cellspacing='0' border='0' width='100%'>
  221. <tr>
  222. <td>
  223. <uddi:UddiLabel Text='[[HELP_BLOCK_PUBLISH_CONTACT]]' CssClass='helpBlock' Runat='server' /><br>
  224. <br>
  225. <uddi:TabControl ID='tabs' Runat='server'>
  226. <uddi:TabPage Name='TAB_DETAILS' Runat='server'>
  227. <uddi:ContextualHelpControl
  228. Runat='Server'
  229. Text='[[HELP_BLOCK_PUBLISH_CONTACT_DETAILS]]'
  230. HelpFile='publish.context.publishcontactdetails'
  231. CssClass='tabHelpBlock'
  232. BorderWidth='0'
  233. />
  234. <br>
  235. <uddi:EditControl
  236. id='contactDetail'
  237. OnEditCommand='Edit_OnClick'
  238. OnUpdateCommand='Update_OnClick'
  239. OnCancelCommand='Cancel_OnClick'
  240. Runat='server'>
  241. <EditItemTemplate>
  242. <table width='100%' cellpadding='4' cellspacing='0' border='0'>
  243. <colgroup>
  244. <col width='0*'>
  245. <col width='154'>
  246. </colgroup>
  247. <tr>
  248. <td class='tableHeader'>
  249. <uddi:StringResource Name='HEADING_CONTACT' Runat='Server' /></td>
  250. <td class='tableHeader' width='150'>
  251. <uddi:StringResource Name='HEADING_ACTIONS' Runat='Server' /></td>
  252. </tr>
  253. <tr valign='top'>
  254. <td class='tableEditItem'>
  255. <uddi:LocalizedLabel
  256. Name='TAG_CONTACT_NAME'
  257. CssClass='lightHeader'
  258. Runat='Server' /><br>
  259. <uddi:UddiTextBox
  260. ID='editName'
  261. Width='200px'
  262. Selected='true'
  263. OnEnterKeyPressed='Update_OnClick'
  264. MaxLength='255'
  265. Runat='server' /><br>
  266. <asp:RequiredFieldValidator
  267. id='requiredName'
  268. ControlToValidate='editName'
  269. Display='Dynamic'
  270. Runat='server'/>
  271. <br>
  272. <uddi:UddiLabel
  273. Text='[[TAG_USE_TYPE]]'
  274. CssClass='lightHeader'
  275. Runat='Server' /><br>
  276. <uddi:UddiTextBox
  277. ID='editUseType'
  278. Width='200px'
  279. OnEnterKeyPressed='Update_OnClick'
  280. MaxLength='255'
  281. Runat='server' /></td>
  282. <td class='tableEditItem'>
  283. <uddi:UddiButton
  284. Text='<%# Localization.GetString( "BUTTON_UPDATE" )%>'
  285. CommandName='update'
  286. Width='70px'
  287. CssClass='button'
  288. Runat='server' />
  289. &nbsp;
  290. <uddi:UddiButton
  291. Text='<%# Localization.GetString( "BUTTON_CANCEL" )%>'
  292. CommandName='cancel'
  293. CausesValidation='false'
  294. Width='70px'
  295. CssClass='button'
  296. Runat='server' /></td>
  297. </tr>
  298. </table>
  299. </EditItemTemplate>
  300. <ItemTemplate>
  301. <table width='100%' cellpadding='4' cellspacing='0' border='0'>
  302. <colgroup>
  303. <col width='0*'>
  304. <col width='154'>
  305. </colgroup>
  306. <tr>
  307. <td class='tableHeader'>
  308. <uddi:StringResource
  309. Name='HEADING_CONTACT'
  310. Runat='Server' /></td>
  311. <td class='tableHeader' width='150'>
  312. <uddi:StringResource
  313. Name='HEADING_ACTIONS'
  314. Runat='Server' /></td>
  315. </tr>
  316. <tr valign='top'>
  317. <td class='tableItem'>
  318. <uddi:UddiLabel
  319. Text='<%# contact.PersonName %>'
  320. ID='displayName'
  321. Runat='server' /><br>
  322. <uddi:UddiLabel
  323. Text='[[TAG_USE_TYPE]]'
  324. CssClass='lightHeader'
  325. Runat='Server' />
  326. <uddi:UddiLabel
  327. Text='<%# Utility.Iff( Utility.StringEmpty( contact.UseType ), Localization.GetString( "HEADING_NONE" ), contact.UseType ) %>'
  328. ID='displayUseType'
  329. Runat='server' /></td>
  330. <td class='tableItem'>
  331. <uddi:UddiButton
  332. Text='<%# Localization.GetString( "BUTTON_EDIT" )%>'
  333. CommandName='edit'
  334. Width='70px'
  335. CssClass='button'
  336. Runat='server' /></td>
  337. </tr>
  338. </table>
  339. </ItemTemplate>
  340. </uddi:EditControl><br>
  341. <br>
  342. <uddi:Descriptions ID='descriptions' Runat='server' />
  343. </uddi:TabPage>
  344. <uddi:TabPage Name='TAB_EMAILS' Runat='server'>
  345. <uddi:ContextualHelpControl
  346. Runat='Server'
  347. Text='[[HELP_BLOCK_PUBLISH_CONTACT_EMAILS]]'
  348. HelpFile='publish.context.publishcontactemail'
  349. CssClass='tabHelpBlock'
  350. BorderWidth='0'
  351. />
  352. <br>
  353. <uddi:Email ID='emails' Runat='Server' />
  354. </uddi:TabPage>
  355. <uddi:TabPage Name='TAB_PHONES' Runat='server'>
  356. <uddi:ContextualHelpControl
  357. Runat='Server'
  358. Text='[[HELP_BLOCK_PUBLISH_CONTACT_PHONES]]'
  359. HelpFile='publish.context.publishcontactphone'
  360. CssClass='tabHelpBlock'
  361. BorderWidth='0'
  362. />
  363. <br>
  364. <uddi:Phone ID='phones' Runat='Server' />
  365. </uddi:TabPage>
  366. <uddi:TabPage Name='TAB_ADDRESSES' Runat='server'>
  367. <uddi:ContextualHelpControl
  368. Runat='Server'
  369. Text='[[HELP_BLOCK_PUBLISH_CONTACT_ADDRESSES]]'
  370. HelpFile='publish.context.publishcontactaddress'
  371. CssClass='tabHelpBlock'
  372. BorderWidth='0'
  373. />
  374. <br>
  375. <uddi:Address ID='addresses' Runat='server' />
  376. </uddi:TabPage>
  377. </uddi:TabControl>
  378. </td>
  379. </tr>
  380. </table>
  381. </td>
  382. </tr>
  383. <asp:PlaceHolder
  384. Id='FooterBag'
  385. Runat='server'
  386. >
  387. <tr height='95'>
  388. <td>
  389. <!-- Footer Control Here -->
  390. <uddi:Footer
  391. Runat='server'
  392. />
  393. </td>
  394. </tr>
  395. </asp:PlaceHolder>
  396. </table>
  397. </form>