⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bulletin.java

📁 一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
//				String url = GSTool.removeParaFormURI(req.getRequestURI());			// 2001.2.28 del ookubo
				String nexturl = url + "?" + BLCmd.PA_CMD + "=" + BLCmd.BL_OPINION
					+ "&" + BLCmd.PA_PAG + "=" + (String)((String[])hsPara.get(BLCmd.PA_PAG))[0]
					+ "&" + BLCmd.PA_LIM + "=" + (String)((String[])hsPara.get(BLCmd.PA_LIM))[0]
					+ "&" + BLCmd.PA_GID + "=" + (String)((String[])hsPara.get(BLCmd.PA_GID))[0]
					+ "&" + BLCmd.PA_BID + "=" + (String)((String[])hsPara.get(BLCmd.PA_BID))[0]
					+ "&" + BLCmd.PA_BLV + "=" + (String)((String[])hsPara.get(BLCmd.PA_BLV))[0] ;
				CreateErrorPage epage = new CreateErrorPage("僞僀僩儖傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
				epage.write(req,res);
				return;
			}
			if(taitol.length() == 0)
				taitol = "null";
			taitol = cnv.ReturntoBR(taitol);
			messege = (String)((String[])hsPara.get("messege"))[0];
			if(messege.length() == 0)
				messege = " ";
            messege = cnv.ReturntoBR(cnv.safetyHTML(messege));
            
            
            byte[] content = new byte[0];
            try{
				Hashtable hash = (Hashtable)hsPara.get("tmpfile");
				tmpfile = (String)hash.get("filename");
				tmptype = (String)hash.get("content-type");
				content = (byte[])hash.get("content");
				if(tmpfile.length() == 0) {
					tmpfile = " ";
					tmptype = " ";
				}            
            } catch( ClassCastException e) {
            	tmpfile = " ";
                tmptype = " ";
            }
            
            
			tmpfile = GSTool.Lastname(tmpfile);
			limit = (String)((String[])hsPara.get("limit"))[0];
			cal.ResetTime();
			timestamp = cal.getstrYear() + cal.getstrMonth() + cal.getstrDate() + cal.getstrHour() + cal.getstrMinute() + cal.getstrSecond();
			if(content.length == 0) {
				tmpfile = " ";
				tmptype = " ";
			}
			bldata.BLData(entuserid,sessionUNAME,taitol,messege,limit,timestamp,tmpfile,tmptype);
			bldata.Save();
			if(content.length != 0) {
				bldata.setContent(content);
			}

			String level = (String)((String[])hsPara.get("blv"))[0];
			level = Integer.toString(Integer.parseInt( level ) + 1);
			blindex.Addmod((String)((String[])hsPara.get("bid"))[0],new BLIndexData(conf.GetStrBullMax(),level ,(String)((String[])hsPara.get("bid"))[0],limit));
			blindex.Save();

			conf.SetBulletinMax(conf.GetBulletinMax()+1);
			conf.Save();

			page = new Createbulletin_body(hsInitData,hsPara,blindex,intpage,uconf.GetDispcntMax(),sessionUID.intValue(),UM);
			break;


		case BLCmd.BL_DISP:// 堄尒昞帵
            if(newCheck(sessionUID.intValue(),req,res,url,Integer.parseInt( selectgrp ),UM)) return;	//2001.2.28 add ookubo
			page = new Createbulletin_disp(hsInitData,hsPara,intpage);
			break;


		case BLCmd.BL_D_CAN:// 堄尒昞帵 栠傞丄曇廤丄嶍彍僠僃僢僋 2002.04.24 update by a.matsubara
        	if(newCheck(sessionUID.intValue(),req,res,url,Integer.parseInt( selectgrp ),UM)) return;	//2001.2.28 add ookubo
            
            buf = (String[])hsPara.get("sakujo.x");
            if(buf!=null) {
            	String[] fmbox = (String[])hsPara.get("cbox");
                String[] tobox;
                if(fmbox==null) {
                	tobox = new String[]{(String)((String[])hsPara.get(BLCmd.PA_BID))[0]};
                } else {
                	tobox = new String[fmbox.length+1];
                    for(int i=0; i<fmbox.length; i++)
                    	tobox[i] = fmbox[i];
                    tobox[fmbox.length] = (String)((String[])hsPara.get(BLCmd.PA_BID))[0];
                }
                hsPara.remove("cbox");
                hsPara.put("cbox",tobox);
            }
            buf = (String[])hsPara.get("hensyu.x");
            if(buf!=null) {
            	page = new Createbulletin_edit_ad(hsInitData,hsPara,intpage);
                break;
            }
            
			page = new Createbulletin_body_ad(hsInitData,hsPara,blindex,intpage,uconf.GetDispcntMax(),sessionUID.intValue(),UM);
			break;


		case BLCmd.BL_P_TEXT:// 堄尒昞帵乮億僢僾傾僢僾梡乯
            if(newCheck(sessionUID.intValue(),req,res,url,Integer.parseInt( selectgrp ),UM)) return;	//2001.2.28 add ookubo
			page = new Createbulletin_p_text(hsInitData,hsPara,0,getMainURL());
			break;
        
        
        case BLCmd.BL_E_SET: // 曇廤撪梕妋掕            2002.04.22 add by a.matsubara
        	if(newCheck(sessionUID.intValue(),req,res,url,Integer.parseInt(selectgrp),UM)) return;
            
            buf = (String[])hsPara.get("henkou.x");
            if(buf!=null) {
            	if(!updateBLData(req,res,url,urlMap,hsPara))
                	return;
            }
            
            page = new Createbulletin_text(hsInitData,hsPara,intpage,sessionUID.intValue());
            break;
        
        
        case BLCmd.BL_A_E_SET: // 曇廤撪梕妋掕乮娗棟幰乯2002.04.22 add by a.matsubara
        	if(newCheck(sessionUID.intValue(),req,res,url,Integer.parseInt(selectgrp),UM)) return;
            
            buf = (String[])hsPara.get("henkou.x");
            if(buf!=null) {
            	if(!updateBLData(req,res,url,urlMap,hsPara))
                	return;
            }
            
            page = new Createbulletin_disp(hsInitData,hsPara,intpage);
            break;
		}
        
		if(page != null)
			page.write(req,res);
	}


    // 2002.04.24 add by a.matsubara
    /**
     * 宖帵斅曇廤撪梕搊榐張棟
     *
     * @param	req		儕僋僄僗僩
     * @param	res		儗僗億儞僗
     * @param	urlMap	image僨傿儗僋僩儕
     * @param	hsPara	僷儔儊乕僞奿擺僴僢僔儏僥乕僽儖
     * @return			張棟偺壜斲
     */
    private boolean updateBLData(HttpServletRequest req,HttpServletResponse res,String url,String urlMap,Hashtable hsPara) throws GSException {
    	BLDataFile bldata = new BLDataFile();
        if(bldata.Getb((String)hsInitData.get(BLCmd.BL_DIR),
        			   (String)((String[])hsPara.get(BLCmd.PA_GID))[0],
                       (String)((String[])hsPara.get(BLCmd.PA_BID))[0]) == false) {
        	String nexturl = url + "?" + BLCmd.PA_CMD + "=" + BLCmd.BL_BULL
            					 + "&" + BLCmd.PA_GID + "=" + (String)((String[])hsPara.get(BLCmd.PA_GID))[0]
                                 + "&" + BLCmd.PA_PAG + "=" + (String)((String[])hsPara.get(BLCmd.PA_PAG))[0];
            CreateErrorPage epage = new CreateErrorPage("僨乕僞偼偡偱偵嶍彍偝傟偰偄傑偡丅",urlMap,nexturl);
            epage.write(req,res);
            return false;
        }
        
        bldata.Lock();
        
        // 僞僀僩儖
        String taitol = (String)((String[])hsPara.get("taitol"))[0];
        if(taitol.length() == 0) {
        	String nexturl = url + "?" + BLCmd.PA_CMD + "=" + BLCmd.BL_EDIT
            					 + "&" + BLCmd.PA_PAG + "=" + (String)((String[])hsPara.get(BLCmd.PA_PAG))[0]
                                 + "&" + BLCmd.PA_GID + "=" + (String)((String[])hsPara.get(BLCmd.PA_GID))[0]
                                 + "&" + BLCmd.PA_BID + "=" + (String)((String[])hsPara.get(BLCmd.PA_BID))[0];
            CreateErrorPage epage = new CreateErrorPage("僞僀僩儖傪擖椡偟偰偔偩偝偄丅",urlMap,nexturl);
            epage.write(req,res);
            return false;
        }
        taitol = cnv.ReturntoBR(taitol);
        bldata.setTaitol(taitol);
        
        // 杮暥
        String messege = (String)((String[])hsPara.get("messege"))[0];
        if(messege.length() == 0)
        	messege = " ";
        messege = cnv.ReturntoBR(cnv.safetyHTML(messege));
        bldata.setMessege(messege);
        
        // 揧晅
        byte[] content = new byte[0];
        try{
        	Hashtable hash = (Hashtable)hsPara.get("tmpfile");
            String tmpfile = (String)hash.get("filename");
            String tmptype = (String)hash.get("content-type");
            content = (byte[])hash.get("content");
            if(tmpfile.length() != 0 && content.length != 0) {
            	tmpfile = GSTool.Lastname(tmpfile);
                bldata.setTmpfile(tmpfile);
                bldata.setTmptype(tmptype);
                bldata.setContent(content);
            }
        } catch( ClassCastException e) {
        }
        
        bldata.Save();
        bldata.Unlock();
        
        return true;
    }


	/** 
	 * <p>怴婯嶌惉僙僉儏儕僥僀乕
	 *
	 * @param uid    儐乕僓ID
	 * @param req    儕僋僄僗僩
	 * @param res    儗僗億儞僗
	 * @param url    url
	 * @param gid    僌儖乕僾ID
	 * @param UM     儐乕僓儅僱乕僕儍乕
	 */
    private boolean newCheck(int uid,HttpServletRequest req,HttpServletResponse res,String url,int gid,IUserManager UM)
        throws GSException{
        CreateErrorPage page = null;
        if(uid<0)
            throw new GSException("儐乕僓ID偑晄惓偱偡丅");

        String nexturl = url + "?" + BLCmd.PA_CMD + "=" + BLCmd.BL_BULLITEN + "&" + BLCmd.PA_PAG + "=0&" + BLCmd.PA_GID + "=0" ;

		if( gid == 0 ) {									//嫟捠宖帵斅
                return false;
		}else{
            if( UM.isSU(uid) ) {                            //admin
                return false;
            }else{
        		int[] ga = UM.getGidArray(uid);				//強懏僌儖乕僾庢摼
	            for(int i = 0 ; i < ga.length ; i++) {		//
                	if( gid == ga[i] ) {					//懳徾僌儖乕僾
                		return false;
                	}
            	}
                page = new CreateErrorPage("強懏僌儖乕僾偱偼偁傝傑偣傫丅",getMapURL(),nexturl);
            }
		}

        try{
            page.write(req,res);
        }catch(GSException e){
        }

        return true;
    }

    /** 
	 * <p>嶍彍僙僉儏儕僥僀乕
	 *
	 * @param uid    儐乕僓ID
	 * @param req    儕僋僄僗僩
	 * @param res    儗僗億儞僗
	 * @param url    URL
	 * @param gid    僌儖乕僾ID
	 * @param UM     儐乕僓儅僱乕僕儍乕
	 */
    private boolean delCheck(int uid,HttpServletRequest req,HttpServletResponse res,String url,int gid,IUserManager UM)
        throws GSException{

        CreateErrorPage page = null; 
        if(uid<0)
            throw new GSException("儐乕僓ID偑晄惓偱偡丅");

        String nexturl = url + "?" + BLCmd.PA_CMD + "=" + BLCmd.BL_BULLITEN + "&" + BLCmd.PA_PAG + "=0&" + BLCmd.PA_GID + "=0" ;

        if( UM.isSU(uid) ) {                 //admin
            return false;
        }else{
            if( UM.isGroupAdmin(gid,uid) ) { //強懏僌儖乕僾庢摼
                    return false;
            }else{
            	page = new CreateErrorPage("尃尷偑偁傝傑偣傫丅",getMapURL(),nexturl);
			}
        }

        try{
            page.write(req,res);
        }catch(GSException e){
        }

        return true;
    }

}

⌨️ 快捷键说明

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