<link rel="stylesheet" href="/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css">
<script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script language="javascript">   

    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('#ta_content', {
            width : '100%',
            height:'480px',
            newlineTag: 'p',
            //fileManagerJson:'/js/kcfinder/browse.php',
            //allowFileManager:true,
            allowImageUpload:false,
			filterMode : false,
			langType : 'en',
            items : [
                'ace', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|', 
                'clearhtml', 'quickformat','removeformat', 'selectall',  '/','fullscreen', '|',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight',  '|', 'table', 'hr', 'emoticons','image', 'map',  'pagebreak',
                'link', 'unlink', '|','clearstyle', 'about', '|', 'source'
            ],
            afterChange: function() {
                K('#display_count').html(getWordCount(editor.text()));
            },
        });
    });

    //加载预览样式
    function load_preview_css(){
        $("iframe.ke-edit-iframe").contents().find("head").append('<?php echo $this->config->item("css_source_".$this->config->item("site_code")); ?><style>.drop1{height:auto !important;} .photoRight img{max-width:100%;height:auto !important;}</style>');
        $("iframe.ke-edit-iframe").contents().find(".ke-content").css({"max-width":"1024px","margin-left":"auto","margin-right":"auto"});
    
    }

    $(document).ready(function() {
      setTimeout(function(){
        $("iframe.ke-edit-iframe").contents().find("head").append('<link href="http://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css&amp;v=20140915" rel="stylesheet"><style>.drop1{height:auto !important;} .photoRight img{max-width:100%;height:auto !important;}</style>');
        $("iframe.ke-edit-iframe").contents().find(".ke-content").css({"max-width":"1024px","margin-left":"auto","margin-right":"auto"});
      },1000);
        //每隔三分钟自动保存一次任务内容
        setInterval(function(){
          if ($(".autosave").hasClass("hide")==false) {
              editor.sync();
              var data=$('#form_article').serialize();
              var url= '<?php echo site_url('welcome/edit_submit') ?>';
              $.post(url,data,function(responseText){
                var responseText=eval("("+responseText+")");//转换为json对象 
                  for (var key in responseText) {
                    if (responseText[key].name != 'ok') {
                       $("#auto-save").html('(自动保存失败...)');
                    }
                  }
              });
          };
        }, 30000);

        //ajax获取获取google分析数据的日期设置
        $("#startdate,#enddate").datepicker({
            showButtonPanel: true
        });
        $("#total-analytics>a").trigger("click");

        $("#rating-container>ul>li").hover(function(){
            $(this).tooltip('show');
        });

        change_seo_count('ta_summary');
        change_seo_count('ta_seo_title');
        change_seo_count('ta_seo_description');

        init_recommend_popover("#meta_recommend_info",".meta_recommend_info_box");
        init_recommend_popover("#meta_related_info",".meta_related_info_box");

    });

	
	//快速图片上传
	function openKCFinder_ta_photo() {
		window.CallBack=openKCFinder_ta_photo_callback;
		window.open('/media/popselectpicture.php?site_lgc=1&remote=true', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600' );
	} 
	
	function openKCFinder_ta_photo_callback(result) {
		if (result != null && result.Pinfo[0]) {
			$('#ta_photo').val(result.Pinfo[0].PUrl);
			$("#ta_photo_img").attr("src","<?php echo $this->config->item('media_image_url'); ?>"+result.Pinfo[0].PUrl);
		}  
	}
	
    //选择内容图片
    function openKCFinder_Content() {
        window.CallBack=openKCFinder_Content_callback;
        window.open('/media/popselectpicture.php?site_lgc=1&remote=true', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600' );
    }
    function openKCFinder_Content_callback(result) {
        var site_image_url='<?php echo $this->config->item('media_image_url') ?>';
        if (result != null){
  				for(var key in result.Pinfo){
            editor.insertHtml('<div class="photoBlock300 autowidht" id="yonglaidingweitupian"> <img src="'+site_image_url+result.Pinfo[key].PUrl+'" alt="'+result.Pinfo[key].PName+'" width="'+result.Pinfo[key].Width+'" height="'+result.Pinfo[key].Height+'" />' + result.Pinfo[key].Sinfo + '</div>');
            var yonglaidingweitupian=$("iframe.ke-edit-iframe").contents().find("#yonglaidingweitupian");
            if (yonglaidingweitupian.parents('p').length>0) {
                yonglaidingweitupian.parents('p').before('<div class="photoBlock300 autowidht">'+yonglaidingweitupian.html()+'</div>');
                yonglaidingweitupian.remove();
            }else{
              yonglaidingweitupian.attr('id','');
            }
  			  }
        }
    }

    function get_analytics_ajax(formid,contentid,loadtotal){
        var url= $("#"+formid).attr('action')+'/'+loadtotal;
        var data = $("#"+formid).serialize();
        $("#"+contentid).html('<img src="/css/images/loading.gif" >');
        $.post(url,data,function(result){
            $("#"+contentid).html(result);
        });
    }

    function show_msg(a,type){
        if (type=='data-short') {
            var contenttype='data-long';
            var flag=' >> ';
        }else{
            var contenttype='data-short';
            var flag=' << ';
        }
        var content=$(a).parent('p').attr(type);
        $(a).parent('p').text(content).append('<a href="javascript:void(0);" onclick="show_msg(this,'+"'"+contenttype+"'"+');"> '+flag+' </a>');
    }

    function submitsms(formID){
      $(".btn_send_sms").text('loading');
      var $form=$("#"+formID);
      var data=$form.serialize();
      var url=$form.attr('action');
      $.ajax({
        type: "post",
        url: url,
        dataType: "json",
        data: data,
        success: function(json_data) {
          for (var key in json_data) {
            if (json_data[key].name == 'ok') {
              var smstext=$("#m_content").val();
              var data_short=smstext.substr(0,100);
              var myDate = new Date();
              var other_html='';
              if (data_short!=smstext) {
                other_html='<a href="javascript:void(0);" onclick="show_msg(this,\'data-long\');"> &gt;&gt; </a>';
              };
              var sms='<blockquote><p style="word-wrap:break-word;" data-long="'+smstext+'" data-short="'+data_short+'">'+data_short+other_html+'</p><small>'+myDate.toLocaleString();+'</small></blockquote>';
              $("#short_sms_container").prepend(sms);
              $("#m_content").val('');
            }else if (json_data[key].name == 'no') {
              $.modaldialog.error('发送失败...');
            }
          }
          $(".btn_send_sms").text('Send');
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
          $(".btn_send_sms").text('Send');
          $.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...');
        }
      });
    }

    function init_recommend_popover(elem,container){
        $(elem).popover({
            'container':container,
            'title':'title',
            'content':function(){},
            'placement':'bottom',
            'trigger':'click',
            'template':'<div style="width:500px;min-height: 500px;overflow: hidden;" class="popover recommend_info_popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title hidden" style="display:none;"></h3><div class="popover-content" style="width:500px;"></div><div class="span12" style="background:#eee;margin-left:0; padding: 8px 10px 0 10px;margin-top: -19px;border-bottom:1px solid #ddd;"><div class="span11" style="padding-left:0;"><div class="input-group"><input type="text" class="form-control" id="article_key" name="article_key" placeholder="page URL, title, or keyword(s)" style="width:355px;"><span class="input-group-btn"><button class="btn btn-default" id="btn_search_article_list" type="button" style="margin-top: -10px;">search</button></span></div></div><div class="span1" style="border-left:1px solid #bbb;height:32px;line-height:38px;font-size:18px;text-align: center;"><a href="javascript:void(0);" onclick="$(\'#meta_recommend_info\').popover(\'hide\');$(\'#meta_related_info\').popover(\'hide\');$(\'#meta_bread_info\').popover(\'hide\');" class="icon-remove text-danger"></a></div></div><div class="span12" id="recommended_list" style="padding-right: 20px;"></div><div class="span12" id="recommend_list" style="padding-left:0;padding-right: 10px;max-height:500px;overflow-y: scroll;margin-right: -15px;float: right;"></div><div class="span12" id="recommended_tips">To recommend similar articles/pages readers might be interested in (instead of in the task pane):<br /><br /><ul><li>Put your mouse arrow in the box below and click to make the search box appear.</li><li>Enter title/keyword(s)/URL to bring up a list of pages to recommend. </li><li>“Add” what your want to recommend.</li><li>Click “Save links” when everything is done, before saving/submitting the task. </li></ul></div></div>'
        });
        $(elem).on('shown.bs.popover', function () {
            var right_offset=document.documentElement["clientWidth"]-$(elem)[0].getBoundingClientRect().right;
            if (right_offset<300) {
                $(elem).next(".recommend_info_popover").attr('style',"left:"+(-(400-right_offset))+"px !important;display: block;");
            };
            var ic_id_list=$(elem).val();
            if (ic_id_list=='' || $("#recommended_list").html()!='') {
                return false;
            };
            $("#recommended_list").html('<img src="/css/images/loading.gif" >');
            var url="<?php echo site_url('/welcome/search_by_icid'); ?>";
            $.post(url,{"ic_id_list":ic_id_list},function(html){
                 $("#recommended_list").html(html);
            });
        }).on('hidden.bs.popover',function(){
            setTimeout(function(){
                $(".recommend_info_popover").remove();
            },0);
        });

        $("body").on("click","#btn_search_article_list",function(){
            $("#recommend_list").html('<img src="/css/images/loading.gif" >');
            var url="<?php echo site_url('/welcome/search'); ?>";
            var key=$("#article_key").val();
            var ic_id_list=$(elem).val();
            $.post(url,{'keywords':key,"ic_id_list":ic_id_list},function(html){
                $("#recommend_list").html(html);
            });
        });
    }

    //自定义选项设置
function author_meta(meta_act, im_ic_id, im_key, im_value) {
    if (meta_act == 'save') {
        var url = "/author.php/welcome/save_meta";
    }
    if (meta_act == 'delete') {
        if (confirm('Delete it?')) {
            var url = "/author.php/welcome/delete_meta";
        } else {
            return false;
        }
    }
    $.ajax({
        type: "post",
        dataType: "json",
        url: url,
        data: {
            'im_ic_id': im_ic_id,
            'im_key': im_key,
            'im_value': im_value
        },
        success: function(data, textStatus) {
            for (var key in data) {
                if (data[key].name == 'ok') {
                    $.modaldialog.success(data[key].value);
                    return true;
                } else {
                    $.modaldialog.error(data[key].value);
                }
            }
        },
        error: function() {
            $.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...');
        }
    });
}
	
</script>
<div class="row-fluid">
<div class="span10 offset1">
  <div class="span9">
    <div class="">
      <legend>Task Requirement</legend>
      <div style="background:#f5f5f5;padding:15px;margin-bottom:15px;">
      <div class="row-fluid">
        <div class="span12">
          <strong>Task name:</strong>:
          <?php echo $task->t_title; ?>
        </div>
      </div>
  <div class="row-fluid">
    <div class="span3">
        <strong>Task type:</strong>
        <?php echo $task->t_td_type; ?>
    </div>
    <div class="span3">
        <strong>Sent by:</strong>
        <?php echo get_author_name($task->t_ht_op_code); ?>
    </div>
    <div class="span6">
        <strong>Task Deadline:</strong>
        <?php echo date('m/d/Y',strtotime($task->t_expires)); ?>
    </div> 
  </div>
  <div class="row-fluid">
    <div class="span12">
      <p><strong>Task requirement：</strong><?php echo htmlspecialchars($task->t_content); ?></p>
    </div>
  </div>
  <?php if(!empty($task->t_attach)){ ?>
  <div class="row-fluid">
      <strong>Task attachment：</strong>
      <a target="_blank" href="/author/document/task_attach/<?php echo $task->t_attach; ?>"><?php echo $task->t_attach; ?></a>
  </div>
  <?php } ?>
  </div>

             <legend>
                <span>Task Details</span>
                <span class="pull-right <?php if(!isset($task_status) or $task_status==0) echo 'hide';?>" style="font-size:14px;" id="total-analytics">
                  <a href="javascript:void(0);" onClick="get_analytics_ajax('get-analytic-form','total-analytics','1');">获取google分析汇总数据</a>
                </span>
            </legend>
             
             <form action="#" class=""  name="form_article" id="form_article" method="post">
                <div class="media hide">
                  <strong class="pull-left">
                    Link
                  </strong>
                  <div class="media-body">
                    <?php if (!empty($information)){ ?>
                             <a href="http://www.chinahighlights.com<?php echo $information->ic_url; ?>" class="btn" target="_blank"><?php echo $information->ic_title; ?></a>
                    <?php } ?>
                  </div>
                </div>
                <p> </p>
                    <label class="control-label" ><strong>Page Title (a must)</strong></label>
                    <input type="text" class="span12" id="ta_title" name="ta_title" placeholder="Title" value="<?php if(isset($task_detail->ta_title))echo $task_detail->ta_title; ?>">
                    
                    <label><strong>Content</strong><em id="auto-save" class="small"></em></label>
                     <a href="javascript:void(0);" onclick="openKCFinder_Content();" title="Insert an image"><i class="icon-picture pull-right"></i></a>
                     <i class="icon-stop icon-white pull-right"></i>
                     <i class="icon-stop icon-white pull-right" id="display_count">-</i>
                     <textarea rows="12" class="span12" id="ta_content" name="ta_content"><?php if(isset($task_detail->ta_content))echo $task_detail->ta_content; ?></textarea>                      
                      
                    <p> </p>
                    <label><strong>Brief Introduction</strong> ( <120 characters) <em class="pull-right muted" id="ta_summary_count"></em></label>
                    <textarea rows="3" class="span12" id="ta_summary" name="ta_summary" onkeyup="change_seo_count(this.id);" placeholder="Brief introduction"><?php if(isset($task_detail->ta_summary))echo $task_detail->ta_summary; ?></textarea>                    
                    <label class="control-label" ><strong>SEO Title</strong> (20-68 characters)<span class="glyphicon glyphicon-question-sign" style="background:#333;font-size:12px;padding:1px 5px; color:#fff;border-radius:25px;cursor:pointer;" data-toggle="modal" data-target="#seo_description_modal">?</span> <em class="pull-right muted" id="ta_seo_title_count"></em></label>
                      <input type="text" class="span12" id="ta_seo_title" name="ta_seo_title" onkeyup="change_seo_count(this.id);" placeholder="SEO title" value="<?php if(isset($task_detail->ta_seo_title))echo $task_detail->ta_seo_title; ?>">
                    
                    <label class="control-label" ><strong>SEO Description</strong> （80-160 characters）<span class="glyphicon glyphicon-question-sign" style="background:#333;font-size:12px;padding:1px 5px; color:#fff;border-radius:25px;cursor:pointer;" data-toggle="modal" data-target="#seo_description_modal">?</span><em class="pull-right muted" id="ta_seo_description_count"></em></label>
                      <input type="text" class="span12" id="ta_seo_description" name="ta_seo_description" onkeyup="change_seo_count(this.id);" placeholder="SEO discription" value="<?php if(isset($task_detail->ta_seo_description))echo $task_detail->ta_seo_description; ?>">
                    
                    <label class="control-label" ><strong>SEO Keywords</strong></label>
                      <input type="text" class="span12" id="ta_seo_keywords" name="ta_seo_keywords" placeholder="SEO keyworkds" value="<?php if(isset($task_detail->ta_seo_keywords))echo $task_detail->ta_seo_keywords; ?>">
               
                    <div class="span12 meta_recommend_info_box" style="margin:0;">
                            <label><strong>You Might Like</strong> (recommended related pages, 1-4)
                                <a href="javascript:void(0);" onclick="author_meta('delete', '<?php echo $task->t_id; ?>', 'meta_author_recommend_info', $('#meta_recommend_info').val())"><i class="icon-remove"></i></a>
                                <a href="javascript:void(0);" onclick="author_meta('save', '<?php echo $task->t_id; ?>', 'meta_author_recommend_info', $('#meta_recommend_info').val())"><i class="icon-list-alt" title="Save Recommendations"></i></a>
                                <i class="icon-question-sign" title="To recommend similar articles/pages readers might be interested in"></i>
                            </label>
                            <input name="meta_recommend_info" id="meta_recommend_info" type="text"  class="span12" placeholder="124343,8784," value="<?php echo get_meta($task->t_id, 'meta_author_recommend_info'); ?>" autocomplete="off">
                    </div>

                    <div class="span12 meta_related_info_box" style="margin:0;">
                            <label><strong>Related Articles</strong> (other particularly relevant pages,1–8)
                                <a href="javascript:void(0);" onclick="author_meta('delete', '<?php echo $task->t_id; ?>', 'meta_author_related_info', $('#meta_related_info').val())"><i class="icon-remove"></i></a>
                                <a href="javascript:void(0);" onclick="author_meta('save', '<?php echo $task->t_id; ?>', 'meta_author_related_info', $('#meta_related_info').val())"><i class="icon-list-alt" title="Save Recommendations"></i></a>
                                <i class="icon-question-sign" title="To recommend similar articles/pages readers might be interested in"></i>
                            </label>
                            <input name="meta_related_info" id="meta_related_info" type="text"  class="span12" placeholder="124343,8784," value="<?php echo get_meta($task->t_id, 'meta_author_related_info'); ?>" autocomplete="off">
                    </div>
               <div>
                <label class="control-label" ><strong>List Picture</strong> (if possible for article/attraction pages)</label>
                <div class="media">
                  <div class="pull-left">
                    <img style="width:250px;" onclick="openKCFinder_ta_photo();" src="<?php echo empty($task_detail->ta_photo)?'/css/images/uploadPic.jpg':$this->config->item('media_image_url').$task_detail->ta_photo; ?>" class="img-polaroid span4" name="ta_photo_img" id="ta_photo_img" >
                  </div>
                  <div class="media-body">
                    <button type="button" onclick="openKCFinder_ta_photo();" class="btn" style="margin:25px 0;">Choose</button><br>
                    <button type="button" onclick="$('#ta_photo').val('');$('#ta_photo_img').attr('src','/css/images/uploadPic.jpg');" class="btn" style="margin-bottom:12px;"> Reset　</button>
                    <p>Use our gallery for images,</p>
                    <p>Click the “Choose” button<br> to choose a photo from our Photo Galleries.</p>                  
                  </div>
                </div>
                
                
                <input type="hidden" name="ta_photo" id="ta_photo" value="<?php if(isset($task_detail->ta_photo))echo $task_detail->ta_photo; ?>" />
                <input type="hidden" name="ht_user" value="<?php echo $task->t_ht_op_code; ?>">
                <input type="hidden" name="t_a_id" value="<?php echo $task->t_a_id; ?>">
                <input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
                <input type="hidden" id="ta_ic_id" name="ta_ic_id" value="<?php if(isset($task_detail->ta_ic_id))echo $task_detail->ta_ic_id; ?>" >
                </div>
                
            </form> 
            

            <div class="btn-group pull-right">
                <?php (!empty($task->t_a_id) && ($task->t_status=='edit' or $task->t_status=='unreviewed'))?$disabled='':$disabled=' hide ';?>
                <button class="btn btn-info autosave <?php echo $disabled; ?>" onclick="editor.sync();$('#form_article').attr('action','<?php echo site_url('welcome/edit_submit') ?>');submitForm('form_article');">Save</button>
                <button class="btn btn-info <?php echo $disabled; ?>" onclick="editor.sync();$('#form_article').attr('action','<?php echo site_url('welcome/review_submit') ?>');submitForm('form_article');">Submit</button>

                <?php empty($task->t_a_id)?$disabled='':$disabled=' style="display:none;" ';?>
                <button class="btn btn-info" <?php echo $disabled; ?> data-toggle="modal" data-target="#undertake_modal">Accept the task</button>
                <?php (!empty($task->t_a_id) && $task->t_status=='edit' )?$disabled='':$disabled=' style="display:none;" ';?>
                <?php // 不允许放弃任务
                if(false){
                ?>
                <button class="btn btn-info" <?php echo $disabled; ?> data-toggle="modal" data-target="#canceltake_modal">Give up the tasks</button>
                <?php } ?>
                <p> </p>
            </div>
          </div>

  </div>
  <div class="span3 well" style="min-height:1500px;">
    <?php if(!empty($task->t_rating)){ ?>
    <legend class="muted">Word / Amount count</legend>
    <p>Word count：<?php echo empty($task_last_version)?0:$task_last_version->ta_count; ?></p>
    <p>Amount count：<?php echo empty($task_last_version)?0:$task_last_version->ta_charge; ?></p><br>
    <legend class="muted">Task Score</legend>
    <div id="rating-container">
                <ul style="list-style: none;margin-left: 0;">
                  <?php 
                    $type=array('English','Content','Format','Marketing Text','Links','Images','HTML');
                    $rating_tips=array(
                      1=>'Start again with this aspect',
                      2=>'Needs a lot of work',
                      3=>'Definitely needs some work',
                      4=>'Acceptable, but could/should be improved a bit.',
                      5=>'Good work. Nothing more needed.'
                    );
                    $rating=explode(',',$task->t_rating);
                  ?>
                  <?php foreach ($type as $k=>$v) { ?>
                      <li style="margin-bottom:5px;" data-original-title="<?php if(isset($rating[$k]) && isset($rating_tips[$rating[$k]])) echo $rating_tips[$rating[$k]]; ?>">
                        <span><?php echo $v; ?>：<span>
                        <?php 
                          if(isset($rating[$k])){
                            for ($i=0; $i < $rating[$k]; $i++) {
                        ?>
                             <img src="/js/start_rate/sth.gif">   
                        <?php
                            }
                          }
                        ?>
                      </li>
                  <?php } ?>
                </ul>
            </div>
            <?php } ?>
           <?php if(!empty($task->t_a_id)){ ?>
            <a name="sms"></a>
            <legend class="muted">Short message</legend> 
            <form action="<?php echo site_url('welcome/send_to_admin'); ?>" class="form-horizontal"  name="form_sms" id="form_sms" method="post">
                  <textarea rows="3" class="span12" id="m_content" name="m_content" placeholder="Short message" ></textarea>
                  <input type="hidden" id="t_id" name="t_id" value="<?php echo isset($task)?$task->t_id:false; ?>" >
                  <p> </p>
                  <a class="btn btn_send_sms <?php if($task->t_a_id!=$admin_info_user) echo 'hide'; ?>" href="javascript:void(0);" onclick="submitsms('form_sms');">Send</a>
            </form>
            <p> </p>
            <div id="short_sms_box">
            <div id="short_sms_container">
            <?php
             if(!empty($sms_list)){
                foreach($sms_list as $k=>$sms){
                    if ($k>2) break;
                    $content=get_text_short(htmlspecialchars($sms->m_content),50,'...');
                    if($sms->m_sender==$task->t_a_id){
            ?>
              <blockquote>
                <p style="word-wrap:break-word;" data-long="<?php echo htmlspecialchars($sms->m_content); ?>" data-short="<?php echo htmlspecialchars($content['content']); ?>">
                  <?php echo htmlspecialchars($content['content']); ?>
                  <?php if($content['length']){ ?> 
                      <a href="javascript:void(0);" onclick="show_msg(this,'data-long');"> >> </a> 
                  <?php } ?>
                </p>
               <small><?php echo get_author_name($sms->m_sender); ?> <?php echo date('m/d/Y H:i:s',strtotime($sms->m_datetime)); ?></small>
              </blockquote>
              <div class="clearfix"></div>
            <?php }else{ ?>

              <?php if(!isset($other_sender)) $other_sender=$sms->m_sender; ?>
              <blockquote class="pull-right">
              <p style="word-wrap:break-word;" data-long="<?php echo htmlspecialchars($sms->m_content); ?>" data-short="<?php echo htmlspecialchars($content['content']); ?>">
                <?php echo htmlspecialchars($content['content']); ?>
                <?php if($content['length']){ ?> 
                    <a href="javascript:void(0);" onclick="show_msg(this,'data-long');"> >> </a> 
                <?php } ?>
              </p>
               <small><?php echo get_author_name($sms->m_sender); ?> <?php echo date('m/d/Y H:i:s',strtotime($sms->m_datetime)); ?></small>
              </blockquote><div class="clearfix"></div>
            
            <?php 
                }
              }
            } 
            ?>

            <!--短消息历史记录start-->
            <?php if(!empty($sms_list)){ ?>
            <a data-toggle="modal" href="#sms-modal" id="sms-modal-trigger" class="btn btn-block" data-backdrop="static">More Message..</a>
            <div id="sms-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;width:75%;left:32%;">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                  <h3 id="myModalLabel">Message History</h3>
                </div>
                <div class="modal-body" id="sms-modal-body" style="height:450px;">
                  <?php if (!empty($sms_list)) { krsort($sms_list); foreach ($sms_list as $sms) { ?>
                    <?php if(!isset($other_sender)) $other_sender=$sms->m_sender; ?>
                    <?php $avatars['me']=get_author_photo($task->t_a_id); if(isset($other_sender))$avatars['other']=get_author_photo($other_sender); ?>
                    <?php if($sms->m_sender!=$task->t_a_id){ ?>

                    <div class="media">
                      <a class="pull-left" href="#">
                        <img class="media-object" src="<?php echo $avatars['other'];?>" width="45" height="45">
                      </a>
                      <div class="media-body">
                        <div class="media">
                          <small><?php echo get_author_name($sms->m_sender); ?>　<?php echo date('Y-m-d H:i:s', strtotime($sms->m_datetime)); ?></small>
                          <p style="word-break: break-all; word-wrap:break-word;"><?php echo htmlspecialchars($sms->m_content); ?></p>
                        </div>
                      </div>
                    </div>
                    
                  <?php }else{ ?>
                    <div class="media">
                      <a class="pull-right" href="#">
                        <img class="media-object" src="<?php echo $avatars['me'];?>" width="45" height="45">
                      </a>
                      <div class="media-body">
                        <div class="media">
                          <small class="pull-right"><?php echo get_author_name($sms->m_sender); ?>　<?php echo date('Y-m-d H:i:s', strtotime($sms->m_datetime)); ?></small>
                          <p class="pull-right" style="word-break: break-all; word-wrap:break-word; clear:both;"><?php echo htmlspecialchars($sms->m_content); ?></p>
                        </div>
                      </div>
                    </div>
                  <?php } }} ?>
                </div>
                <div class="modal-footer"></div>
            </div>
            <script type="text/javascript">
              $("#sms-modal-trigger").click(function(){
                setTimeout(function(){
                    $("#sms-modal-body").scrollTop(102400);
                },500);
              });
            </script>
            <?php } ?>
            <!--短消息历史记录end-->
            </div>
            </div>

           <?php } ?>
        
  </div>
  </div>
</div>

<!-- 承接任务 -->
<div class="modal fade" id="undertake_modal" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3>Accept the task</h3>
  </div>
  <div class="modal-body">
    <p>Make sure again.</p>
	<form action="<?php echo site_url('taskhall/undertake') ?>"   name="form_undertake" id="form_undertake" method="post">
		<input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
	</form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
    <button class="btn btn-primary" onclick="submitForm('form_undertake');">Yes</button>
  </div>
</div>

<!-- 放弃任务 -->
<div class="modal fade" id="canceltake_modal" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3>Give up the task</h3>
  </div>
  <div class="modal-body">
    <p>Make sure again.</p>
	<form action="<?php echo site_url('taskhall/canceltake') ?>"   name="form_canceltake" id="form_canceltake" method="post">
		<input type="hidden" id="t_id" name="t_id" value="<?php echo $task->t_id; ?>" >
	</form>	
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
    <button class="btn btn-primary" onclick="submitForm('form_canceltake');">Yes</button>
  </div>
</div>

<!--成效信息展示modal-->
<div id="myModal" class="modal hide fade" style="width:90%;left:25%;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <div id="myModalLabel" style="line-height:30px;">
        <h3 class="span5 pull-left">Web View</h3>
        <form style="margin-bottom:0px;" id="get-analytic-form" method="post" action="<?php echo site_url('welcome/get_analytics_by_date'); ?>">
            <input class="span2 pull-left" style="margin-bottom:0;" size="16" id="startdate" name="startdate" type="text" value="start date">
            <input class="span2 pull-left" style="margin-bottom:0;" size="16" id="enddate" name="enddate" type="text" value="end date">
            <input type="hidden" name="pagepath" value="<?php if (!empty($information)) echo $information->ic_url; ?>">
            <input type="hidden" name="sitecode" value="<?php if (!empty($information)) echo $information->ic_sitecode; ?>">
            <button type="button" class="btn" onClick="get_analytics_ajax('get-analytic-form','analytics-content','0');">search</button>
        </form>
    </div>
  </div>
  <div class="modal-body" id="analytics-content">
    
  </div>
</div>


<div class="modal fade" id="seo_description_modal" style="width:58%;left:39%;" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-header" style="border:none;">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  </div>
  <div class="modal-body">
    <img src="/css/images/seo_descriptions.jpg">
  </div>
</div>