Commit 95c09885 authored by kroky6's avatar kroky6

[ENH] admin_editable_after permission added to tracker fields - non-admins can...

[ENH] admin_editable_after permission added to tracker fields - non-admins can insert but not update and still are able to see the field
parent 03a9bbef
......@@ -105,6 +105,7 @@ class Tiki_Profile_InstallHandler_TrackerField extends Tiki_Profile_InstallHandl
'public' => 'n',
'admin_only' => 'y',
'admin_editable' => 'p',
'admin_editable_after' => 'a',
'creator_editable' => 'c',
'immutable' => 'i',
)
......
......@@ -838,7 +838,7 @@ class Tracker_Field_ItemLink extends Tracker_Field_Abstract implements Tracker_F
$definition = Tracker_Definition::get($trackerId);
foreach ($option as $fieldId) {
$field = $definition->getField($fieldId);
if( $field['isPublic'] == 'y' && ($field['isHidden'] == 'n' || $field['isHidden'] == 'c' || $field['isHidden'] == 'p' || $tiki_p_admin_trackers == 'y')
if( $field['isPublic'] == 'y' && ($field['isHidden'] == 'n' || $field['isHidden'] == 'c' || $field['isHidden'] == 'p' || $field['isHidden'] == 'a' || $tiki_p_admin_trackers == 'y')
&& $field['type'] != 'x' && $field['type'] != 'h' && ($field['type'] != 'p' || $field['options_array'][0] != 'password')
&& (empty($field['visibleBy']) or array_intersect(TikiLib::lib('tiki')->get_user_groups($user), $field['visibleBy']) || $tiki_p_admin_trackers == 'y') ) {
$fields[] = $fieldId;
......
......@@ -319,8 +319,8 @@ class Tracker_Item
$isHidden = $field['isHidden'];
$editableBy = $field['editableBy'];
if ($isHidden == 'i') {
// Immutable after creation
if ($isHidden == 'i' || $isHidden == 'a') {
// Immutable or editable by admin only after creation
return $this->isNew();
} elseif ($isHidden == 'c') {
// Creator or creator group check when field can be modified by creator only
......
......@@ -1680,7 +1680,7 @@ function wikiplugin_tracker($data, $params)
foreach ($flds['data'] as $i=>$f) { // collect additional infos
if (in_array($f['fieldId'], $outf)) {
$flds['data'][$i]['ins_id'] = ($f['type'] == 'e')?'ins_'.$f['fieldId']: $fields_prefix.$f['fieldId'];
if (($f['isHidden'] == 'c' || $f['isHidden'] == 'p') && !empty($itemId) && !isset($item['creators'])) {
if (($f['isHidden'] == 'c' || $f['isHidden'] == 'p' || $f['isHidden'] == 'a') && !empty($itemId) && !isset($item['creators'])) {
$item['creators'] = $trklib->get_item_creators($trackerId, $itemId);
}
}
......
......@@ -111,6 +111,7 @@
<option value="r"{if $field.isHidden eq 'r'} selected="selected"{/if}>{tr}Visible by all but not in RSS feeds{/tr}</option>
<option value="y"{if $field.isHidden eq 'y'} selected="selected"{/if}>{tr}Visible after creation by administrators only{/tr}</option>
<option value="p"{if $field.isHidden eq 'p'} selected="selected"{/if}>{tr}Editable by administrators only{/tr}</option>
<option value="a"{if $field.isHidden eq 'a'} selected="selected"{/if}>{tr}Editable after creation by administrators only{/tr}</option>
<option value="c"{if $field.isHidden eq 'c'} selected="selected"{/if}>{tr}Editable by administrators and creator only{/tr}</option>
<option value="i"{if $field.isHidden eq 'i'} selected="selected"{/if}>{tr}Immutable after creation{/tr}</option>
</select>
......
......@@ -95,7 +95,7 @@
{/if}
{foreach key=jx item=ix from=$fields}
{$fieldcount = $fieldcount + 1}
{if $ix.isPublic eq 'y' and ($ix.isHidden eq 'n' or $ix.isHidden eq 'c' or $ix.isHidden eq 'p' or $perms.tiki_p_admin_trackers eq 'y')
{if $ix.isPublic eq 'y' and ($ix.isHidden eq 'n' or $ix.isHidden eq 'c' or $ix.isHidden eq 'p' or $ix.isHidden eq 'a' or $perms.tiki_p_admin_trackers eq 'y')
and $ix.type ne 'x' and $ix.type ne 'h' and in_array($ix.fieldId, $listfields) and ($ix.type ne 'p' or $ix.options_array[0] ne 'password')
and (empty($ix.visibleBy) or in_array($default_group, $ix.visibleBy) or $perms.tiki_p_admin_trackers eq 'y')}
{if $ix.type eq 'l'}
......@@ -160,7 +160,7 @@ the section loop so that the vars are not replaced by nested pretty tracker exec
{if ($showstatus ne 'n') and ($tracker_info.showStatus eq 'y' or ($tracker_info.showStatusAdminOnly eq 'y' and $perms.tiki_p_admin_trackers eq 'y'))}<td></td>{/if}
{if $showitemrank eq 'y'}<td></td>{/if}
{foreach key=jx item=ix from=$fields}
{if $ix.isPublic eq 'y' and ($ix.isHidden eq 'n' or $ix.isHidden eq 'c' or $ix.isHidden eq 'p' or $perms.tiki_p_admin_trackers eq 'y') and $ix.type ne 'x' and $ix.type ne 'h'
{if $ix.isPublic eq 'y' and ($ix.isHidden eq 'n' or $ix.isHidden eq 'c' or $ix.isHidden eq 'p' or $ix.isHidden eq 'a' or $perms.tiki_p_admin_trackers eq 'y') and $ix.type ne 'x' and $ix.type ne 'h'
and in_array($ix.fieldId, $listfields) and ($ix.type ne 'p' or $ix.options_array[0] ne 'password') and (empty($ix.visibleBy) or in_array($default_group, $ix.visibleBy)
or $perms.tiki_p_admin_trackers eq 'y')}
{if isset($computedFields[$ix.fieldId])}
......@@ -297,7 +297,7 @@ the section loop so that the vars are not replaced by nested pretty tracker exec
{if !isset($list_mode)}{assign var=list_mode value="y"}{/if}
{foreach from=$items[user].field_values item=field}
{if $field.isPublic eq 'y' and ($field.isHidden eq 'n' or $field.isHidden eq 'c'
or $field.isHidden eq 'p' or $perms.tiki_p_admin_trackers eq 'y') and $field.type ne 'x' and $field.type ne 'h'
or $field.isHidden eq 'p' or $field.isHidden eq 'a' or $perms.tiki_p_admin_trackers eq 'y') and $field.type ne 'x' and $field.type ne 'h'
and in_array($field.fieldId, $listfields) and ($field.type ne 'p' or $field.options_array[0] ne 'password')
and (empty($field.visibleBy) or in_array($default_group, $field.visibleBy) or $perms.tiki_p_admin_trackers eq 'y')}
<td class={if $field.type eq 'n' or $field.type eq 'q' or $field.type eq 'b'}"numeric"{else}"auto"{/if} {if $field.type eq 'b'} style="padding-right:5px;{$tdinstyle}"{else}{$tdstyle}{/if}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment