Carousel bugfix, templates and i18n

This commit is contained in:
Yung Han Khoe 2009-04-05 15:48:16 +00:00
parent 964d8cf9e2
commit 5e10530e31
4 changed files with 31 additions and 15 deletions

View file

@ -1,5 +1,6 @@
7.7.3 7.7.3
- fixed #10094: double explanation in thread help - fixed #10094: double explanation in thread help
- rfe #9612: Carousel Wobject (was Widget Wobject) (SDH Consulting Group)
7.7.2 7.7.2
- fixed #10056: YUI javascripts included while adminOff (BNC) - fixed #10056: YUI javascripts included while adminOff (BNC)

View file

@ -40,7 +40,7 @@ sub definition {
%properties = ( %properties = (
templateId =>{ templateId =>{
fieldType =>"template", fieldType =>"template",
defaultValue =>'CarouselTmpl0000000001', defaultValue =>'CarouselTmpl0000000002',
tab =>"display", tab =>"display",
noFormPost =>0, noFormPost =>0,
namespace =>"Carousel", namespace =>"Carousel",
@ -91,8 +91,9 @@ This method is optional if you set autoGenerateForms=1 in the definition.
=cut =cut
sub getEditForm { sub getEditForm {
my $self = shift; my $self = shift;
my $tabform = $self->SUPER::getEditForm(); my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session, "Asset_Carousel");
$self->session->style->setScript($self->session->url->extras('yui/build/editor/editor-min.js'), {type => $self->session->style->setScript($self->session->url->extras('yui/build/editor/editor-min.js'), {type =>
'text/javascript'}); 'text/javascript'});
@ -101,12 +102,12 @@ sub getEditForm {
$self->session->style->setScript($self->session->url->extras('wobject/Carousel/carousel.js'), {type => $self->session->style->setScript($self->session->url->extras('wobject/Carousel/carousel.js'), {type =>
'text/javascript'}); 'text/javascript'});
my $tableRowStart = qq| my $tableRowStart =
<tr id="items_row"> '<tr id="items_row">'
<td class="formDescription" valign="top" style="width: 180px;"><label for="item1">Items</label></td> .' <td class="formDescription" valign="top" style="width: 180px;"><label for="item1">'
<td id="items_td" valign="top" class="tableData"> .$i18n->get("items label").'</label><div class="wg-hoverhelp">'.$i18n->get("items description").'</div></td>'
<input type="button" value="Add item" onClick="javascript:addItem()"></button><br /><br /> .' <td id="items_td" valign="top" class="tableData">'
|; .' <input type="button" value="Add item" onClick="javascript:addItem()"></button><br /><br />';
$tabform->getTab("properties")->raw($tableRowStart); $tabform->getTab("properties")->raw($tableRowStart);
@ -114,7 +115,8 @@ sub getEditForm {
my @items = @{JSON->new->decode($self->getValue('items'))->{items}}; my @items = @{JSON->new->decode($self->getValue('items'))->{items}};
foreach my $item (@items){ foreach my $item (@items){
my $itemHTML = 'ID: <input type="text" id="itemId'.$item->{sequenceNumber}.'" ' my $itemHTML = $i18n->get("id label").'<div class="wg-hoverhelp">'.$i18n->get("id description").'</div>: '
.'<input type="text" id="itemId'.$item->{sequenceNumber}.'" '
.'name="itemId_'.$item->{sequenceNumber}.'" value="'.$item->{itemId}.'">' .'name="itemId_'.$item->{sequenceNumber}.'" value="'.$item->{itemId}.'">'
.'<textarea id="item'.$item->{sequenceNumber}.'" name="item_'.$item->{sequenceNumber}.'" ' .'<textarea id="item'.$item->{sequenceNumber}.'" name="item_'.$item->{sequenceNumber}.'" '
.'class="carouselItemText" rows="#" cols="#" ' .'class="carouselItemText" rows="#" cols="#" '
@ -180,6 +182,7 @@ sub processPropertiesFromFormPost {
my $self = shift; my $self = shift;
my $form = $self->session->form; my $form = $self->session->form;
my (@items,$items); my (@items,$items);
$self->SUPER::processPropertiesFromFormPost(@_);
foreach my $param ($form->param) { foreach my $param ($form->param) {
if ($param =~ m/^item_/){ if ($param =~ m/^item_/){

View file

@ -21,16 +21,28 @@ our $I18N = {
context => q|Description of the carousel template field, used as hover help.| context => q|Description of the carousel template field, used as hover help.|
}, },
'payload label' => { 'items label' => {
message => q|Payload|, message => q|Items|,
lastUpdated => 0, lastUpdated => 0,
context => q|Label of the payload field on the edit screen.| context => q|Label of the items field on the edit screen.|
}, },
'payload description' => { 'items description' => {
message => q|Enter a javacript script tag, flash object html, etc to process this carousel's items.|, message => q|Enter this carousel's items.|,
lastUpdated => 0, lastUpdated => 0,
context => q|Description of the payload field, used as hover help.| context => q|Description of the items field, used as hover help.|
},
'id label' => {
message => q|ID|,
lastUpdated => 0,
context => q|Label of the item ID field on the edit screen.|
},
'id description' => {
message => q|Enter a unique ID for this carousel item.|,
lastUpdated => 0,
context => q|Description of the item ID field, used as hover help.|
}, },
}; };