createholiday_temp_edit.java
来自「一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。」· Java 代码 · 共 426 行 · 第 1/2 页
JAVA
426 行
package jp.co.sjts.gsession.main;
/**
* 僥儞僾儗乕僩曇廤 CreateHoliday_Temp_Edit.java
* Copyright (C) 2000-2001 Japan Total System Co,LTD
* Junichi K <kaneuchi@sjts.co.jp>
*/
import java.io.File;
import java.util.Hashtable;
import java.util.Map;
import java.util.List;
import java.util.Iterator;
import java.util.Vector;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jp.co.sjts.gsession.tools.*;
public class CreateHoliday_Temp_Edit extends CreatePage {
private final String title = "僥儞僾儗乕僩曇廤";
private final String bgcolor = "#ffffff";
private final String text = "#000000";
private final String link = "#0000ff";
private final String alink = "#ff0000";
private final String vlink = "#0000ff";
private String urlMap;
private File dataDir;
private Hashtable hsPara;
private UserManager userManager;
private String helpURL;
private String year;
private int page;
public CreateHoliday_Temp_Edit(Hashtable hsPara,String year,String page,File dataDir,String urlMap,String helpURL) {
this.urlMap = urlMap;
this.dataDir = dataDir;
this.hsPara = hsPara;
this.helpURL = helpURL;
this.year = year;
this.page = Integer.parseInt(page);
}
protected boolean writePage(HttpServletRequest req,HttpServletResponse res) throws GSException {
String url = GSTool.removeParaFormURI(req.getRequestURI());
HttpSession session = req.getSession(false);
Integer sessionUID = (Integer)session.getAttribute(GSBase.SESSION_PARA_UID);
GSDate date = new GSDate();
String md = (hsPara.get(GSCmd.GS_PARA_MD) != null)?
((String[])hsPara.get(GSCmd.GS_PARA_MD))[0]:"0101";
if( Integer.parseInt(md.substring(2)) > 40 ) {
HolidayTempData tempdata = new HolidayTempData(md,"","0",year);
if(tempdata.getFlg() != -1)
date.setYMD(year + tempdata.getDate() );
else
date.setYMD(year+md.substring(0,2)+"01");
}
else
date.setYMD(year + md);
HolidayTemp holidaytemp = new HolidayTemp(dataDir,year);
String[] buf,buf2;
String month = null;
String day = null;
String week = null;
String week2 = null;
String title = "";
String substitute = "0";
int imonth = 0;
int iday = 0;
int iweek = 0;
//僷儔儊乕僞庢摼
if((buf = (String[])hsPara.get("month")) != null) {
month = buf[0];
imonth = Integer.parseInt(month);
}
if((buf = (String[])hsPara.get("day")) != null) {
day = buf[0];
iday = Integer.parseInt(day);
}
if((buf = (String[])hsPara.get("week")) != null)
week = buf[0];
if((buf = (String[])hsPara.get("week2")) != null)
week2 = buf[0];
if((buf = (String[])hsPara.get("NAME")) != null)
title = buf[0];
if(hsPara.get(GSCmd.GS_PARA_SUBSTITUTE) != null)
substitute = "1";
if((week != null) && (week2 != null)) {
if((Integer.parseInt(week) <0) && (Integer.parseInt(week2) < 0))
iweek = -1;
else
iweek = Integer.parseInt(week + week2);
}
//媥擔僥儞僾儗乕僩捛壛丄曄峏
if(month != null) {
//捛壛
if( hsPara.get(GSCmd.GS_PARA_ADDX) != null) {
if((imonth < 0) || (iday < 0) || (iweek < 0)) {
String nexturl = url
+"?"+GSCmd.GS_PARA_CMD+"="+GSCmd.GS_HDAY
+"&"+GSCmd.GS_PARA_SUBCMD+"="+GSCmd.SUB_HDAY_TMPEDIT
+"&"+GSCmd.GS_PARA_DATE+"="+date.getstrYear()
+"&"+GSCmd.GS_PARA_BACKPAGE+"="+Integer.toString(page);
String errmsg = "晄惓側擔晅偱偡丅";
CreateErrorPage epage = new CreateErrorPage(errmsg,urlMap,nexturl);
epage.write(req,res);
return false;
}
//擔晅偱捛壛
if(day != null) {
if(holidaytemp.isHoliday(imonth,iday)){
String nexturl = url
+"?"+GSCmd.GS_PARA_CMD+"="+GSCmd.GS_HDAY
+"&"+GSCmd.GS_PARA_SUBCMD+"="+GSCmd.SUB_HDAY_TMPEDIT
+"&"+GSCmd.GS_PARA_DATE+"="+date.getstrYear();
CreateErrorPage epage = new CreateErrorPage("偡偱偵擖椡偝傟偰偄傑偡丅",urlMap,nexturl);
epage.write(req,res);
return false;
}
//晄惓僠僃僢僋
GSDate chkdate = new GSDate();
chkdate.setYMD(date.getYear(),imonth,1);
int maxDay = chkdate.getMaxDayOfMonth();
if(imonth == 2)
maxDay = 29;
if(maxDay < iday){
String nexturl = url
+"?"+GSCmd.GS_PARA_CMD+"="+GSCmd.GS_HDAY
+"&"+GSCmd.GS_PARA_SUBCMD+"="+GSCmd.SUB_HDAY_TMPEDIT
+"&"+GSCmd.GS_PARA_DATE+"="+date.getstrYear()
+"&"+GSCmd.GS_PARA_BACKPAGE+"="+Integer.toString(page);
String errmsg = "晄惓側擔晅偱偡丅";
CreateErrorPage epage = new CreateErrorPage(errmsg,urlMap,nexturl);
epage.write(req,res);
return false;
}
holidaytemp.addHoliday(imonth,iday,title,substitute,date.getstrYear());
holidaytemp.Save();
}
//奼挘巜掕偱捛壛
if((week != null) && (week2 != null)) {
if(holidaytemp.isHoliday(imonth,iweek)) {
String nexturl = url
+"?"+GSCmd.GS_PARA_CMD+"="+GSCmd.GS_HDAY
+"&"+GSCmd.GS_PARA_SUBCMD+"="+GSCmd.SUB_HDAY_TMPEDIT
+"&"+GSCmd.GS_PARA_DATE+"="+date.getstrYear();
CreateErrorPage epage = new CreateErrorPage("偡偱偵擖椡偝傟偰偄傑偡丅",urlMap,nexturl);
epage.write(req,res);
return false;
}
holidaytemp.addHoliday(imonth,iweek,title,substitute,date.getstrYear());
holidaytemp.Save();
}
}
//曄峏
if((hsPara.get(GSCmd.GS_PARA_MD) != null) && (hsPara.get(GSCmd.GS_PARA_CHGX) != null)) {
if((imonth < 0) || (iday < 0) || (iweek < 0)){
String nexturl = url
+"?"+GSCmd.GS_PARA_CMD+"="+GSCmd.GS_HDAY
+"&"+GSCmd.GS_PARA_SUBCMD+"="+GSCmd.SUB_HDAY_TMPEDIT
+"&"+GSCmd.GS_PARA_DATE+"="+date.getstrYear()
+"&"+GSCmd.GS_PARA_BACKPAGE+"="+Integer.toString(page);
String errmsg = "晄惓側擔晅偱偡丅";
CreateErrorPage epage = new CreateErrorPage(errmsg,urlMap,nexturl);
epage.write(req,res);
return false;
}
//擔晅偱曄峏
if(day != null) {
if(holidaytemp.isHoliday(imonth,iday)) {
GSDate gsDate = new GSDate();
gsDate.setYMD(date.getYear(),imonth,iday);
if(Integer.parseInt(date.getstrMonth()+date.getstrDay())
!= Integer.parseInt(gsDate.getstrMonth()+gsDate.getstrDay())){
String nexturl = url
+"?"+GSCmd.GS_PARA_CMD+"="+GSCmd.GS_HDAY
+"&"+GSCmd.GS_PARA_SUBCMD+"="+GSCmd.SUB_HDAY_TMPCHG
+"&"+GSCmd.GS_PARA_DATE+"="+date.getstrYear();
CreateErrorPage epage = new CreateErrorPage("偡偱偵擖椡偝傟偰偄傑偡丅",urlMap,nexturl);
epage.write(req,res);
return false;
}
}
//晄惓僠僃僢僋
GSDate chkdate = new GSDate();
chkdate.setYMD(date.getYear(),imonth,1);
int maxDay = chkdate.getMaxDayOfMonth();
if(imonth == 2)
maxDay = 29;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?