PHP Classes

File: templates/pnotify/alert.js

Recommend this page to a friend!
  Classes of Thierry Feuzeu  >  Modals, alerts and confirmation dialogs for Jaxon  >  templates/pnotify/alert.js  >  Download  
File: templates/pnotify/alert.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Modals, alerts and confirmation dialogs for Jaxon
Display Ajax modal, alert and confirmation dialogs
Author: By
Last change:
Date: 4 years ago
Size: 2,055 bytes
 

Contents

Class file image Download
jaxon.dialogs.pnotify = {
    alert: function(data) {
        notice = new PNotify(data);
        notice.get().click(function(){notice.remove();});
    },
    success: function(content, title) {
        jaxon.dialogs.pnotify.alert({text: content, title: title, type: 'success'});
    },
    info: function(content, title) {
        jaxon.dialogs.pnotify.alert({text: content, title: title, type: 'info'});
    },
    warning: function(content, title) {
        jaxon.dialogs.pnotify.alert({text: content, title: title, type: 'notice'});
    },
    error: function(content, title) {
        jaxon.dialogs.pnotify.alert({text: content, title: title, type: 'error'});
    },
    confirm: function(question, title, yesCallback, noCallback) {
        PNotify.prototype.options.confirm.buttons[0].text = "<?php echo $this->yes ?>";
        PNotify.prototype.options.confirm.buttons[1].text = "<?php echo $this->no ?>";
        notice = new PNotify({
            title: title,
            text: question,
            hide: false,
            confirm:{
                confirm: true
            },
            buttons:{
                closer: false,
                sticker: false,
                labels: {
                    
                }
            }
        });
        notice.get().on("pnotify.confirm", yesCallback);
        if(noCallback != undefined)
            notice.get().on("pnotify.cancel", noCallback);
    }
};

PNotify.prototype.options.delay = 5000;
PNotify.prototype.options.styling = 'fontawesome';
<?php echo $this->options ?>

jaxon.command.handler.register("pnotify.alert", function(args) {
    jaxon.pnotify.alert(args.data);
});

<?php if(($this->defaultForAlert)): ?>
jaxon.ajax.message.success = jaxon.dialogs.pnotify.success;
jaxon.ajax.message.info = jaxon.dialogs.pnotify.info;
jaxon.ajax.message.warning = jaxon.dialogs.pnotify.warning;
jaxon.ajax.message.error = jaxon.dialogs.pnotify.error;
<?php endif ?>
<?php if(($this->defaultForConfirm)): ?>
jaxon.ajax.message.confirm = jaxon.dialogs.pnotify.confirm;
<?php endif ?>
For more information send a message to info at phpclasses dot org.