Lab as a Service 2.0
[laas.git] / src / templates / workflow / confirm.html
1 {% extends "workflow/viewport-element.html" %}
2 {% load staticfiles %}
3
4 {% load bootstrap3 %}
5
6 {% block content %}
7
8 <style>
9     #form_div {
10         width: 100%;
11         padding: 5%;
12         text-align: center;
13     }
14     #text_display {
15         text-align: left;
16         display: inline-block;
17     }
18     #text_wrapper {
19         text-align: center; /*centers child div*/
20     }
21     p {
22         margin:0;
23         padding:0;
24     }
25 </style>
26
27 <div style="text-align:center;">
28     <h3>Confirm  Session</h3>
29 </div>
30 <div id="vlan_warning"></div>
31 <form id="vlan_form" action="/wf/workflow/" method="post">
32     {% csrf_token %}
33     <input id="vlan_input" name="vlan_input" type="hidden"/>
34 </form>
35 <div id="text_wrapper">
36     <div id="text_display">
37         <pre>{{confirmation_info|escape}}</pre>
38     </div>
39 </div>
40 <div id="form_div">
41 <form id="confirmation_form" action="/wf/workflow/" method="post">
42     {% csrf_token %}
43     <div style="display: none;">
44     {{form|default:"<p> No Form Loaded</p>"}}
45     </div>
46 </form>
47 <div class="cform_buttons">
48     <button id="confirm_button" class="btn btn-success" onclick="formconfirm()">Confirm</button>
49     <button id="cancel_button" class="btn btn-danger" onclick="formcancel()">Cancel</button>
50 </div>
51
52 <div style="display: none;">
53 <form id="manager_delete_form" action="/wf/workflow/finish/" method="post">
54     {% csrf_token %}
55 </form>
56 </div>
57
58 <script>
59     var select = document.getElementById("id_confirm");
60
61     function delete_manager()
62     {
63         var form = $("#manager_delete_form");
64         var formData = form.serialize();
65         var req = new XMLHttpRequest();
66         req.open("POST", "/wf/workflow/finish/", false);
67         req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
68         req.onerror = function() { alert("problem with cleaning up session"); }
69         req.onreadystatechange = function() { if(req.readyState === 4 ) { parent.redirect_root(); } }
70         req.send(formData);
71     }
72
73     function formconfirm()
74     {
75         select.value = "True";
76         document.getElementById("confirmation_form").submit();
77     }
78     function formcancel()
79     {
80         select.value = "False";
81         document.getElementById("confirmation_form").submit();
82     }
83
84     var confirmed = {{bypassed|default:"false"}};
85     if( confirmed )
86     {
87         delete_manager();
88     }
89 </script>
90 <script>
91
92 function fixVlans() {
93     document.getElementById("vlan_input").value = "True";
94     document.getElementById("vlan_form").submit();
95 }
96 var problem = {{vlan_warning|default:'false'}};
97 if(problem){
98     var d = document.getElementById("vlan_warning");
99     var h3 = document.createElement("h3");
100     h3.innerHTML = "WARNING: Vlans not available";
101     var h4 = document.createElement("h4");
102     h4.innerHTML = "The vlans you selected are not currently available. Would you like to automatically change them?";
103     var button1 = document.createElement("button");
104     button1.innerHTML = "Correct Vlans For Me";
105     button1.onclick = function() { fixVlans(); }
106
107     var button2 = document.createElement("button");
108     button2.innerHTML = "Cancel. I will change my vlans";
109     button2.onclick = function() { formcancel(); }
110     d.appendChild(h3);
111     d.appendChild(h4);
112     d.appendChild(button1);
113     d.appendChild(button2);
114     document.getElementById("confirm_button").disabled = true;
115     document.getElementById("cancel_button").disabled = true;
116 }
117 </script>
118 </div>
119 {% block element_messages %}
120
121 {% endblock element_messages %}
122 {% endblock content %}
123 {% block onleave %}
124 //document.getElementById("confirmation_form").submit();
125 {% endblock %}