<%@ Page Language="VB" AutoEventWireup="true"  Theme="Web20" CodeFile="DefaultVB.aspx.vb" Inherits="DefaultVB" %>

<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>HelpDesk 2</title>
	
	<link rel="stylesheet" type="text/css" href="Styles/HelpDesk.css" />
</head>
<body>
	<form id="form1" runat="server">
		<asp:ScriptManager ID="ScriptManager" runat="server" />
		<div style="height: 100%">

			<script type="text/javascript">
                function ShowNewWindow()
                {                 
                    var oWindow = window.radopen ("ComposeVB.aspx", null);
                    
                    oWindow.add_close(OnClientClose);
                }
                
                function ShowMessage(url)
                {         
                    var oWindow = window.radopen (url, null); 
                    oWindow.add_close(OnClientClose);
                }
                
                function OnClientClose()
                {
					$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(-1);
                }
                
                function MenuClick(sender, args)
                {
                    if (args.get_item().get_text() == "New")
                    {
                        ShowNewWindow();
                    }
                }
                
                function gridOpenMail(gridRow, e)
                {
					$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(e.get_itemIndexHierarchical());
                }
                
				function OnDateClick(sender, args)
				{
					args.get_domEvent().stopPropagation();
				}
                                                
                function OnDateSelecting(sender, args)
                {
					 args.set_cancel(!args.get_isSelecting());
                }
                     
                function OnClientSelectedIndexChanging(sender,args)
                {
                    sender.get_inputDomElement().blur();
                    var ev = args.get_domEvent();
                    if (ev)
                        ev.cancelBubble = true
                    
                }
			</script>

			<telerik:RadMenu ID="RadMenu1" runat="server" OnClientItemClicked="MenuClick" style="z-index: 1;"></telerik:RadMenu>
			
			<telerik:RadToolBar OnClientButtonClicking="click_handler" ID="RadToolbar1" runat="server">
				<Items>
					<telerik:RadToolBarButton ToolTip="New Document" CommandName="new" ImageUrl='Img/Email.gif' Text="New" />
					<telerik:RadToolBarButton ToolTip="Print Document" CommandName="Save" ImageUrl='Img/Printer.gif' Text="Print" />
					<telerik:RadToolBarButton ToolTip="Options" CommandName="Send" ImageUrl='Img/Options.gif' Text="Options" />
					<telerik:RadToolBarButton Width="601px">
						<ItemTemplate>
							<asp:Label ID="Label1" runat="server" AssociatedControlID="RadCombobox">From:</asp:Label>
							
							<telerik:RadComboBox ID="RadCombobox" runat="server" OnItemsRequested="RadCombobox_ItemsRequested"
								Height="200px" Width="230px" MarkFirstMatch="True" ItemRequestTimeout="500" ShowMoreResultsBox="True"
								EnableLoadOnDemand="True" AllowCustomText="true" AutoPostBack="true" OnSelectedIndexChanged="RadCombobox_SelectedIndexChanged" OnClientSelectedIndexChanging="OnClientSelectedIndexChanging">
							</telerik:RadComboBox>
						</ItemTemplate>
					</telerik:RadToolBarButton>
				</Items>
			</telerik:RadToolBar>

			<script type="text/javascript">
				function click_handler(sender, e)
				{
					if (e.get_item().get_text() == "New")
					{
						ShowNewWindow();
					}
				}
			</script>

			<telerik:RadSplitter ID="RadSplitterBrowser" runat="server" Height="98%" Width="100%"
				BorderSize="0" BorderStyle="None">
				<telerik:RadPane ID="RadPaneTreeView" runat="server" Scrolling="None" Width="263px">
					<telerik:RadSplitter ID="SplitterTreeView" runat="server" Orientation="Horizontal">
						<telerik:RadPane ID="RadPaneTV" runat="server" Height="100%">
						
							<telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick">
								<Nodes>
									<telerik:RadTreeNode runat="server" Text="Users" />
								</Nodes>
							</telerik:RadTreeView>
							
							<div style="clear: both; height: 24px"></div>
						</telerik:RadPane>
						<telerik:RadSplitBar ID="RadSplitBar3" runat="server" CollapseMode="Forward"></telerik:RadSplitBar>
						<telerik:RadPane ID="RadPaneCalendar" runat="server" Scrolling="None" Height="251px">
							<telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="True" CultureInfo="English (United States)"
								EnableMultiSelect="false" OnSelectionChanged="RadCalendar1_SelectionChanged"
								Height="100%" Width="100%">
								<ClientEvents OnDateClick="OnDateClick" OnDateSelecting="OnDateSelecting"></ClientEvents>
							</telerik:RadCalendar>
						</telerik:RadPane>
					</telerik:RadSplitter>
				</telerik:RadPane>
				<telerik:RadSplitBar ID="RadSplitBar1" runat="server" CollapseMode="Forward"></telerik:RadSplitBar>
				<telerik:RadPane ID="RadPaneGrid" runat="server" Width="400px">
					<telerik:RadGrid ID="RadGrid1" runat="server" Height="99.7%" OnPreRender="RadGrid1_PreRender"
						AutoGenerateColumns="False" OnItemDataBound="RadGrid1_ItemDataBound" >
						<AlternatingItemStyle Height="30px"></AlternatingItemStyle>
						<GroupHeaderItemStyle Font-Bold="True" ForeColor="#3366CC" VerticalAlign="Bottom">
						</GroupHeaderItemStyle>
						<MasterTableView Width="100%" GroupLoadMode="Client">
							<GroupByExpressions>
								<telerik:GridGroupByExpression>
									<SelectFields>
										<telerik:GridGroupByField FieldAlias="Product" FieldName="Product"></telerik:GridGroupByField>
									</SelectFields>
									<GroupByFields>
										<telerik:GridGroupByField FieldAlias="Product" FieldName="Product"></telerik:GridGroupByField>
									</GroupByFields>
								</telerik:GridGroupByExpression>
							</GroupByExpressions>
							<Columns>
								<telerik:GridBoundColumn UniqueName="MessageID" SortExpression="MessageID" DataField="MessageID"
									Display="false">
								</telerik:GridBoundColumn>
								<telerik:GridTemplateColumn HeaderText="Subject" SortExpression="Title" UniqueName="Title">
									<HeaderStyle Width="70%"></HeaderStyle>
									<ItemTemplate>
										<asp:Image ID="icon" runat="server" Style="vertical-align: middle" ImageUrl="Img/new.gif"
											AlternateText="Icon" BorderWidth="0" ImageAlign="absMiddle" />
										From:
										<asp:Label ID="itemLabelUser" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Email") %>'></asp:Label>
										<br />
										<asp:Label ID="itemLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>'></asp:Label>
										<asp:HyperLink ID="hlReply" runat="server" Style="color: gray;">Reply</asp:HyperLink>
									</ItemTemplate>
									<ItemStyle BorderStyle="None" />
								</telerik:GridTemplateColumn>
								<telerik:GridTemplateColumn HeaderText="Date" SortExpression="Date" UniqueName="Date">
									<HeaderStyle Width="30%"></HeaderStyle>
									<ItemTemplate>
										<asp:Label ID="itemLabelDate" runat="server"></asp:Label>
									</ItemTemplate>
									<ItemStyle BorderStyle="None" />
								</telerik:GridTemplateColumn>
							</Columns>
						</MasterTableView>
						<ItemStyle BorderStyle="None" />
						<ClientSettings ReorderColumnsOnClient="True" AllowGroupExpandCollapse="True" EnablePostBackOnRowClick="false">
							<Selecting AllowRowSelect="True" />
							<ClientEvents OnRowSelected="gridOpenMail" />
						</ClientSettings>
						<HeaderStyle BorderColor="#617FB5" BorderStyle="Solid" BorderWidth="1px" />
					</telerik:RadGrid>
				</telerik:RadPane>
				<telerik:RadSplitBar ID="RadSplitBar2" runat="server" CollapseMode="Backward"></telerik:RadSplitBar>
				<telerik:RadPane ID="RadPaneDiv" runat="server">
					<div style="padding: 9px; font: 12px Arial, Verdana, sans-serif; min-height:200px" id="testdiv" runat="server">
						<b><asp:Label ID="lblThreadTitle" runat="server"></asp:Label></b>
						<br />
						<br />
						<b><asp:Label ID="lblMessageDate" runat="server"></asp:Label></b>
						<div class="ReadingPane"><asp:Label ID="lblText" runat="server"></asp:Label></div>
					</div>
				</telerik:RadPane>
			</telerik:RadSplitter>
			<telerik:RadWindowManager Visible="true" Height="530px" Width="805px" Title="Compose"
				ID="Singleton" Modal="true" VisibleOnPageLoad="false" runat="server" Behaviors="Close">
				<Windows></Windows>
			</telerik:RadWindowManager>
			
			<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
				<AjaxSettings>
					<telerik:AjaxSetting AjaxControlID="RadToolbar1">
						<UpdatedControls>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="testdiv"></telerik:AjaxUpdatedControl>
						</UpdatedControls>
					</telerik:AjaxSetting>
					<telerik:AjaxSetting AjaxControlID="RadGrid1">
						<UpdatedControls>
							<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
						</UpdatedControls>
					</telerik:AjaxSetting>
					<telerik:AjaxSetting AjaxControlID="RadTreeView1">
						<UpdatedControls>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="testdiv"></telerik:AjaxUpdatedControl>
						</UpdatedControls>
					</telerik:AjaxSetting>
					<telerik:AjaxSetting AjaxControlID="RadCalendar1">
						<UpdatedControls>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadCalendar1">
							</telerik:AjaxUpdatedControl>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="testdiv"></telerik:AjaxUpdatedControl>
						</UpdatedControls>
					</telerik:AjaxSetting>
					<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
						<UpdatedControls>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="testdiv"></telerik:AjaxUpdatedControl>
						</UpdatedControls>
					</telerik:AjaxSetting>
					<telerik:AjaxSetting AjaxControlID="RadCalendar1">
						<UpdatedControls>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadCalendar1">
							</telerik:AjaxUpdatedControl>
							<telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="testdiv"></telerik:AjaxUpdatedControl>
						</UpdatedControls>
					</telerik:AjaxSetting>
				</AjaxSettings>
			</telerik:RadAjaxManager>
			
			<telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" InitialDelayTime="0"
				Transparency="50" BackColor="#ffffff">
				<img id="Img1" src="~/Img/loading6.gif" style="border: 0; margin: 100px 0;" width="74" alt="Loading..." runat="server" />
			</telerik:RadAjaxLoadingPanel>
			
			<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDesk2ConnectionString %>"
				SelectCommand="SELECT *,P.Name as Product FROM Users U INNER JOIN Messages M ON U.UserID = M.Sender INNER JOIN Threads T ON M.ThreadID = T.ThreadID INNER JOIN Products P ON P.ProductID=T.productID WHERE M.Date =@date">
				<SelectParameters>
					<asp:ControlParameter ControlID="RadCalendar1" DefaultValue="4/14/2006" Name="date"
						PropertyName="SelectedDate" />
				</SelectParameters>
			</asp:SqlDataSource>
			
			<telerik:RadToolTipManager ToolTipZoneID="_NON_EXISTING_" ID="TreeViewRadToolTipManager"
				runat="server" Position="BottomCenter" Animation="Fade" Width="230px"
				ShowDelay="500" Height="150px">
				<WebServiceSettings Method="GetUserDetails" Path="UserWebService.asmx" />
			</telerik:RadToolTipManager>
		</div>
	</form>
</body>
</html>
