Merge "Inherit from oparent"
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.topologymodeler / src / main / webapp / jsp / shared / dialogs.jsp
1 <%--
2 /*******************************************************************************
3  * Copyright (c) 2012-2013 University of Stuttgart.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and the Apache License 2.0 which both accompany this distribution,
7  * and are available at http://www.eclipse.org/legal/epl-v10.html
8  * and http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Contributors:
11  *    Oliver Kopp - initial API and implementation and/or initial documentation
12  *    Yves Schubert - switch to bootstrap 3
13  *******************************************************************************/
14 --%>
15 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
16
17 <script>
18 /**
19  * Displays a nice message box with "yes" and "no"
20  *
21  * TODO: currently cannot be recursively called
22  *
23  * @param msg      Message to display
24  * @param fnOnYes  function to be called if user presses "yes"
25  * @param title    (optional) title of the dialog
26  */
27 function vConfirmYesNo(msg, fnOnYes, title) {
28         title = title || "Please confirm";
29         $("#diagyesnotitle").text(title);
30         $("#diagyesnomsg").text(msg);
31         $("#diagyesnoyesbtn").off("click");
32         $("#diagyesnoyesbtn").on("click", function() {
33                 var diag = $("#diagyesno");
34                 // quick hack to get fnOnYes() working -> use the hidden.bs.modal event
35                 diag.on("hidden.bs.modal", function() {
36                         fnOnYes();
37                         diag.off("hidden.bs.modal");
38                 });
39                 diag.modal("hide");
40         });
41         $("#diagyesno").modal("show");
42 }
43
44 $(function() {
45         $("#diagyesno").on("shown.bs.modal", function() {
46                 $("#diagyesnoyesbtn").focus();
47         });
48 });
49 </script>
50
51 <div class="modal fade z1051" id="diagyesno">
52         <div class="modal-dialog">
53                 <div class="modal-content">
54                         <div class="modal-header">
55                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
56                                 <h4 class="modal-title" id="diagyesnotitle"></h4>
57                         </div>
58                         <div class="modal-body">
59                                 <p id="diagyesnomsg"></p>
60                         </div>
61                         <div class="modal-footer">
62                                 <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
63                                 <button id="diagyesnoyesbtn" type="button" class="btn btn-primary">Yes</button>
64                         </div>
65                 </div>
66         </div>
67 </div>
68
69 <div class="modal fade z1060" id="diagmessage">
70         <div class="modal-dialog">
71                 <div class="modal-content">
72                         <div class="modal-header">
73                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
74                                 <h4 class="modal-title" id="diagmessagetitle"></h4>
75                         </div>
76                         <div class="modal-body" id="diagmessagemsg">
77                         </div>
78                         <div class="modal-footer">
79                                 <button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
80                         </div>
81                 </div>
82         </div>
83 </div>