<?php
/**
 * config_input_view.php - Config input
 *
 * @author $Author: dtong $
 * @version $Id: config_input_view.php,v 1.7 2011/04/08 07:56:01 dtong Exp $
 * @copyright Copyright (c) 2011, Tiller Software Co., Ltd.
*/
$url=base_url() . "admin/config/update/{$index}";
$delete_url = base_url() . "admin/config/set_default/{$index}/{$item}";
$index_url = base_url() . "admin/config/index/{$index}";
?>
<div style="text-align:center;font-weight:bold;margin-top:15px"><?php echo lang('syscfg_input_title')?></div>
<form name="config_form">
<input type="hidden" name="item" value="<?php echo $item?>" />
	<div style="margin-left:3%;margin-right:3%;width:94%;margin-top:10px;font-size:11px">
		<div style="margin-top:10px;margin-bottom:10px;font-weight:bold"><?php echo lang('syscfg_title_name') . ": $name"?></div>

		<?php if (isset($desc) ) { ?>
			<div style="margin-top:10px;margin-bottom:10px"><?php echo lang('syscfg_title_desc') . ": $desc"?></div>
		<?php } ?>
		<center>
		<table><tr>
			<td valign="middle">
				<?php echo '<b>' . lang('syscfg_input_new_value') . '</b>'?>:
			</td>
			<td>
				<?php if ($use_boolean) {
					$true_selected = ''; $false_selected='';
					if ( $machine_value ) {
						$true_selected = 'selected="selected"';
					}
					else {
						$false_selected = 'selected="selected"';
					}
				?>
					<select name='value'>
						<?php if (!$boolean_negate) { ?>
							<option value="1" <?php echo $true_selected?>><?php echo lang('syscfg_boolean_true')?></option>
							<option value="0" <?php echo $false_selected?>><?php echo lang('syscfg_boolean_false')?></option>
						<?php } else { ?>
							<option value="0" <?php echo $false_selected?>><?php echo lang('syscfg_boolean_true')?></option>
							<option value="1" <?php echo $true_selected?>><?php echo lang('syscfg_boolean_false')?></option>
						<?php } ?>
					</select>
				<?php } ?>

				<?php if ($use_textbox) { ?>
					<input type="text" name="value" size="<?php echo $textsize?>" value="<?php echo $machine_value?>" />
				<?php 	}
						if ($use_multiline_textbox) { // (issue: 159) add textarea view ?>
					<textarea name="value" rows="<?php echo $rowsize?>" cols="<?php echo $textsize?>"><?php echo $machine_value?></textarea>
				<?php } ?>
			</td>
		</tr></table>
		</center>
	</div>
	<br />
	<center>
	<input type="submit" value="<?php echo lang('syscfg_input_cancel_button'); ?>" name="save" <?php osa_btn()?>
			onClick="closeDhtmlWindow('adminconfig'); return false;" />
	&nbsp;&nbsp;&nbsp;&nbsp;
	<?php if ( $show_default_button ) {
		//Need a second URL else the first delete won't refresh the page with the new default value??? ?>
		<input type="submit" value="<?php echo lang('syscfg_input_setdefault_button'); ?>" name="close" <?php osa_btn()?>
				onClick="ajaxGetpage('','<?php echo $delete_url?>',false); closeDhtmlWindow('adminconfig');
							<?php if ( isset($refresh_page) && $refresh_page ) { ?>
								ajaxGetpage('header','<?php echo base_url()?>admin/config/update_header',true);
							<?php } ?>
							ajaxGetpage('page_content','<?php echo $index_url?>',false); return false;" />
		&nbsp;&nbsp;&nbsp;&nbsp;
	<?php } ?>
	<input type="submit" value="<?php echo lang('syscfg_input_save_button'); ?>" name="close" <?php osa_btn()?>
			onClick="if (ajaxPostform('page_content','<?php echo $url?>','config_form',false)==false) return false;
			<?php if ( isset($refresh_page) && $refresh_page ) { ?>
				ajaxGetpage('header','<?php echo base_url()?>admin/config/update_header',true);
			<?php } ?>
			closeDhtmlWindow('adminconfig'); return false;" />
	<?php /*
	<input type="submit" value="<?php echo lang('syscfg_input_save_button'); ?>" name="close" <?php osa_btn()?>
			onClick="ajaxPostform('page_content','<?php echo $url?>','config_form',false);
			<?php if ( isset($refresh_page) && $refresh_page ) { ?>
				window.location='<?php echo base_url() . 'home/admin_config'?>'; return false;
			<?php } ?>
			closeDhtmlWindow('adminconfig'); return false;" /> */?>
	</center>
</form>