eliot.scolarite.preferenceutilisateur.notification.NotificationView = Ext.extend(Ext.util.Observable, {
- constructor: function(config) {
+ constructor:function (config) {
this.init(eliot.scolarite.preferenceutilisateur.notification, config);
this.createNotificationGrid();
this.observeModel();
},
- init: function(ns, config) {
+ init:function (ns, config) {
this.ns = ns;
this.Constantes = this.ns.Constantes;
this.ConfigServeur = this.ns.ConfigServeur;
this.addAllEvents();
},
- addAllEvents: function() {
+ addAllEvents:function () {
},
- creeConfig: function() {
+ creeConfig:function () {
this.config = {
- model: undefined,
- controller: undefined
+ model:undefined,
+ controller:undefined
};
return this.config;
},
- getInterface: function() {
+ getInterface:function () {
return {
- getItems: this.getItems.createDelegate(this)
+ getItems:this.getItems.createDelegate(this)
}
},
- getItems: function(){
+ getItems:function () {
return [
this.notificationGrid
];
},
- createNotificationGrid: function() {
+ createNotificationGrid:function () {
this.gridPlugins = [];
this.notificationGrid = new Ext.grid.GridPanel({
- store: this.config.controller.getNotificationStore(),
- enableColumnMove: false,
- autoSize: false,
- colModel: this.creeColModel(),
- cls: 'portal-default_table',
- margins: '0 5 5 5',
- border: true,
- columnLines: true,
- stripeRows: true,
- plugins: this.gridPlugins,
- listeners: {
- afterrender: function() {
+ store:this.config.controller.getNotificationStore(),
+ enableColumnMove:false,
+ autoSize:false,
+ colModel:this.creeColModel(),
+ cls:'portal-default_table',
+ margins:'0 5 5 5',
+ border:true,
+ columnLines:true,
+ stripeRows:true,
+ plugins:this.gridPlugins,
+ listeners:{
+ afterrender:function () {
this.checkboxEmail = document.getElementById('checkboxHeader-mail');
this.checkboxEmail.onclick = this.checkAllEmail.createDelegate(this);
this.updateHeaderCheckbox();
},
- scope: this
+ scope:this
}
});
},
- checkAllEmail: function() {
+ checkAllEmail:function () {
this.checkAllRecords('mail', 'disableMail', this.checkboxEmail.checked);
},
- checkAllSms: function() {
+ checkAllSms:function () {
this.checkAllRecords('sms', 'disableSms', this.checkboxSms.checked);
},
- checkAllRecords: function(column, disableColumn, checked) {
- this.config.controller.getNotificationStore().each(function(record) {
+ checkAllRecords:function (column, disableColumn, checked) {
+ this.config.controller.getNotificationStore().each(function (record) {
if (record.get(disableColumn) == false) {
record.set(column, checked);
}
this.config.model.setValue(this.config.controller.getNotificationStore().getModifiedRecords());
},
- creeColModel: function() {
+ creeColModel:function () {
var config = this.config;
var columns = [
{
- header: this.ConfigServeur.libelle.libelle,
- dataIndex: 'libelle',
+ header:'<div style="font-weight:bold;text-align:center;">' +
+ this.ConfigServeur.libelle.libelle +
+ '</div>',
+ dataIndex:'libelle',
width:400
},
this.createCheckColumn({
- header: this.getCheckColumnHeader('mail', this.ConfigServeur.libelle.email),
- dataIndex: 'mail',
- disabledIndex: 'disableMail',
- width: 100,
- align: 'center'
+ header:this.getCheckColumnHeader('mail', this.ConfigServeur.libelle.email),
+ dataIndex:'mail',
+ disabledIndex:'disableMail',
+ width:100,
+ align:'center'
})
];
if (this.ConfigServeur.data.disableSms == false) {
columns.push(this.createCheckColumn({
- header: this.getCheckColumnHeader('sms', this.ConfigServeur.libelle.sms),
- dataIndex: 'sms',
- disabledIndex: 'disableSms',
- width: 100,
- align: 'center'
+ header:this.getCheckColumnHeader('sms', this.ConfigServeur.libelle.sms),
+ dataIndex:'sms',
+ disabledIndex:'disableSms',
+ width:100,
+ align:'center'
}));
}
return new Ext.grid.ColumnModel({
- defaults: {
- menuDisabled: true,
- resizable: false,
- align: 'left',
- fixed: true
+ defaults:{
+ menuDisabled:true,
+ resizable:false,
+ align:'left',
+ fixed:true
},
- columns: columns
+ columns:columns
});
},
- getCheckColumnHeader: function(name, label) {
- return label + ' <input type="checkbox" id="checkboxHeader-' + name + '" style="vertical-align: bottom; margin-right: 4px; margin-left: 8px;"/>';
+ getCheckColumnHeader:function (name, label) {
+ return '<span style="font-weight: bold;">' + label + '</span>' +
+ ' <input type="checkbox" id="checkboxHeader-' +
+ name + '" style="vertical-align: bottom; margin-right: 4px; margin-left: 8px;"/>';
},
- createCheckColumn: function(config) {
- config.renderer = function(v, p, record) {
+ createCheckColumn:function (config) {
+ config.renderer = function (v, p, record) {
if (record.get(this.disabledIndex) == true) {
return '';
}
var model = this.config.model;
- config.onMouseDown = function(e, t) {
+ config.onMouseDown = function (e, t) {
if (Ext.fly(t).hasClass(this.createId())) {
e.stopEvent();
var index = this.grid.getView().findRowIndex(t);
observeModel:function () {
this.config.model.addListener(
- this.Constantes.eventId.change,
- function() {
- this.updateHeaderCheckbox();
- },
- this);
+ this.Constantes.eventId.change,
+ function () {
+ this.updateHeaderCheckbox();
+ },
+ this);
},
- updateHeaderCheckbox: function () {
+ updateHeaderCheckbox:function () {
var allMail = true;
var allSms = true;
- this.config.controller.getNotificationStore().each(function(record) {
+ this.config.controller.getNotificationStore().each(function (record) {
if ((record.get('disableMail') == false) && (record.get('mail') != true)) {
allMail = false;
}