Search in sources :

Example 6 with ElementTag

use of teammates.ui.template.ElementTag in project teammates by TEAMMATES.

the class InstructorCoursesPageData method convertToActiveCoursesTable.

private ActiveCoursesTable convertToActiveCoursesTable(List<CourseAttributes> courses) {
    ActiveCoursesTable activeCourses = new ActiveCoursesTable();
    int idx = -1;
    for (CourseAttributes course : courses) {
        idx++;
        List<ElementTag> actionsParam = new ArrayList<>();
        Boolean hasModifyPermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT);
        ElementTag enrollButton = createButton("Enroll", "btn btn-default btn-xs t_course_enroll" + idx, "", getInstructorCourseEnrollLink(course.getId()), Const.Tooltips.COURSE_ENROLL, !hasModifyPermission);
        ElementTag viewButton = createButton("View", "btn btn-default btn-xs t_course_view" + idx, "", getInstructorCourseDetailsLink(course.getId()), Const.Tooltips.COURSE_DETAILS, false);
        ElementTag editButton = createButton("Edit", "btn btn-default btn-xs t_course_edit" + idx, "", getInstructorCourseEditLink(course.getId()), Const.Tooltips.COURSE_EDIT, false);
        ElementTag archiveButton = createButton("Archive", "btn btn-default btn-xs t_course_archive" + idx, "", getInstructorCourseArchiveLink(course.getId(), true, false), Const.Tooltips.COURSE_ARCHIVE, false);
        String deleteLink = getInstructorCourseDeleteLink(course.getId(), false);
        Boolean hasDeletePermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE);
        ElementTag deleteButton = createButton("Delete", "btn btn-default btn-xs course-delete-link " + "t_course_delete" + idx, "", deleteLink, Const.Tooltips.COURSE_DELETE, !hasDeletePermission);
        deleteButton.setAttribute("data-course-id", course.getId());
        actionsParam.add(enrollButton);
        actionsParam.add(viewButton);
        actionsParam.add(editButton);
        actionsParam.add(archiveButton);
        actionsParam.add(deleteButton);
        ActiveCoursesTableRow row = new ActiveCoursesTableRow(SanitizationHelper.sanitizeForHtml(course.getId()), SanitizationHelper.sanitizeForHtml(course.getName()), course.getCreatedAtDateString(), course.getCreatedAtDateStamp(), course.getCreatedAtFullDateTimeString(), this.getInstructorCourseStatsLink(course.getId()), actionsParam);
        activeCourses.getRows().add(row);
    }
    return activeCourses;
}
Also used : ArrayList(java.util.ArrayList) ActiveCoursesTable(teammates.ui.template.ActiveCoursesTable) ElementTag(teammates.ui.template.ElementTag) ActiveCoursesTableRow(teammates.ui.template.ActiveCoursesTableRow) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes)

Example 7 with ElementTag

use of teammates.ui.template.ElementTag in project teammates by TEAMMATES.

the class InstructorCoursesPageData method createButton.

private ElementTag createButton(String content, String buttonClass, String id, String href, String title, boolean isDisabled) {
    ElementTag button = new ElementTag(content);
    button.setAttribute("class", buttonClass);
    if (id != null && !id.isEmpty()) {
        button.setAttribute("id", id);
    }
    if (href != null && !href.isEmpty()) {
        button.setAttribute("href", href);
    }
    if (title != null && !title.isEmpty()) {
        button.setAttribute("title", title);
        button.setAttribute("data-toggle", "tooltip");
        button.setAttribute("data-placement", "top");
    }
    if (isDisabled) {
        button.setAttribute("disabled", null);
    }
    return button;
}
Also used : ElementTag(teammates.ui.template.ElementTag)

Example 8 with ElementTag

use of teammates.ui.template.ElementTag in project teammates by TEAMMATES.

the class InstructorFeedbackEditPageData method getQuestionNumberOptions.

private List<ElementTag> getQuestionNumberOptions(int numQuestions) {
    List<ElementTag> options = new ArrayList<>();
    for (int opt = 1; opt < numQuestions + 1; opt++) {
        ElementTag option = createOption(String.valueOf(opt), String.valueOf(opt), false);
        options.add(option);
    }
    return options;
}
Also used : ArrayList(java.util.ArrayList) ElementTag(teammates.ui.template.ElementTag)

Example 9 with ElementTag

use of teammates.ui.template.ElementTag in project teammates by TEAMMATES.

the class InstructorFeedbackEditPageData method getPreviewAsInstructorOptions.

private List<ElementTag> getPreviewAsInstructorOptions(List<InstructorAttributes> instructorList) {
    List<ElementTag> results = new ArrayList<>();
    for (InstructorAttributes instructor : instructorList) {
        ElementTag option = createOption(instructor.name, instructor.email);
        results.add(option);
    }
    return results;
}
Also used : ArrayList(java.util.ArrayList) ElementTag(teammates.ui.template.ElementTag) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 10 with ElementTag

use of teammates.ui.template.ElementTag in project teammates by TEAMMATES.

the class InstructorCourseDetailsPageData method createButton.

private ElementTag createButton(String content, String buttonClass, String id, String href, String title, String dataToggle, String dataCourseId, boolean isDisabled) {
    ElementTag button = new ElementTag(content);
    if (buttonClass != null) {
        button.setAttribute("class", buttonClass);
    }
    if (id != null) {
        button.setAttribute("id", id);
    }
    if (href != null) {
        button.setAttribute("href", href);
    }
    if (title != null) {
        button.setAttribute("title", title);
        button.setAttribute("data-placement", "top");
    }
    if (dataToggle != null) {
        button.setAttribute("data-toggle", dataToggle);
    }
    if (dataCourseId != null) {
        button.setAttribute("data-course-id", dataCourseId);
    }
    if (isDisabled) {
        button.setAttribute("disabled", null);
    }
    return button;
}
Also used : ElementTag(teammates.ui.template.ElementTag)

Aggregations

ElementTag (teammates.ui.template.ElementTag)30 ArrayList (java.util.ArrayList)16 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)3 FeedbackQuestionDetails (teammates.common.datatransfer.questions.FeedbackQuestionDetails)3 InstructorFeedbackResultsResponseRow (teammates.ui.template.InstructorFeedbackResultsResponseRow)3 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)2 FeedbackSessionsTableRow (teammates.ui.template.FeedbackSessionsTableRow)2 InstructorFeedbackResultsModerationButton (teammates.ui.template.InstructorFeedbackResultsModerationButton)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1 ActiveCoursesTable (teammates.ui.template.ActiveCoursesTable)1 ActiveCoursesTableRow (teammates.ui.template.ActiveCoursesTableRow)1 ArchivedCoursesTable (teammates.ui.template.ArchivedCoursesTable)1 ArchivedCoursesTableRow (teammates.ui.template.ArchivedCoursesTableRow)1 FeedbackSessionsCopyFromModal (teammates.ui.template.FeedbackSessionsCopyFromModal)1 InstructorFeedbackResultsQuestionTable (teammates.ui.template.InstructorFeedbackResultsQuestionTable)1 InstructorFeedbackSessionActions (teammates.ui.template.InstructorFeedbackSessionActions)1