<?php

// -----------------------------------------------------------------------
// This file is part of Igloo
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program 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, or (at your option) any
// later version.
// 
// This program 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 program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
// 02110-1301, USA.
// -----------------------------------------------------------------------

?>

<form action="nlt_edit.php" method="post" name="frm" id="id_frm">

<div class="box">
	<div class="box_top">
		<?php echo $lang['hdr_newsletter'];?><br />
	</div>
	
	<div class="box_mid">
		<div class="content">
			<?php
			if (isset($total_emails_sent)) {
			?>
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<?php echo $lang['txt_emails_sent'];?>: <?php echo $total_emails_sent;?><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<?php
			}
			?>
			
			<?php
			if (isset($croncomplete)) {
			?>
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<b><?php echo $lang['txt_croncomplete'];?></b><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<?php
			}
			?>
			
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<?php echo $lang['txt_intro'];?><br />
					</td>
					<td colspan="2">
						<br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<fieldset>
						<legend><?php echo $lang['txt_header_1'];?></legend>
						<p>
						<?php echo $lang['txt_newsletter_intro'];?><br />
						</p>
						
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
						
						<p>
							<label for="id_subject"><?php echo $lang['txt_subject'];?></label>
							<input type="text" id="id_subject" name="subject"  size="40" value="<?php echo $lang['txt_subject_txt'];?>" /><br />
						</p>
						
						<table cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td align="right">
									<script language="JavaScript" type="text/javascript">
									var displayType = 'newsletter';
									</script>
									<script language="JavaScript" type="text/javascript" src="js/gui_wiki.js"></script><br />
								</td>
							</tr>
							<tr>
								<td valign="top">
									<label for="id_message"><?php echo $lang['txt_message'];?></label>
									<textarea for="id_message" name="message" rows="15" cols="60"><?php echo $lang['txt_message_txt'];?></textarea>
									<script language="JavaScript" type="text/javascript">
											var txtarea = document.frm.message;
										</script>
								</td>
							</tr>
						</table>
						
						<?php
						if(count($lang['arr_lang_name'] == 1)) {
						?>
						<input type="hidden" name="language_id" value="<?php echo $_SESSION['s_language_id'];?>" />
						<?php
						}
						else {
						?>
						<p>
							<label for="id_language"><?php echo $lang['txt_language'];?></label>
							<select id="id_language" name="language_id">
							<?php
							foreach($lang['arr_lang_name'] as $key => $i):
							?>
							<option value="<?php echo $key;?>" <? if($language_id == $key) echo "checked";?>><?php echo $i;?></option>
							<?php endforeach; ?>
							</select>
						</p>
						<?php }?>
						
						<?php if (isset($allow_spellcheck)) {?>
						<p align="right">
							<input type="button" value="<?php echo $lang['sub_check_spelling'];?>" class="button" onClick="openSpellChecker();" />&nbsp;&nbsp;
						</p>
						<?php }?>
							
						</fieldset>
						
					</td>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="10" height="1" alt="" /><br />
					</td>
					<td valign="top" width="200">
						<fieldset>
						<legend><?php echo $lang['txt_header_2'];?></legend>
						<p>
						<?php echo $lang['txt_to_help'];?><br />
						</p>
						
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
						
						<p>
							<input type="radio" name="to_type_id" value="<?php echo $newsletter_type_ids['node'];?>" "checked" /><?php echo $lang['txt_to_type1'];?> (<?php echo $total_members;?>)<br />
							
							<?php
							if (isset($lang['arr_acs']['role'])) {
							foreach ($lang['arr_acs']['role'] as $key => $i):
							?>
							<input type="radio" name="to_role_id" value="<?php echo $key;?>" /><?php echo $i;?><br />
							<?php
							endforeach;
							}
							?>
							
							<input type="radio" name="to_type_id" value="<?php echo $newsletter_type_ids['node_pending'];?>" /><?php echo $lang['txt_to_type2'];?> (<?php echo $total_pending_members;?>)<br />
							<input type="radio" name="to_type_id" value="<?php echo $newsletter_type_ids['node_invited'];?>" /><?php echo $lang['txt_to_type3'];?> (<?php echo $total_invited;?>)<br />
							
						</p>
						</fieldset>
						
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" /><br />

						<fieldset>
						<legend><?php echo $lang['txt_header_3'];?></legend>
						<p>
						<?php echo $lang['txt_send_intro'];?><br />
						</p>

						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />

						<input type="submit" name="send_newsletter" value="<?php echo $lang['sub_newsletter'];?>" class="button_urgent" />
						
						</fieldset>
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>

<div class="box_bottom">
	<span class="box_bottom_right"></span>
	<span class="box_bottom_left"></span>
</div>
