<?php

// -----------------------------------------------------------------------
// This file is part of AROUNDMe
// 
// Copyright (C) 2003 - 2006 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="chl_edit.php" method="post" name="frm" id="id_frm">
<input type="hidden" name="channel_id" value="<?php if(isset($channel['channel_id'])) { echo $channel['channel_id'];}?>" />

<div class="box">
	<div class="box_top">
		<?php echo $lang['hdr_channel'];?><br />
	</div>
	
	<div class="box_mid">
		<div class="content">
			<table border="0" cellspacing="0" cellpadding="0" width="100%">
				<tr>
					<td valign="top">
						<fieldset>
						<legend><?php echo $lang['txt_header_1'];?></legend>
						<p>
						<?php echo $lang['txt_overview_intro'];?><br />
						</p>
						
						<p>
						<label for="id_channel_title"><?php echo $lang['form_label_title'];?></label>
						<input id="id_channel_title" type="text" name="channel_title" size="35" value="<?php if (isset($channel['channel_title'])) { echo $channel['channel_title'];}?>" /><br />
						</p>
						
						<p>
						<label for="id_channel_url"><?php echo $lang['form_lable_url'];?></label>
						<input id="id_channel_url" type="text" name="channel_url" size="55" value="<?php if (isset($channel['channel_url'])) { echo $channel['channel_url'];}?>" /><br />
						</p>
						
						<p>
						<label for="id_channel_synopsis"><?php echo $lang['form_label_synopsis'];?></label>
						<textarea id="id_channel_synopsis" name="channel_synopsis" cols="52" rows="2"><?php if (isset($channel['channel_synopsis'])) { echo $channel['channel_synopsis'];}?></textarea><br />
						</p>
						</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_publishing_intro'];?><br />
						</p>

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

						<?php
						
						//find out what value rsp has

						if (isset($channel['rsp'])) {
							foreach($channel['rsp'] as $key => $rsp):
								if ($rsp['level_id'] == $rspconfig['rsp_level']['node']) {
									$rsp_node = 1;
								}
							endforeach;
						}
						
						?>

						<script type="text/javascript">
						function setDegreeEveryone(id) {
							if (id.checked) {
								document.getElementById('id_degree_id').checked=true;
							}
						}
						function setPublishingOff() {
							document.getElementById('id_level_id_node').checked=false;
							document.getElementById('id_level_id_public').checked=false;

						}
						</script>

						<table border="0" cellspacing="0" cellpadding="2" width="100%">
							<?php

							if ($this->user_acs->checkPermission($resource_ids['node']['rsp'], $privilege_ids['allow_rsp_node'])) { //resourece_id, Priv_id
							$selected="";
							if (isset($rsp_node) && $rsp_node == 1) {
								$selected=" checked=\"checked\"";
							}
							?>
							<tr>
								<td valign="top">
									<input type="checkbox" id="id_level_id_node" name="rsp_node" value="1"<?php echo $selected;?> class="checkbox" onClick="javascript:setDegreeEveryone(this);" /><br />
								</td>
								<td>
									<?php echo $lang['txt_publish_node_help'];?><br />
								</td>
							</tr>
							<?php }?>
						</table>
						</fieldset>

						<script type="text/javascript">
						//check php did not set either of the publishing buttons
						if (document.getElementById('id_level_id_node').checked) {
							document.getElementById('id_degree_id').checked=true;
						}
						</script>
						<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_save_intro'];?><br />
						</p>

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

						<?php if (isset($channel)) {
						?>
						<input type="submit" name="channel_delete" class="button_urgent" value="<?php echo $lang['form_submit_delete'];?>" />&nbsp;
						<input type="submit" name="channel_save" class="button_urgent" value="<?php echo $lang['form_submit_save'];?>" />&nbsp;
						<?php
						}
						else {
						?>
						<input type="submit" name="channel_insert" class="button_urgent" value="<?php echo $lang['form_submit_insert'];?>" /><br />
						<?php }?>
						</fieldset>
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>
		
<div class="box_bottom">
	<span class="box_bottom_right"></span>
	<span class="box_bottom_left"></span>
</div>