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;
}