Apache-App-Mercury

 view release on metacpan or  search on metacpan

Mercury/Base.pm  view on Meta::CPAN

      if ref $self->{r} and $self->{r}->can("warn") and DEBUG;
}

sub log_error {
    my $self = shift;
    my $errmsg = $_[0] ? $_[0] : ": ".$@;
    $self->{r}->log_error((ref($self)||$self).$errmsg)
      if ref $self->{r} and $self->{r}->can("log_error");
}

sub uri_escape_noamp {
    return uri_escape($_[1], '^;/?:@=+\$,A-Za-z0-9\-_.!~*\'()');
}

sub get_date {
    my @date = localtime($_[1] ? $_[1] : time);
#    my $midnighttime = mktime(0, 0, 0, @date[3, 4, 5], 0, 0, 0);
    $date[5] += 1900;	# this *IS* y2k compliant. in 2008, ymd[5] will be 108
    $date[4]++;		# convert month from 0-11 to 1-12
    $date[4] = "0".$date[4] if length($date[4]) < 2; # make month two digits
    $date[3] = "0".$date[3] if length($date[3]) < 2; # make day two digits
    return @date[5,4,3];

Mercury/Display.pm  view on Meta::CPAN

		   $q->font({-size => '-1'}, "Unread") ]),
	  (map {
	      my $bgcol = $color;
	      $color = ($color eq '#ffffff' ? '#ffccff' : '#ffffff');
	      my ($tot_unread, $box_unread) = $self->count_unread(undef, $_);
	      ($q->td({-bgcolor => $bgcol, -nowrap},
		      $q->font({-size => '-1'},
			       ($_ eq $self->{'current_box'}
				? $q->strong('* '.$labels->{$_}.' *')
				: $q->a({-href => BASE_URI."?mailbox=".
					 $self->uri_escape_noamp($_)},
					$labels->{$_})))) .
	       $q->td({-bgcolor => $bgcol, -align => 'right'},
		      $q->font({-size => '-1'}, $#{$self->{$_}->{'index'}}+1)).
	       $q->td({-bgcolor => $bgcol, -align => 'right'},
		      $q->font({-size => '-1'},
			       ($box_unread > 0
				? $q->strong($q->span({-class => 'msgunread'},
						      $box_unread))
				: ($_ ne 'outbox' ? '0' : '-')))))
	  } @{$self->{'mailboxes'}})

Mercury/Message.pm  view on Meta::CPAN

    my @attach_html;
    if (ref $self->{'Attachments'} eq "ARRAY") {
	foreach (0..$#{$self->{'Attachments'}}) {
	    my $a = $self->{'Attachments'}->[$_];
	    next unless
	      $a->{'Filename'} and $a->{'Name'} and $a->{'AttachmentID'};
	    push(@attach_html,
		 ($q->td({-align => 'right', -nowrap},
			 $q->b("Attachment ".($_+1).":")) .
		  $q->td({-nowrap},
			 $q->a({-href => $self->uri_escape_noamp
				(Apache::App::Mercury::Config::ATTACHMENT_BASE_URI() .
				 $a->{'Filename'}),
				-class => 'attach',
				-target => 'theAttachmentWindow'},
			       $a->{'Name'}))));
	}
    }

    my $markedup_body = $self->pretty_print($self->{'body'});

Mercury/Message.pm  view on Meta::CPAN


    # generate attachment HTML
    my @attach_html;
    if (ref $self->{'Attachments'} eq "ARRAY") {
	foreach (0..$#{$self->{'Attachments'}}) {
	    my $a = $self->{'Attachments'}->[$_];
	    next unless
	      $a->{'Filename'} and $a->{'Name'} and $a->{'AttachmentID'};
	    push(@attach_html,
		 ($q->b("Attachment ".($_+1).": ") .
		  $q->a({-href => $self->uri_escape_noamp
			 (Apache::App::Mercury::Config::ATTACHMENT_BASE_URI() .
			  $a->{'Filename'}),
			 -class => 'attach',
			 -target => 'theAttachmentWindow'},
			$a->{'Name'}) .
		  " (".$q->a({-href => Apache::App::Mercury::Config::BASE_URI()."?remove_attach=".$_},
			     "remove").")"
		 ));
	}
    }



( run in 0.389 second using v1.01-cache-2.11-cpan-c21f80fb71c )