Skip to content

Commit 42dfd76

Browse files
committed
Move 'Logged in as' dialog to footer.html
1 parent 37fb304 commit 42dfd76

File tree

5 files changed

+49
-123
lines changed

5 files changed

+49
-123
lines changed

web/templates/admin/list_search.html

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,9 @@
7272
if ($key == $user) {
7373
?>
7474
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/logout"><?=__('logout')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
75-
<?
76-
if (!empty($_SESSION['look_alert'])) {
77-
?>
78-
<script type="text/javascript">
79-
$(function() {
80-
$( "#dialog:ui-dialog" ).dialog( "destroy" );
81-
$( "#dialog-message" ).dialog({
82-
modal: true,
83-
buttons: {
84-
Ok: function() {
85-
$( this ).dialog( "close" );
86-
},
87-
}
88-
});
89-
});
90-
</script>
91-
<div id="dialog-message" title="<?=__('Welcome')?>">
92-
<p class="confirmation"><?=__('LOGGED_IN_AS',$key)?></p>
93-
</div>
94-
<?
95-
unset($_SESSION['look_alert']);
96-
}
97-
} else { ?>
75+
<?php
76+
} else {
77+
?>
9878
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/login/?loginas=<?=$data[$key]['USER']?>&token=<?=$_SESSION['token']?>""><?=__('login as')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
9979
<? }
10080
}

web/templates/admin/list_user.html

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,38 +92,9 @@
9292
if ($key == $user) {
9393
?>
9494
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/logout"><?=__('logout')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
95-
<?
96-
if (!empty($_SESSION['look_alert'])) {
97-
?>
98-
<script type="text/javascript">
99-
$(function() {
100-
$( "#dialog:ui-dialog" ).dialog( "destroy" );
101-
$( "#dialog-message" ).dialog({
102-
modal: true,
103-
buttons: {
104-
Ok: function() {
105-
$( this ).dialog( "close" );
106-
},
107-
},
108-
create:function () {
109-
$(this).closest(".ui-dialog")
110-
.find(".ui-button:first")
111-
.addClass("submit");
112-
$(this).closest(".ui-dialog")
113-
.find(".ui-button")
114-
.eq(1) // the first button
115-
.addClass("cancel");
116-
}
117-
});
118-
});
119-
</script>
120-
<div id="dialog-message" title="<?=__('Welcome')?>">
121-
<p class="confirmation"><?=__('LOGGED_IN_AS',$key)?></p>
122-
</div>
123-
<?
124-
unset($_SESSION['look_alert']);
125-
}
126-
} else { ?>
95+
<?php
96+
} else {
97+
?>
12798
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/login/?loginas=<?=$key?>&token=<?=$_SESSION['token']?>""><?=__('login as').' '.$key?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
12899
<?}?>
129100
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href"><a href="/edit/user/?user=<?=$key?>&token=<?=$_SESSION['token']?>"><?=__('edit')?> <i></i></a><span class="shortcut enter">&nbsp;&#8629;</span></div>

web/templates/footer.html

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,53 @@
1717
?>
1818

