我的空间,写我所写,禅我所藏

与我一起遨游吧

 

通过数据库的设置字段,对流程中的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 阅读(718) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿(2)

随笔分类

随笔档案

文章档案

搜索

最新评论

阅读排行榜

评论排行榜