<?php
 	/**
 * eq_input_view.php - eq Edit file
 *
 * @author $Author: dtong $
 * @version $Id: eq_input_view.php,v 1.13 2011/04/27 05:46:26 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/

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

    $mode = CMS_ADMIN_UPDATE;
if ($action==CMS_ACTION_ADD) {
 	$row->id                 = "";
 	$row->text               = "";
 	$row->sort               = "1";
 	$row->enabled	         = "1";

 	$mode = CMS_ADMIN_INSERT;
}
elseif ($action==CMS_ACTION_EDIT) {
 	if ( isset($data)==FALSE || count($data) == 0 )  {
		echo lang('admin_eq_error_nodata');
		return;
	}
	$row 	    = $data[0];

} else
 	return;

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

?>

<form method="POST" action= "<?php echo $href; ?>admin/eq/update" name="eq_form" >

<input type="hidden" id="id" name="id" size="30" value="<?php   echo $row->id; ?>" />
<input type="hidden" id="type" name="type" size="30" value="<?php   echo $type; ?>" />
<center>
<div class="user_title"><?php echo $selected_display; ?></div>
<div id="div_strnd" class="eq_table">

<div id="div_department" >
	<table class="eq_table_edit"  >
		<tr>
		<td class="field_req" ><?php echo osa_get_template_value($template,'_input_col1'); ?><?php echo $img_req; ?></td>
		<td class="eq_text_left" >
	 	<?php
	 		$tmp = 0;
	 		if (isset($dep_schid) && !empty($dep_schid) ) {
	 			$tmp = $dep_schid;
	 		}
	 		elseif ( isset($selected_dep) && !empty($selected_dep) ) {
	 			$tmp = $selected_dep;
	 		}
	    	//echo form_dropdown("departmentid", $department, $selected_dep, "size=1");
	    	echo form_dropdown("departmentid", $department, $tmp, "size=1");
		?>
		</td>
		</tr>
	</table>
</div>

<!--
<div id="div_type" >
	<table class="eq_table_edit"  >
		<tr >
		<td class="eq_edit_left" ><?php echo lang('admin_eq_col_type'); ?></td>
		<td class="eq_text_left" >
		<?php
 			echo form_dropdown("type", $type, $selected_type, "size=1");
		?>
		</td>
		</tr>
	</table>
</div>
 -->

<div id="div_text" >
	<table class="eq_table_edit"  >
		<tr >
		<td class="field_req" ><?php echo osa_get_template_value($template,'_input_col2'); ?><?php echo $img_req; ?></td>
		<td class="eq_text_left" ><TEXTAREA id="eq_col_text"  NAME="text" COLS="50" ROWS="10" ><?php   echo $row->text; ?></TEXTAREA>
		</tr>
	</table>
</div>

 <div id="div_sort" >
	<table class="eq_table_edit"  >
		<tr >
		<td class="eq_edit_left" ><?php echo osa_get_template_value($template,'_input_col3'); ?></td>
		<td class="eq_text_left" ><input type="text" id="sort" name="sort" size="30" value="<?php   echo $row->sort; ?>"  MAXLENGTH="9"/>
		</tr>
	</table>
</div>

<div id="div_enabled" >
	<table class="eq_table_edit"  >
		<tr >
		<td class="eq_edit_left" ><?php echo osa_get_template_value($template,'_input_col4'); ?></td>
		<td class="eq_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>
</center>
<div class="reswin_buttons">
		<input type="button" value="<?php echo lang('admin_btn_cancel'); ?>" name="cancel" <?php osa_btn()?>
		onClick="cancelDhtml('eq_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; ?>','eq_form','<?php echo $refresh; ?>','page_content','eq_input');return false;" />
</div>
<br />
</form>