package WebGUI::Asset::Wobject::Carousel; $VERSION = "1.0.0"; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2008 Plain Black Corporation. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use strict; use JSON; use Tie::IxHash; use WebGUI::International; use WebGUI::Utility; use base 'WebGUI::Asset::Wobject'; #------------------------------------------------------------------- =head2 definition ( ) defines wobject properties for New Wobject instances. You absolutely need this method in your new Wobjects. If you choose to "autoGenerateForms", the getEditForm method is unnecessary/redundant/useless. =cut sub definition { my $class = shift; my $session = shift; my $definition = shift; my $i18n = WebGUI::International->new($session, 'Asset_Carousel'); my %properties; tie %properties, 'Tie::IxHash'; %properties = ( templateId =>{ fieldType =>"template", defaultValue =>'CarouselTmpl0000000001', tab =>"display", noFormPost =>0, namespace =>"Carousel", hoverHelp =>$i18n->get('carousel template description'), label =>$i18n->get('carousel template label'), }, slideWidth =>{ fieldType => "integer", defaultValue => 0, tab => "display", hoverHelp => $i18n->get('carousel slideWidth description'), label => $i18n->get('carousel slideWidth label'), }, slideHeight =>{ fieldType => "integer", defaultValue => 0, tab => "display", hoverHelp => $i18n->get('carousel slideHeight description'), label => $i18n->get('carousel slideHeight label'), }, richEditor =>{ fieldType => "selectRichEditor", defaultValue => "PBrichedit000000000001", tab => 'display', label => $i18n->get('rich editor', 'Asset_Collaboration'), hoverHelp => $i18n->get('rich editor description'), }, items =>{ noFormPost =>1, fieldType =>'text', autoGenerate =>0, }, autoPlay => { fieldType => 'yesNo', defaultValue => 0, tab => "properties", hoverHelp => $i18n->get('carousel autoPlay description'), label => $i18n->get('carousel autoPlay label'), }, autoPlayInterval => { fieldType => 'Integer', defaultValue => 4, tab => 'properties', hoverHelp => $i18n->get('carousel autoPlayInterval description'), label => $i18n->get('carousel autoPlayInterval label'), }, ); push(@{$definition}, { assetName=>$i18n->get('assetName'), icon=>'Carousel.png', autoGenerateForms=>1, tableName=>'Carousel', className=>'WebGUI::Asset::Wobject::Carousel', properties=>\%properties }); return $class->SUPER::definition($session, $definition); } #------------------------------------------------------------------- =head2 duplicate ( ) duplicates a New Wobject. This method is unnecessary, but if you have auxiliary, ancillary, or "collateral" data or files related to your wobject instances, you will need to duplicate them here. =cut sub duplicate { my $self = shift; my $newAsset = $self->SUPER::duplicate(@_); return $newAsset; } #------------------------------------------------------------------- =head2 getEditForm ( ) returns the tabform object that will be used in generating the edit page for New Wobjects. This method is optional if you set autoGenerateForms=1 in the definition. =cut sub getEditForm { my $self = shift; my $tabform = $self->SUPER::getEditForm(); my $i18n = WebGUI::International->new($self->session, "Asset_Carousel"); $self->session->style->setScript($self->session->url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'), {type => 'text/javascript'}); $self->session->style->setScript($self->session->url->extras('yui/build/element/element-min.js'), {type => 'text/javascript'}); $self->session->style->setScript($self->session->url->extras('yui/build/tabview/tabview-min.js'), {type => 'text/javascript'}); $self->session->style->setScript($self->session->url->extras('yui/build/editor/editor-min.js'), {type => 'text/javascript'}); $self->session->style->setScript($self->session->url->extras('yui/build/json/json-min.js'), {type => 'text/javascript'}); $self->session->style->setLink($self->session->url->extras('yui/build/editor/assets/skins/sam/editor.css'), {type =>'text/css', rel=>'stylesheet'}); $self->session->style->setLink($self->session->url->extras('yui/build/tabview/assets/skins/sam/tabview.css'), {type =>'text/css', rel=>'stylesheet'}); $self->session->style->setScript($self->session->url->extras('wobject/Carousel/carousel.js'), {type => 'text/javascript'}); my $tableRowStart = '