',
'',
'', this.app.i18n._('Total Messages:'), ' | ',
'', folder.get('cache_totalcount'), ' | ',
'
',
'',
'', this.app.i18n._('Unread Messages:'), ' | ',
'', folder.get('cache_unreadcount'), ' | ',
'
',
'',
'', this.app.i18n._('Name on Server:'), ' | ',
'', folder.get('globalname'), ' | ',
'
',
'',
'', this.app.i18n._('Last update:'), ' | ',
'', Tine.Tinebase.common.dateTimeRenderer(folder.get('client_access_time')), ' | ',
'
',
'
'
];
tip.body.dom.innerHTML = info.join('');
} else {
return false;
}
},
/**
* updates the given tip
* @param {Ext.Tooltip} tip
*/
updateProgressTip: function(tip) {
var folderId = this.getElsParentsNodeId(tip.triggerElement),
folder = this.app.getFolderStore().getById(folderId),
progress = Math.round(folder.get('cache_job_actions_done') / folder.get('cache_job_actions_est') * 100);
if (! this.isDropSensitive) {
tip.body.dom.innerHTML = String.format(this.app.i18n._('Fetching messages... ({0} done)'), progress + '%');
} else {
return false;
}
},
/**
* updates the given tip
* @param {Ext.Tooltip} tip
*/
updateUnreadTip: function(tip) {
var folderId = this.getElsParentsNodeId(tip.triggerElement),
folder = this.app.getFolderStore().getById(folderId),
count = folder.get('cache_unreadcount');
if (! this.isDropSensitive) {
tip.body.dom.innerHTML = String.format(this.app.i18n.ngettext('{0} unread message', '{0} unread messages', count), count);
} else {
return false;
}
},
/**
* decrement unread count of currently selected folder
*/
decrementCurrentUnreadCount: function() {
var store = Tine.Tinebase.appMgr.get('Felamimail').getFolderStore(),
node = this.getSelectionModel().getSelectedNode(),
folder = node ? store.getById(node.id) : null;
if (folder) {
folder.set('cache_unreadcount', parseInt(folder.get('cache_unreadcount'), 10) -1);
folder.commit();
}
},
/**
* add account record to root node
*
* @param {Tine.Felamimail.Model.Account} record
*/
addAccount: function(record) {
var node = new Ext.tree.AsyncTreeNode({
id: record.data.id,
path: '/' + record.data.id,
record: record,
globalname: '',
draggable: false,
allowDrop: false,
expanded: false,
text: Ext.util.Format.htmlEncode(record.get('name')),
// BUG: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
// qtip: Tine.Tinebase.common.doubleEncode(record.get('host')),
// FIXED:
qtip: Ext.util.Format.htmlEncode(record.get('host')),
leaf: false,
cls: 'felamimail-node-account',
delimiter: record.get('delimiter'),
ns_personal: record.get('ns_personal'),
account_id: record.data.id,
listeners: {
scope: this,
load: function(node) {
var account = this.accountStore.getById(node.id);
this.updateAccountStatus(account);
}
}
});
// we don't want appending folder effects
this.suspendEvents();
this.root.appendChild(node);
this.resumeEvents();
},
/**
* get active account by checking selected node
* @return Tine.Felamimail.Model.Account
*/
getActiveAccount: function() {
var result = null;
var node = this.getSelectionModel().getSelectedNode();
if (node) {
var accountId = node.attributes.account_id;
result = this.accountStore.getById(accountId);
}
return result;
}
});