<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="at.gv.egovernment.moa.id.configuration.helper.LanguageHelper"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
		<link rel="stylesheet" type="text/css" href="../css/index.css">
		<title><%=LanguageHelper.getGUIString("title", request) %></title>
		<script type="text/javascript" src="../js/common.js"></script>
		<script src="../js/jquery.js"></script>
		
	</head>
	
	<body>
		
 		<jsp:include page="snippets/header_userinfos.jsp"></jsp:include>

		<jsp:include page="snippets/main_menu.jsp"></jsp:include>
		
		<div id="information_area">
			<s:if test="hasActionErrors()">
   			<div id="error_area">
   				<label><%=LanguageHelper.getGUIString("error.title", request) %></label>
      			<s:actionerror/>
   			</div>
			</s:if>	
			
			<div id="list_area">
				<h2><%=LanguageHelper.getGUIString("webpages.moaconfig.header", request) %></h2>
			
				<s:if test="authUser.isAdmin()">
								
					<s:form namespace="/secure" method="POST" enctype="multipart/form-data">
							
							<s:textfield name="moaconfig.publicURLPrefix" 
								value="%{moaconfig.publicURLPrefix}" 
								labelposition="left"
								key="webpages.oaconfig.general.publicURLPreFix"
								cssClass="textfield_long">
							</s:textfield>
					
				
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.defaultbkus.header", request) %></h3>
							
							<s:textfield name="moaconfig.defaultBKUOnline" 
								value="%{moaconfig.defaultBKUOnline}" 
								labelposition="left"
								key="webpages.oaconfig.general.bku.online"
								cssClass="textfield_long">
							</s:textfield>
	
							<s:textfield name="moaconfig.defaultBKUHandy" 
								value="%{moaconfig.defaultBKUHandy}" 
								labelposition="left"
								key="webpages.oaconfig.general.bku.handy"
								cssClass="textfield_long">
							</s:textfield>
	
							<s:textfield name="moaconfig.defaultBKULocal" 
								value="%{moaconfig.defaultBKULocal}" 
								labelposition="left"
								key="webpages.oaconfig.general.bku.local"
								cssClass="textfield_long">
							</s:textfield>
						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.slrequesttemplates.header", request) %></h3>
							
							<s:textfield name="moaconfig.SLRequestTemplateOnline" 
								value="%{moaconfig.SLRequestTemplateOnline}" 
								labelposition="left"
								key="webpages.moaconfig.slrequesttemplates.online"
								cssClass="textfield_long">
							</s:textfield>
	
							<s:textfield name="moaconfig.SLRequestTemplateHandy" 
								value="%{moaconfig.SLRequestTemplateHandy}" 
								labelposition="left"
								key="webpages.moaconfig.slrequesttemplates.handy"
								cssClass="textfield_long">
							</s:textfield>
	
							<s:textfield name="moaconfig.SLRequestTemplateLocal" 
								value="%{moaconfig.SLRequestTemplateLocal}" 
								labelposition="left"
								key="webpages.moaconfig.slrequesttemplates.local"
								cssClass="textfield_long">
							</s:textfield>
						</div>			

						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.certificates.header", request) %></h3>
							
							<s:textfield name="moaconfig.certStoreDirectory" 
								value="%{moaconfig.certStoreDirectory}" 
								labelposition="left"
								key="webpages.moaconfig.certificates.certstore"
								cssClass="textfield_long">
							</s:textfield>
	
							<s:checkbox name="moaconfig.trustmanagerrevocationcheck" 
								value="%{moaconfig.trustmanagerrevocationcheck}"
								labelposition="left"
								key="webpages.moaconfig.certificates.trustmanagerrev"
								cssClass="checkbox">
							</s:checkbox>
	
							<s:textfield name="moaconfig.trustedCACerts" 
								value="%{moaconfig.trustedCACerts}" 
								labelposition="left"
								key="webpages.moaconfig.certificates.trustCACerts"
								cssClass="textfield_long">
							</s:textfield>

							<s:radio list="moaconfig.chainigmodelist"
								name="moaconfig.defaultchainigmode"
								value="%{moaconfig.defaultchainigmode}"
								labelposition="left"
								key="webpages.moaconfig.certificates.chainingmode"
								cssClass="radio">
							</s:radio>		

						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.timeout.header", request) %></h3>
							
							<s:textfield name="moaconfig.timeoutAssertion" 
								value="%{moaconfig.timeoutAssertion}" 
								labelposition="left"
								key="webpages.moaconfig.timeout.assertion"
								cssClass="textfield_long">
							</s:textfield>
							<s:textfield name="moaconfig.timeoutMOASessionCreated" 
								value="%{moaconfig.timeoutMOASessionCreated}" 
								labelposition="left"
								key="webpages.moaconfig.timeout.MOASessionCreated"
								cssClass="textfield_long">
							</s:textfield>
							<s:textfield name="moaconfig.timeoutMOASessionUpdated" 
								value="%{moaconfig.timeoutMOASessionUpdated}" 
								labelposition="left"
								key="webpages.moaconfig.timeout.MOASessionUpdated"
								cssClass="textfield_long">
							</s:textfield>
							
						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.moasp.header", request) %></h3>
							
							<s:textfield name="moaconfig.moaspssIdlTrustProfile" 
								value="%{moaconfig.moaspssIdlTrustProfile}" 
								labelposition="left"
								key="webpages.moaconfig.moasp.idltrustprofile"
								cssClass="textfield_long">
							</s:textfield>
							
