<?php if (!isset($_SESSION['FirstName'])) {
	session_start();
}
    include ('includes/db1config.php');
    include ('../includes/mysql_connect.php');
	include ('includes/admin-config.php');	//get site options
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php 
include('title.php'); 
echo'<link href="css/'.$stylesheet.'" rel="stylesheet" type="text/css" media="screen" />';	
echo'<link href="css/print_style.css" rel="stylesheet" type="text/css" media="print" />';
?>

<link rel="stylesheet" type="text/css" href="css/cssverticalmenu.css" />
<link rel="stylesheet" href="includes/tinyaccordion/style.css" type="text/css" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"> </script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>


<script type="text/javascript" src="../js/ddaccordion.js"></script>

<!-- for popup windows -->
<link href="css/popup-style.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/script.js"></script>
 <!-- end popup script-->

<style>
	.leftForm {
	    float: left;
	    left: -54px;
	    position: relative;
	    width: 371px;
	}

	.rightForm{
		float: left;
		width: 300px;
	}
	.saveButton{
		margin: auto;
	}
	#save-button{
		margin-right: 115px;
		width: 150px;
	}

	.AddMOreEdit:hover {
		cursor: pointer;
	}

	.arrowlistmenu{
		width: 100%; /*width of accordion menu*/
	}

	.arrowlistmenu .menuheader{ /*CSS class for menu headers in general (expanding or not!)*/
		font:12px Verdana,Arial;width:95%; border:1px solid #467182; padding:7px; 
		font-weight:bold; margin-top:5px; cursor:pointer; 
	    -webkit-border-radius: 7px;
	    -moz-border-radius: 7px;
	    border-radius: 7px;
	    border: solid 1px #e8e8e8;
	    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
	    -webkit-transition-duration: 0.2s;
	    -moz-transition-duration: 0.2s;
	    transition-duration: 0.2s;
	    -webkit-user-select:none;
	    -moz-user-select:none;
	    -ms-user-select:none;
	    user-select:none;
		color:#fff;
		background-color:#2077a1;
		padding-left:.5em;padding-right:.5em;
	}

	.arrowlistmenu .openheader{ /*CSS class to apply to expandable header when it's expanded*/
		background-image: url(titlebar-active.png);
	}

	.arrowlistmenu ul{ /*CSS for UL of each sub menu*/
	list-style-type: none;
	margin: 0;
	padding: 0;
	margin-bottom: 0px; /*bottom spacing between each UL and rest of content*/
	background: none;
	}

	.arrowlistmenu ul li{
	padding-bottom: 0px; /*bottom spacing between menu items*/
	}

	.arrowlistmenu ul li .opensubheader{ /*Open state CSS for sub menu header*/
	background: lightblue !important;
	}

	.arrowlistmenu ul li .closedsubheader{ /*Closed state CSS for sub menu header*/
	background: lightgreen !important;
	}

	.arrowlistmenu ul li a{
	color: #81BEF7;
	background: url(arrowbullet.png) no-repeat center left; /*custom bullet list image*/
	display: block;
	padding: 0px 0;
	padding-left: 19px; /*link text is indented 19px*/
	text-decoration: none;
	font-weight: bold;
	border-bottom: 1px solid #dadada;
	font-size: 90%;
	}

	.arrowlistmenu ul li a:visited{
	color: #81BEF7;
	}

	.arrowlistmenu ul li a:hover{ /*hover state CSS*/
	color: #FA5858;
	background-color: #FA5858;
	}

	.arrowlistmenu ul li a.subexpandable:hover{ /*hover state CSS for sub menu header*/
	background: lightblue;
	}
	html {
	    overflow-y: scroll;
	}
	#save-button {
	    margin-right: 0px !important;
	    width: 100px !important;
	}

</style>

<style type="text/css">
	body#pop-up-window {
		background:none;
		margin-top:5px;
	}
	
	body#pop-up-window #content,
	body#pop-up-window #main-content {
		margin:0px;
		padding:0px;
		width:100%;
		background:none;
	}
	
	#main-content .entry h1 {
	    margin     : 0 0 0 25%;
	    padding    : 0 0 10px;
	    text-align : center;
	}

	body#pop-up-window #content {
	}
	
	#wrapper.custom {
		-webkit-border-radius: none;
		-moz-border-radius: none;
	    border-radius: 0;
		border: none;
		background: none;
		width: 500px;
		padding:0px;
		margin:0px;
		margin:16px;
	}

	.disabled {
		background: #48a3db none repeat scroll 0 0;
	    border: 1px solid #777777;
	    border-radius: 4px;
	    color: #fff;
	    opacity: 0.34;
	    padding: 3px 6px;
	}

	.disabled:hover {
		background: #48a3db none repeat scroll 0 0 !important;
	    border: 1px solid #777777 !important;
	    border-radius: 4px !important;
	    color: #fff !important;
	    opacity: 0.34 !important;
	    padding: 3px 6px !important;
	}

	tr td {
	    padding: 3px 20px !important;
	}
	.mainForm{
		margin: auto !important;
    	width: 250px !important;
	}
