tiki-list_object_permissions.tpl 8.11 KB
Newer Older
1
{title}{tr}Object Permissions List{/tr}{/title}
2

3
<div class="t_navbar">
4
	{button href="tiki-objectpermissions.php" class="btn btn-link" _type="link" _icon_name="permission" _text="{tr}Manage permissions{/tr}"}
5 6
</div>

7 8 9 10 11 12
<br>
{if $all_groups|@count >= 5}
	{$size = 6}
{else}
	{$size = $all_groups|@count +1}
{/if}
13
<form method="post">
14 15 16 17 18 19 20 21
	<div class="clearfix forb-group">
		<legend>{tr}Group Filter{/tr}</legend>
		<fieldset>
			<div class="col-lg-6">
				<select class='form-control' multiple="multiple" id="filterGroup" name="filterGroup[]" size="{$size}">
					<option value=""{if empty($filterGroup)}selected="selected"{/if}></option>
					{foreach from=$all_groups item=gr}
						<option value="{$gr|escape}" {if in_array($gr, $filterGroup)}selected="selected"{/if}>{$gr|escape}</option>
22
					{/foreach}
23 24 25 26 27 28
				</select>
			</div>
			<div>
				<input type="submit" class="btn btn-default" name="filter" value="{tr}Filter{/tr}">
			</div>
		</fieldset>
29
	</div>
30
</form>
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
<br>
<legend>{tr}Object Permissions{/tr}</legend>
<ul class="nav nav-tabs" id="allperms">
	{foreach $res as $type => $content}
		<li>
			<a href="#{$type|strip:'_'}" data-toggle="tab">{$type|ucwords}</a>
		</li>
	{/foreach}
</ul>
<div class="tab-content">
	<br>
	{foreach $res as $type => $content}
		<div id="{$type|strip:'_'}" class="tab-pane">
			<ul class="nav nav-tabs" id="allperms">
				<li class="active"><a href="#{$type|strip:'_'}-global" data-toggle="tab">{tr}Global permissions{/tr} ({$content.default|@count})</a></li>
				<li><a href="#{$type|strip:'_'}-object" data-toggle="tab">{tr}Object permissions{/tr} ({$content.objects|@count})</a></li>
				<li><a href="#{$type|strip:'_'}-category" data-toggle="tab">{tr}Category permissions{/tr} ({$content.category|@count})</a></li>
			</ul>
			{* global permissions *}
			<div class="tab-content">
					<div id="{$type|strip:'_'}-global" class="tab-pane active">
						{if count($content.default)}
							<form id="{$type|strip:'_'}-global" method="post">
								{foreach from=$filterGroup item=f}
									<input type="hidden" name="filterGroup[]" value="{$f|escape}">
56
								{/foreach}
57
								<div class="table-responsive">
58
									<table class="table table-striped table-hover">
59 60 61 62 63 64 65 66 67 68 69 70 71 72
										<tr>
											<th class="checkbox-cell">{select_all checkbox_names='groupPerm[]'}</th>
											<th>{tr}Group{/tr}</th>
											<th>{tr}Permission{/tr}</th>
										</tr>

										{foreach from=$content.default item=default}
											<tr>
												<td class="checkbox-cell"><input type="checkbox" name="groupPerm[]" value='{$default|json_encode|escape}'></td>
												<td class="text">{$default.group|escape}</td>
												<td class="text">{$default.perm|escape}</td>
											</tr>
										{/foreach}
									</table>
73
								</div>
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
								<legend>{tr}Perform action with selected permissions:{/tr}</legend>
								<div class="form-group">
									<label for="delete" class="col-lg-4 control-label">
										{tr}Delete{/tr}
									</label>
									<div class="col-lg-2">
										<button class="btn btn-default" name="delete" value="delete">
											{tr}OK{/tr}
										</button>
									</div>
									<div class="col-lg-6"></div><br>
								</div>
								<div class="form-group">
									<label for="duplicate" class="col-lg-4 control-label">
										{tr}Assign to this group{/tr}
									</label>
									<div class="col-lg-4">
										<div class="input-group">
											<input type="text" name="toGroup" class="form-control">
										<span class="input-group-btn">
											<button class="btn btn-default" name="duplicate" value="duplicate">
												{tr}OK{/tr}
											</button>
										</span>
										</div>
									</div>
								</div>
							</form>
						{else}<br>
							{remarksbox title="{tr}Only default global permissions are being used.{/tr}"}{/remarksbox}
						{/if}
					</div><br>
				{* object permissions *}
				<div id="{$type|strip:'_'}-object" class="tab-pane">
					{if count($content.objects)}
