- $table_html = <<<EOD
- <tr>
- <th> </th>
- <th>$_bugtrack_plugin_state</th>
- <th>$_bugtrack_plugin_priority</th>
- <th>$_bugtrack_plugin_category</th>
- <th>$_bugtrack_plugin_name</th>
- <th>$_bugtrack_plugin_summary</th>
- </tr>
-EOD;
- for ($i = 0; $i <= count($_bugtrack_plugin_state_list); ++$i) {
- ksort($table[$i],SORT_NUMERIC);
- $table_html .= join("\n",$table[$i]);
+ $table = array();
+ for ($i = 0; $i <= $count_list + 1; ++$i) $table[$i] = array();
+ foreach ($data as $line) {
+ list($page_name, $no, $summary, $name, $priority, $state, $category, $filetime, $state_no, $html) = $line;
+ $table[$state_no][$no] = $html;
+ }
+ $table_html = ' <tr>' . "\n";
+ $bgcolor = htmlsc($_plugin_bugtrack['header_bgcolor']);
+ foreach (array('pagename', 'state', 'priority', 'category', 'name', 'summary') as $item)
+ $table_html .= ' <th style="background-color:' . $bgcolor . '">' .
+ htmlsc($_plugin_bugtrack[$item]) . '</th>' . "\n";
+ $table_html .= ' </tr>' . "\n";
+ for ($i = 0; $i <= $count_list; ++$i) {
+ ksort($table[$i], SORT_NUMERIC);
+ $table_html .= join("\n", $table[$i]);
+ }
+ return '<table border="1" width="100%">' . "\n" .
+ $table_html . "\n" .
+ '</table>';
+}
+
+// Get one set of data from a page (or a page moved to $page)
+function plugin_bugtrack_list_pageinfo($page, $no = NULL, $recurse = TRUE, $filetime = NULL)
+{
+ global $WikiName, $InterWikiName, $BracketName, $_plugin_bugtrack;
+
+ if ($no === NULL)
+ $no = preg_match('/\/([0-9]+)$/', $page, $matches) ? $matches[1] : 0;
+
+ $source = get_source($page);
+
+ // Check 'moved' page _just once_
+ $regex = "/move\s*to\s*($WikiName|$InterWikiName|\[\[$BracketName\]\])/";
+ $match = array();
+ if ($recurse && preg_match($regex, $source[0], $match))
+ return plugin_bugtrack_list_pageinfo(strip_bracket($match[1]), $no, FALSE, $filetime);
+
+ $body = join("\n", $source);
+ foreach(array('summary', 'name', 'priority', 'state', 'category') as $item) {
+ $regex = '/-\s*' . preg_quote($_plugin_bugtrack[$item], '/') . '\s*:(.*)/';
+ if (preg_match($regex, $body, $matches)) {
+ if ($item == 'name') {
+ $$item = strip_bracket(trim($matches[1]));
+ } else {
+ $$item = trim($matches[1]);
+ }
+ } else {
+ $$item = ''; // Data not found
+ }