<?php
include("loginkey.php");//引入公共变量文件
include("include/config.php");//引入公共变量文件
include("include/common.php");//引入公共函数文件
setcookie("retimgurl", "", time()-3600,"/lmcms_v1/backweb/");
?>
<!DOCTYPE html>
<html>
<head>
	<title><?=rinput(websitename)?>-后台管理系统</title>
<meta name="Keywords" content="<?=rinput(websitekey)?>" />
<meta name="Description" content="<?=rinput(websitedes)?>" />  
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	
    <!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- libraries -->
    <link href="css/lib/jquery-ui-1.10.2.custom.css" rel="stylesheet" type="text/css" />
    <link href="css/lib/font-awesome.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/layout.css" />
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />

    <!-- this page specific styles -->
    <link rel="stylesheet" href="css/compiled/index.css" type="text/css" media="screen" />    

   
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>

    <!-- navbar头部导航 -->
<?php
 include("header.php");
 ?>
    <!-- end navbar头部导航 -->

    <!-- sidebar左侧导航开始 -->
 
<?php
 include("leftmenu.php");
 ?> 
    <!-- end sidebar左侧导航结果 -->
<?php
$msql = "select * from limao_shop where lm_id=". intval(rinput($_GET['id']));
$mrs = limaors($msql);
$mdata = mysql_fetch_object($mrs);

?>
<script type="text/javascript">
//提取cookie中的值
	function getCookie(name) {
	    var cookieStr = document.cookie;
	    if(cookieStr.length > 0) {
	        var cookieArr = cookieStr.split(";"); //将cookie信息转换成数组
	        for (var i=0; i<cookieArr.length; i++) {
	            var cookieVal = cookieArr[i].split("="); //将每一组cookie(cookie名和值)也转换成数组
	            if(cookieVal[0] == name) {
	                return unescape(cookieVal[1]); //返回需要提取的cookie值
	            }
	        }
	    }
	}
function checkCookie() {
	   var svalue = getCookie("retimgurl");
	   var oldvalue =  document.getElementById("lm_img").value;
	   if (svalue != null) {
	   	   if(svalue != oldvalue){
    document.getElementById("lm_img").value=svalue;
    document.getElementById("viewimg").src="../upload/upimg/"+svalue;
	}	}}
	window.setInterval("checkCookie()",3000);//每隔3秒，调用一次getDateDemo() 
//window.setTimeout(checkCookie(),3000);
</script>
	<!-- main container -->
    <div class="content">
　　　　　 <div style="padding-left:50px;font-size:20px;">修改商品</div>
        <div id="pad-wrapper">
      　　　　   <form action="shop_add_ok.php" method="post">
            <div class="span10 column">
              <div class="field-box">
                <label>主题：<input class="span5" name="lm_title" value="<?=rinput($mdata->lm_title)?>"　required Maxlength="50" type="text" /></label>
              </div>
               <div class="field-box">
                <label>来源：<input class="span2"  name="lm_source" value="<?=rinput($mdata->lm_source)?>" required Maxlength="16" type="text" /> &nbsp;
                       发布者：<input class="span2"  name="lm_writer" value="<?=rinput($mdata->lm_writer)?>" required Maxlength="16" type="text" /></label>
              </div>
               <div class="field-box">
                <label>图片：<input class="span3" type="text" id="lm_img"  name="lm_img" value="<?=rinput($mdata->lm_img)?>" required Maxlength="40" />&nbsp;
                <input type="button" id="upbutton" value="上传" onclick="window.open('upfile/index.php','child','width=900px,height=500px,top=50px,scrollbars=yes');" />&nbsp;<img id="viewimg" src="<?=rinput(webupimgurl).rinput($mdata->lm_img)?>" width="100px;" height="80px;" alt="缩略图"/>
                 <br/>
                       前端图片宽度：<input class="span1" type="number"  value="<?=rinput($mdata->lm_imgw)?>" name="lm_imgw" required Maxlength="5" value="300" />px;
                       前端图片高度：<input class="span1" type="number"  value="<?=rinput($mdata->lm_imgh)?>" name="lm_imgh" required Maxlength="5" value="500" />px;
                       </label>
              </div>
               <div class="field-box">
 <script language="javascript" type="text/javascript">
