/*jsl:import ipa.js */ /* Authors: * Endi Sukma Dewata * Petr Vobornik * * Copyright (C) 2010 Red Hat * see file 'COPYING' for use and warranty information * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ define([ 'dojo/_base/lang', 'dojo/keys', 'dojo/topic', 'dojo/Evented', './builder', './ipa', './jquery', './phases', './reg', './text', './field', './widget'], function(lang, keys, topic, Evented, builder, IPA, $, phases, reg, text, field_mod, widget_mod) { /** * Opened dialogs * * For proper functionality requires started application(`app_container.app`) * * @class * @singleton */ IPA.opened_dialogs = { /** Opened dialogs */ dialogs: [], /** * Show only one dialog at a time * @property {Boolean} */ show_only_one: true, /** * Dialog topic handlers * @property {Array} * @protected */ handlers: [], /** * Object which contains `current_facet` * @property {ApplicationController} */ app: null, /** * Get top dialog of target facet or a global one * @return {IPA.dialog} */ top_dialog: function() { var top = null; for (var i=0,l=this.dialogs.length; i -1) this.dialogs.splice(index, 1); this.focus_top(); }, /** * Hide all dialogs or only the ones belonging to specific facet * @param {facet.facet|facets.Facet} [facet] Target facet */ hide: function(facet) { for (var i=0,l=this.dialogs.length; i', { 'class': 'modal fade', keydown: that.on_key_down, tabindex: '-1', 'role': 'dialog', 'aria-labelledby': 'myLargeModalLabel', 'aria-hidden': 'true' }); that.dialog_node = $('
', { 'class': 'modal-dialog', id: that.get_id(), 'data-name' : that.name, role: 'dialog', tabIndex: -1 // make the div focusable }).appendTo(that.dom_node); that.content_node = $('
', { 'class': 'modal-content' }). appendTo(that.dialog_node); that.header_node = $('
', { 'class': 'modal-header' }); that.create_header(); that.header_node.appendTo(that.content_node); that.body_node = $('
', { 'class': 'modal-body' }); // for backwards compatibility that.container = that.body_node; that.create_content(); that.body_node.appendTo(that.content_node); that.footer_node = $('
', { 'class': 'modal-footer' }); that.create_footer(); that.footer_node.appendTo(that.content_node); that.activity_indicator = IPA.activity_widget({ text: text.get('@i18n:status.working', 'Working'), mode: 'icon', visible: false }); that.activity_indicator_node = $('
').appendTo(that.dom_node); that.activity_indicator.create(that.activity_indicator_node); that.policies.post_create(); return that.dom_node; }; /** * Create header * @protected * @return {jQuery} header_node */ that.create_header = function() { that.header_node.empty(); that.title_close_button = $('