use of org.olat.core.gui.components.form.flexible.elements.DownloadLink in project OpenOLAT by OpenOLAT.
the class CheckListRunController method forgeCheckboxWrapper.
private CheckboxWrapper forgeCheckboxWrapper(Checkbox checkbox, DBCheck check, boolean readOnly, FormItemContainer formLayout) {
String[] values = new String[] { translate(checkbox.getLabel().i18nKey()) };
boolean canCheck = CheckboxReleaseEnum.userAndCoach.equals(checkbox.getRelease());
String boxId = "box_" + checkbox.getCheckboxId();
MultipleSelectionElement el = uifactory.addCheckboxesHorizontal(boxId, null, formLayout, onKeys, values);
el.setEnabled(canCheck && !readOnly && !userCourseEnv.isCourseReadOnly());
el.addActionListener(FormEvent.ONCHANGE);
DownloadLink downloadLink = null;
if (StringHelper.containsNonWhitespace(checkbox.getFilename())) {
VFSContainer container = checkboxManager.getFileContainer(userCourseEnv.getCourseEnvironment(), courseNode);
VFSItem item = container.resolve(checkbox.getFilename());
if (item instanceof VFSLeaf) {
String name = "file_" + checkbox.getCheckboxId();
downloadLink = uifactory.addDownloadLink(name, checkbox.getFilename(), null, (VFSLeaf) item, formLayout);
}
}
CheckboxWrapper wrapper = new CheckboxWrapper(checkbox, downloadLink, el);
el.setUserObject(wrapper);
if (check != null && check.getChecked() != null && check.getChecked().booleanValue()) {
el.select(onKeys[0], true);
wrapper.setDbCheckbox(check.getCheckbox());
wrapper.setScore(check.getScore());
}
if (downloadLink != null) {
downloadLink.setUserObject(wrapper);
}
return wrapper;
}
use of org.olat.core.gui.components.form.flexible.elements.DownloadLink in project OpenOLAT by OpenOLAT.
the class GTASampleSolutionsEditController method updateModel.
private void updateModel() {
List<Solution> solutionList = gtaManager.getSolutions(courseEnv, gtaNode);
List<SolutionRow> rows = new ArrayList<>(solutionList.size());
for (Solution solution : solutionList) {
String filename = solution.getFilename();
String author = null;
VFSItem item = solutionContainer.resolve(filename);
if (item instanceof MetaTagged) {
MetaInfo metaInfo = ((MetaTagged) item).getMetaInfo();
if (metaInfo != null && metaInfo.getAuthorIdentityKey() != null) {
author = userManager.getUserDisplayName(metaInfo.getAuthorIdentityKey());
}
}
DownloadLink downloadLink = null;
if (item instanceof VFSLeaf) {
downloadLink = uifactory.addDownloadLink("file_" + (++linkCounter), filename, null, (VFSLeaf) item, solutionTable);
}
rows.add(new SolutionRow(solution, author, downloadLink));
}
solutionModel.setObjects(rows);
solutionTable.reset();
}
use of org.olat.core.gui.components.form.flexible.elements.DownloadLink in project OpenOLAT by OpenOLAT.
the class DialogElementListController method loadModel.
protected void loadModel() {
RepositoryEntry entry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
List<DialogElement> elements = dialogElementsManager.getDialogElements(entry, courseNode.getIdent());
List<DialogElementRow> rows = new ArrayList<>(elements.size());
for (DialogElement element : elements) {
DialogElementRow row = new DialogElementRow(element, userPropertyHandlers, getLocale());
int msgCount = forumManager.countMessagesByForumID(element.getForum().getKey());
int newMsg = msgCount - forumManager.countReadMessagesByUserAndForum(getIdentity(), element.getForum().getKey());
row.setNumOfMessages(msgCount);
row.setNumOfUnreadMessages(newMsg);
VFSLeaf item = dialogElementsManager.getDialogLeaf(element);
if (item != null) {
DownloadLink downloadLink = uifactory.addDownloadLink("file_" + (++counter), row.getFilename(), null, item, flc);
row.setDownloadLink(downloadLink);
}
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset(true, true, true);
}
use of org.olat.core.gui.components.form.flexible.elements.DownloadLink in project OpenOLAT by OpenOLAT.
the class AbstractAssignmentEditController method updateModel.
protected void updateModel() {
fileExistsRenderer.setFilenames(tasksFolder.list());
List<TaskDefinition> taskDefinitions = gtaManager.getTaskDefinitions(courseEnv, gtaNode);
List<TaskDefinitionRow> rows = new ArrayList<>(taskDefinitions.size());
for (TaskDefinition def : taskDefinitions) {
DownloadLink downloadLink = null;
VFSItem item = tasksContainer.resolve(def.getFilename());
if (item instanceof VFSLeaf) {
downloadLink = uifactory.addDownloadLink("file_" + (++linkCounter), def.getFilename(), null, (VFSLeaf) item, taskDefTableEl);
}
rows.add(new TaskDefinitionRow(def, downloadLink));
}
taskModel.setObjects(rows);
taskDefTableEl.reset();
}
use of org.olat.core.gui.components.form.flexible.elements.DownloadLink in project openolat by klemens.
the class DialogElementListController method loadModel.
protected void loadModel() {
RepositoryEntry entry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
List<DialogElement> elements = dialogElementsManager.getDialogElements(entry, courseNode.getIdent());
List<DialogElementRow> rows = new ArrayList<>(elements.size());
for (DialogElement element : elements) {
DialogElementRow row = new DialogElementRow(element, userPropertyHandlers, getLocale());
int msgCount = forumManager.countMessagesByForumID(element.getForum().getKey());
int newMsg = msgCount - forumManager.countReadMessagesByUserAndForum(getIdentity(), element.getForum().getKey());
row.setNumOfMessages(msgCount);
row.setNumOfUnreadMessages(newMsg);
VFSLeaf item = dialogElementsManager.getDialogLeaf(element);
if (item != null) {
DownloadLink downloadLink = uifactory.addDownloadLink("file_" + (++counter), row.getFilename(), null, item, flc);
row.setDownloadLink(downloadLink);
}
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset(true, true, true);
}
Aggregations