Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.namespace('Zarafa.core.ui.notifier');
- /**
- * @class Zarafa.core.ui.notifier.DialogNotifierPlugin
- * @extends Zarafa.core.ui.notifier.NotifyPlugin
- */
- Zarafa.core.ui.notifier.DialogNotifierPlugin = Ext.extend(Zarafa.core.ui.notifier.NotifyPlugin, {
- notifierElem : undefined,
- /**
- * Send a notification to the user. This {@link #getPlugin requests} the plugin for the provided category.
- * On the plugin the {@link Zarafa.core.ui.notifier.NotifyPlugin#notify notify} function is called to display
- * the message to the user. If no plugin could be found for
- * the given category, then no message will be shown to the user.
- *
- * @param {String} category The category which applies to the notification.
- * @param {String} title The title which must be shown in the message.
- * @param {Mixed} message The message which should be displayed. This could be either a String,
- * @param {Ext.Container container} optional message container.
- * a {@link Ext.data.Record record}, or a data object which contains the data which must be shown.
- */
- notify : function(category, title, message, container, animationEffect)
- {
- if(!Ext.isDefined(this.notifierElem)){
- this.notifierElem = Ext.DomHelper.append(container, {tag : 'div', class:'zarafa-dialog-notifier-container', html:message}, true);
- this.layoutMsgContainer(container);
- }
- this.animMessage(this.notifierElem, animationEffect);
- },
- /**
- * set position for message container
- * @private
- */
- layoutMsgContainer : function(container)
- {
- this.notifierElem.setLeft(container.getWidth()/2 - 50);
- this.notifierElem.setTop(0);
- },
- /**
- * Event handler which is called when the {@link Ext.Fx#} animation has been
- * completed. This will reset the {@link #animating} flag to start animating any pending messages.
- *
- * @private
- */
- removeElem : function(element){
- Ext.destroy(element);
- this.notifierElem = undefined;
- },
- /**
- * Start the animation,
- * we will slide the message into the screen from the given direction, and after the timeout,
- * the message will be slided out to the given direction (during sliding it will disappear gradually).
- * @param {@link Ext.Element element}
- * @private
- */
- animMessage : function(element, animationEffect)
- {
- switch (animationEffect)
- {
- case 'run':
- element.animate({
- opacity: {to: 0, from: 1},
- },
- 4, // animation duration
- this.removeElem.createDelegate(this), // callback
- 'easeOut', // easing method
- 'run' // animation type ('run','color','motion','scroll')
- );
- break;
- case 'fadeIn':
- element.fadeIn({
- endOpacity: .8, //can be any value between 0 and 1 (e.g. .5)
- easing: 'easeOut',
- });
- break;
- case 'fadeOut' :
- element.fadeOut({
- endOpacity: 0, //can be any value between 0 and 1 (e.g. .5)
- easing: 'easeOut',
- duration: .2,
- remove: true
- });
- break;
- }
- }
- });
- Zarafa.onReady(function() {
- container.getNotifier().registerPlugin('dialogNotifier', new Zarafa.core.ui.notifier.DialogNotifierPlugin());
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement