<link rel="stylesheet" href="/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<link rel="stylesheet" href="/js/start_rate/rating_simple.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/start_rate/rating_simple.js"></script> 
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
    $(function() {
        $("#t_expires,#startdate,#enddate").datepicker({
            showButtonPanel: true
        });

        $("#start-rating1").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        $("#start-rating2").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        $("#start-rating3").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        $("#start-rating4").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        $("#start-rating5").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        $("#start-rating6").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        $("#start-rating7").webwidget_rating_simple({
            rating_star_length: '5',
            rating_initial_value: '5',
            rating_function_name: 'set_rate', //this is function name for click
            directory: '/js/start_rate'
        });
        //鼠标经过评分星星的时候弹出提示
        $(".webwidget_rating_simple>li").hover(function() {
            var i = $(this).children('span').text();
            i--;
            var tips = new Array(
                    "Start again with this aspect",
                    "Needs a lot of work",
                    "Definitely needs some work",
                    "Acceptable, but could/should be improved a bit.",
                    "Good work. Nothing more needed.");
            $(this).attr('data-original-title', tips[i]);
            $(this).tooltip('show');
        });

        $(".wait-task").click(function(event) {
            event.preventDefault();
            var url = $(this).attr('href');
            $.post(url, '', function(responseText) {
                var responseText = eval("(" + responseText + ")");//转换为json对象 
                for (var key in responseText) {
                    if (responseText[key].name == 'ok') {
                        alert('已通过该投稿申请！');
                    } else if (responseText[key].name == 'no') {
                        alert('已拒绝该投稿申请！');
                    }
                }
            });
        });
        //根据审核次数计算结算价格
        $("#base_charge").keyup(function() {
            set_price();
        });
        //根据单字价格计算总金额
        $("#word_price,#ta_count").keyup(function() {
            set_price_by_wordprice();
        });

        $("#total-analytics>a").trigger("click");
    })

    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,
            items: [
                'ace', '|', 'fullscreen', '|', 'clearstyle', '|', 'source'
            ],
            afterChange: function() {
                K('#display_count').html(getWordCount(editor.text()));
                var word_count = $('#display_count').text();
                $("#ta_count").val(word_count);
                set_price_by_wordprice();
                //K('#display_count').html(this.count('text'));
            }
        });
    });


    function set_rate() {
        var rating_str = '';
        var totalrating = 0;
        for (var i = 1; i < 8; i++) {
            var rating = $("#start-rating" + i).val();
            rating_str = rating_str + rating + ',';
            totalrating = Number(totalrating) + Number(rating);
        }
        ;
        $("#t_rating").val(rating_str);
        $("#t_rating_total").val(totalrating);
    }

    function set_price() {
        var base_charge = $("#base_charge").val();
        var discount = $("#t_discount").attr('data-discount');
        var total = Number(base_charge) * Number(discount);
        total = parseInt(total);
        $("#total_charge").text(total);
        $("#ta_charge").val(total);
    }

    function set_price_by_wordprice() {
        var word_count = $("#ta_count").val();
        var word_price = $("#word_price").val();
        var base_charge = word_count * word_price;
        $("#base_charge").val(base_charge);
        set_price();
    }
    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('发送');
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                $.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...');
                $(".btn_send_sms").text('发送');
            }
        });
    }

</script>

