--- /dev/null
+/*
+Copyright (c) Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
+For licensing, see README.txt or http://www.pentilanero.com (Cecill-C or AGPL or LGPL)
+*/
+Ext.ns("EntSavoie.InternalMessaging");
+EntSavoie.InternalMessaging.ImMainContainer = function (config) {
+ Ext.apply(this, config);
+
+ // Ajoute le texte des erreurs
+ Ext.QuickTips.init();
+ // turn on validation errors beside the field globally
+ Ext.form.Field.prototype.msgTarget = 'side';
+
+ // on creer une fenetre de configuration des comptes mails
+ this.mailAccountConfigurator = this.mailAccountConfigurator || new EntSavoie.InternalMessaging.MailAccountConfigurator({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ mainContainer: this,
+ language: this.language,
+ academicAdress: this.academicAdress,
+ mail: this.mail,
+ isValidAdress: this.isValidAdress,
+ isAcademicAdressChecked: this.isAcademicAdressChecked,
+ isMailChecked: this.isMailChecked,
+ isGeneratedAddress: this.isGeneratedAddress,
+ hasExternalMessagingRights: this.hasExternalMessagingRights
+ });
+
+ // on creer la zone de gauche qui affiche l'arbre des dossiers contenant les messages
+ this.treeFolderMessage = this.treeFolderMessage || new EntSavoie.InternalMessaging.ImTreeFolder({
+ incommingFolderId: this.incommingFolderId,
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ rssItemId: this.rssItemId,
+ chanelId: this.chanelId,
+ mainContainer: this
+ });
+
+ // on cree la zone qui affiche la liste des messages
+ this.gridMessagesView = this.gridMessagesView || new EntSavoie.InternalMessaging.ImGridMessageView({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ mainContainer: this,
+ incommingFolderId: this.incommingFolderId,
+ messageId: this.messageId,
+ rssItemId: this.rssItemId,
+ isIm: this.isIm,
+ folderId: this.folderId,
+ sendingFolderType: this.sendingFolderType
+ });
+
+ // on cree la zone qui affiche un message
+ this.messageItemView = this.messageItemView || new EntSavoie.InternalMessaging.ImItemMessageView({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ mainContainer: this
+ });
+
+ // on cree la zone qui affiche un mail
+ this.mailItemView = this.mailItemView || new EntSavoie.InternalMessaging.MailMessageView({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ hidden: true,
+ mainContainer: this
+ });
+
+ // on cree la zone qui affiche un item rss
+ this.rssItemView = this.rssItemView || new EntSavoie.InternalMessaging.RssItemView({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ hidden: true,
+ gridMessagesView: this.gridMessagesView,
+ mainContainer: this
+ });
+
+ this.addContactWindow = this.addContactWindow || new EntSavoie.InternalMessaging.AddContactWindow({
+ actionURLAjax: this.actionURLAjax,
+ renderURLAjax: this.renderURLAjax
+ });
+
+ this.itemViewCard = new Ext.Panel({
+ layout: "card",
+ activeItem: 0,
+ border:false,
+ items: [
+ this.messageItemView,
+ this.mailItemView,
+ this.rssItemView
+ ]
+ });
+
+ // on cree la fenetre de creation d'un message
+ this.createMessageWindow = this.createMessageWindow || new EntSavoie.InternalMessaging.CreateMessageView({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ mainContainer: this,
+ userGroupId: this.userGroupId,
+ sendToCasierBtnHide : true,
+ sendBtnLabel: this.i18n.InternalMessaging.ImMainContainer.sendBtnLabel,
+ activeMail: true,
+ language: this.language,
+ isGroupManagment: this.isGroupManagment,
+ isIM: true,
+ hasDirectoryRights: this.hasDirectoryRights,
+ hasExternalMessagingRights: this.hasExternalMessagingRights
+ });
+
+ this.attachedFilesView = this.attachedFilesView || new EntSavoie.InternalMessaging.AttachedFilesView({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ mainContainer: this
+ });
+
+ this.attachedFilesPanel = this.attachedFilesPanel || new Ext.Panel({
+ title: this.i18n.InternalMessaging.ImMainContainer.attachedFilesPanelTitle,
+ layout: 'fit',
+ //width: "auto",
+ height: 290,
+ region: 'south',
+ border: false,
+ collapsible: true,
+ collapsed: true,
+ items: [this.attachedFilesView]
+ });
+ this.attachedFilesPanel.on("bodyresize", this.messageItemView.onPjBtnClick , this.messageItemView);
+
+
+ EntSavoie.InternalMessaging.ImMainContainer.superclass.constructor.call(this, {
+ height: EntSavoie.FullScreen.fired()?EntSavoie.FullScreen.getContainerHeight():Global.Portlet.height,
+ layout:'border',
+ monitorResize: true,
+ width:"auto",
+ items:[
+ {
+ layout: 'fit',
+ width: 200,
+ region: 'west',
+ border: false,
+ items: [this.treeFolderMessage]
+ },
+ {
+ region:'center',
+ layout:'border',
+ border:false,
+ split: true,
+ items: [{
+ layout: 'fit',
+ width: "auto",
+ height: 250,
+ region: 'north',
+ split: true,
+ border: false,
+ items: [this.gridMessagesView]
+ },{
+ layout: 'fit',
+ width: "auto",
+ region: 'center',
+ border: false,
+ split: true,
+ items: [this.itemViewCard]
+ },
+ this.attachedFilesPanel
+ ]
+ }]
+ });
+
+};
+
+Ext.extend(EntSavoie.InternalMessaging.ImMainContainer, Ext.Panel, {
+ initComponent: function () {
+ EntSavoie.InternalMessaging.ImMainContainer.superclass.initComponent.call(this);
+ },
+
+ refreshMessage: function(msgId, msgType, isRss){
+ if(isRss){
+ this.itemViewCard.getLayout().setActiveItem(2);
+ this.rssItemView.refreshRssItem(msgId);
+ } else {
+ if (msgType=="internalMessaging") {
+ this.itemViewCard.getLayout().setActiveItem(0);
+ this.messageItemView.refreshMessage(msgId);
+ }
+ else {
+ this.itemViewCard.getLayout().setActiveItem(1);
+ this.mailItemView.refreshMessage(msgId);
+ }
+ }
+ },
+
+ resetInterface: function() {
+ this.itemViewCard.getLayout().activeItem.resetInterface();
+ },
+
+ addContactToAdressBook: function(value) {
+
+ var emailValue = value;
+ var infIndex = emailValue.search("<");
+ var supIndex = emailValue.search(">");
+
+ if (infIndex != -1 && supIndex != -1) {
+ emailValue = emailValue.substr(infIndex + 1,supIndex - (infIndex + 1));
+ }
+
+ this.addContactWindow.show();
+ this.addContactWindow.resetInterface();
+ this.addContactWindow.courrielField.setValue(emailValue);
+ },
+
+ addVCardToAdressBook: function(value) {
+ this.addContactWindow.show();
+ this.addContactWindow.resetInterface();
+
+ this.addContactWindow.courrielField.setValue(value.email);
+ this.addContactWindow.nameField.setValue(value.nom);
+ this.addContactWindow.firstNameField.setValue(value.prenom);
+ this.addContactWindow.organisationField.setValue(value.organisation);
+ this.addContactWindow.phoneField.setValue(value.phone);
+ this.addContactWindow.mobileField.setValue(value.mobile);
+ this.addContactWindow.faxField.setValue(value.fax);
+ this.addContactWindow.addressField.setValue(value.adresse);
+ this.addContactWindow.cityField.setValue(value.ville);
+ this.addContactWindow.postCodeField.setValue(value.codepostal);
+ this.addContactWindow.noteField.setValue(value.note);
+
+
+ }
+});