1919
<?php
20-
if (!empty($_SESSION['error_msg'])):
20+
// todo: display all the dialogs?
21+
22+
if (!empty($_SESSION['look_alert'])):
2123
?>
22-
<div>
23-
<div id="dialog-message" title="">
24-
<p><?=htmlentities($_SESSION['error_msg'])?></p>
25-
</div>
26-
<script>
24+
<script>
25+
$(function() {
2726
$('#dialog:ui-dialog').dialog('destroy');
2827
$('#dialog-message').dialog({
2928
modal: true,
3029
buttons: {
3130
Ok: function() {
3231
$(this).dialog('close');
3332
}
34-
},
35-
create: function() {
36-
$(this)
37-
.closest('.ui-dialog')
38-
.find('.ui-button:first')
39-
.addClass('submit');
4033
}
4134
});
35+
});
36+
</script>
37+
<div id="dialog-message" title="<?=__('Welcome')?>">
38+
<p class="confirmation"><?=__('LOGGED_IN_AS', $_SESSION['look'])?></p>
39+
</div>
40+
<?php
41+
unset($_SESSION['look_alert']);
42+
elseif (!empty($_SESSION['error_msg'])):
43+
?>
44+
<div>
45+
<script>
46+
$(function() {
47+
$('#dialog:ui-dialog').dialog('destroy');
48+
$('#dialog-message').dialog({
49+
modal: true,
50+
buttons: {
51+
Ok: function() {
52+
$(this).dialog('close');
53+
}
54+
},
55+
create: function() {
56+
$(this)
57+
.closest('.ui-dialog')
58+
.find('.ui-button:first')
59+
.addClass('submit');
60+
}
61+
});
62+
});
4263
</script>
64+
<div id="dialog-message" title="">
65+
<p><?=htmlentities($_SESSION['error_msg'])?></p>
66+
</div>
4367
</div>
4468
<?php
4569
unset($_SESSION['error_msg']);

web/templates/user/list_search.html

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,29 +74,9 @@
7474
if ($key == $user) {
7575
?>
7676
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/logout"><?=__('logout')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
77-
<?
78-
if (!empty($_SESSION['look_alert'])) {
79-
?>
80-
<script type="text/javascript">
81-
$(function() {
82-
$( "#dialog:ui-dialog" ).dialog( "destroy" );
83-
$( "#dialog-message" ).dialog({
84-
modal: true,
85-
buttons: {
86-
Ok: function() {
87-
$( this ).dialog( "close" );
88-
},
89-
}
90-
});
91-
});
92-
</script>
93-
<div id="dialog-message" title="<?=__('Welcome')?>">
94-
<p class="confirmation"><?=__('LOGGED_IN_AS',$key)?></p>
95-
</div>
96-
<?
97-
unset($_SESSION['look_alert']);
98-
}
99-
} else { ?>
77+
<?php
78+
} else {
79+
?>
10080
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/login/?loginas=<?=$data[$key]['USER']?>&token=<?=$_SESSION['token']?>""><?=__('login as')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
10181
<? }
10282
}
@@ -235,4 +215,4 @@
235215
</div>
236216
</div>
237217
</div>
238-
</div>
218+
</div>

web/templates/user/list_user.html

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -90,38 +90,9 @@
9090
if ($key == $user) {
9191
?>
9292
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/logout"><?=__('logout')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
93-
<?
94-
if (!empty($_SESSION['look_alert'])) {
95-
?>
96-
<script type="text/javascript">
97-
$(function() {
98-
$( "#dialog:ui-dialog" ).dialog( "destroy" );
99-
$( "#dialog-message" ).dialog({
100-
modal: true,
101-
buttons: {
102-
Ok: function() {
103-
$( this ).dialog( "close" );
104-
},
105-
},
106-
create:function () {
107-
$(this).closest(".ui-dialog")
108-
.find(".ui-button:first")
109-
.addClass("submit");
110-
$(this).closest(".ui-dialog")
111-
.find(".ui-button")
112-
.eq(1) // the first button
113-
.addClass("cancel");
114-
}
115-
});
116-
});
117-
</script>
118-
<div id="dialog-message" title="<?=__('Welcome')?>">
119-
<p class="confirmation"><?=__('LOGGED_IN_AS',$key)?></p>
120-
</div>
121-
<?
122-
unset($_SESSION['look_alert']);
123-
}
124-
} else { ?>
93+
<?php
94+
} else {
95+
?>
12596
<div class="actions-panel__col actions-panel__loginas shortcut-l" key-action="href"><a href="/login/?loginas=<?=$key?>""><?=__('login as')?> <i></i></a><span class="shortcut">&nbsp;L</span></div>
12697
<?}?>
12798
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href"><a href="/edit/user/?user=<?=$key?>"><?=__('edit')?> <i></i></a><span class="shortcut enter">&nbsp;&#8629;</span></div>

0 commit comments

Comments
 (0)