public IdentityAssessmentEditController( WindowControl wControl, UserRequest ureq, StackedController stackPanel, Identity assessedIdentity, ICourse course, boolean mayEdit, boolean headers) { super(ureq, wControl); this.stackPanel = stackPanel; this.mayEdit = mayEdit; main = new Panel("main"); assessedUserCourseEnvironment = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course); this.ores = OresHelper.clone(course); this.headers = headers; doIdentityAssessmentOverview(ureq, true); putInitialPanel(main); BusinessControl bc = getWindowControl().getBusinessControl(); ContextEntry ce = bc.popLauncherContextEntry(); if (ce != null) { OLATResourceable oresNode = ce.getOLATResourceable(); if (OresHelper.isOfType(oresNode, CourseNode.class)) { Long courseNodeId = oresNode.getResourceableId(); Structure runStructure = assessedUserCourseEnvironment.getCourseEnvironment().getRunStructure(); CourseNode courseNode = runStructure.getNode(courseNodeId.toString()); if (courseNode instanceof AssessableCourseNode) { doEditNodeAssessment(ureq, (AssessableCourseNode) courseNode); } } } }
/** @see java.lang.Object#toString() */ public String toString() { return "ores: " + ores.getResourceableTypeName() + "," + ores.getResourceableId() + ", title: " + title; }
private void doInsert(UserRequest ureq, TreePosition tp) { ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId()); int insertPos = tp.getChildpos(); CourseNode selectedNode = getCourseNode(tp.getParentTreeNode()); CourseEditorTreeNode insertParent = course.getEditorTreeModel().getCourseEditorNodeById(selectedNode.getIdent()); // check if insert position is within the to-be-copied tree if (course.getEditorTreeModel().checkIfIsChild(insertParent, moveCopyFrom)) { showError("movecopynode.error.overlap"); fireEvent(ureq, Event.CANCELLED_EVENT); } else if (copy) { // do a copy // copy subtree and save model recursiveCopy( moveCopyFrom, insertParent, insertPos, true, CourseFactory.getCourseEditSession(ores.getResourceableId())); CourseFactory.saveCourseEditorTreeModel(course.getResourceableId()); ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_NODE_COPIED, getClass()); fireEvent(ureq, Event.DONE_EVENT); } else { // move only if (insertParent.getIdent().equals(moveCopyFrom.getParent().getIdent())) { // same parent, adjust insertPos if (insertPos > moveCopyFrom.getPosition()) insertPos--; } insertParent.insert(moveCopyFrom, insertPos); moveCopyFrom.setDirty(true); // mark subtree as dirty TreeVisitor tv = new TreeVisitor( new Visitor() { @Override public void visit(INode node) { CourseEditorTreeNode cetn = (CourseEditorTreeNode) node; cetn.setDirty(true); } }, moveCopyFrom, true); tv.visitAll(); CourseFactory.saveCourseEditorTreeModel(course.getResourceableId()); showInfo("movecopynode.info.condmoved"); ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_NODE_MOVED, getClass()); fireEvent(ureq, Event.DONE_EVENT); } }
/** * @param ores * @param title * @param wControl */ public DTabImpl( OLATResourceable ores, OLATResourceable initialOres, String title, WindowControl wOrigControl) { this.ores = ores; this.initialOres = initialOres; this.title = title; // Root the JumpInPath - typically all resources are opened in tabs StackedBusinessControl businessControl = new StackedBusinessControl(null, wOrigControl.getBusinessControl()); wControl = BusinessControlFactory.getInstance() .createBusinessWindowControl(businessControl, wOrigControl); String typeName = ores.getResourceableTypeName(); String shortTitle; if (title == null) { shortTitle = "???"; } else if (!title.startsWith(I18nManager.IDENT_PREFIX)) { // don't truncate titles when in inline translation mode (OLAT-3811) shortTitle = Formatter.truncate(title, 15); } else { shortTitle = title; } navElement = new DefaultNavElement(shortTitle, title, "b_resource_" + typeName.replace(".", "-")); }
@Override public SubscriptionContext getSubscriptionContext( KalendarRenderWrapper kalendarRenderWrapper, OLATResourceable course) { String caller = kalendarRenderWrapper.getKalendar().getType(); SubscriptionContext subsContext = null; if (caller.equals(CalendarController.CALLER_COURSE) || caller.equals(CalendarManager.TYPE_COURSE)) { subsContext = new SubscriptionContext( OresHelper.calculateTypeName(CalendarManager.class) + "." + CalendarManager.TYPE_COURSE, course.getResourceableId(), CalendarController.ACTION_CALENDAR_COURSE); } else if (caller.equals(CalendarController.CALLER_COLLAB) || caller.equals(CalendarManager.TYPE_GROUP)) { BusinessGroup businessGroup = getBusinessGroup(kalendarRenderWrapper); if (businessGroup != null) { subsContext = new SubscriptionContext( OresHelper.calculateTypeName(CalendarManager.class) + "." + CalendarManager.TYPE_GROUP, businessGroup.getResourceableId(), CalendarController.ACTION_CALENDAR_GROUP); } } return subsContext; }
@Override protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if (nodeSelections.contains(source)) { MultipleSelectionElement nodeSelection = (MultipleSelectionElement) source; if (nodeSelection.isMultiselect()) { selectRec(nodeSelection, nodeSelection.isSelected(0)); } } else if (source == selectAll) { for (MultipleSelectionElement nodeSelection : nodeSelections) { if (nodeSelection.isMultiselect() && !nodeSelection.isSelected(0)) { SelectNodeObject treeNode = (SelectNodeObject) nodeSelection.getUserObject(); String id = treeNode.getId(); nodeSelection.select(id, true); } } } else if (source == deselectAll) { for (MultipleSelectionElement nodeSelection : nodeSelections) { if (nodeSelection.isMultiselect() && nodeSelection.isSelected(0)) { SelectNodeObject treeNode = (SelectNodeObject) nodeSelection.getUserObject(); String id = treeNode.getId(); nodeSelection.select(id, false); } } } else if (source == asChild) { position = -1; ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId()); create(rootSelection, course, selectedNode.getCourseNode()); fireEvent(ureq, Event.CHANGED_EVENT); } else if (source == sameLevel) { ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId()); CourseEditorTreeNode parentNode = (CourseEditorTreeNode) selectedNode.getParent(); position = 0; for (position = parentNode.getChildCount(); position-- > 0; ) { if (selectedNode.getIdent().equals(parentNode.getChildAt(position).getIdent())) { position++; break; } } create(rootSelection, course, parentNode.getCourseNode()); fireEvent(ureq, Event.CHANGED_EVENT); } else { super.formInnerEvent(ureq, source, event); } }
public void event(UserRequest ureq, Controller source, Event event) { if (source == logFileChooserForm) { if (event == Event.DONE_EVENT) { final boolean logAdminChecked = logFileChooserForm.logAdminChecked(); final boolean logUserChecked = logFileChooserForm.logUserChecked(); final boolean logStatisticChecked = logFileChooserForm.logStatChecked(); final Date begin = logFileChooserForm.getBeginDate(); final Date end = logFileChooserForm.getEndDate(); if (end != null) { // shift time from beginning to end of day end.setTime(end.getTime() + 24 * 60 * 60 * 1000); } UserManager um = UserManager.getInstance(); final String charset = um.getUserCharset(ureq.getIdentity()); ICourse course = CourseFactory.loadCourse(ores); final String courseTitle = course.getCourseTitle(); final String targetDir = CourseFactory.getOrCreateDataExportDirectory(ureq.getIdentity(), courseTitle).getPath(); final Long resId = ores.getResourceableId(); final Locale theLocale = ureq.getLocale(); final String email = ureq.getIdentity().getUser().getProperty(UserConstants.EMAIL, ureq.getLocale()); AsyncExportManager.getInstance() .asyncArchiveCourseLogFiles( ureq.getIdentity(), new Runnable() { @Override public void run() { showExportFinished(); } }, resId, targetDir, begin, end, logAdminChecked, logUserChecked, logStatisticChecked, charset, theLocale, email); showExportOngoing(true); } else if (event == Event.DONE_EVENT) { myPanel.setContent(myContent); } } }
public MoveCopySubtreeController( UserRequest ureq, WindowControl wControl, OLATResourceable ores, CourseEditorTreeNode moveCopyFrom, boolean copy) { super(ureq, wControl); this.ores = ores; this.moveCopyFrom = moveCopyFrom; this.copy = copy; ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId()); addLoggingResourceable(LoggingResourceable.wrap(course)); addLoggingResourceable(LoggingResourceable.wrap(moveCopyFrom.getCourseNode())); insertTree = new MenuTree(null, "copy_node_selection", this); insertTree.enableInsertTool(true); insertModel = new InsertTreeModel(course.getEditorTreeModel().getRootNode(), moveCopyFrom); insertTree.setTreeModel(insertModel); VelocityContainer mainVC = createVelocityContainer("moveCopyNode"); selectButton = LinkFactory.createButton("insertAtSelectedTreepos", mainVC, this); selectButton.setCustomEnabledLinkCSS("btn btn-primary"); selectButton.setCustomDisabledLinkCSS("btn btn-default"); selectButton.setEnabled(false); cancelButton = LinkFactory.createButton("cancel", mainVC, this); int numOfNodes = TreeHelper.totalNodeCount(insertModel.getRootNode()); if (numOfNodes > CourseModule.getCourseNodeLimit()) { String msg = getTranslator() .translate( "warning.containsXXXormore.nodes", new String[] { String.valueOf(numOfNodes), String.valueOf(CourseModule.getCourseNodeLimit() + 1) }); Controller tmp = MessageUIFactory.createWarnMessage(ureq, wControl, null, msg); listenTo(tmp); mainVC.put("nodelimitexceededwarning", tmp.getInitialComponent()); } mainVC.put("selection", insertTree); putInitialPanel(mainVC); }
public DENManageParticipantsController( UserRequest ureq, WindowControl wControl, OLATResourceable ores, DENCourseNode courseNode) { super(ureq, wControl); this.ores = ores; this.courseNode = courseNode; denManager = DENManager.getInstance(); mailManager = CoreSpringFactory.getImpl(MailManager.class); // prepare list of enrolled participants dateList = denManager.getDENEvents(ores.getResourceableId(), courseNode.getIdent()); listTableData = new DENListTableDataModel(dateList, getTranslator()); tableListParticipants = denManager.createListParticipantsTable(ureq, wControl, getTranslator(), listTableData); listenTo(tableListParticipants); putInitialPanel(tableListParticipants.getInitialComponent()); }
private void doEditNodeAssessment(UserRequest ureq, AssessableCourseNode courseNode) { if (mayEdit) { ICourse course = CourseFactory.loadCourse(ores); UserCourseInformationsManager userCourseInformationsManager = CoreSpringFactory.getImpl(UserCourseInformationsManager.class); Date initialLaunchDate = userCourseInformationsManager.getInitialLaunchDate( ores.getResourceableId(), assessedUserCourseEnvironment.getIdentityEnvironment().getIdentity()); AssessedIdentityWrapper assessedIdentityWrapper = AssessmentHelper.wrapIdentity( assessedUserCourseEnvironment, initialLaunchDate, courseNode); assessmentEditCtr = new AssessmentEditController( ureq, getWindowControl(), stackPanel, course, courseNode, assessedIdentityWrapper); listenTo(assessmentEditCtr); main.setContent(assessmentEditCtr.getInitialComponent()); } else { throw new OLATSecurityException( "doEditNodeAssessment() called but controller configured with mayEdit=false"); } }