Commit bf5a1ab4 authored by kroky6's avatar kroky6

[FIX] show ItemLink add button only if user has permission to add items to remote tracker

parent 1520c7e7
......@@ -250,6 +250,8 @@ class Tracker_Field_ItemLink extends Tracker_Field_Abstract implements Tracker_F
function renderInput($context = array())
{
$trackerPerms = Perms::get('tracker', $this->getOption('trackerId'));
if ($this->useSelector()) {
$value = $this->getValue();
$placeholder = tr(TikiLib::lib('object')->get_title('tracker', $this->getOption('trackerId')));
......@@ -295,6 +297,7 @@ class Tracker_Field_ItemLink extends Tracker_Field_Abstract implements Tracker_F
'status' => $status,
'selector_value' => $value,
'format' => $format,
'createTrackerItems' => $trackerPerms->create_tracker_items,
]);
return $template;
......@@ -303,6 +306,7 @@ class Tracker_Field_ItemLink extends Tracker_Field_Abstract implements Tracker_F
$data = array(
'list' => $this->getItemList(),
'displayFieldsListType' => $this->getOption('displayFieldsListType'),
'createTrackerItems' => $trackerPerms->create_tracker_items,
);
$servicelib = TikiLib::lib('service');
......
......@@ -7,7 +7,7 @@
{capture assign=fieldvalue}{if is_array($field.value)}{','|implode:$field.value}{else}{$field.value}{/if}{/capture}
{wikiplugin _name=trackerlist trackerId=$field.options_map.trackerId fields=':'|implode:$field.options_map.displayFieldsList editableall="y" showlinks="y" sortable="type:reset" sortList="[1,0]" tsfilters="type:nofilter" tsfilteroptions="type:reset" tspaginate="max:5" checkbox="/"|cat:$field.ins_id|cat:"//////y/"|cat:$fieldvalue filterfield=$field.options_map.preSelectFieldThere exactvalue=$data.preselection_value ignoreRequestItemId=y}
{/wikiplugin}
{if $field.options_map.addItems}
{if $field.options_map.addItems and $data.createTrackerItems}
<a class="btn btn-default insert-tracker-item" href="{service controller=tracker action=insert_item trackerId=$field.options_map.trackerId next=$data.next|escape}" data-href="{service controller=tracker action=insert_item trackerId=$field.options_map.trackerId next=$data.next|escape}">{$field.options_map.addItems|escape}</a>
{if $field.options_map.preSelectFieldThere}
{jq}
......@@ -49,7 +49,7 @@
</option>
{/foreach}
</select>
{if $field.options_map.addItems}
{if $field.options_map.addItems and $data.createTrackerItems}
<a class="btn btn-default insert-tracker-item" href="{service controller=tracker action=insert_item trackerId=$field.options_map.trackerId next=$data.next|escape}" data-href="{service controller=tracker action=insert_item trackerId=$field.options_map.trackerId next=$data.next|escape}">{$field.options_map.addItems|escape}</a>
{if $field.options_map.preSelectFieldThere}
{jq}
......
{* $Id: itemlink.tpl 51847 2014-07-04 18:08:48Z lphuberdeau $ *}
<div class="item-link">
{object_selector _id=$field.ins_id _simplevalue=$field.value _simplename=$field.ins_id _placeholder=$data.placeholder type="trackeritem" tracker_id=$field.options_map.trackerId tracker_status=$data.status _format=$data.format}
{if $field.options_map.addItems}
{if $field.options_map.addItems and $data.createTrackerItems}
<a class="btn btn-default insert-tracker-item" href="{service controller=tracker action=insert_item trackerId=$field.options_map.trackerId}">{$field.options_map.addItems|escape}</a>
{jq}
$('#{{$field.ins_id|escape}}')
......
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