📄 index.php
字号:
<?php
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
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()\r\n{\r\n 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 if(document.form1.MODULE_NO.value==\"\")\r\n { alert(\"模块序号不能为空!\");\r\n return (false);\r\n }\r\n\r\n if(document.form1.MODULE_FILE.value==\"\")\r\n { alert(\"模块文件不能为空!\");\r\n return (false);\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 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\r\nfunction delete_url(MODULE_ID)\r\n{\r\n msg='确认要删除该模块么?';\r\n if(window.confirm(msg))\r\n {\r\n URL=\"delete.php?MODULE_ID=\" + MODULE_ID;\r\n window.location=URL;\r\n }\r\n}\r\n\r\n\r\nfunction delete_all()\r\n{\r\n msg='确认要删除所有模块么?';\r\n if(window.confirm(msg))\r\n {\r\n URL=\"delete_all.php\";\r\n window.location=URL;\r\n }\r\n}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\" onload=\"document.form1.MODULE_NO.focus();\">\r\n\r\n<table border=\"0\" width=\"100%\" 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\"> 添加模块</span>\r\n </td>\r\n </tr>\r\n</table>\r\n\r\n";
$query = "SELECT * from MYTABLE";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$MODULE_FILE_DEFINE .= $ROW['MODULE_FILE'].",";
}
echo "\r\n<table border=\"0\" cellspacing=\"1\" width=\"450\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\" align=\"center\" >\r\n <form action=\"add.php\" method=\"post\" name=\"form1\" onsubmit=\"return CheckForm();\">\r\n <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=25 name=TO_NAME rows=3 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=\"\">\r\n <textarea cols=25 name=\"PRIV_NAME\" rows=3 class=\"BigStatic\" wrap=\"yes\" readonly></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=\"\">\r\n <textarea cols=25 name=\"COPY_TO_NAME\" rows=3 class=\"BigStatic\" wrap=\"yes\" readonly></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 <tr>\r\n <td nowrap class=\"TableData\">默认位置:</td>\r\n <td nowrap class=\"TableData\">\r\n <select name=\"MODULE_POS\" class=\"BigSelect\">\r\n <option value=\"l\">左侧</option>\r\n <option value=\"r\">右侧</option>\r\n </select>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\">序号:</td>\r\n <td nowrap class=\"TableData\">\r\n <input type=\"text\" name=\"MODULE_NO\" class=\"BigInput\" size=\"10\" maxlength=\"100\">\r\n </td>\r\n <tr>\r\n <td nowrap class=\"TableData\">文件:</td>\r\n <td class=\"TableData\">\r\n <select name=\"MODULE_FILE\" class=\"BigSelect\">\r\n";
$CUR_DIR = $ROOT_PATH."general/mytable/";
$dh = opendir( $CUR_DIR );
while ( false !== ( $FILE_NAME = readdir( $dh ) ) )
{
if ( $FILE_NAME == "." || $FILE_NAME == ".." || !is_file( $CUR_DIR."/".$FILE_NAME ) && strtolower( substr( $FILE_NAME, -4 ) ) != ".php" || find_id( $MODULE_FILE_DEFINE, $FILE_NAME ) )
{
echo " <option value=\"";
echo $FILE_NAME;
echo "\">";
echo substr( $FILE_NAME, 0, -4 );
echo "</option>\r\n";
}
}
echo " </select><br>此处列出 安装目录\\webroot\\general\\mytable 下尚未添加的文件\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\">显示属性:</td>\r\n <td nowrap class=\"TableData\">\r\n <select name=\"VIEW_TYPE\" class=\"BigSelect\">\r\n <option value=\"1\">用户可选</option>\r\n <option value=\"2\">用户必选</option>\r\n <option value=\"3\">暂停显示</option>\r\n </select>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableControl\" colspan=\"2\" align=\"center\">\r\n <input type=\"submit\" value=\"添加\" class=\"BigButton\" title=\"添加模块\" name=\"button\">\r\n </td>\r\n </form>\r\n</table>\r\n\r\n<br>\r\n\r\n<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"3\">\r\n <tr>\r\n <td background=\"/images/dian1.gif\" width=\"100%\"></td>\r\n </tr>\r\n</table>\r\n\r\n<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" class=\"small\">\r\n <tr>\r\n <td class=\"Big\"><img src=\"/images/notify_open.gif\" align=\"absmiddle\"><span class=\"big3\"> 管理模块</span>\r\n </td>\r\n </tr>\r\n</table>\r\n\r\n<br>\r\n<div align=\"center\">\r\n\r\n";
$query = "SELECT * from MYTABLE order by MODULE_POS,MODULE_NO";
$cursor = exequery( $connection, $query );
$MODULE_COUNT = 0;
while ( $ROW = mysql_fetch_array( $cursor ) )
{
++$MODULE_COUNT;
$MODULE_ID = $ROW['MODULE_ID'];
$MODULE_NO = $ROW['MODULE_NO'];
$MODULE_FILE = $ROW['MODULE_FILE'];
$MODULE_POS = $ROW['MODULE_POS'];
$VIEW_TYPE = $ROW['VIEW_TYPE'];
$TO_ID = $ROW['DEPT_ID'];
$PRIV_ID = $ROW['PRIV_ID'];
$USER_ID = $ROW['USER_ID'];
$TO_NAME = "";
if ( $TO_ID == "ALL_DEPT" )
{
$TO_NAME = "全体部门";
}
else
{
$query1 = "select DEPT_NAME from DEPARTMENT where find_in_set(DEPT_ID,'".$TO_ID."')";
$cursor1 = exequery( $connection, $query1 );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$TO_NAME .= $ROW['DEPT_NAME'].",";
}
}
$TO_NAME_TITLE = "";
$TO_NAME_STR = "";
if ( $TO_NAME != "" )
{
if ( substr( $TO_NAME, -2 ) == "," )
{
$TO_NAME = substr( $TO_NAME, 0, -2 );
}
$TO_NAME_TITLE .= "部门:".$TO_NAME;
$TO_NAME_STR .= "<font color=#0000FF><b>部门:</b></font>".csubstr( strip_tags( $TO_NAME ), 0, 20 ).( 20 < strlen( $TO_NAME ) ? "..." : "" )."<br>";
}
$PRIV_NAME = "";
$query1 = "SELECT PRIV_NAME 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'].",";
}
if ( $PRIV_NAME != "" )
{
$PRIV_NAME = substr( $PRIV_NAME, 0, -2 );
if ( $TO_NAME_TITLE != "" )
{
$TO_NAME_TITLE .= "\n\n";
}
$TO_NAME_TITLE .= "角色:".$PRIV_NAME;
$TO_NAME_STR .= "<font color=#0000FF><b>角色:</b></font>".csubstr( strip_tags( $PRIV_NAME ), 0, 20 ).( 20 < strlen( $PRIV_NAME ) ? "..." : "" )."<br>";
}
$USER_NAME = "";
$query1 = "SELECT USER_NAME from USER where find_in_set(USER_ID,'".$USER_ID."')";
$cursor1 = exequery( $connection, $query1 );
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
$USER_NAME .= $ROW['USER_NAME'].",";
}
if ( $USER_NAME != "" )
{
$USER_NAME = substr( $USER_NAME, 0, -2 );
if ( $TO_NAME_TITLE != "" )
{
$TO_NAME_TITLE .= "\n\n";
}
$TO_NAME_TITLE .= "人员:".$USER_NAME;
$TO_NAME_STR .= "<font color=#0000FF><b>人员:</b></font>".csubstr( strip_tags( $USER_NAME ), 0, 20 ).( 20 < strlen( $USER_NAME ) ? "..." : "" )."<br>";
}
if ( $MODULE_POS == "l" )
{
$MODULE_POS_DESC = "左侧";
}
else
{
$MODULE_POS_DESC = "右侧";
}
if ( $VIEW_TYPE == "1" )
{
$VIEW_TYPE_DESC = "用户可选";
}
else if ( $VIEW_TYPE == "2" )
{
$VIEW_TYPE_DESC = "用户必选";
}
else if ( $VIEW_TYPE == "3" )
{
$VIEW_TYPE_DESC = "暂停显示";
}
if ( $MODULE_COUNT == 1 )
{
echo " <table border=\"0\" cellspacing=\"1\" width=\"650\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\">\r\n";
}
echo " <tr class=\"";
if ( $MODULE_POS == "l" )
{
echo "TableData";
}
else
{
echo "TableContent";
}
echo "\">\r\n <td nowrap align=\"center\">";
echo $MODULE_POS_DESC;
echo "</td>\r\n <td nowrap align=\"center\">";
echo $MODULE_NO;
echo "</td>\r\n <td nowrap align=\"center\">";
if ( $VIEW_TYPE == "2" )
{
echo "<font color=red>";
}
else if ( $VIEW_TYPE == "3" )
{
echo "<font color=gray>";
}
echo substr( $MODULE_FILE, 0, -4 );
echo "</td>\r\n <td nowrap align=\"center\">";
if ( $VIEW_TYPE == "2" )
{
echo "<font color=red>";
}
else if ( $VIEW_TYPE == "3" )
{
echo "<font color=gray>";
}
echo $VIEW_TYPE_DESC;
echo "</td>\r\n <td style=\"cursor:hand\" title=\"";
echo $TO_NAME_TITLE;
echo "\">";
echo $TO_NAME_STR;
echo "</td>\r\n <td nowrap align=\"center\" width=\"80\">\r\n <a href=\"edit.php?MODULE_ID=";
echo $MODULE_ID;
echo "\"> 编辑</a>\r\n <a href=\"javascript:delete_url('";
echo $MODULE_ID;
echo "');\"> 删除</a>\r\n </td>\r\n </tr>\r\n";
}
if ( 0 < $MODULE_COUNT )
{
echo " <thead class=\"TableHeader\">\r\n <td nowrap align=\"center\">默认位置</td>\r\n <td nowrap align=\"center\">序号</td>\r\n <td nowrap align=\"center\">文件</td>\r\n <td nowrap align=\"center\">显示属性</td>\r\n <td nowrap align=\"center\">发布范围</td>\r\n <td nowrap align=\"center\">操作</td>\r\n </thead>\r\n <thead class=\"TableControl\">\r\n <td nowrap align=\"center\" colspan=\"6\">\r\n <input type=\"button\" class=\"BigButton\" OnClick=\"javascript:delete_all();\" value=\"全部删除\">\r\n </td>\r\n </thead>\r\n </table>\r\n";
}
else
{
message( "", "尚未添加模块" );
}
echo "\r\n</div>\r\n\r\n</body>\r\n</html>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -