我的空間,寫我所寫,禪我所藏

          與我一起遨游吧

           

          通過數據庫的設置字段,對流程中的jsp控件進行權限顯示控制,最終以javascript串返回頁面實現

             public static String limitControls(String procdefId,String activityId,String url)throws WfException{
              Connection con = DbConnectionManager.getInstance().getConnection(
                         poolName);
             Statement st = null;
             String value="";
            try {
                 st = con.createStatement();
                 String iSql = "";
                 ///
                 if(activityId!=null&&!"null".equals(activityId)){
                 iSql = "select distinct a.controltype,a.controlname,a.viewtype,c.formname from activitycontrollimits a,activitycontrol c,ASSIGNMENTEVENTAUDITS b where a.limitno=c.limitno and c.actdefid=b.activitydefinitionid and b.ACTIVITYID='"+activityId+"' and url='"+url+"'" ;
                 
                 }
                 ///進去發起頁面 activityid is null
                 else
                 iSql = "select distinct a.controltype,a.controlname,a.viewtype,c.formname from activitycontrollimits a,activitycontrol c where a.limitno=c.limitno and procdefid='"+procdefId+"' and actdefid='null' and url='"+url+"'" ;
                 System.out.println(iSql);
                 ResultSet rs = st.executeQuery(iSql);
                
                 while (rs.next()) {
                  int cType = rs.getInt(3);
                  switch(cType){
                  case 0:value = value+"document.all['"+rs.getString(2)+"'].disabled=true;";
                         break;
                  case 1:
                   if(rs.getInt(1)==3)
                    value = value="self.location='commons/noallow.jsp'";
                   else
                   value = value+"document.all['"+rs.getString(2)+"'].style.display='none';";
                         break;
                  //case 2:value=  value+"document.all['"+rs.getString(2)+"'].style.display='block';";
                        // break;
               
                  default:
                     value = value+"document.all['"+rs.getString(2)+"'].disabled=false;";
                     break;
                  }
                 }
                // if(value.trim().length()==0)
                //  value="self.location='/commons/noallow.jsp'";
               } catch (Exception e) {
                e.printStackTrace();
                 throw new WfException(ErrorInfo.EXT_PROC_MANAGER_ERROR,"生成校驗串失敗!",
                           ErrorInfo.getTrace(e, e.getStackTrace()));
                }    finally {
                  DbConnectionManager.getInstance().freeConnection(poolName, con);
              }
                value= "<script language='javascript'>"+value;
                value = value+"</script>";
              return value; 
             }

          posted on 2007-06-25 15:43 imcb 閱讀(754) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 临邑县| 东宁县| 遂溪县| 宾川县| 金溪县| 南丰县| 营山县| 定西市| 临沂市| 乐陵市| 兴宁市| 乳山市| 舞钢市| 嫩江县| 高平市| 屏边| 白河县| 军事| 元谋县| 九龙县| 铜陵市| 吉木萨尔县| 岳西县| 大洼县| 宣威市| 如东县| 张掖市| 芦山县| 和林格尔县| 平谷区| 陆良县| 阳城县| 黎川县| 雷山县| 泽普县| 甘南县| 阿城市| 盘锦市| 滁州市| 秭归县| 双牌县|