Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ADF-1784/Side by side authoring #2585

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
82a08fb
fix: synchronize the authoring view with the component version
jsconan Sep 24, 2024
a75efda
refactor: convert to ES6
jsconan Sep 24, 2024
5d2f9ab
Merge branch 'feat/HKD-6/integration' into feature/ADF-1784/side-by-s…
jsconan Sep 25, 2024
a9e7a4a
feat: forward the translation parameters through the config
jsconan Sep 25, 2024
88a9ec1
feat: manage dynamically the placeholders for the authoring panels
jsconan Sep 25, 2024
4f16c38
feat: do not show up the list of interactions if the translation mode…
jsconan Sep 25, 2024
2cb0ae7
feat: handle the translation mode in the item's properties panel
jsconan Sep 25, 2024
5c55de5
refactor: also apply the dynamic templates to the authoring component…
jsconan Sep 26, 2024
73f127c
feat: add the placeholder for the item viewer and style the frame
jsconan Sep 26, 2024
5025638
chore: bundle assets
jsconan Sep 26, 2024
3f1fbf4
fix: remove duplicate creating toolbar misplacement in side-by-side mode
jsconan Sep 27, 2024
7ab1b21
feat: minimal size for the item
jsconan Sep 27, 2024
fe1289f
chore: bundle assets
jsconan Sep 27, 2024
3ee7fa4
fix: decrease z-index for the item-viewer separator handle
jsconan Sep 27, 2024
e1bd345
feat: move the item-viewer to a plugin
jsconan Sep 27, 2024
0dac8c2
fix: use class instead of id in the item viewer, reserve space for th…
jsconan Sep 27, 2024
ee921b1
feat: display the title of the original item, add context suffix
jsconan Sep 27, 2024
283ce5d
fix: add the missing aread to the component as well
jsconan Sep 27, 2024
7f16aaf
chore: bundle assets
jsconan Sep 27, 2024
94e8e97
feat: handle the resize of the item viewer
jsconan Sep 30, 2024
2c1507e
fix: wrong name for the itemViewer plugin
jsconan Sep 30, 2024
8759500
fix: always set the value for the translation properties
jsconan Oct 8, 2024
ac14b50
feat: add the viewer to the side-by-side authoring
jsconan Oct 9, 2024
9a2beb9
feat: also manage the translation progress
jsconan Oct 10, 2024
20c280e
feat: add the translation language to the item's title
jsconan Oct 10, 2024
f1b9fa7
refactor: use a more consistent naming for the origin URI
jsconan Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions controller/QtiCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ protected function getCreatorConfig(core_kernel_classes_Resource $item)
$lang = \common_session_SessionManager::getSession()->getDataLanguage();
$config->setProperty('lang', $lang);

// Add support for translation and side-by-side view
$config->setProperty('translation', $this->getRequestParameter('translation'));
$config->setProperty('originResourceUri', $this->getRequestParameter('originResourceUri'));

//base url:
$url = tao_helpers_Uri::url('getFile', 'QtiCreator', 'taoQtiItem', [
'uri' => $item->getUri(),
Expand Down
2 changes: 1 addition & 1 deletion views/css/item-creator.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/css/item-creator.css.map

Large diffs are not rendered by default.

114 changes: 68 additions & 46 deletions views/js/controller/creator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2016-2019 (original work) Open Assessment Technologies SA ;
* Copyright (c) 2016-2024 (original work) Open Assessment Technologies SA ;
*
*/


/**
* creator/index controller
*
Expand All @@ -28,44 +27,65 @@ define([
'lodash',
'module',
'core/logger',
'core/promise',
'ui/feedback',
'layout/loading-bar',
'taoQtiItem/qtiCreator/itemCreator',
'taoQtiItem/qtiCreator/editor/areaBroker',
'taoQtiItem/qtiCreator/plugins/loader'
], function($, _, module, loggerFactory, Promise, feedback, loadingBar, itemCreatorFactory, areaBrokerFactory, pluginLoader){
'taoQtiItem/qtiCreator/plugins/loader',
'tpl!taoQtiItem/qtiCreator/tpl/layout/interactionsPanel',
'tpl!taoQtiItem/qtiCreator/tpl/layout/itemPanel',
'tpl!taoQtiItem/qtiCreator/tpl/layout/propertiesPanel'
], function (
$,
_,
module,
loggerFactory,
feedback,
loadingBar,
itemCreatorFactory,
areaBrokerFactory,
pluginLoader,
interactionsPanelTpl,
itemPanelTpl,
propertiesPanelTpl
) {
'use strict';

/**
* Set up the areaBroker mapping from the actual DOM
* @returns {areaBroker} already mapped
*/
const loadAreaBroker = function loadAreaBroker(){
function loadAreaBroker(config) {
const $container = $('#item-editor-scope');
const $wrapper = $('#item-editor-wrapper', $container);
const panels = [itemPanelTpl, propertiesPanelTpl];
if (!config || !config.properties || !config.properties.translation) {
panels.unshift(interactionsPanelTpl);
}
panels.forEach(panel => $wrapper.append(panel()));
return areaBrokerFactory($container, {
'menu': $('.menu', $container),
'menuLeft': $('.menu-left', $container),
'menuRight': $('.menu-right', $container),
'contentCreatorPanel': $('#item-editor-panel', $container),
'editorBar': $('#item-editor-panel .item-editor-bar', $container),
'title': $('#item-editor-panel .item-editor-bar h1', $container),
'toolbar': $('#item-editor-panel .item-editor-bar #toolbar-top', $container),
'interactionPanel': $('#item-editor-interaction-bar', $container),
'propertyPanel': $('#item-editor-item-widget-bar', $container),
'itemPanel': $('#item-editor-scroll-inner', $container),
'itemPropertyPanel': $('#sidebar-right-item-properties', $container),
'itemStylePanel': $('#item-style-editor-bar', $container),
'modalContainer': $('#modal-container', $container),
'elementPropertyPanel': $('#item-editor-body-element-property-bar .panel', $container)
menu: $('.menu', $container),
menuLeft: $('.menu-left', $container),
menuRight: $('.menu-right', $container),
contentCreatorPanel: $('#item-editor-panel', $container),
editorBar: $('#item-editor-panel .item-editor-bar', $container),
editorWrapper: $('#item-editor-wrapper', $container),
title: $('#item-editor-panel .item-editor-bar h1', $container),
toolbar: $('#item-editor-panel .item-editor-bar #toolbar-top', $container),
interactionPanel: $('#item-editor-interaction-bar', $container),
propertyPanel: $('#item-editor-item-widget-bar', $container),
itemPanel: $('#item-editor-scroll-inner', $container),
itemPropertyPanel: $('#sidebar-right-item-properties', $container),
itemStylePanel: $('#item-style-editor-bar', $container),
modalContainer: $('#modal-container', $container),
elementPropertyPanel: $('#item-editor-body-element-property-bar .panel', $container)
});
};
}

/**
* The creator's controller
*/
const indexController = {

/**
* The entrypoint
*/
Expand All @@ -78,34 +98,36 @@ define([
* Report errors
* @param {Error} err - the error to report
*/
const reportError = function reportError(err){
function reportError(err) {
loadingBar.stop();

logger.error(err);

if(err instanceof Error){
if (err instanceof Error) {
feedback().error(err.message);
}
};
}

loadingBar.start();

//load plugins dynamically
if (config) {
if(config.plugins){
config.properties.allowCustomTemplate = config.plugins.some(({ name }) => name === 'xmlResponseProcessing');
if (config.plugins) {
config.properties.allowCustomTemplate = config.plugins.some(
({ name }) => name === 'xmlResponseProcessing'
);

_.forEach(config.plugins, plugin => {
if(plugin && plugin.module){
if (plugin && plugin.module) {
pluginLoader.add(plugin);
}
});
}
if(config.contextPlugins){

if (config.contextPlugins) {
_.forEach(config.contextPlugins, plugin => {
if(plugin && plugin.module){
if(plugin.exclude){
if (plugin && plugin.module) {
if (plugin.exclude) {
pluginLoader.remove(plugin.module);
} else {
pluginLoader.add(plugin);
Expand All @@ -116,22 +138,22 @@ define([
}

//load the plugins
pluginLoader.load().then(function(){

//build a new item creator
itemCreatorFactory(config, loadAreaBroker(), pluginLoader.getPlugins())
.on('error', reportError)
.on('success', message => feedback().success(message) )
.on('init', function(){
this.render();
})
.on('ready', () => loadingBar.stop() )
.init();
})
.catch(reportError);
pluginLoader
.load()
.then(() => {
//build a new item creator
itemCreatorFactory(config, loadAreaBroker(config), pluginLoader.getPlugins())
.on('error', reportError)
.on('success', message => feedback().success(message))
.on('init', function onInit() {
this.render();
})
.on('ready', () => loadingBar.stop())
.init();
})
.catch(reportError);
}
};

return indexController;
});

45 changes: 28 additions & 17 deletions views/js/qtiCreator/component/itemAuthoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2019 Open Assessment Technologies SA ;
* Copyright (c) 2019-2024 Open Assessment Technologies SA ;
*/
/**
* @author Jean-Sébastien Conan <jean-sebastien@taotesting.com>
Expand All @@ -25,6 +25,9 @@ define([
'taoQtiItem/qtiCreator/itemCreator',
'taoQtiItem/qtiCreator/editor/areaBroker',
'tpl!taoQtiItem/qtiCreator/component/tpl/itemAuthoring',
'tpl!taoQtiItem/qtiCreator/tpl/layout/interactionsPanel',
'tpl!taoQtiItem/qtiCreator/tpl/layout/itemPanel',
'tpl!taoQtiItem/qtiCreator/tpl/layout/propertiesPanel',
'css!taoQtiItemCss/qti-runner.css',
'css!taoQtiItemCss/themes/default.css',
'css!taoQtiItemCss/item-creator.css'
Expand All @@ -34,7 +37,10 @@ define([
pluginLoaderFactory,
itemCreatorFactory,
areaBrokerFactory,
componentTpl
componentTpl,
interactionsPanelTpl,
itemPanelTpl,
propertiesPanelTpl
) {
'use strict';

Expand Down Expand Up @@ -110,29 +116,34 @@ define([
});

// load the plugins, then render the item creator
pluginLoader.load()
pluginLoader
.load()
.then(() => this.render(container))
.catch(err => this.trigger('error', err));
})

// renders the component
.on('render', function () {
const $container = this.getElement();
const panels = [interactionsPanelTpl, itemPanelTpl, propertiesPanelTpl];
const $wrapper = $('#item-editor-wrapper', $container);
panels.forEach(panel => $wrapper.append(panel()));
areaBroker = areaBrokerFactory($container, {
'menu': $container.find('.menu'),
'menuLeft': $container.find('.menu-left'),
'menuRight': $container.find('.menu-right'),
'contentCreatorPanel': $container.find('#item-editor-panel'),
'editorBar': $container.find('#item-editor-panel .item-editor-bar'),
'title': $container.find('#item-editor-panel .item-editor-bar h1'),
'toolbar': $container.find('#item-editor-panel .item-editor-bar #toolbar-top'),
'interactionPanel': $container.find('#item-editor-interaction-bar'),
'propertyPanel': $container.find('#item-editor-item-widget-bar'),
'itemPanel': $container.find('#item-editor-scroll-inner'),
'itemPropertyPanel': $container.find('#sidebar-right-item-properties'),
'itemStylePanel': $container.find('#item-style-editor-bar'),
'modalContainer': $container.find('#modal-container'),
'elementPropertyPanel': $container.find('#item-editor-body-element-property-bar .panel')
menu: $container.find('.menu'),
menuLeft: $container.find('.menu-left'),
menuRight: $container.find('.menu-right'),
contentCreatorPanel: $container.find('#item-editor-panel'),
editorBar: $container.find('#item-editor-panel .item-editor-bar'),
editorWrapper: $container.find('#item-editor-wrapper'),
title: $container.find('#item-editor-panel .item-editor-bar h1'),
toolbar: $container.find('#item-editor-panel .item-editor-bar #toolbar-top'),
interactionPanel: $container.find('#item-editor-interaction-bar'),
propertyPanel: $container.find('#item-editor-item-widget-bar'),
itemPanel: $container.find('#item-editor-scroll-inner'),
itemPropertyPanel: $container.find('#sidebar-right-item-properties'),
itemStylePanel: $container.find('#item-style-editor-bar'),
modalContainer: $container.find('#modal-container'),
elementPropertyPanel: $container.find('#item-editor-body-element-property-bar .panel')
});

itemCreator = itemCreatorFactory(this.getConfig(), areaBroker, pluginLoader.getPlugins())
Expand Down
Loading