<?php echo $this->fetch('header.html'); ?>
<div class="row">
<div class="span12">
<h3>网站信息</h3>
<form method="post" action="<?php echo APPADMIN; ?>?m=admin_sites&a=save">
<table class="table table-bordered" width="100%">
    <tr>
        <td width="12%">网站名称：</td>
        <td width="88%"><input type="text" name="sitename" value="<?php echo $this->_var['data']['sitename']; ?>"></td>
    </tr>
    <tr>
      <td>网站logo：</td>
      <td>
      <div class="btn-upload">
      <input type="file" name="upimg" class="btn-upload-file" id="upimg" onChange="uploadgoodsimg()">
      </div>
      <label  id="loading" style="color:red; display:none;">正在上传中...</label>
      <span id="imgShow">
      <?php if ($this->_var['data']['logo']): ?>
      <img src="/<?php echo $this->_var['data']['logo']; ?>">
      <?php endif; ?>
      </span>

      <input name="logo" type="hidden" id="logo" value="<?php echo $this->_var['data']['logo']; ?>"></td>
    </tr>
    <tr>
      <td>标题：</td>
      <td><input name="title" type="text" id="title" value="<?php echo $this->_var['data']['title']; ?>"></td>
    </tr>
    <tr>
      <td>关键字：</td>
      <td><input name="keywords" type="text" id="keywords" value="<?php echo $this->_var['data']['keywords']; ?>"></td>
    </tr>
    <tr>
      <td>描述：</td>
      <td><textarea name="description" id="description" cols="45" rows="5"><?php echo $this->_var['data']['description']; ?></textarea></td>
    </tr>
    <tr>
      <td>备案：</td>
      <td><input name="icp" type="text" id="icp" value="<?php echo $this->_var['data']['icp']; ?>"></td>
    </tr>
    <tr>
      <td>统计代码：</td>
      <td><textarea name="statjs" id="statjs" cols="45" rows="5"><?php echo $this->_var['data']['statjs']; ?></textarea></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" class="btn btn-success" value="提交"></td>
    </tr>
</table>
</form>
</div>
</div>

<script language="javascript" src="/static/js/ajaxfileupload.js"></script>
<script language="javascript">
   function uploadgoodsimg()
    {
        //starting setting some animation when the ajax starts and completes
        $("#loading")
        .ajaxStart(function(){
            $(this).show();
        })
        .ajaxComplete(function(){
            $(this).hide();
        });

        $.ajaxFileUpload
        (
            {
                url:'/index.php?m=upload&a=upload&t='+Math.random(), 
                secureuri:false,
                fileElementId:'upimg',
                dataType: 'json',
                success: function (data, status)
                {
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                           alert(data.msg);
                        }else
                        {
                             $("#imgShow").html("<img src='/"+data.imgurl+"' width='100'>");
							 $("#logo").val(data.imgurl);
                        }
                    }
                },
                error: function (data, status, e)
                {
                    alert(e);
                }
            }
        )
        
        return false;

    }
</script>
<?php echo $this->fetch('footer.html'); ?>