function cbao(s)
{
lm_type.value =s;
}
</script> 
                <label>栏目类别：<input type="hidden" name="lm_type" id="lm_type" value="<?=rinput($mdata->lm_type)?>" />
                <select name="mySelect" id="mySelect" style="height:35px;" onchange="cbao(this.options[this.options.selectedIndex].value)">
                 <?php
                                       $nmsql="select * from limao_nm where lm_nmid=0";
                                       $rs = limaors($nmsql);
                                       $row = array();
                                       while($row=mysql_fetch_object($rs)){
                                       ?>
                         <option value="<?=rinput($row->lm_nmid);?>" />☆☆☆☆<?=rinput($row->lm_nmname);?>☆☆☆☆
                                       
                                                                             
                                        <?php
                                       $rjnmsql="select * from limao_nm where lm_nmid=".intval($row->lm_id)." and lm_error=2";
                                       $rjrs = limaors($rjnmsql);
                                       $rjrow = array();
                                       while($rjrow=mysql_fetch_object($rjrs)){
                                       ?>
                       <option value="<?=rinput($rjrow->lm_id);?>" />┈┈┄<?=rinput($rjrow->lm_nmname);?>┈┈┈
                
                    <?
                              }
                            }
                                ?>
                </select>
<script type="text/javascript">
var svalue=document.getElementById("lm_type").value;
document.getElementById("mySelect").value=svalue;
</script>
                
                </label>
              </div>
               <div class="field-box">
                <label>关键词：<input class="span3"  name="lm_keywords" value="<?=rinput($mdata->lm_keywords)?>" Maxlength="40" type="text" /> &nbsp;
                       购买URL：<input class="span4"  name="lm_buyurl" value="<?=rinput($mdata->lm_buyurl)?>" Maxlength="40" type="text" /></label>
              </div>
           　 　<div class="field-box">
                <label>内容：<br><textarea name="lm_body" id="lm_body" required style="width:98%;height:400px;"><?=rinput($mdata->lm_body)?></textarea></label>
                   <script type="text/javascript" charset="utf-8" src="Uedit/ueditor.config.js"></script>　
    　<script type="text/javascript" charset="utf-8" src="Uedit/ueditor.all.min.js"> </script>　
        <script type="text/javascript" charset="utf-8" src="Uedit/lang/zh-cn/zh-cn.js"></script>　
                <script id="lm_body" type="text/plain"></script>  
  　            <!-- 实例化编辑器 -->
 　             <script type="text/javascript">
               var ue = UE.getEditor('lm_body');
               </script>
              </div>
              <div class="field-box">
                <label>文章摘要：<textarea name="lm_des" class="span7"><?=rinput($mdata->lm_des)?></textarea></label>
              </div>
              <div class="field-box">
                <label>发布日期：<input type="text" class="span3" name="lm_date" value="<?=rinput($mdata->lm_date)?>" />&nbsp;
                备注：<input type="text" class="span4" name="lm_alt" value="<?=rinput($mdata->lm_alt)?>" />
                </label>
              </div>
              <div class="field-box">
                <label>计量单位：<input type="text" class="span1" name="lm_dw" value="<?=rinput($mdata->lm_dw)?>" />&nbsp;
                单价：<input type="text" class="span1" name="lm_dj" value="<?=rinput($mdata->lm_dj)?>" />&nbsp;
                可售数量：<input type="text" class="span1" name="lm_numeric" value="<?=rinput($mdata->lm_numeric)?>" />&nbsp;
                </label>
              </div>
              <input type="hidden" name="atype" value="edit" />
              <input type="hidden" name="lm_id" value="<?=rinput($mdata->lm_id)?>" />
                    <input type="submit" class="btn-flat gray" value="修改商品" />
                <!-- end table sample -->
           </div></form>
          </div>
      
    </div>

