Index: lams_tool_doku/conf/etherpad-lite/node_modules/ep_resize/static/js/index.js =================================================================== diff -u --- lams_tool_doku/conf/etherpad-lite/node_modules/ep_resize/static/js/index.js (revision 0) +++ lams_tool_doku/conf/etherpad-lite/node_modules/ep_resize/static/js/index.js (revision 02b4f536341d8e6c4a9177839faa5f0b57c8ef22) @@ -0,0 +1,70 @@ +'use strict'; + +var lastHeight; +var lastWidth; +var returnchildHeights = function (children) { + var maxHeight = 0; + if (children.length) { + maxHeight = 0; + children.each(function (key, child) { + if ($(child).is(':visible')) { + var childtop = ($(child).offset().top + $(child).outerHeight()); + if (childtop > maxHeight) { + maxHeight = childtop; + } + } + }); + } + + return maxHeight; +}; + +exports.aceEditEvent = function (event, args, callback) { + var editbar = $('#editbar'); + + var elem = $('iframe[name=ace_outer]').contents().find('iframe[name=ace_inner]'); + var newHeight = elem.outerHeight() + (editbar.length ? editbar.outerHeight() : 0); + var newWidth = elem.outerWidth(); + + var maxChild = returnchildHeights($('iframe[name=ace_outer]').contents().find('body').children()); + var maxChildBody = returnchildHeights($('body').children()); + if (maxChildBody > maxChild) { + maxChild = maxChildBody + } + + if (maxChild > newHeight) { + newHeight = maxChild; + } + if (!lastHeight || !lastWidth || lastHeight !== newHeight || lastWidth !== newWidth) { + sendResizeMessage(newWidth, newHeight, window.document.location.href); + } + +}; + +exports.goToRevisionEvent = function (hook_name, context, cb) { + + var editbar = $('#timeslider-top') + var elem = $('#padeditor'); + + var newHeight = elem.outerHeight() + (editbar.length ? editbar.outerHeight() : 0); + var newWidth = elem.outerWidth(); + + if (!lastHeight || !lastWidth || lastHeight !== newHeight || lastWidth !== newWidth) { + sendResizeMessage(newWidth, newHeight, window.document.location.href); + } +}; + +var sendResizeMessage = function (width, height, location) { + lastHeight = height; + lastWidth = width; + + + window.parent.postMessage({ + name: 'ep_resize', + data: { + width: width, + height: height, + location : location + } + }, '*'); +} Index: lams_tool_doku/readme.txt =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r02b4f536341d8e6c4a9177839faa5f0b57c8ef22 --- lams_tool_doku/readme.txt (.../readme.txt) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_doku/readme.txt (.../readme.txt) (revision 02b4f536341d8e6c4a9177839faa5f0b57c8ef22) @@ -1,7 +1,10 @@ Modifications required to be done for Etherpad server (version #1.6.1): -* Copy the folder /lams_tool_doku/conf/etherpad-lite/src/ over to /${etherpad-lite-server-folder}/src/ -(it will copy three files /src/node/utils/Settings.js, /src/static/js/pad.js and /src/static/js/pad_userlist.js). +* Install ep_resize plugin +https://github.com/tiblu/ep_resize +* Copy the folder /lams_tool_doku/conf/etherpad-lite/ over to /${etherpad-lite-server-folder}/ +It customises Etherpad and the plugin + * In order to hide Etherpad index page make the following file empty: /${etherpad-lite-server-folder}/src/templates/index.html. Besides, one can turn on "editOnly" option in /${etherpad-lite-server-folder}/settings.json. This option's description: "Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads." Index: lams_tool_scratchie/web/WEB-INF/tags/Etherpad.tag =================================================================== diff -u -r1db1912a84326ba4b408dccfc6fc6dd1d740d0f8 -r02b4f536341d8e6c4a9177839faa5f0b57c8ef22 --- lams_tool_scratchie/web/WEB-INF/tags/Etherpad.tag (.../Etherpad.tag) (revision 1db1912a84326ba4b408dccfc6fc6dd1d740d0f8) +++ lams_tool_scratchie/web/WEB-INF/tags/Etherpad.tag (.../Etherpad.tag) (revision 02b4f536341d8e6c4a9177839faa5f0b57c8ef22) @@ -13,6 +13,7 @@ <%@ attribute name="showControls" required="false" rtexprvalue="true" %> <%@ attribute name="showChat" required="false" rtexprvalue="true" %> <%@ attribute name="height" required="false" rtexprvalue="true" %> +<%@ attribute name="heightAutoGrow" required="false" rtexprvalue="true" %> <%@ tag import="org.lamsfoundation.lams.util.Configuration"%> <%@ tag import="org.lamsfoundation.lams.util.ConfigurationKeys"%> @@ -37,6 +38,22 @@ var delayBeforeInitialise = typeof lamsEtherpadTagInitialiseDelay == 'undefined' ? 0 : lamsEtherpadTagInitialiseDelay; lamsEtherpadTagInitialiseDelay = delayBeforeInitialise + 1500; + + // Resize Etherpad iframe when its content grows. + // It does not support shrinking, only growing. + // This feature requires ep_resize plugin installed in Etherpad and customised with code in Doku tool + $(window).on('message onmessage', function (e) { + var msg = e.originalEvent.data; + if (msg.name === 'ep_resize') { + var src = msg.data.location.substring(0, msg.data.location.indexOf('?')), + iframe = $('iframe[src^="' + src + '"]'), + // height should be no less than 200 px + height = Math.max(200, msg.data.height); + iframe.height(height); + } + }); + + window.setTimeout(function(){ $.ajax({ url: 'etherpad/getPad.do', @@ -59,7 +76,7 @@ 'lang':'${fn:toLowerCase(localeLanguage)}', 'showControls':${empty showControls ? false : showControls}, 'showChat': ${empty showChat ? false : showChat}, - 'height': ${empty height ? '+$(window).height() - 200' : height} + 'height': ${empty height ? 'undefined' : height} ,'userName':' ' }); } Index: lams_tool_scratchie/web/pages/learning/scratchies.jsp =================================================================== diff -u -ra173c56737e22188f4ea7b1188b4282eaba5ed31 -r02b4f536341d8e6c4a9177839faa5f0b57c8ef22 --- lams_tool_scratchie/web/pages/learning/scratchies.jsp (.../scratchies.jsp) (revision a173c56737e22188f4ea7b1188b4282eaba5ed31) +++ lams_tool_scratchie/web/pages/learning/scratchies.jsp (.../scratchies.jsp) (revision 02b4f536341d8e6c4a9177839faa5f0b57c8ef22) @@ -112,7 +112,7 @@
${questionEtherpadContent}