📄 new.php
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
?>
<html>
<head>
<title>投票管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language="JavaScript">
function CheckForm()
{
if(document.form1.TO_ID.value=="")
{ alert("请指定发布范围!");
return (false);
}
if(document.form1.SUBJECT.value=="")
{ alert("投票的标题不能为空!");
return (false);
}
document.form1.submit();
}
function clear_dept()
{
document.form1.TO_NAME.value="";
document.form1.TO_ID.value="";
}
function LoadWindow()
{
URL="/module/dept_select";
loc_x=document.body.scrollLeft+event.clientX-event.offsetX-100;
loc_y=document.body.scrollTop+event.clientY-event.offsetY+170;
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");
}
function td_calendar(fieldname)
{
myleft=document.body.scrollLeft+event.clientX-event.offsetX-80;
mytop=document.body.scrollTop+event.clientY-event.offsetY+140;
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");
}
function change_type()
{
if(document.form1.TYPE.value=="1")
document.getElementById("MAX_NUM_DESC").style.display="";
else
document.getElementById("MAX_NUM_DESC").style.display="none";
}
function clear_priv()
{
document.form1.PRIV_ID.value="";
document.form1.PRIV_NAME.value="";
}
function LoadPrivWindow()
{
URL="/module/priv_select";
loc_x=document.body.scrollLeft+event.clientX-event.offsetX;
loc_y=document.body.scrollTop+event.clientY-event.offsetY+200;
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");
}
function clear_user2()
{
document.form1.COPY_TO_NAME.value="";
document.form1.COPY_TO_ID.value="";
}
function LoadWindow2()
{
URL="/module/user_select?ID=2";
loc_x=document.body.scrollLeft+event.clientX-event.offsetX-100;
loc_y=document.body.scrollTop+event.clientY-event.offsetY+170;
//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");
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");
}
</script>
</head>
<body class="bodycolor" topmargin="5" onload="javascript:form1.SUBJECT.focus();">
<?
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"];
$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"];
if($BEGIN_DATE=="0000-00-00")
$BEGIN_DATE="";
if($END_DATE=="0000-00-00")
$END_DATE="";
$query1="select * from USER where USER_ID='$FROM_ID'";
$cursor1= exequery($connection,$query1);
if($ROW=mysql_fetch_array($cursor1))
{
$FROM_NAME=$ROW["USER_NAME"];
$DEPT_ID=$ROW["DEPT_ID"];
}
$DEPT_NAME=dept_long_name($DEPT_ID);
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($MAX_NUM=="")
$MAX_NUM=0;
?>
<table border="0" width="90%" cellspacing="0" cellpadding="3" class="small">
<tr>
<td class="Big"><img src="/images/notify_new.gif" align="absmiddle"><span class="big3"> <?if($VOTE_ID!="")echo "修改";else echo "新建";?>投票</span>
</td>
</tr>
</table>
<table border="0" width="70%" cellpadding="2" cellspacing="1" align="center" bgcolor="#000000" class="small">
<form enctype="multipart/form-data" action="add.php" method="post" name="form1">
<tr>
<td nowrap class="TableData">发布范围(部门):</td>
<td class="TableData">
<input type="hidden" name="TO_ID" value="<?=$TO_ID?>">
<textarea cols=40 name="TO_NAME" rows=2 class="BigStatic" wrap="yes" readonly><?=$TO_NAME?></textarea>
<input type="button" value="添 加" class="SmallButton" onClick="LoadWindow()" title="添加部门" name="button">
<input type="button" value="清 空" class="SmallButton" onClick="clear_dept()" title="清空部门" name="button">
</td>
</tr>
<tr>
<td nowrap class="TableData">发布范围(角色):</td>
<td class="TableData">
<input type="hidden" name="PRIV_ID" value="<?=$PRIV_ID?>">
<textarea cols=40 name="PRIV_NAME" rows=2 class="BigStatic" wrap="yes" readonly><?=$PRIV_NAME?></textarea>
<input type="button" value="选 择" class="SmallButton" onClick="LoadPrivWindow()" title="选择角色" name="button">
<input type="button" value="清 空" class="SmallButton" onClick="clear_priv()" title="清空角色" name="button">
</td>
</tr>
<tr>
<td nowrap class="TableData">发布范围(人员):</td>
<td class="TableData">
<input type="hidden" name="COPY_TO_ID" value="<?=$COPY_TO_ID?>">
<textarea cols=40 name="COPY_TO_NAME" rows=2 class="BigStatic" wrap="yes" readonly><?=$COPY_TO_NAME?></textarea>
<input type="button" value="选 择" class="SmallButton" onClick="LoadWindow2()" title="选择人员" name="button">
<input type="button" value="清 空" class="SmallButton" onClick="clear_user2()" title="清空人员" name="button">
</td>
</tr>
<tr>
<td nowrap class="TableData"> 标题:</td>
<td class="TableData">
<input type="text" name="SUBJECT" size="40" maxlength="40" class="BigInput" value="<?=$SUBJECT?>">
</td>
</tr>
<tr>
<td nowrap class="TableData">投票描述:</td>
<td class="TableData">
<textarea name="CONTENT" class="BigInput" cols="50" rows="3"><?=$CONTENT?></textarea>
</td>
</tr>
<tr>
<td nowrap class="TableData"> 类型:</td>
<td class="TableData">
<select name="TYPE" class="BigSelect" onchange="change_type();">
<option value="0" <?if($TYPE=="0") echo "selected";?>>单选</option>
<option value="1" <?if($TYPE=="1") echo "selected";?>>多选</option>
</select>
<span id="MAX_NUM_DESC" style="display:<?if($TYPE!="1") echo "none";?>"> 最多允许选择 <input type="input" name="MAX_NUM" value="<?=$MAX_NUM?>" size="4" class="SmallInput"> 项,为0则不限制</span>
</td>
</tr>
<tr>
<td nowrap class="TableData"> 查看投票结果:</td>
<td class="TableData">
<select name="VIEW_PRIV" class="BigSelect">
<option value="0" <?if($VIEW_PRIV=="0") echo "selected";?>>投票后允许查看</option>
<option value="1" <?if($VIEW_PRIV=="1") echo "selected";?>>投票前允许查看</option>
<option value="2" <?if($VIEW_PRIV=="2") echo "selected";?>>不允许查看</option>
</select>
</td>
</tr>
<tr>
<td nowrap class="TableData"> 匿名投票:</td>
<td class="TableData">
<input type="checkbox" name="ANONYMITY" id="ANONYMITY" <?if($ANONYMITY=="1") echo "checked";?>><label for="ANONYMITY">允许匿名投票</label>
</td>
</tr>
<tr>
<td nowrap class="TableData"> 有效期:</td>
<td class="TableData">
生效日期:<input type="text" name="BEGIN_DATE" size="10" maxlength="10" class="BigInput" value="<?=$BEGIN_DATE?>">
<img src="/images/menu/calendar.gif" border="0" style="cursor:hand" onclick="td_calendar('form1.BEGIN_DATE');">
为空为立即生效<br>
终止日期:<input type="text" name="END_DATE" size="10" maxlength="10" class="BigInput" value="<?=$END_DATE?>">
<img src="/images/menu/calendar.gif" border="0" style="cursor:hand" onclick="td_calendar('form1.END_DATE');">
为空为手动终止
</td>
</tr>
<tr>
<td nowrap class="TableData"> 短消息提醒:</td>
<td class="TableData">
<input type="checkbox" name="SMS_REMIND" id="SMS_REMIND" checked><label for="SMS_REMIND">使用内部短信提醒用户</label>
<?
$query = "select * from SMS2_PRIV";
$cursor=exequery($connection,$query);
if($ROW=mysql_fetch_array($cursor))
$TYPE_PRIV=$ROW["TYPE_PRIV"];
if(find_id($TYPE_PRIV,11)) //检查该模块是否允许手机提醒
{
?>
<input type="checkbox" name="SMS2_REMIND" id="SMS2_REMIND"><label for="SMS2_REMIND">使用手机短信提醒用户</label>
<?
}
?>
</td>
</tr>
<tr align="center" class="TableControl">
<td colspan="2" nowrap>
<input type="hidden" name="VOTE_ID" value="<?=$VOTE_ID?>">
<input type="hidden" name="CUR_PAGE" value="<?=$CUR_PAGE?>">
<input type="button" value="发布" class="BigButton" onclick="CheckForm();">
<input type="reset" value="重填" class="BigButton">
<?
if($VOTE_ID!="")
{
?>
<input type="button" value="返回" class="BigButton" onclick="location='index1.php?CUR_PAGE=$CUR_PAGE'">
<?
}
?>
</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -