Skip to content
Snippets Groups Projects
Commit 0120c01c authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Readd support to create copies of pool sessions

A new API endpoint is used to create a copy instead of locally exporting
and importing the session (2.3 behavior).
parent ed73b081
1 merge request!83Readd support to create copies of pool sessions
Pipeline #22541 passed with stages
in 1 minute and 10 seconds
......@@ -39,5 +39,40 @@ Ext.define("ARSnova.controller.SessionImport", {
}
});
return promise;
},
/**
* Creates a copy of a public pool session.
*
* @param sessionkey Session key of the public pool session
*/
copySessionFromPublicPool: function (sessionkey, sessionAttributes) {
var me = this;
var hideLoadMask = ARSnova.app.showLoadMask(Messages.LOAD_MASK_SESSION_PP_CLONE, 240000);
var showMySessionsPanel = function () {
// forward to session panel
var hTP = ARSnova.app.mainTabPanel.tabPanel.homeTabPanel;
hTP.animateActiveItem(hTP.mySessionsPanel, {
type: 'slide',
direction: 'right',
duration: 700
});
hideLoadMask();
};
var errorHandler = function (error) {
hideLoadMask();
};
ARSnova.app.restProxy.copySessionFromPublicPool(
sessionkey, sessionAttributes, {
success: function (response) {
showMySessionsPanel();
},
failure: function () {
console.log("Could not copy public pool session.");
}
}
);
}
});
......@@ -1081,6 +1081,16 @@ Ext.define('ARSnova.proxy.RestProxy', {
});
},
copySessionFromPublicPool: function (keyword, sessionAttributes, callbacks) {
this.arsjax.request({
url: "session/" + keyword + "/copyfrompublicpool",
method: "POST",
jsonData: sessionAttributes,
success: callbacks.success,
failure: callbacks.failure
});
},
getSubjectSort: function (sessionKeyword, isPreparation, callbacks) {
this.arsjax.request({
url: "lecturerquestion/subjectsort?sessionkey=" + sessionKeyword +
......
......@@ -307,6 +307,6 @@ Ext.define('ARSnova.view.home.PublicPoolSingleItemPanel', {
var customSessionAttributes = {};
customSessionAttributes.name = this.sessionName.getValue();
customSessionAttributes.shortName = this.sessionShortName.getValue();
ARSnova.app.getController("SessionExport").cloneSessionFromPublicPool(this.getSession(), customSessionAttributes);
ARSnova.app.getController("SessionImport").copySessionFromPublicPool(this.getSession().keyword, customSessionAttributes);
}
});
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment