-
Notifications
You must be signed in to change notification settings - Fork 141
/
block.tpl
43 lines (42 loc) · 1.4 KB
/
block.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{**
* block.tpl
*
* Copyright (c) 2003-2010 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Common site sidebar menu -- user tools.
*}
{if $isUserLoggedIn}
<div class="block" id="sidebarSelectRole">
<span class="blockTitle">{translate key="user.roles"}</span>
<br />
<form id="changeActingAsUserGroupForm" action="">
<select id="changedActingAsUserGroupId" name="changedActingAsUserGroupId" class="field select">
{iterate from="userGroups" item=group}
<option value="{$group->getId()}" {if $group->getId() == $currentActingAsUserGroupId}selected="selected"{/if}>{$group->getLocalizedName()}</option>
{/iterate}
</select>
<label for="toolbox_press_roles">{translate key="plugins.block.selectRole.changeTo"}</label>
{literal}<script type='text/javascript'>
$(function(){
$('#changedActingAsUserGroupId').change(function() {
$.post(
'{/literal}{url router=$smarty.const.ROUTE_COMPONENT component="api.user.RoleApiHandler" op="changeActingAsUserGroup"}{literal}',
$(this.form).serialize(),
function(jsonData) {
// Display error message (if any)
if (jsonData.status == false) {
alert(jsonData.content);
} else {
// Reload the page
location.reload(true);
}
},
"json"
);
});
});
</script>{/literal}
</form>
</div>
{/if}