installers (calendaring), RT#16584
authorIvan Kohler <ivan@freeside.biz>
Sat, 12 Apr 2014 19:29:18 +0000 (12:29 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sat, 12 Apr 2014 19:29:18 +0000 (12:29 -0700)
htetc/freeside-rt.conf
rt/share/html/Elements/CalendarDaySchedule
rt/share/html/NoAuth/css/calendar.css
rt/share/html/Schedule/UserBar [new file with mode: 0644]
rt/share/html/Search/Calendar.html
rt/share/html/Search/Schedule.html

index 71ebfbd..bcc5de3 100644 (file)
@@ -84,3 +84,9 @@ PerlHandler HTML::Mason
     PerlHandler HTML::Mason
   </FilesMatch>
 </DirectoryMatch>
+
+<Directory %%%FREESIDE_DOCUMENT_ROOT%%%/rt/Schedule> 
+SetHandler perl-script 
+PerlHandler HTML::Mason 
+</Directory>
+
index 08e1a51..0f9f909 100644 (file)
@@ -5,8 +5,28 @@ $DateTypes => undef
 @username  => ()
 </%args>
 % foreach my $username ( @username ) {
-<span class="calendarright"><% $username %>---sparkline--*</span><br>
+%   my $mapname = "$username-$date";
+<span class="calendarright"><% $username %><img src="<%$RT::WebPath%>/Schedule/UserBar?Username=<%$username%>;Date=<%$date%>" useMap="#<%$mapname%>"><span><br>
+<MAP name="<%$mapname%>">
+%# false laziness w/Schedule/UserBar
+%#XXX block out unavailable times
+%#alas.  abstractions break, freeside-specific stuff to get availability
+%# move availability to RT side?  make it all callback/pluggable?
+%
+%#XXX block out / show / color code existing appointments
+%
+<AREA onmouseover="overlib('XX miles away<BR>more info')"
+      onmouseout="nd(); return true;"
+      shape = "rect"
+      coords="0,0,59,11"
+      href="test_href"
+%#    alt=
+%#    title=
+>
+</MAP>
 % }
 <%init>
 
+my( $date, $time ) = split('T', $Date);
+
 </%init>
index 14cbabc..96241e7 100644 (file)
@@ -37,6 +37,7 @@ color:#505050;
 }
 
 .calendarright {
+  text-align: right;
   float: right;
 }
 
diff --git a/rt/share/html/Schedule/UserBar b/rt/share/html/Schedule/UserBar
new file mode 100644 (file)
index 0000000..5e834a0
--- /dev/null
@@ -0,0 +1,39 @@
+<%perl>
+
+use GD;
+
+my $im = new GD::Image($width, $height) or die;
+
+my $white = $im->colorAllocate(255,255,255);
+my $black = $im->colorAllocate(0,0,0); 
+
+# Put a black frame around the picture
+$im->rectangle(0,0,$width-1,$height-1,$black);
+
+#XXX block out unavailable times
+#alas.  abstractions break, freeside-specific stuff to get availability
+# move availability to RT side?  make it all callback/pluggable?
+
+#XXX block out / show / color code existing appointments
+
+$r->content_type('image/png');
+$m->clear_buffer;
+$m->out($im->png);
+$m->abort;
+
+</%perl>
+<%args>
+$Username => undef
+$Date     => undef
+</%args>
+<%once>
+
+my $stime    = RT->Config->Get('CalendarWeeklyStartMin');
+$stime = 480 unless $stime =~ /^\d+$/; #8am
+my $etime    = RT->Config->Get('CalendarWeeklyEndMin');
+$etime = 1080 unless $etime =~ /^\d+$/; #6pm
+
+my $width = ( $etime - $stime ) / 10;
+my $height = 12;
+
+</%once>
index e6282b5..c425751 100644 (file)
@@ -82,7 +82,7 @@ $DayDisplay => undef
 <tr>
 <td class="labels" colspan=<% $WeekDay ? 2 : 1 %>></td>
 % for ( @{$week{$weekstart}} ) {
-<th width="14%" colspan=<% $WeekDay ? $slots : 1 %>><%$rtdate->GetWeekday($_)%></th>
+<th colspan=<% $WeekDay ? $slots : 1 %>><%$rtdate->GetWeekday($_)%></th>
 % }
 </tr>
 </thead>
index 12d2685..bbbfffd 100644 (file)
@@ -1,5 +1,10 @@
 <& /Elements/Header, Title => 'Schedule' &>
 
+%#init_overlib.html
+%foreach my $file (@files) {
+<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/<%$file%>.js"></SCRIPT>
+%}
+
 <& /Search/Calendar.html,
      @_,
      Embed          => 'Schedule.html',
@@ -7,3 +12,10 @@
      DayDisplayArgs => [ username => $ARGS{username} ],
 &>
 
+<%init>
+my @files = ();
+#if ( ! $initialized ) {
+  push @files, map "overlibmws$_", ( '', qw( _iframe _draggable _crossframe ) );
+  push @files, map { "${_}contentmws" } qw( iframe ajax );
+#%}
+</%init>