dept_list.php
来自「通达OA2007SE源代码 非常好的」· PHP 代码 · 共 256 行
PHP
256 行
<?
function dept_tree_list ($DEPT_ID, $PRIV_OP)
{
global $connection;
global $DEEP_COUNT;
$query = (((''.'SELECT * from DEPARTMENT where DEPT_PARENT=').$DEPT_ID).' order by DEPT_NO');
$cursor = exequery ($connection, $query);
$OPTION_TEXT = '';
$DEEP_COUNT1 = $DEEP_COUNT;
($DEEP_COUNT .= ' ');
while ($ROW = mysql_fetch_array ($cursor))
{
++$COUNT;
$DEPT_ID = $ROW['DEPT_ID'];
$DEPT_NAME = $ROW['DEPT_NAME'];
$DEPT_PARENT = $ROW['DEPT_PARENT'];
$DEPT_NAME = htmlspecialchars ($DEPT_NAME);
if (($PRIV_OP == 1))
{
$DEPT_PRIV = is_dept_priv ($DEPT_ID);
}
else
{
$DEPT_PRIV = 1;
}
$OPTION_TEXT_CHILD = dept_tree_list ($DEPT_ID, $PRIV_OP);
if (($DEPT_PRIV == 1))
{
($OPTION_TEXT .= (((((((((('
<tr class=TableControl>
<td class=\'menulines\' id=\''.$DEPT_ID).'\' name=\'').$DEPT_NAME).'\' onclick=javascript:click_dept(\'').$DEPT_ID).'\') style=cursor:hand>').$DEEP_COUNT1).'├').$DEPT_NAME).'</a></td>
</tr>'));
}
if (($OPTION_TEXT_CHILD != ''))
{
($OPTION_TEXT .= $OPTION_TEXT_CHILD);
continue;
}
}
$DEEP_COUNT = $DEEP_COUNT1;
return $OPTION_TEXT;
}
include_once 'inc/auth.php';
include_once 'inc/utility_all.php';
echo '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
';
echo '<s';
echo 'tyle>
.menulines{}
</style>
';
echo '<s';
echo 'cript Language="JavaScript">
var parent_window = parent.dialogArguments;
function click_dept(dept_id)
{
TO_VAL=parent_window.form1.TO_ID.value;
targetelement=document.all(dept_id);
dept_name=targetelement.name;
if(TO_VAL.indexOf(","+dept_id+",")>0 || TO_VAL.indexOf(dept_id+",")==0)
{
if(TO_VAL.indexOf(dept_id+",")==0)
{
parent_window.form1.TO_ID.value=parent';
echo '_window.form1.TO_ID.value.replace(dept_id+",","");
parent_window.form1.TO_NAME.value=parent_window.form1.TO_NAME.value.replace(dept_name+",","");
borderize_off(targetelement);
}
if(TO_VAL.indexOf(","+dept_id+",")>0)
{
parent_window.form1.TO_ID.value=parent_window.form1.TO_ID.value.replace(","+dept_id+",",",");
parent_window.form1.TO_NAME.value=parent_';
echo 'window.form1.TO_NAME.value.replace(","+dept_name+",",",");
borderize_off(targetelement);
}
}
else
{
parent_window.form1.TO_ID.value+=dept_id+",";
parent_window.form1.TO_NAME.value+=dept_name+",";
borderize_on(targetelement);
}
}
function borderize_on(targetelement)
{
color="#003FBF";
targetelement.style.borderColor="black";
targetelement.style.bac';
echo 'kgroundColor=color;
targetelement.style.color="white";
targetelement.style.fontWeight="bold";
}
function borderize_off(targetelement)
{
targetelement.style.backgroundColor="";
targetelement.style.borderColor="";
targetelement.style.color="";
targetelement.style.fontWeight="";
}
function begin_set()
{
TO_VAL=parent_window.form1.TO_ID.value;
if(TO_VAL=="ALL_DEPT")';
echo '
{
parent_window.form1.TO_ID.value="";
parent_window.form1.TO_NAME.value="";
}
for (step_i=0; step_i<document.all.length; step_i++)
{
if(document.all(step_i).className=="menulines")
{
dept_id=document.all(step_i).id;
if(TO_VAL.indexOf(","+dept_id+",")>0 || TO_VAL.indexOf(dept_id+",")==0)
borderize_on(document.all(step_i));
}
}
';
echo '}
function add_all()
{
TO_VAL=parent_window.form1.TO_ID.value;
for (step_i=0; step_i<document.all.length; step_i++)
{
if(document.all(step_i).className=="menulines")
{
dept_id=document.all(step_i).id;
dept_name=document.all(step_i).name;
if(TO_VAL.indexOf(","+dept_id+",")<=0 && TO_VAL.indexOf(dept_id+",")!=0)
{
parent_window.form1.TO';
echo '_ID.value+=dept_id+",";
parent_window.form1.TO_NAME.value+=dept_name+",";
borderize_on(document.all(step_i));
}
}
}
}
function add_all_dept()
{
parent_window.form1.TO_ID.value="ALL_DEPT";
parent_window.form1.TO_NAME.value="全体部门";
parent.close();
}
function del_all()
{
for (step_i=0; step_i<document.all.length; step_i++)
{
T';
echo 'O_VAL=parent_window.form1.TO_ID.value;
if(document.all(step_i).className=="menulines")
{
dept_id=document.all(step_i).id;
dept_name=document.all(step_i).name;
if(TO_VAL.indexOf(dept_id+",")==0)
{
parent_window.form1.TO_ID.value=parent_window.form1.TO_ID.value.replace(dept_id+",","");
parent_window.form1.TO_NAME.value=parent_w';
echo 'indow.form1.TO_NAME.value.replace(dept_name+",","");
}
if(TO_VAL.indexOf(","+dept_id+",")>0)
{
parent_window.form1.TO_ID.value=parent_window.form1.TO_ID.value.replace(","+dept_id+",",",");
parent_window.form1.TO_NAME.value=parent_window.form1.TO_NAME.value.replace(","+dept_name+",",",");
}
borderize_off(document.all(step_i));
}
';
echo '}
}
</script>
</head>
<body topmargin="1" leftmargin="0" class="bodycolor" onload="begin_set();';
if ((($CHECKED == 'true') AND (0 < $DEPT_ID)))
{
echo 'add_all();';
}
else
{
if ((($CHECKED == 'false') AND (0 < $DEPT_ID)))
{
echo 'del_all();';
}
else
{
if (($CHECKED AND ($DEPT_ID == 0)))
{
echo 'add_all_dept()';
}
}
}
echo '">
';
if (($DEPT_ID == ''))
{
$DEPT_ID = 0;
}
$OPTION_TEXT = dept_tree_list ($DEPT_ID, $PRIV_OP);
$query = ((''.'SELECT DEPT_ID,DEPT_NAME from DEPARTMENT where DEPT_ID=').$DEPT_ID);
$cursor = exequery ($connection, $query);
if ($ROW = mysql_fetch_array ($cursor))
{
$DEPT_ID = $ROW['DEPT_ID'];
$DEPT_NAME = $ROW['DEPT_NAME'];
$OPTION_TEXT = ((((((((('
<tr class=TableContent>
<td class=\'menulines\' id=\''.$DEPT_ID).'\' name=\'').$DEPT_NAME).'\' onclick=javascript:click_dept(\'').$DEPT_ID).'\') style=cursor:hand>').$DEPT_NAME).'</a></td>
</tr>').$OPTION_TEXT);
}
if (($OPTION_TEXT == ''))
{
message ('提示', '未定义或无可管理部门');
echo ' <div align="center"><input type="button" class="BigButton" value="返回" onclick="javascript:location=\'dept_list.php?PRIV_OP=';
echo $PRIV_OP;
echo '\';"></div>
';
}
else
{
echo ' <table border="1" cellspacing="0" width="95%" class="small" cellpadding="3" bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center">
';
if (($PRIV_OP == ''))
{
echo ' <tr class="TableContent">
<td onclick="javascript:add_all_dept();" style="cursor:hand" align="center">全体部门</td>
</tr>
';
}
echo ' <tr class="TableContent">
<td onclick="javascript:add_all();" style="cursor:hand" align="center">全部添加</td>
</tr>
<tr class="TableContent">
<td onclick="javascript:del_all();" style="cursor:hand" align="center">全部删除</td>
</tr>
';
echo $OPTION_TEXT;
if (($DEPT_ID != 0))
{
echo ' <tr class="TableContent">
<td onclick="javascript:location=\'dept_list.php?PRIV_OP=';
echo $PRIV_OP;
echo '\';" style="cursor:hand" align="center">返回</td>
</tr>
</table>
';
}
}
echo '
</body>
</html>
';
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?