Commit 9967f4aa9667da8cfbd398cbd3102865d3c1ca89

Authored by Neil Blakey-Milner
1 parent 26f29ec8

Move manage_folder_permissions out of the base folder.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3963 c91229c3-7414-0410-bfa2-8a42b809f60b
templates/ktcore/manage_folder_permissions.smarty renamed to templates/ktcore/folder/permissions.smarty
@@ -45,11 +45,11 @@ td.false { background-color: #ffaaaa; text-align: centre } @@ -45,11 +45,11 @@ td.false { background-color: #ffaaaa; text-align: centre }
45 </thead> 45 </thead>
46 <tbody> 46 <tbody>
47 { foreach item=oGroup from=$groups } 47 { foreach item=oGroup from=$groups }
48 -<td>{$oGroup->getID()} / {$oGroup->getName()}</td>  
49 - { assign var=iGroupID value=$oGroup->getID() } 48 +<td>{$oGroup->getId()} / {$oGroup->getName()}</td>
  49 + { assign var=iGroupId value=$oGroup->getId() }
50 { foreach item=oPerm from=$permissions } 50 { foreach item=oPerm from=$permissions }
51 - { assign var=iPermID value=$oPerm->getID() }  
52 - { assign var=bHasPerm value=$aMapPermissionGroup[$iPermID][$iGroupID] } 51 + { assign var=iPermId value=$oPerm->getId() }
  52 + { assign var=bHasPerm value=$aMapPermissionGroup[$iPermId][$iGroupId] }
53 { if $bHasPerm } 53 { if $bHasPerm }
54 <td class="true">True</td> 54 <td class="true">True</td>
55 { else } 55 { else }
@@ -67,10 +67,10 @@ padding: 2px; padding-right: 1em; padding-left: 1em&quot;&gt; @@ -67,10 +67,10 @@ padding: 2px; padding-right: 1em; padding-left: 1em&quot;&gt;
67 { if $inherited } 67 { if $inherited }
68 Inherited from {$inherited} 68 Inherited from {$inherited}
69 [<a 69 [<a
70 -href="{$smarty.server.PHP_SELF}?action=copyPermissions&fFolderID={$iFolderID}">Copy</a>] 70 +href="{$smarty.server.PHP_SELF}?action=copyPermissions&fFolderId={$iFolderId}">Copy</a>]
71 { else } 71 { else }
72 [<a 72 [<a
73 -href="{$smarty.server.PHP_SELF}?action=inheritPermissions&fFolderID={$iFolderID}">Use 73 +href="{$smarty.server.PHP_SELF}?action=inheritPermissions&fFolderId={$iFolderId}">Use
74 parent's permissions</a>] 74 parent's permissions</a>]
75 { /if } 75 { /if }
76 </span> 76 </span>
@@ -81,7 +81,7 @@ parent&#39;s permissions&lt;/a&gt;] @@ -81,7 +81,7 @@ parent&#39;s permissions&lt;/a&gt;]
81 <div class="edit" id="edit"> 81 <div class="edit" id="edit">
82 <form method="POST"> 82 <form method="POST">
83 <input type="hidden" name="action" value="update"> 83 <input type="hidden" name="action" value="update">
84 -<input type="hidden" name="fFolderID" value="{$iFolderID}"> 84 +<input type="hidden" name="fFolderId" value="{$iFolderId}">
85 <table class="pretty" cellspacing="0" cellpadding="0" border="0" width="100%"> 85 <table class="pretty" cellspacing="0" cellpadding="0" border="0" width="100%">
86 <thead> 86 <thead>
87 <tr> 87 <tr>
@@ -93,17 +93,17 @@ parent&#39;s permissions&lt;/a&gt;] @@ -93,17 +93,17 @@ parent&#39;s permissions&lt;/a&gt;]
93 </thead> 93 </thead>
94 <tbody> 94 <tbody>
95 { foreach item=oGroup from=$groups } 95 { foreach item=oGroup from=$groups }
96 -<td>{$oGroup->getID()} / {$oGroup->getName()}</td>  
97 - { assign var=iGroupID value=$oGroup->getID() } 96 +<td>{$oGroup->getId()} / {$oGroup->getName()}</td>
  97 + { assign var=iGroupId value=$oGroup->getId() }
98 { foreach item=oPerm from=$permissions } 98 { foreach item=oPerm from=$permissions }
99 - { assign var=iPermID value=$oPerm->getID() }  
100 - { assign var=bHasPerm value=$aMapPermissionGroup[$iPermID][$iGroupID] } 99 + { assign var=iPermId value=$oPerm->getId() }
  100 + { assign var=bHasPerm value=$aMapPermissionGroup[$iPermId][$iGroupId] }
101 { if $bHasPerm } 101 { if $bHasPerm }
102 -<td class="true"><input type="checkbox" name="foo[{$iPermID}][group][]"  
103 -value="{$iGroupID}" checked="true"></td> 102 +<td class="true"><input type="checkbox" name="foo[{$iPermId}][group][]"
  103 +value="{$iGroupId}" checked="true"></td>
104 { else } 104 { else }
105 -<td class="false"><input type="checkbox" name="foo[{$iPermID}][group][]"  
106 -value="{$iGroupID}"></td> 105 +<td class="false"><input type="checkbox" name="foo[{$iPermId}][group][]"
  106 +value="{$iGroupId}"></td>
107 { /if } 107 { /if }
108 { /foreach } 108 { /foreach }
109 </tr> 109 </tr>
@@ -116,6 +116,73 @@ value=&quot;{$iGroupID}&quot;&gt;&lt;/td&gt; @@ -116,6 +116,73 @@ value=&quot;{$iGroupID}&quot;&gt;&lt;/td&gt;
116 </div> 116 </div>
117 { /if } 117 { /if }
118 118
  119 +<h2>Dynamic permissions</h2>
  120 +
  121 +{ if $dynamic_conditions }
  122 +<table class="pretty" cellpadding="0" cellspacing="0">
  123 + <thead>
  124 + <tr>
  125 + <th>Group</th>
  126 + <th>Condition</th>
  127 +{foreach from=$permissions item=oPerm}
  128 + <th title="{$oPerm->sName}">{$oPerm->sHumanName}</th>
  129 +{/foreach}
  130 + </tr>
  131 + </thead>
  132 + <tbody>
  133 +{ foreach from=$dynamic_conditions item=oDynamicCondition }
  134 + <tr>
  135 +{php}
  136 +$this->assign("oGroup", Group::get($this->_tpl_vars['oDynamicCondition']->getGroupId()));
  137 +$this->assign("oCondition", KTSavedSearch::get($this->_tpl_vars['oDynamicCondition']->getConditionId()));
  138 +$this->assign("aPermissions", $this->_tpl_vars['oDynamicCondition']->getAssignment());
  139 +{/php}
  140 + <td>{$oGroup->getName()}</td>
  141 + <td>{$oCondition->getName()}</td>
  142 +{foreach from=$permissions item=oPerm}
  143 + {assign var=bHasPerm value=$oPerm->getId()|in_array:$aPermissions}
  144 + { if $bHasPerm }
  145 + <td class="true">True</td>
  146 + { else }
  147 + <td class="false">False</td>
  148 + { /if }
  149 +{/foreach}
  150 + </tr>
  151 +{ /foreach }
  152 + </tbody>
  153 +</table>
  154 +{ /if }
  155 +
  156 +{ if $edit }
  157 +<h3>Add a new dynamic permission</h3>
  158 +<form>
  159 +<table class="pretty" cellpadding="0" cellspacing="0">
  160 +<input type="hidden" name="action" value="newDynamicPermission" />
  161 +<input type="hidden" name="fFolderId" value="{$iFolderId}" />
  162 +<thead>
  163 +<tr>
  164 + <th>Group</th>
  165 + <th>Condition</th>
  166 +{foreach from=$permissions item=oPerm}
  167 + <th title="{$oPerm->sName}">{$oPerm->sHumanName}</th>
  168 +{/foreach}
  169 +</tr>
  170 +</thead>
  171 +<tbody>
  172 +<tr>
  173 + <td>{entity_select entities=$groups name=fGroupId none=true}</td>
  174 + <td>{entity_select entities=$conditions name=fConditionId none=true}</td>
  175 +{entity_checkboxes entities=$permissions name=fPermissionIds assign=aPermissionCheckboxes method="none"}
  176 +{foreach from=$aPermissionCheckboxes item=sCheckbox}
  177 + <td>{$sCheckbox}</td>
  178 +{/foreach}
  179 +</tr>
  180 +</tbody>
  181 +</table>
  182 +<input type="submit" name="submit" value="Add" />
  183 +</form>
  184 +{ /if }
  185 +
119 <h2>User permissions</h2> 186 <h2>User permissions</h2>
120 187
121 <div> 188 <div>
@@ -130,11 +197,11 @@ value=&quot;{$iGroupID}&quot;&gt;&lt;/td&gt; @@ -130,11 +197,11 @@ value=&quot;{$iGroupID}&quot;&gt;&lt;/td&gt;
130 </thead> 197 </thead>
131 <tbody> 198 <tbody>
132 { foreach item=oUser from=$users } 199 { foreach item=oUser from=$users }
133 -<td>{$oUser->getID()} / {$oUser->getName()}</td>  
134 - { assign var=iUserID value=$oUser->getID() } 200 +<td>{$oUser->getId()} / {$oUser->getName()}</td>
  201 + { assign var=iUserId value=$oUser->getId() }
135 { foreach item=oPerm from=$permissions } 202 { foreach item=oPerm from=$permissions }
136 - { assign var=iPermID value=$oPerm->getID() }  
137 - { assign var=bHasPerm value=$aMapPermissionUser[$iPermID][$iUserID] } 203 + { assign var=iPermId value=$oPerm->getId() }
  204 + { assign var=bHasPerm value=$aMapPermissionUser[$iPermId][$iUserId] }
138 { if $bHasPerm } 205 { if $bHasPerm }
139 <td class="true">True</td> 206 <td class="true">True</td>
140 { else } 207 { else }