<?/*
Copyright (C) 2003 Media Net Link, Inc. Danville, CA 94526 USA

This file is part of AthenaRMS.

AthenaRMS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

AthenaRMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/?>
<div class="athenatitleshadow">Edit RMS<div class="athenatitle">Edit RMS</div></div>
<br />

<?php
  require_once 'crm.php';
  require_once 'server_functions.php';

  globalize_request_keys('crm_id', 'add_crm_id', 'del_crm_id');

  $crm = new CRM();
  $r = $crm->Select_by_CRM_ID($crm_id);
  $crm_name = $r->Get('crm_name');
?>
CRM "<?php echo $crm_name; ?>" has access to:
<ul>
<?php
  if ($add_crm_id) $crm->Grant_Access ($add_crm_id, $crm_id);

  if ($del_crm_id) $crm->Remove_Access ($del_crm_id, $crm_id);

  $crm_access = $crm->Access_To ($crm_id, DB_FETCHMODE_ASSOC);

  $omit_list = array ($crm_id);

  foreach ($crm_access as $r) {
    $omit_list[] = $r['access_to_crm_id'];
    print "  <li><a href=\"$_SERVER[PHP_SELF]?crm_id=$crm_id&amp;del_crm_id=$r[access_to_crm_id]\">Del</a> - $r[access_to_crm_name]</li>\n";
  }

  $crm_dd = $crm->Multi_Array_Drop_Down_Omit_Vals ($crm->List_All (''), '', $omit_list);
?>
</ul>

<?php if ($crm_dd) { ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="crm_id" value="<?php echo $crm_id; ?>" />
Give this CRM access to CRM: <select name="add_crm_id"><?php echo $crm_dd; ?></select>
<input type="submit" name="submit" value="Submit" />
</form>
<?php } ?>

<a href="../add_crm_people?crm_id=<?php echo $crm_id; ?>">Assign people to this CRM</a>
