<%@ Page language="c#" Codebehind="LOedit.aspx.cs" AutoEventWireup="false" Inherits="testEditor.LOedit" ValidateRequest=false Trace="false"%>
<%@ Register TagPrefix="uclayout" TagName="footer" Src="webfooter.ascx" %>
<%@ Register TagPrefix="uclayout" TagName="toolbar" Src="toolbar.ascx" %>
<%@ Register TagPrefix="uclayout" TagName="header" Src="webheader.ascx" %>
<%@ Register TagPrefix="uclayout" TagName="sidebar" Src="sidebar.ascx" %>
<%@ Register TagPrefix="fckeditorv2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>Learning Object Editor</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<meta http-equiv="Cache-Control" content="no-cache">
		<meta http-equiv="Cache-Control" content="post-check=0,pre-check=0">
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Expires" content="0">
		<script type="text/javascript">                
        
         var needtoConfirm = true;
         window.onbeforeunload = confirmExit;
         
         function CheckIsChanged()
         {
	          // Get the editor instance that we want to interact with.
	          var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
	          var isContinue;
	          if ( oEditor.IsDirty() )
	          {
	             alert (oEditor.IsDirty());
	             oEditor.ResetIsDirty();
	             isContinue = window.confirm("Your changes will be lost! Do you really want to continue?");
	             //return true;
	          }
	          //else 
	          // return false;
	         return isContinue;
          }
          
          function confirmExit()
          {
	          // Get the editor instance that we want to interact with.
	          var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
	          if (needtoConfirm)
	          {
	               if ( oEditor.IsDirty() )
	               {
	                  //alert (oEditor.IsDirty());
	                  oEditor.ResetIsDirty();
	                  //alert (oEditor.IsDirty());
	                  return "Your changes will be lost! Do you really want to continue?";	            
	                 }
	          }
	        
          }
          
          function unsetValue()
          {
              needtoConfirm = false;              
              
          }
          
          function warningMeta()
          {
             needtoConfirm = false;     
             return window.confirm("Make sure metadata is changed before continue. Do you want to proceed with saving?");
          }
          
          
          function ValidateRadioBtn(source,arguments)
          {
               
               if ((document.getElementById("RadioBtnMinor").checked == false) && (document.getElementById("RadioBtnMajor").checked == false))
                {
                   arguments.IsValid = false;
                }
                else
                   arguments.IsValid = true;
          }

          
          

		</script>
		<LINK href="mainstyle.css" type="text/css" rel="stylesheet">
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<P><uclayout:header id="ucHeader" runat="server"></uclayout:header><uclayout:toolbar id="ucToolbar" runat="server"></uclayout:toolbar></P>
			<P>
				<TABLE id="Table2" cellSpacing="0" cellPadding="6" width="100%" border="0">
					<TR>
						<TD class="tdnoborder">
							<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0">
								<TR>
									<TD class="sidelinks" style="WIDTH: 104px" vAlign="top"><uclayout:sidebar id="ucSidebar" runat="server"></uclayout:sidebar></TD>
									<TD class="content">
										<P><fckeditorv2:fckeditor id="FCKeditor1" runat="server" Height="600px" BasePath="/murlloEditing/FCKeditor/"></fckeditorv2:fckeditor>
										<P></P>
										<P><asp:label id="lblPage" runat="server"></asp:label><asp:literal id="LiteralIfrContent" runat="server"></asp:literal></P>
										<P><asp:label id="lblMsg" runat="server" Font-Bold="True" ForeColor="#C00000" Visible="False"></asp:label></P>
									</TD>
								</TR>
								<TR>
									<TD class="tdnoborder" style="WIDTH: 104px; HEIGHT: 49px"></TD>
									<TD class="tdnoborder" style="PADDING-TOP: 10px">
										<div class="savepanel" id="divSaveOption" runat="server">
											<TABLE id="tableSaveOption" cellSpacing="0" cellPadding="0" width="100%" border="0">
												<TR>
													<TD style="WIDTH: 119px; HEIGHT: 53px"><asp:label id="Label1" runat="server" ToolTip="Please enter some decription about the nature of your change">Edit Summary:</asp:label><asp:requiredfieldvalidator id="RFValidatorSum" runat="server" ErrorMessage="Please provide a summary for your changes"
															ControlToValidate="TextBoxSummary">*</asp:requiredfieldvalidator>&nbsp;&nbsp;&nbsp;
													</TD>
													<TD style="WIDTH: 303px; HEIGHT: 53px"><asp:textbox id="TextBoxSummary" runat="server" Height="56px" TextMode="MultiLine" Width="333px"></asp:textbox></TD>
													<TD style="HEIGHT: 53px"><asp:radiobutton id="RadioBtnMinor" runat="server" ToolTip="Is Version of" GroupName="changes" Text="Minor Changes"></asp:radiobutton>&nbsp;
														<asp:radiobutton id="RadioBtnMajor" runat="server" ToolTip="Is Based on" GroupName="changes" Text="Major Changes"></asp:radiobutton>&nbsp;
														<asp:customvalidator id="CustomValidator1" runat="server" ErrorMessage="Please indicate whether it is minor or major changes"
															Width="8px" OnServerValidate="ServerValidation" ClientValidationFunction="ValidateRadioBtn">*</asp:customvalidator></TD>
												</TR>
												<TR>
													<TD style="WIDTH: 100%; HEIGHT: 45px" colSpan="3">
														<div class="note">*&nbsp;the Edit Summary and Minor/Major changes buttons are 
															mandatory, you need to fill those before pressing the save button</div>
													</TD>
												</TR>
												<TR>
													<TD style="HEIGHT: 40px" colSpan="2">
														<div class="note"><asp:label id="Lblmeta" runat="server" Font-Size="Small"> * Please edit the metadata first before you save the learning object</asp:label></div>
													</TD>
													<td style="HEIGHT: 40px">
														<p><asp:hyperlink id="Hlmeta" runat="server" Font-Bold="True">Edit Metadata</asp:hyperlink>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
															<asp:HyperLink id="Hlmetanew" runat="server" Visible="False">Edit Meta Test</asp:HyperLink></p>
													</td>
												</TR>
												<TR>
													<TD style="HEIGHT: 42px" colSpan="2">&nbsp;<asp:button id="BtnSave" runat="server" Text="Save LO"></asp:button>&nbsp;
														<asp:button id="BtnCancel" runat="server" Text="Cancel" CausesValidation="False"></asp:button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													</TD>
													<TD align="right"><asp:imagebutton id="ImgBtnLock" runat="server" ToolTip="Click to acquire a lock for this LO for another 15 mins"
															CausesValidation="False" AlternateText="Acquire Lock" ImageUrl="logos/lock.GIF"></asp:imagebutton></TD>
												</TR>
												<TR>
													<TD colSpan="3"><asp:validationsummary id="ValidationSummary1" runat="server" Height="46px"></asp:validationsummary>
														<P><asp:literal id="Literal1" runat="server"></asp:literal></P>
														<P>&nbsp;</P>
													</TD>
												</TR>
											</TABLE>
										</div>
									</TD>
								</TR>
							</TABLE>
						</TD>
					</TR>
				</TABLE>
				<A class="linktotop" href="#top">Go To Top</A>
			</P>
			<p><uclayout:footer id="Footer1" runat="server"></uclayout:footer></p>
		</form>
	</body>
</HTML>