</style>

</head>
<body id="pop-up-window">

<div id="wrapper" class="custom">



<!-- start page -->



<!-- start content -->
<div id="content">
<div id="main-content">
   
		<div class="post">
		  <div class="entry">

<h1>Update Detail</h1>
                
<?php 
if( $_SESSION['masterAdmin'] == 1 ){ 

	include ('includes/db1config.php');
	include ('../includes/mysql_connect.php');

    $query = "SELECT * from marketing_materials where recordkey = ".$_GET['id'];
	$rt    = mysql_query($query); // query executed
	echo mysql_error(); // if any error is there that will be printed to the screen
	$row   = mysql_fetch_array($rt);

	if( $row['thumbnail'] != '' ){
        $path = '<img width="40px" height="40px" src="/custom/marketing/'.$row["thumbnail"].'" alt="Thumbnail Image">';
    } else {
        $path = 'Thumbnail Not found';
    }
	
?>
	
	<div class="mainForm">
        <form id="formm" action="savethumbnaildetail.php" method="post" enctype="multipart/form-data">
            <input type="hidden" name="recordKey" value="<?php echo $_GET['id']; ?>">
            <div class="leftForm">
	            <table>    
	                <tr>
	                	<td>File Name :</td>
	                	<td><input type="text" name="file_name" value="<?php echo explode('.',$row['file_name'])[0]; ?>" id="Item" size="20"></td>
                	</tr>

	                <tr>
	                	<td>Description :</td>
	                	<td><input  value="<?php echo $row['description']; ?>" type="text" name="description" class="" id="" ></td>
                	</tr>

                	<tr>
	                	<td>Details :</td>
	                	<?php $details = ( isset($row['detail']) && $row['detail'] != '' ? $row['detail'] : '' ); ?>
	                	<td>
	                		<textarea name="detail" rows="5" cols="20"><?php echo $details; ?></textarea>	
                		</td>
                	</tr>

	                <tr>
	                	<td>Status</td>
	                	<td>
	                		<select name="status">
								<option value="">Please select status</option>
								<option <?php  if( $row['status'] == 1 ) { echo "selected"; } ?> value="1">1</option>
								<option <?php  if( $row['status'] == 2 ) { echo "selected"; } ?> value="2">2</option>
								<option <?php  if( $row['status'] == 3 ) { echo "selected"; } ?> value="3">3</option>
								<option <?php  if( $row['status'] == 4 ) { echo "selected"; } ?> value="4">4</option>
								<option <?php  if( $row['status'] == 5 ) { echo "selected"; } ?> value="5">5</option>
	                		</select>
	                	</td>
	                </tr>

	                <tr>
	                	<td>Thumbnail</td>
	                	<td><?php echo $path; ?></td>
	                </tr>
					
					<?php 
						if( $row['thumbnail'] == '' && $_SESSION['masterAdmin'] == 1 ){
					?>
		                <tr>
		                	<td>Upload Thumbnail</td>
		                	<td><input type="file" name="thumbnail" id="my_file_field" ></td>
		                </tr>
	                <?php
						}
					?>

	                <tr>
	                	<td></td>
	                	<td><input type="submit" id="save-button" value="Update"></td>
	                </tr>

	            </table>
        	</div>
    	</form>	
    </div>

<?php } else {
	echo '<font color="red"><div align="center">You are not authorized to view this page. <br>Please <a href="index.php"><font color="blue">login here</font></a>.</div></font>';
}
?>
            
 <br />

</div><!-- end entry-->

<br />

</div><!-- end post-->

</div><!-- end main-content-->

</div><!-- end content -->


<div style="clear: both;">&nbsp;</div>
<div id="page-bg-btm">
</div><!-- end page-bg-btm div -->

</div><!-- end wrapper div-->


<script>
	
	$(document).ready(function() {
		$("#formm").submit(function() {
            var ext = $('#my_file_field').val().split('.').pop().toLowerCase();
            if($.inArray(ext, ['gif','png','jpg','jpeg','bmp','pdf','']) == -1) {
                alert('File type not allowed');
                return false;
            }
        });
	});
</script>
</body>
</html>