109 110 111
						<form method="post">
							{foreach from=$filterGroup item=f}<input type="hidden" name="filterGroup[]" value="{$f|escape}">{/foreach}
							<div class="table-responsive">
112
								<table class="table table-striped table-hover">
113 114 115 116 117 118 119 120 121 122 123 124
									<tr>
										<th class="checkbox-cell">{select_all checkbox_names='objectPerm[]'}</th>
										<th>{tr}Object{/tr}</th>
										<th>{tr}Group{/tr}</th>
										<th>{tr}Permission{/tr}</th>
										<th>{tr}Reason{/tr}</th>
									</tr>
									{foreach from=$content.objects item=object}
										{if !empty($object.special)}
											{foreach from=$object.special item=special}
												<tr>
													<td class="checkbox-cell"><input type="checkbox" name="objectPerm[]" value='{$special|json_encode|escape}'></td>
125
													<td class="text">{object_link type=$special.objectType id=$special.objectId title=$special.objectName}</td>
126 127 128 129 130 131 132 133 134 135 136 137 138
													<td class="text">{$special.group|escape}</td>
													<td class="text">{$special.perm|escape}</td>
													<td class="text">
														{if !empty($special.objectId)}
															{* I doubt this link worked in the past, permType was not specified *}
															{permission_link mode=link type=$special.objectType id=$special.objectId title=$special.objectName label=$special.reason}
														{else}
															{$special.reason|escape}
														{/if}
														{if !empty($special.detail)}({$special.detail|escape}){/if}
													</td>
												</tr>
											{/foreach}
139
										{/if}
140 141 142
									{/foreach}
								</table>
							</div>
143 144 145 146 147 148 149 150 151
							<legend>{tr}Perform action with selected permissions:{/tr}</legend>
							<div class="form-group">
								<label for="delete" class="col-lg-4 control-label">
									{tr}Delete{/tr}
								</label>
								<div class="col-lg-2">
									<button class="btn btn-default" name="delete" value="delete">
										{tr}OK{/tr}
									</button>
152
								</div>
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
								<div class="col-lg-6"></div><br>
							</div>
							<div class="form-group">
								<label for="duplicate" class="col-lg-4 control-label">
									{tr}Assign to this group{/tr}
								</label>
								<div class="col-lg-4">
									<div class="input-group">
										<input type="text" name="toGroup" class="form-control">
										<span class="input-group-btn">
											<button class="btn btn-default" name="duplicate" value="duplicate">
												{tr}OK{/tr}
											</button>
										</span>
									</div>
								</div>
							</div>
170
						</form>
171 172 173 174 175 176 177
					{else}<br>
						{remarksbox title="{tr}No object permissions apply.{/tr}"}{/remarksbox}
					{/if}
				</div>
				{* category permissions *}
				<div id="{$type|strip:'_'}-category" class="tab-pane">
					{if count($content.category)}
178 179
						<form method="post">
							<div class="table-responsive">
180
								<table class="table table-striped table-hover">
181 182 183 184 185 186 187 188 189 190
									<tr>
										<th>{tr}Object{/tr}</th>
										<th>{tr}Group{/tr}</th>
										<th>{tr}Permission{/tr}</th>
										<th>{tr}Reason{/tr}</th>
									</tr>
									{foreach from=$content.category item=object}
										{if !empty($object.category)}
											{foreach from=$object.category item=special}
												<tr>
191
													<td class="text">{object_link type=$object.objectType objectId=$object.objectId}</td>
192 193 194 195 196 197 198 199 200 201 202 203 204 205
													<td class="text">{$special.group|escape}</td>
													<td class="text">{$special.perm|escape}</td>
													<td class="text">
														{if !empty($special.objectId)}
															{* I doubt this link worked in the past, permType was not specified *}
															{permission_link mode=icon type=$special.objectType id=$special.objectId title=$special.objectName}
															{tr}{$special.reason|escape}:{/tr} {$special.objectName|escape}
														{else}
															{$special.reason|escape}: {$special.objectName}
														{/if}
														{if !empty($special.detail)}({$special.detail|escape}){/if}
													</td>
												</tr>
											{/foreach}
206
										{/if}
207 208 209 210
									{/foreach}
								</table>
							</div>
						</form>
211 212 213 214 215 216
					{else}<br>
						{remarksbox title="{tr}No category permissions apply.{/tr}"}{/remarksbox}
					{/if}
				</div>
			</div>
		</div>
217
	{/foreach}
218
</div>