Apache-App-Mercury

 view release on metacpan or  search on metacpan

Mercury/Controller.pm  view on Meta::CPAN


    return $r->status;
}

sub process_msg {
    my ($self) = @_;
    my $q = $self->{q};

    return
      ($q->div({-align => 'center'},
	       $q->font({-color => '#ff0000'}, $q->b($self->{msg}))) .
       $q->br . $q->hr({-size => 1, -width => '80%', -align => 'center'}) .
       $q->br
      );
}


1;

__END__

Mercury/Display.pm  view on Meta::CPAN

    $labels = { map { $_ => ucfirst($_) } @{$self->{'mailboxes'}} }
        if !$labels or ref $labels ne 'HASH';

    my $color = '#ffffff';

    return
      ($q->table
       ({-cellspacing => 1, -border => 2},
	$q->Tr
	([$q->th({-align => 'left', -bgcolor => '#cc6699'},
		 [ $q->font({-size => '-1'}, "Mailbox"),
		   $q->font({-size => '-1'}, "Msgs"),
		   $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/Display.pm  view on Meta::CPAN


    my $msg_in_progress =
      ref $self->{compose_msg} eq "Apache::App::Mercury::Message";

    return
      ($q->table
       ({-cellspacing => 0, -cellpadding => 0,
	 -border => 0, -bgcolor => '#cccccc'},
	$q->Tr
	([$q->td({-align => 'right'},
		 $q->font({-size => '-1'},
			  $q->a({-href => BASE_URI.'?edit_mail_prefs=1'},
				"Edit mail settings"))),
	  $q->td({-align => 'right'},
		 $q->hr({-width => '50%', -align => 'right', -size => 1})),
	  $q->td({-align => 'right'},
		 $q->font({-size => '-1'},
			  $q->submit('check_mail', "Check mail"))),
	  $q->td({-align => 'right'},
		 $q->font({-size => '-1'},
			  $q->em("Mail last checked at:".$q->br.
				 $q->u($last_time)))),
	  $q->td({-align => 'right'},
		 $q->hr({-width => '50%', -align => 'right', -size => 1})),
	  $q->td({-align => 'right'},
		 $q->font({-size => '-1'},
			  $q->submit('compose', ($msg_in_progress
						 ? "Return to msg compose"
						 : "Compose new message")))),
	  $q->td({-align => 'right'},
		 $q->hr({-width => '50%', -align => 'right', -size => 1})),
	  ($#{$self->{$box}->{'index'}} < 0
	   ? ($q->td({-align => 'right'},
		     $q->font({-size => '-1'},
			      $q->em("There are no messages in this mailbox."))))
	   : ($box ne 'outbox'
	      ? ($q->td({-align => 'right'},
			$q->font({-size => '-1'},
				 (@transfer_boxes
				  ? ($q->submit('transfer',
						"Transfer selected messages") .
				     $q->br. "to Mailbox: ".
				     $q->popup_menu(-name => 'to_mailbox',
						    -values => \@transfer_boxes,
						    -labels => $labels))
				  : ($q->em("You can ".
					    $q->a({-href => BASE_URI.'?edit_mail_prefs=1'},
						  "create custom mailboxes")."."))))),
		 $q->td({-align => 'right'},
			$q->hr({-width => '50%',-align =>'right',-size => 1})))
	      : () )),
	  $q->td({-align => 'right'},
		 $q->font({-size => '-1'},
			  $q->submit('delete',"Delete selected messages")))
	 ])
       )
      );
}

sub display_msglist {
    my ($self) = @_;
    my $q = $self->{q};

Mercury/Display.pm  view on Meta::CPAN


    return
      ($q->table
       ({-width => '96%', -align => 'center'},
	$q->Tr
	([$q->th({-align => 'left', -bgcolor => '#8080ff'},
		 ['&nbsp;',
		  $q->a({-href => BASE_URI."?".$box."_sortby=subject__".
			 ($sortby eq 'subject' && $sortdir eq 'up' ?'down':'up'),
			 -class => 'msgsort'}, 'Subject') .
		  $q->font({-size => '-1'},
			   $q->span({-class => 'msgsort'}, " (click to view)")).
		  ($sortby eq 'subject' ? $arrow : ''),
		  ($box ne 'outbox'
		   ? ($q->a({-href => BASE_URI."?".$box."_sortby=sender__".
			     ($sortby eq 'sender' && $sortdir eq 'up'
			      ? 'down' : 'up'),
			     -class => 'msgsort'}, 'Sender') .
		      ($sortby eq 'sender' ? $arrow :''))
		   : ($q->a({-href => BASE_URI."?".$box."_sortby=recipient__".
			     ($sortby eq 'recipient' && $sortdir eq 'up'

Mercury/Display.pm  view on Meta::CPAN

		  $q->a({-href => BASE_URI."?".$box."_sortby=time__".
			 ($sortby eq 'time' && $sortdir eq 'up' ? 'down':'up'),
			 -class => 'msgsort'}, 'Date') .
		  ($sortby eq 'time' ? $arrow : '') ]),
	  (map {
	      my $id = $msglist->[$_];
	      my $bgcol = $color;
	      $color = ($color eq '#ffffff' ? '#c8e0ff' : '#ffffff');
	      ($q->td
	       ({-align => 'left', -bgcolor => $bgcol},
		[ $q->font
		  ({-size => '-1'},
		   $q->checkbox(-name =>'select_msgs',
				-value => $id,
				-label => '')),
		  ($msgs->{$id}->{'sent_to'} ne $msgs->{$id}->{'sender'}
		   ?
		   ($box ne 'outbox' && $msgs->{$id}->{'status'} eq 'unread'
		    ?($q->font
		      ({-size => '-1'},
		       $q->strong
		       ($q->span({-class => 'msgunread'},
				 $q->a({-href => BASE_URI.'?read='.$_},
				       $msgs->{$id}->{'subject'})) )),
		      $q->font({-size => '-1'},
			       $q->strong($q->span({-class => 'msgunread'},
						   $msgs->{$id}->{'sender'}))),
		      $q->font({-size => '-1'},
			       $q->strong( $q->span({-class => 'msgunread'},
						    $msgs->{$id}->{'time_formatted'}))))
		     : ($q->font({-size => '-1'},
				 $q->a({-href => BASE_URI.'?read='.$_},
				       $msgs->{$id}->{'subject'})),
			$q->font({-size=>'-1'},
				 ($box ne 'outbox'
				  ? $msgs->{$id}->{'sender'}
				  : ($msgs->{$id}->{'recipient'} eq
				     $msgs->{$id}->{'sent_to'}
				     ? $msgs->{$id}->{'recipient'}
				     : $msgs->{$id}->{'recipient'}."..."))),
			$q->font({-size=>'-1'}, $msgs->{$id}->{'time_formatted'})) )
		   : ($q->em
		      ($q->font({-size => '-1', -color => '#666633'}, 
				$q->a({-href => BASE_URI.'?read='.$_},
				      $msgs->{$id}->{'subject'})) ),
		      $q->em( $q->font({-size => '-1', -color => '#666633'}, 
				       "Memo") ),
		      $q->em( $q->font({-size => '-1', -color => '#666633'}, 
				       $msgs->{$id}->{'time_formatted'}))))
		]));
	  } 0..$#$msglist)
	 ])
       )
      );
}

sub display_message_with_header {
    my ($self, $msg, $box) = @_;

Mercury/Display.pm  view on Meta::CPAN

    my $msg_in_progress =
      ref $self->{compose_msg} eq "Apache::App::Mercury::Message";

    return
      ($q->startform(-action => BASE_URI) .
       $q->hidden(-name => 'msg_id', -default => $msg->{'id'}, -override=>1) .
       $q->table
       ({-bgcolor => '#cccccc', -cellspacing => 0},
	$q->Tr
	([$q->td({-align => 'center'},
		 $q->font({-size => '-1'},
			  $q->submit('message_center',
				     "Return to '".ucfirst($box)."'") .
			  $q->hr({-size => 1}))),
	  $q->td({-align => 'center'},
		 $q->font({-size => '-1'},
			  ($self->{'cur_index'} > 0
			   ? $q->submit('read_prev', "Previous Msg")
			   : $q->em('at first message in box')) .
			  ($self->{'cur_index'} <= 0 ||
			   $self->{'cur_index'} >= $#{$self->{$box}->{'index'}}
			   ? $q->br : " ") .
			  ($self->{'cur_index'} < $#{$self->{$box}->{'index'}}
			   ? $q->submit('read_next', "Next Msg")
			   : $q->em('at last message in box')) .
			  $q->hr({-size => 1}))),
	  $q->td({-align => 'center'},
		 $q->font({-size => '-1'},
			  $q->submit('print', "Format for Printing") .
			  $q->hr({-size => 1}))),
	  $q->td({-align => 'center'},
		 $q->font({-size => '-1'},
			  $q->submit('compose', ($msg_in_progress
						 ? "Return to msg compose"
						 : "Compose new message")))),
	  $q->td({-align => 'center'},
		 $q->font({-size => '-1'},
			  ($box ne 'outbox'
			   ? ((!$is_memo ? $q->submit('reply', "Reply") : '') .
			      $q->submit('forward', "Forward"))
			   : $q->submit('re-send', "Re-send")) .
			  $q->hr({-size => 1}))),
	  (@transfer_boxes
	   ? ($q->td({-align => 'center'},
		     $q->font({-size => '-1'},
			      $q->submit('transfer',
					 "Transfer Msg to: ") . $q->br .
			      $q->popup_menu(-name => 'to_mailbox',
					     -values => \@transfer_boxes,
					     -labels => $labels) .
			      $q->hr({-size => 1}))))
	   : () ),
	  $q->td({-align => 'center'},
		 $q->font({-size => '-1'},
			  $q->submit('delete',
				     $is_memo ? "Delete Memo" : "Delete Msg")))
	 ])
       )
      );
}

sub display_compose_with_header {
    my ($self) = @_;
    my $q = $self->{q};

Mercury/Display.pm  view on Meta::CPAN

		   : $q->em('None'))),
	   $q->td({-valign => 'top', -width => '50%'},
		  ($#custom_mboxes < 14
		   ? ($q->submit('add_box', "Add box: ") .
		      $q->textfield(-name => 'new_box',
				    -size => 16, -maxlength => 16))
		   : $q->em("You have 15 custom mailboxes, which is the maximum currently allowed."))) .
	   $q->td({-align => 'right', -valign => 'top', -width => '50%'},
		  ($#custom_mboxes >= 0
		   ? ($q->submit('delete_box', "Delete selected box").$q->br .
		      $q->font({-size => '-1'}, " (" .
			       $q->checkbox(-name => 'delete_mail_in_box',
					    -value => 1,
					    -label => '') .
			       " Check to delete all mail in that box, otherwise mail will be transfered to your Inbox.)"))
		   : '&nbsp;')),

	   $q->th({-colspan => 2, -align => 'left', -bgcolor => '#cccccc'},
		  "Edit filters"),
	   $q->td({-width => '50%', -align => 'right'},
		  "Send transaction related messages to: ") .

Mercury/Message.pm  view on Meta::CPAN

		 " (".$self->{'sender_info'}->{'fname'}." ".
		 $self->{'sender_info'}->{'lname'}.")"),
	  (!$is_memo
	   ? ($q->td({-align => 'right', -valign => 'top', -nowrap},
		     $q->b("To:")) . $q->td($recip_desc))
	   : ()),
	  @attach_html,
	  ($self->{'action'}
	   ? ()
	   : ($q->td({-align => 'right', -nowrap}, $q->b("Security level:")) .
	      $q->td({-nowrap}, $q->font({-face => 'fixed'},
					 uc $self->{'security'}))))
	 ])
       ) .
       $q->hr({-width => '200', -align => 'left', -size => '1'}) .
       $q->pre($markedup_body)
      );
}

sub display_compose {
    my ($self) = @_;

Mercury/Message.pm  view on Meta::CPAN

       join($q->br, @attach_html) .
       $q->br .
       $q->b("Attach ") .
       $q->textfield(-name => 'num_files_to_attach', -override => 1,
		     -default => ($self->{'num_to_attach'}
				  ? $self->{'num_to_attach'} : 0),
		     -size => 2, -maxlength => 2) .
       $q->b(" file(s)") . $q->br .
       $q->b("Security level of this message: ") .
       ($self->{'security_fixed'} && $self->{'security'}
	? $q->font({-face => 'fixed'}, uc($self->{'security'}))
	: $q->popup_menu(-name => 'security', -override => 1,
			 -values => ['low', 'medium', 'high'],
			 -default => ($self->{'security'}
				      ? $self->{'security'} : 'medium'),
			 -labels => { 'low' => "Low", 'medium' => "Medium",
				      'high' => "High" },
			)) .
       $q->br
      );
}

Mercury/Message.pm  view on Meta::CPAN

				      $q->b("Select new attachments:") .$q->p.
				      join('', map {
					  ("$_: " . $q->filefield(-name => 'attachment'.($_-1)) . $q->br)
				      } 1..$self->{'num_to_attach'}))
			     : $q->td({-bgcolor=>'#ffffff', -valign=>'bottom'},
				      '&nbsp;')),
			    $q->td({-bgcolor => '#cccccc'},
				   $q->b("Security level: ") .
				   ($self->{'security_fixed'} &&
				    $self->{'security'}
				    ? $q->font({-face => 'fixed'},
					       uc($self->{'security'}))
				    : $q->popup_menu
				    (-name => 'security', -override => 1,
				     -values => ['low', 'medium', 'high'],
				     -default => ($self->{'security'}
						  ? $self->{'security'}
						  : 'medium'),
				     -labels => { 'low' => "Low",
						  'medium' => "Medium",
						  'high' => "High" }))),

Mercury/Message.pm  view on Meta::CPAN

					      : "Commit memo"))),
		   $q->td({-align => 'right'},
			  $q->submit('make_changes', "Make changes")),
		   $q->td({-align => 'right'}, $q->submit('cancel', "Cancel")),
		   $q->td('&nbsp;' . $q->br . '&nbsp;'),
		   $q->td({-align => 'right', -valign => 'bottom'},
			  $q->submit('return', "Store and return to '".
				     ucfirst($messaging->{'current_box'})."'").
			  ($self->{'num_to_attach'}
			   ? ($q->br .
			      $q->font({-size => '-2'},
				       $q->em("Selected attached files will " .
					      $q->b('NOT') .
					      " be remembered when stored")))
			   : ''))
		  ]))))) .
       $q->endform
      );
}




( run in 1.929 second using v1.01-cache-2.11-cpan-97f6503c9c8 )