<?php
 	/**
 * user_input_view.php - User Edit file
 *
 * @author $Author: dtong $
 * @version $Id: department_input_view.php,v 1.14 2011/02/02 11:32:17 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/


$href   = base_url();
$refresh= base_url().$page.'/refresh/'.$selectlistitem.'/'.$filter;
$page   = base_url().$page;
$imgreq	    = 'req.gif';
$img_req  	= "<img src=". osa_imagepath() . "$imgreq    title='Required field'   alt='Required field'    border='0' >";

    //$mode='update';
    $mode = CMS_ADMIN_UPDATE;
 	if ($action==CMS_ACTION_ADD) {
 		$row->id                 = "";
 		$row->name          = "";
 		$row->shortname           = "";
 		$row->description         = "";
 		$row->enabled	         = "1";
 		$mode = CMS_ADMIN_INSERT;
 	}
 	elseif ($action==CMS_ACTION_EDIT) {
 		if ( isset($data)==FALSE || count($data) == 0 )  {
			echo lang('admin_department_error_nodata');
			return;
		}
		$row 	    = $data[0];

 	} else
 		return;

 		$mode = $page.'/'.$mode;
?>



<form method="POST" action= "<?php echo $mode; ?>" name="department_form" >
<input type="hidden" id="id" name="id" size="30" value="<?php   echo $row->id; ?>" />
<center>
<div class="user_title"><?php echo $selected_display; ?></div>

<div id="div_department" class="department_table">

<div id="div_name" >
	<table class="department_table_edit"  >
		<tr >
		<td class="field_req" ><?php echo lang('admin_department_col_name'); ?><?php echo $img_req; ?></td>
		<td class="department_text_left" ><input type="text" id="name" name="name" size="30" value="<?php   echo $row->name; ?>" />
		</tr>
	</table>
</div>

<div id="div_shotname" >
	<table class="department_table_edit"  >
		<tr >
		<td class="department_edit_left" ><?php echo lang('admin_department_col_shortname'); ?></td>
		<td class="department_text_left" ><input type="text" id="shortname" name="shortname" size="30" value="<?php   echo $row->shortname; ?>" />
		</tr>
	</table>
</div>

<div id="div_description" >
	<table class="department_table_edit"  >
		<tr >
		<td class="department_edit_left" ><?php echo lang('admin_department_col_description'); ?></td>
		<td class="department_text_left" ><TEXTAREA id="description"  NAME="description" COLS="50" ROWS="10" ><?php   echo $row->description; ?></TEXTAREA>
		</tr>
	</table>
</div>

<div id="div_enable" >
	<table class="department_table_edit"  >
		<tr >
		<td class="department_edit_left" ><?php echo lang('admin_department_col_enabled'); ?></td>
		<td class="department_text_left" >
		<?php
		$checked="";
		if ($row->enabled =='1')
		$checked='checked';
		?>
		<input type="checkbox"  name="Enabled" <?php  echo $checked; ?>  />
	</tr>
	</table>
</div>
</div>
<span class="admin_req"  style="color:red"><?php echo lang('admin_red'); ?></span>
<span class="admin_req" ><?php echo lang('admin_req'); ?></span>


<div class="reswin_buttons">

<input type="button" value="<?php echo lang('admin_btn_cancel'); ?>" name="cancel" <?php osa_btn()?>
onClick="cancelDhtml('department_input');return false;" />

<span style="margin-left:30px">&nbsp;</span>

<input type="button" value="<?php echo lang('admin_btn_save'); ?>" name="save" <?php osa_btn()?>
onClick="submitDhtml('<?php echo $mode; ?>','department_form','<?php echo $refresh; ?>','page_content','department_input');return false;" />
</div>

<br />
</center>
</form>