add RTx::Calendar 0.07
[freeside.git] / rt / share / html / Prefs / Calendar.html
1 <%args>
2 $ChangeURL   => undef
3 $ResetURL    => undef
4 $SearchType  => 'Ticket'
5 $HiddenField => undef
6 </%args>
7
8 <& /Elements/Header, Title => $title &>
9 <& /User/Elements/Tabs,
10     current_tab => 'Prefs/Calendar.html',
11     Title => $title
12 &>
13
14 <&| /Widgets/TitleBox, title => loc('ICal Feeds (ics)') &>
15
16 <&| /Widgets/TitleBox, title => 'Help' &>
17
18 <h3>displaying reminders :</h3>
19 <p>If you want to have reminders in a search you need to go in the <a
20 href="<%$RT::WebPath%>/Search/Edit.html"><%loc("Edit Query")%></a> tab
21 of the <%loc("query builder")%> and add something like that :
22
23  <pre>
24    AND ( Type = 'ticket' OR Type = 'reminder' )
25 </pre>
26 </p>
27
28 <h3>displaying other kind of dates :</h3>
29 <p>By default RTx::Calendar display Due and Starts dates. You can
30 select other kind of events you want with the <%loc("Display
31 Columns")%> section in the <a
32 href="<%$RT::WebPath%>/Search/Build.html"><%loc("Query
33 Builder")%></a>. The following one will display the two latter and
34 LastUpdated dates :
35
36 <pre>
37   '&lt;small&gt;__Due__&lt;/small&gt;',
38   '&lt;small&gt;__Starts__&lt;/small&gt;',
39   '&lt;small&gt;__LastUpdated__&lt;/small&gt;'
40 </pre>
41 </p>
42
43 <h3>changing the default query :</h3>
44 <p>You can change the default Query of Calendar.html and MyCalendar
45 portlet by saving a query with the name <code>calendar</code> in the
46 <a href="<%$RT::WebPath%>/Search/Build.html"><%loc("Query
47 Builder")%></a>.</p>
48
49 </&>
50
51 <& /Prefs/Elements/CalendarFeed &>
52
53 % # only allow this part if 
54 % if ($AllowSearch) {
55
56 % my $search_count;
57
58 %   # I'm quite sure the loop isn't usefull but...
59 %   my @Objects = $session{CurrentUser}->UserObj;
60 %   for my $object (@Objects) {
61 %     next unless ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id;
62 %     my @searches = $object->Attributes->Named('SavedSearch');
63 %     for my $search (@searches) {
64 %       next if ($search->SubValue('SearchType')
65 %              && $search->SubValue('SearchType') ne $SearchType);
66 %       $search_count++;
67 <& /Prefs/Elements/CalendarFeed, Object => $object, Search => $search &>
68
69 %     }
70 %   }
71 %   unless ($search_count) {
72
73 <&| /Widgets/TitleBox, title => loc('Private Search ICal feeds')
74                      , title_class=> 'inverse'
75                      , color => "#993333" &>
76
77 You can add private ICal feeds by saving new queries in <a
78 href="<%$RT::WebPath . '/Search/Build.html'%>">the Query Builder</a>
79
80 </&>
81
82 %   }
83 % } else {
84 %#<&| /Widgets/TitleBox, title => loc('Private Search ICal feeds')
85 %#                     , title_class=> 'inverse'
86 %#                     , color => "#993333" &>
87 %#
88 %#<%loc('Private search ICal feeds disabled. To enable them, ask your admin for "[_1]" and "[_2]" rights',
89 %#       loc('CreateSavedSearch'),
90 %#       loc('LoadSavedSearch') )%>
91 %#
92 %#</&>
93 % }
94
95 </&>
96
97 <%INIT>
98 use Digest::SHA1;
99 use RT::SavedSearches;
100
101 my $title = loc("Calendar Prefs");
102 my $AllowSearch;
103
104 $AllowSearch = 1
105  if $session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch',
106                                        Object=> $RT::System );
107
108 my $object;
109
110 if ($HiddenField eq 'Private') {
111    $object = $session{CurrentUser}->UserObj;
112 } elsif ($AllowSearch and my ($SearchId) = $HiddenField =~ m/SavedSearch\-(\d+)/) {
113     $object = $session{CurrentUser}->Attributes->WithId($SearchId);
114 }
115
116 if (defined $ChangeURL) {
117   my @args = $object->SetAttribute(Name => 'ICalURL', Content => Digest::SHA1::sha1_base64(time));
118 } elsif (defined $ResetURL) {
119   my @args = $object->DeleteAttribute('ICalURL');
120 }
121
122
123 </%INIT>