3 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
5 * This file is a part of Codendi.
7 * Codendi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * Codendi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
21 require_once('Widget.class.php');
22 require_once('plugins_utils.php');
29 class Widget_MyBookmarks extends Widget {
30 function Widget_MyBookmarks() {
31 $this->Widget('mybookmarks');
34 return _("My Bookmarks");
36 function getContent() {
37 $html_my_bookmarks = '';
38 $result = db_query_params("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where ".
39 "user_id=$1 ORDER BY bookmark_title",array( user_getid() ));
40 $rows = db_numrows($result);
41 if (!$result || $rows < 1) {
42 $html_my_bookmarks .= _("You currently do not have any bookmarks saved");
43 $html_my_bookmarks .= db_error();
45 $html_my_bookmarks .= '<table style="width:100%">';
46 for ($i=0; $i<$rows; $i++) {
48 $class="bgcolor-white";
51 $class="bgcolor-grey";
55 $html_my_bookmarks .= '<TR class="'. $class .'"><TD>';
56 $html_my_bookmarks .= '<A HREF="'. db_result($result,$i,'bookmark_url') .'">'. db_result($result,$i,'bookmark_title') .'</A> ';
57 $html_my_bookmarks .= '<small><A HREF="/my/bookmark_edit.php?bookmark_id='. db_result($result,$i,'bookmark_id') .'">['._("Edit").']</A></SMALL></TD>';
58 $html_my_bookmarks .= '<td style="text-align:right"><A HREF="/my/bookmark_delete.php?bookmark_id='. db_result($result,$i,'bookmark_id');
59 $html_my_bookmarks .= '" onClick="return confirm(\''._("Delete this bookmark?").'\')">';
60 $html_my_bookmarks .= '<IMG SRC="'.$GLOBALS['HTML']->imgroot.'ic/trash.png" HEIGHT="16" WIDTH="16" BORDER="0" ALT="DELETE"></A></td></tr>';
62 $html_my_bookmarks .= '</table>';
64 $html_my_bookmarks .= '<div style="text-align:center; font-size:0.8em;"><a href="/my/bookmark_add.php">['. _("Add a bookmark") .']</a></div>';
65 return $html_my_bookmarks;
67 function getDescription() {
68 return _("List your favorite bookmarks (your favorite pages in Codendi or external).<br>Note that in many cases Codendi uses URL with enough embedded information to bookmark sophisticated items like Software Map browsing, typical search in your project Bug or Task database, etc . <br>Bookmarked items can be edited which means that both the title of the bookmark and its destination URL can be modified.");