@bp.route('/courses/<course_type>/<int:course_id>/outline/view')
@login_required
def view_course_outline(course_type, course_id):
    """View the outline of a course"""
    # Validate course type and get course
    if course_type not in ['short', 'learn']:
        flash('Invalid course type.', 'error')
        return redirect(url_for('teacher.manage_courses'))
    
    CourseModel = ShortCourse if course_type == 'short' else LearningCourse
    
    # Teachers see their own courses, students see any course
    if current_user.role == 'teacher':
        course = CourseModel.query.filter(
            and_(
                CourseModel.id == course_id,
                CourseModel.teacher_id == current_user.id
            )
        ).first_or_404()
        is_teacher = True
    else:
        course = CourseModel.query.filter_by(id=course_id).first_or_404()
        is_teacher = False
    
    # Get topics for this course, ordered by their position
    topics = Topic.query.filter_by(course_id=course_id).order_by(Topic.order).all()
    
    return render_template('teacher/view_course_outline.html', 
                          course=course,
                          topics=topics,
                          course_type=course_type,
                          is_teacher=is_teacher)