<%-- 							<s:textarea name="moaconfig.identityLinkSigners" 
								value="%{moaconfig.identityLinkSigners}" 
								labelposition="left"
								key="webpages.moaconfig.identitylinksigners"
								cssClass="textfield_large">
							</s:textarea> --%>
							
							<s:textfield name="moaconfig.moaspssAuthTrustProfile" 
								value="%{moaconfig.moaspssAuthTrustProfile}" 
								labelposition="left"
								key="webpages.moaconfig.moasp.authtrustprofile"
								cssClass="textfield_long">
							</s:textfield>
							
<%-- 							<s:textarea name="moaconfig.moaspssAuthTransformations" 
								value="%{moaconfig.moaspssAuthTransformations}" 
								labelposition="left"
								key="webpages.moaconfig.moasp.authblocktransform"
								cssClass="textfield_large">
							</s:textarea> --%>
							<s:textfield name="moaconfig.moaspssAuthTransformations" 
								value="%{moaconfig.moaspssAuthTransformations}" 
								labelposition="left"
								key="webpages.moaconfig.moasp.authblocktransform"
								cssClass="textfield_long">
							</s:textfield>
							
							<s:textfield name="moaconfig.moaspssURL" 
								value="%{moaconfig.moaspssURL}" 
								labelposition="left"
								key="webpages.moaconfig.moasp.url"
								cssClass="textfield_long">
							</s:textfield>
							
						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.services.header", request) %></h3>
							<s:textfield name="moaconfig.mandateURL" 
								value="%{moaconfig.mandateURL}" 
								labelposition="left"
								key="webpages.moaconfig.services.mandates"
								cssClass="textfield_long">
							</s:textfield>
							<s:textfield name="moaconfig.szrgwURL" 
								value="%{moaconfig.szrgwURL}" 
								labelposition="left"
								key="webpages.moaconfig.services.szrgw"
								cssClass="textfield_long">
							</s:textfield>
						</div>
						
						<div class="oa_config_block" >
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.sso.header", request) %></h3>
<%-- 							<s:textfield name="moaconfig.ssoPublicUrl" 
								value="%{moaconfig.ssoPublicUrl}" 
								labelposition="left"
								key="webpages.moaconfig.sso.PublicUrl"
								cssClass="textfield_long">
							</s:textfield> --%>
							<s:textfield name="moaconfig.ssoFriendlyName" 
								value="%{moaconfig.ssoFriendlyName}" 
								labelposition="left"
								key="webpages.moaconfig.sso.FriendlyName"
								cssClass="textfield_long">
							</s:textfield>							
							<s:textfield name="moaconfig.ssoTarget " 
								value="%{moaconfig.ssoTarget }" 
								labelposition="left"
								key="webpages.moaconfig.services.sso.Target"
								cssClass="textfield_long">
							</s:textfield>
							<s:textarea name="moaconfig.ssoSpecialText" 
								value="%{moaconfig.ssoSpecialText}" 
								labelposition="left"
								key="webpages.moaconfig.services.sso.SpecialText"
								cssClass="textfield_large">
							</s:textarea>														
						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.oaconfig.stork.header", request) %></h3>
							<s:select list="#{1:'1', 2:'2', 3:'3', 4:'4'}"
								value="#{storkconfig.defaultQaa}"
								name="storkconfig.defaultQaa"
								key="webpages.moaconfig.stork.qaa.default"
								labelposition="left" />
							<h4><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.pepslist", request) %></h4>
                            <table id="stork_pepslist">
								<tr><th>Country Shortcode</th><th>PEPS URL</th>
								<s:iterator value="storkconfig.cpepslist" status="stat">
								  <tr><td><s:textfield name="storkconfig.cpepslist[%{#stat.index}].countryCode" value="%{countryCode}" cssClass="textfield_short"/></td>
								      <td><s:textfield name="storkconfig.cpepslist[%{#stat.index}].URL" value="%{URL}" cssClass="textfield_long"/></td>
								      <td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.removepeps", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
								</s:iterator>
                                <s:if test="%{storkconfig.cpepslist == null}">
                                    <tr><td><s:textfield name="storkconfig.cpepslist[0].countryCode" value="CC" cssClass="textfield_short"/></td>
                                        <td><s:textfield name="storkconfig.cpepslist[0].URL" value="http://" cssClass="textfield_long"/></td>
                                        <td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.removepeps", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
                                </s:if>
                            </table>
							<input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.newpeps", request) %>" onclick='newPeps();' />
							<h4><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %></h4>
							<table id="stork_attributelist">
								<tr><th><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading.name", request) %></th><th><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading.mandatory", request) %></th></tr>
								<s:iterator value="storkconfig.attributes" status="stat">
									<tr><td><s:textfield name="storkconfig.attributes[%{#stat.index}].name" value="%{name}"/></td>
										<td><s:checkbox name="storkconfig.attributes[%{#stat.index}].mandatory" value="%{mandatory}" /></td>
										<td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.remove", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
								</s:iterator>
							</table>
							<input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.new", request) %>" onclick='newStorkAttribute();' />
						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.header", request) %></h3>

							<div id="moageneral_active_protocol" class="moageneral_protocol_area">
								<h4><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.allowed.header", request) %></h4>
								<s:checkbox name="moaconfig.protocolActiveSAML1" 
									value="%{moaconfig.protocolActiveSAML1}"
									labelposition="left"
									key="webpages.moaconfig.protocols.legacy.saml1"
									cssClass="checkbox">
								</s:checkbox>
								<s:checkbox name="moaconfig.protocolActivePVP21" 
									value="%{moaconfig.protocolActivePVP21}"
									labelposition="left"
									key="webpages.moaconfig.protocols.legacy.pvp2"
									cssClass="checkbox">
								</s:checkbox>
								<s:checkbox name="moaconfig.protocolActiveOAuth" 
									value="%{moaconfig.protocolActiveOAuth}"
									labelposition="left"
									key="webpages.moaconfig.protocols.oauth"
									cssClass="checkbox">
								</s:checkbox>
							</div>
	
							<br>
															
							<div id="moageneral_legacy_protocol" class="moageneral_protocol_area">
								<h4><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.legacy.header", request) %></h4>
								<s:checkbox name="moaconfig.legacy_saml1" 
									value="%{moaconfig.legacy_saml1}"
									labelposition="left"
									key="webpages.moaconfig.protocols.legacy.saml1"
									cssClass="checkbox">
								</s:checkbox>
								<s:checkbox name="moaconfig.legacy_pvp2" 
									value="%{moaconfig.legacy_pvp2}"
									labelposition="left"
									key="webpages.moaconfig.protocols.legacy.pvp2"
									cssClass="checkbox">
								</s:checkbox>
							</div>
							
							<br>
							
							<div class="moageneral_protocol_area">
								<h4><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.saml1.header", request) %></h4>
									
									<s:textfield name="moaconfig.saml1SourceID " 
										value="%{moaconfig.saml1SourceID}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.saml1.sourceID"
										cssClass="textfield_long">
									</s:textfield>
							</div>
							
							<br>
							
							<div class="moageneral_protocol_area">
								<h4><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.pvp2.header", request) %></h4>
									
