/* Copyright 2008-2018 Clipperz Srl This file is part of Clipperz, the online password manager. For further information about its features and functionalities please refer to http://www.clipperz.com. * Clipperz is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * Clipperz is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License along with Clipperz. If not, see http://www.gnu.org/licenses/. */ Clipperz.Base.module('Clipperz.PM.UI.Components'); Clipperz.PM.UI.Components.CardToolbarClass = React.createClass({ displayName: 'Clipperz.PM.UI.Components.CardToolbar', propTypes: { // 'style': React.PropTypes.oneOf(['extra-short', 'narrow', 'wide', 'extra-wide']).isRequired, 'style': React.PropTypes.oneOf(Clipperz_PM_UI_availableStyles).isRequired, 'enableSidePanels': React.PropTypes.bool.isRequired, 'accountInfo': React.PropTypes.object.isRequired, 'proxyInfo': React.PropTypes.object.isRequired, 'messageBox': React.PropTypes.object.isRequired, 'filter': React.PropTypes.object /*.isRequired */, 'attachmentQueueInfo': React.PropTypes.object.isRequired, }, //---------------------------------------------------------------------------- selectionToggleHandler: function (anEvent) { //console.log("selectionToggleHandler"); MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'toggleSelectionPanel'); }, settingsToggleHandler: function (anEvent) { //console.log("settingsToggleHandler"); MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'toggleSettingsPanel'); }, attachmentQueueToggleHandler: function(anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'toggleAttachmentQueueBox'); }, //============================================================================ certificateQueueToggleHandler: function (anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'toggleCertificateQueueBox'); }, //============================================================================ notificationCounter: function () { var result; // console.log("CARD TOOLBAR NOTIFICATIONS", this.props['notifications']); if (this.props['notifications']) { result = this.props['notifications'].length; } else { result = null; } /* var attachmentDownloadNotificationNumber = MochiKit.Base.filter(function(anElement) { return anElement['queueElement']['process'] == 'DOWNLOAD'; }, this.props['attachmentQueueInfo']['notifications']).length; var attachmentUploadNotificationNumber = this.props['attachmentQueueInfo']['notifications'].length - attachmentDownloadNotificationNumber; // attachmentDownloadNotificationNumber = 2; // attachmentUploadNotificationNumber = 3; /* var verifyingCertificateNotificationNumber = this.props['certificateQueueInfo'] ? MochiKit.Base.filter(function (anCertificationInfo) { return anCertificationInfo['status'] == 'requested'; }, this.props['certificateQueueInfo']).length : 0; var verifiedCertificateNotificationNumber = this.props['certificateQueueInfo'] ? MochiKit.Base.filter(function (anCertificationInfo) { return anCertificationInfo['status'] == 'published'; }, this.props['certificateQueueInfo']).length : 0; */ return result; }, notificationLevel: function () { var result = 'info'; var i, c; c = this.props['notifications'].length; for (i=0; i