<div class="col-xs-24 content mail_box">
  
    
      <div style="padding:20px 25px;">
        <form id="form-send-mail" name="form-send-mail" method="post" action="<?php echo site_url('mail/save_mail') ?>">
        <div class="media" style="overflow:visible;">
          <div class="media-left">
            <button type="button" id="btn-send-mail" class="media-object btn btn-default" style="width:80px;height:80px;" data-loading-text="正在发送" onclick="$(this).button('loading');editor.sync();ajaxSubmit('form-send-mail');">发送(S)</button>
          </div>
          <div class="media-body" style="overflow:visible;">
            <div class="input-group" id="auto-complete">
                  <span class="input-group-btn">
                    <button class="btn btn-default" type="button" disabled="disabled">收件人(O)...</button>
                  </span>
                  <input type="text" class="form-control mail_adress_list" id="emaillist" name="emaillist" value="<?php echo $email; ?>" autocomplete="off">
                <ul class="list-unstyled" style="top: 99px; left: 205px;"></ul>
            </div>

            <div class="col-xs-24 btn-sm"></div>
            <div class="form-group input-group" id="auto-complete2">
                  <span class="input-group-btn">
                    <button class="btn btn-default" type="button" disabled="disabled">抄　送(C)...</button>
                  </span>
                  <input type="text" class="form-control mail_adress_list" id="cs_emaillist" name="cs_emaillist" value="<?php echo isset($cs_emaillist)?$cs_emaillist:''; ?>" autocomplete="off">
                <ul class="list-unstyled" style="top: 143px; left: 204px; display: none;"></ul>
            </div>

          </div>
        </div>
        <div class="form-group input-group">
          <div class="input-group-btn">
            <button type="button" class="btn btn-default" style="width:92px;cursor:default;background:#fff !important;" disabled="disabled">主　题</button>
          </div>
          <input type="text" class="form-control" name="mail_subject" id="mail-subject" value="<?php echo isset($mail_subject)?$mail_subject:''; ?>" autocomplete="off">
          <div class="input-group-btn">
            <input type="text" class="form-control" name="mail_o_orderno" value="<?php echo $orderno==0?'':$orderno; ?>" style="width:150px;border-left:none;" placeholder="订单号">
          </div>
        </div>

        <div class="form-group">
          <textarea class="init_editor" id="mail_content" name="mail_content" ><?php echo isset($mail_body)?htmlspecialchars_decode($mail_body):''; echo isset($template->tp_content)?$template->tp_content:''; ?></textarea> 
        </div>
        <?php $attachments=isset($attachments)?$attachments:array();foreach ($attachments as $a) { if(!empty($a)){ $attach=explode('|@@|', $a); $filename_arr=explode('.', $attach[1]); $file_base_path=rtrim(rtrim(FCPATH,'\\'),'/'); ?>
            <input type="hidden" name="attachments[]" value="<?php echo $file_base_path.$attach[2]; ?>|<?php echo end($filename_arr); ?>|<?php echo $attach[3]; ?>|<?php echo $attach[1]; ?>">
        <?php } } ?>
        </form>
        
        <div id="upload-attachs-box" class="form-group" style="margin-bottom:7px;position:relative;">
            <a href=""><span class="glyphicon glyphicon-paperclip" style="padding-right:5px;"></span>添加附件：</a>
            <form action="<?php echo site_url('mail/editor_upload/file'); ?>" 
                method="post" 
                target="ifm1"
                class="form-horizontal"
                enctype="multipart/form-data" style="position:absolute;z-index:10;left: 0;top: 0;">
              <input style="filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity: 0;opacity: 0; height: 20px;width: 85px;cursor: pointer;" type="file" name="editorfile" onChange="this.form.submit()" />
            </form>
            <div id="upload_status1" class="hidden">
              <iframe class="ifm1" name="ifm1"></iframe>
            </div>

            <?php $attachments=isset($attachments)?$attachments:array(); foreach ($attachments as $a) { if(!empty($a)){ $attach=explode('|@@|', $a); $filename_arr=explode(':', $attach[1]); ?>
               <a href="javascript:void(0);"><?php echo $filename_arr[0]; ?></a>，
            <?php } } ?>

        </div>
    
      </div>

  
</div>



<script type="text/javascript">
  function set_attach(file_path,file_ext,file_type,file_name,orig_name) {
    $("#upload-attachs-box").append('<a href="javascript:void(0);">'+orig_name+'；</a>');
    $("#form-send-mail").append('<input type="hidden" name="attachments[]" value="'+file_path+'|'+file_ext+'|'+file_type+'|'+orig_name+':'+file_name+'">');
  }
</script> 