summaryrefslogtreecommitdiff
path: root/templates/content_permissions.tpl
blob: c4ae116655be3f1701145aa9f76147778afa6ab8 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{strip}

<div class="admin liberty">
	<div class="header">
		<h1>{tr}Assign permissions{/tr}</h1>
	</div>

	<div class="body">
		<h2>{tr}Assign permissions to{/tr}: {$gContent->getTitle()}</h2>

		{if !$contentPerms.assigned}
			{formfeedback warning="No Individual permissions set. Global Permissions apply."}
		{else}
			{smartlink ititle="Clear all custom content permissions" action=expunge content_id=$gContent->mContentId}
		{/if}

		{if count($contentPerms.groups) lt 10}
			<table class="data">
				<caption>{tr}Permissions set for this content item{/tr}</caption>
				<tr>
					<th>{tr}Permission{/tr}</th>
					{foreach from=$contentPerms.groups item=group}
						<th>{$group.group_name}</th>
					{/foreach}
				</tr>

				{foreach from=$contentPerms.assignable key=perm item=permInfo}
					<tr class="{cycle values="odd,even"}">
						<td>{$permInfo.perm_desc}<br /><em>({$permInfo.perm_name})</em></td>
						{foreach from=$contentPerms.groups key=groupId item=groupInfo}
							{assign var=icon value="icons/media-playback-stop"}                {* default icon *}
							{assign var=action value="assign"}                                 {* default action *}
							{if $groupInfo.perms.$perm}                                        {* global active permissions *}
								{assign var=icon value="icons/dialog-ok"}                      {* default active permission icon *}
								{if $contentPerms.assigned.$groupId.$perm}
									{assign var=icon value="icons/list-add"}                   {* custon permission icon *}
									{assign var=action value="remove"}                         {* remove permission if we have a custom one *}
								{/if}
								{if $contentPerms.assigned.$groupId.$perm.is_revoked}
									{assign var=icon value="icons/list-remove"}                {* is_revoked icon *}
								{/if}
							{/if}
							<td style="text-align:center">{smartlink itra=false ititle=$perm ibiticon=$icon action=$action content_id=$gContent->mContentId perm=$perm group_id=$groupId}</td>
						{/foreach}
					</tr>
				{/foreach}
			</table>

		{else}

			{form}
				<input type="hidden" name="content_id" value="{$gContent->mContentId}" />
				<input type="hidden" name="action" value="assign" />

				<div class="row">
					{formlabel label="Assign this Permission" for="perm"}
					{forminput}
						<select name="perm" id="perm">
							{foreach from=$contentPerms.assignable item=perm}
								<option value="{$perm.perm_name}">{$perm.perm_desc}</option>
							{/foreach}
						</select>
						{formhelp note=""}
					{/forminput}
				</div>

				<div class="row">
					{formlabel label="To this Group" for="group_id"}
					{forminput}
						<select name="group_id" id="group_id">
							{foreach from=$contentPerms.groups item=group}
								<option value="{$group.group_id}">{$group.group_name}</option>
							{/foreach}
						</select>
						{formhelp note=""}
					{/forminput}
				</div>

				<div class="row submit">
					<input type="submit" name="back" value="{tr}Go back to content{/tr}" />
					<input type="submit" name="assign" value="{tr}Assign Permission{/tr}" />
				</div>
			{/form}

			{if $contentPerms.assigned}
				<table class="data">
					<caption>{tr}Custom permissions assigned to this content{/tr}</caption>
					<tr>
						<th>{tr}Group{/tr}</th>
						<th>{tr}Permission{/tr}</th>
						<th>{tr}Action{/tr}</th>
					</tr>
					{foreach from=$contentPerms.assigned key=groupId item=groupInfo}
						{foreach from=$groupInfo key=perm item=permInfo name=fgroup}
							<tr class="{cycle values="even,odd"}">
								{if $smarty.foreach.fgroup.first}
									<td rowspan="{$smarty.foreach.fgroup.total}">{$permInfo.group_name}</td>
								{/if}
								<td>
									{if $contentPerms.assigned.$groupId.$perm.is_revoked}
										{biticon iname=list-remove iexplain="Removed Permission"}
									{else}
										{biticon iname=list-add iexplain="Added Permission"}
									{/if} {$permInfo.perm_desc} <em>({$permInfo.perm_name})</em>
								</td>
								<td align="right">
									{smartlink ititle="Remove Permission" ibiticon="icons/edit-delete" action=remove content_id=$gContent->mContentId perm=$perm group_id=$groupId}
								</td>
							</tr>
						{/foreach}
					{foreachelse}
						<tr class="norecords">
							<td colspan="3">{tr}No individual permissions, global permissions apply{/tr}</td>
						</tr>
					{/foreach}
				</table>
			{/if}

			<h2 >{tr}Default Permissions{/tr}</h2>
			<ul>
				{foreach from=$contentPerms.groups key=groupId item=groupInfo}
					<li>{$groupInfo.group_name}
						<ul>
							{foreach from=$groupInfo.perms key=perm item=permInfo}
								{if $contentPerms.assignable.$perm}
									<li>{$permInfo.perm_desc} <em>({$permInfo.perm_name})</em></li>
								{/if}
							{/foreach}
						</ul>
					</li>
				{/foreach}
			</ul>
		{/if}
	</div><!-- end .body -->
</div><!-- end .liberty -->

{/strip}