/////////////////////////////////////////////////////////////////
//Copyright (C) 2005 NTT CORPORATION.
//
//	ATCXV@Assignmentse[uւ̒ǉsAǉ̏NCAg̃AvbgɕԂActionNX
//
//		ύX
//			2005.02.16  VK쐬   ΍茫Y
//
//	@\
//
//	Assignmentse[uւ̒ǉsAǉ̏NCAg̃AvbgɕԂActionNXłB
//
/////////////////////////////////////////////////////////////////
package jp.co.ntt.lms.xmf.actions.lo.method.methodassignments;

import java.util.Date;
import java.util.Hashtable;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import jp.co.ntt.lms.xmf.xmo.Com.ConstTree;
import jp.co.ntt.lms.xmo.Assignments.AssignmentsClient;
import jp.co.ntt.lms.xmo.Groups.GroupsClient;
import jp.co.ntt.lms.xmo.Lo.LoClient;
import jp.co.ntt.lms.xmo.People.PeopleClient;
import jp.co.ntt.lms.xmo.util.HtmlEscape;
import jp.co.ntt.lms.xmo.util.XMODate;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;

/**
 * Assignmentse[uւ̒ǉsǍʂAvbgɕԂActionNXłB
 * 
 * @author Kentaro Ishizaki (UNITEC)
 * @version 1.0
 */
