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.

82 lines
2.4 KiB

  1. using System;
  2. using System.Data;
  3. using System.Web.UI;
  4. using System.Web.UI.WebControls;
  5. using UDDI;
  6. using UDDI.API;
  7. using UDDI.API.ServiceType;
  8. using UDDI.Diagnostics;
  9. namespace UDDI.Web
  10. {
  11. public class TModelControl : UddiControl
  12. {
  13. protected TModelInfoCollection tModelInfos;
  14. protected bool frames;
  15. protected DataGrid grid;
  16. public void Initialize( TModelInfoCollection tModelInfos, bool allowEdit )
  17. {
  18. this.tModelInfos = tModelInfos;
  19. grid.Columns[ 0 ].Visible = allowEdit;
  20. grid.Columns[ 1 ].Visible = allowEdit;
  21. grid.Columns[ 2 ].Visible = !allowEdit;
  22. }
  23. protected void Page_Load( object sender, EventArgs e )
  24. {
  25. frames = ( "true" == Request[ "frames" ] );
  26. PopulateDataGrid();
  27. }
  28. void PopulateDataGrid()
  29. {
  30. grid.DataSource = tModelInfos;
  31. grid.DataBind();
  32. }
  33. protected void TModel_Edit( object sender, DataGridCommandEventArgs e )
  34. {
  35. string key = tModelInfos[ e.Item.ItemIndex ].TModelKey;
  36. if( frames )
  37. {
  38. //
  39. // Reload explorer and view panes.
  40. //
  41. Response.Write(
  42. ClientScripts.ReloadExplorerAndViewPanes( "editmodel.aspx?frames=true&key=" + key, key ) );
  43. }
  44. else
  45. {
  46. Response.Redirect( "editmodel.aspx?frames=false&key=" + key );
  47. }
  48. }
  49. protected void TModel_Delete( object sender, DataGridCommandEventArgs e )
  50. {
  51. string name = tModelInfos[ e.Item.ItemIndex ].Name;
  52. string key = tModelInfos[ e.Item.ItemIndex ].TModelKey;
  53. //
  54. // The user has not yet confirmed the delete operation, so display
  55. // a confirmation dialog.
  56. //
  57. string message = String.Format(
  58. Localization.GetString( "TEXT_DELETE_CONFIRMATION" ),
  59. name );
  60. Page.RegisterStartupScript(
  61. "Confirm",
  62. ClientScripts.Confirm(
  63. message,
  64. "editmodel.aspx?frames=" + ( frames ? "true" : "false" ) + "&key=" + key + "&mode=delete&confirm=true&tab=2" ) );
  65. }
  66. protected void TModel_Add( object sender, EventArgs e )
  67. {
  68. Response.Redirect( "editmodel.aspx?frames=" + ( frames ? "true" : "false" ) + "&mode=add" );
  69. }
  70. }
  71. }