Server IP : 85.214.239.14 / Your IP : 13.59.116.142 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/task/2/cwd/proc/3/cwd/srv/modoboa/instance/sitestatic/js/ |
Upload File : |
(function($) { var Cwizard = function(element, options) { this.initialize(element, options); }; Cwizard.prototype = { constructor: Cwizard, initialize: function(element, options) { this.$element = $(element); this.options = $.extend({}, $.fn.cwizard.defaults, options); this.$element.carousel({pause: true}); this.$element.carousel("pause"); this.listen(); this.titles = {}; $('input:text:visible:first').focus(); }, listen: function() { $(".next").on("click", $.proxy(this.next, this)); $(".prev").on("click", $.proxy(this.prev, this)); $(".submit").on("click", $.proxy(this.submit, this)); }, get_current_step_id: function() { return $(".item.active").attr("id"); }, get_current_title: function() { return $(".modal-header").find("small").html(); }, set_current_title: function(title) { $(".modal-header").find("small").html(title); }, post: function(last, target) { var $form = (this.options.formid) ? $('#' + this.options.formid) : $('form'); var data = $form.serialize() + "&stepid=" + this.get_current_step_id() + "&target=" + target; $.ajax({ type: 'POST', url: $form.attr("action"), data: data, global: false }).done($.proxy(function(resp) { if (!last) { $('input:text:visible:first').focus(); this.set_current_title(resp.title); if (this.options.transition_callbacks[resp.id] !== undefined) { this.options.transition_callbacks[resp.id](); } $(".carousel-inner").css("overflow", "hidden"); this.$element.carousel(resp.stepid); } else { $("#modalbox").modal('hide'); if (this.options.success_callback !== undefined) { this.options.success_callback(resp); } else { window.location.reload(); } } }, this)).fail($.proxy(function(jqxhr) { var resp = $.parseJSON(jqxhr.responseText); if (resp.stepid !== undefined) { var stepid = resp.stepid; display_form_errors("step" + stepid, resp); if (this.options.error_callbacks[stepid] !== undefined) { this.options.error_callbacks[stepid](); } $('input:text:visible:first').focus(); if (resp.respmsg) { $(".modal-body").prepend(build_error_alert(resp.respmsg)); } return; } $(".modal-body").prepend(build_error_alert(resp)); }, this)); }, update_buttons: function() { $(".carousel-inner").css("overflow", "visible"); $('.bset.active').removeClass("active"); $("#" + $(".item.active").attr("id") + "_buttons").addClass("active"); }, next: function(evt) { evt.preventDefault(); var step_id = this.get_current_step_id(); this.titles[step_id] = this.get_current_title(); this.$element.on('slid.bs.carousel', this.update_buttons); this.post(false, "next"); }, /** * Go back to the previous step. */ prev: function(evt) { var stepid = this.get_current_step_id(); evt.preventDefault(); this.$element.on('slid.bs.carousel', this.update_buttons); this.post(false, "prev", stepid); }, submit: function(evt) { evt.preventDefault(); this.post(true, "next"); } }; $.fn.cwizard = function(method) { return this.each(function() { var $this = $(this), data = $this.data('cwizard'), options = typeof method === "object" && method; if (!data) { $this.data('cwizard', new Cwizard(this, options)); } if (typeof method === "string") { data[method](); } }); }; $.fn.cwizard.defaults = { transition_callbacks: {}, error_callbacks: {} }; })(jQuery);