Search in sources :

Example 1 with ElementTag

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

the class InstructorFeedbackResultsPageData method buildMissingResponseRowsBetweenRecipientAndPossibleGivers.

/**
 * Construct missing response rows between the recipient identified by {@code recipientIdentifier} and
 * {@code possibleGivers}.
 */
private List<InstructorFeedbackResultsResponseRow> buildMissingResponseRowsBetweenRecipientAndPossibleGivers(FeedbackQuestionAttributes question, List<String> possibleGivers, String recipientIdentifier, String recipientName, String recipientTeam) {
    List<InstructorFeedbackResultsResponseRow> missingResponses = new ArrayList<>();
    FeedbackQuestionDetails questionDetails = questionToDetailsMap.get(question);
    for (String possibleGiver : possibleGivers) {
        String possibleGiverName = bundle.getFullNameFromRoster(possibleGiver);
        String possibleGiverTeam = bundle.getTeamNameFromRoster(possibleGiver);
        String textToDisplay = questionDetails.getNoResponseTextInHtml(recipientIdentifier, possibleGiver, bundle, question);
        if (questionDetails.shouldShowNoResponseText(question)) {
            InstructorFeedbackResultsModerationButton moderationButton = buildModerationButtonForGiver(question, possibleGiver, "btn btn-default btn-xs", MODERATE_SINGLE_RESPONSE);
            InstructorFeedbackResultsResponseRow missingResponse = new InstructorFeedbackResultsResponseRow(possibleGiverName, possibleGiverTeam, recipientName, recipientTeam, textToDisplay, moderationButton, true);
            missingResponse.setRowAttributes(new ElementTag("class", "pending_response_row"));
            configureResponseRow(possibleGiver, recipientIdentifier, missingResponse);
            missingResponses.add(missingResponse);
        }
    }
    return missingResponses;
}
Also used : InstructorFeedbackResultsResponseRow(teammates.ui.template.InstructorFeedbackResultsResponseRow) FeedbackQuestionDetails(teammates.common.datatransfer.questions.FeedbackQuestionDetails) ArrayList(java.util.ArrayList) InstructorFeedbackResultsModerationButton(teammates.ui.template.InstructorFeedbackResultsModerationButton) ElementTag(teammates.ui.template.ElementTag)

Example 2 with ElementTag

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

the class InstructorFeedbackResultsPageData method buildQuestionTableAndResponseRows.

/**
 * Builds a question table for given question, and response rows for the given responses.
 *
 * @param participantIdentifier  for viewTypes * > Question > *, constructs missing response rows
 *                               only for the given participant
 * @param isShowingResponseRows  if false, hides the response rows
 */
private InstructorFeedbackResultsQuestionTable buildQuestionTableAndResponseRows(FeedbackQuestionAttributes question, List<FeedbackResponseAttributes> responses, String additionalInfoId, String participantIdentifier, boolean isShowingResponseRows) {
    List<ElementTag> columnTags = new ArrayList<>();
    Map<String, Boolean> isSortable = new HashMap<>();
    boolean isCollapsible = true;
    List<InstructorFeedbackResultsResponseRow> responseRows = null;
    FeedbackQuestionDetails questionDetails = questionToDetailsMap.get(question);
    if (isShowingResponseRows) {
        switch(viewType) {
            case QUESTION:
                buildTableColumnHeaderForQuestionView(columnTags, isSortable);
                responseRows = buildResponseRowsForQuestion(question, responses);
                break;
            case GIVER_QUESTION_RECIPIENT:
                buildTableColumnHeaderForGiverQuestionRecipientView(columnTags, isSortable);
                responseRows = buildResponseRowsForQuestionForSingleGiver(question, responses, participantIdentifier);
                isCollapsible = false;
                break;
            case RECIPIENT_QUESTION_GIVER:
                buildTableColumnHeaderForRecipientQuestionGiverView(columnTags, isSortable);
                responseRows = buildResponseRowsForQuestionForSingleRecipient(question, responses, participantIdentifier);
                isCollapsible = false;
                break;
            default:
                Assumption.fail("View type should not involve question tables");
                break;
        }
        // by default order (first by team name, then by display name)
        if (questionDetails.isQuestionSpecificSortingRequired()) {
            responseRows.sort(questionDetails.getResponseRowsSortOrder());
        } else {
            responseRows = InstructorFeedbackResultsResponseRow.sortListWithDefaultOrder(responseRows);
        }
    }
    String studentEmail = student == null ? null : student.email;
    String statisticsTable = questionDetails.getQuestionResultStatisticsHtml(responses, question, studentEmail, bundle, viewType.toString());
    String questionText = questionDetails.getQuestionText();
    String additionalInfoText = questionDetails.getQuestionAdditionalInfoHtml(question.questionNumber, additionalInfoId);
    InstructorFeedbackResultsQuestionTable questionTable = new InstructorFeedbackResultsQuestionTable(!responses.isEmpty(), statisticsTable, responseRows, question, questionText, additionalInfoText, columnTags, isSortable);
    if (viewType == InstructorFeedbackResultsPageViewType.QUESTION) {
        // setup classes, for loading responses by ajax
        // ajax_submit: user needs to click on the panel to load
        // ajax_auto: responses are loaded automatically
        questionTable.setAjaxClass(isLargeNumberOfResponses() ? " ajax_submit" : " ajax_auto");
    }
    questionTable.setShowResponseRows(isShowingResponseRows);
    questionTable.setCollapsible(isCollapsible);
    return questionTable;
}
Also used : InstructorFeedbackResultsResponseRow(teammates.ui.template.InstructorFeedbackResultsResponseRow) FeedbackQuestionDetails(teammates.common.datatransfer.questions.FeedbackQuestionDetails) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) ElementTag(teammates.ui.template.ElementTag) InstructorFeedbackResultsQuestionTable(teammates.ui.template.InstructorFeedbackResultsQuestionTable)

