⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shareuser.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
字号:
<?
include_once("inc/auth.php");
$MANAGER_ID=1;
?>

<html>
<head>
<title>共享范围确定</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script>
var parent_window =window.opener;
function func_find(select_obj,option_text)
{
 pos=option_text.indexOf("] ")+1;
 option_text=option_text.substr(0,pos);

 for (j=0; j<select_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<select_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=select2.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;

     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");
     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; 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.MANAGERS.value=fld_str;
   parent_window.document.all("SHARE_USER").value=fld_str
   parent.close();
   //document.form1.submit();
}


<?
if($VIEW_TYPE=="")
   $VIEW_TYPE=0;
?>
function set_view_type()
{
   location="shareuser.php?MANAGER_ID=<?=$MANAGER_ID?>&VIEW_TYPE=<?=(1-$VIEW_TYPE)?>&SHARE_USERID=<?=$SHARE_USERID?>";
}
</script>
</head>

<body class="bodycolor" topmargin="5" onload="func_init();">

<?
   $USER_ID=$SHARE_USERID;
?>

<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"><span class="big3">&nbsp;&nbsp;确定共享人员</span>
    &nbsp;
    <select class="BigSelect" name="VIEW_TYPE" onchange="set_view_type();">
    <option value="0">按部门选择人员</option>
    <option value="1" <?if($VIEW_TYPE==1)echo "selected";?>>按角色选择人员</option>
    </select>
    <span class="small1">销售人员可以将自己的客户共享给指定的人员,空共享给所有人员</span>
    </td>
  </tr>
</table>


<br>
<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 valign="top" align="center" bgcolor="#CCCCCC">
    <select  name="select1" ondblclick="func_delete();" MULTIPLE style="width:200;height:280">
      <?
        $SHARE_ARRAY=explode(",",$SHARE_USERID);
        $ARRAY_COUNT=sizeof($SHARE_ARRAY);
        for($I=0;$I<$ARRAY_COUNT;$I++)
        {
         $query="SELECT `USER_ID` , `USER_NAME` , PRIV_NAME, DEPT_NAME FROM `user` a 
               LEFT OUTER JOIN department b ON a.DEPT_ID = b.DEPT_ID 
               LEFT OUTER JOIN user_priv c ON a.USER_PRIV = c.USER_PRIV where a.USER_ID='$SHARE_ARRAY[$I]'";
         $cursor=exequery($connection,$query);
         if($ROW=mysql_fetch_array($cursor))
         {
           $USER_NAME=$ROW["USER_NAME"];
           if($VIEW_TYPE==0)
           {
               $GROUP_NAME=$ROW["DEPT_NAME"];
           }
          else
           {
               $GROUP_NAME=$ROW["PRIV_NAME"];
           }

       
       ?>
       <option value="<?=$SHARE_ARRAY[$I]?>">[<?=$GROUP_NAME?>] <?=$USER_NAME?></option>
       <?
        }
       }
       ?>
    </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="#CCCCCC">
    <select  name="select2" ondblclick="func_insert();" MULTIPLE style="width:200;height:280">
      <?
        $query = "SELECT * from USER,USER_PRIV,DEPARTMENT where USER.DEPT_ID=DEPARTMENT.DEPT_ID and USER.USER_PRIV=USER_PRIV.USER_PRIV and NOT_LOGIN!='1'";
        if($VIEW_TYPE==0)
           $query.= " order by DEPT_NO,USER.DEPT_ID,PRIV_NO,USER_NO,USER_NAME";
        else
           $query.= " order by PRIV_NO,DEPT_NO,USER_NO,USER_NAME";
        $cursor=exequery($connection,$query);
        while($ROW=mysql_fetch_array($cursor))
        {
          $USER_ID1=$ROW["USER_ID"];
          $USER_NAME=$ROW["USER_NAME"];
          $DEPT_ID1=$ROW["DEPT_ID"];
          $USER_PRIV=$ROW["USER_PRIV"];

          if($VIEW_TYPE==0)
          {
            $query1 = "SELECT * from DEPARTMENT where DEPT_ID=" .$DEPT_ID1;
            $cursor1= exequery($connection,$query1);
            if($ROW=mysql_fetch_array($cursor1))
               $GROUP_NAME=$ROW["DEPT_NAME"];
          }
          else
          {
            $query1 = "SELECT * from USER_PRIV where USER_PRIV=" .$USER_PRIV;
            $cursor1= exequery($connection,$query1);
            if($ROW=mysql_fetch_array($cursor1))
               $GROUP_NAME=$ROW["PRIV_NAME"];
          }

          if(!find_id($USER_ID,$USER_ID1))
          {
       ?>
       <option value="<?=$USER_ID1?>">[<?=$GROUP_NAME?>] <?=$USER_NAME?></option>

       <?
          }
        }
       ?>
    </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="submit.php" method="post" name="form1">
    点击条目时,可以组合CTRL或SHIFT键进行多选<br>
      <input type="button" class="BigButton" value="确 定" onclick="mysubmit();">&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="hidden" name="MANAGER_ID" value="<?=$MANAGER_ID?>">
      <input type="hidden" name="MANAGERS" value="">
    </form>
    </td>
  </tr>
</table>

</body>
</html>

⌨️ 快捷键说明

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