diff --git a/src/main/java/org/olat/admin/user/course/CourseOverviewController.java b/src/main/java/org/olat/admin/user/course/CourseOverviewController.java index aebefce97e907b793574abc2062eaca8c284a786..d70fdda7369856d65bd4b26f5dde1a553f0e4dac 100644 --- a/src/main/java/org/olat/admin/user/course/CourseOverviewController.java +++ b/src/main/java/org/olat/admin/user/course/CourseOverviewController.java @@ -71,6 +71,7 @@ import org.olat.group.BusinessGroupService; import org.olat.group.BusinessGroupShort; import org.olat.group.model.BGRepositoryEntryRelation; import org.olat.group.ui.main.CourseMembership; +import org.olat.group.ui.main.CourseMembershipComparator; import org.olat.group.ui.main.EditSingleMembershipController; import org.olat.group.ui.main.MemberPermissionChangeEvent; import org.olat.repository.RepositoryEntry; @@ -101,6 +102,7 @@ public class CourseOverviewController extends BasicController { private final Link addAsOwner, addAsTutor, addAsParticipant; private TableController courseListCtr; private MembershipDataModel tableDataModel; + private final CourseMembershipComparator membershipComparator = new CourseMembershipComparator(); private CloseableModalController cmc; private DialogBoxController confirmSendMailBox; @@ -147,7 +149,19 @@ public class CourseOverviewController extends BasicController { courseListCtr.addColumnDescriptor(false, new DefaultColumnDescriptor(MSCols.externalRef.i18n(), MSCols.externalRef.ordinal(), TABLE_ACTION_LAUNCH, getLocale())); CustomCellRenderer roleRenderer = new CourseRoleCellRenderer(); - courseListCtr.addColumnDescriptor(new CustomRenderColumnDescriptor(MSCols.role.i18n(), MSCols.role.ordinal(), null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, roleRenderer)); + courseListCtr.addColumnDescriptor(new CustomRenderColumnDescriptor(MSCols.role.i18n(), MSCols.role.ordinal(), null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, roleRenderer){ + @Override + public int compareTo(int rowa, int rowb) { + CourseMemberView cmv1 = (CourseMemberView)table.getTableDataModel().getValueAt(rowa,dataColumn); + CourseMemberView cmv2 = (CourseMemberView)table.getTableDataModel().getValueAt(rowb,dataColumn); + if(cmv1 == null || cmv1.getMembership() == null) { + return -1; + } else if(cmv2 == null || cmv2.getMembership() == null) { + return 1; + } + return membershipComparator.compare(cmv1.getMembership(), cmv2.getMembership()); + } + }); courseListCtr.addColumnDescriptor(new DefaultColumnDescriptor(MSCols.firstTime.i18n(), MSCols.firstTime.ordinal(), null, getLocale())); if(isLastVisitVisible) { courseListCtr.addColumnDescriptor(new DefaultColumnDescriptor(MSCols.lastTime.i18n(), MSCols.lastTime.ordinal(), null, getLocale())); @@ -806,4 +820,5 @@ public class CourseOverviewController extends BasicController { return !RepositoryEntryManagedFlag.isManaged(re, RepositoryEntryManagedFlag.membersmanagement); } } + } \ No newline at end of file diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html index 517fbf47cd6572fc53537e2db693d33e09e36d66..cdfa16251162d26ef681ae6abf7699e506d28627 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html @@ -87,6 +87,8 @@ <td> #if(!$isRestrictedEdit) <input type="text" name="points_q$count" value="$content.getPoints()" size="5" onchange="return setFormDirty('ofo_tab_fibitem')" onclick="return setFormDirty('ofo_tab_fibitem')"/> + #else + $content.getPoints() #end </td> #end diff --git a/src/main/java/org/olat/repository/manager/RepositoryServiceImpl.java b/src/main/java/org/olat/repository/manager/RepositoryServiceImpl.java index c70b9add31f6c55845bf19364023433f8cfe2c05..bedf950e4f70c1a521e9d814884ed353e8be6171 100644 --- a/src/main/java/org/olat/repository/manager/RepositoryServiceImpl.java +++ b/src/main/java/org/olat/repository/manager/RepositoryServiceImpl.java @@ -53,6 +53,7 @@ import org.olat.core.util.vfs.LocalFolderImpl; import org.olat.core.util.vfs.VFSContainer; import org.olat.core.util.vfs.VFSItem; import org.olat.core.util.vfs.VFSLeaf; +import org.olat.core.util.vfs.VFSManager; import org.olat.course.assessment.manager.AssessmentModeDAO; import org.olat.course.assessment.manager.UserCourseInformationsManager; import org.olat.course.certificate.CertificatesManager; @@ -227,10 +228,16 @@ public class RepositoryServiceImpl implements RepositoryService { RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(sourceEntry); copyEntry = handler.copy(author, sourceEntry, copyEntry); - - + //copy the image RepositoryManager.getInstance().copyImage(sourceEntry, copyEntry); + + //copy media container + VFSContainer sourceMediaContainer = handler.getMediaContainer(sourceEntry); + if(sourceMediaContainer != null) { + VFSContainer targetMediaContainer = handler.getMediaContainer(copyEntry); + VFSManager.copyContent(sourceMediaContainer, targetMediaContainer); + } ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_CREATE, getClass(), LoggingResourceable.wrap(copyEntry, OlatResourceableType.genRepoEntry)); diff --git a/src/main/java/org/olat/user/IdentityContextEntryControllerCreator.java b/src/main/java/org/olat/user/IdentityContextEntryControllerCreator.java index 9cc213a054c05fe840cc9492000161b658617c0f..ee7c9b5ca001646ce1445fa2b198508c7f3d73d9 100644 --- a/src/main/java/org/olat/user/IdentityContextEntryControllerCreator.java +++ b/src/main/java/org/olat/user/IdentityContextEntryControllerCreator.java @@ -40,8 +40,9 @@ import org.olat.home.HomeSite; /** * <h3>Description:</h3> * <p> - * This class offers a way to launch the users homepage (alias visiting card) - * controller in a new tab + * This class offers a way to launch the users home page (alias visiting card), home site + * or the home of the logged in user in a new tab or (in the case of the logged in user) + * in its user's tools. * <p> * Initial Date: 21.08.2009 <br> * @@ -64,7 +65,7 @@ public class IdentityContextEntryControllerCreator extends DefaultContextEntryCo */ @Override public Controller createController(List<ContextEntry> ces, UserRequest ureq, WindowControl wControl) { - Identity id = getIdentity(ces.get(0)); + Identity id = getIdentity(ces.get(0), ureq); if (id == null) { return null; } @@ -74,7 +75,7 @@ public class IdentityContextEntryControllerCreator extends DefaultContextEntryCo @Override public String getSiteClassName(List<ContextEntry> ces, UserRequest ureq) { Long resId = ces.get(0).getOLATResourceable().getResourceableId(); - if(resId != null && resId.equals(ureq.getIdentity().getKey())) { + if(resId != null && (resId.longValue() == 0l || resId.equals(ureq.getIdentity().getKey()))) { return HomeSite.class.getName(); } return null; @@ -85,7 +86,7 @@ public class IdentityContextEntryControllerCreator extends DefaultContextEntryCo ContextEntry mainEntry, List<ContextEntry> entries) { Long resId = mainEntry.getOLATResourceable().getResourceableId(); - if(resId != null && resId.equals(ureq.getIdentity().getKey())) { + if(resId != null && (resId.longValue() == 0l || resId.equals(ureq.getIdentity().getKey()))) { if(entries.isEmpty()) {//rewrite OLATResourceable homeOres = OresHelper.createOLATResourceableInstance("HomeSite", resId); entries.add(BusinessControlFactory.getInstance().createContextEntry(homeOres)); @@ -102,14 +103,14 @@ public class IdentityContextEntryControllerCreator extends DefaultContextEntryCo */ @Override public String getTabName(ContextEntry ce, UserRequest ureq) { - Identity id = getIdentity(ce); + Identity id = getIdentity(ce, ureq); if (id == null) return null; return UserManagerImpl.getInstance().getUserDisplayName(id); } @Override public boolean validateContextEntryAndShowError(ContextEntry ce, UserRequest ureq, WindowControl wControl) { - return getIdentity(ce) != null; + return getIdentity(ce, ureq) != null; } /** @@ -118,17 +119,17 @@ public class IdentityContextEntryControllerCreator extends DefaultContextEntryCo * @param ce * @return the identity or NULL if not found */ - private Identity getIdentity(ContextEntry ce) { + private Identity getIdentity(ContextEntry ce, UserRequest ureq) { if(identity == null) { OLATResourceable resource = ce.getOLATResourceable(); Long key = resource.getResourceableId(); - if (key == null || key.equals(0)) { - log.error("Can not load identity with key::" + key); - return null; - } - identity = BaseSecurityManager.getInstance().loadIdentityByKey(key); - if (identity == null) { - log.error("Can not load identity with key::" + key); + if (key == null || key.longValue() == 0l) { + identity = ureq.getIdentity(); + } else { + identity = BaseSecurityManager.getInstance().loadIdentityByKey(key); + if (identity == null) { + log.error("Can not load identity with key::" + key); + } } } return identity; diff --git a/src/test/java/org/olat/core/util/FormatterTest.java b/src/test/java/org/olat/core/util/FormatterTest.java index c1d8ea5e8a71e46c1888014fec1eb6222762281a..4654d39f6eaefcfd235b663f931e2a2ebd56f148 100644 --- a/src/test/java/org/olat/core/util/FormatterTest.java +++ b/src/test/java/org/olat/core/util/FormatterTest.java @@ -89,9 +89,11 @@ public class FormatterTest { Assert.assertTrue(Formatter.formatEmoticonsAsImages("+ ").indexOf("<") == 0); Assert.assertTrue(Formatter.formatEmoticonsAsImages("- ").indexOf("<") == 0); - // text after +/- => should NOT render up or down icon + // text after +/- => should NOT render up or down icon, is probably an enumeration Assert.assertTrue(Formatter.formatEmoticonsAsImages("+trallala").indexOf("<") == -1); Assert.assertTrue(Formatter.formatEmoticonsAsImages("-lustig").indexOf("<") == -1); + Assert.assertTrue(Formatter.formatEmoticonsAsImages("+ trallala").indexOf("<") == -1); + Assert.assertTrue(Formatter.formatEmoticonsAsImages("- lustig").indexOf("<") == -1); // text before +/- => should NOT render up or down icon Assert.assertTrue(Formatter.formatEmoticonsAsImages("trallala-").indexOf("<") == -1);