<?php
##############################################################
##In-portal													##
##############################################################
##					      In-portal							##
##					Intechnic Corporation					##
##			   All Rights Reserved, 1998-2002				##
##															##	
##	No portion of this code may be copied, reproduced or	##	
##	   otherwise redistributed without proper written		##
##	  consent of Intechnic Corporation.  Violation will		##
##	   result in revocation of the license and support		##
##	 privileges along maximum prosecution allowed by law.	##
##############################################################

// new startup: begin
define('REL_PATH', 'admin/users');
$relation_level = count( explode('/', REL_PATH) );
define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
require_once FULL_PATH.'/kernel/startup.php';
// new startup: end

require_once ($pathtoroot.$admin."/include/elements.php"); 
require_once ($pathtoroot."kernel/admin/include/navmenu.php"); 
//require_once ($pathtolocal."admin/include/navmenu.php"); 
require_once($pathtoroot.$admin."/toolbar.php");

unset($objEditItems);

$objEditItems = new clsUserManager();
$objEditItems->SourceTable = $objSession->GetEditTable("PortalUser");
$objEditItems->EnablePaging = FALSE;
$GroupCount = 0;

    if (isset($_POST["itemlist"]))
    {
	if(is_array($_POST["itemlist"]))
	{
	  $UserList = implode(",",$_POST["itemlist"]);
	  $UserCount = count($_POST["itemlist"]);
	}
	else
	{
	  $a = explode($_POST["itemlist"]);
	  $userCount = count($a);
	  unset($a);
	  $UserList = $_POST["itemlist"];
    }

    if($itemcount>1)
    {
	  if ($en+1 == $itemcount)
		$en_next = -1;
	  else
		$en_next = $en+1;

	  if ($en == 0)
		$en_prev = -1;
	  else
		$en_prev = $en-1;
    }
    $action = "m_sendmail";
}

$envar = "env=" . BuildEnv();

$section = 'in-portal:edituser_sendmail';

$title = prompt_language("la_Text_Send")." ".prompt_language("la_Text_Email")." ".prompt_language("la_Text_To")." $UserCount ".prompt_language("la_Text_Users");
echo $envar."<br>\n";

//Display header
  $sec = $objSections->GetSection($section);
  int_header(NULL,NULL,$title);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form ID="mailuser" name="mailuser" action="" method=POST>
  <tr <?php int_table_color(); ?>>
    <td valign="top" colspan="3"><?php echo prompt_language("la_prompt_Enable_HTML"); ?>
      <input type="checkbox" name="html_enable" value="1">
      <br>
      <?php int_hint(prompt_language("la_Warning_Enable_HTML")); ?>
    </td>
  </tr>

  <?php int_subsection_title(prompt_language("la_tab_EmailMessage")); ?>
  <tr <?php int_table_color(); ?>>
    <td valign="top"><span class="text"><?php echo prompt_language("la_prompt_EmailSubject"); ?></span></td>
    <td>
      <input type="text" name="email_subject" class="text" size="30" value="">
    </td>
    <td><span ID="valSubject" class="validation_error"><?php echo prompt_language("la_val_RequiredField"); ?></span></td>
  </tr>
   <tr <?php int_table_color(); ?>>
    <td valign="top"><span class="text"><?php echo prompt_language("la_prompt_EmailBody"); ?></span></td>
    <td>
      <textarea name="email_body" cols="30" rows="5" class="text"></textarea>
    </td>
    <td><span ID="valBody" class="validation_error"><?php echo prompt_language("la_val_RequiredField"); ?></span></td>
  </tr>

  <tr <?php int_table_color(); ?>>
    <td colspan="3">
      <input type="hidden" name="Action" value="<?php echo $action; ?>">
      <input type="hidden" name="idlist" value="<?php echo $UserList; ?>">
      <input type="hidden" name="IdType" VALUE="user">
      <input type="button" name="submit1" value="<?php echo admin_language("la_Save"); ?>" class="button" onclick="edit_submit('mailuser','<?php echo $admin; ?>/users/user_list.php',1);">
      <input type="button" name="submit3" value="<?php echo admin_language("la_Cancel"); ?>" class="button" onclick="edit_submit('mailuser','<?php echo $admin; ?>/users/user_list.php',2);">
    </td>
  </tr>
  </FORM>
</table>
<SCRIPT LANGUAGE="JavaScript">
  InitValidation();
</SCRIPT>

<?php int_footer(); ?>