<div>LIMAOCMS　Copyright @ 2016. All rights reserved.</div>
	<!-- scripts -->
    <script src="js/jquery-latest.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery-ui-1.10.2.custom.min.js"></script>
    <!-- knob -->
    <script src="js/jquery.knob.js"></script>
    <!-- flot charts -->
    <script src="js/jquery.flot.js"></script>
    <script src="js/jquery.flot.stack.js"></script>
    <script src="js/jquery.flot.resize.js"></script>
    <script src="js/theme.js"></script>

    <script type="text/javascript">
        $(function () {

            // jQuery Knobs
            $(".knob").knob();



            // jQuery UI Sliders
            $(".slider-sample1").slider({
                value: 100,
                min: 1,
                max: 500
            });
            $(".slider-sample2").slider({
                range: "min",
                value: 130,
                min: 1,
                max: 500
            });
            $(".slider-sample3").slider({
                range: true,
                min: 0,
                max: 500,
                values: [ 40, 170 ],
            });

            

            // jQuery Flot Chart
            var visits = [[1, 50], [2, 40], [3, 45], [4, 23],[5, 55],[6, 65],[7, 61],[8, 70],[9, 65],[10, 75],[11, 57],[12, 59]];
            var visitors = [[1, 25], [2, 50], [3, 23], [4, 48],[5, 38],[6, 40],[7, 47],[8, 55],[9, 43],[10,50],[11,47],[12, 39]];

            var plot = $.plot($("#statsChart"),
                [ { data: visits, label: "Signups"},
                 { data: visitors, label: "Visits" }], {
                    series: {
                        lines: { show: true,
                                lineWidth: 1,
                                fill: true, 
                                fillColor: { colors: [ { opacity: 0.1 }, { opacity: 0.13 } ] }
                             },
                        points: { show: true, 
                                 lineWidth: 2,
                                 radius: 3
                             },
                        shadowSize: 0,
                        stack: true
                    },
                    grid: { hoverable: true, 
                           clickable: true, 
                           tickColor: "#f9f9f9",
                           borderWidth: 0
                        },
                    legend: {
                            // show: false
                            labelBoxBorderColor: "#fff"
                        },  
                    colors: ["#a7b5c5", "#30a0eb"],
                    xaxis: {
                        ticks: [[1, "JAN"], [2, "FEB"], [3, "MAR"], [4,"APR"], [5,"MAY"], [6,"JUN"], 
                               [7,"JUL"], [8,"AUG"], [9,"SEP"], [10,"OCT"], [11,"NOV"], [12,"DEC"]],
                        font: {
                            size: 12,
                            family: "Open Sans, Arial",
                            variant: "small-caps",
                            color: "#697695"
                        }
                    },
                    yaxis: {
                        ticks:3, 
                        tickDecimals: 0,
                        font: {size:12, color: "#9da3a9"}
                    }
                 });

            function showTooltip(x, y, contents) {
                $('<div id="tooltip">' + contents + '</div>').css( {
                    position: 'absolute',
                    display: 'none',
                    top: y - 30,
                    left: x - 50,
                    color: "#fff",
                    padding: '2px 5px',
                    'border-radius': '6px',
                    'background-color': '#000',
                    opacity: 0.80
                }).appendTo("body").fadeIn(200);
            }

            var previousPoint = null;
            $("#statsChart").bind("plothover", function (event, pos, item) {
                if (item) {
                    if (previousPoint != item.dataIndex) {
                        previousPoint = item.dataIndex;

                        $("#tooltip").remove();
                        var x = item.datapoint[0].toFixed(0),
                            y = item.datapoint[1].toFixed(0);

                        var month = item.series.xaxis.ticks[item.dataIndex].label;

                        showTooltip(item.pageX, item.pageY,
                                    item.series.label + " of " + month + ": " + y);
                    }
                }
                else {
                    $("#tooltip").remove();
                    previousPoint = null;
                }
            });
        });
    </script>

</body>
</html>