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

          與我一起遨游吧

           

          通過數據庫的設置字段,對流程中的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 閱讀(749) 評論(0)  編輯  收藏


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


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 巴马| 黄浦区| 兴安盟| 济阳县| 桃园市| 巩义市| 黄大仙区| 乐平市| 定陶县| 屏山县| 札达县| 河北区| 会宁县| 观塘区| 富宁县| 平罗县| 湛江市| 景德镇市| 丰镇市| 遵义市| 哈尔滨市| 安国市| 荔浦县| 汽车| 陆川县| 丰宁| 禹州市| 昂仁县| 山西省| 合川市| 都匀市| 北辰区| 根河市| 德州市| 礼泉县| 合川市| 浦县| 平顶山市| 浦城县| 章丘市| 运城市|