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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations