reserve.java

来自「一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。」· Java 代码 · 共 1,098 行 · 第 1/3 页

JAVA
1,098
字号
				else
					page = new CreateReserve_day(hsInitData,hsPara,sessionUID.toString(),UM,conf);
				break;
			}
			buf = (String[])hsPara.get("make.x");		// 嶌惉
			if(buf!=null) {
				if( Integer.parseInt(gid) != -1 ) {
					page = new CreateReserve_value_new(hsInitData,hsPara);
					break;
				}
			}
			buf = (String[])hsPara.get("edit.x");		// 曇廤
			if(buf!=null) {
				if( Integer.parseInt(gid) != -1 ) {
					if( hsPara.get(RECmd.PA_PID) != null) {	 //
						pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];	 //
						if( Integer.parseInt(pid) != -1) {
							page = new CreateReserve_value_edit(hsInitData,hsPara);
							break;
						}
					}
				}
			}
			buf = (String[])hsPara.get("del.x");		// 嶍彍
			if(buf!=null) {
				if( Integer.parseInt(gid) != -1 ) {
					if( hsPara.get(RECmd.PA_PID) != null) {	 //
						pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];	 //
						if( Integer.parseInt(pid) != -1) {
							String msg =  "巤愝忣曬傪嶍彍偟傑偡丅傛傠偟偄偱偡偐丅";
							String title = "巤愝忣曬偺嶍彍";
							String IconName = "kakunin.gif";
							Para[] paras = new Para[7];
							paras[0] = new Para("action",url);
							paras[1] = new Para(RECmd.PA_CMD,Integer.toString(RECmd.RE_SHI_MAKE_DEL));
							paras[2] = new Para(RECmd.PA_DATE,(String)((String[])hsPara.get(RECmd.PA_DATE))[0] );
							paras[3] = new Para(RECmd.PA_HGRP,(String)((String[])hsPara.get(RECmd.PA_HGRP))[0] );
							paras[4] = new Para(RECmd.PA_GID,(String)((String[])hsPara.get(RECmd.PA_GID))[0] );
							paras[5] = new Para(RECmd.PA_PID,pid);
							paras[6] = new Para(RECmd.PA_MO2,(String)((String[])hsPara.get(RECmd.PA_MO2))[0] );
							CreateMsgPage mpage = new CreateMsgPage(CreateMsgPage.MB_YESNO,CreateMsgPage.ID_POST ,title,msg,paras,urlMap+IconName);
							mpage.write(req,res);
							return;
						}
					}
				}
			}
			page = new CreateReserve_shi_make(hsInitData,hsPara);
			break;


		case RECmd.RE_SHI_MAKE_DEL://巤愝忣曬愝掕 嶍彍
			if( hsPara.get("__submit.x") != null ) {
				gid = (String)((String[])hsPara.get(RECmd.PA_GID))[0];   //
				pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];   //
				REPlantFile pfile = new REPlantFile(dataDir,gid);
				pfile.Deluid( pid );
				pfile.Save();
				/* data/gid/pid/僼僅儖僟乕傪嶍彍 */
				String GrpDir = dataDir + "data" + File.separator + gid + File.separator + pid;
				File file = new File(GrpDir);
				GSTool.deleteDir(file);
			}
			page = new CreateReserve_shi_make(hsInitData,hsPara);
			break;


		case RECmd.RE_VAL_NEW://巤愝怴婯嶌惉
			buf = (String[])hsPara.get("edit.x");		// 嶌惉
			if(buf!=null) {
				gid = (String)((String[])hsPara.get(RECmd.PA_GID))[0];	 //
				messege = (String)((String[])hsPara.get("0"))[0];	 //
				if(messege.length() == 0) {
					nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_VAL_NEW_P
						+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
						+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
						+ "&" + RECmd.PA_MO2 + "=" + (String)((String[])hsPara.get(RECmd.PA_MO2))[0]
						+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
					CreateErrorPage epage = new CreateErrorPage("柤慜傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
					epage.write(req,res);
					return;
				}
				gfile = new REGpFile(dataDir);
				gdata = gfile.DataChk(gid);
				ifile = new REItemFile(dataDir,gid,0);
				REPlantFile pfile = new REPlantFile(dataDir,gid);
				pfile.Addmod( new REPlantData(gdata.GetPmax(),messege,"0"));
				REValueFile vfile = new REValueFile(dataDir,gid,gdata.GetPmax());
				for( int i = 0 ; i < ifile.size() ; i++ ) {
					REItemData idata = ifile.Getmod(i);				//
					messege = (String)((String[])hsPara.get(idata.GetId()))[0];	 //
					if( idata.GetIntIndis() == 0 ) {
						if( messege.length() == 0 ) {
							nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_VAL_NEW_P
								+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
								+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
								+ "&" + RECmd.PA_MO2 + "=" + (String)((String[])hsPara.get(RECmd.PA_MO2))[0]
								+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
							CreateErrorPage epage = new CreateErrorPage("昁廋崁栚傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
							epage.write(req,res);
							return;
						}
					}
					if(messege.length() == 0)
						messege = " " ;
					messege = cnv.ReturntoBR(messege);
					vfile.Addmod( new REValueData(idata.GetId(),messege));
				}
				pfile.Save();
				vfile.Save();
				gdata.SetPmax(gdata.GetIntPmax()+1);
				gfile.update(gdata);
				gfile.Save();
			}
			page = new CreateReserve_shi_make(hsInitData,hsPara);
			break;


		case RECmd.RE_VAL_NEW_P://巤愝怴婯嶌惉
			page = new CreateReserve_value_new(hsInitData,hsPara);
			break;


		case RECmd.RE_VAL_EDIT://巤愝怴婯曇廤
			buf = (String[])hsPara.get("edit.x");		// 曇廤
			if(buf!=null) {
				gid = (String)((String[])hsPara.get(RECmd.PA_GID))[0];	 //
				pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];	 //
				messege = (String)((String[])hsPara.get("0"))[0];	 //
				if(messege.length() == 0) {
					nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_VAL_EDIT_P
						+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
						+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
						+ "&" + RECmd.PA_MO2 + "=" + (String)((String[])hsPara.get(RECmd.PA_MO2))[0]
						+ "&" + RECmd.PA_PID + "=" + (String)((String[])hsPara.get(RECmd.PA_PID))[0]
						+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
					CreateErrorPage epage = new CreateErrorPage("柤慜傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
					epage.write(req,res);
					return;
				}
				ifile = new REItemFile(dataDir,gid,0);
				REPlantFile pfile = new REPlantFile(dataDir,gid);
				REPlantData pdata = pfile.DataChk(pid);
				pdata.SetName(messege);
				pfile.update(pdata);
				pfile.Save();
				REValueFile vfile = new REValueFile(dataDir,gid,pid);
				for( int i = 0 ; i < ifile.size() ; i++ ) {
					REItemData idata = ifile.Getmod(i);				//
					REValueData vdata = vfile.DataChk(idata.GetId());
					messege = (String)((String[])hsPara.get(idata.GetId()))[0];	 //
					if(idata.GetIntIndis() == 0 ) {
						if(messege.length() == 0) {
							nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_VAL_EDIT_P
								+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
								+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
								+ "&" + RECmd.PA_MO2 + "=" + (String)((String[])hsPara.get(RECmd.PA_MO2))[0]
								+ "&" + RECmd.PA_PID + "=" + (String)((String[])hsPara.get(RECmd.PA_PID))[0]
								+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
							CreateErrorPage epage = new CreateErrorPage("昁廋崁栚傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
							epage.write(req,res);
							return;
						}
					}
					if(messege.length() == 0)
						messege = " " ;
					messege = cnv.ReturntoBR(messege);
					if( vdata == null ) {
						vfile.Addmod( new REValueData(idata.GetId(),messege));
					}else{
						vdata.SetName(messege);
						vfile.update(vdata);
					}
				}
				vfile.Save();
			}
            buf = (String[])hsPara.get("cansel.x");       // cansel   //2001.2.20 ookubo add
            if(buf!=null) {
                gid = (String)((String[])hsPara.get(RECmd.PA_GID))[0];   //
                pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];   //
                ifile = new REItemFile(dataDir,gid,0);
                REPlantFile pfile = new REPlantFile(dataDir,gid);
                REPlantData pdata = pfile.DataChk(pid);
                REValueFile vfile = new REValueFile(dataDir,gid,pid);
                for( int i = 0 ; i < ifile.size() ; i++ ) {
                    REItemData idata = ifile.Getmod(i);             //
                    REValueData vdata = vfile.DataChk(idata.GetId());
                    messege = (String)((String[])hsPara.get(idata.GetId()))[0];  //
                    if(idata.GetIntIndis() == 0 ) {
                        if(messege.length() == 0) {
                            nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_VAL_EDIT_P
                                + "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
                                + "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
                                + "&" + RECmd.PA_MO2 + "=" + (String)((String[])hsPara.get(RECmd.PA_MO2))[0]
                                + "&" + RECmd.PA_PID + "=" + (String)((String[])hsPara.get(RECmd.PA_PID))[0]
                                + "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
                            CreateErrorPage epage = new CreateErrorPage("昁廋崁栚傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
                            epage.write(req,res);
                            return;
                        }
                    }
                }
            }

			page = new CreateReserve_shi_make(hsInitData,hsPara);
			break;


		case RECmd.RE_VAL_EDIT_P://巤愝怴婯嶌惉
			page = new CreateReserve_value_edit(hsInitData,hsPara);
			break;


		case RECmd.RE_INFO://巤愝忣曬
			page = new CreateReserve_infomation(hsInitData,hsPara);
			break;


		case RECmd.RE_REGISTER://巤愝梊栺搊榐
			page = new CreateReserve_register(hsInitData,hsPara,UM,sessionUID.toString(),conf);
			break;


		case RECmd.RE_REGISTER_P://巤愝梊栺搊榐
			buf = (String[])hsPara.get("make.x");	//愝掕
			if(buf!=null) {
				gid = (String)((String[])hsPara.get(RECmd.PA_GID))[0];	//
				pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];	//
				messege = (String)((String[])hsPara.get("object"))[0];	//
				if(messege.length() == 0)
					messege = " ";
				String style = (String)((String[])hsPara.get("note"))[0];	//
				if(style.length() == 0)
					style = " ";
				style = cnv.ReturntoBR(style);
				String styy = (String)((String[])hsPara.get("styy"))[0];	//
				String stmm = (String)((String[])hsPara.get("stmm"))[0];	//
				stmm  = GSTool.intDecFormat(Integer.parseInt(stmm),"00" );
				String stdd = (String)((String[])hsPara.get("stdd"))[0];	//
				stdd  = GSTool.intDecFormat(Integer.parseInt(stdd),"00" );
				String sthh = (String)((String[])hsPara.get("sthh"))[0];	//
				sthh  = GSTool.intDecFormat(Integer.parseInt(sthh),"00" );
				String sthm = (String)((String[])hsPara.get("sthm"))[0];	//
				String edyy = (String)((String[])hsPara.get("edyy"))[0];	//
				String edmm = (String)((String[])hsPara.get("edmm"))[0];	//
				edmm  = GSTool.intDecFormat(Integer.parseInt(edmm),"00" );
				String eddd = (String)((String[])hsPara.get("eddd"))[0];	//
				eddd  = GSTool.intDecFormat(Integer.parseInt(eddd),"00" );
				String edhh = (String)((String[])hsPara.get("edhh"))[0];	//
				edhh  = GSTool.intDecFormat(Integer.parseInt(edhh),"00" );
				String edhm = (String)((String[])hsPara.get("edhm"))[0];	//
				long st = Long.parseLong( styy + stmm + stdd + sthh + sthm );
				long ed =  Long.parseLong( edyy + edmm + eddd + edhh + edhm );
				if(st >= ed) {
					nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_REGISTER
						+ "&" + RECmd.PA_MOD + "=" + (String)((String[])hsPara.get(RECmd.PA_MOD))[0]
						+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
						+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
						+ "&" + RECmd.PA_PID + "=" + (String)((String[])hsPara.get(RECmd.PA_PID))[0]
						+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
					CreateErrorPage epage = new CreateErrorPage("斖埻偑堎忢偱偡丅",urlMap,nexturl);
					epage.write(req,res);
					return;
				}
//梊栺僨乕僞撉傒崬傒
				REReserveFile rfile = new REReserveFile(dataDir,gid,pid);
				for( int i3 = 0 ; i3 < rfile.size() ; i3++ )
				{
					REReserveData rdata = rfile.Getmod(i3);//柧嵶撉傒崬傒
					if( Long.parseLong( rdata.GetEnd() ) <= st ) {			   // 廔椆偑崱擔傛傝彫偝偄 懳徾奜
					} else if( Long.parseLong( rdata.GetStart() ) >= ed ) {	  // 奐巒偑崱擔傛傝戝偒偄 懳徾奜
					} else {
						nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_REGISTER
							+ "&" + RECmd.PA_MOD + "=" + (String)((String[])hsPara.get(RECmd.PA_MOD))[0]
							+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
							+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
							+ "&" + RECmd.PA_PID + "=" + (String)((String[])hsPara.get(RECmd.PA_PID))[0]
							+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
						CreateErrorPage epage = new CreateErrorPage("偡偱偵梊栺嵪偱偡丅",urlMap,nexturl);
						epage.write(req,res);
						return;
					}
				}
				pfile = new REPlantFile(dataDir,gid);
				pdata = pfile.DataChk(pid);
				rfile.Addmod( new REReserveData(pdata.GetIdx(),sessionUNAME,styy+stmm+stdd+sthh+sthm,edyy+edmm+eddd+edhh+edhm,messege,style,sessionUID.toString()));
				rfile.Save();
				pdata.SetIdx(pdata.GetIntIdx()+1);
				pfile.update(pdata);
				pfile.Save();
			}
			mode = (String)((String[])hsPara.get(RECmd.PA_MOD))[0];
			if( Integer.parseInt(mode) == 0 )
				page = new CreateReserve_week(hsInitData,hsPara,sessionUID.toString(),UM,conf,getHoliday(year));
			else
				page = new CreateReserve_day(hsInitData,hsPara,sessionUID.toString(),UM,conf);
			break;


		case RECmd.RE_CANSEL://巤愝梊栺庢徚
			page = new CreateReserve_cansel(hsInitData,hsPara,UM,sessionUID.toString(),conf);
			break;


		case RECmd.RE_CANSEL_P://巤愝梊栺庢徚
			buf = (String[])hsPara.get("del.x");	//愝掕
			if(buf!=null) {
// 2001.3.1 update start ookubo
    			gid = (String)((String[])hsPara.get(RECmd.PA_GID))[0];	//
	    		pid = (String)((String[])hsPara.get(RECmd.PA_PID))[0];	//
		    	rid = (String)((String[])hsPara.get(RECmd.PA_RID))[0];	//
			   	REReserveFile rfile = new REReserveFile(dataDir,gid,pid);
		        REReserveData rdata = rfile.DataChk(rid);
                if( UM.isSU(sessionUID.intValue()) == true || rdata.GetIntUid() == sessionUID.intValue() ) {
				    rfile.Del( rid );
				    rfile.Save();
// 2001.3.1 update end ookubo
                }else{
					nexturl = url + "?" + RECmd.PA_CMD + "=" + RECmd.RE_CANSEL
						+ "&" + RECmd.PA_MOD + "=" + (String)((String[])hsPara.get(RECmd.PA_MOD))[0]
						+ "&" + RECmd.PA_DATE + "=" + (String)((String[])hsPara.get(RECmd.PA_DATE))[0]
						+ "&" + RECmd.PA_HGRP + "=" + (String)((String[])hsPara.get(RECmd.PA_HGRP))[0]
						+ "&" + RECmd.PA_PID + "=" + (String)((String[])hsPara.get(RECmd.PA_PID))[0]
						+ "&" + RECmd.PA_RID + "=" + (String)((String[])hsPara.get(RECmd.PA_RID))[0]
						+ "&" + RECmd.PA_GID + "=" + (String)((String[])hsPara.get(RECmd.PA_GID))[0] ;
					CreateErrorPage epage = new CreateErrorPage("嶌惉幰媦傃娗棟幰埲奜偼嶍彍偱偒傑偣傫丅",urlMap,nexturl);
					epage.write(req,res);
					return;

                }
			}
			mode = (String)((String[])hsPara.get(RECmd.PA_MOD))[0];
			if( Integer.parseInt(mode) == 0 )
				page = new CreateReserve_week(hsInitData,hsPara,sessionUID.toString(),UM,conf,getHoliday(year));
			else
				page = new CreateReserve_day(hsInitData,hsPara,sessionUID.toString(),UM,conf);
			break;


		case RECmd.RE_SETTING://巤愝梊栺婎杮愝掕
			buf = (String[])hsPara.get("set.x");	//愝掕
			if(buf!=null) {
				String start = (String)((String[])hsPara.get(RECmd.PA_ST))[0];	 //
				String end = (String)((String[])hsPara.get(RECmd.PA_END))[0];	 //
				if( Integer.parseInt(start) < Integer.parseInt(end) ) {
					conf.SetStart(start);
					conf.SetEnd(end);
					conf.Save();
				}
			}
			mode = (String)((String[])hsPara.get(RECmd.PA_MO2))[0];	 //
			if( Integer.parseInt(mode) == 0 )
				page = new CreateReserve_week(hsInitData,hsPara,sessionUID.toString(),UM,conf,getHoliday(year));
			else
				page = new CreateReserve_day(hsInitData,hsPara,sessionUID.toString(),UM,conf);
			break;


		}

		if(page != null)
			page.write(req,res);
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?