Skip to content
Snippets Groups Projects
Commit 626d841a authored by srosse's avatar srosse
Browse files

OO-515: fix opening QTI test and survey made for Onyx

parent 350f12e0
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,7 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler { ...@@ -66,7 +66,7 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler {
private static final boolean DOWNLOADEABLE = true; private static final boolean DOWNLOADEABLE = true;
private static final boolean EDITABLE = true; private static final boolean EDITABLE = true;
static List supportedTypes; static List<String> supportedTypes;
/** /**
* Default constructor. * Default constructor.
...@@ -78,48 +78,57 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler { ...@@ -78,48 +78,57 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler {
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#getSupportedTypes() * @see org.olat.repository.handlers.RepositoryHandler#getSupportedTypes()
*/ */
public List getSupportedTypes() { public List<String> getSupportedTypes() {
return supportedTypes; return supportedTypes;
} }
static { // initialize supported types static { // initialize supported types
supportedTypes = new ArrayList(1); supportedTypes = new ArrayList<String>(1);
supportedTypes.add(SurveyFileResource.TYPE_NAME); supportedTypes.add(SurveyFileResource.TYPE_NAME);
} }
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#supportsLaunch() * @see org.olat.repository.handlers.RepositoryHandler#supportsLaunch()
*/ */
public boolean supportsLaunch() { return LAUNCHEABLE; } public boolean supportsLaunch() {
return LAUNCHEABLE;
}
//<OLATCE-1025> //<OLATCE-1025>
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#supportsDownload() * @see org.olat.repository.handlers.RepositoryHandler#supportsDownload()
*/ */
public boolean supportsDownload() { return DOWNLOADEABLE; } public boolean supportsDownload() {
return DOWNLOADEABLE;
}
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#supportsEdit() * @see org.olat.repository.handlers.RepositoryHandler#supportsEdit()
*/ */
@Override
public boolean supportsEdit(RepositoryEntry repoEntry) { public boolean supportsEdit(RepositoryEntry repoEntry) {
if (OnyxModule.isOnyxTest(repoEntry.getOlatResource())) { if (OnyxModule.isOnyxTest(repoEntry.getOlatResource())) {
return false; return false;
} }
return EDITABLE; return EDITABLE;
} }
//</OLATCE-1025> //</OLATCE-1025>
//<OLATCE-1025> //<OLATCE-1025>
public MainLayoutController createLaunchController(OLATResourceable res, String initialViewIdentifier, UserRequest ureq, WindowControl wControl) {
return (MainLayoutController) getLaunchController( res, ureq, wControl);
}
//</OLATCE-1025> //</OLATCE-1025>
@Override
public MainLayoutController createLaunchController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
return (MainLayoutController)getLaunchController( res, ureq, wControl);
}
/** /**
* @param res * @param res
* @param ureq * @param ureq
* @param wControl * @param wControl
* @return Controller * @return Controller
*/ */
@Override
public Controller getLaunchController(OLATResourceable res, UserRequest ureq, WindowControl wControl) { public Controller getLaunchController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
//<OLATCE-1025> //<OLATCE-1025>
if (OnyxModule.isOnyxTest(res)) { if (OnyxModule.isOnyxTest(res)) {
...@@ -142,6 +151,7 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler { ...@@ -142,6 +151,7 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler {
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#getEditorController(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) * @see org.olat.repository.handlers.RepositoryHandler#getEditorController(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
*/ */
@Override
public Controller createEditorController(OLATResourceable res, UserRequest ureq, WindowControl wControl) { public Controller createEditorController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
//<OLATCE-1025> //<OLATCE-1025>
if (OnyxModule.isOnyxTest(res)) { if (OnyxModule.isOnyxTest(res)) {
...@@ -149,38 +159,26 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler { ...@@ -149,38 +159,26 @@ class QTISurveyHandlerOnyx extends QTISurveyHandler {
} else { } else {
return super.createEditorController(res, ureq, wControl); return super.createEditorController(res, ureq, wControl);
} }
// SurveyFileResource fr = new SurveyFileResource();
// fr.overrideResourceableId(res.getResourceableId());
//
// //check if we can edit in restricted mode -> only typos
// ReferenceManager refM = ReferenceManager.getInstance();
// List referencees = refM.getReferencesTo(res);
// //String referencesSummary = refM.getReferencesToSummary(res, ureq.getLocale());
// //boolean restrictedEdit = referencesSummary != null;
// QTIEditorMainController editor = new QTIEditorMainController(referencees,ureq, wControl, fr);
// if (editor.isLockedSuccessfully()) {
// return editor;
// } else {
// return null;
// }
//</OLATCE-1025> //</OLATCE-1025>
} }
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#getAddController(org.olat.repository.controllers.RepositoryAddCallback, java.lang.Object, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) * @see org.olat.repository.handlers.RepositoryHandler#getAddController(org.olat.repository.controllers.RepositoryAddCallback, java.lang.Object, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
*/ */
@Override
public IAddController createAddController(RepositoryAddCallback callback, Object userObject, UserRequest ureq, WindowControl wControl) { public IAddController createAddController(RepositoryAddCallback callback, Object userObject, UserRequest ureq, WindowControl wControl) {
if (userObject == null || userObject.equals(RepositoryAddController.PROCESS_ADD)) if (userObject == null || userObject.equals(RepositoryAddController.PROCESS_ADD))
return new AddFileResourceController(callback, supportedTypes, new String[] {"zip"}, ureq, wControl); return new AddFileResourceController(callback, supportedTypes, new String[] {"zip"}, ureq, wControl);
else//RepositoryAddController.PROCESS_NEW else//RepositoryAddController.PROCESS_NEW
return new AddNewQTIDocumentController(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY, callback, ureq, wControl); return new AddNewQTIDocumentController(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY, callback, ureq, wControl);
} }
@Override
protected String getDeletedFilePrefix() { protected String getDeletedFilePrefix() {
return "del_qtisurvey_"; return "del_qtisurvey_";
} }
@Override
public WizardCloseResourceController createCloseResourceController(UserRequest ureq, WindowControl wControl, RepositoryEntry repositoryEntry) { public WizardCloseResourceController createCloseResourceController(UserRequest ureq, WindowControl wControl, RepositoryEntry repositoryEntry) {
throw new AssertException("not implemented"); throw new AssertException("not implemented");
} }
......
...@@ -39,15 +39,9 @@ import org.olat.core.gui.control.generic.layout.MainLayoutController; ...@@ -39,15 +39,9 @@ import org.olat.core.gui.control.generic.layout.MainLayoutController;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.ims.qti.editor.AddNewQTIDocumentController; import org.olat.ims.qti.editor.AddNewQTIDocumentController;
import org.olat.ims.qti.editor.QTIEditorMainController;
import org.olat.ims.qti.fileresource.TestFileResource; import org.olat.ims.qti.fileresource.TestFileResource;
import org.olat.ims.qti.process.AssessmentInstance; import org.olat.ims.qti.process.AssessmentInstance;
import org.olat.ims.qti.process.ImsRepositoryResolver;
import org.olat.ims.qti.process.Resolver;
import org.olat.ims.qti.repository.handlers.QTITestHandler; import org.olat.ims.qti.repository.handlers.QTITestHandler;
import org.olat.modules.iq.IQManager;
import org.olat.modules.iq.IQPreviewSecurityCallback;
import org.olat.modules.iq.IQSecurityCallback;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.controllers.AddFileResourceController; import org.olat.repository.controllers.AddFileResourceController;
import org.olat.repository.controllers.IAddController; import org.olat.repository.controllers.IAddController;
...@@ -55,7 +49,6 @@ import org.olat.repository.controllers.RepositoryAddCallback; ...@@ -55,7 +49,6 @@ import org.olat.repository.controllers.RepositoryAddCallback;
import org.olat.repository.controllers.RepositoryAddController; import org.olat.repository.controllers.RepositoryAddController;
import org.olat.repository.controllers.WizardCloseResourceController; import org.olat.repository.controllers.WizardCloseResourceController;
import org.olat.resource.accesscontrol.ui.RepositoryMainAccessControllerWrapper; import org.olat.resource.accesscontrol.ui.RepositoryMainAccessControllerWrapper;
import org.olat.resource.references.ReferenceManager;
import de.bps.onyx.plugin.OnyxModule; import de.bps.onyx.plugin.OnyxModule;
import de.bps.onyx.plugin.run.OnyxRunController; import de.bps.onyx.plugin.run.OnyxRunController;
...@@ -74,28 +67,31 @@ public class QTITestHandlerOnyx extends QTITestHandler { ...@@ -74,28 +67,31 @@ public class QTITestHandlerOnyx extends QTITestHandler {
private static final boolean DOWNLOADEABLE = true; private static final boolean DOWNLOADEABLE = true;
private static final boolean EDITABLE = true; private static final boolean EDITABLE = true;
static List supportedTypes; static List<String> supportedTypes;
/** /**
* Default construcotr. * Default constructor.
*/ */
public QTITestHandlerOnyx() { super(); } public QTITestHandlerOnyx() {
super();
}
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#getSupportedTypes() * @see org.olat.repository.handlers.RepositoryHandler#getSupportedTypes()
*/ */
public List getSupportedTypes() { public List<String> getSupportedTypes() {
return supportedTypes; return supportedTypes;
} }
static { // initialize supported types static { // initialize supported types
supportedTypes = new ArrayList(1); supportedTypes = new ArrayList<String>(1);
supportedTypes.add(TestFileResource.TYPE_NAME); supportedTypes.add(TestFileResource.TYPE_NAME);
} }
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#supportsLaunch() * @see org.olat.repository.handlers.RepositoryHandler#supportsLaunch()
*/ */
@Override
public boolean supportsLaunch(RepositoryEntry repoEntry) { public boolean supportsLaunch(RepositoryEntry repoEntry) {
return LAUNCHEABLE; return LAUNCHEABLE;
} }
...@@ -103,18 +99,24 @@ public class QTITestHandlerOnyx extends QTITestHandler { ...@@ -103,18 +99,24 @@ public class QTITestHandlerOnyx extends QTITestHandler {
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#supportsDownload() * @see org.olat.repository.handlers.RepositoryHandler#supportsDownload()
*/ */
public boolean supportsDownload(RepositoryEntry repoEntry) { return DOWNLOADEABLE; } @Override
public boolean supportsDownload(RepositoryEntry repoEntry) {
return DOWNLOADEABLE;
}
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#supportsEdit() * @see org.olat.repository.handlers.RepositoryHandler#supportsEdit()
*/ */
@Override
public boolean supportsEdit(RepositoryEntry repoEntry) { public boolean supportsEdit(RepositoryEntry repoEntry) {
if (OnyxModule.isOnyxTest(repoEntry.getOlatResource())) { if (OnyxModule.isOnyxTest(repoEntry.getOlatResource())) {
return false; return false;
} }
return EDITABLE; return EDITABLE;
} }
public MainLayoutController createLaunchController(OLATResourceable res, String initialViewIdentifier, UserRequest ureq, WindowControl wControl) { @Override
public MainLayoutController createLaunchController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
MainLayoutController layoutCtr = (MainLayoutController) getLaunchController( res, ureq, wControl); MainLayoutController layoutCtr = (MainLayoutController) getLaunchController( res, ureq, wControl);
//fxdiff VCRP-1: access control of learn resources //fxdiff VCRP-1: access control of learn resources
RepositoryMainAccessControllerWrapper wrapper = new RepositoryMainAccessControllerWrapper(ureq, wControl, res, layoutCtr); RepositoryMainAccessControllerWrapper wrapper = new RepositoryMainAccessControllerWrapper(ureq, wControl, res, layoutCtr);
...@@ -127,11 +129,9 @@ public class QTITestHandlerOnyx extends QTITestHandler { ...@@ -127,11 +129,9 @@ public class QTITestHandlerOnyx extends QTITestHandler {
* @param wControl * @param wControl
* @return Controller * @return Controller
*/ */
@Override
public Controller getLaunchController(OLATResourceable res, UserRequest ureq, WindowControl wControl) { public Controller getLaunchController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
if (OnyxModule.isOnyxTest(res)) { if (OnyxModule.isOnyxTest(res)) {
Resolver resolver = new ImsRepositoryResolver(res);
IQSecurityCallback secCallback = new IQPreviewSecurityCallback();
// <OLATCE-1054> // <OLATCE-1054>
Controller runController = new OnyxRunController(ureq, wControl, res, false); Controller runController = new OnyxRunController(ureq, wControl, res, false);
// </OLATCE-1054> // </OLATCE-1054>
...@@ -148,33 +148,19 @@ public class QTITestHandlerOnyx extends QTITestHandler { ...@@ -148,33 +148,19 @@ public class QTITestHandlerOnyx extends QTITestHandler {
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#getEditorController(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) * @see org.olat.repository.handlers.RepositoryHandler#getEditorController(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
*/ */
@Override
public Controller createEditorController(OLATResourceable res, UserRequest ureq, WindowControl wControl) { public Controller createEditorController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
if (OnyxModule.isOnyxTest(res)) { if (OnyxModule.isOnyxTest(res)) {
return null; return null;
} else { } else {
return super.createEditorController(res, ureq, wControl); return super.createEditorController(res, ureq, wControl);
} }
// TestFileResource fr = new TestFileResource();
// fr.overrideResourceableId(res.getResourceableId());
//
// //check if we can edit in restricted mode -> only typos
// ReferenceManager refM = ReferenceManager.getInstance();
// List referencees = refM.getReferencesTo(res);
// //String referencesSummary = refM.getReferencesToSummary(res, ureq.getLocale());
// //boolean restrictedEdit = referencesSummary != null;
// QTIEditorMainController editor = new QTIEditorMainController(referencees,ureq, wControl, fr);
// if (editor.isLockedSuccessfully()) {
// return editor;
// } else {
// return null;
// }
} }
/** /**
* @see org.olat.repository.handlers.RepositoryHandler#getAddController(org.olat.repository.controllers.RepositoryAddCallback, java.lang.Object, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) * @see org.olat.repository.handlers.RepositoryHandler#getAddController(org.olat.repository.controllers.RepositoryAddCallback, java.lang.Object, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
*/ */
@Override
public IAddController createAddController(RepositoryAddCallback callback, Object userObject, UserRequest ureq, WindowControl wControl) { public IAddController createAddController(RepositoryAddCallback callback, Object userObject, UserRequest ureq, WindowControl wControl) {
if (userObject == null || userObject.equals(RepositoryAddController.PROCESS_ADD)) if (userObject == null || userObject.equals(RepositoryAddController.PROCESS_ADD))
return new AddFileResourceController(callback, supportedTypes, new String[] {"zip"}, ureq, wControl); return new AddFileResourceController(callback, supportedTypes, new String[] {"zip"}, ureq, wControl);
...@@ -182,12 +168,13 @@ public class QTITestHandlerOnyx extends QTITestHandler { ...@@ -182,12 +168,13 @@ public class QTITestHandlerOnyx extends QTITestHandler {
return new AddNewQTIDocumentController(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS, callback, ureq, wControl); return new AddNewQTIDocumentController(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS, callback, ureq, wControl);
} }
@Override
protected String getDeletedFilePrefix() { protected String getDeletedFilePrefix() {
return "del_qtitest_"; return "del_qtitest_";
} }
@Override
public WizardCloseResourceController createCloseResourceController(UserRequest ureq, WindowControl wControl, RepositoryEntry repositoryEntry) { public WizardCloseResourceController createCloseResourceController(UserRequest ureq, WindowControl wControl, RepositoryEntry repositoryEntry) {
throw new AssertException("not implemented"); throw new AssertException("not implemented");
} }
} }
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