<?php require_once './utility/texteditor_utility.php';?>
<?php
$req = $_POST['List'];
if(empty($req)){
		$req ="AddMsg";
}
$ctrl_name = BASE_URL."/expquotes";
$page_name = BASE_URL."/expquotes/".$req;
$num = $cnt;
?>
<style>
		.black_overlay{
			display: none;
			position:fixed;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index:1001;
			-moz-opacity: 0.7;
			opacity:.70;
			filter: alpha(opacity=70);
		}
		.white_content {
			display: none;
			position:fixed;
			top: 30%;
			left: 32%;
			width: 470px;
			height: 600px;
			z-index:1002;
			overflow: auto;
		}
</style>
<h1 class="page-header"><?php echo trim($_REQUEST["List"],'Msg')?> Message</h1>          
<div class="bs-example table-responsive">
	<table align="center" width="100%" border="0">    	
    	 <?php if(!empty($error_msg)) {?>     
            <tr>
                <td align="center">  
                  <div class="col-lg-8 alert alert-danger" style="clear:right">
                    <?php echo $error_msg;?>
                 </div>             
                </td>
             </tr>   
			 
         <?php } ?> 
		 	<tr>
                <td align="center">  
                  <div style="clear:right" align="right">
                   <button value="AddRecord" type="button" name="AddButton" class="btn btn-primary" onclick="Back('frmback','<?php echo $userDetails->expid; ?>')">Back to Messages</button>
                 </div>             
                </td>
             </tr>   
        <tr>
        	<td align="center">       
             <div class="col-lg-12">
             <div class="well">
                  <form name="frm" id="frm" method="post" class="bs-example form-horizontal" enctype="multipart/form-data">
                  <input type="hidden" name="act" id="act" value="" />
				  <input type="hidden" name="List" value="<?php echo $_REQUEST['List']?>">
					<input type="hidden" name="msg_id" id="msg_id" value="<?php echo $userDetails->id?>" />
					<input type="hidden" name="expquote_id" id="expquote_id" value="<?php echo $_REQUEST["expquote_id"]?>" />
                    <fieldset>                  
                      <div class="form-group">
                          <label class="col-lg-2 control-label" for="name">Title</label>
                        <div class="col-lg-8">
                          <input name="title" type="text" class="validate[required] form-control" id="title" value="<?php echo $userDetails->title?>" />
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-2 control-label" for="designer_lname">Description</label>
                        <div class="col-lg-8">
                          <textarea name="description" id="description" cols="40" rows="10"><?php echo $userDetails->description?></textarea>
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-2 control-label" for="name">Image</label>
                        <div class="col-lg-8" align="left">
                          <input type="file" name="simage" id="simage" /> (only <?php echo VALID_EXT_EXPS." files allowed";?>) 
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="page_content"></label>
                        <div class="col-lg-6">
                          <?php 
					  if(!empty($userDetails->simage)){
								 ?>
							 	<table align="center" border="0" cellpadding="3" cellspacing="3" width="100%">
                               	   <tr>	
                                   		<td width="133"><?php if(!empty($userDetails->simage)){?> <img src="<?php echo "../". UPLOADDIR_EXPS."/".$userDetails->simage?>?<?php echo date("YmdHis")?>" width="100" height="100" alt="<?php echo SEO_IMAGE_ALT; ?>" title="<?php echo SEO_IMAGE_TITLE; ?>"> <?php }?><input type="hidden" name="update_image_old" value="<?php echo $userDetails->simage?>">
										</td>
                                   	   
                                   </tr>
                               </table>
                             <?php } ?>
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-2 control-label" for="name">Image</label>
                        <div class="col-lg-8" align="left">
                          <input type="file" name="simage2" id="simage2" />  (only <?php echo VALID_EXT_EXPS." files allowed";?>) 
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="page_content"></label>
                        <div class="col-lg-6">
                          <?php 
					  if(!empty($userDetails->simage2)){
								 ?>
							 	<table align="center" border="0" cellpadding="3" cellspacing="3" width="100%">
                               	   <tr>	
                                   		<td width="133"><?php if(!empty($userDetails->simage2)){?> <img src="<?php echo "../". UPLOADDIR_EXPS."/".$userDetails->simage2?>?<?php echo date("YmdHis")?>" width="100" height="100" alt="<?php echo SEO_IMAGE_ALT; ?>" title="<?php echo SEO_IMAGE_TITLE; ?>"> <?php }?><input type="hidden" name="update_image_old2" value="<?php echo $userDetails->simage2?>">
										</td>
                                   	   
                                   </tr>
                               </table>
                             <?php } ?>
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-2 control-label" for="name">External Link</label>
                        <div class="col-lg-8">
                          <input name="extlink" type="text" class="validate[required] form-control" id="extlink" value="<?php echo $userDetails->extlink?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-2 control-label" for="designer_email">Status</label>
                        <div class="col-lg-8" align="left">
                          <select name="status" id="status" class="form-control" style="width:100px; text-align:left">
						  							<?php if($_REQUEST["List"]!='AddMsg'){?>
													<option value="2" <?php if($userDetails->status==2){echo "selected";}?>>Delete</option>
													<?php }?>
												  	<option value="1" <?php if($userDetails->status==1){echo "selected";}?>>Active</option>
													<option value="0" <?php if($userDetails->status==0){echo "selected";}?>>Inactive</option>
												  </select>
                        </div>
                      </div>
                  
                      <div class="form-group">
                        <div class="col-lg-8 col-lg-offset-1">                    
                          <button class="btn btn-primary" name="Submit" type="submit" value="Submit">Submit</button>&nbsp; <button class="btn btn-primary" name="Cancel" type="button" value="Cancel" onclick="Back('frmback','<?php echo $userDetails->expid; ?>')">Cancel</button>
                        </div>
                      </div>
                    </fieldset>
                  </form>
            </div>
          </div>
            </td>
        </tr>
    </table>
</div>
<form name="frmback" id="frmback" method="post">
	<input type="hidden" name="expquote_id" id="expquote_id" value="<?php echo $_REQUEST["expquote_id"]?>" />
</form>
<script type="text/javascript">
function Back(frm_name,id)
{	
		var Frm = document.getElementById(frm_name);
		Frm.action="../expquotes/msgs";							
		Frm.submit();
}
$(document).ready(function() {
    $('#frm').bootstrapValidator({
        message: 'This value is not valid',
        fields: {
            title: {
                message: 'The Title is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Title is required and can\'t be empty'
                    }
                }
            }
        }
    });
});
</script>