<style type="text/css">
#TQEditorContainer_emailcontent {
  width: 100% !important;
}
</style>

<div class="col-xs-24 btn-lg"></div>
<form class="form-add-watch" method="post" style="background:#fafafa;" action="<?php echo site_url('apps/workflow/index/do_add_work'); ?>">
  <input type="hidden" name="wf_sn" value="<?php if(isset($wf_sn)) echo $wf_sn; ?>">
  <input type="hidden" name="mail_title" value="值班记录">
  <input type="hidden" name="rest_days" value="1">
  <input type="hidden" name="rest_days2" value="0">
  <div class="col-xs-24 zhiban-top">
    <div class="col-xs-5"><input type="text" class="datepicker noshadow noborder" style="font-size:14px;color:#666;width:100px;" name="wf_time" value="<?php $cdate=date('Y-m-d');if(isset($wf_time)) $cdate=$wf_time; echo $cdate; ?>" /></div>
    <div class="col-xs-14 text-center">
        <select name="wf_wt_sn" class="noshadow hidden-xs" style="border:1px solid #ddd;height:24px;width:110px;">
          <?php foreach ($typelist as $t) { ?>
            <option value="<?php echo $t->wt_sn.'@'.$t->wt_step; ?>" <?php if(isset($wf_wt_sn) && $wf_wt_sn==$t->wt_sn.'@'.$t->wt_step) echo 'selected' ?>><?php echo $t->wt_name; ?></option>
          <?php } ?>
        </select> 
        <input type="text" name="wf_user" class="text-center noshadow" style="border:1px solid #ddd;width:100px;" value="<?php $userdata=$this->session->userdata('admin_chtcdn'); if(!isset($wf_user)) {echo $userdata['OPI_Name'];}else{echo $wf_user;} ?>" placeholder="姓名">
    </div>
    <div class="col-xs-5">
      <?php if (!isset($wf_sn) || empty($wf_sn)) { ?>
        <button type="button" class="btn btn-danger pull-right btn-add-watch" onclick="$(this).button('loading');setTimeout(function(){ajaxSubmit('.form-add-watch')},500);">提  交</button>
      <?php } ?>
    </div>
  </div>
  <legend></legend>
  <div class="col-xs-24 nopadding normal_input">
    <div class="col-xs-24 text-danger">温馨提示：<strong>补填记录</strong>的同学请把上方的日期改为<span class="lead">值班当天</span>的日期，并确认值班人是<span class="lead">自己的名字</span></div>
  </div>
  <div class="col-xs-24" style="margin:15px 0 20px 0;">
    <h4>抄送邮件给：<input type="text" class="form-control" name="cc_mail_list" value="<?php echo isset($cc_mail_list)?$cc_mail_list:''; ?>" placeholder="填写要抄送的邮箱地址，多个邮箱需用英文分号';'隔开"></h4>
  </div>
  <div class="col-xs-24">
    <label><h4>值班情况</h4></label>
      <textarea class="form-control" id="emailcontent" rows="36" name="emailcontent"><?php echo isset($emailcontent)?htmlspecialchars_decode($emailcontent):''; ?></textarea>
  </div>

</form>

<div class="modal fade" id="myModal-img" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">插入图片</h4>
      </div>
      <div class="modal-body">
        <form action="<?php echo site_url('apps/outlook/index/upload_photos');?>" 
          method="post" 
          target="ifm1"
          class="form-inline form_upload_photos"
          enctype="multipart/form-data">
          <div class="col-xs-24 btn-lg"></div>
          <div class="form-group">
            <label for="宽度">图片</label>
        <input class="form-control" type="file" name="Profile_file" id="Profile_file" />
      </div>
      <div class="col-xs-24 btn-lg"></div>
      <div class="clearfix"></div>
        <div class="form-group col-xs-12 nopadding">
          <label for="宽度">宽度</label>
          <input type="text" class="form-control" id="upload_photo_width" value="500">
        </div>
        <div class="form-group col-xs-12 nopadding-R">
          <label for="高度">高度</label>
          <input type="text" class="form-control" id="upload_photo_height" value="auto">
        </div>
        <div class="col-xs-24 btn-lg"></div>
      <div class="clearfix"></div>
    </form>
    <div id="upload_status1">
         <iframe class="ifm1 hide" name="ifm1"></iframe>
    </div>
      </div>
      <div class="modal-footer">
    <button type="button" class="btn btn-danger pull-right editor_img_upload">确　定</button>
      </div>
    </div>
  </div>
</div>



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

  <script type="text/javascript">
    $('.datepicker').datepicker({});

    var $img_modal=$('#myModal-img');
var doname="<?php echo $_SERVER['HTTP_HOST']; ?>";
var TQE=new tqEditor('emailcontent', 
 {
  toolbar:['mode','paragraph','fontname','fontsize','forecolor','backcolor','bold','italic','underline','strikethrough','removeformat','|','justifyleft','justifycenter','justifyright','unorderedlist','orderedlist','iodent','outdent','indent','|','inserthorizontalrule','createlink','unlink','inserttable','|','insertimage','insertface'],
  toolbarRight:['fullscreen'],
  imageUploadUrl:'./upload.php', 
  linkUploadUrl:'./upload.php',
  faceurl:'http://'+doname+'/js/TQEditor/face'
 });

$(".editor_img_upload").click(function(){
  $(".form_upload_photos").submit();
  $img_modal.modal('hide');
});
function get_photo_url(text){
  var width=$("#upload_photo_width").val();
  var height=$("#upload_photo_height").val();
  var upload_html='<img src="'+text+'" width="'+width+'" height="'+height+'">';
  TQE.insertHtml(upload_html);
}

  </script>