<%@ Page Language="VB" %>
<%@ Register TagPrefix="ex" Namespace="Exact.Web.UI.Controls" Assembly="Exact.Web.UI.Controls" %>
<%@ Register TagPrefix="ep" Namespace="Exact.Web.UI.Page" Assembly="Exact.Web.UI.Page" %>
<%@ import Namespace="Exact.Core" %>
<%@ Import Namespace="Exact.Data" %>
<%@ Import Namespace="Exact.Repository" %>
<script runat="server">
	Private Sub Page_Init()
		Me.MultiBrowserSupport = True

		Me.AppendStartUpScript("onLoad()")
		AppSecurityLevel = 1
		AppUserLicenseType = Exact.Common.UserLicenseType.Basic
		IgnoreCallStack = True

		MultiBrowserSupport = True
	End Sub

	Private Sub Page_Load()
		MemoHeader.InnerText = env.Term.String(13207, "Query")
	End Sub
</script>
<html>
<head>
	<title><ex:literal runat="server" caption="Notes" captionid="19582" /></title>
	<meta name="save" content="history" />
	<link runat="server" id="ExactCSS" rel="stylesheet" type="text/css" href="Exact.css"/>
<style type="text/css">
#Memo
{
    font-family: Consolas, Courier New, Courier, monospace !important;
}
</style>
	<script type="text/javascript" >
		var ctrlDown = false,
			ctrlKey = 17,
			cmdKey = 91,
			cKey = 67;
		function onLoad() {
			$(document).keydown(function (e) {
				if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = true;
			}).keyup(function (e) {
				if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = false;
			});

			var memo = SysGetElement('Memo');
			var dlgargs;
			try {
				dlgargs = window.ModalPopUp.data('params');

				if (dlgargs != null && dlgargs.length > 0) {
					var s = "";
					for (i = 0; i < dlgargs.length; i++) {
						s += dlgargs[i];
					}
					//s = s.length > 0 ? s + "\r\n" : "";
                    memo.innerHTML = s;
				}
			}
			catch (ex) {
				window.location = 'SysAccessDenied.aspx';
			}
			
			SysFocus('Memo');
			$('#Memo').scrollTop(0);
		}

		function acceptkeyCode(keyCode) {
			if (ctrlDown && keyCode == cKey) return 'false';
			if (keyCode == 13 || keyCode == 32 || (keyCode > 47 && keyCode < 91) || (keyCode > 95 && keyCode < 112) ||
				(keyCode > 218 && keyCode < 223) || (keyCode > 186 && keyCode < 193)) {
				return 'true';
			}
			return 'false';
		}

		function findRemarksElement() {
			if (window.parent.frames.length > 0) {
				for (i = 0; i <= window.parent.frames.length - 1; i++) {
					var lochref = window.parent.frames[i].location.href.toLowerCase();
					if (lochref.indexOf("wflrequest.aspx") > 1) //From Simple request : project card - remarks full screen
						return window.parent.frames[i].SysGetElement(window.parent.frames[i].fullScreenRemarkTag);
					else if (lochref.indexOf("simplerequest.aspx") > 1) {
						var currFrame = window.parent.frames[i];
						for (j = 0; j <= currFrame.frames.length - 1; j++) {
							lochref = currFrame.frames[j].location.href.toLowerCase();
							if (lochref.indexOf("wflrequest.aspx") > 1)
								return currFrame.frames[j].SysGetElement(currFrame.frames[j].fullScreenRemarkTag);
						}
					}
					
				}

			}
						
			return window.parent.SysGetElement(window.parent.fullScreenRemarkTag);;
		}

		function onOk() {
			window.parent.returnValue = SysGet('Memo');
			SysCloseModalPopup();
		}

		function onCancel() {
			window.parent.returnValue = null;
			SysCloseModalPopup();
			
		}
		function onFullScreen() {
            SysSetEditFullscreen('Memo', SysGet("AltHeader"));
		}		
	</script>
    <%: System.Web.Optimization.Scripts.Render("~/ScriptBundles/jqueryjs") %> 
    <style type="text/css">
        #frmPopupMemo { width: 99%; height: 98%; }
    	#MemoBody {overflow:hidden;padding-left: 15px;}
    	#MemoHeader {font-size:28px; }
    	#Memo { width:calc((100%) - 10px); height:calc((100%) - 43px);  	}
		#MemoDiv {overflow-y:auto; max-height:calc((100%) - 30px); height:calc((100%) - 30px); 	}
    	#popupControlHeader {padding-top:5px;}
    	#rightCloseIcon {padding-top: 7px; height: 30px;}
    </style>
</head> 
<body id="MemoBody" onkeydown="if (new SysHandleKey(event).IsEscapeKey()) {onCancel(); SysCancelBubble(event);}">
	
<ep:form runat="server" id="frmPopupMemo" >
	<ex:inputfield id="Mode" runat="server" validationas="Int" hidden="True"/>
	<ex:inputfield id="Update" runat="server" validationas="Int" hidden="True"/>
	<ex:inputfield id="FinTransID" runat="server" validationas="Guid" hidden="True"/>	
	<ex:inputfield id="Full" runat="server" validationas="Int" hidden="True" validationdefault="0"/>
    <ex:inputfield id="AltHeader" runat="server" hidden="True"/>
	<div style="height:100%">
	<div style="height:38px;">
		<span runat="server" id="MemoHeader" ></span>
	</div>
	<div id="MemoDiv">
		<textarea id="Memo" runat="server"></textarea>  
		<div class="ButtonSectionPadding">
			<table style="width:100%">
				<tr>
					<td style="width:34%">
						<ex:button id="btnFullScreen" runat="server" buttonstyle="FullScreen" buttontype="Action" onclick="onFullScreen()" visible="false" />
					</td>
					<td style="width:32%;text-align:center;">
						<ex:button id="btnCancel" runat="server" buttonstyle="Cancel" buttontype="Action" onclick="onCancel()" />
						<ex:button id="btnOK" runat="server" buttonstyle="Custom" caption="OK" buttontype="Action" onclick="onOk()" />
					</td>
					<td style="width:34%"></td>
				</tr>
			</table>
		</div>
	</div>
	</div>
</ep:form>
</body>

</html>
