<?php
// PukiWiki - Yet another WikiWikiWeb clone
-// $Id: tracker.inc.php,v 1.28 2005/01/23 08:29:20 henoheno Exp $
+// $Id: tracker.inc.php,v 1.34 2005/11/28 17:48:30 teanan Exp $
//
// Issue tracker plugin (See Also bugtrack plugin)
var $config;
var $data;
var $sort_type = SORT_REGULAR;
+ var $id = 0;
function Tracker_field($field,$page,$refer,&$config)
{
global $post;
+ static $id = 0;
+ $this->id = ++$id;
$this->name = $field[0];
$this->title = $field[1];
$this->values = explode(',',$field[3]);
{
$s_name = htmlspecialchars($this->name);
$retval = '';
+ $id = 0;
foreach ($this->config->get($this->name) as $option)
{
$s_option = htmlspecialchars($option[0]);
$checked = trim($option[0]) == trim($this->default_value) ? ' checked="checked"' : '';
- $retval .= "<input type=\"radio\" name=\"$s_name\" value=\"$s_option\"$checked />$s_option\n";
+ ++$id;
+ $s_id = '_p_tracker_' . $s_name . '_' . $this->id . '_' . $id;
+ $retval .= '<input type="radio" name="' . $s_name . '" id="' . $s_id .
+ '" value="' . $s_option . '"' . $checked . ' />' .
+ '<label for="' . $s_id . '">' . $s_option . '</label>' . "\n";
}
return $retval;
$s_name = htmlspecialchars($this->name);
$defaults = array_flip(preg_split('/\s*,\s*/',$this->default_value,-1,PREG_SPLIT_NO_EMPTY));
$retval = '';
+ $id = 0;
foreach ($this->config->get($this->name) as $option)
{
$s_option = htmlspecialchars($option[0]);
$checked = array_key_exists(trim($option[0]),$defaults) ?
' checked="checked"' : '';
- $retval .= "<input type=\"checkbox\" name=\"{$s_name}[]\" value=\"$s_option\"$checked />$s_option\n";
+ ++$id;
+ $s_id = '_p_tracker_' . $s_name . '_' . $this->id . '_' . $id;
+ $retval .= '<input type="checkbox" name="' . $s_name .
+ '[]" id="' . $s_id . '" value="' . $s_option . '"' . $checked . ' />' .
+ '<label for="' . $s_id . '">' . $s_option . '</label>' . "\n";
}
return $retval;
}
foreach ($this->rows as $row)
{
- $keys[$field][] = $this->fields[$field]->get_value($row[$field]);
+ $keys[$field][] = isset($row[$field])? $this->fields[$field]->get_value($row[$field]) : '';
}
$params[] = $keys[$field];
$params[] = $this->fields[$field]->sort_type;
if (is_array($order) && isset($order[$sort]))
{
- $index = array_flip(array_keys($order));
+ // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
+ $order_keys = array_keys($order); // with array_shift();
+
+ $index = array_flip($order_keys);
$pos = 1 + $index[$sort];
- $b_end = ($sort == array_shift(array_keys($order)));
+ $b_end = ($sort == array_shift($order_keys));
$b_order = ($order[$sort] == SORT_ASC);
$dir = ($b_end xor $b_order) ? SORT_ASC : SORT_DESC;
$arrow = '&br;'.($b_order ? '↑' : '↓')."($pos)";
- unset($order[$sort]);
+
+ unset($order[$sort], $order_keys);
}
$title = $this->fields[$field]->title;
$r_page = rawurlencode($this->page);