Skip to content
Snippets Groups Projects
Commit 3d148321 authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 10.3 to OpenOLAT default branch with ba488225cc8e8ed20fe569692c4e76cfc51a4de2

parents b3691ac4 a5486573
No related branches found
No related tags found
No related merge requests found
Showing
with 93 additions and 24 deletions
......@@ -260,10 +260,13 @@ public class TabbedPane extends Container implements Activateable2 {
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if(entries == null || entries.isEmpty()) return;
int pos = entries.get(0).getOLATResourceable().getResourceableId().intValue();
if(pos != selectedPane) {
dispatchRequest(ureq, pos);
OLATResourceable ores = entries.get(0).getOLATResourceable();
if("tab".equals(ores.getResourceableTypeName())) {
int pos = ores.getResourceableId().intValue();
if(pos != selectedPane && pos >= 0 && pos < getTabCount()) {
dispatchRequest(ureq, pos);
}
}
}
}
\ No newline at end of file
......@@ -1180,6 +1180,9 @@ public class EditorMainController extends MainLayoutBasicController implements G
}
public boolean hasPublishableChanges(ICourse course) {
if(cetm == null || course == null) {
return false;
}
PublishProcess publishProcess = PublishProcess.getInstance(course, cetm, getLocale());
PublishTreeModel publishTreeModel = publishProcess.getPublishTreeModel();
return publishTreeModel.hasPublishableChanges();
......
......@@ -27,6 +27,7 @@ package org.olat.course.nodes;
import java.util.List;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.stack.BreadcrumbPanel;
import org.olat.core.gui.control.Controller;
......@@ -49,6 +50,7 @@ import org.olat.course.run.navigation.NodeRunConstructionResult;
import org.olat.course.run.scoring.ScoreEvaluation;
import org.olat.course.run.userview.NodeEvaluation;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.ims.lti.LTIManager;
import org.olat.ims.lti.ui.LTIResultDetailsController;
import org.olat.modules.ModuleConfiguration;
import org.olat.repository.RepositoryEntry;
......@@ -61,6 +63,7 @@ import org.olat.resource.OLATResource;
public class BasicLTICourseNode extends AbstractAccessableCourseNode implements AssessableCourseNode {
private static final long serialVersionUID = 2210572148308757127L;
private static final String translatorPackage = Util.getPackageName(LTIEditController.class);
private static final String TYPE = "lti";
public static final String CONFIG_KEY_AUTHORROLE = "authorRole";
......@@ -144,8 +147,7 @@ public class BasicLTICourseNode extends AbstractAccessableCourseNode implements
if (!isValid) {
// FIXME: refine statusdescriptions
String[] params = new String[] { this.getShortTitle() };
String translPackage = Util.getPackageName(LTIConfigForm.class);
sd = new StatusDescription(StatusDescription.ERROR, NLS_ERROR_HOSTMISSING_SHORT, NLS_ERROR_HOSTMISSING_LONG, params, translPackage);
sd = new StatusDescription(StatusDescription.ERROR, NLS_ERROR_HOSTMISSING_SHORT, NLS_ERROR_HOSTMISSING_LONG, params, translatorPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(LTIEditController.PANE_TAB_LTCONFIG);
......@@ -161,8 +163,8 @@ public class BasicLTICourseNode extends AbstractAccessableCourseNode implements
oneClickStatusCache = null;
// only here we know which translator to take for translating condition
// error messages
String translatorStr = Util.getPackageName(LTIEditController.class);
List<StatusDescription> sds = isConfigValidWithTranslator(cev, translatorStr, getConditionExpressions());
List<StatusDescription> sds = isConfigValidWithTranslator(cev, translatorPackage, getConditionExpressions());
oneClickStatusCache = StatusDescriptionHelper.sort(sds);
return oneClickStatusCache;
}
......@@ -182,6 +184,15 @@ public class BasicLTICourseNode extends AbstractAccessableCourseNode implements
public boolean needsReferenceToARepositoryEntry() {
return false;
}
/**
* @see org.olat.course.nodes.CourseNode#cleanupOnDelete(org.olat.course.ICourse)
*/
@Override
public void cleanupOnDelete(ICourse course) {
OLATResource resource = course.getCourseEnvironment().getCourseGroupManager().getCourseResource();
CoreSpringFactory.getImpl(LTIManager.class).deleteOutcomes(resource);
}
/**
* Update the module configuration to have all mandatory configuration flags
......
......@@ -45,12 +45,16 @@ public class CoachParticipantsModelSort extends SortableFlexiTableModelDelegate<
@Override
protected void sort(List<CoachedIdentityRow> rows) {
int columnIndex = getColumnIndex();
CGCols column = CGCols.values()[columnIndex];
switch(column) {
case taskStatus: Collections.sort(rows, new TaskStatusComparator()); break;
default: {
super.sort(rows);
if(GTACoachedGroupGradingController.USER_PROPS_OFFSET < columnIndex) {
CGCols column = CGCols.values()[columnIndex];
switch(column) {
case taskStatus: Collections.sort(rows, new TaskStatusComparator()); break;
default: {
super.sort(rows);
}
}
} else {
super.sort(rows);
}
}
......
......@@ -317,7 +317,6 @@ public class BusinessGroupEditController extends BasicController implements Cont
}
@Override
//fxdiff BAKS-7 Resume function
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if(entries == null || entries.isEmpty() || tabbedPane == null) return;
tabbedPane.activate(ureq, entries, state);
......
......@@ -50,5 +50,11 @@ public interface LTIManager {
public List<LTIOutcome> loadOutcomes(Identity identity, OLATResource resource, String resSubPath);
/**
* Remove the outcomes of a resource, typically before deleting a course.
* @param resource
*/
public void deleteOutcomes(OLATResource resource);
}
......@@ -111,6 +111,14 @@ public class LTIManagerImpl implements LTIManager {
}
return outcomes.getResultList();
}
@Override
public void deleteOutcomes(OLATResource resource) {
String q = "delete from ltioutcome as outcome where outcome.resource=:resource";
dbInstance.getCurrentEntityManager().createQuery(q)
.setParameter("resource", resource)
.executeUpdate();
}
@Override
public Map<String,String> sign(Map<String,String> props, String url, String oauthKey, String oauthSecret) {
......
......@@ -109,26 +109,34 @@ public class FIBItemController extends BasicController implements ControllerEven
int posid = 0;
if (sPosid != null) posid = Integer.parseInt(sPosid);
if (cmd.equals("up")) {
if (posid > 0) {
List<Response> elements = item.getQuestion().getResponses();
List<Response> elements = item.getQuestion().getResponses();
if (posid > 0 && posid < item.getQuestion().getResponses().size()) {
Response obj = elements.remove(posid);
elements.add(posid - 1, obj);
} else {
logError("posid doesn't match responses length: " + posid + "/" + elements.size(), null);
}
} else if (cmd.equals("down")) {
List<Response> elements = item.getQuestion().getResponses();
if (posid < elements.size() - 1) {
if (posid >= 0 && posid < elements.size() - 1) {
Response obj = elements.remove(posid);
elements.add(posid + 1, obj);
} else {
logError("posid doesn't match responses length: " + posid + "/" + elements.size(), null);
}
} else if (cmd.equals("editq")) {
editQuestion = item.getQuestion().getQuestion();
displayMaterialFormController(ureq, editQuestion, restrictedEdit);
} else if (cmd.equals("editr")) {
editResponse = item.getQuestion().getResponses().get(posid);
Material responseMat = item.getQuestion().getResponses().get(posid).getContent();
displayMaterialFormController(ureq, responseMat, restrictedEdit);
List<Response> elements = item.getQuestion().getResponses();
if (posid >= 0 && posid < elements.size()) {
editResponse = elements.get(posid);
Material responseMat = elements.get(posid).getContent();
displayMaterialFormController(ureq, responseMat, restrictedEdit);
} else {
logError("posid doesn't match responses length: " + posid + "/" + elements.size(), null);
}
} else if (cmd.equals("addtext")) {
FIBQuestion fib = (FIBQuestion) item.getQuestion();
FIBResponse response = new FIBResponse();
......
......@@ -616,7 +616,7 @@ public class ItemsController extends BasicController implements Activateable2 {
naviCtr.add(currentItem);
// ... and also to the helper
helper.addItem(currentItem);
if (feed.getItems().size() == 1) {
if (feed.getItems() != null && feed.getItems().size() == 1) {
// First item added, show feed url (for subscription)
fireEvent(ureq, ItemsController.FEED_INFO_IS_DIRTY_EVENT);
// Set the base URI of the feed for the current user. All users
......
......@@ -96,6 +96,33 @@ public class LTIManagerTest extends OlatTestCase {
Assert.assertTrue(outcomes.contains(outcome2));
}
@Test
public void deleteOutcome() {
Identity id = JunitTestHelper.createAndPersistIdentityAsUser("lti-3-" + UUID.randomUUID().toString());
OLATResource resource1 = JunitTestHelper.createRandomResource();
OLATResource resource2 = JunitTestHelper.createRandomResource();
LTIOutcome outcome1 = ltiManager.createOutcome(id, resource1, "sub", "update", "new-outcome", "lti score value");
LTIOutcome outcome2 = ltiManager.createOutcome(id, resource1, "sub", "delete", "new-outcome", null);
LTIOutcome outcome3 = ltiManager.createOutcome(id, resource2, "sub", "delete", "new-outcome", null);
dbInstance.commitAndCloseSession();
//check they exist
List<LTIOutcome> outcomes1 = ltiManager.loadOutcomes(id, resource1, "sub");
Assert.assertEquals(2, outcomes1.size());
Assert.assertTrue(outcomes1.contains(outcome1));
Assert.assertTrue(outcomes1.contains(outcome2));
List<LTIOutcome> outcomes2 = ltiManager.loadOutcomes(id, resource2, "sub");
Assert.assertEquals(1, outcomes2.size());
//delete outcomes of resource 1
ltiManager.deleteOutcomes(resource1);
dbInstance.commitAndCloseSession();
//check that only the outcome of resource 2 survives
List<LTIOutcome> checkOutcomes1 = ltiManager.loadOutcomes(id, resource1, "sub");
Assert.assertTrue(checkOutcomes1.isEmpty());
List<LTIOutcome> checkOutcomes2 = ltiManager.loadOutcomes(id, resource2, "sub");
Assert.assertEquals(1, checkOutcomes2.size());
Assert.assertTrue(checkOutcomes2.contains(outcome3));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment