Index: openacs-4/packages/chat/www/resources/chat.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/resources/Attic/chat.css,v diff -u -r1.8 -r1.9 --- openacs-4/packages/chat/www/resources/chat.css 9 Nov 2018 16:48:36 -0000 1.8 +++ openacs-4/packages/chat/www/resources/chat.css 12 Nov 2018 16:35:32 -0000 1.9 @@ -6,6 +6,7 @@ #xowiki-chat-container { height: 70vh; width: 100%; + position: relative; } /* Users and messages container */ @@ -18,6 +19,21 @@ background-color: white; } +#xowiki-chat-fs { + height: 100vh; + width: 100%; + overflow: hidden; + display: flex; + background-color: white; + + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + zIndex: 999; +} + /* Users block */ #xowiki-chat-users { border: 1px solid #ddd; @@ -129,11 +145,32 @@ border-radius: 8px; } +/* Full screen trigger */ +.xowiki-chat-trigger-fs-block { + padding: 10px; +} + +.xowiki-chat-trigger-fs-link { + text-decoration: none; +} + +.xowiki-chat-trigger-fs-link:hover { + text-decoration: none !important; +} + +.xowiki-chat-trigger-fs-pic:hover { + background-color: white; + border: 1px solid white; +} + /* Responsive design */ @media (max-width: 1000px) { #xowiki-chat { flex-direction: column; } + #xowiki-chat-fs { + flex-direction: column; + } #xowiki-chat-users { order: 1; border-left: 1px solid #ddd; Index: openacs-4/packages/xowiki/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/chat-procs.tcl,v diff -u -r1.37 -r1.38 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 9 Nov 2018 20:09:40 -0000 1.37 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 12 Nov 2018 16:35:32 -0000 1.38 @@ -113,6 +113,9 @@ -package_key "chat" \ -parameter "LinkRegex"] + # Should we add a full screen link to the chat? + set fs_link_p true + # small JavaScript library to obtain a portable ajax request object template::head::add_javascript -src urn:ad:js:get-http-object -order 10 template::head::add_javascript -script "const linkRegex = \"${link_regex}\";" -order 19 @@ -163,15 +166,23 @@ set data [c1 login] if {$data ne ""} { append html [subst { - }] } + if {$fs_link_p} { + append html [subst { + + }] + } + switch -- $mode { "polling" { append html [subst -nocommands { Index: openacs-4/packages/xowiki/www/ajax/chat-common.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/ajax/Attic/chat-common.js,v diff -u -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/ajax/chat-common.js 9 Nov 2018 20:09:40 -0000 1.5 +++ openacs-4/packages/xowiki/www/ajax/chat-common.js 12 Nov 2018 16:35:32 -0000 1.6 @@ -3,6 +3,43 @@ var previous_user_id = ""; var current_color = ""; +// Full screen +function addFullScreenLink() { + + // Full screen trigger block + const triggerFSblock = document.createElement("div"); + triggerFSblock.className = 'xowiki-chat-trigger-fs-block'; + + // Full screen trigger + const triggerFSlink = document.createElement("a"); + triggerFSlink.className = 'xowiki-chat-trigger-fs-link'; + triggerFSlink.setAttribute("href", "javascript:void(0)"); + + // Trigger icon + var triggerFSoff = ''; + var triggerFSon = ''; + triggerFSlink.innerHTML = triggerFSon; + + // Full screen when clicked + triggerFSlink.onclick = () => { + var chat = document.getElementById('xowiki-chat'); + var chatFS = document.getElementById('xowiki-chat-fs'); + if (chat != null) { + chat.id = 'xowiki-chat-fs'; + triggerFSlink.innerHTML = triggerFSoff; + } else if (chatFS != null) { + chatFS.id = 'xowiki-chat'; + triggerFSlink.innerHTML = triggerFSon; + } + } + + // Add Full screen trigger to the chat + const formBlock = document.getElementById('xowiki-chat-messages-form-block'); + triggerFSblock.appendChild(triggerFSlink); + formBlock.appendChild(triggerFSblock); +} + +// Simple function to create links function createLink(text) { if (linkRegex != null) { return text.replace(new RegExp(linkRegex,'g'), function(url) { @@ -13,6 +50,7 @@ } } +// Render the data, being a user or a message function renderData(json) { if (json.type == "message") { renderMessage(json); @@ -21,6 +59,7 @@ } } +// Render the message function renderMessage(msg) { var messages = document.getElementById('xowiki-chat-messages'); var user = msg.user.replace(/\\'/g, "\""); @@ -91,6 +130,7 @@ document.getElementById('xowiki-chat-send').focus(); } +// Render the user in the user list function renderUsers(msg) { var users = document.getElementById('xowiki-chat-users'); while (users.hasChildNodes()) { @@ -129,6 +169,7 @@ } } +// Send the message function chatSendMsg(send_url, handler) { var msgField = document.getElementById('xowiki-chat-send'); var msg = msgField.value;