[Bio] / WebApplication / WebComponent / RollerBlind.pm Repository:
ViewVC logotype

View of /WebApplication/WebComponent/RollerBlind.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Thu Oct 1 09:26:38 2009 UTC (10 years, 3 months ago) by paczian
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_03052011, mobedac_release_05302012, mgrast_dev_05262011, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, mgrast_dev_10262011, HEAD
Changes since 1.4: +5 -1 lines
setting width to false will set the width to nothing

package WebComponent::RollerBlind;

# RollerBlind - component to create roller blinds

use strict;
use warnings;

use base qw( WebComponent );

1;

=pod

=head1 NAME

RollerBlind - component to create roller blinds

=head1 DESCRIPTION

creates roller blinds with information fields

=head1 METHODS

=over 4


=item * B<new> ()

Called when the object is initialized. Expands SUPER::new.

=cut

sub new {

  my $self = shift->SUPER::new(@_);

  $self->{blinds} = [];
  $self->{width} = 765;
  $self->{footer} = "";

  return $self;
}

=item * B<output> ()

Returns the html output of the BarChart component.

=cut

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

  my $width = "";
  if ($self->width) {
    $width = " style='width: " . $self->width . "px;'"
  }
  my $blinds = "<div$width class='RollerBlindMain'>";
  my $i = 0;
  foreach my $blind (@{$self->blinds}) {
    my $active = "Inactive";
    if ($blind->{active}) {
      $active = "Active";
    }
    $blinds .= "<div class='RollerBlindBar$active' name=rb_div_" . $self->id . "_$i onclick='activate_blind(\"" . $self->id . "\", \"$i\");' id='rb_div_" . $self->id . "_$i'><table width=100%><tr><td class='RollerBlindTitle'>" . $blind->{title} . "</td><td style='text-align: right;' class='RollerBlindInfo'>" . $blind->{info} . "</td></tr></table></div>";
    $blinds .= "<div class='RollerBlind" . $active . "' id='rb_" . $self->id . "_$i'>" . $blind->{content} . "</div>";
    $i++;
  }
  
  if ($self->footer) {
    $blinds .= "<div class='RollerBlindFooter'>" . $self->{footer} . "</div>";
  }

  $blinds .= "</div>";
  
  return $blinds;
}

sub width {
  my ($self, $width) = @_;

  if (defined($width)) {
    $self->{width} = $width;
  }

  return $self->{width};
}

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

  return $self->{blinds};
}

sub add_blind {
  my ($self, $blind) = @_;

  unless (defined($blind) && ref($blind) eq "HASH" && defined($blind->{title}) && defined($blind->{content})) {
    return undef;
  }

  unless (defined($blind->{info})) {
    $blind->{info} = "";
  }

  push(@{$self->blinds}, $blind);

  return $blind;
}

sub footer {
  my ($self, $footer) = @_;

  if (defined($footer)) {
    $self->{footer} = $footer;
  }

  return $self->{footer};
}

sub require_javascript {
  return ["$FIG_Config::cgi_url/Html/RollerBlind.js"];
}

sub require_css {
  return "$FIG_Config::cgi_url/Html/RollerBlind.css";
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3