public class MethodAssignmentsUpdateActionAction extends Action
{
	/**
	 * strutst[[NĂ΂郁\bhłB
	 * 
	 * @param mapping }bsOIuWFNgB
	 * @param form ANVtH[IuWFNgB
	 * @param request NGXgIuWFNgB
	 * @param response X|XIuWFNgB
	 * @return ActionForward ANVtH[hIuWFNgB
	 * @throws Exception
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		///////////////////////////////////////////
		// p[^擾
		// 	EparentID		eO[vID	K{
		// 	EselectID		O[vID	K{
		// 	EParentLoID	eLOID			K{
		// 	ELOID			LOID			K{
		// 	Einsert_mode	o^[h	K{
		//  ESendMailFlag  [MtO
		///////////////////////////////////////////
		String strTreeViewType = request.getParameter("tree_view_type");	// c[^Cv("1":Group,"2":Lo)
		String strMode = request.getParameter("Mode");						// [h("insert"/"delete")
		String strParentID = request.getParameter("ParentID");				// eO[vID
		String strSelectID = request.getParameter("SelectID");				// IꂽO[vorlID
		String strParentLoID = request.getParameter("ParentLoID");			// eLOID
		String strLoID = request.getParameter("LoID");						// LOID
		String strInsertMode = request.getParameter("insert_mode");			// o^̏ꍇ̏[h
		String strLearnAuthority = request.getParameter("LearnAuthority");			// wKATC
		String strManagementAuthority = request.getParameter("ManageAuthority");	// ǗATC
		String strSendMailFlag = request.getParameter("SendMailFlag");				// [MtO

		String strUserID = (String)request.getSession().getAttribute("userId");					// ATC

		// bZ[W\[X擾
		MessageResources resources = getResources(request, "msg.xmf.lo.Method.MethodAssignments.MessageResources");
		
		///////////////////////////////////////////
		// p[^`FbN
		///////////////////////////////////////////
		if( strTreeViewType == null || strTreeViewType.equals( "" ) ) {
			String strMessage = resources.getMessage("M062009");
			String strDetail = resources.getMessage("D062009");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strMode == null || strMode.equals( "" ) ) {
			String strMessage = resources.getMessage("M062005");
			String strDetail = resources.getMessage("D062005");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strParentID == null || strParentID.equals( "" ) ) {
			String strMessage = resources.getMessage("M062001");
			String strDetail = resources.getMessage("D062001");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strSelectID == null || strSelectID.equals( "" ) ) {
			String strMessage = resources.getMessage("M062002");
			String strDetail = resources.getMessage("D062002");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strParentLoID == null || strParentLoID.equals( "" ) ) {
			String strMessage = resources.getMessage("M062006");
			String strDetail = resources.getMessage("D062006");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strLoID == null || strLoID.equals( "" ) ) {
			String strMessage = resources.getMessage("M062007");
			String strDetail = resources.getMessage("D062007");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strUserID == null || strUserID.equals( "" ) ) {
			String strMessage = resources.getMessage("M062010");
			String strDetail = resources.getMessage("D062010");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strLearnAuthority == null || strLearnAuthority.equals( "" ) ) {
			String strMessage = resources.getMessage("M062011");
			String strDetail = resources.getMessage("D062011");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		if( strManagementAuthority == null || strManagementAuthority.equals( "" ) ) {
			String strMessage = resources.getMessage("M062012");
			String strDetail = resources.getMessage("D062012");
			request.setAttribute("message", strMessage);
			request.setAttribute("detail", strDetail);
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}

		String strMemberShipID = null; 				// o[VbvID
		if( strParentID.equals( MethodAssignmentsConstants.GROUP_TREE_ROOT )) {
			Hashtable htbRootInfo = (Hashtable)request.getSession().getAttribute( MethodAssignmentsConstants.ASSIGN_ROOT_INFO );
			strMemberShipID = (String)htbRootInfo.get( strSelectID ) + strSelectID; 					// o[VbvID
		}
		else {
			strMemberShipID = strParentID + strSelectID;
		}
		String strMaterialID = null;										// }eAID
		if( strParentLoID.equals( MethodAssignmentsConstants.LO_TREE_ROOT )) {
			Hashtable htbRootInfo = (Hashtable)request.getSession().getAttribute( MethodAssignmentsConstants.ASSIGN_ROOT_INFO );
			strMaterialID = (String)htbRootInfo.get( strLoID ) + strLoID; 					// }eAID
		}
		else {
			strMaterialID = strParentLoID + strLoID;
		}
		String strStartDate = XMODate.parseTime(new Date());			// wKJn
		String strEndDate = XMODate.parseTime(new Date());				// wKI

		
		if( strMode.equals( "insert" ) ) {
			////////////////////////////////////
			// o^
			////////////////////////////////////
			AssignmentsClient objAssignments = new AssignmentsClient();

			// p[^ݒ
			objAssignments.setMemberShipID( strMemberShipID );	// o[VbvID
			objAssignments.setMaterialID( strMaterialID );		// }eAID
			objAssignments.setStudyStartDate( strStartDate );	// wKJn
			objAssignments.setEndDate( strEndDate );			// wKI
			objAssignments.setAssigner( strUserID );						// ATC
			objAssignments.setLearnAuthority( strLearnAuthority );			// wKATC
			objAssignments.setManagementAuthority( strManagementAuthority );// ǗATC
			objAssignments.setSendMailFlag( strSendMailFlag );
			objAssignments.setValue(AssignmentsClient.METHOD_FLAG, "1");

			// o^\bhs
			if( !objAssignments.insert() ) {
				// o^܂Ȃꍇ
				if( objAssignments.isErr() ) {
					// G[̏ꍇ
					request.setAttribute("message", "");
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", objAssignments.getURL());
					return mapping.findForward("error");
				}
				else {
					String strMessage =  objAssignments.getMessage();
					request.setAttribute("message", strMessage);
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", "");
					return mapping.findForward("error");
				}
			}

			Vector vctAssUserList = null;
			// o^[U擾
			if( objAssignments.next() ) {
				vctAssUserList = objAssignments.getAssignUserList();
			}

			//T[ubgJump
			if(vctAssUserList != null && strSendMailFlag.equals("1"))
			{
				HttpSession objSession = request.getSession();
				objSession.setAttribute("USER_LIST", vctAssUserList);
				objSession.setAttribute("IUSERID", strUserID);
			}
		}
		else if( strMode.equals( "update" ) ) {
			////////////////////////////////////
			// XV
			////////////////////////////////////
			AssignmentsClient objAssignments = new AssignmentsClient();

			// p[^ݒ
			objAssignments.setMemberShipID( strMemberShipID );	// o[VbvID
			objAssignments.setMaterialID( strMaterialID );		// }eAID
			// 
			objAssignments.setWhereMemberShipID( strMemberShipID );	// o[VbvID
			objAssignments.setWhereMaterialID( strMaterialID );		// }eAID
			// XV
			objAssignments.setAssigner( strUserID );						// ATC
			objAssignments.setLearnAuthority( strLearnAuthority );			// wKATC
			objAssignments.setManagementAuthority( strManagementAuthority );// ǗATC
			objAssignments.setSendMailFlag( strSendMailFlag );
			objAssignments.setValue(AssignmentsClient.METHOD_FLAG, "1");

			// XV\bhs
			if( !objAssignments.update() ) {
				// XV܂Ȃꍇ
				if( objAssignments.isErr() ) {
					// G[̏ꍇ
					request.setAttribute("message", "");
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", objAssignments.getURL());
					return mapping.findForward("error");
				}
				else {
					String strMessage =  objAssignments.getMessage();
					request.setAttribute("message", strMessage);
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", "");
					return mapping.findForward("error");
				}
			}
		}
		else {
			////////////////////////////////////
			// 폜
			////////////////////////////////////
			AssignmentsClient objAssignments = new AssignmentsClient();

			// 폜ݒ
			objAssignments.setWhereMemberShipID( strMemberShipID );		// o[VbvID
			objAssignments.setWhereMaterialID( strMaterialID );			// }eAID

			// 폜\bhs
			if( !objAssignments.delete() ) {
				// 폜܂Ȃꍇ
				if( objAssignments.isErr() ) {
					// G[̏ꍇ
					request.setAttribute("message", "");
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", objAssignments.getURL());
					return mapping.findForward("error");
				}
				else {
					String strMessage =  objAssignments.getMessage();
					request.setAttribute("message", strMessage);
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", "");
					return mapping.findForward("error");
				}
			}
		}

	
		try {
			if( strTreeViewType.equals( "1" ) ) {
				//XVLof[^x[X擾B
				LoClient objLo = new LoClient();

				// ̐ݒ
				objLo.setWhereLoID( strLoID );
				if( !objLo.select() ) {
					// ܂Ȃꍇ
					if( objLo.isErr() ) {
						// G[̏ꍇ
						request.setAttribute("message", "");
						request.setAttribute("detail", "");
						request.setAttribute("close", "on");
						request.setAttribute("errorurl", objLo.getURL());
						return mapping.findForward("error");
					}
					else {
						String strMessage =  objLo.getMessage();
						request.setAttribute("message", strMessage);
						request.setAttribute("detail", "");
						request.setAttribute("close", "on");
						request.setAttribute("errorurl", "");
						return mapping.findForward("error");
					}
				}
				///////////////////////////////
				// XVLo̎擾
				///////////////////////////////
				String strLoTytle = "";
				String strLoType = "";
				if( objLo.next() ) {
					// ^Cg
					strLoTytle = objLo.getLoTytle();
					// kn^Cv
					strLoType = objLo.getLoType();
				}
				else {
					//Lo݂ȂꍇG[o͂
					String strMessage =  "LO݂܂B";
					request.setAttribute("message", strMessage);
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", "");
					return mapping.findForward("error");
				}

				StringBuffer strGetLine = new StringBuffer();
				String strIconName = "";
				String strIconGif = "";

				if(strLoType.equals("0") || strLoType.equals("1")) {
					strIconGif = "icon_lo_type_" + strLoType + "_h.gif";
					strIconName = ConstTree.TREE_GIF_ICON_PATH + strIconGif;
					strGetLine.append( "<table cellspacing=" + ConstTree.ICON_PITCH +" cellpadding=" + ConstTree.ICON_PITCH + " ><tr><td><IMG src='../../../image/xmo/Base/jpn/" );
					strGetLine.append( MethodAssignmentsConstants.IMG_SPACE_o );
					strGetLine.append( "'width=" + ConstTree.INDENT_ASSIGN_CONTAINER + " height=5></td><td><IMG src='" );
					strGetLine.append( strIconName );
					strGetLine.append( "' name='name/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "'onclick=\"getSubGroup('/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "', '" );
					strGetLine.append( strLoID );
					strGetLine.append( "'); return false\" class=\"hand\"></td><td ID='label/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "'><label onclick=\"select_name('" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "', '" );
					strGetLine.append( strLoID );
					strGetLine.append( "', '" );
					strGetLine.append( HtmlEscape.escapeSinglequoteYen(HtmlEscape.escape(strLoTytle)) );
					strGetLine.append( "');popupDocument('" );
					strGetLine.append( strLearnAuthority );
					strGetLine.append( "','");
					strGetLine.append( strManagementAuthority+"');\" class=\"hand\">" + ConstTree.ICON_SPACE);
					strGetLine.append( "<font size=\"" );
					strGetLine.append( ConstTree.DISPLAY_FONT_SIZE );
					strGetLine.append( "\">" );
					strGetLine.append( HtmlEscape.escape(strLoTytle) );
					strGetLine.append( "</font>" );
					strGetLine.append( "</label></td></tr></table><DIV id=/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "Child style=\"display:none\"></DIV>");
				} else {
					strIconGif = "icon_lo_type_" + strLoType + "_f.gif";
					strIconName = ConstTree.TREE_GIF_ICON_PATH + strIconGif;
					strGetLine.append( "<table cellspacing=" + ConstTree.ICON_PITCH + " cellpadding=" + ConstTree.ICON_PITCH + " ><tr><td><IMG src='../../../image/xmo/Base/jpn/" );
					strGetLine.append( MethodAssignmentsConstants.IMG_SPACE_o );
					strGetLine.append( "' width=" + ConstTree.INDENT_ASSIGN_CONTAINER + " height=5></td><td><IMG src='" );
					strGetLine.append( strIconName );
					strGetLine.append( "' name='name/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "'class=\"hand\"></td><td ID='label/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "'><label onclick=\"select_name('" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "', '" );
					strGetLine.append( strLoID );
					strGetLine.append( "', '" );
					strGetLine.append( HtmlEscape.escapeSinglequoteYen(HtmlEscape.escape(strLoTytle)) );
					strGetLine.append( "');popupDocument('" );
					strGetLine.append( strLearnAuthority );
					strGetLine.append( "','" );
					strGetLine.append( strManagementAuthority+"');\" class=\"hand\">" + ConstTree.ICON_SPACE);
					strGetLine.append( "<font size=\"" );
					strGetLine.append( ConstTree.DISPLAY_FONT_SIZE );
					strGetLine.append( "\">" );
					strGetLine.append( HtmlEscape.escape(strLoTytle) );
					strGetLine.append( "</font>" );
					strGetLine.append( "</label></td></tr></table><DIV id=/" );
					strGetLine.append( strParentLoID );
					strGetLine.append( "/" );
					strGetLine.append( strLoID );
					strGetLine.append( "Child ></DIV>");
				}

				request.setAttribute("strUpdateAction", strGetLine.toString());
			} else {
				if( strSelectID.substring( 0, 2 ).equals( "GR" ) ) {
					// XVO[vf[^x[X擾B
					GroupsClient objGroups = new GroupsClient();

					// ̐ݒ
					objGroups.setWhereGroupID( strSelectID );
					if( !objGroups.select() ) {
						// ܂Ȃꍇ
						if( objGroups.isErr() ) {
							// G[̏ꍇ
							request.setAttribute("message", "");
							request.setAttribute("detail", "");
							request.setAttribute("close", "on");
							request.setAttribute("errorurl", objGroups.getURL());
							return mapping.findForward("error");
						}
						else {
							String strMessage =  objGroups.getMessage();
							request.setAttribute("message", strMessage);
							request.setAttribute("detail", "");
							request.setAttribute("close", "on");
							request.setAttribute("errorurl", "");
							return mapping.findForward("error");
						}
					}
					///////////////////////////////
					// O[v̎擾
					///////////////////////////////
					String strGroupName = "";
					String strGroupType = "";
					if( objGroups.next() ) {
						// O[v
						strGroupName = objGroups.getGroupName();
						strGroupType = objGroups.getGroupType();
					}
					else {
						// O[v݂ȂꍇG[o͂
						String strMessage =  "O[v݂܂B";
						request.setAttribute("message", strMessage);
						request.setAttribute("detail", "");
						request.setAttribute("close", "on");
						request.setAttribute("errorurl", "");
						return mapping.findForward("error");
					}
					StringBuffer strGetLine = new StringBuffer();
					String strIconGif = "icon_group_type_" + strGroupType + ".gif";
					String strIconName = ConstTree.TREE_GIF_ICON_PATH + strIconGif;
					strGetLine.append( "<table cellspacing=" + ConstTree.ICON_PITCH + " cellpadding=" + ConstTree.ICON_PITCH + " ><tr><td><IMG src='../../../image/xmo/Base/jpn/" );
					strGetLine.append( MethodAssignmentsConstants.IMG_SPACE_o );
					strGetLine.append( "' width=" + ConstTree.INDENT_ASSIGN_CONTAINER + " height=5></td><td><IMG src='" );
					strGetLine.append( strIconName );
					strGetLine.append( "' name='name/" );
					strGetLine.append( strParentID );
					strGetLine.append( "/" );
					strGetLine.append( strSelectID );
					strGetLine.append( "'></td><td ID='label/" );
					strGetLine.append( strParentID );
					strGetLine.append( "/" );
					strGetLine.append( strSelectID );
					strGetLine.append( "'><label onclick=\"select_name('" );
					strGetLine.append( strParentID );
					strGetLine.append( "', '" );
					strGetLine.append( strSelectID );
					strGetLine.append( "', '" );
					strGetLine.append( HtmlEscape.escapeSinglequoteYen(HtmlEscape.escape(strGroupName)) );
					strGetLine.append( "');popupDocument('" );
					strGetLine.append( strLearnAuthority );
					strGetLine.append( "','" );
					strGetLine.append( strManagementAuthority+"');\">" + ConstTree.ICON_SPACE);
					strGetLine.append( "<font size=\"" );
					strGetLine.append( ConstTree.DISPLAY_FONT_SIZE );
					strGetLine.append( "\">" );
					strGetLine.append( HtmlEscape.escape(strGroupName) );
					strGetLine.append( "</font>" );
					strGetLine.append( "</label></td></tr></table><DIV id=/" );
					strGetLine.append( strParentID );
					strGetLine.append( "/" );
					strGetLine.append( strSelectID );
					strGetLine.append( "Child ></DIV>");
					
					request.setAttribute("strUpdateAction", strGetLine.toString());
				} else {
					// XV[Uf[^x[X擾B
					PeopleClient objPeople = new PeopleClient();

					// ̐ݒ
					objPeople.setWhereUserID( strSelectID );
					if( !objPeople.select() ) {
						// ܂Ȃꍇ
						if( objPeople.isErr() ) {
							// G[̏ꍇ
							request.setAttribute("message", "");
							request.setAttribute("detail", "");
							request.setAttribute("close", "on");
							request.setAttribute("errorurl", objPeople.getURL());
							return mapping.findForward("error");
						}
						else {
							String strMessage =  objPeople.getMessage();
							request.setAttribute("message", strMessage);
							request.setAttribute("detail", "");
							request.setAttribute("close", "on");
							request.setAttribute("errorurl", "");
							return mapping.findForward("error");
						}
					}
					///////////////////////////////
					// [U̎擾
					///////////////////////////////
					String strUserName = "";
					String strSex = "";
					String strUserType = "";
					if( objPeople.next() ) {
						// [U
						strUserName = objPeople.getUserName();
						strSex = objPeople.getSex();
						strUserType = objPeople.getUserType();
					}
					else {
						// [U݂ȂꍇG[o͂
						String strMessage =  "[U݂܂B";
						request.setAttribute("message", strMessage);
						request.setAttribute("detail", "");
						request.setAttribute("close", "on");
						request.setAttribute("errorurl", "");
						return mapping.findForward("error");
					}

					StringBuffer strGetLine = new StringBuffer();
					String strIconName = "";
					String strIconGif = "";

					if(strSex.equals("1")){
						strIconGif = MethodAssignmentsConstants.IMG_MAN_DISP + strUserType + ".gif";
						strIconName = ConstTree.TREE_GIF_ICON_PATH + strIconGif;
						strGetLine.append( "<table cellspacing=" + ConstTree.ICON_PITCH + " cellpadding=" + ConstTree.ICON_PITCH + " ><tr><td><IMG src='../../../image/xmo/Base/jpn/" );
						strGetLine.append( MethodAssignmentsConstants.IMG_SPACE_o );
						strGetLine.append( "' width=" + ConstTree.INDENT_ASSIGN_CONTAINER + " height=5></td><td><IMG src='" );
						strGetLine.append( strIconName );
						strGetLine.append( "' name='name/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "'></td><td ID='label/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "'><label onclick=\"select_name('" );
						strGetLine.append( strParentID );
						strGetLine.append( "', '" );
						strGetLine.append( strSelectID );
						strGetLine.append( "', '" );
						strGetLine.append( HtmlEscape.escapeSinglequoteYen(HtmlEscape.escape(strUserName)) );
						strGetLine.append( "');popupDocument('" );
						strGetLine.append( strLearnAuthority );
						strGetLine.append( "','" );
						strGetLine.append( strManagementAuthority );
						strGetLine.append( "');\">" + ConstTree.ICON_SPACE);
					strGetLine.append( "<font size=\"" );
					strGetLine.append( ConstTree.DISPLAY_FONT_SIZE );
					strGetLine.append( "\">" );
						strGetLine.append( HtmlEscape.escape(strUserName) );
					strGetLine.append( "</font>" );
						strGetLine.append( "</label></td></tr></table><DIV id=/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "Child ></DIV>");
					}
					else if(strSex.equals("2")){
						strIconGif = MethodAssignmentsConstants.IMG_WOMEN_DISP + strUserType + ".gif";
						strIconName = ConstTree.TREE_GIF_ICON_PATH + strIconGif;
						strGetLine.append( "<table cellspacing=" + ConstTree.ICON_PITCH + " cellpadding=" + ConstTree.ICON_PITCH + " ><tr><td><IMG src='../../../image/xmo/Base/jpn/" );
						strGetLine.append( MethodAssignmentsConstants.IMG_SPACE_o );
						strGetLine.append( "' width=" + ConstTree.INDENT_ASSIGN_CONTAINER + " height=5></td><td><IMG src='" );
						strGetLine.append( strIconName );
						strGetLine.append( "' name='name/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "'></td><td ID='label/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "'><label onclick=\"select_name('" );
						strGetLine.append( strParentID );
						strGetLine.append( "', '" );
						strGetLine.append( strSelectID );
						strGetLine.append( "', '" );
						strGetLine.append( HtmlEscape.escapeSinglequoteYen(HtmlEscape.escape(strUserName)) );
						strGetLine.append( "');popupDocument('" );
						strGetLine.append( strLearnAuthority );
						strGetLine.append( "','" );
						strGetLine.append( strManagementAuthority );
						strGetLine.append( "');\">" + ConstTree.ICON_SPACE);
						strGetLine.append( "<font size=\"" );
						strGetLine.append( ConstTree.DISPLAY_FONT_SIZE );
						strGetLine.append( "\">" );
						strGetLine.append( HtmlEscape.escape(strUserName) );
						strGetLine.append( "</font>" );
						strGetLine.append( "</label></td></tr></table><DIV id=/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "Child ></DIV>");
					}
					else if(strSex.equals("3")){
						strIconGif = MethodAssignmentsConstants.IMG_UNKNOWN_DISP + strUserType + ".gif";
						strIconName = ConstTree.TREE_GIF_ICON_PATH + strIconGif;
						strGetLine.append( "<table cellspacing=" + ConstTree.ICON_PITCH + " cellpadding=" + ConstTree.ICON_PITCH + " ><tr><td><IMG src='../../../image/xmo/Base/jpn/" );
						strGetLine.append( MethodAssignmentsConstants.IMG_SPACE_o );
						strGetLine.append( "' width=" + ConstTree.INDENT_ASSIGN_CONTAINER + " height=5></td><td><IMG src='" );
						strGetLine.append( strIconName );
						strGetLine.append( "' name='name/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "'></td><td ID='label/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "'><label onclick=\"select_name('" );
						strGetLine.append( strParentID );
						strGetLine.append( "', '" );
						strGetLine.append( strSelectID );
						strGetLine.append( "', '" );
						strGetLine.append( HtmlEscape.escapeSinglequoteYen(HtmlEscape.escape(strUserName)) );
						strGetLine.append( "');popupDocument('" );
						strGetLine.append( strLearnAuthority );
						strGetLine.append( "','" );
						strGetLine.append( strManagementAuthority );
						strGetLine.append( "');\">" + ConstTree.ICON_SPACE);
						strGetLine.append( "<font size=\"" );
						strGetLine.append( ConstTree.DISPLAY_FONT_SIZE );
						strGetLine.append( "\">" );
						strGetLine.append( HtmlEscape.escape(strUserName) );
						strGetLine.append( "</font>" );
						strGetLine.append( "</label></td></tr></table><DIV id=/" );
						strGetLine.append( strParentID );
						strGetLine.append( "/" );
						strGetLine.append( strSelectID );
						strGetLine.append( "Child ></DIV>");
					}
					
					request.setAttribute("strUpdateAction", strGetLine.toString());
				}
			}
			
			return mapping.findForward("success");
		}
		catch( Exception e ) {
			e.printStackTrace();
			request.setAttribute("message", "err");
			request.setAttribute("detail", e.getMessage());
			request.setAttribute("close", "on");
			request.setAttribute("errorurl", "");
			return mapping.findForward("error");
		}
		
	}
}
