{% 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">{{'course.plan_task.is_optional_task'|trans}}</span>
    {% else %}
     {{'site.data.task'|trans}}<span class="number">{{ task.number }}</span>：
    {% endif %}
    {{ task.title|sub_text(30) }}
    <span class="color-warning publish-status {% if task.status == 'published' %}
      hidden {% endif %}">{{'course.plan_task.task_unpublished'|trans}}</span>

    {% if file and file.storage == 'cloud' and file.type in ['ppt', 'document','video'] and file.convertStatus == 'error' %}
      <span class="label label-danger ml5">{{'course.plan_task.convert_failed'|trans}}</span>
    {% elseif file and file.storage == 'cloud' and file.type in ['ppt', 'document','video'] and file.convertStatus != 'success' %}
      <span class="label label-warning ml5">{{'course.plan_task.converting'|trans}}</span>
    {% endif %}

    {% if task.activity.mediaType is same as('live') %}
      {% set isLiveFinished = is_live_finished(task.activity.id, 'course') %}

      {% if not task.activity.ext.roomCreated|default(true) %}
        <span class="color-warning">{{ 'course.plan_task.edit_tips'|trans }}</span>
      {% elseif isLiveFinished %}
        <span class="color-gray">{{ 'course.plan_task.live_finish_tips'|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(task.activity.mediaType) %}<span class="color-gray mls">
        （{{ task.activity.length|activity_length_format(task.activity.mediaType) }}）</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>{{'course.plan_task.edit_btn'|trans}}</a>
    {% if showPreviewBtn|default(1) %}
      <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>{{'course.plan_task.preview_btn'|trans}}
      </a>
    {% endif %}

    <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>{{ 'course.plan_task.more_btn'|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>{{'course.plan_task.lesson-marker_btn'|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>{{'course.plan_task.publish_btn'|trans}}
            </a>
          </li>
          {{ slot('task.menu.extension', {'task': task}) }}
          <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>
              {{'course.plan_task.delete_btn'|trans}}
            </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>{{'course.plan_task.unpublish_btn'|trans}}
            </a>
          </li>
      </ul>
    </span>
  </div>

</li>
