Commit d65c56a6 authored by walper's avatar walper

[FIX] PluginTrackerList failed to display the popupfields set in parameter...

[FIX] PluginTrackerList failed to display the popupfields set in parameter "popup". It now shows the correct fields and also in the correct order (as set in param "popup"). If popup is set without fields or not set at all, it shows no popup.
parent 7f4fc7cb
......@@ -138,7 +138,9 @@ abstract class Tracker_Field_Abstract implements Tracker_Field_Interface, Tracke
// add the html / js for the mouseover popup
if (isset($context['showpopup']) && $context['showpopup'] == 'y') {
$popup = $this->renderPopup();
// check if trackerplugin has set popup fields using the popup parameter
$pluginPopupFields = isset($context['popupfields']) ? $context['popupfields'] : null;
$popup = $this->renderPopup($pluginPopupFields);
if ($popup) {
$popup = preg_replace('/<\!--.*?-->/', '', $popup); // remove comments added by log_tpl
......@@ -222,16 +224,25 @@ abstract class Tracker_Field_Abstract implements Tracker_Field_Interface, Tracke
/**
* Create the html/js to show a popupwindow on mouseover when the trackeritem has a field with link enabled.
* The formatting is done via smarty based on 'trackeroutput/popup.tpl'
* @param array $pluginPopupFields - array with fieldids set by trackerlist plugin. if not set the tracker defaults will be used.
* @return NULL|string $popupHtml
*/
private function renderPopup()
private function renderPopup($pluginPopupFields = null)
{
$fields = $this->trackerDefinition->getPopupFields();
// support of trackerlist plugin popup field - if popup is set and has fields - show the fields as defined and in their order
// if parameter popup is set but without fields show no popup
// note: the popup template code in wikiplugin_trackerlist.tpl does not seem to be used at all - only the flag $showpopup
if ($pluginPopupFields && is_array($pluginPopupFields)) {
$fields = $pluginPopupFields;
} else {
// plugin trackerlist not involved
$fields = $this->trackerDefinition->getPopupFields();
}
if (empty($fields)) {
return null;
}
$factory = $this->trackerDefinition->getFieldFactory();
$popupFields = array();
......
......@@ -838,6 +838,9 @@ function wikiplugin_trackerlist($data, $params)
if (!empty($filterfield) && !empty($limit)) {
$limit = array_unique(array_merge($limit, $filterfield));
}
// for some reason if param popup is set but empty, the array contains 2 empty elements. We filter them out.
$popup = array_filter($popup);
if (!empty($popup)) {
$limit = array_unique(array_merge($limit, $popup));
}
......
......@@ -211,6 +211,7 @@ the section loop so that the vars are not replaced by nested pretty tracker exec
{/if}
{* ------- popup ---- *}
{* This popup code does not seem to be used/working except to create the showpopup parameter to enable/disable the popup. the popup is entirely created in tracker/field/abstract.php *}
{if !empty($popupfields)}
{capture name=popup}
<div class="panel panel-default">
......@@ -259,11 +260,11 @@ the section loop so that the vars are not replaced by nested pretty tracker exec
<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"{/if}>
{if $field.isHidden eq 'c' and $fieldr and $perms.tiki_p_admin_trackers ne 'y'}
{elseif isset($perms)}
{trackeroutput item=$items[user] field=$field list_mode=$list_mode showlinks=$showlinks showpopup=$showpopup url=$url editable=in_array($field.fieldId, $editableFields)
{trackeroutput item=$items[user] field=$field list_mode=$list_mode showlinks=$showlinks showpopup=$showpopup popupfields=$popupfields url=$url editable=in_array($field.fieldId, $editableFields)
tiki_p_view_trackers=$perms.tiki_p_view_trackers tiki_p_modify_tracker_items=$perms.tiki_p_modify_tracker_items tiki_p_modify_tracker_items_pending=$perms.tiki_p_modify_tracker_items_pending
tiki_p_modify_tracker_items_closed=$perms.tiki_p_modify_tracker_items_closed tiki_p_comment_tracker_items=$perms.tiki_p_comment_tracker_items reloff=$itemoff}
{else}
{trackeroutput item=$items[user] field=$field list_mode=$list_mode reloff=$itemoff showlinks=$showlinks showpopup=$showpopup url=$url editable=in_array($field.fieldId, $editableFields)}
{trackeroutput item=$items[user] field=$field list_mode=$list_mode reloff=$itemoff showlinks=$showlinks showpopup=$showpopup popupfields=$popupfields url=$url editable=in_array($field.fieldId, $editableFields)}
{/if}
</td>
{/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