{% set file =  files[task.activityId]|default(null) %}
<li class="task-manage-item js-task-manage-item drag clearfix " id="task-{{ task.id }}">
  <div class="item-line"></div>
  <div class="item-content  js-item-content text-overflow">
    <i class="es-icon {{ activity_metas(task.activity.mediaType).icon }} mrm" data-role="task"></i>
    {% if task.isOptional %}
      <span class="label label-info mrm">选修</span>
    {% else %}
      任务<span class="number">{{ task.number }}</span>：
    {% endif %}
    {{ task.title|sub_text(30) }}
    <span class="color-warning publish-status {% if task.status == 'published' %}
      hidden {% endif %}">(未发布)</span>

    {% if file and file.storage == 'cloud' and file.type in ['ppt', 'document','video'] and file.convertStatus == 'error' %}
      <span class="label label-danger ml5">转码失败</span>
    {% elseif file and file.storage == 'cloud' and file.type in ['ppt', 'document','video'] and file.convertStatus != 'success' %}
      <span class="label label-warning ml5">转码中</span>
    {% endif %}

    {% if task.activity.mediaType is same as('live') %}
      {% if not task.activity.ext.roomCreated|default(true) %}
        <span class="color-warning">{{ '编辑以创建直播教室'|trans }}</span>
      {% elseif task.activity.endTime < date().timestamp %}
        <span class="color-gray">{{ '直播已经结束'|trans }}</span>
      {% else %}
        <span class="color-success mls">
        {{ task.activity.startTime|date('Y-n-j H:i')|trans }} ~ {{ task.activity.endTime|date('H:i')|trans }}</span>
      {% endif %}
    {% else %}
      {% if task.activity.length|activity_length_format %}<span class="color-gray mls">
        （{{ task.activity.length|activity_length_format }}）</span>{% endif %}
    {% endif %}
  </div>
  <div class="item-actions">
    <a class="btn gray-darker" data-role='update-task' href="javascript:;" data-toggle="modal" data-target="#modal"
      data-url="{{ path('course_manage_task_update', {id:task.id,courseId:task.courseId}) }}"><i
        class="es-icon es-icon-edit mrs"></i>编辑</a>
    <a class="btn gray-darker" href="{{ path('course_task_show', {id:task.id,courseId:task.courseId,preview:1}) }}"
      target="_blank"><i class="es-icon es-icon-removeredeye mrs"></i>预览</a>
    <span class="dropdown">
      <a class="dropdown-toggle dropdown-more btn gray-darker" id="dropdown-more" data-toggle="dropdown" href="#"><i
          class="es-icon es-icon-keyboardarrowdown mrs" aria-haspopup="true"
          aria-expanded="false"></i>{{ '更多'|trans }}
      </a>
      <ul class="dropdown-menu pull-right dropdown-menu-more" role="menu" style="margin-top:12px;min-width:144px"
        aria-labelledby="dLabel" style="display:none;">

        {% if task.type == 'video' and setting('storage.upload_mode') == 'cloud' %}
          {% set file = task.activity.ext.file|default(null) %}
          {% if  file.storage|default(null) == 'cloud' %}
          <li class="mark-manage" >
          <a href="{{ path('course_task_marker_manage', {courseId:course.id, taskId:task.id}) }}" target="_blank" class="manage-lesson-marker-btn" >
          <span class="glyphicon glyphicon-list prs"></span>{{'弹题管理'|trans}}
          </a>
          </li>
          <li class="divider mark-manage-divider" style="display:none;"></li>
          {% endif %}
        {% endif %}

        {% if task.status|default('create') == 'published' %}
          {% set status = 1 %}
        {% else %}
          {% set status = 0 %}
        {% endif %}
          <li>
            <a class='publish-item {% if status == 1 %}hidden{% endif %}' href="javascript:;" data-type="task"
              data-url="{{ path('course_manage_task_publish', {id:task.id,courseId:task.courseId}) }}">
              <i class="es-icon es-icon--check-circle mrs"></i>发布
            </a>
          </li>
          <li>
            <a class='delete-item {% if status == 1 %}hidden{% endif %}' href="javascript:;" data-type="task"
              data-url="{{ path('course_manage_task_delete', {taskId:task.id,courseId:task.courseId}) }}">
              <i class="es-icon es-icon-delete mrs"></i>
              删除
            </a>
          </li>
          <li>
            <a class='unpublish-item {% if status != 1 %}hidden{% endif %}' href="javascript:;" data-type="task"
              data-url="{{ path('course_manage_task_unpublish', {id:task.id,courseId:task.courseId}) }}">
              <i class="es-icon es-icon-close01 mrm"></i>取消发布
            </a>
          </li>
      </ul>
    </span>
  </div>

</li>
