Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Using context.module or panels.module I would like to have multiple chat windows on a single page.
Comment | File | Size | Author |
---|---|---|---|
#10 | multiple_chats-1495374-10.patch | 975 bytes | langworthy |
#1 | multiple_chats-1495374-1.patch | 1.91 KB | langworthy |
Comments
Comment #1
langworthy CreditAttribution: langworthy commentedPatch attached. I wouldn't be surprised if there is a more efficient way of doing this.
Comment #2
langworthy CreditAttribution: langworthy commentedComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedthanks, will review tonight/tomorrow.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedthe intention of this line in chatroom.module is to key each chat by it's cid, so we can have multiple on the page by allowing multiple to be sent down in Drupal.settings.chatroom.chats:
and this snippet in chatroom.js is meant to process them:
so, the current code at least intends to handle the multi-chat window case.
what errors where you seeing that led to this patch?
Comment #5
langworthy CreditAttribution: langworthy commentedWhen there is a single chat window on the page
Drupal.settings.chatroom.chats
is an object. When there are more than one it is an array of objects. The patch checks if it is an object or an array, and if it is an array it finds the proper object to work with.Comment #6
langworthy CreditAttribution: langworthy commentedThe patch doesn't change anything in
Drupal.Nodejs.connectionSetupHandlers.chatroom
. The only problems I ran into was inDrupal.chatroom.initialiseChat
(Drupal.settings.chatroom.chats[this.id.replace(/^edit-chatroom-message-entry-box-/, '')];
is undefined)Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedok, cool.
so the bug seems to me that it should always be an object, keyed by the cid of the chat. does that make sense? i'd rather make php send down js that can always be addressed the same way rather than adding a special case check to the js.
Comment #8
langworthy CreditAttribution: langworthy commentedIt makes some sense but I'm not sure how to make it work as desired. I've played around with the
drupal_add_js()
code from #4 but no luck.Comment #9
langworthy CreditAttribution: langworthy commentedSo I'm starting to understand this better.
Right now:
Results in
Drupal.settings.chatroom.chats
being:When there are two chat windows on the page.
We want it to be:
And each chat object will be a property of this Object keyed by cid (as described in #7).
There seems to be something getting messed up in the PHP->JS as:
Will end up with the correct format, only it has 'x' appended to each key.
But:
Doesn't work.
Comment #10
langworthy CreditAttribution: langworthy commentedI think we need to fix this once on the JS side.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedi think i agree with this. we can even ditch the attempt to index by cid in php, and just add chats to the array.
i'm holding off committing this, however, because now that i'm really playing with multiple chats on the same page, i'm uncovering lower lever bugs in contentTokenChannel handling which i want to fix first.