[Rt-commit] r18012 - in rt/3.999/branches/merge_to_3.8.2: share/html/Ticket/Elements
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Jan 29 05:12:11 EST 2009
Author: sunnavy
Date: Thu Jan 29 05:12:08 2009
New Revision: 18012
Modified:
rt/3.999/branches/merge_to_3.8.2/ (props changed)
rt/3.999/branches/merge_to_3.8.2/share/html/Ticket/Elements/Bookmark
Log:
r19216 at sunnavys-mb: sunnavy | 2009-01-29 17:47:29 +0800
merged share/html/Ticket/Elements/Bookmark
Modified: rt/3.999/branches/merge_to_3.8.2/share/html/Ticket/Elements/Bookmark
==============================================================================
--- rt/3.999/branches/merge_to_3.8.2/share/html/Ticket/Elements/Bookmark (original)
+++ rt/3.999/branches/merge_to_3.8.2/share/html/Ticket/Elements/Bookmark Thu Jan 29 05:12:08 2009
@@ -50,17 +50,35 @@
$bookmarks = $bookmarks->content if $bookmarks;
$bookmarks ||= {};
+my $bookmarked = $bookmarks->{ $id }; # we still not sure if it's undef
+
+my @ids;
+if ( $Toggle || !$bookmarked ) {
+ my $ticket = RT::Model::Ticket->new;
+ $ticket->load( $id );
+ return unless $id = $ticket->id;
+
+ @ids = ($id, $ticket->merged);
+}
+
+
+
if ( $toggle ) {
- if ( $bookmarks->{ $id } ) {
- delete $bookmarks->{ $id };
+ if ( grep $bookmarks->{ $_ }, @ids ) {
+ delete $bookmarks->{ $_ } foreach @ids;
+ $bookmarked = 0;
} else {
$bookmarks->{ $id } = 1;
+ $bookmarked = 1;
}
Jifty->web->current_user->user_object->set_attribute(
Name => 'Bookmarks',
Content => $bookmarks,
);
+} elsif ( !$bookmarked ) {
+ $bookmarked = grep $bookmarks->{ $_ }, @ids;
}
+
</%INIT>
<%ARGS>
$id
@@ -68,8 +86,8 @@
</%ARGS>
<span id="toggle-<% $id %>">
% my $url = RT->config->get('WebPath') ."/Helpers/Toggle/TicketBookmark?id=". $id;
-<a align="right" href="<% $url %>" onClick="ahah('<% $url |n %>', 'toggle-<% $id |n %>'); return false;" >
-% if ( $bookmarks->{ $id } ) {
+<a align="right" href="<% $url %>" onclick="ahah('<% $url |n %>', 'toggle-<% $id |n %>'); return false;" >
+% if ( $bookmarked ) {
<img src="<% RT->config->get('WebPath') %>/NoAuth/images/star.gif" alt="<% _('Remove Bookmark') %>" style="border-style: none" />
% } else {
<img src="<% RT->config->get('WebPath') %>/NoAuth/images/empty_star.gif" alt="<% _('Add Bookmark') %>" style="border-style: none" />
More information about the Rt-commit
mailing list