Elive

 view release on metacpan or  search on metacpan

lib/Elive/Entity/Meeting.pm  view on Meta::CPAN

						   })
				 }
				);

    return $connection->_check_for_errors($som);
}
    
=head2 buildJNLP 

Builds a JNLP for the meeting.

    # ...
    use Elive;
    use Elive::Entity::Role;
    use Elive::Entity::Meeting;

    use CGI;
    my $cgi = CGI->new;

    #
    # authentication, calls to Elive->connect,  etc goes here...
    #
    my $meeting_id = $cgi->param('meeting_id');
    my $meeting = Elive::Entity::Meeting->retrieve($meeting_id);

    my $login_name = $cgi->param('user');

    my $jnlp = $meeting->buildJNLP(
                                   userName => $login_name,
                                   sessionRole => ${Elive::Entity::Role::PARTICIPANT},
                                  );
    #
    # join this user to the meeting
    #

    print $cgi->header(-type       => 'application/x-java-jnlp-file',
                       -attachment => 'my-meeting.jnlp');

    print $jnlp;

Alternatively, you can pass a user object or user-id via C<userId>

    my $user = Elive::Entity::User->get_by_loginName($login_name);

    my $jnlp = $meeting->buildJNLP(userId => $user);

Or you can just conjure up a display name and role. The user does
not have to exist as in the ELM database, or in the meeting's participant list:

    my $jnlp = $meeting->buildJNLP(
                       displayName => 'Joe Bloggs',
                       sessionRole => ${Elive::Entity::Role::PARTICIPANT}
                     );

Guests will by default be given a C<sessionRole> of participant (3).

JNLP is the 'Java Network Launch Protocol', also commonly known as Java
WebStart. To launch the meeting you can, for example, render this as a web
page, or send email attachments  with mime type C<application/x-java-jnlp-file>.

Under Windows, and other desktops, files are usually saved  with extension
C<.jnlp>.

See also L<http://wikipedia.org/wiki/JNLP>.

=cut

sub buildJNLP {
    my ($self, %opt) = @_;

    my $connection = $self->connection || $opt{connection}
	or die "not connected";

    my $meeting_id = $opt{meeting_id} ||= $self->meetingId;

    die "unable to determine meeting_id"
	unless $meeting_id;

    my %soap_params = (meetingId => $meeting_id);

    foreach my $param (qw(displayName sessionRole userName userId)) {
	my $val = delete $opt{$param};
	$soap_params{$param} = $val
	    if defined $val;
    }

    my $user = delete $opt{user};

    if ($user) {
	if (ref($user) || $user =~ m{^\d+$}x) {
	    $soap_params{userId} ||= $user;
	}
	else {
	    $soap_params{userName} ||= $user;
	}
    }

    $soap_params{userId} ||= $connection->login
	unless $soap_params{userName} || $soap_params{displayName};

    my %params_frozen = %{$self->_freeze(\%soap_params)};
    my $som = $connection->call('buildMeetingJNLP' => %params_frozen);

    my $results = $self->_get_results($som, $connection);

    return @$results && $results->[0];
}

=head2 web_url

Utility method to return various website links for the meeting. This is
available as both class level and object level methods.

    #
    # Class level access.
    #
    my $url = Elive::Entity::Meeting->web_url(
                     meeting_id => $meeting_id,
                     action => 'join',    # join|edit|...
                     connection => $my_connection);  # optional



( run in 0.561 second using v1.01-cache-2.11-cpan-df04353d9ac )