Example 3 with ElementTag

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

the class InstructorFeedbackSessionsPageData method addPlaceholderIfEmpty.

/**
 * Adds the placeholder option to the list of select options if the list is empty.
 * @param selectOptions list containing all the options
 * @param message the message of the placeholder
 */
private void addPlaceholderIfEmpty(List<ElementTag> selectOptions, String message) {
    if (!selectOptions.isEmpty()) {
        return;
    }
    ElementTag placeholder = createOption(message, "", true);
    selectOptions.add(placeholder);
}
Also used : ElementTag(teammates.ui.template.ElementTag)

Example 4 with ElementTag

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

the class InstructorFeedbackSessionsPageData method getCourseIdOptions.

private List<ElementTag> getCourseIdOptions(List<CourseAttributes> courses, String courseIdForNewSession, Map<String, InstructorAttributes> instructors, FeedbackSessionAttributes newFeedbackSession) {
    ArrayList<ElementTag> result = new ArrayList<>();
    for (CourseAttributes course : courses) {
        // True if this is a submission of the filled 'new session' form
        // for this course:
        boolean isFilledFormForSessionInThisCourse = newFeedbackSession != null && course.getId().equals(newFeedbackSession.getCourseId());
        // True if this is for displaying an empty form for creating a
        // session for this course:
        boolean isEmptyFormForSessionInThisCourse = course.getId().equals(courseIdForNewSession);
        if (instructors.get(course.getId()).isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)) {
            ElementTag option = createOption(course.getId(), course.getId(), isFilledFormForSessionInThisCourse || isEmptyFormForSessionInThisCourse);
            result.add(option);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) ElementTag(teammates.ui.template.ElementTag) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes)

Example 5 with ElementTag

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

the class InstructorHomeCourseAjaxPageData method createCourseTableLinks.

private List<ElementTag> createCourseTableLinks(InstructorAttributes instructor, String courseId) {
    String disabled = "disabled";
    String className = "btn-tm-actions course-";
    ElementTag students = new ElementTag("Students");
    ElementTag sessions = new ElementTag("Sessions");
    ElementTag instructors = new ElementTag("Instructors");
    ElementTag courses = new ElementTag("Course");
    ElementTag enroll = createButton("Enroll", className + "enroll-for-test", getInstructorCourseEnrollLink(courseId), Const.Tooltips.COURSE_ENROLL);
    addAttributeIf(!instructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT), enroll, disabled, null);
    ElementTag view = createButton("View / Edit", className + "view-for-test", getInstructorCourseDetailsLink(courseId), Const.Tooltips.COURSE_DETAILS);
    ElementTag edit = createButton("View / Edit", className + "edit-for-test", getInstructorCourseEditLink(courseId), Const.Tooltips.COURSE_EDIT);
    ElementTag add = createButton("Add", className + "add-eval-for-test", getInstructorFeedbackSessionsLink(courseId), Const.Tooltips.COURSE_ADD_FEEDBACKSESSION);
    addAttributeIf(!instructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION), add, disabled, null);
    ElementTag archive = createButton("Archive", className + "archive-for-test", getInstructorCourseArchiveLink(courseId, true, true), Const.Tooltips.COURSE_ARCHIVE);
    addAttributeIf(true, archive, "data-course-id", courseId);
    ElementTag delete = createButton("Delete", className + "delete-for-test course-delete-link", getInstructorCourseDeleteLink(courseId, true), Const.Tooltips.COURSE_DELETE);
    addAttributeIf(!instructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE), delete, disabled, null);
    addAttributeIf(true, delete, "data-course-id", courseId);
    students.addNestedElement(enroll);
    students.addNestedElement(view);
    sessions.addNestedElement(add);
    instructors.addNestedElement(edit);
    courses.addNestedElement(archive);
    courses.addNestedElement(delete);
    return Arrays.asList(students, instructors, sessions, courses);
}
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