set_visit_priv.php

来自「通达OA2007SE源代码 非常好的」· PHP 代码 · 共 228 行

PHP
228
字号
<?
  include_once 'inc/auth.php';
  include_once 'inc/utility_all.php';
  echo '
<html>
<head>
<title>指定资源申请角色权限</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
';
  echo '<s';
  echo 'cript>
function func_find(select_obj,option_text)
{
 pos=option_text.indexOf("] ")+1;
 option_text=option_text.substr(0,pos);
 for (j=0; j';
  echo '<s';
  echo 'elect_obj.options.length; j++)
 {
   str=select_obj.options(j).text;
   if(str.indexOf(option_text)>=0)
      return j;
 }//for
 return j;
}
function func_color(select_obj)
{
 font_color="red";
 option_text="";
 for (j=0; j';
  echo '<s';
  echo 'elect_obj.options.length; j++)
 {
   str=select_obj.options(j).text;
   if(str.indexOf(option_text)<0)
   {
      if(font_color=="red")
         font_color="blue";
      else
         font_color="red";
   }
   select_obj.options(j).style.color=font_color;
   pos=str.indexOf("] ")+1;
   option_text=str.substr(0,pos);
 }//for
 return j;
}
function func_insert()
{
 for (i=selec';
  echo 't2.options.length-1; i>=0; i--)
 {
   if(select2.options(i).selected)
   {
     option_text=select2.options(i).text;
     option_value=select2.options(i).value;
     option_style_color=select2.options(i).style.color;
     var my_option = document.createElement("OPTION");
     my_option.text=option_text;
     my_option.value=option_value;
     my_option.style.color=option_style_color;
';
  echo '
     pos=func_find(select1,option_text);
     select1.add(my_option,pos);
     select2.remove(i);
  }
 }//for
 func_init();
}
function func_delete()
{
 for (i=select1.options.length-1; i>=0; i--)
 {
   if(select1.options(i).selected)
   {
     option_text=select1.options(i).text;
     option_value=select1.options(i).value;
     var my_option = document.createElement("OPTION"';
  echo ');
     my_option.text=option_text;
     my_option.value=option_value;
     pos=func_find(select2,option_text);
     select2.add(my_option,pos);
     select1.remove(i);
  }
 }//for
 func_init();
}
function func_select_all1()
{
 for (i=select1.options.length-1; i>=0; i--)
   select1.options(i).selected=true;
}
function func_select_all2()
{
 for (i=select2.options.length-1; ';
  echo 'i>=0; i--)
   select2.options(i).selected=true;
}
function func_init()
{
  func_color(select2);
  func_color(select1);
}
function mysubmit()
{
   fld_str="";
   for (i=0; i< select1.options.length; i++)
   {
      options_value=select1.options(i).value;
      fld_str+=options_value+",";
    }
   document.form1.FLD_STR.value=fld_str;
   document.form1.submit();
}
function se';
  echo 't_view_type()
{
   location="set_visit_priv.php?SOURCEID=';
  echo $SOURCEID;
  echo '";
}
</script>
</head>
<body class="bodycolor" topmargin="5" onload="func_init();">
';
  $query = (((''.'select * from OA_SOURCE where SOURCEID=\'').$SOURCEID).'\'');
  $cursor = exequery ($connection, $query);
  if ($ROW = mysql_fetch_array ($cursor))
  {
    $VISIT_PRIV = $ROW['VISIT_PRIV'];
  }
  echo '
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/edit.gif" WIDTH="22" HEIGHT="20" align="absmiddle">';
  echo '<s';
  echo 'pan class="big3"> 指定资源申请角色权限</span>
    </td>
  </tr>
</table>
<br>
<table width="500" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF" class="big">
  <tr bgcolor="#CCCCCC">
    <td align="center"><b>已选角色</b></td>
    <td align="center">&nbsp;</td>
    <td align="center" valign="top"><b>备选角色</b></td>
  </tr>
  <tr>
    <td';
  echo ' valign="top" align="center" bgcolor="#CCCCCC">
    ';
  echo '<s';
  echo 'elect  name="select1" ondblclick="func_delete();" MULTIPLE style="width:200;height:200">
      ';
  $query = 'SELECT * from USER_PRIV order by PRIV_NO';
  $cursor = exequery ($connection, $query);
  while ($ROW = mysql_fetch_array ($cursor))
  {
    $USER_PRIV = $ROW['USER_PRIV'];
    $PRIV_NAME = $ROW['PRIV_NAME'];
    if (find_id ($VISIT_PRIV, $USER_PRIV))
    {
      echo '       <option value="';
      echo $USER_PRIV;
      echo '">';
      echo $PRIV_NAME;
      echo '</option>
       ';
      continue;
    }
  }
  echo '    </select>
    <input type="button" value=" 全 选 " onclick="func_select_all1();" class="SmallInput">
    </td>
    <td align="center" bgcolor="#999999">
      <input type="button" class="SmallInput" value=" ← " onclick="func_insert();">
      <br><br>
      <input type="button" class="SmallInput" value=" → " onclick="func_delete();">
    </td>
    <td align="center" valign="top" bgcolor="#';
  echo 'CCCCCC">
    ';
  echo '<s';
  echo 'elect  name="select2" ondblclick="func_insert();" MULTIPLE style="width:200;height:200">
      ';
  $query = 'SELECT * from USER_PRIV order by PRIV_NO';
  $cursor = exequery ($connection, $query);
  while ($ROW = mysql_fetch_array ($cursor))
  {
    $PRIV_NAME = $ROW['PRIV_NAME'];
    $USER_PRIV = $ROW['USER_PRIV'];
    if (!find_id ($VISIT_PRIV, $USER_PRIV))
    {
      echo '       <option value="';
      echo $USER_PRIV;
      echo '">';
      echo $PRIV_NAME;
      echo '</option>
       ';
      continue;
    }
  }
  echo '    </select>
    <input type="button" value=" 全 选 " onclick="func_select_all2();" class="SmallInput">
    </td>
  </tr>
  <tr bgcolor="#CCCCCC">
    <td align="center" valign="top" colspan="3">
    <form action="VISIT_PRIV_submit.php" method="post" name="form1">
    点击条目时,可以组合CTRL或SHIFT键进行多选<br>
      <input type="button" class="BigButton" value="保 存" onclick="mysubmit();">&n';
  echo 'bsp;&nbsp;&nbsp;&nbsp;
      <input type="button" class="BigButton" value="关 闭" onclick="window.close()">
      <input type="hidden" name="SOURCEID" value="';
  echo $SOURCEID;
  echo '">
      <input type="hidden" name="FLD_STR" value="">
    </form>
    </td>
  </tr>
</table>
</body>
</html>
';
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?