--- /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.Atelier");
+EntSavoie.Atelier.AccessAteliers = 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';
+
+ // stock le record de l'atelier courant
+ this.currentAtelierRecord = null;
+
+ // stock le record sur lequel on fait un rowAction
+ this.recordRowAction = null;
+ // stock le grid sur lequel on fait un rowAction
+ this.gridRowAction = null;
+ // stock l'action lors d'un rowAction
+ this.rowActionCmd = null;
+
+ // stock si il faut forcer un refresh sur le activate du tab
+ this.mainForceRefresh = false;
+ this.instTabForceRefresh = false;
+ this.otherTabForceRefresh = false;
+ this.allTabForceRefresh = false;
+
+ this.instExceptionCount = 0;
+ this.otherExceptionCount = 0;
+ this.allExceptionCount = 0;
+
+ this.refreshAfterGrpValidation = false;
+
+ // composant d'interface
+
+ // PARTIE ALL GRP PANEL
+ this.searchTextValue = "";
+ this.searchTextField = this.searchTextField || new Ext.form.TextField({
+ emptyText: this.i18n.Atelier.AccessAteliers.searchTextField.emptyText,
+ clearCls: "clear-recherche"
+ });
+
+ this._all_store = this._all_store || new Ext.data.GroupingStore({
+ // load using HTTP
+ proxy: new Ext.data.HttpProxy({
+ url: this.renderURLAjax+"&jspPage=/ateliersAll.jsp"
+ }),
+
+ // the return will be XML, so lets set up a reader
+ reader: new Ext.data.XmlReader({
+ totalProperty: 'total',
+ record: "atelier",
+ id: "id"
+ }, ["name", "id", "url", "defaultPortletView", "type", "grouping", "desc"]),
+ sortInfo:{field: 'name', direction: "ASC"}
+ });
+
+
+ this._atelierAllPaggingTB = this._atelierAllPaggingTB || new Ext.PagingToolbar({
+ pageSize: 21,
+ store: this._all_store,
+ displayInfo: true,
+ displayMsg: this.i18n.Atelier.AccessAteliers._atelierAllPaggingTB.displayMsg,
+ emptyMsg: this.i18n.Atelier.AccessAteliers._atelierAllPaggingTB.emptyMsg,
+ items:[]
+ });
+
+ this._all_grid = this._all_grid || new Ext.grid.GridPanel({
+ store: this._all_store,
+ autoExpandColumn: 'nom',
+ columns: [
+ {header: this.i18n.Atelier.AccessAteliers._all_grid.columns.header, dataIndex: 'name', id: 'nom', sortable: false, groupable: false}
+ ],
+ loadMask: true,
+ title: this.i18n.Atelier.AccessAteliers._all_grid.title,
+ hideHeaders: true,
+ tbar: [this.searchTextField],
+ bbar: this._atelierAllPaggingTB
+ });
+
+
+ // PARTIE INST GRP PANEL
+ this.searchTextInstValue = "";
+ this.searchTextInstField = this.searchTextInstField || new Ext.form.TextField({
+ emptyText: this.i18n.Atelier.AccessAteliers.searchTextInstField.emptyText,
+ clearCls: "clear-recherche"
+ });
+
+ this._inst_store = this._inst_store || new Ext.data.Store({
+ // load using HTTP
+ proxy: new Ext.data.HttpProxy({
+ url: this.renderURLAjax+"&jspPage=/ateliersInst.jsp&migrate=false"
+ }),
+
+ // the return will be XML, so lets set up a reader
+ reader: new Ext.data.XmlReader({
+ totalProperty: 'total',
+ record: "atelier",
+ id: "id"
+ }, ["name", "id", "url", "defaultPortletView", "type", "desc"]),
+ sortInfo:{field: 'name', direction: "ASC"}
+ });
+
+ this._atelierInstPaggingTB = this._atelierInstPaggingTB || new Ext.PagingToolbar({
+ pageSize: 21,
+ store: this._inst_store,
+ displayInfo: true,
+ displayMsg: this.i18n.Atelier.AccessAteliers._atelierInstPaggingTB.displayMsg,
+ emptyMsg: this.i18n.Atelier.AccessAteliers._atelierInstPaggingTB.emptyMsg,
+ items:[]
+ });
+
+ this._inst_grid = this._inst_grid || new Ext.grid.GridPanel({
+ store: this._inst_store,
+ autoExpandColumn: 'nom',
+ columns: [
+ {header: this.i18n.Atelier.AccessAteliers._inst_grid.columns.header, width: 30, id:'nom', dataIndex: 'name', sortable: false}
+ ],
+ loadMask: true,
+ hideHeaders: true,
+ title: this.i18n.Atelier.AccessAteliers._inst_grid.title,
+ tbar: [this.searchTextInstField],
+ bbar: this._atelierInstPaggingTB
+ });
+
+ // PARTIE ARCHIVE GRP PANEL
+ this.searchTextArchiveValue = "";
+ this.searchTextArchiveField = this.searchTextArchiveField || new Ext.form.TextField({
+ emptyText: this.i18n.Atelier.AccessAteliers.searchTextArchiveField.emptyText,
+ clearCls: "clear-recherche"
+ });
+
+ this._archive_store = this._archive_store || new Ext.data.Store({
+ // load using HTTP
+ proxy: new Ext.data.HttpProxy({
+ url: this.renderURLAjax+"&jspPage=/ateliersInst.jsp&migrate=true"
+ }),
+
+ // the return will be XML, so lets set up a reader
+ reader: new Ext.data.XmlReader({
+ totalProperty: 'total',
+ record: "atelier",
+ id: "id"
+ }, ["name", "id", "url", "defaultPortletView", "type", "desc"]),
+ sortInfo:{field: 'name', direction: "ASC"}
+ });
+
+ this._atelierArchivePaggingTB = this._atelierArchivePaggingTB || new Ext.PagingToolbar({
+ pageSize: 21,
+ store: this._archive_store,
+ displayInfo: true,
+ displayMsg: this.i18n.Atelier.AccessAteliers._atelierArchivePaggingTB.displayMsg,
+ emptyMsg: this.i18n.Atelier.AccessAteliers._atelierArchivePaggingTB.emptyMsg,
+ items:[]
+ });
+
+ this._archive_grid = this._archive_grid || new Ext.grid.GridPanel({
+ store: this._archive_store,
+ autoExpandColumn: 'nom',
+ columns: [
+ {header: this.i18n.Atelier.AccessAteliers._archive_grid.columns.header, width: 30, id:'nom', dataIndex: 'name', sortable: false}
+ ],
+ loadMask: true,
+ hideHeaders: true,
+ title: this.i18n.Atelier.AccessAteliers._archive_grid.title,
+ tbar: [this.searchTextArchiveField],
+ bbar: this._atelierArchivePaggingTB
+ });
+
+ // PARTIE OTHERS GRP PANEL
+ this.searchTextOtherValue = "";
+ this.searchTextOtherField = this.searchTextOtherField || new Ext.form.TextField({
+ emptyText: this.i18n.Atelier.AccessAteliers.searchTextOtherField.emptyText,
+ clearCls: "clear-recherche"
+ });
+
+ this._other_store = this._other_store || new Ext.data.Store({
+ // load using HTTP
+ proxy: new Ext.data.HttpProxy({
+ url: this.renderURLAjax+"&jspPage=/ateliersOther.jsp"
+ }),
+
+
+ // the return will be XML, so lets set up a reader
+ reader: new Ext.data.XmlReader({
+ totalProperty: 'total',
+ record: "atelier",
+ id: "id"
+ }, ["name", "id", "url", "defaultPortletView", "type", "desc", {name:"isAdmin", type:"boolean"}, {name:"isLocalAdmin", type:"boolean"},{name: "hideDesc", type: "boolean"} ]),
+ sortInfo:{field: 'name', direction: "ASC"}
+ });
+
+
+ // Possible actions on a group : description, delete, unsubscribe
+ this.action_column = this.action_column || new Ext.grid.ActionColumn({
+ width: 80,
+ sortable: false,
+ menuDisabled: true,
+ align: 'right',
+ items: [{
+ getClass: function(v, meta, rec, row, col, store) {
+ if (rec.get('hideDesc') == false) {
+ return 'description';
+ }
+ },
+ tooltip: this.i18n.Atelier.AccessAteliers.action_column.items.descr.tooltip,
+ scope: this,
+ handler: this.onDescriptionRowAction
+ },
+ {
+ getClass: function(v, meta, rec, row, col, store) {
+ if (rec.get('isAdmin') == true || rec.get('isLocalAdmin') == true) {
+ return 'deleteGroup';
+ }
+ },
+ tooltip: this.i18n.Atelier.AccessAteliers.action_column.items.suppr.tooltip,
+ scope: this,
+ handler: this.onDeleteRowAction
+ },
+ {
+ getClass: function(v, meta, rec, row, col, store) {
+ if (rec.get('isAdmin') == false) {
+ return 'unsubscribeGroup';
+ }
+ },
+ tooltip: this.i18n.Atelier.AccessAteliers.action_column.items.unsubscribe.tooltip,
+ scope: this,
+ handler: this.onUnsubscribeRowAction
+ }
+ ]
+ });
+
+
+ this._atelierOtherPaggingTB = this._atelierOtherPaggingTB || new Ext.PagingToolbar({
+ pageSize: 21,
+ store: this._other_store,
+ displayInfo: true,
+ displayMsg: this.i18n.Atelier.AccessAteliers._atelierOtherPaggingTB.displayMsg,
+ emptyMsg: this.i18n.Atelier.AccessAteliers._atelierOtherPaggingTB.emptyMsg,
+ items:[]
+ });
+
+ this._other_grid = this._other_grid || new Ext.grid.GridPanel({
+ store: this._other_store,
+ autoExpandColumn: 'nom',
+ columns: [
+ {header: this.i18n.Atelier.AccessAteliers._other_grid.columns.header, width: 30, id:'nom', dataIndex: 'name', sortable: false},
+ this.action_column
+ ],
+ loadMask: true,
+ hideHeaders: true,
+ title: this.i18n.Atelier.AccessAteliers._other_grid.title,
+ tbar: [this.searchTextOtherField],
+ bbar: this._atelierOtherPaggingTB
+ });
+
+
+ // TAB contenant l'ensemble des grids
+ this.tabManager = this.tabManager || new Ext.TabPanel({
+ activeTab: 0,
+ plain:true,
+ title: this.i18n.Atelier.AccessAteliers.tabManager.title,
+ items:[
+ this._all_grid,
+ this._inst_grid,
+ this._other_grid,
+ this._archive_grid
+ ],
+ fbar : ['->',
+ {
+ tooltip: this.i18n.Atelier.AccessAteliers.tabManager.fbar.permissions.tooltip,
+ text : this.i18n.Atelier.AccessAteliers.tabManager.fbar.permissions.text,
+ hidden: !this.isManager,
+ handler: this.onUpdatePermissions,
+ scope: this
+ },
+ {
+ text: this.i18n.Atelier.AccessAteliers.tabManager.fbar.join.text,
+ handler: this.onAccessAtelierRedirect,
+ scope: this
+ }
+ ]
+ });
+
+
+ // INTERFACE D AFFICHAGE DES MEMBRES
+ this._member_store = this._member_store || new Ext.data.Store({
+ // load using HTTP
+ proxy: new Ext.data.HttpProxy({
+ url: this.renderURLAjax+"&jspPage=/membersAteliers.jsp"
+ }),
+ // the return will be XML, so lets set up a reader
+ reader: new Ext.data.XmlReader({
+ totalProperty: 'total',
+ record: "member",
+ id: "id"
+ }, ["nom", "statut", "id"]),
+ remoteSort: true
+ });
+ this._member_store.setDefaultSort("nom", "ASC");
+
+
+ this._memberPaggingTB = this._memberPaggingTB || new Ext.PagingToolbar({
+ pageSize: 25,
+ store: this._member_store,
+ displayInfo: true,
+ displayMsg: this.i18n.Atelier.AccessAteliers._memberPaggingTB.displayMsg,
+ emptyMsg: this.i18n.Atelier.AccessAteliers._memberPaggingTB.emptyMsg,
+ items:[]
+ });
+
+ this._member_grid = this._member_grid || new Ext.grid.GridPanel({
+ store: this._member_store,
+ disableSelection:true,
+ loadMask: true,
+ autoExpandColumn: 'nom',
+ columns: [
+ {header: this.i18n.Atelier.AccessAteliers._member_grid.columns.header[0], width: 20, dataIndex: 'nom', id:'nom', sortable: true},
+ //{header: this.i18n.Atelier.AccessAteliers._member_grid.columns.header[1], width: 125, dataIndex: 'prenom', sortable: false},
+ {header: this.i18n.Atelier.AccessAteliers._member_grid.columns.header[2], width: 125, dataIndex: 'statut', sortable: true}
+ ],
+ title: this.i18n.Atelier.AccessAteliers._member_grid.title,
+ bbar: this._memberPaggingTB
+ });
+
+ // Affichage des informations eventuelles sur les communautés
+ this.waitValidation = this.waitValidation || new EntSavoie.Atelier.InfoCommunitiesDisplay({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ accessAtelier: this
+ });
+
+ // Affichage des communautés en attente de validation
+ this.creationValidation = this.creationValidation || new EntSavoie.Atelier.GroupCreationValidation({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ isGrpAdmin: this.isGrpAdmin,
+ accessAtelier: this
+ });
+
+ // Affichage des demande d'extension de durée de vie
+ this.requestLifeExtension = this.requestLifeExtension || new EntSavoie.Atelier.RequestLifeExtension({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ isGrpAdmin: this.isGrpAdmin,
+ accessAtelier: this
+ });
+
+ // Affichage des demande d'extension de durée de vie
+ this.myWaitingInscriptions = this.myWaitingInscriptions || new EntSavoie.Atelier.MyWaitingInscriptions({
+ renderURLAjax: this.renderURLAjax,
+ actionURLAjax: this.actionURLAjax,
+ accessAtelier: this
+ });
+
+ // TAB contenant l'ensemble des grids de validation
+ this.tabValidation = this.tabValidation || new Ext.TabPanel({
+ activeTab: this.validTab || 0,
+ hidden:true,
+ plain:true,
+ height: 160,
+ items:[this.creationValidation,
+ /*this.requestLifeExtension,*/
+ this.myWaitingInscriptions]
+ });
+
+ // TAB contenant l'ensemble des grids de validation
+ this.tabValidationElev = this.tabValidationElev || new Ext.TabPanel({
+ activeTab: 0,
+ hidden: true,
+ plain:true,
+ height: 160,
+ items:[this.waitValidation,
+ this.myWaitingInscriptions]
+ });
+
+
+
+ EntSavoie.Atelier.AccessAteliers.superclass.constructor.call(this, {
+ title: this.i18n.Atelier.AccessAteliers.title,
+ border: false,
+ layout:'border',
+ style: 'padding: 5px;',
+ height: 730,
+ width: "auto",
+ items: [{
+ region: "center",
+ border: false,
+ xtype: "panel",
+ height: 400,
+ style: 'padding-right: 5px; background-color: #ffffff;',
+ layout: 'fit',
+ items:[this.tabManager]
+ },{
+ region: "east",
+ border: false,
+ xtype: "panel",
+ height: 400,
+ width: 395,
+ style: 'padding-right: 5px; background-color: #ffffff;',
+ layout: 'fit',
+ items:[this._member_grid]
+ },{
+ region: "south",
+ border: false,
+ xtype: "panel",
+ style: 'padding-top: 15px;background-color: #ffffff;',
+ height: 200,
+ layout: 'form',
+ items : [this.tabValidation,
+ this.tabValidationElev]
+ }]
+ });
+
+
+
+ // definition des listeners
+ this.on("activate", this.onActivateTab, this);
+ //search on list Atelier
+ this.searchTextField.on("valid", this.onValidSearchText, this);
+ this._all_store.proxy.on("beforeload", this.onBeforeLoadAllStoreProxy, this);
+ //this._all_store.on("load", this.onLoadAllStore, this);
+ this._all_grid.on("cellclick", this.onCellclickAllGrid, this);
+ this._all_grid.on("celldblclick", this.onCellDblclickAllGrid, this);
+ this._all_grid.on("viewready", this.onRenderAllGrid, this);
+ this._all_grid.on("show", this.onShowAllGrid, this);
+
+
+ this.searchTextInstField.on("valid", this.onValidSearchTextInst, this);
+ this._inst_store.proxy.on("beforeload", this.onBeforeLoadInstStoreProxy, this);
+ this._inst_grid.on("cellclick", this.onCellclickInstGrid, this);
+ this._inst_grid.on("celldblclick", this.onCellDblclickInstGrid, this);
+ this._inst_grid.on("viewready", this.onRenderInstGrid, this);
+ this._inst_grid.on("show", this.onShowInstGrid, this);
+
+ this.searchTextArchiveField.on("valid", this.onValidSearchTextArchive, this);
+ this._archive_store.proxy.on("beforeload", this.onBeforeLoadArchiveStoreProxy, this);
+ this._archive_grid.on("cellclick", this.onCellclickArchiveGrid, this);
+ this._archive_grid.on("celldblclick", this.onCellDblclickArchiveGrid, this);
+ this._archive_grid.on("viewready", this.onRenderArchiveGrid, this);
+ this._archive_grid.on("show", this.onShowArchiveGrid, this);
+
+ this.searchTextOtherField.on("valid", this.onValidSearchTextOther, this);
+ this._other_store.proxy.on("beforeload", this.onBeforeLoadOtherStoreProxy, this);
+ this._other_grid.on("cellclick", this.onCellclickOtherGrid, this);
+ this._other_grid.on("celldblclick", this.onCellDblclickOtherGrid, this);
+ this._other_grid.on("viewready", this.onRenderOtherGrid, this);
+ this._other_grid.on("show", this.onShowOtherGrid, this);
+
+ this._member_store.proxy.on("beforeload", this.onBeforeLoadProxyMemmbres_store, this);
+ this._member_store.on("load", this.onLoadMemmbres_store, this);
+
+ this._all_store.on("exception", this.onExceptionAllStore, this);
+ this._inst_store.on("exception", this.onExceptionInstStore, this);
+ this._other_store.on("exception", this.onExceptionOtherStore, this);
+
+};
+
+Ext.extend(EntSavoie.Atelier.AccessAteliers, Ext.Panel, {
+ initComponent: function () {
+ EntSavoie.Atelier.AccessAteliers.superclass.initComponent.call(this);
+ if(this.isGrpAdmin){
+ this.tabValidation.show();
+ this.tabValidationElev.hide();
+ }else{
+ this.tabValidation.hide();
+ this.tabValidationElev.show();
+ }
+ },
+
+ onExceptionAllStore: function(misc) {
+ if(this.allExceptionCount<10){
+ this.allExceptionCount++;
+ this._all_store.load({params:{start:0, limit: 21}});
+ } else {
+ Ext.MessageBox.alert("Attention", "En raison d'un dysfonctionnement réseau, l'opération demandée ne peut être réalisée.", function(btn){});
+ }
+ },
+
+ onExceptionInstStore: function(misc) {
+ if(this.instExceptionCount<10){
+ this.instExceptionCount++;
+ this._inst_store.load({params:{start:0, limit: 21}});
+ } else {
+ Ext.MessageBox.alert("Attention", "En raison d'un dysfonctionnement réseau, l'opération demandée ne peut être réalisée.", function(btn){});
+ }
+ },
+
+ onExceptionOtherStore: function(misc) {
+ if(this.otherExceptionCount<10){
+ this.otherExceptionCount++;
+ this._other_store.load({params:{start:0, limit: 21}});
+ } else {
+ Ext.MessageBox.alert("Attention", "En raison d'un dysfonctionnement réseau, l'opération demandée ne peut être réalisée.", function(btn){});
+ }
+ },
+
+ forceRefresh: function() {
+ this.mainForceRefresh = true;
+ this.instTabForceRefresh = true;
+ this.otherTabForceRefresh = true;
+ },
+
+ onActivateTab: function(){
+ if (this.mainForceRefresh) {
+ this.mainForceRefresh = false;
+ this.refreshAfterGrpValidation = false;
+
+ this.waitValidation.refreshInfos();
+ this.creationValidation.refreshInfos();
+ this.requestLifeExtension.refreshInfos();
+
+ this.searchTextField.suspendEvents(false);
+ this.searchTextField.reset();
+ this.searchTextField.resumeEvents();
+
+ // on passe sur le premier tab
+ this.tabManager.setActiveTab(0);
+ // on recharge le tab
+ this._all_store.load({params:{start:0, limit:21}});
+ }
+ else if (this.refreshAfterGrpValidation) {
+ this.refreshAfterGrpValidation = false;
+ this.waitValidation.refreshInfos();
+ if (this.tabManager.getActiveTab().getId()==this._other_grid.id) {
+ this._other_store.load({params:{start:0, limit:21}});
+ }
+ else {
+ this.otherTabForceRefresh = true;
+ }
+ }
+ },
+
+ refreshAfterGrpValidation: function(){
+
+ },
+
+ refreshAfterGrpRefused: function(){
+ this.waitValidation.refreshInfos();
+ },
+
+ refreshAfterGrpCancel: function(){
+ this.waitValidation.refreshInfos();
+ this.creationValidation.refreshInfos();
+ this.requestLifeExtension.refreshInfos();
+ },
+
+ // Traitement des evt sur le panel ALL
+ onValidSearchText: function(tf){
+ if (this._atelierAllPaggingTB!=null) {
+ if (this.searchTextValue != tf.getValue()) {
+ this.searchTextValue=tf.getValue();
+ this._atelierAllPaggingTB.moveFirst();
+ }
+ }
+ },
+
+ onBeforeLoadAllStoreProxy: function(proxy, params){
+ if (this.searchTextField!=null) {
+ params.recherche = this.searchTextField.getValue();
+ } else {
+ params.recherche = "";
+ }
+ },
+
+ onLoadAllStore: function(store, records, e){
+ if (records.length>0) {
+ //this._all_grid.getSelectionModel().selectFirstRow();
+ //this.onCellclickAllGrid(this._all_grid, 0, 0, null);
+ }
+ },
+
+ onCellclickAllGrid : function(grid, rowIndex, colIndex, e){
+ this.singleClickTask = new Ext.util.DelayedTask(this.onCellSelected, this, [grid, rowIndex, colIndex, e, true]);
+ this.singleClickTask.delay(500);
+ },
+
+ onCellDblclickAllGrid : function(grid, rowIndex, colIndex, e){
+ if(this.singleClickTask){
+ this.singleClickTask.cancel();
+ this.singleClickTask = null;
+ }
+ this.onCellSelected(grid, rowIndex, colIndex, e);
+ this.accessToGroup();
+ },
+
+ onRenderAllGrid: function(grid){
+ this._all_store.load({params:{start:0, limit: 21}});
+ },
+
+ onShowAllGrid: function(grid){
+ if (this.allTabForceRefresh) {
+ this.allTabForceRefresh = false;
+ this._all_store.load({params:{start:0, limit:21}});
+ }
+ },
+
+
+ // traitement des evt sur le panel INST
+ onValidSearchTextInst: function(tf){
+ if (this._atelierInstPaggingTB!=null) {
+ if (this.searchTextInstValue != tf.getValue()) {
+ this.searchTextInstValue=tf.getValue();
+ this._atelierInstPaggingTB.moveFirst();
+ }
+ }
+ },
+
+ onBeforeLoadInstStoreProxy: function(proxy, params){
+ if (this.searchTextInstField!=null) {
+ params.recherche = this.searchTextInstField.getValue();
+ } else {
+ params.recherche = "";
+ }
+ },
+
+ onRenderInstGrid: function(grid){
+ this._inst_store.load({params:{start:0, limit:21}});
+ },
+
+ onShowInstGrid: function(grid){
+ if (this.instTabForceRefresh) {
+ this.instTabForceRefresh = false;
+ this._inst_store.load({params:{start:0, limit:21}});
+ }
+ },
+
+ onCellclickInstGrid : function(grid, rowIndex, colIndex, e){
+ this.singleClickTask = new Ext.util.DelayedTask(this.onCellSelected, this, [grid, rowIndex, colIndex, e, true]);
+ this.singleClickTask.delay(500);
+ },
+
+ onCellDblclickInstGrid : function(grid, rowIndex, colIndex, e){
+ if(this.singleClickTask){
+ this.singleClickTask.cancel();
+ this.singleClickTask = null;
+ }
+ this.onCellSelected(grid, rowIndex, colIndex, e);
+ this.accessToGroup();
+ },
+
+ // traitement des evt sur le panel ARCHIVE
+ onValidSearchTextArchive: function(tf){
+ if (this._atelierArchivePaggingTB!=null) {
+ if (this.searchTextArchiveValue != tf.getValue()) {
+ this.searchTextArchiveValue=tf.getValue();
+ this._atelierArchivePaggingTB.moveFirst();
+ }
+ }
+ },
+
+ onBeforeLoadArchiveStoreProxy: function(proxy, params){
+ if (this.searchTextArchiveField!=null) {
+ params.recherche = this.searchTextArchiveField.getValue();
+ } else {
+ params.recherche = "";
+ }
+ },
+
+ onRenderArchiveGrid: function(grid){
+ this._archive_store.load({params:{start:0, limit:21}});
+ },
+
+ onShowArchiveGrid: function(grid){
+ if (this.instTabForceRefresh) {
+ this.instTabForceRefresh = false;
+ this._archive_store.load({params:{start:0, limit:21}});
+ }
+ },
+
+ onCellclickArchiveGrid : function(grid, rowIndex, colIndex, e){
+ this.singleClickTask = new Ext.util.DelayedTask(this.onCellSelected, this, [grid, rowIndex, colIndex, e, true]);
+ this.singleClickTask.delay(500);
+ },
+
+ onCellDblclickArchiveGrid : function(grid, rowIndex, colIndex, e){
+ if(this.singleClickTask){
+ this.singleClickTask.cancel();
+ this.singleClickTask = null;
+ }
+ this.onCellSelected(grid, rowIndex, colIndex, e);
+ this.accessToGroup();
+ },
+
+
+ // traitement des evt sur le panel OTHERS
+
+ onValidSearchTextOther: function(tf){
+ if (this._atelierOtherPaggingTB!=null) {
+ if (this.searchTextOtherValue != tf.getValue()) {
+ this.searchTextOtherValue=tf.getValue();
+ this._atelierOtherPaggingTB.moveFirst();
+ }
+ }
+ },
+
+ onBeforeLoadOtherStoreProxy: function(proxy, params){
+ if (this.searchTextOtherField!=null) {
+ params.recherche = this.searchTextOtherField.getValue();
+ } else {
+ params.recherche = "";
+ }
+ },
+
+ onRenderOtherGrid: function(grid){
+ this._other_store.load({params:{start:0, limit:21}});
+ },
+
+ onShowOtherGrid: function(grid){
+ if (this.otherTabForceRefresh) {
+ this.otherTabForceRefresh = false;
+ this._other_store.load({params:{start:0, limit:21}});
+ }
+ },
+
+ onCellclickOtherGrid : function(grid, rowIndex, colIndex, e){
+ this.singleClickTask = new Ext.util.DelayedTask(this.onCellSelected, this, [grid, rowIndex, colIndex, e, true]);
+ this.singleClickTask.delay(500);
+ },
+
+
+ onCellDblclickOtherGrid : function(grid, rowIndex, colIndex, e){
+ if(this.singleClickTask){
+ this.singleClickTask.cancel();
+ this.singleClickTask = null;
+ }
+ this.onCellSelected(grid, rowIndex, colIndex, e);
+ this.accessToGroup();
+ },
+
+ // Action de suppression du groupe
+ onDeleteRowAction: function(grid, rowIndex, colIndex) {
+ var record = grid.getStore().getAt(rowIndex);
+ this.recordRowAction = record;
+ this.gridRowAction = grid;
+ this.rowActionCmd = 'deleteGroup';
+ Ext.MessageBox.show({
+ icon:Ext.Msg.QUESTION,
+ title: this.i18n.Atelier.AccessAteliers.onAccessRowAction.del.MessageBox.title,
+ msg: this.i18n.Atelier.AccessAteliers.onAccessRowAction.del.MessageBox.msg,
+ buttons: {yes: this.i18n.Atelier.AccessAteliers.onAccessRowAction.del.MessageBox.buttons.yes, cancel: this.i18n.Atelier.AccessAteliers.onAccessRowAction.del.MessageBox.buttons.cancel},
+ fn: this.onApprovedRowAction_call,
+ scope: this
+ });
+ },
+
+ // Unsuscribe
+ onUnsubscribeRowAction: function(grid, rowIndex, colIndex) {
+ var record = grid.getStore().getAt(rowIndex);
+ this.recordRowAction = record;
+ this.gridRowAction = grid;
+ this.rowActionCmd = 'unsubscribeGroup';
+ Ext.MessageBox.show({
+ icon:Ext.Msg.QUESTION,
+ title: this.i18n.Atelier.AccessAteliers.onAccessRowAction.unsubscribe.MessageBox.title,
+ msg: this.i18n.Atelier.AccessAteliers.onAccessRowAction.unsubscribe.MessageBox.msg,
+ buttons: {yes: this.i18n.Atelier.AccessAteliers.onAccessRowAction.unsubscribe.MessageBox.buttons.yes, cancel: this.i18n.Atelier.AccessAteliers.onAccessRowAction.unsubscribe.MessageBox.buttons.cancel},
+ fn: this.onApprovedRowAction_call,
+ scope: this
+ });
+ },
+
+ onDescriptionRowAction: function(grid, rowIndex, colIndex) {
+ var record = grid.getStore().getAt(rowIndex);
+ Ext.Msg.show({
+ title: this.i18n.Atelier.AccessAteliers.onDescriptionRowAction.Msg.title + record.get('name'),
+ msg: record.get('desc'),
+ modal:true,
+ width: 250,
+ icon:Ext.Msg.INFO,
+ buttons:Ext.Msg.OK
+ });
+ },
+
+ onApprovedRowAction_call: function(btn) {
+ if(btn=="cancel") {
+ return false;
+ }
+
+ Ext.Ajax.request({
+ url: this.actionURLAjax,
+ params: {
+ cmd: this.rowActionCmd,
+ groupId: this.recordRowAction.get("id")
+ },
+ scope: this,
+ success: this.onSuccessRowAction,
+ failure: this.onFailureRowAction
+ });
+
+ this.gridRowAction.getStore().remove(this.recordRowAction);
+
+ },
+
+ onSuccessRowAction:function(response, options) {
+ // on rafraichi le joinGroup
+ this.mainView.joinGroups.forceRefreshJoin = true;
+ if (this.gridRowAction.getId()==this._other_grid.id) {
+ // il faut rafraichir ALL
+ this.allTabForceRefresh = true;
+ }
+ else {
+ // il faut rafraichir other
+ this.otherTabForceRefresh = true;
+ }
+
+ if (this.rowActionCmd=="unsubscribeGroup") {
+ Ext.slideMsg.msg(this.i18n.Atelier.AccessAteliers.onSuccessRowAction.slideMsg.title, this.i18n.Atelier.AccessAteliers.onSuccessRowAction.slideMsg.body + this.recordRowAction.get("name"));
+ }
+ },
+
+ onFailureRowAction:function(response, options) {
+ this.gridRowAction.getStore().add([this.recordRowAction]);
+ Ext.MessageBox.alert(this.i18n.Atelier.AccessAteliers.onFailureRowAction.alert.title, this.i18n.Atelier.AccessAteliers.onFailureRowAction.alert.msg, function(btn){});
+ },
+
+
+ // traitmement des evt sur les membres
+ onBeforeLoadProxyMemmbres_store: function(proxy, params){
+ if (this.currentAtelierRecord!=null) {
+ params.idAtelier = this.currentAtelierRecord.get('id');
+ params.type = this.currentAtelierRecord.get('type');
+ }
+ },
+
+ onLoadMemmbres_store: function (store, records, e){
+ this._memberPaggingTB.bindStore(this._member_store);
+ },
+
+ // On met a jour les membres et l'url du groupe
+ onCellSelected: function(grid, rowIndex, colIndex, e, load){
+ try {
+ if(grid.id != this._inst_grid.id){
+ this._inst_grid.getSelectionModel().clearSelections();
+ }
+ } catch(e1){}
+ try {
+ if(grid.id != this._other_grid.id){
+ this._other_grid.getSelectionModel().clearSelections();
+ }
+ } catch(e2) {}
+ try {
+ if(grid.id != this._all_grid.id){
+ this._all_grid.getSelectionModel().clearSelections();
+ }
+ } catch(e3) {}
+ try {
+ if(grid.id != this._archive_grid.id){
+ this._archive_grid.getSelectionModel().clearSelections();
+ }
+ } catch(e4) {}
+
+ try {
+ var record = grid.getStore().getAt(rowIndex);
+ this.currentAtelierRecord = record;
+ if(load){
+ this._member_store.load({params:{start:0, limit:25}});
+ this._member_grid.setTitle(record.get("name"));
+ this.singleClickTask = null;
+ }
+ } catch(e5) {
+ // Double click
+ this.singleClickTask = null;
+ }
+ },
+
+
+ /*
+ * Partie qui concerne le bouton
+ * */
+ onAccessAtelierRedirect : function(button, event) {
+ this.accessToGroup();
+ },
+
+ onUpdatePermissions : function(button, event) {
+ Ext.MessageBox.show({
+ icon:Ext.Msg.QUESTION,
+ title: this.i18n.Atelier.AccessAteliers.onUpdatePermissions.MessageBox.title,
+ msg: this.i18n.Atelier.AccessAteliers.onUpdatePermissions.MessageBox.msg,
+ buttons: {yes: this.i18n.Atelier.AccessAteliers.onUpdatePermissions.MessageBox.buttons.yes, cancel: this.i18n.Atelier.AccessAteliers.onUpdatePermissions.MessageBox.buttons.cancel},
+ fn: this.onApprovedUpdatePermission_call,
+ scope: this
+ });
+ },
+
+ onApprovedUpdatePermission_call: function(btn) {
+ if(btn=="cancel") {
+ return false;
+ }
+
+ Ext.Ajax.request({
+ url: this.actionURLAjax,
+ params: {
+ cmd: "updatePermissions"
+ },
+ scope: this,
+ success: this.onSuccessUpdatePermissions,
+ failure: this.onFailureUpdatePermissions
+ });
+ },
+
+ onSuccessUpdatePermissions: function(response, options) {
+ // Verification du succes de la requete
+ var backObj = Ext.decode(response.responseText);
+ if (!backObj.success) {
+ Ext.MessageBox.alert(this.i18n.Atelier.AccessAteliers.onSuccessUpdatePermissions.alert.title, this.i18n.Atelier.AccessAteliers.onSuccessUpdatePermissions.alert.msg, function(btn){});
+ }
+ else {
+ Ext.Msg.show({
+ title: this.i18n.Atelier.AccessAteliers.onSuccessUpdatePermissions.Msg.title
+ ,msg: this.i18n.Atelier.AccessAteliers.onSuccessUpdatePermissions.Msg.msg
+ ,modal:true
+ ,icon:Ext.Msg.INFO
+ ,buttons:Ext.Msg.OK
+ ,minWidth:350
+ });
+ }
+ },
+
+ onFailureUpdatePermissions: function(response, options) {
+ Ext.MessageBox.alert(this.i18n.Atelier.AccessAteliers.onFailureUpdatePermissions.alert.title, this.i18n.Atelier.AccessAteliers.onFailureUpdatePermissions.alert.msg, function(btn){});
+ },
+
+ accessToGroup: function(){
+ if (this.currentAtelierRecord != null) {
+ if(Global.User.hasMenuAjaxable()){
+ entityMenuNavigation("#/group" + this.currentAtelierRecord.get('url') + "?p_p_id=menuPageGroupe_WAR_menuPageGroupeportlet&p_p_lifecycle=0&p_p_state=exclusive&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&jspPage=%2FviewAjax.jsp", null, null, "/group" + this.currentAtelierRecord.get('url') + "?p_p_id=" + this.currentAtelierRecord.get('defaultPortletView') + "&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view" + this.accesAteliersParams);
+ } else {
+ if (this.isLSOEnabled) {
+ window.location="#/group" + this.currentAtelierRecord.get('url') + this.lsoGrpLandingPage;
+ }
+ else {
+ window.location="#/group" + this.currentAtelierRecord.get('url') + "?p_p_id=" + this.currentAtelierRecord.get('defaultPortletView') + this.accesAteliersParams;
+ }
+ }
+ }
+ }
+
+});
+
+
+