<div class="row-fluid">
    <div class="span2 ">
        <?php
        echo $nav_view;
        isset($task_detail_list) ? $version_count = count($task_detail_list) : false;
        ?>
    </div>
    <div class="span10">
        <div class="row-fluid">
            <div class="span9">
                <ul id="myTab" class="nav nav-tabs">
                    <li class="<?php
                    echo ($nav_active != 'create_task' and $nav_active != 'in_wait' and ! empty($task->t_a_id) and ! empty($version_count)) ? 'active' : '';
                    echo ($nav_active == 'create_task') ? ' hide ' : '';
                    ?>"><a href="#home" data-toggle="tab">任务详情</a></li>
                    <li class="<?php echo ($nav_active == 'create_task' or $nav_active == 'in_wait' or empty($task->t_a_id) or empty($version_count)) ? 'active' : ''; ?>"><a href="#profile" data-toggle="tab">任务要求</a></li>
                    <div class="btn-group pull-right" >
                        <?php if (!empty($task) && $task->t_status == 'wait') { ?>
                            <a class="btn btn-danger wait-task" href="<?php echo site_url('author/change_wait_tast_status/' . $task->t_id . '/' . $task->t_a_id . '/refuse'); ?>">不通过投稿申请</a>
                            <a class="btn btn-success wait-task" href="<?php echo site_url('author/change_wait_tast_status/' . $task->t_id . '/' . $task->t_a_id . '/edit'); ?>">通过投稿申请</a>
                        <?php } else { ?>
                            <?php (!empty($task) && $task->t_status == 'review') ? $disabled = '' : $disabled = ' hide '; ?>
                            <button class="btn btn-info <?php echo $disabled; ?>" data-toggle="modal" data-target="#review_modal"> 审 核 </button>
                            <?php (!empty($task) && ($task->t_status == 'reviewed' or $task->t_status == 'complete' or $task->t_status == 'published') ) ? $disabled = '' : $disabled = ' hide '; ?>
                            <button class="btn btn-info <?php echo $disabled; ?>" <?php echo $disabled; ?> data-toggle="modal" data-target="#publish_modal">发布</button>
                            <?php //if (empty($task->t_a_id) or $task->t_status == 'complete' or $task->t_status == 'published') { ?>
                            <button class="btn btn-info <?php if ($nav_active == 'create_task' or $task->t_status == 'review' or $task->t_status == 'reviewed') echo 'hide'; ?>"  onclick="$('#form_create_task').attr('action', '<?php echo site_url('author/delete_task') ?>');
                                    if (confirm('是否把删除任务?')) {
                                        submitForm('form_create_task');
                                    }">删除任务</button>
                                    <?php (!empty($task) && ($task->t_status == 'complete' or $task->t_status == 'published' or $task->t_status == 'reviewed')) ? $disabled = 'hide' : $disabled = ''; ?>
                            <button class="btn btn-primary <?php echo $disabled; ?>"  onclick="$('#form_create_task').attr('action', '<?php echo site_url('author/create_task_submit') ?>');
                                    submitForm('form_create_task');">提交要求</button>
                                    <?php //}    ?>
                                <?php } ?>
                    </div>
                </ul>
                <div id="myTabContent" class="tab-content row-fluid">
                    <div class="tab-pane fade <?php echo ($nav_active != 'create_task' and $nav_active != 'in_wait' and ! empty($task->t_a_id) and ! empty($version_count)) ? 'active in' : ''; ?>" id="home">
                        <form method="post" name="form_save_task" id="form_save_task" action="<?php echo site_url('author/save_task_datailinfo'); ?>" class="<?php if (!empty($task) && $task->t_status == 'wait') echo 'hide'; ?>">
                            <div class="media">
                                <strong class="pull-left">
                                    关联信息
                                </strong>
                                <div class="media-body">
                                    <?php if (!empty($information)) { ?>
                                        <a href="<?php echo site_url('/information/edit/' . $information->is_id); ?>" class="btn" target="_blank"><?php echo $information->ic_title; ?></a>
                                    <?php } ?>
                                </div>
                            </div>
                            <p></p>
                            <?php
                            if (!empty($version_count)) {
                                ?>

                                <div class="tabbable tabs-below">

                                    <div class="tab-content">
                                        <?php
                                        foreach ($task_detail_list as $task_key => $task_detail) {
                                            $task_key == 0 ? $active = "active" : $active = "";
                                            $task_key == 0 ? $active_flag = '' : $active_flag = $task_key;
                                            ?>
                                            <div class="tab-pane <?php echo $active; ?>" id="task_version_<?php echo $task_detail->ta_id; ?>">
                                                <div class="span12">
                                                    <div class="span8">
                                                        <div class="control-group">
                                                            <input type="hidden" name="ta_id<?php echo $active_flag; ?>" value="<?php echo $task_detail->ta_id; ?>">
                                                            <label class="control-label">
                                                                信息标题
                                                            </label>
                                                            <div class="controls">
                                                                <input type="text" class="span12" name="ta_title<?php echo $active_flag; ?>" value="<?php echo $task_detail->ta_title; ?>" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="span4">
                                                        <div class="control-group">
                                                            <label class="control-label">提交时间</label>
                                                            <div class="controls">
                                                                <input type="text" class="span12" value="<?php echo date('m/d/Y', strtotime($task_detail->ta_datetime)); ?>" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <label class="control-label">信息内容</label>
                                                <div class="controls">
                                                    <i class="icon-stop icon-white pull-right"></i>
                                                    <i class="icon-stop icon-white pull-right" id="display_count">-</i>
                                                    <textarea rows="8" name="ta_content<?php echo $active_flag; ?>" class="span12 ta_content"><?php echo $task_detail->ta_content; ?></textarea>
                                                </div>
                                                <label>Brief introduction</label>
                                                <textarea rows="3" class="span12" id="ta_summary" name="ta_summary<?php echo $active_flag; ?>" placeholder="Brief introduction"><?php if (isset($task_detail->ta_summary)) echo $task_detail->ta_summary; ?></textarea>                    

                                                <div class="control-group">
                                                    <label class="control-label">SEO标题</label>
                                                    <div class="controls">
                                                        <input type="text" class="span12" name="ta_seo_title<?php echo $active_flag; ?>" value="<?php echo $task_detail->ta_seo_title; ?>" />
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <label class="control-label">SEO描述</label>
                                                    <div class="controls">
                                                        <input type="text" class="span12" name="ta_seo_description<?php echo $active_flag; ?>" value="<?php echo $task_detail->ta_seo_description; ?>" />
                                                    </div>
                                                </div>  

                                                <div class="control-group">
                                                    <label class="control-label">SEO关键词</label>
                                                    <div class="controls">
                                                        <input type="text" class="span12" name="ta_seo_keywords<?php echo $active_flag; ?>" value="<?php echo $task_detail->ta_seo_keywords; ?>" />
                                                    </div>
                                                </div>  

                                                <div class="span12" style="margin:0;">
                                                    <div class="span6 meta_recommend_info_box">
                                                        <label>推荐信息
                                                        </label>
                                                        <input name="meta_recommend_info" id="meta_recommend_info" type="text"  class="form-control" placeholder="124343,8784," value="<?php echo get_meta($task->t_id, 'meta_author_recommend_info'); ?>" autocomplete="off">
                                                    </div>

                                                    <div class="span6 meta_related_info_box">
                                                        <label>相关文章
                                                        </label>
                                                        <input name="meta_related_info" id="meta_related_info" type="text"  class="form-control" placeholder="124343,8784," value="<?php echo get_meta($task->t_id, 'meta_author_related_info'); ?>" autocomplete="off">
                                                    </div>
                                                </div>

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



                                    <ul class="nav nav-tabs">
                                        <?php
                                        foreach ($task_detail_list as $task_key => $task_detail) {
                                            $task_key == 0 ? $active = "active" : $active = "";
                                            ?>
                                            <li class="<?php echo $active; ?>"><a href="#task_version_<?php echo $task_detail->ta_id; ?>" data-toggle="tab">版本<?php echo ($version_count - $task_key) ?></a></li>
                                        <?php } ?>
                                    </ul>
                                    <button type="button" class="btn btn-primary pull-right" onclick="editor.sync();
                                            $('#form_save_task').attr('action', '<?php echo site_url("author/save_task_datailinfo"); ?>');
                                            submitForm('form_save_task');"> 保存修改 </button>
                                </div>
                            <?php } ?>
                        </form>
                    </div>
                    <div class="tab-pane fade <?php echo ($nav_active == 'create_task' or $nav_active == 'in_wait' or empty($task->t_a_id) or empty($version_count)) ? 'active in' : ''; ?>" id="profile">
                        <form action="" class=""  name="form_create_task" id="form_create_task" method="post">
                            <div class="span2">
                                <label class="control-label">任务类型</label>
                                <select class="span12" id="t_td_type" name="t_td_type">
                                    <?php
                                    foreach ($this->config->item('auhtor_task_type') as $type_key => $type_value) {
                                        $selected = '';
                                        if (isset($task)) {
                                            $task->t_td_type == $type_value ? $selected = 'selected' : false;
                                        } elseif ($type_key == '修改') {
                                            $selected = 'selected';
                                        }
                                        ?>
                                        <option value="<?php echo $type_value; ?>" <?php echo $selected ?> ><?php echo $type_key; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="span10">
                                <label class="control-label">任务名称</label>
                                <input type="text" class="span12" id="t_title" name="t_title" placeholder="任务名称" value="<?php echo isset($task) ? $task->t_title : false; ?>" />
                            </div>
                            <label class="control-label">任务要求</label>
                            <textarea rows="8" class="span12" id="t_content" name="t_content" ><?php echo isset($task) ? $task->t_content : false; ?></textarea>

                            <div class="controls controls-row">
                                <div class="span3">
                                    <label class="control-label">截止日期</label>
                                    <input class="span12" size="16" id="t_expires" name="t_expires" type="text" value="<?php echo isset($task) ? date('m/d/Y', strtotime($task->t_expires)) : false; ?>" />
                                </div>
                                <div class="span3">
                                    <label class="control-label">指定作者</label>
                                    <select class="span12" id="t_a_id" name="t_a_id">
                                        <option value="0" <?php echo (isset($task) && ($task->t_a_id == 0)) ? ' selected ' : false; ?>>CHT任务大厅</option>
                                        <option value="-1" <?php echo (isset($task) && ($task->t_a_id == -1)) ? ' selected ' : false; ?> >AH任务大厅</option>
                                        <?php
                                        foreach ($author_list as $author) {
                                            $selected = '';
                                            if (isset($task)) {
                                                $task->t_a_id == $author->a_id ? $selected = 'selected' : false;
                                            }
                                            ?>
                                            <option value="<?php echo $author->a_id; ?>" <?php echo $selected; ?> ><?php
                                                echo $author->a_name . ' -';
                                                echo empty($author->a_sitecode) ? 'cht' : $author->a_sitecode;
                                                ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                                <?php if ($nav_active != 'create_task') { ?>
                                    <div class="span3">
                                        <label class="control-label">审核字数</label>
                                        <span class="span3 uneditable-input"><?php echo empty($task_last_version) ? false : $task_last_version->ta_count; ?></span>
                                    </div>
                                    <div class="span3">
                                        <label class="control-label">审核金额</label>
                                        <span class="span3 uneditable-input"><?php echo empty($task_last_version) ? false : $task_last_version->ta_charge; ?></span>
                                    </div>
                                <?php } ?>
                            </div>
                            <input type="hidden" id="is_id" name="is_id" value="<?php echo!empty($information) ? $information->is_id : false; ?>" >
                            <input type="hidden" id="t_id" name="t_id" value="<?php echo isset($task) ? $task->t_id : false; ?>" >
                        </form>
                        <?php if (!empty($information) && $nav_active == 'create_task') { ?>
                            <div class="media">
                                <strong class="pull-left">
                                    关联信息
                                </strong>
                                <div class="media-body">
                                    <a href="<?php echo site_url('/information/edit/' . $information->is_id); ?>" class="btn" target="_blank"><?php echo $information->ic_title; ?></a>
                                </div>
                            </div>
                        <?php } ?>
                        <?php if (!empty($task->t_attach)) { ?>
                            <div class="row-fluid">附件:<a href="/author/document/task_attach/<?php echo $task->t_attach; ?>"><?php echo $task->t_attach; ?></a> </div>
                        <?php } ?>
                    </div>
                </div>
            </div>

            <div class="span3 well" style="min-height:1024px;">
                <?php if (!empty($task->t_rating)) { ?>
                    <legend class="muted">任务评分</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;" 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>短消息</legend> 
                                        <form action="<?php echo site_url('author/send_to_author'); ?>" class="form-horizontal"  name="form_sms" id="form_sms" method="post">
                                            <textarea rows="3" class="input-block-level" id="m_content" name="m_content" placeholder="短消息" ></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 pull-left" href="javascript:void(0);" onclick="submitsms('form_sms');">发送</a>
                                        </form>
                                        <p>&nbsp;</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;word-break: break-all;" 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 { ?>
                                                            <blockquote class="pull-right">
                                                                <p style="word-wrap:break-word;word-break: break-all;" 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
                                                        }
                                                    }
                                                }
                                                ?>
                                                <?php if (!empty($sms_list)) { ?>
                                                    <?php
                                                    $avatar['me'] = get_author_photo();
                                                    $other_sender = '';
                                                    ?>
                                                    <a data-toggle="modal" href="#sms-modal" id="sms-modal-trigger" class="btn btn-block" data-backdrop="static">更多消息..</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">短消息历史记录</h3>
                                                        </div>
                                                        <div class="modal-body" id="sms-modal-body" style="height:520px;">
                                                            <?php
                                                            if (!empty($sms_list)) {
                                                                krsort($sms_list);
                                                                foreach ($sms_list as $sms) {
                                                                    ?>
                                                                    <?php if ($sms->m_sender == $task->t_a_id) { ?>
                                                                        <?php if ($other_sender == '') $other_sender = get_author_photo($sms->m_sender); ?>
                                                                        <div class="media">
                                                                            <a class="pull-left" href="#">
                                                                                <img class="media-object" src="<?php echo $other_sender; ?>" 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-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 $avatar['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-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 } ?>
                                            </div>
                                        </div>
                                    <?php } ?>
                                    </div>
                                    </div>
                                    </div>
                                    </div>

                                    <?php if (!empty($task)) { ?>
                                        <!-- 审核界面 -->
                                        <div class="modal fade hide" id="review_modal" tabindex="-1" role="dialog" data-backdrop="false" style="width:700px; left:45%;">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                <h3>审核</h3>
                                            </div>
                                            <div class="modal-body">

                                                <form action="<?php echo site_url('author/review_task_submit') ?>" class="form-horizontal"  name="form_review_task" id="form_review_task" method="post">
                                                    <div class="control-group">
                                                        <label class="control-label">是否通过</label>
                                                        <div class="controls">
                                                            <label class="radio inline">
                                                                <input type="radio" name="reviewed" onclick="$('#taskcharge,.ispublish').show();" id="reviewed" value="reviewed" checked>
                                                                通过
                                                            </label>
                                                            <label class="radio inline">
                                                                <input type="radio" name="reviewed" onclick="$('#taskcharge,.ispublish').hide();" id="reviewed" value="edit">
                                                                不通过
                                                            </label>
                                                        </div>
                                                    </div>

                                                    <div class="control-group ispublish">
                                                        <label class="control-label">字数</label>
                                                        <div class="controls">
                                                            <div class="form-inline">
                                                                <input type="text" class="input-medium" name="ta_count" id="ta_count" value="" />
                                                                <input id="word_price" name="word_price" class="input-small" type="text" value="0.25" >
                                                                <label class="checkbox">RMB/字</label>
                                                            </div>
                                                        </div>
                                                    </div>

                                                    <div class="control-group" id="taskcharge">
                                                        <label class="control-label">金额</label>
                                                        <div class="controls">
                                                            <div class="form-inline">
                                                                <input id="base_charge" name="base_charge" class="input-small" type="text" value="0" >
                                                                <label class="checkbox">*</label>
                                                                <span class="input-small uneditable-input" id="t_discount" data-discount="<?php echo $discount[0]; ?>" style="width:50px;"><?php echo $discount[1]; ?></span>
                                                                <label class="checkbox">=</label>
                                                                <span class="input-small uneditable-input" id="total_charge" >0</span>
                                                                <input id="ta_charge" name="ta_charge" class="input-small" type="hidden" value="0" >
                                                                <label class="checkbox">￥</label>
                                                            </div>
                                                        </div>
                                                    </div> 

                                                    <div class="control-group">
                                                        <label class="control-label">审核备注</label>
                                                        <div class="controls">
                                                            <textarea rows="6" class="input-xlarge" id="review_m_content" name="review_m_content" style="width:300px;"></textarea>
                                                        </div>
                                                    </div>
                                                    <!--审核评分-->
                                                    <legend></legend>
                                                    <?php $type = array('English', 'Content', 'Format', 'Marketing Text', 'Links', 'Images', 'HTML'); ?>
                                                    <?php foreach ($type as $k => $t) { ?>
                                                        <div class="control-group" style="margin-bottom:0;">
                                                            <label class="control-label"><?php echo $t; ?></label>
                                                            <div class="controls">
                                                                <input name="start-rating<?php echo $k + 1; ?>" value="5" id="start-rating<?php echo $k + 1; ?>" type="hidden">
                                                            </div>
                                                        </div>
                                                    <?php } ?> 

                                                    <legend></legend>
                                                    <div class="control-group ispublish">
                                                        <label class="control-label">发到信息平台</label>
                                                        <div class="controls">
                                                            <input type="radio" name="ispublish" value="1">发布
                                                            <input type="radio" name="ispublish" value="0" checked>不发布
                                                        </div>
                                                    </div>
                                                    <div class="control-group ispublish">
                                                        <?php if (empty($information)) { ?>
                                                            <label class="control-label">搜索节点</label>
                                                            <div class="controls">
                                                                <input type="text" id="choose_is_ic_name" name="choose_is_ic_name" data-provide="typeahead" data-source='[<?php echo $root_type_list; ?>]'>
                                                            </div>
                                                        <?php } else { ?>
                                                            <label class="control-label">已 绑 定 节 点</label>
                                                            <div class="controls">
                                                                <input type="text" value="<?php echo $information->ic_url_title; ?>">
                                                            </div>
                                                        <?php } ?>
                                                    </div>

                                                    <input type="hidden" id="t_id" name="t_id" value="<?php echo isset($task) ? $task->t_id : false; ?>" >
                                                    <input type="hidden" id="t_rating" name="t_rating" value="5,5,5,5,5,5,5" >
                                                    <input type="hidden" id="t_rating_total" name="t_rating_total" value="35">
                                                    <input type="hidden" name="choose_ic_is_id" value="<?php echo!empty($information) ? $information->is_id : false; ?>" >
                                                </form>
                                            </div>
                                            <div class="modal-footer">
                                                <button class="btn" data-dismiss="modal">取消</button>
                                                <a class="btn btn-primary" href="javascript:void(0);" onclick="submitForm('form_review_task');" >提交审核</a>
                                            </div>
                                        </div>
                                        <!-- 审核界面 end -->


                                        <!-- 发布界面 -->
                                        <div class="modal fade hide" id="publish_modal" tabindex="-1" role="dialog" data-backdrop="false">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                                <h3>发布</h3>
                                            </div>
                                            <div class="modal-body">
                                                <form action="<?php echo site_url('author/publish_task_submit') ?>" class="form-horizontal"  name="form_publish_task" id="form_publish_task" method="post">
                                                    <div class="control-group">
                                                        <?php if (empty($information)) { ?>
                                                            <label class="control-label">搜索节点</label>
                                                            <div class="controls">
                                                                <input type="text" id="selected_is_ic_name" name="selected_is_ic_name" data-provide="typeahead" data-source='[<?php echo $root_type_list; ?>]'>
                                                            </div>
                                                        <?php } else { ?>
                                                            <label class="control-label">已经绑定节点</label>
                                                            <div class="controls">
                                                                <input type="text" value="<?php echo $information->ic_url_title; ?>">
                                                            </div>
                                                        <?php } ?>
                                                    </div>

                                                    <input type="hidden" id="t_id" name="t_id" value="<?php echo isset($task) ? $task->t_id : false; ?>" >
                                                    <input type="hidden" id="ic_is_id" name="ic_is_id" value="<?php echo!empty($information) ? $information->is_id : false; ?>" >
                                                </form>
                                            </div>
                                            <div class="modal-footer">
                                                <button class="btn" data-dismiss="modal">取消</button>
                                                <a class="btn btn-primary" href="javascript:void(0);" onclick="submitForm('form_publish_task');" >提交发布</a>
                                            </div>
                                        </div>
                                        <!-- 发布界面 end -->

                                    <?php } ?>