<?php
/*=====================================================================*\
|| ###################################################################
-|| # Bugdar [#]version[#]
-|| # Copyright ©2002-[#]year[#] Blue Static
+|| # Bugdar
+|| # Copyright (c)2004-2009 Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| # the Free Software Foundation; version 2 of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|| ###################################################################
\*=====================================================================*/
-define('SVN', '$Id$');
if (empty($_REQUEST['do']))
{
$fetchtemplates = array(
'favorites',
- 'trackerhome_bits'
+ 'trackerhome_bits',
+ 'list_head'
);
require_once('./global.php');
+require_once('./includes/class_sort.php');
// ###################################################################
if ($_REQUEST['do'] == 'handle')
{
- $bugsys->input_clean('bugid', TYPE_UINT);
- $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $bugsys->in['bugid']);
- if (!check_bug_permission($bug))
+ $input->inputClean('bugid', TYPE_UINT);
+ $bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $input->in['bugid']);
+ if (!check_bug_permissions($bug))
{
- $message->error_permission();
+ $message->errorPermission();
}
if (!can_perform('cansubscribe', $bug['product']))
{
- $message->error_permission();
+ $message->errorPermission();
}
- if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . $bugsys->in['bugid']))
+ if ($db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . bugdar::$userinfo['userid'] . " AND bugid = " . $input->in['bugid']))
{
- $db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . $bugsys->in['bugid']);
- $message->redirect(_('This bug has been removed from your favorites list.'), "showreport.php?bugid=" . $bugsys->in['bugid']);
+ $db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . bugdar::$userinfo['userid'] . " AND bugid = " . $input->in['bugid']);
+ $message->redirect(T('This bug has been removed from your favorites list.'), "showreport.php?bugid=" . $input->in['bugid']);
}
else
{
- $db->query("INSERT INTO " . TABLE_PREFIX . "favorite (userid, bugid) VALUES (" . $bugsys->userinfo['userid'] . ", " . $bugsys->in['bugid'] . ")");
- $message->redirect(_('This bug has been added to your favorites list.'), "showreport.php?bugid=" . $bugsys->in['bugid']);
+ $db->query("INSERT INTO " . TABLE_PREFIX . "favorite (userid, bugid) VALUES (" . bugdar::$userinfo['userid'] . ", " . $input->in['bugid'] . ")");
+ $message->redirect(T('This bug has been added to your favorites list.'), "showreport.php?bugid=" . $input->in['bugid']);
}
}
{
if (!can_perform('canviewbugs'))
{
- $message->error_permission();
+ $message->errorPermission();
}
$favorites = $db->query("
SELECT favorite.bugid, bug.* FROM " . TABLE_PREFIX . "favorite AS favorite
RIGHT JOIN " . TABLE_PREFIX . "bug AS bug
ON (favorite.bugid = bug.bugid)
- WHERE favorite.userid = " . $bugsys->userinfo['userid'] . "
- AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $bugsys->userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")
+ WHERE favorite.userid = " . bugdar::$userinfo['userid'] . "
+ AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . bugdar::$userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")
");
- while ($bug = $db->fetch_array($favorites))
+
+ if ($favorites->size() < 1)
+ {
+ $message->error(T('You do not have any favorites in your list. To add a bug to your list, while viewing the report, click the [Add to Favorites] link next to the bug\'s ID.'));
+ }
+
+ $sort = new ListSorter('favorite');
+
+ $headers = $sort->constructColumnHeaders(false);
+
+ foreach ($favorites as $bug)
{
- $funct->exec_swap_bg($stylevar['alt_color'], '');
- $bug['bgcolor'] = ($bugsys->userinfo['showcolors'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $funct->bgcolour);
- $bug['product'] = $bugsys->datastore['product']["$bug[product]"]['title'];
- $bug['version'] = $bugsys->datastore['version']["$bug[version]"]['version'];
- $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status'];
- $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'];
- $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority'];
- $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity'];
-
- $bug['hiddendisplay'] = ((!can_perform('canviewhidden', $bug['product']) AND $bug['hiddenlastposttime']) ? true : false);
-
- $bug['lastposttime'] = ($bug['hiddendisplay'] ? $bug['hiddenlastposttime'] : $bug['lastposttime']);
- $bug['lastpost'] = ($bug['hiddendisplay'] ? $bug['hiddenlastpostbyname'] : $bug['lastpostbyname']);
-
- $bug['lastposttime'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']);
- eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";');
+ BSFunctions::swap_css_classes('altcolor', '');
+ $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass);
+ $bugs .= $sort->constructRow($bug);
}
- eval('$template->flush("' . $template->fetch('favorites') . '");');
+ $tpl = new BSTemplate('favorites');
+ $tpl->vars = array(
+ 'bugs' => $bugs,
+ 'headers' => $headers
+ );
+ $tpl->evaluate()->flush();
}
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
?>
\ No newline at end of file