<%-- 									<s:textfield name="moaconfig.pvp2PublicUrlPrefix " 
										value="%{moaconfig.pvp2PublicUrlPrefix}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.PublicUrlPrefix"
										cssClass="textfield_long">
									</s:textfield> --%>
									<s:textfield name="moaconfig.pvp2IssuerName" 
										value="%{moaconfig.pvp2IssuerName}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.IssuerName"
										cssClass="textfield_long">
									</s:textfield>

									<h5><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.pvp2.org.header", request) %></h5>
									<s:textfield name="moaconfig.pvp2OrgName" 
										value="%{moaconfig.pvp2OrgName}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.org.name"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2OrgDisplayName" 
										value="%{moaconfig.pvp2OrgDisplayName}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.org.displayname"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2OrgURL " 
										value="%{moaconfig.pvp2OrgURL}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.org.url"
										cssClass="textfield_long">
									</s:textfield>
									
									<h5><%=LanguageHelper.getGUIString("webpages.moaconfig.protocols.pvp2.contact.header", request) %></h5>
									<s:textfield name="moaconfig.pvp2Contact.surname" 
										value="%{moaconfig.pvp2Contact.surname}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.contact.surename"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2Contact.givenname" 
										value="%{moaconfig.pvp2Contact.givenname}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.contact.givenname"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2Contact.mail" 
										value="%{moaconfig.pvp2Contact.mail}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.contact.email"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2Contact.phone" 
										value="%{moaconfig.pvp2Contact.phone}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.contact.phone"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2Contact.company" 
										value="%{moaconfig.pvp2Contact.company}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.contact.company"
										cssClass="textfield_long">
									</s:textfield>
									<s:textfield name="moaconfig.pvp2Contact.type" 
										value="%{moaconfig.pvp2Contact.type}" 
										labelposition="left"
										key="webpages.moaconfig.protocols.pvp2.contact.type"
										cssClass="textfield_long">
									</s:textfield>
							</div>
						</div>
						
						<div class="oa_config_block">
							<h3><%=LanguageHelper.getGUIString("webpages.moaconfig.sl.transormations.header", request) %></h3>
							
							<s:iterator value="%{moaconfig.fileUploadFileName}" var="fileName">
								<s:label key="webpages.moaconfig.sl.transormations.filename" value="%{fileName}"/>
						
								<div id="pvp2_certificate_upload">
									<s:file name="moaconfig.fileUpload" key="webpages.moaconfig.sl.transormations.upload" cssClass="textfield_long"></s:file>
								</div>
							</s:iterator>
							
							<s:if test="moaconfig.fileUploadFileName.size() == 0">
									<div id="pvp2_certificate_upload">
									<s:file name="moaconfig.fileUpload" key="webpages.moaconfig.sl.transormations.upload" cssClass="textfield_long"></s:file>
								</div>
							</s:if>
							
						</div>
						
						<br>
						<br>
						
						<s:hidden name="formID" 
							value="%{formID}"></s:hidden>
																	
						<div id="button_area">					
							<s:submit key="webpages.edit.back" action="backGeneralConfig"/>		
							<s:submit key="webpages.edit.save" action="saveGeneralConfig"/>						
						</div>
					
					</s:form>
					
				</s:if>
			</div>
			
		</div>
		
		<jsp:include page="snippets/footer.jsp"></jsp:include>
		
	</body>
</html>