📄 new.php
字号:
<?php
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
if ( $PARENT_ID != "" && $PARENT_ID != "0" )
{
$query = "SELECT * from VOTE_TITLE where VOTE_ID=".$PARENT_ID;
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$TO_ID = $ROW['TO_ID'];
$PRIV_ID = $ROW['PRIV_ID'];
$COPY_TO_ID = $ROW['USER_ID'];
$TYPE = $ROW['TYPE'];
$MAX_NUM = $ROW['MAX_NUM'];
$ANONYMITY = $ROW['ANONYMITY'];
$VIEW_PRIV = $ROW['VIEW_PRIV'];
$BEGIN_DATE = $ROW['BEGIN_DATE'];
$END_DATE = $ROW['END_DATE'];
if ( $BEGIN_DATE == "0000-00-00" )
{
$BEGIN_DATE = "";
}
if ( $END_DATE == "0000-00-00" )
{
$END_DATE = "";
}
if ( $TO_ID == "ALL_DEPT" )
{
$TO_NAME = "全体部门";
}
else
{
$TO_NAME = "";
$TOK = strtok( $TO_ID, "," );
while ( $TOK != "" )
{
$query1 = "select * from DEPARTMENT where DEPT_ID=".$TOK;
$cursor1 = exequery( $connection, $query1 );
if ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$TO_NAME .= $ROW['DEPT_NAME'].",";
}
$TOK = strtok( "," );
}
}
$PRIV_NAME = "";
$query1 = "select * from USER_PRIV where find_in_set(USER_PRIV,'".$PRIV_ID."')";
$cursor1 = exequery( $connection, $query1 );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$PRIV_NAME .= $ROW['PRIV_NAME'].",";
}
$COPY_TO_NAME = "";
$query1 = "select * from USER where find_in_set(USER_ID,'".$COPY_TO_ID."')";
$cursor1 = exequery( $connection, $query1 );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$COPY_TO_NAME .= $ROW['USER_NAME'].",";
}
}
}
if ( $VOTE_ID != "" )
{
$query = "SELECT * from VOTE_TITLE where VOTE_ID=".$VOTE_ID;
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
$TO_ID = $ROW['TO_ID'];
$PARENT_ID = $ROW['PARENT_ID'];
$PRIV_ID = $ROW['PRIV_ID'];
$COPY_TO_ID = $ROW['USER_ID'];
$SUBJECT = $ROW['SUBJECT'];
$CONTENT = $ROW['CONTENT'];
$TYPE = $ROW['TYPE'];
$MAX_NUM = $ROW['MAX_NUM'];
$ANONYMITY = $ROW['ANONYMITY'];
$VIEW_PRIV = $ROW['VIEW_PRIV'];
$BEGIN_DATE = $ROW['BEGIN_DATE'];
$END_DATE = $ROW['END_DATE'];
$PUBLISH = $ROW['PUBLISH'];
if ( $BEGIN_DATE == "0000-00-00" )
{
$BEGIN_DATE = "";
}
if ( $END_DATE == "0000-00-00" )
{
$END_DATE = "";
}
if ( $TO_ID == "ALL_DEPT" )
{
$TO_NAME = "全体部门";
}
else
{
$TO_NAME = "";
$TOK = strtok( $TO_ID, "," );
while ( $TOK != "" )
{
$query1 = "select * from DEPARTMENT where DEPT_ID=".$TOK;
$cursor1 = exequery( $connection, $query1 );
if ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$TO_NAME .= $ROW['DEPT_NAME'].",";
}
$TOK = strtok( "," );
}
}
$PRIV_NAME = "";
$query1 = "select * from USER_PRIV where find_in_set(USER_PRIV,'".$PRIV_ID."')";
$cursor1 = exequery( $connection, $query1 );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$PRIV_NAME .= $ROW['PRIV_NAME'].",";
}
$COPY_TO_NAME = "";
$query1 = "select * from USER where find_in_set(USER_ID,'".$COPY_TO_ID."')";
$cursor1 = exequery( $connection, $query1 );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$COPY_TO_NAME .= $ROW['USER_NAME'].",";
}
}
}
echo "\r\n<html>\r\n<head>\r\n<title>投票管理</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n\r\n<script Language=\"JavaScript\">\r\nfunction CheckForm(flag)\r\n{\r\n";
if ( $PARENT_ID == "" || $PARENT_ID == "0" )
{
echo " if(document.form1.TO_ID.value==\"\" && document.form1.PRIV_ID.value==\"\" && document.form1.COPY_TO_ID.value==\"\")\r\n { alert(\"请至少指定一种发布范围!\");\r\n return (false);\r\n }\r\n";
}
echo " if(document.form1.SUBJECT.value==\"\")\r\n { alert(\"投票的标题不能为空!\");\r\n return (false);\r\n }\r\n \r\n document.form1.PUBLISH.value=flag;\r\n\r\n document.form1.submit();\r\n}\r\n\r\nfunction clear_dept()\r\n{\r\n document.form1.TO_NAME.value=\"\";\r\n document.form1.TO_ID.value=\"\";\r\n}\r\n\r\nfunction LoadWindow()\r\n{\r\n URL=\"/module/dept_select\";\r\n loc_x=document.body.scrollLeft+event.clientX-event.offsetX-100;\r\n loc_y=document.body.scrollTop+event.clientY-event.offsetY+170;\r\n window.showModalDialog(URL,self,\"edge:raised;scroll:1;status:0;help:0;resizable:1;dialogWidth:400px;dialogHeight:330px;dialogTop:\"+loc_y+\"px;dialogLeft:\"+loc_x+\"px\");\r\n}\r\n\r\nfunction td_calendar(fieldname)\r\n{\r\n myleft=document.body.scrollLeft+event.clientX-event.offsetX-80;\r\n mytop=document.body.scrollTop+event.clientY-event.offsetY+140;\r\n\r\n window.showModalDialog(\"/inc/calendar.php?FIELDNAME=\"+fieldname,self,\"edge:raised;scroll:0;status:0;help:0;resizable:1;dialogWidth:280px;dialogHeight:215px;dialogTop:\"+mytop+\"px;dialogLeft:\"+myleft+\"px\");\r\n}\r\n\r\nfunction change_type()\r\n{\r\n if(document.form1.TYPE.value==\"1\")\r\n document.getElementById(\"MAX_NUM_DESC\").style.display=\"\";\r\n else\r\n document.getElementById(\"MAX_NUM_DESC\").style.display=\"none\";\r\n}\r\n\r\nfunction clear_priv()\r\n{\r\n document.form1.PRIV_ID.value=\"\";\r\n document.form1.PRIV_NAME.value=\"\";\r\n}\r\n\r\nfunction LoadPrivWindow()\r\n{\r\n URL=\"/module/priv_select\";\r\n loc_x=document.body.scrollLeft+event.clientX-event.offsetX;\r\n loc_y=document.body.scrollTop+event.clientY-event.offsetY+200;\r\n window.showModalDialog(URL,self,\"edge:raised;scroll:1;status:0;help:0;resizable:1;dialogWidth:250px;dialogHeight:300px;dialogTop:\"+loc_y+\"px;dialogLeft:\"+loc_x+\"px\");\r\n}\r\n\r\nfunction clear_user2()\r\n{\r\n document.form1.COPY_TO_NAME.value=\"\";\r\n document.form1.COPY_TO_ID.value=\"\";\r\n}\r\n\r\nfunction LoadWindow2()\r\n{\r\n URL=\"/module/user_select?ID=2\";\r\n loc_x=document.body.scrollLeft+event.clientX-event.offsetX-100;\r\n loc_y=document.body.scrollTop+event.clientY-event.offsetY+170;\r\n //window.open(URL,\"read_notify\",\"height=400,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left=150,resizable=yes\");\r\n window.showModalDialog(URL,self,\"edge:raised;scroll:0;status:0;help:0;resizable:1;dialogWidth:350px;dialogHeight:350px;dialogTop:\"+loc_y+\"px;dialogLeft:\"+loc_x+\"px\");\r\n}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\" onload=\"javascript:form1.SUBJECT.focus();\">\r\n";
if ( $MAX_NUM == "" )
{
$MAX_NUM = 0;
}
echo "<table border=\"0\" width=\"90%\" cellspacing=\"0\" cellpadding=\"3\" class=\"small\">\r\n <tr>\r\n <td class=\"Big\"><img src=\"/images/notify_new.gif\" align=\"absmiddle\"><span class=\"big3\"> ";
if ( $VOTE_ID != "" )
{
echo "修改";
}
else
{
echo "新建";
}
echo "投票</span>\r\n </td>\r\n </tr>\r\n</table>\r\n\r\n<table border=\"0\" width=\"70%\" cellpadding=\"2\" cellspacing=\"1\" align=\"center\" bgcolor=\"#000000\" class=\"small\">\r\n <form enctype=\"multipart/form-data\" action=\"add.php\" method=\"post\" name=\"form1\">\r\n";
if ( $PARENT_ID == "" || $PARENT_ID == "0" )
{
echo " <tr>\r\n <td nowrap class=\"TableData\">发布范围(部门):</td>\r\n <td class=\"TableData\">\r\n <input type=\"hidden\" name=\"TO_ID\" value=\"";
echo $TO_ID;
echo "\">\r\n <textarea cols=40 name=\"TO_NAME\" rows=2 class=\"BigStatic\" wrap=\"yes\" readonly>";
echo $TO_NAME;
echo "</textarea>\r\n <input type=\"button\" value=\"添 加\" class=\"SmallButton\" onClick=\"LoadWindow()\" title=\"添加部门\" name=\"button\">\r\n <input type=\"button\" value=\"清 空\" class=\"SmallButton\" onClick=\"clear_dept()\" title=\"清空部门\" name=\"button\">\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\">发布范围(角色):</td>\r\n <td class=\"TableData\">\r\n <input type=\"hidden\" name=\"PRIV_ID\" value=\"";
echo $PRIV_ID;
echo "\">\r\n <textarea cols=40 name=\"PRIV_NAME\" rows=2 class=\"BigStatic\" wrap=\"yes\" readonly>";
echo $PRIV_NAME;
echo "</textarea>\r\n <input type=\"button\" value=\"选 择\" class=\"SmallButton\" onClick=\"LoadPrivWindow()\" title=\"选择角色\" name=\"button\">\r\n <input type=\"button\" value=\"清 空\" class=\"SmallButton\" onClick=\"clear_priv()\" title=\"清空角色\" name=\"button\">\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\">发布范围(人员):</td>\r\n <td class=\"TableData\">\r\n <input type=\"hidden\" name=\"COPY_TO_ID\" value=\"";
echo $COPY_TO_ID;
echo "\">\r\n <textarea cols=40 name=\"COPY_TO_NAME\" rows=2 class=\"BigStatic\" wrap=\"yes\" readonly>";
echo $COPY_TO_NAME;
echo "</textarea>\r\n <input type=\"button\" value=\"选 择\" class=\"SmallButton\" onClick=\"LoadWindow2()\" title=\"选择人员\" name=\"button\">\r\n <input type=\"button\" value=\"清 空\" class=\"SmallButton\" onClick=\"clear_user2()\" title=\"清空人员\" name=\"button\">\r\n </td>\r\n </tr>\r\n";
}
echo " <tr>\r\n <td nowrap class=\"TableData\"> 标题:</td>\r\n <td class=\"TableData\">\r\n <input type=\"text\" name=\"SUBJECT\" size=\"40\" maxlength=\"100\" class=\"BigInput\" value=\"";
echo $SUBJECT;
echo "\">\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\">投票描述:</td>\r\n <td class=\"TableData\">\r\n <textarea name=\"CONTENT\" class=\"BigInput\" cols=\"50\" rows=\"3\">";
echo $CONTENT;
echo "</textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\"> 类型:</td>\r\n <td class=\"TableData\">\r\n <select name=\"TYPE\" class=\"BigSelect\" onchange=\"change_type();\">\r\n <option value=\"0\" ";
if ( $TYPE == "0" )
{
echo "selected";
}
echo ">单选</option>\r\n <option value=\"1\" ";
if ( $TYPE == "1" )
{
echo "selected";
}
echo ">多选</option>\r\n <option value=\"2\" ";
if ( $TYPE == "2" )
{
echo "selected";
}
echo ">文本输入</option>\r\n </select>\r\n <span id=\"MAX_NUM_DESC\" style=\"display:";
if ( $TYPE != "1" )
{
echo "none";
}
echo "\"> 最多允许选择 <input type=\"input\" name=\"MAX_NUM\" value=\"";
echo $MAX_NUM;
echo "\" size=\"4\" class=\"SmallInput\"> 项,为0则不限制</span>\r\n </td>\r\n </tr>\r\n";
if ( $PARENT_ID == "" || $PARENT_ID == "0" )
{
echo " <tr>\r\n <td nowrap class=\"TableData\"> 查看投票结果:</td>\r\n <td class=\"TableData\">\r\n <select name=\"VIEW_PRIV\" class=\"BigSelect\">\r\n <option value=\"0\" ";
if ( $VIEW_PRIV == "0" )
{
echo "selected";
}
echo ">投票后允许查看</option>\r\n <option value=\"1\" ";
if ( $VIEW_PRIV == "1" )
{
echo "selected";
}
echo ">投票前允许查看</option>\r\n <option value=\"2\" ";
if ( $VIEW_PRIV == "2" )
{
echo "selected";
}
echo ">不允许查看</option>\r\n </select>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\"> 匿名投票:</td>\r\n <td class=\"TableData\">\r\n <input type=\"checkbox\" name=\"ANONYMITY\" id=\"ANONYMITY\" ";
if ( $ANONYMITY == "1" )
{
echo "checked";
}
echo "><label for=\"ANONYMITY\">允许匿名投票</label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\"> 有效期:</td>\r\n <td class=\"TableData\">\r\n 生效日期:<input type=\"text\" name=\"BEGIN_DATE\" size=\"10\" maxlength=\"10\" class=\"BigInput\" value=\"";
echo $BEGIN_DATE;
echo "\">\r\n <img src=\"/images/menu/calendar.gif\" border=\"0\" style=\"cursor:hand\" onclick=\"td_calendar('form1.BEGIN_DATE');\">\r\n 为空为立即生效<br>\r\n 终止日期:<input type=\"text\" name=\"END_DATE\" size=\"10\" maxlength=\"10\" class=\"BigInput\" value=\"";
echo $END_DATE;
echo "\">\r\n <img src=\"/images/menu/calendar.gif\" border=\"0\" style=\"cursor:hand\" onclick=\"td_calendar('form1.END_DATE');\">\r\n 为空为手动终止\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\"> 短消息提醒:</td>\r\n <td class=\"TableData\">\r\n";
echo sms_remind( 11 );
echo " </td>\r\n </tr>\r\n";
}
echo " <tr align=\"center\" class=\"TableControl\">\r\n <td colspan=\"2\" nowrap>\r\n <input type=\"hidden\" name=\"VOTE_ID\" value=\"";
echo $VOTE_ID;
echo "\">\r\n <input type=\"hidden\" name=\"CUR_PAGE\" value=\"";
echo $CUR_PAGE;
echo "\">\r\n <input type=\"hidden\" name=\"PARENT_ID\" value=\"";
echo $PARENT_ID;
echo "\">\r\n <input type=\"hidden\" name=\"PUBLISH\" value=\"";
echo $PUBLISH;
echo "\">\r\n";
if ( $VOTE_ID != "" && ( $PARENT_ID == "" || $PARENT_ID == "0" ) )
{
echo " <input type=\"button\" value=\"发布\" class=\"BigButton\" onclick=\"CheckForm('1');\"> \r\n";
}
echo " <input type=\"button\" value=\"保存\" class=\"BigButton\" onclick=\"CheckForm('0');\"> \r\n <input type=\"reset\" value=\"重填\" class=\"BigButton\"> \r\n";
if ( $VOTE_ID != "" && ( $PARENT_ID == "" || $PARENT_ID == "0" ) )
{
echo " <input type=\"button\" value=\"返回\" class=\"BigButton\" onclick=\"location='index1.php?CUR_PAGE=";
echo $CUR_PAGE;
echo "'\">\r\n";
}
if ( $PARENT_ID != "" && $PARENT_ID != "0" )
{
echo " <input type=\"button\" value=\"返回\" class=\"BigButton\" onclick=\"location='vote.php?PARENT_ID=";
echo $PARENT_ID;
echo "&CUR_PAGE=";
echo $CUR_PAGE;
echo "'\">\r\n";
}
echo " </td>\r\n </tr>\r\n </table>\r\n</form>\r\n\r\n</body>\r\n</html>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -