2018-05-13 12:06:32 +00:00
|
|
|
/**
|
|
|
|
* Conversation page main script file
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
|
|
|
|
ComunicWeb.pages.conversations.main = {
|
2018-05-16 05:00:06 +00:00
|
|
|
|
2018-05-13 12:06:32 +00:00
|
|
|
/**
|
|
|
|
* Open settings page
|
|
|
|
*
|
|
|
|
* @param {object} args Optionnal arguments
|
|
|
|
* @param {HTMLElement} target The target for the page
|
|
|
|
*/
|
|
|
|
open: function(args, target){
|
|
|
|
|
2020-04-09 09:36:32 +00:00
|
|
|
//Create a container
|
|
|
|
const container = createElem2({
|
2018-05-13 12:06:32 +00:00
|
|
|
appendTo: target,
|
|
|
|
type: "div",
|
2020-04-09 09:36:32 +00:00
|
|
|
class: "conversations-page-container"
|
2018-05-13 12:06:32 +00:00
|
|
|
});
|
|
|
|
|
2018-05-15 19:34:02 +00:00
|
|
|
//Check if a conversation has to be opened
|
|
|
|
if(args.subfolder){
|
2020-04-09 09:36:32 +00:00
|
|
|
ComunicWeb.pages.conversations.conversation.open(this.getCurrentConversationID(), container);
|
2018-05-15 19:34:02 +00:00
|
|
|
}
|
2018-05-16 04:47:41 +00:00
|
|
|
|
2020-04-09 09:36:32 +00:00
|
|
|
// Otherwise display the list of conversations
|
|
|
|
else {
|
|
|
|
ComunicWeb.pages.conversations.listPane.display(container);
|
|
|
|
}
|
2018-05-16 05:00:06 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine the current conversation ID
|
|
|
|
*
|
|
|
|
* @return {Number} The ID of the current conversation (0 if none found)
|
|
|
|
*/
|
|
|
|
getCurrentConversationID: function(){
|
|
|
|
|
|
|
|
var id = location.toString().split("/conversations/");
|
|
|
|
id = id[id.length - 1];
|
|
|
|
|
|
|
|
//Check if no ID is specified
|
|
|
|
if(id.length < 1)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return Number(id);
|
|
|
|
|
2018-05-13 12:06:32 +00:00
|
|
|
}
|
|
|
|
}
|