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.

464 lines
12 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='Explorer' Src='../controls/explorer.ascx' %>
  10. <%@ Register Tagprefix='uddi' Tagname='BreadCrumb' Src='../controls/breadcrumb.ascx' %>
  11. <%@ Import Namespace='System.Data' %>
  12. <%@ Import Namespace='UDDI' %>
  13. <%@ Import Namespace='UDDI.API' %>
  14. <%@ Import Namespace='UDDI.API.Business' %>
  15. <%@ Import Namespace='UDDI.API.Service' %>
  16. <%@ Import Namespace='UDDI.API.ServiceType' %>
  17. <script language='C#' runat='server'>
  18. protected CacheObject cache;
  19. protected string searchID;
  20. protected string bgcolor;
  21. protected string cssClass;
  22. protected string margin;
  23. protected void Page_Init( object sender, EventArgs e )
  24. {
  25. Response.Expires = -1;
  26. Response.AddHeader( "Cache-Control", "no-cache" );
  27. Response.AddHeader( "Pragma", "no-cache" );
  28. searchID = Request[ "search" ];
  29. if( null == searchID )
  30. Response.Redirect( "default.aspx" );
  31. cache = SessionCache.Get( searchID );
  32. if( !UddiBrowser.IsDownlevel )
  33. {
  34. cssClass = "explorerFrame";
  35. bgcolor = "#eeeeee";
  36. margin = "5";
  37. explorerTab.Visible = true;
  38. breadcrumb.Visible = false;
  39. //tabs.Style.Height = Unit.Percentage( 100 );
  40. tabs.Style.Width = Unit.Percentage( 100 );
  41. tabs.TabGapStyle.Height = Unit.Pixel( 25 );
  42. tabs.TabBodyStyle.Height = Unit.Percentage( 100 );
  43. tabs.TabBodyStyle.CssClass = "tabPage";
  44. }
  45. else
  46. {
  47. cssClass = "viewFrame";
  48. bgcolor = "#ffffff";
  49. margin = "0";
  50. nsspacer.Style.Add( "padding", "10" );
  51. explorerTab.Visible = false;
  52. breadcrumb.Visible = true;
  53. }
  54. if( null != cache )
  55. {
  56. switch( cache.FindType )
  57. {
  58. case "find_service":
  59. grid.Columns[ 1 ].HeaderText = Localization.GetString( "HEADING_SERVICE_NAME" );
  60. break;
  61. case "find_business":
  62. grid.Columns[ 1 ].HeaderText = Localization.GetString( "HEADING_BUSINESS_NAME" );
  63. break;
  64. case "find_tModel":
  65. grid.Columns[ 1 ].HeaderText = Localization.GetString( "HEADING_TMODEL_NAME" );
  66. break;
  67. }
  68. }
  69. PageStyle.CssClass = cssClass;
  70. PageStyle.BackgroundColor = bgcolor;
  71. PageStyle.MarginHeight = margin;
  72. PageStyle.MarginWidth = margin;
  73. PageStyle.LeftMargin = margin;
  74. PageStyle.TopMargin = margin;
  75. }
  76. protected void Page_Load( object sender, EventArgs e )
  77. {
  78. breadcrumb.AddBlurb( Localization.GetString( "HEADING_SEARCH_RESULTS" ), null, null, null, false );
  79. if( !Page.IsPostBack )
  80. {
  81. entityKey.Text = null;
  82. PopulateDataGrid();
  83. }
  84. }
  85. protected void Grid_OnItemCommand( object sender, DataGridCommandEventArgs e )
  86. {
  87. switch( e.CommandName.ToLower() )
  88. {
  89. case "navigate":
  90. entityKey.Text = ((DataBoundLiteralControl)e.Item.Cells[ 0 ].Controls[ 0 ]).Text.Trim();
  91. if( !UddiBrowser.IsDownlevel )
  92. {
  93. tabs.SelectedIndex = 1;
  94. PopulateTreeView();
  95. }
  96. else
  97. {
  98. string key = entityKey.Text;
  99. switch( cache.FindType )
  100. {
  101. case "find_service":
  102. Response.Redirect( "../details/servicedetail.aspx?search=" + searchID + "&frames=false&key=" + key );
  103. break;
  104. case "find_business":
  105. Response.Redirect( "../details/businessdetail.aspx?search=" + searchID + "&frames=false&key=" + key );
  106. break;
  107. case "find_tModel":
  108. Response.Redirect( "../details/modeldetail.aspx?search=" + searchID + "&frames=false&key=" + key );
  109. break;
  110. }
  111. }
  112. break;
  113. }
  114. }
  115. protected void PopulateTreeView()
  116. {
  117. BusinessEntity business = new BusinessEntity();
  118. TModel tModel = new TModel();
  119. EntityBase parent;
  120. string key = entityKey.Text;
  121. if( Utility.StringEmpty( key ) || null == cache )
  122. {
  123. noSearch.Visible = true;
  124. return;
  125. }
  126. noSearch.Visible = false;
  127. switch( cache.FindType )
  128. {
  129. case "find_service":
  130. BusinessService service = new BusinessService();
  131. service.ServiceKey = key;
  132. service.Get();
  133. explorer.Initialize( service );
  134. Page.RegisterClientScriptBlock(
  135. "ReloadView",
  136. ClientScripts.ReloadViewPane( "../details/servicedetail.aspx?search=" + searchID + "&frames=true&key=" + key ) );
  137. break;
  138. case "find_business":
  139. business.BusinessKey = key;
  140. business.Get();
  141. explorer.Initialize( business );
  142. Page.RegisterClientScriptBlock(
  143. "ReloadView",
  144. ClientScripts.ReloadViewPane( "../details/businessdetail.aspx?search=" + searchID + "&frames=true&key=" + key ) );
  145. break;
  146. case "find_tModel":
  147. tModel.TModelKey = key;
  148. tModel.Get();
  149. explorer.Initialize( tModel );
  150. Page.RegisterClientScriptBlock(
  151. "ReloadView",
  152. ClientScripts.ReloadViewPane( "../details/modeldetail.aspx?search=" + searchID + "&frames=true&key=" + key ) );
  153. break;
  154. }
  155. }
  156. protected void TabControl_OnTabPageChange( object sender, int oldIndex, int newIndex )
  157. {
  158. switch( newIndex )
  159. {
  160. case 0:
  161. PopulateDataGrid();
  162. break;
  163. case 1:
  164. PopulateTreeView();
  165. break;
  166. }
  167. }
  168. protected void Grid_OnPageIndexChange( object sender, DataGridPageChangedEventArgs e )
  169. {
  170. grid.CurrentPageIndex = e.NewPageIndex;
  171. PopulateDataGrid();
  172. }
  173. protected void PopulateDataGrid()
  174. {
  175. int records = 0;
  176. if( null == cache )
  177. {
  178. count.Text = Localization.GetString( "TEXT_NO_SEARCH" );
  179. grid.Visible = false;
  180. return;
  181. }
  182. switch( cache.FindType )
  183. {
  184. case "find_service":
  185. ServiceList serviceList = cache.FindService.Find();
  186. grid.DataSource = serviceList.ServiceInfos;
  187. grid.DataBind();
  188. records = serviceList.ServiceInfos.Count;
  189. break;
  190. case "find_business":
  191. BusinessList businessList = cache.FindBusiness.Find();
  192. grid.DataSource = businessList.BusinessInfos;
  193. grid.DataBind();
  194. records = businessList.BusinessInfos.Count;
  195. break;
  196. case "find_tModel":
  197. TModelList tModelList = cache.FindTModel.Find();
  198. grid.DataSource = tModelList.TModelInfos;
  199. grid.DataBind();
  200. records = tModelList.TModelInfos.Count;
  201. break;
  202. }
  203. count.Text = String.Format( Localization.GetString( "TEXT_RECORD_COUNT" ), records );
  204. grid.Visible = ( records > 0 );
  205. }
  206. protected string GetKey( object info )
  207. {
  208. if( info is ServiceInfo )
  209. return ((ServiceInfo)info).ServiceKey;
  210. else if( info is BusinessInfo )
  211. return ((BusinessInfo)info).BusinessKey;
  212. else if( info is TModelInfo )
  213. return ((TModelInfo)info).TModelKey;
  214. return null;
  215. }
  216. protected string GetName( object info )
  217. {
  218. if( info is ServiceInfo )
  219. return HttpUtility.HtmlEncode( ((ServiceInfo)info).Names[ 0 ].Value );
  220. else if( info is BusinessInfo )
  221. return HttpUtility.HtmlEncode( ((BusinessInfo)info).Names[ 0 ].Value );
  222. else if( info is TModelInfo )
  223. return HttpUtility.HtmlEncode( ((TModelInfo)info).Name );
  224. return null;
  225. }
  226. protected string GetDescription( object info )
  227. {
  228. DescriptionCollection descriptions;
  229. if( info is BusinessInfo )
  230. {
  231. descriptions = ((BusinessInfo)info).Descriptions;
  232. }
  233. else
  234. {
  235. descriptions = new DescriptionCollection();
  236. if( info is ServiceInfo )
  237. descriptions.Get( ((ServiceInfo)info).ServiceKey, EntityType.BusinessService );
  238. else if( info is TModelInfo )
  239. descriptions.Get( ((TModelInfo)info).TModelKey, EntityType.TModel );
  240. }
  241. foreach( Description description in descriptions )
  242. {
  243. if( UDDI.Context.User.IsoLangCode == description.IsoLangCode )
  244. return description.Value;
  245. }
  246. return null;
  247. }
  248. </script>
  249. <uddi:StyleSheetControl
  250. Runat='server'
  251. Default='../stylesheets/uddi.css'
  252. Downlevel='../stylesheets/uddidl.css'
  253. />
  254. <uddi:PageStyleControl
  255. Runat='server'
  256. OnClientContextMenu='Document_OnContextMenu()'
  257. OnClientLoad='Window_OnLoad()'
  258. OnClientBeforeUnload='Window_OnBeforeUnload()'
  259. ShowFooter='false'
  260. Title="TITLE"
  261. AltTitle="TITLE_ALT"
  262. />
  263. <uddi:ClientScriptRegister
  264. Runat='server'
  265. Language='javascript'>
  266. <!--
  267. function Window_OnBeforeUnload()
  268. {
  269. var loading = document.getElementById( "loading" );
  270. var content = document.getElementById( "content" );
  271. if( null != loading )
  272. loading.style.display = "";
  273. if( null != content )
  274. content.style.display = "none";
  275. }
  276. function Window_OnLoad()
  277. {
  278. }
  279. function Document_OnContextMenu()
  280. {
  281. var e = window.event;
  282. e.cancelBubble = true;
  283. e.returnValue = false;
  284. }
  285. //-->
  286. </uddi:ClientScriptRegister>
  287. <uddi:SecurityControl
  288. UserRequired='true'
  289. Runat='server'
  290. />
  291. <form runat='server'>
  292. <table width='100%' border='0' height='100%' cellpadding='0' cellspacing='0'>
  293. <asp:PlaceHolder
  294. Id='HeaderBag'
  295. Runat='server'
  296. >
  297. <tr height='95'>
  298. <td>
  299. <!-- Header Control Here -->
  300. <uddi:Header
  301. Runat='server'
  302. />
  303. </td>
  304. </tr>
  305. </asp:PlaceHolder>
  306. <tr height='100%' valign='top'>
  307. <td>
  308. <uddi:BreadCrumb
  309. Id='breadcrumb'
  310. Runat='server'
  311. />
  312. <div id='nsspacer' Runat='server'>
  313. <uddi:TabControl ID='tabs'
  314. OnTabChange='TabControl_OnTabPageChange'
  315. Runat='server'>
  316. <uddi:TabPage Name='TAB_FIND_RESULTS' Runat='server'>
  317. <div id='loading' style='padding: 15px; display: none'>
  318. <%=UDDI.Localization.GetString( "TEXT_LOADING" )%>
  319. </div>
  320. <div id='content'>
  321. <asp:DataGrid ID='grid' AutoGenerateColumns='false' Width='100%' Border='0' Cellpadding='2' Cellspacing='0' ItemStyle-VerticalAlign='top' OnItemCommand='Grid_OnItemCommand' OnPageIndexChanged='Grid_OnPageIndexChange' AllowPaging='true' PageSize='7' Visible='false' Runat='server'>
  322. <EditItemStyle CssClass='tableEditItem' />
  323. <HeaderStyle CssClass='tableHeader' />
  324. <ItemStyle CssClass='tableItem' />
  325. <AlternatingItemStyle CssClass='tableAlternatingItem' />
  326. <FooterStyle CssClass='tableFooter' />
  327. <PagerStyle Mode='NumericPages' HorizontalAlign='Left' CssClass='pager' PageButtonCount='10' />
  328. <Columns>
  329. <asp:TemplateColumn Visible='false'>
  330. <ItemTemplate>
  331. <%# GetKey( Container.DataItem ) %>
  332. </ItemTemplate>
  333. </asp:TemplateColumn>
  334. <asp:TemplateColumn>
  335. <ItemTemplate>
  336. <nobr>
  337. <%# grid.CurrentPageIndex * grid.PageSize + Container.ItemIndex + 1 %>.
  338. <asp:LinkButton
  339. CommandName='navigate'
  340. Text='<%# GetName( Container.DataItem ) %>'
  341. ToolTip='<%# GetName( Container.DataItem ) %>'
  342. Runat='server' /></nobr><br>
  343. <uddi:UddiLabel Text='<%# GetDescription( Container.DataItem ) %>' Runat='server' />
  344. </ItemTemplate>
  345. </asp:TemplateColumn>
  346. </Columns>
  347. </asp:DataGrid><br>
  348. <asp:Label ID='count' Runat='server' />
  349. </div>
  350. </uddi:TabPage>
  351. <uddi:TabPage ID='explorerTab' Name='TAB_EXPLORER' Runat='server'>
  352. <div id='loading' style='padding: 15px; display: none'>
  353. <%=UDDI.Localization.GetString( "TEXT_LOADING" )%>
  354. </div>
  355. <div id='content'>
  356. <uddi:LocalizedLabel ID='noSearch' Name='TEXT_NO_SEARCH' Runat='server' />
  357. <uddi:Explorer ID='explorer' Runat='server' />
  358. </div>
  359. </uddi:TabPage>
  360. </uddi:TabControl>
  361. <asp:Label ID='entityKey' Visible='false' Runat='server' />
  362. </div>
  363. <br>
  364. </td>
  365. </tr>
  366. <asp:PlaceHolder
  367. Id='FooterBag'
  368. Runat='server'
  369. >
  370. <tr height='95'>
  371. <td>
  372. <!-- Footer Control Here -->
  373. <uddi:Footer
  374. Runat='server'
  375. />
  376. </td>
  377. </tr>
  378. </asp:PlaceHolder>
  379. </table>
  380. </form>