<%@ page errorPage="errorPage.jsp" language="java" session="true" contentType="text/html;charset=ISO-8859-2" %>
<%@ page import="com.etixpert.evolution.gui.servlets.*"%>
<%@ page pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ include file="header.jsp" %>
<%@ include file="check.jsp" %>	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%
	boolean admin = false;
	boolean distributor = false;
	boolean customer = false;
	if	(session.getAttribute("admin")!=null) admin = true;
	if	(session.getAttribute("customer")!=null) customer = true;
		if	(session.getAttribute("distributor")!=null) distributor = true;
%>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="main.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- JavaScript code hiding
	function changeSel(which){
		window = open("leftMenu.jsp?sel="+which, "_self", "");
	}

	function simpleLink(origLink) {
		parent.mainFrame.location = origLink;
	}


	function link(origLink){
		if (top.mainFrame.document.forms.length == 0) {
			simpleLink(origLink);
			return;
		}
		else {
			if (top.mainFrame.document.forms[0].saveState == null) {
				simpleLink(origLink); 
				return;
			}
			top.mainFrame.document.forms[0].saveState.value = top.mainFrame.self.location.pathname;
			top.mainFrame.document.forms[0].link.value = origLink;
			top.mainFrame.document.forms[0].submit();
		}
	}
	
	function sWait() {
		 document.all['showWait'].style.display='block';
 		 document.all['noShowWait'].style.display='none';
	}
	
	function hWait() {
		 document.all['noShowWait'].style.display='block';
  		 document.all['showWait'].style.display='none';
	}
	
	
// -->
</SCRIPT>
</head>
<body onLoad="hWait();">
<div width="800" height="30" align="left" class="menu"><%=FormHelper.generateUserDataHeaderString(pageContext)%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="menu" href="process/user_selection.jsp">Anderen Vetriebspartner auswählen</a></div>
<table border="1" id="userTable" class="menu">
    <%
    	String curr_level_id = (String)session.getAttribute("original_level_id");
    	String showBonus = ("400".equals(curr_level_id)) ? "true":"false";
    %>
<jsp:include page="MenuHelper.jsp">
	<jsp:param name="showBonus" value="<%=showBonus%>"/>
	<jsp:param name="self_id" value="1270"/>
	<jsp:param name="parent_id" value="1200"/>	
</jsp:include>
</table>
<form action="process/user_detail_modify.jsp" method="post">
<input type="hidden" name="saveState"/>
<input type="hidden" name="pageAction"/>
<input type="hidden" name="link" value="process/user_detail_modify.jsp"/>
  <table width="800" border="0" cellpadding="0" cellspacing="0" id="userDetailsTable" class="normal">
    <!--DWLayoutTable-->
    <tr> 
      <td width="293" height="30" valign="top" id="userTableContentMainTitles"><fmt:message key="SELECT_OPTION"/>:  </td>
      <td width="76">&nbsp;</td>
      <td width="431">&nbsp;</td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><a href="javascript:top.mainFrame.document.forms[0].pageAction.value = 'user_modify'; link('process/user_detail_modify.jsp');" onClick="javascript:sWait();"><fmt:message key="SAVE_MOD"/></a></td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><a href="javascript:top.mainFrame.document.forms[0].pageAction.value = 'load_user'; link('process/user_detail_personal.jsp');"><fmt:message key="REVERT_TO_DB"/></a></td>
    </tr>
    <%
    	if (session.getAttribute("DISTRIBUTOR_ALLOW_BANK_PROBLEM")!=null) {

    %>
    	<tr>
    		<td id="userTableContentMainTitles2" height="329" colspan="3">
    		<%
    		java.util.Map problem = (java.util.Map)session.getAttribute("DISTRIBUTOR_ALLOW_BANK_PROBLEM");
      		java.util.List orders = (java.util.List)problem.get("orders");
      		java.util.List abos = (java.util.List)problem.get("abos");
      		String ord_list = "";
      		String abo_list = "";
      		if (orders!=null) {
      			for (int i = 0; i<orders.size(); i++) {
      				ord_list = ord_list + (""+orders.get(i));
      				if (i!=orders.size()-1) ord_list = ord_list + ", ";
      			}
      		}
      		if (abos!=null) {
      			for (int i = 0; i<abos.size(); i++) {
      				abo_list = abo_list + (""+abos.get(i));
      				if (i!=abos.size()-1) abo_list = abo_list + ", ";
      			}
      		}
      		%>
      			<fmt:message key="ALLOW_BANK_PROBLEM"/><br>
      		<%
      		if (!"".equals(ord_list)) {
      			%>
      				Bestellungen: <%=ord_list%><br>
      			<%
      		}
      		if (!"".equals(abo_list)) {
      			%>
      				Abos: <%=abo_list%><br>
      			<%
      		}
      		session.setAttribute("DISTRIBUTOR_ALLOW_BANK_PROBLEM", null);
    		
    		%>
    		</td>
    	</tr>
    <%   
   
   		} else if (session.getAttribute("CANNOT_MODIFY_USER")!=null) {
     %>
    	<tr>
    		<td id="userTableContentMainTitles2" height="329" colspan="3">
    		<%  
    			out.println(session.getAttribute("CANNOT_MODIFY_USER"));
	      		session.setAttribute("CANNOT_MODIFY_USER", null);
			%>
    		</td>
    	</tr>
    <%   
    	} else {
    %>
    <tr> 
      <td height="329">&nbsp;</td>
      <td>&nbsp;</td>
      <td id="userTableContentMainTitles"><%
      	if (session.getAttribute("DISTRIBUTOR_MODIFIED")!=null) {
      		String id = (String)session.getAttribute("CURRENT_DISTRIBUTOR_ID");
      		out.print(id!=null?id:"");out.print(" wurde erfolgreich geändert!");
      	}
      	
      	
      	
      	session.setAttribute("DISTRIBUTOR_MODIFIED", null);
      	
      	if (session.getAttribute("ABO_WARNING")!=null) {
      	%>
      		<br><fmt:message key="PARTNER_CREATE_ABO"/>
      	<%
      		session.setAttribute("ABO_WARNING", null);
      	}
      	
      %></td>
    </tr>
    <%
    	}
    %>
    <tr>
      <td colspan="3" id="userTableContentFields" height="30"><div id="showWait" style="display:none;">&nbsp;&nbsp;&nbsp;&nbsp;<fmt:message key="PLEASE_WAIT"/></div><div id="noShowWait" style="display:none;">&nbsp;</div></td>
    </tr>    
  </table>
</form>
</body>
</html>
