new i18n api requiring $session

This commit is contained in:
Colin Kuskie 2006-01-12 17:49:20 +00:00
parent 877bf082a0
commit 01d95a265e
141 changed files with 2266 additions and 1745 deletions

View file

@ -67,8 +67,9 @@ sub _formatFunction {
} else {
$url = $self->session->url->page("op=".$function->{op});
}
my $i18n = WebGUI::International->new($self->session);
return {
title=>WebGUI::International::get($function->{title}{id}, $function->{title}{namespace}),
title=>$i18n->($function->{title}{id}, $function->{title}{namespace}),
icon=>$self->session->config->get("extrasURL")."/adminConsole/".$function->{icon},
'icon.small'=>$self->session->config->get("extrasURL")."/adminConsole/small/".$function->{icon},
url=>$url,
@ -119,7 +120,8 @@ Returns a Hash of title, url, canUse, and icon. title is the Internationalizatio
sub getAdminConsoleParams {
my $self = shift;
return { 'title' => WebGUI::International::get("admin console","AdminConsole"),
my $i18n = WebGUI::International->new($self->session);
return { 'title' => $i18n->get("admin console","AdminConsole"),
url => $self->session->url->page("op=adminConsole"),
canUse => $self->session->user->isInGroup("12"),
icon => $self->session->config->get("extrasURL")."/adminConsole/adminConsole.gif"
@ -394,9 +396,10 @@ sub render {
my %var;
$var{"application.workarea"} = shift;
$var{"application.title"} = shift || $self->{_function}{title};
$var{"backtosite.label"} = WebGUI::International::get("493");
$var{"toggle.on.label"} = WebGUI::International::get("toggle on", "AdminConsole");
$var{"toggle.off.label"} = WebGUI::International::get("toggle off","AdminConsole");
my $i18n = WebGUI::International->new($self->session, "AdminConsole");
$var{"backtosite.label"} = $i18n->get("493", "WebGUI");
$var{"toggle.on.label"} = $i18n->get("toggle on");
$var{"toggle.off.label"} = $i18n->get("toggle off");
$var{"application.icon"} = $self->{_function}{icon};
$var{"application.canUse"} = $self->{_function}{canUse};
$var{"application.url"} = $self->{_function}{url};

View file

@ -150,9 +150,11 @@ An array reference containing additional information to include with the default
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session, "Asset");
push(@{$definition}, {
assetName=>WebGUI::International::get("asset","Asset"),
assetName=>->get("asset"),
tableName=>'assetData',
className=>'WebGUI::Asset',
icon=>'assets.gif',
@ -478,6 +480,7 @@ Creates and returns a tabform to edit parameters of an Asset.
sub getEditForm {
my $self = shift;
my $i18n = WebGUI::International->new($self->session, "Asset");
my $uiLevelOverride = $self->get("className");
$uiLevelOverride =~ s/\:\:/_/g;
my $tabform = WebGUI::TabForm->new(undef,undef,$self->getUrl(),$uiLevelOverride);
@ -501,66 +504,66 @@ sub getEditForm {
value=>$self->session->form->process("proceed")
});
}
$tabform->addTab("properties",WebGUI::International::get("properties","Asset"));
$tabform->addTab("properties",$i18n->get("properties"));
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get("asset id","Asset"),
-label=>$i18n->get("asset id"),
-value=>$self->get("assetId"),
-hoverHelp=>WebGUI::International::get('asset id description','Asset'),
-hoverHelp=>$i18n->get('asset id description'),
);
$tabform->getTab("properties")->text(
-label=>WebGUI::International::get(99,"Asset"),
-label=>$i18n->get(99),
-name=>"title",
-hoverHelp=>WebGUI::International::get('99 description','Asset'),
-hoverHelp=>$i18n->get('99 description'),
-value=>$self->get("title")
);
$tabform->getTab("properties")->text(
-label=>WebGUI::International::get(411,"Asset"),
-label=>$i18n->get(411),
-name=>"menuTitle",
-value=>$self->get("menuTitle"),
-hoverHelp=>WebGUI::International::get('411 description',"Asset"),
-hoverHelp=>$i18n->get('411 description'),
-uiLevel=>1
);
$tabform->getTab("properties")->text(
-name=>"url",
-label=>WebGUI::International::get(104,"Asset"),
-label=>$i18n->get(104),
-value=>$self->get("url"),
-hoverHelp=>WebGUI::International::get('104 description',"Asset"),
-hoverHelp=>$i18n->get('104 description'),
-uiLevel=>3
);
$tabform->addTab("display",WebGUI::International::get(105,"Asset"),5);
$tabform->addTab("display",$i18n->get(105),5);
$tabform->getTab("display")->yesNo(
-name=>"isHidden",
-value=>$self->get("isHidden"),
-label=>WebGUI::International::get(886,"Asset"),
-hoverHelp=>WebGUI::International::get('886 description',"Asset"),
-label=>$i18n->get(886),
-hoverHelp=>$i18n->get('886 description'),
-uiLevel=>6
);
$tabform->getTab("display")->yesNo(
-name=>"newWindow",
-value=>$self->get("newWindow"),
-label=>WebGUI::International::get(940,"Asset"),
-hoverHelp=>WebGUI::International::get('940 description',"Asset"),
-label=>$i18n->get(940),
-hoverHelp=>$i18n->get('940 description'),
-uiLevel=>6
);
$tabform->addTab("security",WebGUI::International::get(107,"Asset"),6);
$tabform->addTab("security",$i18n->get(107),6);
$tabform->getTab("security")->yesNo(
-name=>"encryptPage",
-value=>$self->get("encryptPage"),
-label=>WebGUI::International::get('encrypt page',"Asset"),
-hoverHelp=>WebGUI::International::get('encrypt page description',"Asset"),
-label=>$i18n->get('encrypt page'),
-hoverHelp=>$i18n->get('encrypt page description'),
-uiLevel=>6
);
$tabform->getTab("security")->dateTime(
-name=>"startDate",
-label=>WebGUI::International::get(497,"Asset"),
-hoverHelp=>WebGUI::International::get('497 description',"Asset"),
-label=>$i18n->get(497),
-hoverHelp=>$i18n->get('497 description'),
-value=>$self->get("startDate"),
-uiLevel=>6
);
$tabform->getTab("security")->dateTime(
-name=>"endDate",
-label=>WebGUI::International::get(498,"Asset"),
-hoverHelp=>WebGUI::International::get('498 description',"Asset"),
-label=>$i18n->get(498),
-hoverHelp=>$i18n->get('498 description'),
-value=>$self->get("endDate"),
-uiLevel=>6
);
@ -582,53 +585,53 @@ sub getEditForm {
$tabform->getTab("security")->selectBox(
-name=>"ownerUserId",
-options=>$users,
-label=>WebGUI::International::get(108,"Asset"),
-hoverHelp=>WebGUI::International::get('108 description',"Asset"),
-label=>$i18n->get(108),
-hoverHelp=>$i18n->get('108 description'),
-value=>[$self->get("ownerUserId")],
-subtext=>$subtext,
-uiLevel=>6
);
$tabform->getTab("security")->group(
-name=>"groupIdView",
-label=>WebGUI::International::get(872,"Asset"),
-hoverHelp=>WebGUI::International::get('872 description',"Asset"),
-label=>$i18n->get(872),
-hoverHelp=>$i18n->get('872 description'),
-value=>[$self->get("groupIdView")],
-uiLevel=>6
);
$tabform->getTab("security")->group(
-name=>"groupIdEdit",
-label=>WebGUI::International::get(871,"Asset"),
-hoverHelp=>WebGUI::International::get('871 description',"Asset"),
-label=>$i18n->get(871),
-hoverHelp=>$i18n->get('871 description'),
-value=>[$self->get("groupIdEdit")],
-excludeGroups=>[1,7],
-uiLevel=>6
);
$tabform->addTab("meta",WebGUI::International::get("Metadata","Asset"),3);
$tabform->addTab("meta",$i18n->get("Metadata"),3);
$tabform->getTab("meta")->textarea(
-name=>"synopsis",
-label=>WebGUI::International::get(412,"Asset"),
-hoverHelp=>WebGUI::International::get('412 description',"Asset"),
-label=>$i18n->get(412),
-hoverHelp=>$i18n->get('412 description'),
-value=>$self->get("synopsis"),
-uiLevel=>3
);
$tabform->getTab("meta")->textarea(
-name=>"extraHeadTags",
-label=>WebGUI::International::get("extra head tags","Asset"),
-hoverHelp=>WebGUI::International::get('extra head tags description',"Asset"),
-label=>$i18n->get("extra head tags"),
-hoverHelp=>$i18n->get('extra head tags description'),
-value=>$self->get("extraHeadTags"),
-uiLevel=>5
);
$tabform->getTab("meta")->yesNo(
-name=>"isPackage",
-label=>WebGUI::International::get("make package","Asset"),
-hoverHelp=>WebGUI::International::get('make package description',"Asset"),
-label=>$i18n->get("make package"),
-hoverHelp=>$i18n->get('make package description'),
-value=>$self->getValue("isPackage"),
-uiLevel=>7
);
$tabform->getTab("meta")->yesNo(
-name=>"isPrototype",
-label=>WebGUI::International::get("make prototype","Asset"),
-hoverHelp=>WebGUI::International::get('make prototype description',"Asset"),
-label=>$i18n->get("make prototype"),
-hoverHelp=>$i18n->get('make prototype description'),
-value=>$self->getValue("isPrototype"),
-uiLevel=>9
);
@ -640,7 +643,7 @@ sub getEditForm {
# Add a "Select..." option on top of a select list to prevent from
# saving the value on top of the list when no choice is made.
if($fieldType eq "selectList") {
$options = {"", WebGUI::International::get("Select","Asset")};
$options = {"", $i18n->get("Select")};
}
$tabform->getTab("meta")->dynamicField(
name=>"metadata_".$meta->{$field}{fieldId},
@ -657,9 +660,9 @@ sub getEditForm {
# Add a quick link to add field
$tabform->getTab("meta")->readOnly(
-value=>'<p><a href="'.$self->session->url->page("func=editMetaDataField;fid=new").'">'.
WebGUI::International::get('Add new field','Asset').
$i18n->get('Add new field').
'</a></p>',
-hoverHelp=>WebGUI::International::get('Add new field description',"Asset"),
-hoverHelp=>$i18n->get('Add new field description'),
);
}
}
@ -696,7 +699,7 @@ If this evaluates to True, then the smaller extras/adminConsole/small/assets.gif
sub getIcon {
my $self = shift;
my $small = shift;
my $definition = $self->definition;
my $definition = $self->definition($self->session);
my $icon = $definition->[0]{icon} || "assets.gif";
return $self->session->config->get("extrasURL").'/assets/small/'.$icon if ($small);
return $self->session->config->get("extrasURL").'/assets/'.$icon;
@ -775,7 +778,7 @@ Returns the internationalization of the word "Asset".
sub getName {
my $self = shift;
my $definition = $self->definition;
my $definition = $self->definition($self->session);
return $definition->[0]{assetName};
}
@ -863,9 +866,9 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
my $toolbar = $self->session->icon->delete('func=delete',$self->get("url"),WebGUI::International::get(43,"Asset"));
my $i18n = WebGUI::International->new($self->session, "Asset");
my $toolbar = $self->session->icon->delete('func=delete',$self->get("url")$i18n->get(43));
my $commit;
my $i18n = WebGUI::International->new("Asset");
if (($self->canEditIfLocked && $self->session->scratch->get("versionTag") eq $self->get("tagId")) || !$self->isLocked) {
$toolbar .= $self->session->icon->edit('func=edit',$self->get("url"));
} else {
@ -917,7 +920,7 @@ Returns the UI Level specified in the asset definition or from the config file i
sub getUiLevel {
my $self = shift;
my $definition = $self->definition;
my $definition = $self->definition($self->session);
return $self->session->config->get("assetUiLevel"){$definition->[0]{className}} || $definition->[0]{uiLevel} || 1;
}
@ -969,7 +972,7 @@ sub getValue {
return $storedValue if (defined $storedValue);
unless (exists $self->{_propertyDefinitions}) { # check to see if the definitions have been merged and cached
my %properties;
foreach my $definition (@{$self->definition}) {
foreach my $definition (@{$self->definition($self->session)}) {
%properties = (%properties, %{$definition->{properties}});
}
$self->{_propertyDefinitions} = \%properties;
@ -1036,7 +1039,7 @@ sub new {
# got properties from cache
} else {
my $sql = "select * from asset";
foreach my $definition (@{$class->definition}) {
foreach my $definition (@{$class->definition($session)}) {
$sql .= " left join ".$definition->{tableName}." on asset.assetId="
.$definition->{tableName}.".assetId and ".$definition->{tableName}.".revisionDate=".$revisionDate;
}
@ -1186,7 +1189,7 @@ Updates current Asset with data from Form.
sub processPropertiesFromFormPost {
my $self = shift;
my %data;
foreach my $definition (@{$self->definition}) {
foreach my $definition (@{$self->definition($self->session)}) {
foreach my $property (keys %{$definition->{properties}}) {
if ($definition->{properties}{$property}{noFormPost}) {
$data{$property} = $definition->{properties}{$property}{defaultValue} if $self->session->form->process("assetId") eq "new";
@ -1364,7 +1367,7 @@ Hash reference of properties and values to set.
sub update {
my $self = shift;
my $properties = shift;
foreach my $definition (@{$self->definition}) {
foreach my $definition (@{$self->definition($self->session)}) {
my @setPairs;
foreach my $property (keys %{$definition->{properties}}) {
next unless (exists $properties->{$property});
@ -1418,7 +1421,7 @@ sub www_add {
}
if ($self->session->form->process("'prototype'")) {
my $prototype = WebGUI::Asset->new($self->session->form->process("prototype"),$class);
foreach my $definition (@{$prototype->definition}) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab
foreach my $definition (@{$prototype->definition($self->session)}) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab
foreach my $property (keys %{$definition->{properties}}) {
next if (isIn($property,qw(title menuTitle url isPrototype isPackage)));
next if ($definition->{properties}{$property}{noFormPost});
@ -1539,7 +1542,7 @@ sub www_manageAssets {
$self->session->style->setScript($self->session->config->get("extrasURL").'/contextMenu/contextMenu.js', {type=>"text/javascript"});
$self->session->style->setLink($self->session->config->get("extrasURL").'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
$self->session->style->setScript($self->session->config->get("extrasURL").'/assetManager/assetManager.js', {type=>"text/javascript"});
my $i18n = WebGUI::International->new("Asset");
my $i18n = WebGUI::International->new($session, "Asset");
my $ancestors = $self->getLineage(["self","ancestors"],{returnObjects=>1});
my @crumbtrail;
foreach my $ancestor (@{$ancestors}) {
@ -1609,7 +1612,7 @@ sub www_manageAssets {
</script> <div class="adminConsoleSpacer">
&nbsp;
</div>
<div style="float: left; padding-right: 30px; font-size: 14px;width: 28%;"><fieldset><legend>'.WebGUI::International::get(1083,"Asset").'</legend>';
<div style="float: left; padding-right: 30px; font-size: 14px;width: 28%;"><fieldset><legend>'.$i18n->get(1083).'</legend>';
foreach my $link (@{$self->getAssetAdderLinks("proceed=manageAssets","assetContainers")}) {
$output .= '<img src="'.$link->{'icon.small'}.'" align="middle" alt="'.$link->{label}.'" border="0" />
<a href="'.$link->{url}.'">'.$link->{label}.'</a> ';
@ -1639,11 +1642,11 @@ sub www_manageAssets {
$hasClips = 1;
}
if ($hasClips) {
$output .= '<div style="width: 28%; float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.WebGUI::International::get(1082,"Asset").'</legend>'
$output .= '<div style="width: 28%; float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.$i18n->get(1082).'</legend>'
.WebGUI::Form::formHeader($self->session,)
.WebGUI::Form::hidden($self->session,{name=>"func",value=>"pasteList"})
.WebGUI::Form::checkbox($self->session,{extras=>'onchange="toggleClipboardSelectAll(this.form);"'})
.' '.WebGUI::International::get("select all","Asset").'<br />'
.' '.$i18n->get("select all").'<br />'
.WebGUI::Form::checkList($self->session,{name=>"assetId",vertical=>1,options=>\%options})
.'<br />'
.WebGUI::Form::submit($self->session,{value=>"Paste"})
@ -1671,7 +1674,7 @@ sub www_manageAssets {
}
if ($hasPackages) {
$output .= '<div style="width: 28%;float: left; padding-right: 30px; font-size: 14px;"><fieldset>
<legend>'.WebGUI::International::get("packages","Asset").'</legend>
<legend>'.$i18n->get("packages").'</legend>
'.$packages.' </fieldset></div> ';
}
$output .= '

View file

@ -33,8 +33,9 @@ our @ISA = qw(WebGUI::Asset);
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_Event");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Event"),
assetName=>$i18n->get('assetName'),
icon=>'calendar.gif',
tableName=>'EventsCalendar_event',
className=>'WebGUI::Asset::Event',
@ -72,45 +73,46 @@ sub definition {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_Event");
$tabform->getTab("properties")->HTMLArea(
-name=>"description",
-label=>WebGUI::International::get(512,"Asset_Event"),
-hoverHelp=>WebGUI::International::get('Description description',"Asset_Event"),
-label=>$i18n->get(512),
-hoverHelp=>$i18n->get('Description description'),
-value=>$self->getValue("description")
);
$tabform->getTab("properties")->dateTime(
-name=>"eventStartDate",
-label=>WebGUI::International::get(513,"Asset_Event"),
-hoverHelp=>WebGUI::International::get('Start Date description',"Asset_Event"),
-label=>$i18n->get(513),
-hoverHelp=>$i18n->get('Start Date description'),
-extras=>'onBlur="this.form.eventEndDate.value=this.form.eventStartDate.value;this.form.until.value=this.form.eventStartDate.value;"',
-value=>$self->getValue("eventStartDate")
);
$tabform->getTab("properties")->dateTime(
-name=>"eventEndDate",
-label=>WebGUI::International::get(514,"Asset_Event"),
-hoverHelp=>WebGUI::International::get('End Date description',"Asset_Event"),
-label=>$i18n->get(514),
-hoverHelp=>$i18n->get('End Date description'),
-extras=>'onBlur="this.form.until.value=this.form.eventEndDate.value;"',
-value=>$self->getValue("eventEndDate")
);
$tabform->getTab("properties")->text(
-name=>"eventLocation",
-label=>WebGUI::International::get(515,"Asset_Event"),
-hoverHelp=>WebGUI::International::get('515 description',"Asset_Event"),
-label=>$i18n->get(515),
-hoverHelp=>$i18n->get('515 description'),
-value=>$self->getValue("eventLocation")
);
if ($self->session->form->process("func") eq "add") {
my %recursEvery;
tie %recursEvery, 'Tie::IxHash';
%recursEvery = (
'never'=>WebGUI::International::get(4,"Asset_Event"),
'day'=>WebGUI::International::get(700,"Asset_Event"),
'week'=>WebGUI::International::get(701,"Asset_Event"),
'month'=>WebGUI::International::get(702,"Asset_Event"),
'year'=>WebGUI::International::get(703,"Asset_Event"),
'never'=>$i18n->get(4),
'day'=>$i18n->get(700),
'week'=>$i18n->get(701),
'month'=>$i18n->get(702),
'year'=>$i18n->get(703),
);
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get(8,"Asset_Event"),
-hoverHelp=>WebGUI::International::get('Recurs every description',"Asset_Event"),
-label=>$i18n->get(8),
-hoverHelp=>$i18n->get('Recurs every description'),
-value=>WebGUI::Form::integer({
name=>"interval",
defaultValue=>1
@ -119,7 +121,7 @@ sub getEditForm {
name=>"recursEvery",
options=>\%recursEvery
})
.' '.WebGUI::International::get(9,"Asset_Event").' '
.' '.$i18n->get(9).' '
.WebGUI::Form::date({
name=>"until"
})
@ -129,8 +131,8 @@ sub getEditForm {
-name=>"templateId",
-value=>$self->getValue("templateId"),
-namespace=>"EventsCalendar/Event",
-label=>WebGUI::International::get(530,"Asset_Event"),
-hoverHelp=>WebGUI::International::get('530 description',"Asset_Event"),
-label=>$i18n->get(530),
-hoverHelp=>$i18n->get('530 description'),
);
return $tabform;
}
@ -203,19 +205,20 @@ sub view {
my $self = shift;
my ($output, $event, $id);
my %var = $self->get;
my $i18n = WebGUI::International->new($self->session,"Asset_Event");
$event = $self;
$var{title} = $event->getValue("title");
$var{"start.label"} = WebGUI::International::get(14,"Asset_Event");
$var{"start.label"} = $i18n->get(14);
$var{"start.date"} =$self->session->datetime->epochToHuman($self->getValue("eventStartDate"),"%z");
$var{"start.time"} =$self->session->datetime->epochToHuman($self->getValue("eventStartDate"),"%Z");
$var{"end.label"} = WebGUI::International::get(15,"Asset_Event");
$var{"end.label"} = $i18n->get(15);
$var{"end.date"} =$self->session->datetime->epochToHuman($self->getValue("eventEndDate"),"%z");
$var{"end.time"} =$self->session->datetime->epochToHuman($self->getValue("eventEndDate"),"%Z");
$var{canEdit} = $self->canEdit;
$var{"edit.url"} = $self->session->url->page('func=edit');
$var{"edit.label"} = WebGUI::International::get(575,"Asset_Event");
$var{"edit.label"} = $i18n->get(575);
$var{"delete.url"} = $self->session->url->page('func=deleteEvent;rid='.$self->getValue("EventsCalendar_recurringId"));
$var{"delete.label"} = WebGUI::International::get(576,"Asset_Event");
$var{"delete.label"} = $i18n->get(576);
my @others;
my ($start, $garbage) = $self->session->datetime->dayStartEnd($self->get("eventStartDate"));
my ($garbage, $end) = $self->session->datetime->dayStartEnd($self->get("eventEndDate"));
@ -238,13 +241,14 @@ sub view {
sub www_deleteEvent {
my $self = shift;
return $self->session->privilege->insufficient() unless ($self->canEdit);
my $i18n = WebGUI::International->new($self->session,"Asset_Event");
my ($output);
$output = '<h1>'.WebGUI::International::get(42,"Asset_Event").'</h1>';
$output .= WebGUI::International::get(75,"Asset_Event").'<p><blockquote>';
$output .= '<a href="'.$self->session->url->page('func=deleteEventConfirm').'">'.WebGUI::International::get(76,"Asset_Event").'</a><p>';
$output = '<h1>'.$i18n->get(42).'</h1>';
$output .= $i18n->get(75).'<p><blockquote>';
$output .= '<a href="'.$self->session->url->page('func=deleteEventConfirm').'">'.$i18n->get(76).'</a><p>';
$output .= '<a href="'.$self->session->url->page('func=deleteEventConfirm;rid='.$self->session->form->process("rid")).'">'
.WebGUI::International::get(77,"Asset_Event").'</a><p>' if (($self->session->form->process("rid") ne "") and ($self->session->form->process("rid") ne "0"));
$output .= '<a href="'.$self->getUrl.'">'.WebGUI::International::get(78,"Asset_Event").'</a>';
.$i18n->get(77).'</a><p>' if (($self->session->form->process("rid") ne "") and ($self->session->form->process("rid") ne "0"));
$output .= '<a href="'.$self->getUrl.'">'.$i18n->get(78).'</a>';
$output .= '</blockquote>';
return $self->session->style->process($output,$self->getParent->getValue("styleTemplateId"));
}
@ -271,7 +275,8 @@ sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("event add/edit","Asset_Event");
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('13', 'Asset_Event'));
my $i18n = WebGUI::International->new($self->session,"Asset_Event");
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get('13'));
}
#-------------------------------------------------------------------

View file

@ -63,8 +63,9 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_Image");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Image"),
assetName=>$i18n->get('assetName'),
tableName=>'ImageAsset',
className=>'WebGUI::Asset::File::Image',
properties=>{
@ -116,27 +117,28 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_Image");
$tabform->getTab("properties")->integer(
-name=>"thumbnailSize",
-label=>WebGUI::International::get('thumbnail size', 'Asset_Image'),
-hoverHelp=>WebGUI::International::get('Thumbnail size description', 'Asset_Image'),
-label=>$i18n->get('thumbnail size'),
-hoverHelp=>$i18n->get('Thumbnail size description'),
-value=>$self->getValue("thumbnailSize")
);
$tabform->getTab("properties")->textarea(
-name=>"parameters",
-label=>WebGUI::International::get('parameters', 'Asset_Image'),
-hoverHelp=>WebGUI::International::get('Parameters description', 'Asset_Image'),
-label=>$i18n->get('parameters'),
-hoverHelp=>$i18n->get('Parameters description'),
-value=>$self->getValue("parameters")
);
if ($self->get("filename") ne "") {
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get('thumbnail', 'Asset_Image'),
-hoverHelp=>WebGUI::International::get('Thumbnail description', 'Asset_Image'),
-label=>$i18n->get('thumbnail'),
-hoverHelp=>$i18n->get('Thumbnail description'),
-value=>'<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='$self->session->datetime->time().'" alt="thumbnail" /></a>'
);
my ($x, $y) = $self->getStorageLocation->getSizeInPixels($self->get("filename"));
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get('image size', 'Asset_Image'),
-label=>$i18n->get('image size'),
-value=>$x.' x '.$y
);
}
@ -226,16 +228,17 @@ sub view {
sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=resize'),WebGUI::International::get("resize image","Asset_Image")) if ($self->get("filename"));
my $i18n = WebGUI::International->new($self->session, 'Asset_Image');
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=resize'),$i18n->get("resize image")) if ($self->get("filename"));
my $tabform = $self->getEditForm;
$tabform->getTab("display")->template(
-value=>$self->get("templateId"),
-namespace=>"ImageAsset",
-hoverHelp=>WebGUI::International::get('image template description','Asset_Image'),
-hoverHelp=>$i18n->get('image template description'),
-defaultValue=>"PBtmpl0000000000000088"
);
$self->getAdminConsole->setHelp("image add/edit","Asset_Image");
return $self->getAdminConsole->render($tabform->print,WebGUI::International::get("edit image","Asset_Image"));
return $self->getAdminConsole->render($tabform->print,$i18n->get("edit image"));
}
#-------------------------------------------------------------------
@ -246,7 +249,8 @@ sub www_resize {
$self->getStorageLocation->resize($self->get("filename"),$self->session->form->process("newWidth"),$self->session->form->process("newHeight"));
$self->setSize($self->getStorageLocation->getFileSize($self->get("filename")));
}
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=edit'),WebGUI::International::get("edit image","Asset_Image"));
my $i18n = WebGUI::International->new($self->session,"Asset_Image");
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=edit'),$i18n->get("edit image"));
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name=>"func",
@ -254,26 +258,26 @@ sub www_resize {
);
my ($x, $y) = $self->getStorageLocation->getSizeInPixels($self->get("filename"));
$f->readOnly(
-label=>WebGUI::International::get('image size', 'Asset_Image'),
-hoverHelp=>WebGUI::International::get('image size description', 'Asset_Image'),
-label=>$i18n->get('image size'),
-hoverHelp=>$i18n->get('image size description'),
-value=>$x.' x '.$y,
);
$f->integer(
-label=>WebGUI::International::get('new width','Asset_Image'),
-hoverHelp=>WebGUI::International::get('new width description','Asset_Image'),
-label=>$i18n->get('new width'),
-hoverHelp=>$i18n->get('new width description'),
-name=>"newWidth",
-value=>$x,
);
$f->integer(
-label=>WebGUI::International::get('new height','Asset_Image'),
-hoverHelp=>WebGUI::International::get('new height description','Asset_Image'),
-label=>$i18n->get('new height'),
-hoverHelp=>$i18n->get('new height description'),
-name=>"newHeight",
-value=>$y,
);
$f->submit;
my $image = '<div align="center"><img src="'.$self->getStorageLocation->getUrl($self->get("filename")).'" border="1" alt="'.$self->get("filename").'" /></div>';
$self->getAdminConsole->setHelp("image resize","Asset_Image");
return $self->getAdminConsole->render($f->print.$image,WebGUI::International::get("resize image","Asset_Image"));
return $self->getAdminConsole->render($f->print.$image,$i18n->get("resize image"));
}
#-------------------------------------------------------------------

View file

@ -57,10 +57,11 @@ sub unzip {
my $filepath = $storage->getPath();
chdir $filepath;
my $i18n = WebGUI::International->new($self->session,"Asset_ZipArchive");
if($filename =~ m/\.zip/i){
my $zip = Archive::Zip->new();
unless ($zip->read($filename) == $zip->AZ_OK){
$self->session->errorHandler->warn(WebGUI::International::get("zip_error","Asset_ZipArchive"));
$self->session->errorHandler->warn($i18n->get("zip_error"));
return 0;
}
$zip->extractTree();
@ -71,7 +72,7 @@ sub unzip {
return 0;
}
} else{
$self->session->errorHandler->warn(WebGUI::International::get("bad_archive","Asset_ZipArchive"));
$self->session->errorHandler->warn($i18n->get("bad_archive"));
}
return 1;
@ -105,8 +106,9 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_ZipArchive");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_ZipArchive"),
assetName=>$i18n->get('assetName'),
tableName=>'ZipArchiveAsset',
className=>'WebGUI::Asset::File',
properties=>{
@ -150,16 +152,17 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_ZipArchive");
$tabform->getTab("display")->template(
-value=>$self->getValue("templateId"),
-label=>WebGUI::International::get('template label', 'Asset_ZipArchive'),
-label=>$i18n->get('template label'),
-namespace=>"ZipArchiveAsset"
);
$tabform->getTab("properties")->text (
-name=>"showPage",
-label=>WebGUI::International::get('show page', 'Asset_ZipArchive'),
-label=$i18n->get('show page'),
-value=>$self->getValue("showPage"),
-hoverHelp=>WebGUI::International::get('show page description', 'Asset_ZipArchive'),
-hoverHelp=>$i18n->get('show page description'),
);
return $tabform;
}
@ -201,22 +204,23 @@ sub processPropertiesFromFormPost {
my $file = $self->get("filename");
#return unless $file;
my $i18n = WebGUI::International->new($self->session, 'Asset_ZipArchive');
unless($self->session->form->process("showPage")) {
$storage->delete;
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
$self->session->scratch->set("za_error",WebGUI::International::get("za_show_error","Asset_ZipArchive"));
$self->session->scratch->set("za_error",$i18n->get("za_show_error"));
return;
}
unless($file =~ m/\.tar/i || $file =~ m/\.zip/i) {
$storage->delete;
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
$self->session->scratch->set("za_error",WebGUI::International::get("za_error","Asset_ZipArchive"));
$self->session->scratch->set("za_error",$i18n->get("za_error"));
return;
}
unless ($self->unzip($storage,$self->get("filename"))) {
$self->session->errorHandler->warn(WebGUI::International::get("unzip_error","Asset_ZipArchive"));
$self->session->errorHandler->warn($i18n->get("unzip_error"));
}
}
@ -285,8 +289,9 @@ sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("zip archive add/edit", "Asset_ZipArchive");
my $i18n = WebGUI::International->new($self->session,"Asset_ZipArchive");
return $self->getAdminConsole->render($self->getEditForm->print,
WebGUI::International::get('zip archive add/edit title',"Asset_ZipArchive"));
$i18n->get('zip archive add/edit title'));
}
#-------------------------------------------------------------------

View file

@ -110,8 +110,9 @@ sub chopTitle {
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_Post");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Post"),
assetName=>$i18n->get('assetName'),
icon=>'post.gif',
tableName=>'Post',
className=>'WebGUI::Asset::Post',
@ -370,14 +371,15 @@ sub getReplyUrl {
sub getStatus {
my $self = shift;
my $status = $self->get("status");
my $i18n = WebGUI::International->new($self->session,"Asset_Post");
if ($status eq "approved") {
return WebGUI::International::get('approved','Asset_Post');
return $i18n->get('approved');
} elsif ($status eq "denied") {
return WebGUI::International::get('denied','Asset_Post');
return $i18n->get('denied');
} elsif ($status eq "pending") {
return WebGUI::International::get('pending','Asset_Post');
return $i18n->get('pending');
} elsif ($status eq "archived") {
return WebGUI::International::get('archived','Asset_Post');
return $i18n->get('archived');
}
}
@ -498,10 +500,11 @@ sub getUploadControl {
my $maxAttachments = $self->getThread->getParent->getValue("attachmentsPerPost");
my $uploadControl;
return undef unless ($maxAttachments);
my $i18n = WebGUI::International->new($self->session);
if ($self->get("storageId")) {
my $i;
foreach my $filename (@{$self->getStorageLocation->getFiles}) {
$uploadControl .= $self->session->icon->delete("func=deleteFile;filename=".$filename,$self->get("url"),WebGUI::International::get("delete file warning","Asset_Collaboration"))
$uploadControl .= $self->session->icon->delete("func=deleteFile;filename=".$filename,$self->get("url"),$i18n->get("delete file warning"))
.' <a href="'.$self->getStorageLocation->getUrl($filename).'">'.$filename.'</a>'
.'<br />';
$i++;
@ -622,6 +625,7 @@ sub notifySubscribers {
$subscribers{$userId} = $userId unless ($userId eq $self->get("ownerUserId"));
}
my %lang;
my $i18n = WebGUI::International->new($self->session);
foreach my $userId (keys %subscribers) {
my $u = WebGUI::User->new($userId);
if ($lang{$u->profileField("language")}{message} eq "") {
@ -629,8 +633,8 @@ sub notifySubscribers {
$self->getThread->getParent->appendTemplateLabels($lang{$u->profileField("language")}{var});
$lang{$u->profileField("language")}{var}{url} = $self->session->url->getSiteURL().$self->getUrl;
$lang{$u->profileField("language")}{var}{'notify.subscription.message'} =
WebGUI::International::get(875,"Asset_Post",$u->profileField("language"));
$lang{$u->profileField("language")}{subject} = WebGUI::International::get(523,"Asset_Post",$u->profileField("language"));
$i18n->get(875,"Asset_Post",$u->profileField("language"));
$lang{$u->profileField("language")}{subject} = $i18n->get(523,"Asset_Post",$u->profileField("language"));
$lang{$u->profileField("language")}{message} = $self->processTemplate($lang{$u->profileField("language")}{var}, $self->getThread->getParent->get("notificationTemplateId"));
}
WebGUI::MessageLog::addEntry($userId,"",$lang{$u->profileField("language")}{subject},$lang{$u->profileField("language")}{message});
@ -642,6 +646,7 @@ sub notifySubscribers {
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
my $i18n = WebGUI::International->new($self->session);
my %data;
if ($self->session->form->process("assetId") eq "new") {
if ($self->getParent->get("className") eq "WebGUI::Asset::Wobject::Collaboration") {
@ -670,7 +675,7 @@ sub processPropertiesFromFormPost {
$data{endDate} = $self->getThread->getParent->get("endDate") unless ($self->session->form->process("endDate"));
($data{synopsis}, $data{content}) = $self->getSynopsisAndContentFromFormPost;
if ($self->getThread->getParent->get("addEditStampToPosts")) {
$data{content} .= "\n\n --- (".WebGUI::International::get('Edited_on','Asset_Post')." ".$self->session->datetime->epochToHuman(undef,"%z %Z [GMT%O]").WebGUI::International::get('By','Asset_Post').$self->session->user->profileField("alias").") --- \n";
$data{content} .= "\n\n --- (".$i18n->get('Edited_on','Asset_Post')." ".$self->session->datetime->epochToHuman(undef,"%z %Z [GMT%O]").$i18n->get('By','Asset_Post').$self->session->user->profileField("alias").") --- \n";
if ($self->getValue("contentType") eq "mixed" || $self->getValue("contentType") eq "html") {
$data{content} = '<p>'.$data{content}.'</p>';
}
@ -956,6 +961,7 @@ sub www_edit {
my %var;
my $content;
my $title;
my $i18n = WebGUI::International->new($self->session);
if ($self->session->form->process("func") eq "add") { # new post
$var{'form.header'} = WebGUI::Form::formHeader($self->session,{action=>$self->getParent->getUrl})
.WebGUI::Form::hidden({
@ -1084,10 +1090,10 @@ sub www_edit {
richEditId=>$self->getThread->getParent->get("richEditor")
});
$var{'form.submit'} = WebGUI::Form::submit({
extras=>"onclick=\"this.value='".WebGUI::International::get(452)."'; this.form.func.value='editSave'; this.form.submit();return false;\""
extras=>"onclick=\"this.value='".$i18n->get(452)."'; this.form.func.value='editSave'; this.form.submit();return false;\""
});
$var{'form.preview'} = WebGUI::Form::submit({
value=>WebGUI::International::get("preview","Asset_Collaboration")
value=>$i18n->get("preview","Asset_Collaboration")
});
$var{'attachment.form'} = $self->getUploadControl;
$var{'contentType.form'} = WebGUI::Form::contentType({

View file

@ -71,8 +71,9 @@ sub decrementReplies {
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_Thread");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Thread"),
assetName=>$i18n->get('assetName'),
icon=>'thread.gif',
tableName=>'Thread',
className=>'WebGUI::Asset::Post::Thread',

View file

@ -60,8 +60,9 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit');
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName','Asset_RichEdit'),
assetName=>$i18n->get('assetName'),
icon=>'richEdit.gif',
uiLevel => 5,
tableName=>'RichEdit',
@ -153,64 +154,65 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit');
my %buttons;
tie %buttons, "Tie::IxHash";
%buttons = (
'search' => WebGUI::International::get('search', 'Asset_RichEdit'),
'replace' => WebGUI::International::get('replace', 'Asset_RichEdit'),
'cut' => WebGUI::International::get('cut', 'Asset_RichEdit'),
'copy' => WebGUI::International::get('copy', 'Asset_RichEdit'),
'paste' => WebGUI::International::get('paste', 'Asset_RichEdit'),
'pastetext' => WebGUI::International::get('pastetext', 'Asset_RichEdit'),
'pasteword' => WebGUI::International::get('pasteword', 'Asset_RichEdit'),
'undo' => WebGUI::International::get('undo', 'Asset_RichEdit'),
'redo' => WebGUI::International::get('redo', 'Asset_RichEdit'),
'bold' => WebGUI::International::get('bold', 'Asset_RichEdit'),
'italic' => WebGUI::International::get('italic', 'Asset_RichEdit'),
'underline' => WebGUI::International::get('underline', 'Asset_RichEdit'),
'strikethrough' => WebGUI::International::get('strikethrough', 'Asset_RichEdit'),
'justifyleft' => WebGUI::International::get('justifyleft', 'Asset_RichEdit'),
'justifycenter' => WebGUI::International::get('justifycenter', 'Asset_RichEdit'),
'justifyright' => WebGUI::International::get('justifyright', 'Asset_RichEdit'),
'justifyfull' => WebGUI::International::get('justifyfull', 'Asset_RichEdit'),
'bullist' => WebGUI::International::get('bullist', 'Asset_RichEdit'),
'numlist' => WebGUI::International::get('numlist', 'Asset_RichEdit'),
'outdent' => WebGUI::International::get('outdent', 'Asset_RichEdit'),
'indent' => WebGUI::International::get('indent', 'Asset_RichEdit'),
'sub' => WebGUI::International::get('sub', 'Asset_RichEdit'),
'sup' => WebGUI::International::get('sup', 'Asset_RichEdit'),
'styleselect' => WebGUI::International::get('styleselect', 'Asset_RichEdit'),
'formatselect' => WebGUI::International::get('formatselect', 'Asset_RichEdit'),
'fontselect' => WebGUI::International::get('fontselect', 'Asset_RichEdit'),
'fontsizeselect' => WebGUI::International::get('fontsizeselect', 'Asset_RichEdit'),
'forecolor' => WebGUI::International::get('forecolor', 'Asset_RichEdit'),
'backcolor' => WebGUI::International::get('backcolor', 'Asset_RichEdit'),
'link' => WebGUI::International::get('link', 'Asset_RichEdit'),
'pagetree' => WebGUI::International::get('pagetree', 'Asset_RichEdit'),
'anchor' => WebGUI::International::get('anchor', 'Asset_RichEdit'),
'unlink' => WebGUI::International::get('unlink', 'Asset_RichEdit'),
'tablecontrols' => WebGUI::International::get('tablecontrols', 'Asset_RichEdit'),
'visualaid' => WebGUI::International::get('visualaid', 'Asset_RichEdit'),
'hr' => WebGUI::International::get('hr', 'Asset_RichEdit'),
'advhr' => WebGUI::International::get('advhr', 'Asset_RichEdit'),
'inserttime' => WebGUI::International::get('inserttime', 'Asset_RichEdit'),
'insertdate' => WebGUI::International::get('insertdate', 'Asset_RichEdit'),
'image' => WebGUI::International::get('image', 'Asset_RichEdit'),
'insertImage' => WebGUI::International::get('insertImage', 'Asset_RichEdit'),
'flash' => WebGUI::International::get('flash', 'Asset_RichEdit'),
'charmap' => WebGUI::International::get('charmap', 'Asset_RichEdit'),
'collateral' => WebGUI::International::get('collateral', 'Asset_RichEdit'),
'emotions' => WebGUI::International::get('emotions', 'Asset_RichEdit'),
'help' => WebGUI::International::get('help', 'Asset_RichEdit'),
'iespell' => WebGUI::International::get('iespell', 'Asset_RichEdit'),
'removeformat' => WebGUI::International::get('removeformat', 'Asset_RichEdit'),
'code' => WebGUI::International::get('code', 'Asset_RichEdit'),
'cleanup' => WebGUI::International::get('cleanup', 'Asset_RichEdit'),
'save' => WebGUI::International::get('save', 'Asset_RichEdit'),
'preview' => WebGUI::International::get('preview', 'Asset_RichEdit'),
'fullscreen' => WebGUI::International::get('fullscreen', 'Asset_RichEdit'),
'zoom' => WebGUI::International::get('zoom', 'Asset_RichEdit'),
'print' => WebGUI::International::get('print', 'Asset_RichEdit'),
'search' => $i18n->get('search'),
'replace' => $i18n->get('replace'),
'cut' => $i18n->get('cut'),
'copy' => $i18n->get('copy'),
'paste' => $i18n->get('paste'),
'pastetext' => $i18n->get('pastetext'),
'pasteword' => $i18n->get('pasteword'),
'undo' => $i18n->get('undo'),
'redo' => $i18n->get('redo'),
'bold' => $i18n->get('bold'),
'italic' => $i18n->get('italic'),
'underline' => $i18n->get('underline'),
'strikethrough' => $i18n->get('strikethrough'),
'justifyleft' => $i18n->get('justifyleft'),
'justifycenter' => $i18n->get('justifycenter'),
'justifyright' => $i18n->get('justifyright'),
'justifyfull' => $i18n->get('justifyfull'),
'bullist' => $i18n->get('bullist'),
'numlist' => $i18n->get('numlist'),
'outdent' => $i18n->get('outdent'),
'indent' => $i18n->get('indent'),
'sub' => $i18n->get('sub'),
'sup' => $i18n->get('sup'),
'styleselect' => $i18n->get('styleselect'),
'formatselect' => $i18n->get('formatselect'),
'fontselect' => $i18n->get('fontselect'),
'fontsizeselect' => $i18n->get('fontsizeselect'),
'forecolor' => $i18n->get('forecolor'),
'backcolor' => $i18n->get('backcolor'),
'link' => $i18n->get('link'),
'pagetree' => $i18n->get('pagetree'),
'anchor' => $i18n->get('anchor'),
'unlink' => $i18n->get('unlink'),
'tablecontrols' => $i18n->get('tablecontrols'),
'visualaid' => $i18n->get('visualaid'),
'hr' => $i18n->get('hr'),
'advhr' => $i18n->get('advhr'),
'inserttime' => $i18n->get('inserttime'),
'insertdate' => $i18n->get('insertdate'),
'image' => $i18n->get('image'),
'insertImage' => $i18n->get('insertImage'),
'flash' => $i18n->get('flash'),
'charmap' => $i18n->get('charmap'),
'collateral' => $i18n->get('collateral'),
'emotions' => $i18n->get('emotions'),
'help' => $i18n->get('help'),
'iespell' => $i18n->get('iespell'),
'removeformat' => $i18n->get('removeformat'),
'code' => $i18n->get('code'),
'cleanup' => $i18n->get('cleanup'),
'save' => $i18n->get('save'),
'preview' => $i18n->get('preview'),
'fullscreen' => $i18n->get('fullscreen'),
'zoom' => $i18n->get('zoom'),
'print' => $i18n->get('print'),
# 'advlink' => "Advanced Link",
# 'spacer' => "Toolbar Spacer",
# 'separator' => "Toolbar Separator",
@ -224,10 +226,10 @@ sub getEditForm {
<td>%s</td>
<td>%s</td>
</tr>!,
WebGUI::International::get('button','Asset_RichEdit'),
WebGUI::International::get('row 1','Asset_RichEdit'),
WebGUI::International::get('row 2','Asset_RichEdit'),
WebGUI::International::get('row 3','Asset_RichEdit');
$i18n->get('button'),
$i18n->get('row 1'),
$i18n->get('row 2'),
$i18n->get('row 3');
my @toolbarRow1 = split("\n",$self->getValue("toolbarRow1"));
my @toolbarRow2 = split("\n",$self->getValue("toolbarRow2"));
my @toolbarRow3 = split("\n",$self->getValue("toolbarRow3"));
@ -260,108 +262,108 @@ sub getEditForm {
}
$buttonGrid .= "</table>";
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get('toolbar buttons', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('toolbar buttons description', 'Asset_RichEdit'),
-label=>$i18n->get('toolbar buttons'),
-hoverHelp=>$i18n->get('toolbar buttons description'),
-value=>$buttonGrid
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("askAboutRichEdit"),
-label=>WebGUI::International::get('using rich edit', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('using rich edit description', 'Asset_RichEdit'),
-label=>$i18n->get('using rich edit'),
-hoverHelp=>$i18n->get('using rich edit description'),
-name=>"askAboutRichEdit"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("preformatted"),
-label=>WebGUI::International::get('preformatted', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('preformatted description', 'Asset_RichEdit'),
-label=>$i18n->get('preformatted'),
-hoverHelp=>$i18n->get('preformatted description'),
-name=>"preformatted",
-uiLevel=>9
);
$tabform->getTab("security")->textarea(
-value=>$self->getValue("validElements"),
-name=>"validElements",
-label=>WebGUI::International::get('elements', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('elements description', 'Asset_RichEdit'),
-subtext=>WebGUI::International::get('elements subtext', 'Asset_RichEdit'),
-label=>$i18n->get('elements'),
-hoverHelp=>$i18n->get('elements description'),
-subtext=>$i18n->get('elements subtext'),
-uiLevel=>9
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("editorHeight"),
-label=>WebGUI::International::get('editor height', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('editor height description', 'Asset_RichEdit'),
-label=>$i18n->get('editor height'),
-hoverHelp=>$i18n->get('editor height description'),
-name=>"editorHeight",
-uiLevel=>9
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("editorWidth"),
-label=>WebGUI::International::get('editor width', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('editor width description', 'Asset_RichEdit'),
-label=>$i18n->get('editor width'),
-hoverHelp=>$i18n->get('editor width description'),
-name=>"editorWidth",
-uiLevel=>9
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("sourceEditorHeight"),
-label=>WebGUI::International::get('source editor height', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('source editor height description', 'Asset_RichEdit'),
-label=>$i18n->get('source editor height'),
-hoverHelp=>$i18n->get('source editor height description'),
-name=>"sourceEditorHeight"
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("sourceEditorWidth"),
-label=>WebGUI::International::get('source editor width', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('source editor width description', 'Asset_RichEdit'),
-label=>$i18n->get('source editor width'),
-hoverHelp=>$i18n->get('source editor width description'),
-name=>"sourceEditorWidth"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("useBr"),
-label=>WebGUI::International::get('use br', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('use br description', 'Asset_RichEdit'),
-label=>$i18n->get('use br'),
-hoverHelp=>$i18n->get('use br description'),
-name=>"useBr",
-uiLevel=>9
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("removeLineBreaks"),
-label=>WebGUI::International::get('remove line breaks', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('remove line breaks description', 'Asset_RichEdit'),
-label=>$i18n->get('remove line breaks'),
-hoverHelp=>$i18n->get('remove line breaks description'),
-name=>"removeLineBreaks",
-uiLevel=>9
);
$tabform->getTab("display")->yesNo(
-value=>$self->getValue("nowrap"),
-label=>WebGUI::International::get('no wrap', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('no wrap description', 'Asset_RichEdit'),
-label=>$i18n->get('no wrap'),
-hoverHelp=>$i18n->get('no wrap description'),
-name=>"nowrap",
-uiLevel=>9
);
$tabform->getTab("properties")->selectBox(
-value=>[$self->getValue("directionality")],
-label=>WebGUI::International::get('directionality', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('directionality description', 'Asset_RichEdit'),
-label=>$i18n->get('directionality'),
-hoverHelp=>$i18n->get('directionality description'),
-name=>"directionality",
-options=>{
ltr=>WebGUI::International::get('left to right', 'Asset_RichEdit'),
rtl=>WebGUI::International::get('right to left', 'Asset_RichEdit'),
ltr=>$i18n->get('left to right'),
rtl=>$i18n->get('right to left'),
}
);
$tabform->getTab("display")->selectBox(
-value=>[$self->getValue("toolbarLocation")],
-label=>WebGUI::International::get('toolbar location', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('toolbar location description', 'Asset_RichEdit'),
-label=>$i18n->get('toolbar location'),
-hoverHelp=>$i18n->get('toolbar location description'),
-name=>"toolbarLocation",
-options=>{
top=>WebGUI::International::get('top', 'Asset_RichEdit'),
bottom=>WebGUI::International::get('bottom', 'Asset_RichEdit'),
top=>$i18n->get('top'),
bottom=>$i18n->get('bottom'),
}
);
$tabform->getTab("properties")->text(
-value=>$self->getValue("cssFile"),
-label=>WebGUI::International::get('css file', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('css file description', 'Asset_RichEdit'),
-label=>$i18n->get('css file'),
-hoverHelp=>$i18n->get('css file description'),
-name=>"cssFile"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("enableContextMenu"),
-label=>WebGUI::International::get('enable context menu', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('enable context menu description', 'Asset_RichEdit'),
-label=>$i18n->get('enable context menu'),
-hoverHelp=>$i18n->get('enable context menu description'),
-name=>"enableContextMenu"
);
return $tabform;
@ -395,6 +397,7 @@ sub getRichEditor {
my @toolbarRow3 = split("\n",$self->getValue("toolbarRow3"));
my @toolbarButtons = (@toolbarRow1,@toolbarRow2,@toolbarRow3);
my @plugins;
my $i18n = WebGUI::International->new($self->session, 'Asset_RichEdit');
my %config = (
mode => "exact",
elements => $nameId,
@ -459,9 +462,9 @@ sub getRichEditor {
$config{theme_advanced_source_editor_height} = $self->getValue("sourceEditorHeight") if ($self->getValue("sourceEditorHeight") > 0);
}
}
my $language = WebGUI::International::getLanguage($self->session->user->profileField("language"),"languageAbbreviation");
my $language = $i18n->getLanguage($self->session->user->profileField("language"),"languageAbbreviation");
unless ($language) {
$language = WebGUI::International::getLanguage("English","languageAbbreviation");
$language = $i18n->getLanguage("English","languageAbbreviation");
}
$config{language} = $language;
$config{content_css} = $self->getValue("cssFile") || $self->session->config->get("extrasURL").'/tinymce2/defaultcontent.css';
@ -497,7 +500,8 @@ sub view {
sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("rich edit edit config","Asset_RichEdit"));
my $i18n = WebGUI::International->new($self->session,"Asset_RichEdit");
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get("rich edit edit config"));
}

View file

@ -30,18 +30,19 @@ sub _drawQueryBuilder {
my $self = shift;
# Initialize operators
my @textFields = qw|text yesNo selectList radioList|;
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
my %operator;
foreach (@textFields) {
$operator{$_} = {
"=" => WebGUI::International::get("is","Asset_Shortcut"),
"!=" => WebGUI::International::get("isnt","Asset_Shortcut")
"=" => $i18n->get("is"),
"!=" => $i18n->get("isnt")
};
}
$operator{integer} = {
"=" => WebGUI::International::get("equal to","Asset_Shortcut"),
"!=" => WebGUI::International::get("not equal to","Asset_Shortcut"),
"<" => WebGUI::International::get("less than","Asset_Shortcut"),
">" => WebGUI::International::get("greater than","Asset_Shortcut")
"=" => $i18n->get("equal to"),
"!=" => $i18n->get("not equal to"),
"<" => $i18n->get("less than"),
">" => $i18n->get("greater than")
};
# Get the fields and count them
@ -63,8 +64,8 @@ sub _drawQueryBuilder {
my $conjunctionField = WebGUI::Form::selectBox({
name=>"conjunction",
options=>{
"AND" => WebGUI::International::get("AND","Asset_Shortcut"),
"OR" => WebGUI::International::get("OR","Asset_Shortcut")},
"AND" => $i18n->get("AND"),
"OR" => $i18n->get("OR")},
value=>["OR"],
extras=>'class="qbselect"',
}
@ -136,8 +137,9 @@ sub _submenu {
my $ac = WebGUI::AdminConsole->new($self->session,"shortcutmanager");
$ac->setHelp($help) if ($help);
$ac->setIcon($self->getIcon);
$ac->addSubmenuItem($self->getUrl('func=edit'), WebGUI::International::get("Back to Edit Shortcut","Asset_Shortcut"));
$ac->addSubmenuItem($self->getUrl("func=manageOverrides"),WebGUI::International::get("Manage Shortcut Overrides","Asset_Shortcut"));
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
$ac->addSubmenuItem($self->getUrl('func=edit'), $i18n->get("Back to Edit Shortcut"));
$ac->addSubmenuItem($self->getUrl("func=manageOverrides"),$i18n->get("Manage Shortcut Overrides"));
return $ac->render($workarea, $title);
}
@ -158,8 +160,9 @@ sub canManage {
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Shortcut"),
assetName=>$i18n->get('assetName'),
icon=>'shortcut.gif',
tableName=>'Shortcut',
className=>'WebGUI::Asset::Shortcut',
@ -221,24 +224,24 @@ sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $originalTemplate;
my $i18n = WebGUI::International->new("Asset_Shortcut");
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get(1,"Asset_Shortcut"),
-hoverHelp=>WebGUI::International::get('1 description',"Asset_Shortcut"),
-label=>$i18n->get(1),
-hoverHelp=>$i18n->get('1 description'),
-value=>'<a href="'.$self->getShortcut->getUrl.'">'.$self->getShortcut->get('title').'</a> ('.$self->getShortcut->getId.')'
);
$tabform->getTab("display")->template(
-value=>$self->getValue("templateId"),
-label=>WebGUI::International::get('shortcut template title', 'Asset_Shortcut'),
-hoverHelp=>WebGUI::International::get('shortcut template title description', 'Asset_Shortcut'),
-label=>$i18n->get('shortcut template title'),
-hoverHelp=>$i18n->get('shortcut template title description'),
-namespace=>"Shortcut"
);
if($self->session->setting->get("metaDataEnabled")) {
$tabform->getTab("properties")->yesNo(
-name=>"shortcutByCriteria",
-value=>$self->getValue("shortcutByCriteria"),
-label=>WebGUI::International::get("Shortcut by alternate criteria","Asset_Shortcut"),
-hoverHelp=>WebGUI::International::get("Shortcut by alternate criteria description","Asset_Shortcut"),
-label=>$i18n->get("Shortcut by alternate criteria"),
-hoverHelp=>$i18n->get("Shortcut by alternate criteria description"),
-extras=>q|onchange="
if (this.form.shortcutByCriteria[0].checked) {
this.form.resolveMultiples.disabled=false;
@ -251,8 +254,8 @@ sub getEditForm {
$tabform->getTab("properties")->yesNo(
-name=>"disableContentLock",
-value=>$self->getValue("disableContentLock"),
-label=>WebGUI::International::get("disable content lock","Asset_Shortcut"),
-hoverHelp=>WebGUI::International::get("disable content lock description","Asset_Shortcut")
-label=>$i18n->get("disable content lock"),
-hoverHelp=>$i18n->get("disable content lock description")
);
if ($self->getValue("shortcutByCriteria") == 0) {
$self->{_disabled} = 'disabled=true';
@ -260,18 +263,18 @@ sub getEditForm {
$tabform->getTab("properties")->selectBox(
-name=>"resolveMultiples",
-value=>[ $self->getValue("resolveMultiples") ],
-label=>WebGUI::International::get("Resolve Multiples","Asset_Shortcut"),
-hoverHelp=>WebGUI::International::get("Resolve Multiples description","Asset_Shortcut"),
-label=>$i18n->get("Resolve Multiples"),
-hoverHelp=>$i18n->get("Resolve Multiples description"),
-options=>{
mostRecent=>WebGUI::International::get("Most Recent","Asset_Shortcut"),
random=>WebGUI::International::get("Random","Asset_Shortcut"),
mostRecent=>$i18n->get("Most Recent"),
random=>$i18n->get("Random"),
},
-extras=>$self->{_disabled}
);
$tabform->getTab("properties")->readOnly(
-value=>$self->_drawQueryBuilder(),
-label=>WebGUI::International::get("Criteria","Asset_Shortcut"),
-hoverHelp=>WebGUI::International::get("Criteria description","Asset_Shortcut")
-label=>$i18n->get("Criteria"),
-hoverHelp=>$i18n->get("Criteria description")
);
}
$tabform->addTab('overrides',$i18n->get('Overrides'));
@ -282,8 +285,8 @@ sub getEditForm {
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("showReloadIcon"),
-name=>"showReloadIcon",
-label=>WebGUI::International::get("show reload icon","Asset_Shortcut"),
-hoverHelp=>WebGUI::International::get("show reload icon description","Asset_Shortcut")
-label=>$i18n->get("show reload icon"),
-hoverHelp=>$i18n->get("show reload icon description")
);
}
return $tabform;
@ -306,7 +309,7 @@ sub getExtraHeadTags {
#-------------------------------------------------------------------
sub getFieldsList {
my $self = shift;
my $i18n = WebGUI::International->new("Asset_Shortcut");
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
my $output = '<a href="'.$self->getUrl('op=editProfileSettings').'" class="formLink">'.$i18n->get('Manage Profile Fields').'</a><br /><br />';
my %fieldNames;
tie %fieldNames, 'Tie::IxHash';
@ -345,7 +348,7 @@ sub getFieldsList {
sub getOverridesList {
my $self = shift;
my $output = '';
my $i18n = WebGUI::International->new("Asset_Shortcut");
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
my %overrides = $self->getOverrides;
$output .= '<table cellspacing="0" cellpadding="3" border="1">';
$output .= '<tr class="tableHeader"><td>'.$i18n->get('fieldName').'</td><td>'.$i18n->get('edit delete fieldname').'</td><td>'.$i18n->get('Original Value').'</td><td>'.$i18n->get('New value').'</td><td>'.$i18n->get('Replacement value').'</td></tr>';
@ -602,16 +605,17 @@ sub uncacheOverrides {
sub view {
my $self = shift;
my $content;
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
my $shortcut = $self->getShortcut;
if ($self->get("shortcutToAssetId") eq $self->get("parentId")) {
$content = WebGUI::International::get("Displaying this shortcut would cause a feedback loop","Asset_Shortcut");
$content = $i18n->get("Displaying this shortcut would cause a feedback loop");
} else {
$content = $shortcut->view;
}
my %var = (
isShortcut => 1,
'shortcut.content' => $content,
'shortcut.label' => WebGUI::International::get('assetName',"Asset_Shortcut"),
'shortcut.label' => $i18n->get('assetName'),
originalURL => $shortcut->getUrl,
'shortcut.url'=>$self->getUrl
);
@ -627,8 +631,9 @@ sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("shortcut add/edit","Asset_Shortcut");
$self->getAdminConsole->addSubmenuItem($self->getUrl("func=manageOverrides"),WebGUI::International::get("Manage Shortcut Overrides","Asset_Shortcut"));
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get(2,"Asset_Shortcut"));
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
$self->getAdminConsole->addSubmenuItem($self->getUrl("func=manageOverrides"),$i18n->get("Manage Shortcut Overrides"));
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get(2));
}
#-------------------------------------------------------------------
@ -676,7 +681,8 @@ sub www_getUserPrefsForm {
sub www_manageOverrides {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
return $self->_submenu($self->getOverridesList,WebGUI::International::get("Manage Shortcut Overrides","Asset_Shortcut"));
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
return $self->_submenu($self->getOverridesList,$i18n->get("Manage Shortcut Overrides"));
}
#-------------------------------------------------------------------
@ -703,16 +709,17 @@ sub www_saveUserPrefs {
my @fellowFields = $self->getPrefFieldsToShow;
my %data = ();
$self->uncacheOverrides;
my $i18n = WebGUI::International->new($self->session);
my $u = WebGUI::User->new($self->discernUserId);
foreach my $fieldId (keys %{$session{form}}) {
my $field = WebGUI::ProfileField->new($fieldId);
next unless $field;
$data{$field->getId} = $field->formProcess;
if ($field->getId eq 'email' && WebGUI::Operation::Profile::isDuplicateEmail($data{$field->getId})) {
return '<li>'.WebGUI::International::get(1072).'</li>';
return '<li>'.$i18n->get(1072).'</li>';
}
if ($field->isRequired && !$data{$field->getId}) {
return '<li>'.$field->getLabel.' '.WebGUI::International::get(451).'</li>';
return '<li>'.$field->getLabel.' '.$i18n->get(451).'</li>';
}
$u->profileField($field->getId,$data{$field->getId});
}
@ -731,7 +738,7 @@ sub www_getNewTitle {
sub www_editOverride {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
my $i18n = WebGUI::International->new("Asset_Shortcut");
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
my $fieldName = $self->session->form->process("fieldName");
my %overrides = $self->getOverrides;
my $output = '';

View file

@ -60,8 +60,9 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_Snippet");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Snippet"),
assetName=>$i18n->get('assetName'),
uiLevel => 5,
icon=>'snippet.gif',
tableName=>'snippet',
@ -104,20 +105,20 @@ sub getEditForm {
}
$tabform->getTab("properties")->codearea(
-name=>"snippet",
-label=>WebGUI::International::get('assetName', 'Asset_Snippet'),
-hoverHelp=>WebGUI::International::get('snippet description', 'Asset_Snippet'),
-label=>$i18n->get('assetName'),
-hoverHelp=>$i18n->get('snippet description'),
-value=>$self->getValue("snippet")
);
$tabform->getTab("properties")->yesNo(
-name=>"processAsTemplate",
-label=>WebGUI::International::get('process as template', 'Asset_Snippet'),
-hoverHelp=>WebGUI::International::get('process as template description', 'Asset_Snippet'),
-label=>$i18n->get('process as template'),
-hoverHelp=>$i18n->get('process as template description'),
-value=>$self->getValue("processAsTemplate")
);
$tabform->getTab("properties")->combo(
-name=>"mimeType",
-label=>WebGUI::International::get('mimeType', 'Asset_Snippet'),
-hoverHelp=>WebGUI::International::get('mimeType description', 'Asset_Snippet'),
-label=>$i18n->get('mimeType'),
-hoverHelp=>$i18n->get('mimeType description'),
-value=>[$self->getValue('mimeType')],
-options=>\%mimeTypes
);
@ -160,7 +161,8 @@ sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("snippet add/edit","Asset_Snippet");
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('snippet add/edit title',"Asset_Snippet"));
my $i18n = WebGUI::International->new($self->session, 'Asset_Snippet');
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get('snippet add/edit title'));
}
#-------------------------------------------------------------------

View file

@ -78,7 +78,8 @@ sub _execute {
return $t->output;
} else {
$self->session->errorHandler->error("Error in template. ".$@);
return WebGUI::International::get('template error', 'Asset_Template').$@;
my $i18n = WebGUI::International->new($self->session, 'Asset_Template');
return $i18n->get('template error').$@;
}
}
@ -98,8 +99,9 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session, 'Asset_Template');
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Template"),
assetName=>$i18n->get('assetName'),
icon=>'template.gif',
tableName=>'template',
className=>'WebGUI::Asset::Template',
@ -148,14 +150,14 @@ sub getEditForm {
$tabform->getTab("properties")->combo(
-name=>"namespace",
-options=>$namespaces,
-label=>WebGUI::International::get('namespace','Asset_Template'),
-hoverHelp=>WebGUI::International::get('namespace description','Asset_Template'),
-label=>$i18n->get('namespace'),
-hoverHelp=>$i18n->get('namespace description'),
-value=>[$self->session->form->process("namespace")]
);
} else {
$tabform->getTab("meta")->readOnly(
-label=>WebGUI::International::get('namespace','Asset_Template'),
-hoverHelp=>WebGUI::International::get('namespace description','Asset_Template'),
-label=>$i18n->get('namespace'),
-hoverHelp=>$i18n->get('namespace description'),
-value=>$self->getValue("namespace")
);
$tabform->getTab("meta")->hidden(
@ -166,13 +168,13 @@ sub getEditForm {
$tabform->getTab("display")->yesNo(
-name=>"showInForms",
-value=>$self->getValue("showInForms"),
-label=>WebGUI::International::get('show in forms', 'Asset_Template'),
-hoverHelp=>WebGUI::International::get('show in forms description', 'Asset_Template'),
-label=>$i18n->get('show in forms'),
-hoverHelp=>$i18n->get('show in forms description'),
);
$tabform->getTab("properties")->codearea(
-name=>"template",
-label=>WebGUI::International::get('assetName', 'Asset_Template'),
-hoverHelp=>WebGUI::International::get('template description', 'Asset_Template'),
-label=>$i18n->get('assetName'),
-hoverHelp=>$i18n->get('template description'),
-value=>$self->getValue("template")
);
return $tabform;
@ -328,8 +330,9 @@ sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("template add/edit","Asset_Template");
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=styleWizard'),WebGUI::International::get("style wizard","Asset_Template")) if ($self->get("namespace") eq "style");
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('edit template', 'Asset_Template'));
my $i18n = WebGUI::International->new($self->session, 'Asset_Template');
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=styleWizard'),$i18n->get("style wizard")) if ($self->get("namespace") eq "style");
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get('edit template'));
}
#-------------------------------------------------------------------
@ -532,8 +535,9 @@ $style .= '
$output .= WebGUI::Form::submit($self->session,);
$output .= WebGUI::Form::formFooter($self->session,);
}
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=edit'),WebGUI::International::get("edit template","Asset_Template")) if ($self->get("url"));
return $self->getAdminConsole->render($output,WebGUI::International::get('style wizard', 'Asset_Template'));
my $i18n = WebGUI::International->new($self->session, 'Asset_Template');
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=edit'),$i18n->get("edit template")) if ($self->get("url"));
return $self->getAdminConsole->render($output,$i18n->get('style wizard'));
}
#-------------------------------------------------------------------

View file

@ -66,6 +66,7 @@ An array of hashes to prepend to the list
sub definition {
my $class = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($self->session,'Wobject');
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
@ -73,47 +74,47 @@ sub definition {
fieldType=>'HTMLArea',
defaultValue=>undef,
tab=>"properties",
label=>WebGUI::International::get(85,'Wobject'),
hoverHelp=>WebGUI::International::get('85 description','Wobject')
label=>$i18n->get(85),
hoverHelp=>$i18n->get('85 description')
},
displayTitle=>{
fieldType=>'yesNo',
defaultValue=>1,
tab=>"display",
label=>WebGUI::International::get(174,'Wobject'),
hoverHelp=>WebGUI::International::get('174 description','Wobject'),
label=>$i18n->get(174),
hoverHelp=>$i18n->get('174 description'),
uiLevel=>5
},
cacheTimeout=>{
fieldType=>'interval',
defaultValue=>60,
tab=>"display",
label=>WebGUI::International::get(895,'Wobject'),
hoverHelp=>WebGUI::International::get('895 description','Wobject'),
label=>$i18n->get(895),
hoverHelp=>$i18n->get('895 description'),
uiLevel=>8
},
cacheTimeoutVisitor=>{
fieldType=>'interval',
defaultValue=>600,
tab=>"display",
label=>WebGUI::International::get(896,'Wobject'),
hoverHelp=>WebGUI::International::get('896 description','Wobject'),
label=>$i18n->get(896),
hoverHelp=>$i18n->get('896 description'),
uiLevel=>8
},
styleTemplateId=>{
fieldType=>'template',
defaultValue=>undef,
tab=>"display",
label=>WebGUI::International::get(1073,'Wobject'),
hoverHelp=>WebGUI::International::get('1073 description','Wobject'),
label=>$i18n->get(1073),
hoverHelp=>$i18n->get('1073 description'),
namespace=>'style'
},
printableStyleTemplateId=>{
fieldType=>'template',
defaultValue=>undef,
tab=>"display",
label=>WebGUI::International::get(1079,'Wobject'),
hoverHelp=>WebGUI::International::get('1079 description','Wobject'),
label=>$i18n->get(1079),
hoverHelp=>$i18n->get('1079 description'),
namespace=>'style'
}
);
@ -197,10 +198,11 @@ A comparison expression to be used when checking whether the action should be al
sub confirm {
return $self->session->privilege->vitalComponent() if ($_[4]);
my $noURL = $_[3] || $_[0]->getUrl;
my $output = '<h1>'.WebGUI::International::get(42,'Wobject').'</h1>';
my $i18n = WebGUI::International->new($self->session,'Wobject');
my $output = '<h1>'.$i18n->get(42).'</h1>';
$output .= $_[1].'<p>';
$output .= '<div align="center"><a href="'.$_[2].'">'.WebGUI::International::get(44,'Wobject').'</a>';
$output .= ' &nbsp; <a href="'.$noURL.'">'.WebGUI::International::get(45,'Wobject').'</a></div>';
$output .= '<div align="center"><a href="'.$_[2].'">'.$i18n->get(44).'</a>';
$output .= ' &nbsp; <a href="'.$noURL.'">'.$i18n->get(45).'</a></div>';
return $output;
}
@ -559,7 +561,8 @@ sub www_edit {
$tag =~ s/([a-z])([A-Z])/$1 $2/g; #Separate studly caps
$tag =~ s/([A-Z]+(?![a-z]))/$1 /g; #Separate acronyms
$self->getAdminConsole->setHelp(lc($tag)." add/edit", "Asset_".$tag2);
my $addEdit = ($self->session->form->process("func") eq 'add') ? WebGUI::International::get('add','Wobject') : WebGUI::International::get('edit','Wobject');
my $i18n = WebGUI::International->new($self->session,'Wobject');
my $addEdit = ($self->session->form->process("func") eq 'add') ? $i18n->get('add') : $i18n->get('edit');
return $self->getAdminConsole->render($self->getEditForm->print,$addEdit.' '.$self->getName);
}

View file

@ -70,7 +70,9 @@ text will come out formatted as paragraphs.
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,'Asset_Article');
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
@ -79,44 +81,44 @@ sub definition {
defaultValue=>'PBtmpl0000000000000002',
tab=>"display",
namespace=>"Article",
hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
label=>WebGUI::International::get(72,"Asset_Article")
hoverHelp=>$i18n->get('article template description'),
label=>$i18n->get(72)
},
linkURL=>{
tab=>"properties",
fieldType=>'url',
defaultValue=>undef,
label=>WebGUI::International::get(8,"Asset_Article"),
hoverHelp=>WebGUI::International::get('link url description','Asset_Article'),
label=>$i18n->get(8),
hoverHelp=>$i18n->get('link url description'),
uiLevel=>3
},
linkTitle=>{
tab=>"properties",
fieldType=>'text',
defaultValue=>undef,
label=>WebGUI::International::get(7,"Asset_Article"),
hoverHelp=>WebGUI::International::get('link title description','Asset_Article'),
label=>$i18n->get(7),
hoverHelp=>$i18n->get('link title description'),
uiLevel=>3
},
convertCarriageReturns=>{
tab=>"display",
fieldType=>'yesNo',
defaultValue=>0,
label=>WebGUI::International::get(10,"Asset_Article"),
subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,"Asset_Article").'</span>',
hoverHelp=>WebGUI::International::get('carriage return description','Asset_Article'),
label=>$i18n->get(10),
subtext=>' &nbsp; <span style="font-size: 8pt;">'.$i18n->get(11).'</span>',
hoverHelp=>$i18n->get('carriage return description'),
uiLevel=>5
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Article"),
assetName=>$i18n->get('assetName'),
icon=>'article.gif',
autoGenerateForms=>1,
tableName=>'Article',
className=>'WebGUI::Asset::Wobject::Article',
properties=>\%properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -117,7 +117,7 @@ sub appendPostListTemplateVars {
sub appendTemplateLabels {
my $self = shift;
my $var = shift;
my $i18n = WebGUI::International->new("Asset_Collaboration");
my $i18n = WebGUI::International->new($self->session, "Asset_Collaboration");
$var->{"add.label"} = $i18n->get("add");
$var->{"addlink.label"} = $i18n->get("addlink");
$var->{"addquestion.label"} = $i18n->get("addquestion");
@ -262,9 +262,11 @@ sub decrementThreads {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Collaboration");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Collaboration"),
assetName=>$i18n->get('assetName'),
icon=>'collaboration.gif',
tableName=>'Collaboration',
className=>'WebGUI::Asset::Wobject::Collaboration',
@ -415,7 +417,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -430,95 +432,96 @@ sub duplicate {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new($self->session,"Asset_Collaboration");
$tabform->getTab("display")->yesNo(
-value=>$self->getValue('displayLastReply'),
-label=>WebGUI::International::get('display last reply', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('display last reply description', 'Asset_Collaboration'),
-label=>$i18n->get('display last reply'),
-hoverHelp=>$i18n->get('display last reply description'),
-name=>"displayLastReply"
);
$tabform->getTab("display")->template(
-value=>$self->getValue('collaborationTemplateId'),
-namespace=>"Collaboration",
-label=>WebGUI::International::get('system template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('system template description', 'Asset_Collaboration'),
-label=>$i18n->get('system template'),
-hoverHelp=>$i18n->get('system template description'),
-name=>"collaborationTemplateId"
);
$tabform->getTab("display")->template(
-name=>"threadTemplateId",
-value=>$self->getValue("threadTemplateId"),
-namespace=>"Collaboration/Thread",
-label=>WebGUI::International::get('thread template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('thread template description', 'Asset_Collaboration'),
-label=>$i18n->get('thread template'),
-hoverHelp=>$i18n->get('thread template description'),
);
$tabform->getTab("display")->template(
-name=>"postFormTemplateId",
-value=>$self->getValue("postFormTemplateId"),
-namespace=>"Collaboration/PostForm",
-label=>WebGUI::International::get('post template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('post template description', 'Asset_Collaboration'),
-label=>$i18n->get('post template'),
-hoverHelp=>$i18n->get('post template description'),
);
$tabform->getTab("display")->template(
-name=>"searchTemplateId",
-value=>$self->getValue("SearchTemplateId"),
-namespace=>"Collaboration/Search",
-label=>WebGUI::International::get('search template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('search template description', 'Asset_Collaboration'),
-label=>$i18n->get('search template'),
-hoverHelp=>$i18n->get('search template description'),
);
$tabform->getTab("display")->template(
-name=>"notificationTemplateId",
-value=>$self->getValue("notificationTemplateId"),
-namespace=>"Collaboration/Notification",
-label=>WebGUI::International::get('notification template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('notification template description', 'Asset_Collaboration'),
-label=>$i18n->get('notification template'),
-hoverHelp=>$i18n->get('notification template description'),
);
$tabform->getTab("display")->template(
-name=>"rssTemplateId",
-value=>$self->getValue("rssTemplateId"),
-namespace=>"Collaboration/RSS",
-label=>WebGUI::International::get('rss template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('rss template description', 'Asset_Collaboration'),
-label=>$i18n->get('rss template'),
-hoverHelp=>$i18n->get('rss template description'),
);
$tabform->getTab("security")->group(
-name=>"moderateGroupId",
-label=>WebGUI::International::get('who moderates', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('who moderates description', 'Asset_Collaboration'),
-label=>$i18n->get('who moderates'),
-hoverHelp=>$i18n->get('who moderates description'),
-value=>[$self->getValue("moderateGroupId")]
);
$tabform->getTab("security")->group(
-name=>"postGroupId",
-label=>WebGUI::International::get('who posts', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('who posts description', 'Asset_Collaboration'),
-label=>$i18n->get('who posts'),
-hoverHelp=>$i18n->get('who posts description'),
-value=>[$self->getValue("postGroupId")]
);
$tabform->getTab("display")->integer(
-name=>"threadsPerPage",
-label=>WebGUI::International::get('threads/page', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('threads/page description', 'Asset_Collaboration'),
-label=>$i18n->get('threads/page'),
-hoverHelp=>$i18n->get('threads/page description'),
-value=>$self->getValue("threadsPerPage")
);
$tabform->getTab("display")->integer(
-name=>"postsPerPage",
-label=>WebGUI::International::get('posts/page', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('posts/page description', 'Asset_Collaboration'),
-label=>$i18n->get('posts/page'),
-hoverHelp=>$i18n->get('posts/page description'),
-value=>$self->getValue("postsPerPage")
);
if ($self->session->setting->get("useKarma")) {
$tabform->getTab("properties")->integer(
-name=>"karmaPerPost",
-label=>WebGUI::International::get('karma/post', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('karma/post description', 'Asset_Collaboration'),
-label=>$i18n->get('karma/post'),
-hoverHelp=>$i18n->get('karma/post description'),
-value=>$self->getValue("karmaPerPost")
);
$tabform->getTab("properties")->integer(
-name=>"karmaSpentToRate",
-label=>WebGUI::International::get('karma spent to rate', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('karma spent to rate description', 'Asset_Collaboration'),
-label=>$i18n->get('karma spent to rate'),
-hoverHelp=>$i18n->get('karma spent to rate description'),
-value=>$self->getValue("karmaSpentToRate")
);
$tabform->getTab("properties")->integer(
-name=>"karmaRatingMultiplier",
-label=>WebGUI::International::get('karma rating multiplier', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('karma rating multiplier description', 'Asset_Collaboration'),
$i18n->get('karma rating multiplier'),
-hoverHelp=>$i18n->get('karma rating multiplier description'),
-value=>$self->getValue("karmaRatingMultiplier")
);
} else {
@ -538,98 +541,98 @@ sub getEditForm {
$tabform->getTab("security")->filterContent(
-value=>$self->getValue("filterCode"),
-name=>"filterCode",
-label=>WebGUI::International::get('filter code', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('filter code description', 'Asset_Collaboration'),
-label=>$i18n->get('filter code'),
-hoverHelp=>$i18n->get('filter code description'),
);
my %options;
tie %options, 'Tie::IxHash';
%options = (
lineage=>WebGUI::International::get('sequence', 'Asset_Collaboration'),
dateUpdated=>WebGUI::International::get('date updated', 'Asset_Collaboration'),
dateSubmitted=>WebGUI::International::get('date submitted', 'Asset_Collaboration'),
title=>WebGUI::International::get('title', 'Asset_Collaboration'),
userDefined1=>WebGUI::International::get('user defined 1', 'Asset_Collaboration'),
userDefined2=>WebGUI::International::get('user defined 2', 'Asset_Collaboration'),
userDefined3=>WebGUI::International::get('user defined 3', 'Asset_Collaboration'),
userDefined4=>WebGUI::International::get('user defined 4', 'Asset_Collaboration'),
userDefined5=>WebGUI::International::get('user defined 5', 'Asset_Collaboration'),
lineage=>$i18n->get('sequence'),
dateUpdated=>$i18n->get('date updated'),
dateSubmitted=>$i18n->get('date submitted'),
title=>$i18n->get('title'),
userDefined1=>$i18n->get('user defined 1'),
userDefined2=>$i18n->get('user defined 2'),
userDefined3=>$i18n->get('user defined 3'),
userDefined4=>$i18n->get('user defined 4'),
userDefined5=>$i18n->get('user defined 5'),
);
$tabform->getTab("display")->selectBox(
-name=>"sortBy",
-value=>[$self->getValue("sortBy")],
-options=>\%options,
-label=>WebGUI::International::get('sort by', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('sort by description', 'Asset_Collaboration'),
-label=>$i18n->get('sort by'),
-hoverHelp=>$i18n->get('sort by description'),
);
$tabform->getTab("display")->selectBox(
-name=>"sortOrder",
-value=>[$self->getValue("sortOrder")],
-options=>{
asc=>WebGUI::International::get('ascending', 'Asset_Collaboration'),
desc=>WebGUI::International::get('descending', 'Asset_Collaboration'),
asc=>$i18n->get('ascending'),
desc=>$i18n->get('descending'),
},
-label=>WebGUI::International::get('sort order', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('sort order description', 'Asset_Collaboration'),
-label=>$i18n->get('sort order'),
-hoverHelp=>$i18n->get('sort order description'),
);
$tabform->getTab("properties")->interval(
-name=>"archiveAfter",
-label=>WebGUI::International::get('archive after', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('archive after description', 'Asset_Collaboration'),
-label=>$i18n->get('archive after'),
-hoverHelp=>$i18n->get('archive after description'),
-value=>$self->getValue("archiveAfter")
);
$tabform->getTab("properties")->integer(
-name=>"attachmentsPerPost",
-label=>WebGUI::International::get('attachments/post', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('attachments/post description', 'Asset_Collaboration'),
-label=>$i18n->get('attachments/post'),
-hoverHelp=>$i18n->get('attachments/post description'),
-value=>$self->getValue("attachmentsPerPost")
);
$tabform->getTab("security")->interval(
-name=>"editTimeout",
-label=>WebGUI::International::get('edit timeout', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('edit timeout description', 'Asset_Collaboration'),
-label=>$i18n->get('edit timeout'),
-hoverHelp=>$i18n->get('edit timeout description'),
-value=>$self->getValue("editTimeout")
);
$tabform->getTab("security")->yesNo(
-name=>"allowReplies",
-label=>WebGUI::International::get('allow replies', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('allow replies description', 'Asset_Collaboration'),
-label=>$i18n->get('allow replies'),
-hoverHelp=>$i18n->get('allow replies description'),
-value=>$self->getValue("allowReplies")
);
$tabform->getTab("security")->yesNo(
-name=>"addEditStampToPosts",
-label=>WebGUI::International::get('edit stamp', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('edit stamp description', 'Asset_Collaboration'),
-label=>$i18n->get('edit stamp'),
-hoverHelp=>$i18n->get('edit stamp description'),
-value=>$self->getValue("addEditStampToPosts")
);
$tabform->getTab("display")->selectBox(
-name=>"richEditor",
-label=>WebGUI::International::get('rich editor', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('rich editor description', 'Asset_Collaboration'),
-label=>$i18n->get('rich editor'),
-hoverHelp=>$i18n->get('rich editor description'),
-options=>$self->session->db->buildHashRef("select distinct(assetData.assetId), assetData.title from asset, assetData where asset.className='WebGUI::Asset::RichEdit' and asset.assetId=assetData.assetId order by assetData.title"),
-value=>[$self->getValue("richEditor")]
);
$tabform->getTab("display")->yesNo(
-name=>"useContentFilter",
-label=>WebGUI::International::get('content filter', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('content filter description', 'Asset_Collaboration'),
-label=>$i18n->get('content filter'),
-hoverHelp=>$i18n->get('content filter description'),
-value=>$self->getValue("useContentFilter")
);
$tabform->getTab("properties")->yesNo(
-name=>"usePreview",
-label=>WebGUI::International::get('use preview', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('use preview description', 'Asset_Collaboration'),
-label=>$i18n->get('use preview'),
-hoverHelp=>$i18n->get('use preview description'),
-value=>$self->getValue("usePreview")
);
$tabform->getTab("properties")->yesNo(
-name=>"avatarsEnabled",
-label=>WebGUI::International::get('enable avatars', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('enable avatars description', 'Asset_Collaboration'),
-label=>$i18n->get('enable avatars'),
-hoverHelp=>$i18n->get('enable avatars description'),
-value=>$self->getValue("avatarsEnabled")
);
$tabform->getTab("security")->yesNo(
-name=>"moderatePosts",
-label=>WebGUI::International::get('moderate', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('moderate description', 'Asset_Collaboration'),
-label=>$i18n->get('moderate'),
-hoverHelp=>$i18n->get('moderate description'),
-value=>$self->getValue("moderatePosts")
);
return $tabform;
@ -959,6 +962,7 @@ sub www_search {
$self->session->scratch->set($self->getId."_exactPhrase",$self->session->form->process("exactPhrase"));
$self->session->scratch->set($self->getId."_without",$self->session->form->process("without"));
$self->session->scratch->set($self->getId."_numResults",$self->session->form->process("numResults"));
my $i18n = WebGUI::International->new($self->session, 'Asset_Collaboration');
my %var;
$var{'form.header'} = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl})
.WebGUI::Form::hidden($self->session,{ name=>"func", value=>"search" })
@ -992,7 +996,7 @@ sub www_search {
options=>\%results,
value=>[$numResults]
});
$var{'form.search'} = WebGUI::Form::submit($self->session,{value=>WebGUI::International::get(170)});
$var{'form.search'} = WebGUI::Form::submit($self->session,{value=>$i18n->get(170)});
$var{'form.footer'} = WebGUI::Form::formFooter($self->session,);
$var{'back.url'} = $self->getUrl;
$self->appendTemplateLabels(\%var);

View file

@ -43,6 +43,7 @@ sub canPersonalize {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
return $class->SUPER::definition($definition);
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
@ -71,14 +72,15 @@ sub definition {
},
);
my $i18n = WebGUI::International->new($session,"Asset_Dashboard");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Dashboard"),
assetName=>$i18n->get('assetName'),
icon=>'dashboard.gif',
tableName=>'Dashboard',
className=>'WebGUI::Asset::Wobject::Dashboard',
properties=>\%properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -99,7 +101,7 @@ sub discernUserId {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new("Asset_Dashboard");
my $i18n = WebGUI::International->new($self->session, "Asset_Dashboard");
$tabform->getTab("display")->template(
-name=>"templateId",
-value=>$self->getValue('templateId'),
@ -130,8 +132,8 @@ sub getEditForm {
-name=>"assetsToHide",
-value=>\@assetsToHide,
-options=>\%childIds,
-label=>WebGUI::International::get('assets to hide', 'Asset_Layout'),
-hoverHelp=>WebGUI::International::get('assets to hide description', 'Asset_Layout'),
-label=>$i18n->get('assets to hide', 'Asset_Layout'),
-hoverHelp=>$i18n->get('assets to hide description', 'Asset_Layout'),
-vertical=>1,
-uiLevel=>9
);
@ -302,4 +304,4 @@ sub www_view {
1;
1;

View file

@ -90,8 +90,9 @@ sub _fieldAdminIcons {
my $fid = shift;
my $tid = shift;
my $cantDelete = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
my $output;
$output = $self->session->icon->delete('func=deleteFieldConfirm;fid='.$fid.';tid='.$tid,$self->get("url"),WebGUI::International::get(19,"Asset_DataForm")) unless ($cantDelete);
$output = $self->session->icon->delete('func=deleteFieldConfirm;fid='.$fid.';tid='.$tid,$self->get("url"),$i18n->get(19)) unless ($cantDelete);
$output .= $self->session->icon->edit('func=editField;fid='.$fid.';tid='.$tid,$self->get("url"))
.$self->session->icon->moveUp('func=moveFieldUp;fid='.$fid.';tid='.$tid,$self->get("url"))
.$self->session->icon->moveDown('func=moveFieldDown;fid='.$fid.';tid='.$tid,$self->get("url"));
@ -102,8 +103,9 @@ sub _tabAdminIcons {
my $self = shift;
my $tid = shift;
my $cantDelete = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
my $output;
$output = $self->session->icon->delete('func=deleteTabConfirm;tid='.$tid,$self->get("url"),WebGUI::International::get(100,"Asset_DataForm")) unless ($cantDelete);
$output = $self->session->icon->delete('func=deleteTabConfirm;tid='.$tid,$self->get("url"),$i18n->get(100)) unless ($cantDelete);
$output .= $self->session->icon->edit('func=editTab;tid='.$tid,$self->get("url"))
.$self->session->icon->moveLeft('func=moveTabLeft;tid='.$tid,$self->get("url"))
.$self->session->icon->moveRight('func=moveTabRight;tid='.$tid,$self->get("url"));
@ -135,9 +137,11 @@ sub defaultViewForm {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_DataForm");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_DataForm"),
assetName=>$i18n->get('assetName'),
uiLevel => 5,
tableName=>'DataForm',
icon=>'dataForm.gif',
@ -177,7 +181,7 @@ sub definition {
},
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -212,13 +216,14 @@ sub duplicate {
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
my $tabform = $self->SUPER::getEditForm;
$tabform->getTab("display")->template(
-name=>"templateId",
-value=>$self->getValue("templateId"),
-namespace=>"DataForm",
-label=>WebGUI::International::get(82,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('82 description',"Asset_DataForm"),
-label=>$i18n->get(82),
-hoverHelp=>$i18n->get('82 description'),
-afterEdit=>'func=edit',
-defaultValue=>"PBtmpl0000000000000141"
);
@ -226,59 +231,59 @@ sub getEditForm {
-name=>"emailTemplateId",
-value=>$self->getValue("emailTemplateId"),
-namespace=>"DataForm",
-label=>WebGUI::International::get(80,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('80 description',"Asset_DataForm"),
-label=>$i18n->get(80),
-hoverHelp=>$i18n->get('80 description'),
-afterEdit=>'func=edit'
);
$tabform->getTab("display")->template(
-name=>"acknowlegementTemplateId",
-value=>$self->getValue("acknowlegementTemplateId"),
-namespace=>"DataForm",
-label=>WebGUI::International::get(81,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('81 description',"Asset_DataForm"),
-label=>$i18n->get(81),
-hoverHelp=>$i18n->get('81 description'),
-afterEdit=>'func=edit'
);
$tabform->getTab("display")->template(
-name=>"listTemplateId",
-value=>$self->getValue("listTemplateId"),
-namespace=>"DataForm/List",
-label=>WebGUI::International::get(87,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('87 description',"Asset_DataForm"),
-label=>$i18n->get(87),
-hoverHelp=>$i18n->get('87 description'),
-afterEdit=>'func=edit'
);
$tabform->getTab("display")->radioList(
-name=>"defaultView",
-options=>{ 0 => WebGUI::International::get('data form','Asset_DataForm'),
1 => WebGUI::International::get('data list','Asset_DataForm'),},
-label=>WebGUI::International::get('defaultView',"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('defaultView description',"Asset_DataForm"),
-options=>{ 0 => $i18n->get('data form'),
1 => $i18n->get('data list'),},
-label=>$i18n->get('defaultView'),
-hoverHelp=>$i18n->get('defaultView description'),
-value=>$self->getValue("defaultView"),
);
$tabform->getTab("properties")->HTMLArea(
-name=>"acknowledgement",
-label=>WebGUI::International::get(16, "Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('16 description', "Asset_DataForm"),
-value=>($self->get("acknowledgement") || WebGUI::International::get(3, "Asset_DataForm"))
-label=>$i18n->get(16),
-hoverHelp=>$i18n->get('16 description'),
-value=>($self->get("acknowledgement") || $i18n->get(3))
);
$tabform->getTab("properties")->yesNo(
-name=>"mailData",
-label=>WebGUI::International::get(74,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('74 description',"Asset_DataForm"),
-label=>$i18n->get(74),
-hoverHelp=>$i18n->get('74 description'),
-value=>$self->getValue("mailData")
);
$tabform->getTab("security")->group(
-name=>"groupToViewEntries",
-label=>WebGUI::International::get('group to view entries', "Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('group to view entries description',"Asset_DataForm"),
-label=>$i18n->get('group to view entries'),
-hoverHelp=>$i18n->get('group to view entries description'),
-value=>$self->getValue("groupToViewEntries")
);
if ($self->getId eq "new" && $self->session->form->process("proceed") ne "manageAssets") {
$tabform->getTab("properties")->whatNext(
-options=>{
editField=>WebGUI::International::get(76,"Asset_DataForm"),
""=>WebGUI::International::get(745,"Asset_DataForm")
editField=>$i18n->get(76),
""=>$i18n->get(745)
},
-value=>"editField"
);
@ -292,12 +297,13 @@ sub getEditForm {
sub getListTemplateVars {
my $self = shift;
my $var = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
my @fieldLoop;
$var->{"back.url"} = $self->getFormUrl;
$var->{"back.label"} = WebGUI::International::get('go to form',"Asset_DataForm");
$var->{"back.label"} = $i18n->get('go to form');
#$var->{"entryId"} = $self->getId;
#$var->{"delete.url"} = $self->getUrl.";func=deleteAllEntries";
#$var->{"delete.label"} = WebGUI::International::get(91,"Asset_DataForm");
#$var->{"delete.label"} = $i18n->get(91);
my $fields = $self->session->db->read("select DataForm_fieldId,name,label,isMailField,type from DataForm_field
where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
while (my $field = $fields->hashRef) {
@ -333,7 +339,7 @@ sub getListTemplateVars {
"record.edit.url"=>$self->getUrl("func=view;entryId=".$record->{DataForm_entryId}),
"record.edit.icon"=>$self->session->icon->edit("func=view;entryId=".$record->{DataForm_entryId}, $self->getUrl),
"record.delete.url"=>$self->getUrl("func=deleteEntry;entryId=".$record->{DataForm_entryId}),
"record.delete.icon"=>$self->session->icon->delete("func=deleteEntry;entryId=".$record->{Asset_DataForm_entryId}, $self->getUrl, WebGUI::International::get('Delete entry confirmation',"Asset_DataForm")),
"record.delete.icon"=>$self->session->icon->delete("func=deleteEntry;entryId=".$record->{Asset_DataForm_entryId}, $self->getUrl, $i18n->get('Delete entry confirmation')),
"record.username"=>$record->{username},
"record.userId"=>$record->{userId},
"record.submissionDate.epoch"=>$record->{submissionDate},
@ -381,21 +387,22 @@ sub getListUrl {
sub getRecordTemplateVars {
my $self = shift;
my $var = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
$var->{error_loop} = [] unless (exists $var->{error_loop});
$var->{canEdit} = ($self->canEdit);
#$var->{"entryList.url"} = $self->getUrl('func=view;entryId=list');
$var->{"entryList.url"} = $self->getListUrl;
$var->{"entryList.label"} = WebGUI::International::get(86,"Asset_DataForm");
$var->{"entryList.label"} = $i18n->get(86);
$var->{"export.tab.url"} = $self->getUrl('func=exportTab');
$var->{"export.tab.label"} = WebGUI::International::get(84,"Asset_DataForm");
$var->{"export.tab.label"} = $i18n->get(84);
$var->{"delete.url"} = $self->getUrl('func=deleteEntry;entryId='.$var->{entryId});
$var->{"delete.label"} = WebGUI::International::get(90,"Asset_DataForm");
$var->{"delete.label"} = $i18n->get(90);
$var->{"back.url"} = $self->getUrl;
$var->{"back.label"} = WebGUI::International::get(18,"Asset_DataForm");
$var->{"back.label"} = $i18n->get(18);
$var->{"addField.url"} = $self->getUrl('func=editField');
$var->{"addField.label"} = WebGUI::International::get(76,"Asset_DataForm");
$var->{"addField.label"} = $i18n->get(76);
# add Tab label, url, header and init
$var->{"addTab.label"}= WebGUI::International::get(105,"Asset_DataForm");;
$var->{"addTab.label"}= $i18n->get(105);;
$var->{"addTab.url"}= $self->getUrl('func=editTab');
$var->{"tab.init"}= _createTabInit($self->getId);
$var->{"form.start"} = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl})
@ -507,7 +514,7 @@ sub getRecordTemplateVars {
$var->{field_loop} = \@fields;
$tabsth->finish;
$var->{tab_loop} = \@tabs;
$var->{"form.send"} = WebGUI::Form::submit($self->session,{value=>WebGUI::International::get(73, "Asset_DataForm")});
$var->{"form.send"} = WebGUI::Form::submit($self->session,{value=>$i18n->get(73)});
$var->{"form.save"} = WebGUI::Form::submit($self->session,);
$var->{"form.end"} = WebGUI::Form::formFooter($self->session,);
return $var;
@ -519,12 +526,13 @@ sub getRecordTemplateVars {
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
my $i18n = WebGUI::International->new($self->session, "Asset_DataForm");
if ($self->session->form->process("assetId") eq "new") {
$self->setCollateral("DataForm_field","DataForm_fieldId",{
DataForm_fieldId=>"new",
DataForm_tabId=>0,
name=>"from",
label=>WebGUI::International::get(10,"Asset_DataForm"),
label=>$i18n->get(10),
status=>"editable",
isMailField=>1,
width=>0,
@ -534,7 +542,7 @@ sub processPropertiesFromFormPost {
DataForm_fieldId=>"new",
DataForm_tabId=>0,
name=>"to",
label=>WebGUI::International::get(11,"Asset_DataForm"),
label=>$i18n->get(11),
status=>"hidden",
isMailField=>1,
width=>0,
@ -545,7 +553,7 @@ sub processPropertiesFromFormPost {
DataForm_fieldId=>"new",
DataForm_tabId=>0,
name=>"cc",
label=>WebGUI::International::get(12,"Asset_DataForm"),
label=>$i18n->get(12),
status=>"hidden",
isMailField=>1,
width=>0,
@ -555,7 +563,7 @@ sub processPropertiesFromFormPost {
DataForm_fieldId=>"new",
DataForm_tabId=>0,
name=>"bcc",
label=>WebGUI::International::get(13,"Asset_DataForm"),
label=>$i18n->get(13),
status=>"hidden",
isMailField=>1,
width=>0,
@ -565,12 +573,12 @@ sub processPropertiesFromFormPost {
DataForm_fieldId=>"new",
DataForm_tabId=>0,
name=>"subject",
label=>WebGUI::International::get(14,"Asset_DataForm"),
label=>$i18n->get(14),
status=>"editable",
isMailField=>1,
width=>0,
type=>"text",
defaultValue=>WebGUI::International::get(2,"Asset_DataForm")
defaultValue=>$i18n->get(2)
});
}
if ($self->session->form->process("fid") eq "new") { # hack to get proceed to work.
@ -742,21 +750,22 @@ sub www_deleteTabConfirm {
sub www_editField {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
my (%field, $f, %fieldStatus,$tab);
tie %field, 'Tie::CPHash';
tie %fieldStatus, 'Tie::IxHash';
%fieldStatus = (
"hidden" => WebGUI::International::get(4, "Asset_DataForm"),
"visible" => WebGUI::International::get(5, "Asset_DataForm"),
"editable" => WebGUI::International::get(6, "Asset_DataForm"),
"required" => WebGUI::International::get(75, "Asset_DataForm")
"hidden" => $i18n->get(4),
"visible" => $i18n->get(5),
"editable" => $i18n->get(6),
"required" => $i18n->get(75)
);
$self->session->form->process("fid") = "new" if ($self->session->form->process("fid") eq "");
unless ($self->session->form->process("fid") eq "new") {
%field = $self->session->db->quickHash("select * from DataForm_field where DataForm_fieldId=".$self->session->db->quote($self->session->form->process("fid")));
}
$tab = $self->session->db->buildHashRef("select DataForm_tabId,label from DataForm_tab where assetId=".$self->session->db->quote($self->getId));
$tab->{0} = WebGUI::International::get("no tab","Asset_DataForm");
$tab->{0} = $i18n->get("no tab");
$f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name => "fid",
@ -768,96 +777,96 @@ sub www_editField {
);
$f->text(
-name=>"label",
-label=>WebGUI::International::get(77,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('77 description',"Asset_DataForm"),
-label=>$i18n->get(77),
-hoverHelp=>$i18n->get('77 description'),
-value=>$field{label}
);
$f->text(
-name=>"name",
-label=>WebGUI::International::get(21,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('21 description',"Asset_DataForm"),
-label=>$i18n->get(21),
-hoverHelp=>$i18n->get('21 description'),
-value=>$field{name}
);
if($field{sequenceNumber} && ! $field{isMailField}) {
$f->integer(
-name=>"position",
-label=>WebGUI::International::get('Field Position',"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('Field Position description',"Asset_DataForm"),
-label=>$i18n->get('Field Position'),
-hoverHelp=>$i18n->get('Field Position description'),
-value=>$field{sequenceNumber}
);
}
$f->selectBox(
-name=>"tid",
-options=>$tab,
-label=>WebGUI::International::get(104,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('104 description',"Asset_DataForm"),
-label=>$i18n->get(104),
-hoverHelp=>$i18n->get('104 description'),
-value=>[ $field{DataForm_tabId} || 0 ]
);
$f->text(
-name=>"subtext",
-value=>$field{subtext},
-label=>WebGUI::International::get(79,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('79 description',"Asset_DataForm"),
-label=>$i18n->get(79),
-hoverHelp=>$i18n->get('79 description'),
);
$f->selectBox(
-name=>"status",
-options=>\%fieldStatus,
-label=>WebGUI::International::get(22,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('22 description',"Asset_DataForm"),
-label=>$i18n->get(22),
-hoverHelp=>$i18n->get('22 description'),
-value=> [ $field{status} || "editable" ] ,
);
$f->fieldType(
-name=>"type",
-label=>WebGUI::International::get(23,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('23 description',"Asset_DataForm"),
-label=>$i18n->get(23),
-hoverHelp=>$i18n->get('23 description'),
-value=>$field{type} || "text",
-types=>[qw(dateTime TimeField float zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkList)]
);
$f->integer(
-name=>"width",
-label=>WebGUI::International::get(8,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('8 description',"Asset_DataForm"),
-label=>$i18n->get(8),
-hoverHelp=>$i18n->get('8 description'),
-value=>($field{width} || 0)
);
$f->integer(
-name=>"rows",
-value=>$field{rows} || 0,
-label=>WebGUI::International::get(27,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('27 description',"Asset_DataForm"),
-subtext=>WebGUI::International::get(28,"Asset_DataForm"),
-label=>$i18n->get(27),
-hoverHelp=>$i18n->get('27 description'),
-subtext=>$i18n->get(28),
);
$f->yesNo(
-name=>"vertical",
-value=>$field{vertical},
-label=>WebGUI::International::get('editField vertical label', "Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('editField vertical label description', "Asset_DataForm"),
-subtext=>WebGUI::International::get('editField vertical subtext', "Asset_DataForm")
-label=>$i18n->get('editField vertical label'),
-hoverHelp=>$i18n->get('editField vertical label description'),
-subtext=>$i18n->get('editField vertical subtext')
);
$f->text(
-name=>"extras",
-value=>$field{extras},
-label=>WebGUI::International::get('editField extras label', "Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('editField extras label description', "Asset_DataForm"),
-label=>$i18n->get('editField extras label'),
-hoverHelp=>$i18n->get('editField extras label description'),
);
$f->textarea(
-name=>"possibleValues",
-label=>WebGUI::International::get(24,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('24 description',"Asset_DataForm"),
-label=>$i18n->get(24),
-hoverHelp=>$i18n->get('24 description'),
-value=>$field{possibleValues},
-subtext=>'<br />'.WebGUI::International::get(85,"Asset_DataForm")
-subtext=>'<br />'.$i18n->get(85)
);
$f->textarea(
-name=>"defaultValue",
-label=>WebGUI::International::get(25,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('25 description',"Asset_DataForm"),
-label=>$i18n->get(25),
-hoverHelp=>$i18n->get('25 description'),
-value=>$field{defaultValue},
-subtext=>'<br />'.WebGUI::International::get(85,"Asset_DataForm")
-subtext=>'<br />'.$i18n->get(85)
);
if ($self->session->form->process("fid") eq "new" && $self->session->form->process("proceed") ne "manageAssets") {
$f->whatNext(
-options=>{
"editField"=>WebGUI::International::get(76,"Asset_DataForm"),
"viewDataForm"=>WebGUI::International::get(745,"Asset_DataForm")
"editField"=>$i18n->get(76),
"viewDataForm"=>$i18n->get(745)
},
-value=>"editField"
);
@ -865,7 +874,7 @@ sub www_editField {
$f->submit;
my $ac = $self->getAdminConsole;
$ac->setHelp("data form fields add/edit","Asset_DataForm");
return $ac->render($f->print,WebGUI::International::get('20',"Asset_DataForm"));
return $ac->render($f->print,$i18n->get('20'));
}
#-------------------------------------------------------------------
@ -908,6 +917,7 @@ sub www_editFieldSave {
sub www_editTab {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
my (%tab, $f);
tie %tab, 'Tie::CPHash';
$self->session->form->process("tid") = "new" if ($self->session->form->process("tid") eq "");
@ -925,20 +935,20 @@ sub www_editTab {
);
$f->text(
-name=>"label",
-label=>WebGUI::International::get(101,"Asset_DataForm"),
-label=>$i18n->get(101),
-value=>$tab{label}
);
$f->textarea(
-name=>"subtext",
-label=>WebGUI::International::get(79,"Asset_DataForm"),
-label=>$i18n->get(79),
-value=>$tab{subtext},
-subtext=>""
);
if ($self->session->form->process("tid") eq "new") {
$f->whatNext(
-options=>{
editTab=>WebGUI::International::get(103,"Asset_DataForm"),
""=>WebGUI::International::get(745,"Asset_DataForm")
editTab=>$i18n->get(103),
""=>$i18n->get(745)
},
-value=>"editTab"
);
@ -946,7 +956,7 @@ sub www_editTab {
$f->submit;
my $ac = $self->getAdminConsole;
$ac->setHelp("data form fields add/edit","Asset_DataForm");
return $ac->render($f->print,WebGUI::International::get('20',"Asset_DataForm"));
return $ac->render($f->print,$i18n->get('20'));
}
#-------------------------------------------------------------------
@ -1064,6 +1074,7 @@ sub www_process {
},0);
my ($var, %row, @errors, $updating, $hadErrors);
$var->{entryId} = $entryId;
my $i18n = WebGUI::International->new($self->session,"Asset_DataForm");
tie %row, "Tie::CPHash";
my $sth = $self->session->db->read("select DataForm_fieldId,label,name,status,type,defaultValue,isMailField from DataForm_field
where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
@ -1076,7 +1087,7 @@ sub www_process {
}
if ($row{status} eq "required" && ($value =~ /^\s$/ || $value eq "" || not defined $value)) {
push (@errors,{
"error.message"=>$row{label}." ".WebGUI::International::get(29,"Asset_DataForm").".",
"error.message"=>$row{label}." ".$i18n->get(29).".",
});
$hadErrors = 1;
delete $var->{entryId};

View file

@ -41,9 +41,11 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_EventsCalendar");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_EventsCalendar"),
assetName=>$i18n->get('assetName'),
uiLevel => 9,
icon=>'calendar.gif',
tableName=>'EventsCalendar',
@ -79,7 +81,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -107,75 +109,76 @@ sub epochToArray {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_EventsCalendar");
$tabform->getTab("properties")->selectBox(
-name=>"scope",
-label=>WebGUI::International::get(507,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('507 description',"Asset_EventsCalendar"),
-label=>$i18n->get(507),
-hoverHelp=>$i18n->get('507 description'),
-value=>[$self->getValue("scope")],
-options=>{
0=>WebGUI::International::get(508,"Asset_EventsCalendar"),
1=>WebGUI::International::get(510,"Asset_EventsCalendar"),
2=>WebGUI::International::get(509,"Asset_EventsCalendar"),
0=>$i18n->get(508),
1=>$i18n->get(510),
2=>$i18n->get(509),
}
);
$tabform->getTab("display")->template(
-name=>"templateId",
-label=>WebGUI::International::get(94,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('94 description',"Asset_EventsCalendar"),
-label=>$i18n->get(94),
-hoverHelp=>$i18n->get('94 description'),
-value=>$self->getValue('templateId'),
-namespace=>"EventsCalendar"
);
$tabform->getTab("display")->template(
-name=>"eventTemplateId",
-label=>WebGUI::International::get(80,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('80 description',"Asset_EventsCalendar"),
-label=>$i18n->get(80),
-hoverHelp=>$i18n->get('80 description'),
-value=>$self->getValue('eventTemplateId'),
-namespace=>"EventsCalendar/Event",
);
$tabform->getTab("display")->selectBox(
-name=>"startMonth",
-options=>{
"january"=>WebGUI::International::get('january','DateTime'),
"now"=>WebGUI::International::get(98,"Asset_EventsCalendar"),
"current"=>WebGUI::International::get(82,"Asset_EventsCalendar"),
"first"=>WebGUI::International::get(83,"Asset_EventsCalendar")
"january"=>$i18n->get('january'),
"now"=>$i18n->get(98),
"current"=>$i18n->get(82),
"first"=>$i18n->get(83)
},
-label=>WebGUI::International::get(81,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('81 description',"Asset_EventsCalendar"),
-label=>$i18n->get(81),
-hoverHelp=>$i18n->get('81 description'),
-value=>[$self->getValue("startMonth")]
);
my %options;
tie %options, 'Tie::IxHash';
%options = (
"last"=>WebGUI::International::get(85,"Asset_EventsCalendar"),
"after12"=>WebGUI::International::get(86,"Asset_EventsCalendar"),
"after9"=>WebGUI::International::get(87,"Asset_EventsCalendar"),
"after6"=>WebGUI::International::get(88,"Asset_EventsCalendar"),
"after3"=>WebGUI::International::get(89,"Asset_EventsCalendar"),
"current"=>WebGUI::International::get(82,"Asset_EventsCalendar")
"last"=>$i18n->get(85),
"after12"=>$i18n->get(86),
"after9"=$i18n->get(87),
"after6"=>$i18n->get(88),
"after3"=>$i18n->get(89),
"current"=>$i18n->get(82)
);
$tabform->getTab("display")->selectBox(
-name=>"endMonth",
-options=>\%options,
-label=>WebGUI::International::get(84,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('84 description',"Asset_EventsCalendar"),
-label=>$i18n->get(84),
-hoverHelp=>$i18n->get('84 description'),
-value=>[$self->getValue("endMonth")]
);
$tabform->getTab("display")->selectBox(
-name=>"defaultMonth",
-options=>{
"current"=>WebGUI::International::get(82,"Asset_EventsCalendar"),
"last"=>WebGUI::International::get(85,"Asset_EventsCalendar"),
"first"=>WebGUI::International::get(83,"Asset_EventsCalendar")
"current"=>$i18n->get(82),
"last"=>$i18n->get(85),
"first"=>$i18n->get(83)
},
-label=>WebGUI::International::get(90,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('90 description',"Asset_EventsCalendar"),
-label=>$i18n->get(90),
-hoverHelp=>$i18n->get('90 description'),
-value=>[$self->getValue("defaultMonth")]
);
$tabform->getTab("display")->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(19,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('19 description',"Asset_EventsCalendar"),
-label=>$i18n->get(19),
-hoverHelp=>$i18n->get('19 description'),
-value=>$self->getValue("paginateAfter")
);
return $tabform;
@ -186,6 +189,7 @@ sub getEditForm {
#-------------------------------------------------------------------
sub view {
my $self = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_EventsCalendar");
#define default view month range. Note that this could be different from
#the range a user is allowed to view - set by the events calendar limitations.
my $monthRangeLength = int($self->get("paginateAfter"));
@ -400,7 +404,7 @@ sub view {
my %var;
$var{month_loop} = \@$monthloop;
$var{"addevent.url"} = $self->getUrl().'?func=add;class=WebGUI::Asset::Event';
$var{"addevent.label"} = WebGUI::International::get(20,"Asset_EventsCalendar");
$var{"addevent.label"} = $i18n->get(20);
$var{'sunday.label'} = $self->session->datetime->getDayName(7);
$var{'monday.label'} = $self->session->datetime->getDayName(1);
$var{'tuesday.label'} = $self->session->datetime->getDayName(2);
@ -423,9 +427,9 @@ sub view {
my $nextCalMonthEnd = $calMonthEnd + $monthRangeLength;
my $monthLabel;
if ($monthRangeLength == 1) {
$monthLabel = WebGUI::International::get(560,"Asset_EventsCalendar");
$monthLabel = $i18n->get(560);
} else {
$monthLabel = WebGUI::International::get(561,"Asset_EventsCalendar");
$monthLabel = $i18n->get(561);
}
$var{'pagination.previousPageUrl'} =
$self->getUrl.'?calMonthStart='.$prevCalMonthStart.';calMonthEnd='.$prevCalMonthEnd;
@ -433,22 +437,22 @@ sub view {
$self->getUrl.'?calMonthStart='.$calMonthStart.
';reload='.$self->session->id->generate().'"><a href="'.$self->getUrl.
'?calMonthStart='.$prevCalMonthStart.';calMonthEnd='.$prevCalMonthEnd.'">'.
WebGUI::International::get(558,"Asset_EventsCalendar")." ".$monthRangeLength." ".
$i18n->get(558)." ".$monthRangeLength." ".
$monthLabel.'</a>';
$var{'pagination.nextPageUrl'} = $self->getUrl.
'?calMonthStart='.$nextCalMonthStart.';calMonthEnd='.$nextCalMonthEnd;
$var{'pagination.nextPage'} = '<a href="'.$self->getUrl.
'?calMonthStart='.$nextCalMonthStart.';calMonthEnd='.$nextCalMonthEnd.'">'.
WebGUI::International::get(559,"Asset_EventsCalendar")." ".$monthRangeLength." ".
$i18n->get(559)." ".$monthRangeLength." ".
$monthLabel.'</a></form>';
$var{'pagination.pageList.upTo20'} = '<select size="1" name="calMonthEnd">
<option value="'.($calMonthStart).'">1 '.WebGUI::International::get(560,"Asset_EventsCalendar").'</option>
<option value="'.(1+$calMonthStart).'">2 '.WebGUI::International::get(561,"Asset_EventsCalendar").'</option>
<option value="'.(2+$calMonthStart).'">3 '.WebGUI::International::get(561,"Asset_EventsCalendar").'</option>
<option value="'.(3+$calMonthStart).'">4 '.WebGUI::International::get(561,"Asset_EventsCalendar").'</option>
<option value="'.(5+$calMonthStart).'">6 '.WebGUI::International::get(561,"Asset_EventsCalendar").'</option>
<option value="'.(8+$calMonthStart).'">9 '.WebGUI::International::get(561,"Asset_EventsCalendar").'</option>
<option value="'.(11+$calMonthStart).'">12 '.WebGUI::International::get(561,"Asset_EventsCalendar").'</option></select>
<option value="'.($calMonthStart).'">1 '.$i18n->get(560).'</option>
<option value="'.(1+$calMonthStart).'">2 '.$i18n->get(561).'</option>
<option value="'.(2+$calMonthStart).'">3 '.$i18n->get(561).'</option>
<option value="'.(3+$calMonthStart).'">4 '.$i18n->get(561).'</option>
<option value="'.(5+$calMonthStart).'">6 '.$i18n->get(561).'</option>
<option value="'.(8+$calMonthStart).'">9 '.$i18n->get(561).'</option>
<option value="'.(11+$calMonthStart).'">12 '.$i18n->get(561).'</option></select>
<input type="submit" value="Go" name="Go" />';
#use Data::Dumper; return '<pre>'.Dumper(\%var).'</pre>';
my $vars = \%var;

View file

@ -57,9 +57,11 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Folder");
push(@{$definition}, {
assetName=>WebGUI::International::get("assetName","Asset_Folder"),
assetName=>$i18n->get("assetName"),
uiLevel => 5,
icon=>'folder.gif',
tableName=>'Folder',
@ -71,7 +73,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -87,17 +89,18 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_Folder");
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>WebGUI::International::get('folder template title', "Asset_Folder"),
-hoverHelp=>WebGUI::International::get('folder template description', "Asset_Folder"),
-label=>$i18n->get('folder template title'),
-hoverHelp=>$i18n->get('folder template description'),
-namespace=>"Folder"
);
if ($self->get("assetId") eq "new") {
$tabform->getTab("properties")->whatNext(
-options=>{
view=>WebGUI::International::get(823, "Asset_Folder"),
"viewParent"=>WebGUI::International::get(847, "Asset_Folder")
view=>$i18n->get(823),
"viewParent"=>$i18n->get(847)
},
-value=>"view"
);

View file

@ -31,9 +31,11 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_HttpProxy");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_HttpProxy"),
assetName=>$i18n->get('assetName'),
uiLevel => 5,
icon=>'httpProxy.gif',
tableName=>'HttpProxy',
@ -86,7 +88,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -105,11 +107,12 @@ sub getCookieJar {
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>WebGUI::International::get('http proxy template title',"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('http proxy template title description',"Asset_HttpProxy"),
-label=>$i18n->get('http proxy template title'),
-hoverHelp=>$i18n->get('http proxy template title description'),
-namespace=>"HttpProxy"
);
my %hash;
@ -117,32 +120,32 @@ sub getEditForm {
%hash=(5=>5,10=>10,20=>20,30=>30,60=>60);
$tabform->getTab("properties")->url(
-name=>"proxiedUrl",
-label=>WebGUI::International::get(1,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('1 description',"Asset_HttpProxy"),
-label=>$i18n->get(1),
-hoverHelp=>$i18n->get('1 description'),
-value=>$self->getValue("proxiedUrl")
);
$tabform->getTab("security")->yesNo(
-name=>"followExternal",
-label=>WebGUI::International::get(5,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('5 description',"Asset_HttpProxy"),
-label=>$i18n->get(5),
-hoverHelp=>$i18n->get('5 description'),
-value=>$self->getValue("followExternal")
);
$tabform->getTab("security")->yesNo(
-name=>"followRedirect",
-label=>WebGUI::International::get(8,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('8 description',"Asset_HttpProxy"),
-label=>$i18n->get(8),
-hoverHelp=>$i18n->get('8 description'),
-value=>$self->getValue("followRedirect")
);
$tabform->getTab("properties")->yesNo(
-name=>"rewriteUrls",
-label=>WebGUI::International::get(12,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('12 description',"Asset_HttpProxy"),
-label=>$i18n->get(12),
-hoverHelp=>$i18n->get('12 description'),
-value=>$self->getValue("rewriteUrls")
);
$tabform->getTab("display")->yesNo(
-name=>"removeStyle",
-label=>WebGUI::International::get(6,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('6 description',"Asset_HttpProxy"),
-label=>$i18n->get(6),
-hoverHelp=>$i18n->get('6 description'),
-value=>$self->getValue("removeStyle")
);
$tabform->getTab("display")->filterContent(
@ -152,20 +155,20 @@ sub getEditForm {
$tabform->getTab("properties")->selectBox(
-name=>"timeout",
-options=>\%hash,
-label=>WebGUI::International::get(4,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('4 description',"Asset_HttpProxy"),
-label=>$i18n->get(4),
-hoverHelp=>$i18n->get('4 description'),
-value=>[$self->getValue("timeout")]
);
$tabform->getTab("display")->text(
-name=>"searchFor",
-label=>WebGUI::International::get(13,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('13 description',"Asset_HttpProxy"),
-label=>$i18n->get(13),
-hoverHelp=>$i18n->get('13 description'),
-value=>$self->getValue("searchFor")
);
$tabform->getTab("display")->text(
-name=>"stopAt",
-label=>WebGUI::International::get(14,"Asset_HttpProxy"),
-hoverHelp=>WebGUI::International::get('14 description',"Asset_HttpProxy"),
-label=>$i18n->get(14),
-hoverHelp=>$i18n->get('14 description'),
-value=>$self->getValue("stopAt")
);
return $tabform;

View file

@ -64,16 +64,18 @@ sub _fetchDepartments {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_InOutBoard");
push(@{$definition}, {
tableName=>'InOutBoard',
className=>'WebGUI::Asset::Wobject::InOutBoard',
assetName=>WebGUI::International::get('assetName',"Asset_InOutBoard"),
assetName=>$i18n->get('assetName'),
icon=>'iob.gif',
properties=>{
statusList => {
defaultValue => WebGUI::International::get(10, "Asset_InOutBoard")."\n"
.WebGUI::International::get(11, "Asset_InOutBoard")."\n",
defaultValue => $i18n->get(10)."\n"
.$i18n->get(11)."\n",
fieldType=>"textarea"
},
reportViewerGroup => {
@ -98,7 +100,7 @@ sub definition {
},
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -106,38 +108,39 @@ sub definition {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session, "Asset_InOutBoard");
$tabform->getTab("properties")->textarea(
-name=>"statusList",
-label=>WebGUI::International::get(1, "Asset_InOutBoard"),
-label=>$i18n->get(1),
-value=>$self->getValue("statusList"),
-subtext=>WebGUI::International::get(2, "Asset_InOutBoard"),
-subtext=>$i18n->get(2),
);
$tabform->getTab("display")->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(12, "Asset_InOutBoard"),
-label=>$i18n->get(12),
-value=>$self->getValue("paginateAfter")
);
$tabform->getTab("display")->template (
-name => "inOutTemplateId",
-value => $self->getValue("inOutTemplateId"),
-label => WebGUI::International::get("In Out Template", "Asset_InOutBoard"),
-label => $i18n->get("In Out Template"),
-namespace => "InOutBoard"
);
$tabform->getTab("display")->template (
-name => "reportTemplateId",
-value => $self->getValue("reportTemplateId"),
-label => WebGUI::International::get(13, "Asset_InOutBoard"),
-label => $i18n->get(13),
-namespace => "InOutBoard/Report"
);
$tabform->getTab("security")->group(
-name=>"reportViewerGroup",
-value=>[$self->getValue("reportViewerGroup")],
-label=>WebGUI::International::get(3, "Asset_InOutBoard")
-label=>$i18n->get(3)
);
$tabform->getTab("security")->group(
-name=>"inOutGroup",
-value=>[$self->getValue("inOutGroup")],
-label=>WebGUI::International::get('inOutGroup', "Asset_InOutBoard")
-label=>$i18n->get('inOutGroup')
);
return $tabform;
}
@ -149,6 +152,7 @@ sub view {
my %var;
my $url = $self->getUrl('func=view');
my $i18n = WebGUI::International->new($self->session, "Asset_InOutBoard");
if ($self->session->user->isInGroup($self->getValue("reportViewerGroup"))) {
$var{'viewReportURL'} = $self->getUrl("func=viewReport");
$var{canViewReport} = 1;
@ -177,14 +181,14 @@ sub view {
my %nameHash;
tie %nameHash, "Tie::IxHash";
%nameHash = _fetchNames(@users);
$nameHash{""} = WebGUI::International::get('myself',"Asset_InOutBoard");
$nameHash{""} = $i18n->get('myself');
%nameHash = WebGUI::Utility::sortHash(%nameHash);
$f->selectBox(
-name=>"delegate",
-options=>\%nameHash,
-value=>[ $self->session->scratch->get("userId") ],
-label=>WebGUI::International::get('delegate', "Asset_InOutBoard"),
-label=>$i18n->get('delegate'),
-extras=>q|onchange="this.form.submit();"|,
);
}
@ -192,11 +196,11 @@ sub view {
-name=>"status",
-value=>$status,
-options=>$statusListHashRef,
-label=>WebGUI::International::get(5, "Asset_InOutBoard")
-label=>$i18n->get(5)
);
$f->text(
-name=>"message",
-label=>WebGUI::International::get(6, "Asset_InOutBoard")
-label=>$i18n->get(6)
);
$f->hidden(
-name=>"func",
@ -243,7 +247,7 @@ order by department, lastName, firstName";
my %row;
if ($lastDepartment ne $data->{department}) {
$row{deptHasChanged} = 1;
$row{'department'} = ($data->{department}||WebGUI::International::get(7, "Asset_InOutBoard"));
$row{'department'} = ($data->{department}||$i18n->get(7));
$lastDepartment = $data->{department};
}
else { $row{deptHasChanged} = 0; }
@ -255,7 +259,7 @@ order by department, lastName, firstName";
$row{'username'} = $data->{username};
}
$row{'status'} = ($data->{status}||WebGUI::International::get(15, "Asset_InOutBoard"));
$row{'status'} = ($data->{status}||$i18n->get(15));
$row{'dateStamp'} = $self->session->datetime->epochToHuman($data->{dateStamp});
$row{'message'} = ($data->{message}||"&nbsp;");
@ -272,7 +276,8 @@ order by department, lastName, firstName";
sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("18","Asset_InOutBoard"));
my $i18n = WebGUI::International->new($self->session, "Asset_InOutBoard");
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get("18"));
}
#-------------------------------------------------------------------
@ -311,6 +316,7 @@ group by userId", $self->session->db->quote($self->getId), $self->session->db->q
$sql = sprintf "select delegateUserId from InOutBoard_delegates where userId=%s and assetId=%s",
$self->session->db->quote($self->session->user->profileField("userId")), $self->session->db->quote($self->getId);
my $delegates = $self->session->db->buildArrayRef($sql);
my $i18n = WebGUI::International->new($self->session,"Asset_InOutBoard");
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name => "func",
@ -318,18 +324,18 @@ group by userId", $self->session->db->quote($self->getId), $self->session->db->q
);
$f->selectList(
-name => "delegates",
-label => WebGUI::International::get('in/out status delegates','Asset_InOutBoard'),
-label => $i18n->get('in/out status delegates'),
-options => \%userNames,
-multiple => 1, ##Multiple select
-size => 10, ##Multiple select
-sortByValue => 1,
-value => $delegates, ##My current delegates, if any
-subtext => WebGUI::International::get('in/out status delegates subtext','Asset_InOutBoard'),
-subtext => $i18n->get('in/out status delegates subtext'),
);
$f->submit;
my $ac = $self->getAdminConsole;
return $ac->render($f->print,
WebGUI::International::get('select delegate','Asset_InOutBoard'));
$i18n->get('select delegate'));
}
#-------------------------------------------------------------------
@ -379,6 +385,7 @@ sub www_viewReport {
my $self = shift;
return "" unless ($self->session->user->isInGroup($self->getValue("reportViewerGroup")));
my %var;
my $i18n = WebGUI::International->new($self->session,'Asset_InOutBoard');
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl, -method=>"GET");
my %changedBy = ();
$f->hidden(
@ -393,28 +400,28 @@ sub www_viewReport {
$startDate = $self->session->form->date("startDate") if ($self->session->form->process("doit"));
$f->date(
-name=>"startDate",
-label=>WebGUI::International::get(16, "Asset_InOutBoard"),
-label=>$i18n->get(16),
-value=>$startDate
);
my $endDate = $self->session->form->date("endDate");
$f->date(
-name=>"endDate",
-label=>WebGUI::International::get(17, "Asset_InOutBoard"),
-label=>$i18n->get(17),
-value=>$endDate
);
my %depHash;
%depHash = map { $_ => $_ } (_fetchDepartments(),
WebGUI::International::get('all departments', 'Asset_InOutBoard'));
$i18n->get('all departments'));
my $defaultDepartment = $self->session->form->process("selectDepartment")
|| WebGUI::International::get('all departments', 'Asset_InOutBoard');
my $departmentSQLclause = ($defaultDepartment eq WebGUI::International::get('all departments', 'Asset_InOutBoard'))
|| $i18n->get('all departments');
my $departmentSQLclause = ($defaultDepartment eq $i18n->get('all departments'))
? ''
: 'and c.fieldData='.$self->session->db->quote($defaultDepartment);
$f->selectBox(
-name=>"selectDepartment",
-options=>\%depHash,
-value=>[ $defaultDepartment ],
-label=>WebGUI::International::get('filter departments', "Asset_InOutBoard"),
-label=>$i18n->get('filter departments'),
);
my %paginHash;
tie %paginHash, "Tie::IxHash"; ##Because default sort order is alpha
@ -424,7 +431,7 @@ sub www_viewReport {
-name=>"reportPagination",
-options=>\%paginHash,
-value=>[ $pageReportAfter ],
-label=>WebGUI::International::get(14, "Asset_InOutBoard"),
-label=>$i18n->get(14),
);
$f->submit(-value=>"Search");
$var{'form'} = $f->print;
@ -468,14 +475,14 @@ order by department, lastName, firstName, InOutBoard_statusLog.dateStamp";
if ($lastDepartment ne $data->{department}) {
$row{deptHasChanged} = 1;
$row{'department'} = ($data->{department}||WebGUI::International::get(7, "Asset_InOutBoard"));
$row{'department'} = ($data->{department}||$i18n->get(7));
$lastDepartment = $data->{department};
}
else { $row{deptHasChanged} = 0; }
$row{'username'} = _defineUsername($data);
$row{'status'} = ($data->{status}||WebGUI::International::get(15, "Asset_InOutBoard"));
$row{'status'} = ($data->{status}||$i18n->get(15));
$row{'dateStamp'} = $self->session->datetime->epochToHuman($data->{dateStamp});
$row{'message'} = ($data->{message}||"&nbsp;");
if (! exists $changedBy{ $data->{createdBy} }) {
@ -488,11 +495,11 @@ order by department, lastName, firstName, InOutBoard_statusLog.dateStamp";
}
$var{rows_loop} = \@rows;
$var{'paginateBar'} = $p->getBarTraditional();
$var{'username.label'} = WebGUI::International::get('username label','Asset_InOutBoard');
$var{'status.label'} = WebGUI::International::get(5,'Asset_InOutBoard');
$var{'date.label'} = WebGUI::International::get('date label','Asset_InOutBoard');
$var{'message.label'} = WebGUI::International::get('message label','Asset_InOutBoard');
$var{'updatedBy.label'} = WebGUI::International::get('updatedBy label','Asset_InOutBoard');
$var{'username.label'} = $i18n->get('username label');
$var{'status.label'} = $i18n->get(5);
$var{'date.label'} = $i18n->get('date label');
$var{'message.label'} = $i18n->get('message label');
$var{'updatedBy.label'} = $i18n->get('updatedBy label');
$p->appendTemplateVars(\%var);
}
else { $var{showReport} = 0; }

View file

@ -20,11 +20,13 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_IndexedSearch");
push (@{$definition}, {
tableName=>'IndexedSearch',
className=>'WebGUI::Asset::Wobject::IndexedSearch',
assetName=>WebGUI::International::get('assetName',"Asset_IndexedSearch"),
assetName=>$i18n->get('assetName'),
properties=>{
templateId=>{
fieldType=>"template",
@ -80,7 +82,7 @@ sub definition {
},
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -96,23 +98,24 @@ sub getEditForm {
tie my %searchRoot, 'Tie::IxHash';
# Unconditional read to catch intallation errors.
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
my $sth = $self->session->db->unconditionalRead("select distinct(indexName), indexName from IndexedSearch_docInfo");
unless ($sth->errorCode < 1) {
return "<p><b>" . WebGUI::International::get(1,"Asset_IndexedSearch") . $sth->errorMessage."</b></p>";
return "<p><b>" . $i18n->get(1) . $sth->errorMessage."</b></p>";
}
while (@data = $sth->array) {
$indexName{$data[0]} = $data[1];
}
$sth->finish;
unless(%indexName) {
return "<p><b>" . WebGUI::International::get(2,"Asset_IndexedSearch") .
"<p>" . WebGUI::International::get(3,"Asset_IndexedSearch") . "</p></b></p>";
return "<p><b>" . $i18n->get(2) .
"<p>" . $i18n->get(3) . "</p></b></p>";
}
# Index to use
# $tabform->getTab("properties")->radioList( -name=>'indexName',
# -options=>\%indexName,
# -label=>WebGUI::International::get(5,"Asset_IndexedSearch"),
# -label=>$i18n->get(5),
# -value=>$self->getValue("indexName"),
# -vertical=>1
# );
@ -124,26 +127,26 @@ sub getEditForm {
);
# Page roots
#%searchRoot = ( 'any'=>WebGUI::International::get(15,"Asset_IndexedSearch"),
# $session{page}{pageId}=>WebGUI::International::get(4,"Asset_IndexedSearch"),
#%searchRoot = ( 'any'=>$i18n->get(15),
# $session{page}{pageId}=>$i18n->get(4),
# $self->session->db->buildHash("select pageId,title from page where parentId='0' and isSystem<>1 order by title")
# );
#$tabform->getTab("properties")->checkList ( -name=>'searchRoot',
# -options=>\%searchRoot,
# -label=>WebGUI::International::get(6,"Asset_IndexedSearch"),
# -label=>$i18n->get(6),
# -value=>[ split("\n", $self->getValue("searchRoot")) ],
# -multiple=>1,
# -vertical=>1,
# );
$tabform->getTab("properties")->yesNo(
-name=>'forceSearchRoots',
-label=>WebGUI::International::get('force search roots',"Asset_IndexedSearch"),
-label=>$i18n->get('force search roots'),
-value=>$self->getValue("forceSearchRoots")
);
# Content of specific user
$tabform->getTab("properties")->selectList ( -name=>'users',
-options=>$self->_getUsers(),
-label=>WebGUI::International::get(7,"Asset_IndexedSearch"),
-label=>$i18n->get(7),
-value=>[ split("\n", $self->getValue("users")) ],
-multiple=>1,
-size=>5
@ -152,7 +155,7 @@ sub getEditForm {
# Content in specific namespaces
$tabform->getTab("properties")->selectList ( -name=>'namespaces',
-options=>$self->_getNamespaces,
-label=>WebGUI::International::get(8,"Asset_IndexedSearch"),
-label=>$i18n->get(8),
-value=>[ split("\n", $self->getValue("namespaces")) ],
-multiple=>1,
-size=>5
@ -163,7 +166,7 @@ sub getEditForm {
delete $contentTypes->{content};
$tabform->getTab("properties")->checkList ( -name=>'contentTypes',
-options=>$contentTypes,
-label=>WebGUI::International::get(10,"Asset_IndexedSearch"),
-label=>$i18n->get(10),
-value=>[ split("\n", $self->getValue("contentTypes")) ],
-multiple=>1,
-vertical=>1,
@ -173,15 +176,15 @@ sub getEditForm {
-namespace=>"IndexedSearch"
);
$tabform->getTab("display")->integer ( -name=>'paginateAfter',
-label=>WebGUI::International::get(11,"Asset_IndexedSearch"),
-label=>$i18n->get(11),
-value=>$self->getValue("paginateAfter"),
);
$tabform->getTab("display")->integer ( -name=>'previewLength',
-label=>WebGUI::International::get(12,"Asset_IndexedSearch"),
-label=>$i18n->get(12),
-value=>$self->getValue("previewLength"),
);
$tabform->getTab("display")->yesNo ( -name=>'highlight',
-label=>WebGUI::International::get(13,"Asset_IndexedSearch"),
-label=>$i18n->get(13),
-value=>$self->getValue("highlight"),
);
@ -195,7 +198,7 @@ sub getEditForm {
for (1..5) {
my $highlight = "highlight_$_";
$tabform->getTab("display")->text ( -name=>$highlight,
-label=>WebGUI::International::get(14,"Asset_IndexedSearch") ." $_:",
-label=>$i18n->get(14) ." $_:",
-size=>7,
-value=>$self->getValue($highlight),
-subtext=>qq{
@ -236,9 +239,10 @@ sub view {
$var{query} = $query;
# Set some standard vars
$var{submit} = WebGUI::Form::submit($self->session,{value=>WebGUI::International::get(16, "Asset_IndexedSearch")});
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
$var{submit} = WebGUI::Form::submit($self->session,{value=>$i18n->get(16)});
$var{actionURL} = $self->getUrl;
$var{"int.search"} = WebGUI::International::get(16,"Asset_IndexedSearch");
$var{"int.search"} = $i18n->get(16);
$var{numberOfResults} = '0';
$var{"select_".$self->getValue("paginateAfter")} = "selected";
@ -385,7 +389,8 @@ sub www_edit {
my $form = $self->getEditForm;
my $output = $form;
$output = $form->print unless $form =~ /^<p><b/;
return $self->getAdminConsole->render($output,WebGUI::International::get("26","Asset_IndexedSearch"));
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
return $self->getAdminConsole->render($output,$i18n->get("26"));
}
#-------------------------------------------------------------------
@ -488,14 +493,15 @@ sub _getNamespaces {
$international{$class} = eval{$class->getName()};
}
}
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
tie my %namespaces, 'Tie::IxHash';
if ($restricted and $self->get('namespaces') !~ /any/i) {
$namespaces{any} = WebGUI::International::get(18,"Asset_IndexedSearch");
$namespaces{any} = $i18n->get(18);
foreach (split/\n/, $self->get('namespaces')) {
$namespaces{$_} = $international{$_} || ucfirst($_);
}
} else {
$namespaces{any} = WebGUI::International::get(18,"Asset_IndexedSearch");
$namespaces{any} = $i18n->get(18);
foreach ($self->session->db->buildArray("select distinct(namespace) from IndexedSearch_docInfo order by namespace")) {
$namespaces{$_} = $international{$_} ||ucfirst($_);
}
@ -506,13 +512,14 @@ sub _getNamespaces {
#-------------------------------------------------------------------
sub _getContentTypes {
my ($self, $restricted) = @_;
my %international = ( 'page' => WebGUI::International::get('page',"Asset_IndexedSearch"),
'wobject' => WebGUI::International::get(19,"Asset_IndexedSearch"),
'wobjectDetail' => WebGUI::International::get(20,"Asset_IndexedSearch"),
'content' => WebGUI::International::get(21,"Asset_IndexedSearch"),
'discussion' => WebGUI::International::get('discussion',"Asset_IndexedSearch"),
'profile' => WebGUI::International::get(22,"Asset_IndexedSearch"),
'any' => WebGUI::International::get(23,"Asset_IndexedSearch"),
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
my %international = ( 'page' => $i18n->get('page'),
'wobject' => $i18n->get(19),
'wobjectDetail' => $i18n->get(20),
'content' =>$i18n->get(21),
'discussion' => $i18n->get('discussion'),
'profile' => $i18n->get(22),
'any' => $i18n->get(23),
);
tie my %contentTypes, 'Tie::IxHash';
if ($restricted and $self->get('contentTypes') !~ /any/i) {
@ -548,13 +555,14 @@ sub _getSearchablePages {
sub _getUsers {
my ($self, $restricted) = @_;
tie my %users, 'Tie::IxHash';
my $i18n = WebGUI::International->new($self->session,"Asset_IndexedSearch");
if ($restricted and $self->get('users') !~ /any/i) {
$users{any} = WebGUI::International::get(25,"Asset_IndexedSearch");
$users{any} = $i18n->get(25);
foreach (split/\n/, $self->get('users')) {
$users{$_} = $_;
}
} else {
%users = ( 'any' => WebGUI::International::get(25,"Asset_IndexedSearch"),
%users = ( 'any' => $i18n->get(25),
$self->session->db->buildHash("select userId, username from users order by username")
);
}

View file

@ -58,9 +58,11 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Layout");
push(@{$definition}, {
assetName=>WebGUI::International::get("assetName","Asset_Layout"),
assetName=>$i18n->get("assetName"),
icon=>'layout.gif',
tableName=>'Layout',
className=>'WebGUI::Asset::Wobject::Layout',
@ -80,7 +82,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -95,17 +97,18 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_Layout");
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>WebGUI::International::get('layout template title', 'Asset_Layout'),
-hoverHelp=>WebGUI::International::get('template description', 'Asset_Layout'),
-label=>$i18n->get('layout template title'),
-hoverHelp=>$i18n->get('template description'),
-namespace=>"Layout"
);
if ($self->get("assetId") eq "new") {
$tabform->getTab("properties")->whatNext(
-options=>{
view=>WebGUI::International::get(823, 'Asset_Layout'),
viewParent=>WebGUI::International::get(847, 'Asset_Layout')
view=>$i18n->get(823),
viewParent=>$i18n->get(847)
},
-value=>"view"
);
@ -120,8 +123,8 @@ sub getEditForm {
-name=>"assetsToHide",
-value=>\@assetsToHide,
-options=>\%childIds,
-label=>WebGUI::International::get('assets to hide', 'Asset_Layout'),
-hoverHelp=>WebGUI::International::get('assets to hide description', 'Asset_Layout'),
-label=>$i18n->get('assets to hide'),
-hoverHelp=>$i18n->get('assets to hide description'),
-vertical=>1,
-uiLevel=>9
);

View file

@ -23,12 +23,14 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Matrix");
push(@{$definition}, {
icon=>'matrix.gif',
tableName=>'Matrix',
className=>'WebGUI::Asset::Wobject::Matrix',
assetName=>WebGUI::International::get('assetName',"Asset_Matrix"),
assetName=>$i18n->get('assetName'),
properties=>{
categories=>{
defaultValue=>"Features\nBenefits",
@ -84,7 +86,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -309,13 +311,15 @@ sub www_compare {
#-------------------------------------------------------------------
sub www_copy {
return WebGUI::International::get('no copy','Asset_Matrix');
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
return $i18n->get('no copy');
}
#-------------------------------------------------------------------
sub www_deleteListing {
my $self = shift;
my $output = sprintf WebGUI::International::get('delete listing confirmation','Asset_Matrix'),
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
my $output = sprintf $i18n->get('delete listing confirmation'),
$self->getUrl("func=deleteListingConfirm&listingId=".$self->session->form->process("listingId")),
$self->formatURL("viewDetail",$self->session->form->process("listingId"));
return $self->processStyle($output);
@ -340,88 +344,89 @@ sub www_deleteListingConfirm {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
$tabform->getTab("properties")->textarea(
-name=>"categories",
-label=>WebGUI::International::get('categories', 'Asset_Matrix'),
-hoverHelp=>WebGUI::International::get('categories description', 'Asset_Matrix'),
-label=>$i18n->get('categories'),
-hoverHelp=>$i18n->get('categories description'),
-value=>$self->getValue("categories"),
-subtext=>WebGUI::International::get('categories subtext', 'Asset_Matrix'),
-subtext=>$i18n->get('categories subtext'),
);
$tabform->getTab("properties")->integer(
-name=>"maxComparisons",
-label=>WebGUI::International::get("max comparisons","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("max comparisons description","Asset_Matrix"),
-label=>$i18n->get("max comparisons"),
-hoverHelp=>$i18n->get("max comparisons description"),
-value=>$self->getValue("maxComparisons")
);
$tabform->getTab("properties")->integer(
-name=>"maxComparisonsPrivileged",
-label=>WebGUI::International::get("max comparisons privileged","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("max comparisons privileged description","Asset_Matrix"),
-label=>$i18n->get("max comparisons privileged"),
-hoverHelp=>$i18n->get("max comparisons privileged description"),
-value=>$self->getValue("maxComparisonsPrivileged")
);
$tabform->getTab("properties")->interval(
-name=>"ratingTimeout",
-label=>WebGUI::International::get("rating timeout","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating timeout description","Asset_Matrix"),
-label=>$i18n->get("rating timeout"),
-hoverHelp=>$i18n->get("rating timeout description"),
-value=>$self->getValue("ratingTimeout")
);
$tabform->getTab("properties")->interval(
-name=>"ratingTimeoutPrivileged",
-label=>WebGUI::International::get("rating timeout privileged","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating timeout privileged description","Asset_Matrix"),
-label=>$i18n->get("rating timeout privileged"),
-hoverHelp=>$i18n->get("rating timeout privileged description"),
-value=>$self->getValue("ratingTimeoutPrivileged")
);
$tabform->getTab("security")->group(
-name=>"groupToAdd",
-label=>WebGUI::International::get("group to add","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("group to add description","Asset_Matrix"),
-label=>$i18n->get("group to add"),
-hoverHelp=>$i18n->get("group to add description"),
-value=>[$self->getValue("groupToAdd")]
);
$tabform->getTab("security")->group(
-name=>"privilegedGroup",
-label=>WebGUI::International::get("privileged group","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("privileged group description","Asset_Matrix"),
-label=>$i18n->get("privileged group"),
-hoverHelp=>$i18n->get("privileged group description"),
-value=>[$self->getValue("privilegedGroup")]
);
$tabform->getTab("security")->group(
-name=>"groupToRate",
-label=>WebGUI::International::get("rating group","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating group description","Asset_Matrix"),
-label=>$i18n->get("rating group"),
-hoverHelp=>$i18n->get("rating group description"),
-value=>[$self->getValue("groupToRate")]
);
$tabform->getTab("display")->template(
-name=>"templateId",
-value=>$self->getValue("templateId"),
-label=>WebGUI::International::get("main template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("main template description","Asset_Matrix"),
-label=>$i18n->get("main template"),
-hoverHelp=>$i18n->get("main template description"),
-namespace=>"Matrix"
);
$tabform->getTab("display")->template(
-name=>"detailTemplateId",
-value=>$self->getValue("detailTemplateId"),
-label=>WebGUI::International::get("detail template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("detail template description","Asset_Matrix"),
-label=>$i18n->get("detail template"),
-hoverHelp=>$i18n->get("detail template description"),
-namespace=>"Matrix/Detail"
);
$tabform->getTab("display")->template(
-name=>"ratingDetailTemplateId",
-value=>$self->getValue("ratingDetailTemplateId"),
-label=>WebGUI::International::get("rating detail template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating detail template description","Asset_Matrix"),
-label=>$i18n->get("rating detail template"),
-hoverHelp=>$i18n->get("rating detail template description"),
-namespace=>"Matrix/RatingDetail"
);
$tabform->getTab("display")->template(
-name=>"searchTemplateId",
-value=>$self->getValue("searchTemplateId"),
-label=>WebGUI::International::get("search template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("search template description","Asset_Matrix"),
-label=>$i18n->get("search template"),
-hoverHelp=>$i18n->get("search template description"),
-namespace=>"Matrix/Search"
);
$tabform->getTab("display")->template(
-name=>"compareTemplateId",
-value=>$self->getValue("compareTemplateId"),
-label=>WebGUI::International::get("compare template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("compare template description","Asset_Matrix"),
-label=>$i18n->get("compare template"),
-hoverHelp=>$i18n->get("compare template description"),
-namespace=>"Matrix/Compare"
);
return $tabform;
@ -431,8 +436,9 @@ sub getEditForm {
sub www_edit {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->canEdit;
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
return $self->getAdminConsole->render($self->getEditForm->print,
WebGUI::International::get("edit matrix",'Asset_Matrix'));
$i18n->get("edit matrix"));
}
@ -441,7 +447,8 @@ sub www_edit {
sub www_editListing {
my $self = shift;
my $listing= $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
return WebGUI::International('no edit rights','Asset_Matrix') unless (($self->session->form->process("listingId") eq "new" && $self->session->user->isInGroup($self->get("groupToAdd"))) || $self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
return $i18n->get('no edit rights') unless (($self->session->form->process("listingId") eq "new" && $self->session->user->isInGroup($self->get("groupToAdd"))) || $self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name=>"func",
@ -454,53 +461,53 @@ sub www_editListing {
$f->text(
-name=>"productName",
-value=>$listing->{productName},
-label=>WebGUI::International::get('product name','Asset_Matrix'),
-hoverHelp=>WebGUI::International::get('product name description','Asset_Matrix'),
-label=>$i18n->get('product name'),
-hoverHelp=>$i18n->get('product name description'),
-maxLength=>25
);
$f->text(
-name=>"versionNumber",
-value=>$listing->{versionNumber},
-label=>WebGUI::International::get('version number','Asset_Matrix'),
-hoverHelp=>WebGUI::International::get('version number description','Asset_Matrix'),
-label=>$i18n->get('version number'),
-hoverHelp=>$i18n->get('version number description'),
);
$f->url(
-name=>"productUrl",
-value=>$listing->{productUrl},
-label=>WebGUI::International::get('product url','Asset_Matrix'),
-hoverHelp=>WebGUI::International::get('product url description','Asset_Matrix'),
-label=>$i18n->get('product url'),
-hoverHelp=>$i18n->get('product url description'),
);
$f->text(
-name=>"manufacturerName",
-value=>$listing->{manufacturerName},
-label=>WebGUI::International::get('manufacturer name','Asset_Matrix'),
-hoverHelp=>WebGUI::International::get('manufacturer name description','Asset_Matrix'),
-label=>$i18n->get('manufacturer name'),
-hoverHelp=>$i18n->get('manufacturer name description'),
);
$f->url(
-name=>"manufacturerUrl",
-value=>$listing->{manufacturerUrl},
-label=>WebGUI::International::get('manufacturer url','Asset_Matrix'),
-label=>$i18n->get('manufacturer url'),
);
$f->textarea(
-name=>"description",
-value=>$listing->{description},
-label=>WebGUI::International::get('description','Asset_Matrix'),
-label=>$i18n->get('description'),
);
if ($self->canEdit) {
$f->selectBox(
-name=>"maintainerId",
-value=>[$listing->{maintainerId}],
-label=>WebGUI::International::get('listing maintainer','Asset_Matrix'),
-label=>$i18n->get('listing maintainer'),
-options=>$self->session->db->buildHashRef("select userId,username from users order by username")
-hoverHelp=>WebGUI::International::get('listing maintainer description','Asset_Matrix'),
-hoverHelp=>$i18n->get('listing maintainer description'),
);
}
my %goodBad = (
"No" => WebGUI::International::get("no",'Asset_Matrix'),
"Yes" => WebGUI::International::get("yes",'Asset_Matrix'),
"Free Add On" => WebGUI::International::get("free",'Asset_Matrix'),
"Costs Extra" => WebGUI::International::get("extra",'Asset_Matrix'),
"Limited" => WebGUI::International::get("limited",'Asset_Matrix'),
"No" => $i18n->get("no"),
"Yes" => $i18n->get("yes"),
"Free Add On" => $i18n->get("free"),
"Costs Extra" => $i18n->get("extra"),
"Limited" => $i18n->get("limited"),
);
foreach my $category ($self->getCategories()) {
$f->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
@ -523,7 +530,7 @@ sub www_editListing {
-subtext=>"<br />".$field->{description}
);
} elsif ($field->{fieldType} eq "goodBad") {
my $value = ($field->{value} || $field->{defaultValue} || WebGUI::International::get("no",'Asset_Matrix'));
my $value = ($field->{value} || $field->{defaultValue} || $i18n->get("no"));
$f->selectBox(
-name=>$field->{name},
-value=>[$value],
@ -562,7 +569,7 @@ sub www_editListing {
$a->finish;
}
$f->submit;
return $self->processStyle(WebGUI::International::get('edit listing','Asset_Matrix').$f->print);
return $self->processStyle($i18n->get('edit listing').$f->print);
}
@ -570,7 +577,8 @@ sub www_editListing {
sub www_editListingSave {
my $self = shift;
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
return WebGUI::International('no edit rights','Asset_Matrix') unless (($self->session->form->process("listingId") eq "new" && $self->session->user->isInGroup($self->get("groupToAdd"))) || $self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
return $i18n->get('no edit rights') unless (($self->session->form->process("listingId") eq "new" && $self->session->user->isInGroup($self->get("groupToAdd"))) || $self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
my %data = (
listingId => $self->session->form->process("listingId"),
lastUpdated => $self->session->datetime->time(),
@ -649,6 +657,7 @@ sub www_editListingSave {
sub www_editField {
my $self = shift;
return $self->session->privilege->insufficient() unless($self->canEdit);
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
my $field = $self->session->db->getRow("Matrix_field","fieldId",$self->session->form->process("fieldId"));
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
@ -662,34 +671,39 @@ sub www_editField {
$f->text(
-name=>"name",
-value=>$field->{name},
-label=>WebGUI::International::get('name','Asset_Matrix'),
-label=>$i18n->get('field name'),
-hoverHelp=>$i18n->get('field name description'),
);
$f->text(
-name=>"label",
-value=>$field->{label},
-label=>WebGUI::International::get('label','Asset_Matrix'),
-label=>$i18n->get('field label'),
-hoverHelp=>$i18n->get('field label description'),
);
$f->selectBox(
-name=>"fieldType",
-value=>[$field->{fieldType}],
-label=>WebGUI::International::get('type','Asset_Matrix'),
-label=>$i18n->get('field type'),
-hoverHelp=>$i18n->get('field type description'),
-options=>{
'goodBad' => WebGUI::International::get('good bad','Asset_Matrix'),
'text' => WebGUI::International::get('text','Asset_Matrix'),
'url' => WebGUI::International::get('url','Asset_Matrix'),
'textarea' => WebGUI::International::get('text area','Asset_Matrix'),
'combo' => WebGUI::International::get('combo','Asset_Matrix'),
'goodBad' => $i18n->get('good bad'),
'text' => $i18n->get('text'),
'url' => $i18n->get('url'),
'textarea' => $i18n->get('text area'),
'combo' => $i18n->get('combo'),
}
);
$f->textarea(
-name=>"description",
-value=>$field->{description},
-label=>WebGUI::International::get('description','Asset_Matrix'),
-label=>$i18n->get('field description'),
-hoverHelp=>$i18n->get('field description description'),
);
$f->text(
-name=>"defaultValue",
-value=>$field->{defaultValue},
-label=>WebGUI::International::get('default value','Asset_Matrix'),
-label=>$i18n->get('default value'),
-hoverHelp=>$i18n->get('default value description'),
);
my %cats;
foreach my $category ($self->getCategories) {
@ -698,11 +712,12 @@ sub www_editField {
$f->selectBox(
-name=>"category",
-value=>[$field->{category}],
-label=>WebGUI::International::get('category','Asset_Matrix'),
-label=>$i18n->get('category'),
-hoverHelp=>$i18n->get('category description'),
-options=>\%cats
);
$f->submit;
return $self->processStyle(WebGUI::International::get('edit field','Asset_Matrix').$f->print);
return $self->processStyle($i18n->get('edit field').$f->print);
}
@ -727,7 +742,8 @@ sub www_editFieldSave {
sub www_listFields {
my $self = shift;
return $self->session->privilege->insufficient() unless($self->canEdit);
my $output = sprintf WebGUI::International::get('list fields','Asset_Matrix'),
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
my $output = sprintf $i18n->get('list fields'),
$self->getUrl("func=editField&amp;fieldId=new");
my $sth = $self->session->db->read("select fieldId, label from Matrix_field where assetId=".$self->session->db->quote($self->getId)." order by label");
while (my ($id, $label) = $sth->array) {
@ -957,6 +973,7 @@ sub www_viewDetail {
my $listingId = shift || $self->session->form->process("listingId");
my $hasRated = shift || $self->hasRated($listingId);
my %var;
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$listingId);
my $forum = WebGUI::Asset::Wobject::Collaboration->new($listing->{forumId});
$var{"discussion"} = $forum->view;
@ -1006,23 +1023,23 @@ sub www_viewDetail {
-extras=>'class="content"',
-name=>"from",
-value=>$self->session->user->profileField("email"),
-label=>WebGUI::International::get('your email','Asset_Matrix'),
-label=>$i18n->get('your email'),
);
$f->selectBox(
-name=>"subject",
-extras=>'class="content"',
-options=>{
WebGUI::International::get('report error','Asset_Matrix')=>"Report an error.",
WebGUI::International::get('general comment','Asset_Matrix')=>"General comment.",
$i18n->get('report error')=>"Report an error.",
$i18n->get('general comment')=>"General comment.",
},
-label=>WebGUI::International::get('request type','Asset_Matrix'),
-label=>$i18n->get('request type'),
);
$f->textarea(
-rows=>4,
-extras=>'class="content"',
-columns=>35,
-name=>"body",
-label=>WebGUI::International::get('comment','Asset_Matrix'),
-label=>$i18n->get('comment'),
);
$f->submit(
-extras=>'class="content"',
@ -1089,7 +1106,7 @@ sub www_viewDetail {
$f->submit(
-extras=>'class="ratingForm"',
-value=>"Rate",
-label=>'<a href="'.$self->formatURL("rate",$listingId).'">'.WebGUI::International::get('show ratings','Asset_Matrix').'</A>'
-label=>'<a href="'.$self->formatURL("rate",$listingId).'">'.$i18n->get('show ratings').'</A>'
);
if ($hasRated) {
$var{'ratings'} = $ratingsTable;

View file

@ -25,7 +25,9 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
return $class->SUPER::definition($definition);
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_MessageBoard");
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
@ -34,19 +36,19 @@ sub definition {
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000047',
namespace=>"MessageBoard",
label=>WebGUI::International::get(73,"Asset_MessageBoard"),
hoverHelp=>WebGUI::International::get('73 description',"Asset_MessageBoard")
label=>$i18n->get(73),
hoverHelp=>$i18n->get('73 description')
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_MessageBoard"),
assetName=>$i18n->get('assetName'),
icon=>'messageBoard.gif',
tableName=>'MessageBoard',
className=>'WebGUI::Asset::Wobject::MessageBoard',
autoGenerateForms=>1,
properties=>\%properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -57,6 +59,7 @@ sub view {
my $count;
my $first;
my @forum_loop;
my $i18n = WebGUI::International->new($self->session,"Asset_MessageBoard");
my $children = $self->getLineage(["children"],{includeOnlyClasses=>["WebGUI::Asset::Wobject::Collaboration"],returnObjects=>1});
foreach my $child (@{$children}) {
$count++;
@ -97,13 +100,13 @@ sub view {
}
$var{'default.listing'} = $first->view if ($count == 1 && defined $first);
$var{'forum.add.url'} = $self->getUrl("func=add;class=WebGUI::Asset::Wobject::Collaboration");
$var{'forum.add.label'} = WebGUI::International::get(75,"Asset_MessageBoard");
$var{'title.label'} = WebGUI::International::get('title','Asset_MessageBoard');
$var{'views.label'} = WebGUI::International::get('views',,'Asset_MessageBoard');
$var{'rating.label'} = WebGUI::International::get('rating','Asset_MessageBoard');
$var{'threads.label'} = WebGUI::International::get('threads','Asset_MessageBoard');
$var{'replies.label'} = WebGUI::International::get('replies','Asset_MessageBoard');
$var{'lastpost.label'} = WebGUI::International::get('lastpost','Asset_MessageBoard');
$var{'forum.add.label'} = $i18n->get(75);
$var{'title.label'} = $i18n->get('title');
$var{'views.label'} = $i18n->get('views');
$var{'rating.label'} = $i18n->get('rating');
$var{'threads.label'} = $i18n->get('threads');
$var{'replies.label'} = $i18n->get('replies');
$var{'lastpost.label'} = $i18n->get('lastpost');
$var{areMultipleForums} = ($count > 1);
$var{forum_loop} = \@forum_loop;
return $self->processTemplate(\%var,$self->get("templateId"));

View file

@ -42,8 +42,9 @@ defines wobject properties for MultiSearch instances
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new("Asset_MultiSearch");
my $i18n = WebGUI::International->new($session, "Asset_MultiSearch");
my $properties = {
templateId =>{
fieldType=>"template",
@ -57,8 +58,8 @@ sub definition {
# fieldType=>"textarea",
# defaultValue=>"WebGUI",
# tab=>"properties",
# hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
# label=>WebGUI::International::get(72,"Asset_Article")
# hoverHelp=>$i18n->get('article template description','Asset_Article'),
# label=>$i18n->get(72,"Asset_Article")
# },
};
push(@{$definition}, {
@ -69,7 +70,7 @@ sub definition {
autoGenerateForms=>1,
properties=>$properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -30,9 +30,11 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Navigation");
push(@{$definition}, {
assetName=>WebGUI::International::get("assetName","Asset_Navigation"),
assetName=>$i18n->get("assetName"),
icon=>'navigation.gif',
tableName=>'Navigation',
className=>'WebGUI::Asset::Wobject::Navigation',
@ -75,14 +77,14 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new("Asset_Navigation");
my $i18n = WebGUI::International->new($self->session, "Asset_Navigation");
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-namespace=>"Navigation",
@ -258,8 +260,8 @@ sub getEditForm {
# this.form.func.value='preview';
# this.form.target = 'navPreview';
# this.form.submit()">};
my $saveButton = ' <input type="button" value="'.WebGUI::International::get(62).'" onclick="
this.value=\''.WebGUI::International::get(452).'\';
my $saveButton = ' <input type="button" value="'.$i18n->get(62,'WebGUI').'" onclick="
this.value=\''.$i18n->get(452,'WebGUI').'\';
this.form.func.value=\'editSave\';
this.form.target=\'_self\';
this.form.submit();
@ -289,7 +291,7 @@ sub getToolbar {
if (!$self->isLocked || $self->get("isLockedBy") eq $self->session->user->profileField("userId")) {
$toolbar = $self->session->icon->edit('func=edit'.$returnUrl,$self->get("url"));
}
my $i18n = WebGUI::International->new("Asset");
my $i18n = WebGUI::International->new($self->session, "Asset");
return '<script type="text/javascript">
var contextMenu = new contextMenu_createWithImage("'.$self->getIcon(1).'","'.$self->getId.'","'.$self->getName.'");
contextMenu.addLink("'.$self->getUrl("func=copy").'","'.$i18n->get("copy").'");

View file

@ -36,9 +36,11 @@ sub _hasVoted {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
return $class->SUPER::definition($definition);
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Poll");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Poll"),
assetName=>$i18n->get('assetName'),
tableName=>'Poll',
icon=>'poll.gif',
className=>'WebGUI::Asset::Wobject::Poll',
@ -153,7 +155,7 @@ sub definition {
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -172,11 +174,12 @@ sub duplicate {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new($self->session,"Asset_Poll");
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-namespace=>"Poll",
-label=>WebGUI::International::get(73,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('73 description',"Asset_Poll"),
-label=>$i18n->get(73),
-hoverHelp=>$i18n->get('73 description'),
);
my ($i, $answers);
for ($i=1; $i<=20; $i++) {
@ -186,21 +189,21 @@ sub getEditForm {
}
$tabform->getTab("security")->yesNo(
-name=>"active",
-label=>WebGUI::International::get(3,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('3 description',"Asset_Poll"),
-label=>$i18n->get(3),
-hoverHelp=>$i18n->get('3 description'),
-value=>$self->getValue("active")
);
$tabform->getTab("security")->group(
-name=>"voteGroup",
-label=>WebGUI::International::get(4,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('4 description',"Asset_Poll"),
-label=>$i18n->get(4),
-hoverHelp=>$i18n->get('4 description'),
-value=>[$self->getValue("voteGroup")]
);
if ($self->session->setting->get("useKarma")) {
$tabform->getTab("properties")->integer(
-name=>"karmaPerVote",
-label=>WebGUI::International::get(20,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('20 description',"Asset_Poll"),
-label=>$i18n->get(20),
-hoverHelp=>$i18n->get('20 description'),
-value=>$self->getValue("karmaPerVote")
);
} else {
@ -211,33 +214,33 @@ sub getEditForm {
}
$tabform->getTab("display")->integer(
-name=>"graphWidth",
-label=>WebGUI::International::get(5,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('5 description',"Asset_Poll"),
-label=>$i18n->get(5),
-hoverHelp=>$i18n->get('5 description'),
-value=>$self->getValue("graphWidth")
);
$tabform->getTab("properties")->text(
-name=>"question",
-label=>WebGUI::International::get(6,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('6 description',"Asset_Poll"),
-label=>$i18n->get(6),
-hoverHelp=>$i18n->get('6 description'),
-value=>$self->getValue("question")
);
$tabform->getTab("properties")->textarea(
-name=>"answers",
-label=>WebGUI::International::get(7,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('7 description',"Asset_Poll"),
-subtext=>('<span class="formSubtext"><br />'.WebGUI::International::get(8,"Asset_Poll").'</span>'),
-label=>$i18n->get(7),
-hoverHelp=>$i18n->get('7 description'),
-subtext=>('<span class="formSubtext"><br />'.$i18n->get(8).'</span>'),
-value=>$answers
);
$tabform->getTab("display")->yesNo(
-name=>"randomizeAnswers",
-label=>WebGUI::International::get(72,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('72 description',"Asset_Poll"),
-label=>$i18n->get(72),
-hoverHelp=>$i18n->get('72 description'),
-value=>$self->getValue("randomizeAnswers")
);
$tabform->getTab("properties")->yesNo(
-name=>"resetVotes",
-label=>WebGUI::International::get(10,"Asset_Poll"),
-hoverHelp=>WebGUI::International::get('10 description',"Asset_Poll")
-label=>$i18n->get(10),
-hoverHelp=>$i18n->get('10 description')
) if $self->session->form->process("func") ne 'add';
return $tabform;
}
@ -291,11 +294,12 @@ sub view {
}
$var{canVote} = $showPoll;
my ($totalResponses) = $self->session->db->quickArray("select count(*) from Poll_answer where assetId=".$self->session->db->quote($self->getId));
$var{"responses.label"} = WebGUI::International::get(12,"Asset_Poll");
my $i18n = WebGUI::International->new($self->session,"Asset_Poll");
$var{"responses.label"} = $i18n->get(12);
$var{"responses.total"} = $totalResponses;
$var{"form.start"} = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl});
$var{"form.start"} .= WebGUI::Form::hidden($self->session,{name=>'func',value=>'vote'});
$var{"form.submit"} = WebGUI::Form::submit($self->session,{value=>WebGUI::International::get(11,"Asset_Poll")});
$var{"form.submit"} = WebGUI::Form::submit($self->session,{value=>$i18n->get(11)});
$var{"form.end"} = WebGUI::Form::formFooter($self->session,);
$totalResponses = 1 if ($totalResponses < 1);
for (my $i=1; $i<=20; $i++) {

View file

@ -31,18 +31,19 @@ sub _addFileTab {
my $tabform = $_[0];
my $column = $_[1];
my $internationalId = $_[2];
my $i18n = WebGUI::International->new($self->session,"Asset_Product");
unless ($self->get($column)){
$tabform->getTab("properties")->file(
-name=>$column,
-label=>WebGUI::International::get($internationalId,"Asset_Product"),
-label=>$i18n->get($internationalId),
);
return;
}
my $file = WebGUI::Storage->get($self->get($column));
$tabform->getTab("properties")->readOnly(
-value=>'<a href="'.$self->getUrl('func=deleteFileConfirm&file='.$column).'">'.WebGUI::International::get("deleteImage","Asset_Product").'</a>',
-label=>WebGUI::International::get($internationalId,"Asset_Product"),
-value=>'<a href="'.$self->getUrl('func=deleteFileConfirm&file='.$column).'">'.$i18n->get("deleteImage").'</a>',
-label=>$i18n->get($internationalId),
);
}
@ -95,9 +96,11 @@ sub addRevision {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
return $class->SUPER::definition($definition);
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Product");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Product"),
assetName=>$i18n->get('assetName'),
icon=>'product.gif',
tableName=>'Product',
className=>'WebGUI::Asset::Wobject::Product',
@ -140,7 +143,7 @@ sub definition {
# },
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -200,23 +203,24 @@ sub duplicate {
sub getEditForm {
my $self = shift;
my ($file);
my $i18n = WebGUI::International->new($self->session,"Asset_Product");
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-namespace=>"Product",
-label=>WebGUI::International::get(62,"Asset_Product"),
-hoverHelp=>WebGUI::International::get('62 description',"Asset_Product"),
-label=>$i18n->get(62),
-hoverHelp=>$i18n->get('62 description'),
);
$tabform->getTab("properties")->text(
-name=>"price",
-label=>WebGUI::International::get(10,"Asset_Product"),
-hoverHelp=>WebGUI::International::get('10 description',"Asset_Product"),
-label=>$i18n->get(10),
-hoverHelp=>$i18n->get('10 description'),
-value=>$self->getValue("price")
);
$tabform->getTab("properties")->text(
-name=>"productNumber",
-label=>WebGUI::International::get(11,"Asset_Product"),
-hoverHelp=>WebGUI::International::get('11 description',"Asset_Product"),
-label=>$i18n->get(11),
-hoverHelp=>$i18n->get('11 description'),
-value=>$self->getValue("productNumber")
);
$self->_addFileTab($tabform,"image1",7);
@ -320,16 +324,17 @@ sub www_addAccessory {
@usedAccessories = $self->session->db->buildArray("select accessoryAssetId from Product_accessory where assetId=".$self->session->db->quote($self->getId));
push(@usedAccessories,$self->getId);
$accessory = $self->session->db->buildHashRef("select asset.assetId, assetData.title from asset left join assetData on assetData.assetId=asset.assetId where asset.className='WebGUI::Asset::Wobject::Product' and asset.assetId not in (".$self->session->db->quoteAndJoin(\@usedAccessories).") and (assetData.status='approved' or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).") group by assetData.assetId");
my $i18n = WebGUI::International->new($self->session,"Asset_Product");
$f->selectBox(
-name => "accessoryAccessId",
-options => $accessory,
-label => WebGUI::International::get(17,'Asset_Product'),
-hoverHelp => WebGUI::International::get('17 description','Asset_Product'),
-label => $i18n->get(17),
-hoverHelp => $i18n->get('17 description'),
);
$f->yesNo(
-name => "proceed",
-label => WebGUI::International::get(18,'Asset_Product'),
-hoverHelp => WebGUI::International::get('18 description','Asset_Product'),
-label => $i18n->get(18),
-hoverHelp => $i18n->get('18 description'),
);
$f->submit;
return $self->getAdminConsole->render($f->print, "product accessory add/edit");
@ -359,16 +364,17 @@ sub www_addRelated {
@usedRelated = $self->session->db->buildArray("select relatedAssetId from Product_related where assetId=".$self->session->db->quote($self->getId));
push(@usedRelated,$self->getId);
$related = $self->session->db->buildHashRef("select assetId,title from asset where className='WebGUI::Asset::Wobject::Product' and assetId not in (".$self->session->db->quoteAndJoin(\@usedRelated).")");
my $i18n = WebGUI::International->new($self->session,'Asset_Product');
$f->selectBox(
-name => "relatedAssetId",
-options => $related,
-label => WebGUI::International::get(20,'Asset_Product'),
-hoverHelp => WebGUI::International::get('20 description','Asset_Product'),
-label => $i18n->get(20),
-hoverHelp => $i18n->get('20 description'),
);
$f->yesNo(
-name => "proceed",
-label => WebGUI::International::get(21,'Asset_Product'),
-hoverHelp => WebGUI::International::get('21 description','Asset_Product'),
-label => $i18n->get(21),
-hoverHelp => $i18n->get('21 description'),
);
$f->submit;
return $self->getAdminConsole->render($f->print,"product related add/edit");
@ -469,6 +475,7 @@ sub www_editBenefit {
return $self->session->privilege->insufficient() unless ($self->canEdit);
my ($data, $f, $benefits);
$data = $self->getCollateral("Product_benefit","Product_benefitId",$self->session->form->process("bid"));
my $i18n = WebGUI::International->new($self->session,'Asset_Product');
$f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name => "bid",
@ -482,14 +489,14 @@ sub www_editBenefit {
$f->combo(
-name => "benefit",
-options => $benefits,
-label => WebGUI::International::get(51,'Asset_Product'),
-hoverHelp => WebGUI::International::get('51 description','Asset_Product'),
-label => $i18n->get(51),
-hoverHelp => $i18n->get('51 description'),
-value => [$data->{benefits}],
);
$f->yesNo(
-name => "proceed",
-label => WebGUI::International::get(52,'Asset_Product'),
-hoverHelp => WebGUI::International::get('52 description','Asset_Product'),
-label => $i18n->get(52),
-hoverHelp => $i18n->get('52 description'),
);
$f->submit;
return $self->getAdminConsole->render($f->print, "product benefit add/edit");
@ -516,6 +523,7 @@ sub www_editFeature {
return $self->session->privilege->insufficient() unless ($self->canEdit);
my ($data, $f, $features);
$data = $self->getCollateral("Product_feature","Product_featureId",$self->session->form->process("fid"));
my $i18n = WebGUI::International->new($self->session,'Asset_Product');
$f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name => "fid",
@ -529,14 +537,14 @@ sub www_editFeature {
$f->combo(
-name => "feature",
-options => $features,
-label => WebGUI::International::get(23,'Asset_Product'),
-hoverHelp => WebGUI::International::get('23 description','Asset_Product'),
-label => $i18n->get(23),
-hoverHelp => $i18n->get('23 description'),
-value => [$data->{feature}],
);
$f->yesNo(
-name => "proceed",
-label => WebGUI::International::get(24,'Asset_Product'),
-hoverHelp => WebGUI::International::get('24 description','Asset_Product'),
-label => $i18n->get(24),
-hoverHelp => $i18n->get('24 description'),
);
$f->submit;
return $self->getAdminConsole->render($f->print, "product feature add/edit");
@ -561,6 +569,7 @@ sub www_editSpecification {
my $self = shift;
return $self->session->privilege->insufficient() unless ($self->canEdit);
my ($data, $f, $hashRef);
my $i18n = WebGUI::International->new($self->session,'Asset_Product');
$data = $self->getCollateral("Product_specification","Product_specificationId",$self->session->form->process("sid"));
$f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
@ -575,28 +584,28 @@ sub www_editSpecification {
$f->combo(
-name => "name",
-options => $hashRef,
-label => WebGUI::International::get(26,'Asset_Product'),
-hoverHelp => WebGUI::International::get('26 description','Asset_Product'),
-label => $i18n->get(26),
-hoverHelp => $i18n->get('26 description'),
-value => [$data->{name}],
);
$f->text(
-name => "value",
-label => WebGUI::International::get(27,'Asset_Product'),
-hoverHelp => WebGUI::International::get('27 description','Asset_Product'),
-label => $i18n->get(27),
-hoverHelp => $i18n->get('27 description'),
-value => $data->{value},
);
$hashRef = $self->session->db->buildHashRef("select units,units from Product_specification order by units");
$f->combo(
-name => "units",
-options => $hashRef,
-label => WebGUI::International::get(29,'Asset_Product'),
-hoverHelp => WebGUI::International::get('29 description','Asset_Product'),
-label => $i18n->get(29),
-hoverHelp => $i18n->get('29 description'),
-value => [$data->{units}],
);
$f->yesNo(
-name => "proceed",
-label => WebGUI::International::get(28,'Asset_Product'),
-hoverHelp => WebGUI::International::get('28 description','Asset_Product'),
-label => $i18n->get(28),
-hoverHelp => $i18n->get('28 description'),
);
$f->submit;
return $self->getAdminConsole->render($f->print, "product specification add/edit");
@ -713,24 +722,25 @@ sub view {
my $image2 = $self->get("image2");
my $image3 = $self->get("image3");
#---brochure
my $i18n = WebGUI::International->new($self->session,'Asset_Product');
if ($brochure) {
$file = WebGUI::Storage->get($brochure);
$var{"brochure.icon"} = $self->getFileIconUrl($file);
$var{"brochure.label"} = WebGUI::International::get(13,"Asset_Product");
$var{"brochure.label"} = $i18n->get(13);
$var{"brochure.URL"} = $self->getFileUrl($file);
}
#---manual
if ($manual) {
$file = WebGUI::Storage->get($manual);
$var{"manual.icon"} = $self->getFileIconUrl($file);
$var{"manual.label"} = WebGUI::International::get(14,"Asset_Product");
$var{"manual.label"} = $i18n->get(14);
$var{"manual.URL"} = $self->getFileUrl($file);
}
#---warranty
if ($warranty) {
$file = WebGUI::Storage->get($warranty);
$var{"warranty.icon"} = $self->getFileIconUrl($file);
$var{"warranty.label"} = WebGUI::International::get(15,"Asset_Product");
$var{"warranty.label"} = $i18n->get(15);
$var{"warranty.URL"} = $self->getFileUrl($file);
}
#---image1
@ -754,10 +764,10 @@ sub view {
#---features
$var{"addFeature.url"} = $self->getUrl('func=editFeature&fid=new');
$var{"addFeature.label"} = WebGUI::International::get(34,'Asset_Product');
$var{"addFeature.label"} = $i18n->get(34);
$sth = $self->session->db->read("select feature,Product_featureId from Product_feature where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
while (%data = $sth->hash) {
$segment = $self->session->icon->delete('func=deleteFeatureConfirm&fid='.$data{Product_featureId},$self->get("url"),WebGUI::International::get(3,'Asset_Product'))
$segment = $self->session->icon->delete('func=deleteFeatureConfirm&fid='.$data{Product_featureId},$self->get("url"),$i18n->get(3))
.$self->session->icon->edit('func=editFeature&fid='.$data{Product_featureId},$self->get("url"))
.$self->session->icon->moveUp('func=moveFeatureUp&&fid='.$data{Product_featureId},$self->get("url"))
.$self->session->icon->moveDown('func=moveFeatureDown&&fid='.$data{Product_featureId},$self->get("url"));
@ -771,10 +781,10 @@ sub view {
#---benefits
$var{"addBenefit.url"} = $self->getUrl('func=editBenefit&fid=new');
$var{"addBenefit.label"} = WebGUI::International::get(55,'Asset_Product');
$var{"addBenefit.label"} = $i18n->get(55);
$sth = $self->session->db->read("select benefit,Product_benefitId from Product_benefit where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
while (%data = $sth->hash) {
$segment = $self->session->icon->delete('func=deleteBenefitConfirm&bid='.$data{Product_benefitId},$self->get("url"),WebGUI::International::get(48,'Asset_Product'))
$segment = $self->session->icon->delete('func=deleteBenefitConfirm&bid='.$data{Product_benefitId},$self->get("url"),$i18n->get(48))
.$self->session->icon->edit('func=editBenefit&bid='.$data{Product_benefitId},$self->get("url"))
.$self->session->icon->moveUp('func=moveBenefitUp&bid='.$data{Product_benefitId},$self->get("url"))
.$self->session->icon->moveDown('func=moveBenefitDown&bid='.$data{Product_benefitId},$self->get("url"));
@ -788,10 +798,10 @@ sub view {
#---specifications
$var{"addSpecification.url"} = $self->getUrl('func=editSpecification&sid=new');
$var{"addSpecification.label"} = WebGUI::International::get(35,'Asset_Product');
$var{"addSpecification.label"} = $i18n->get(35);
$sth = $self->session->db->read("select name,value,units,Product_specificationId from Product_specification where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
while (%data = $sth->hash) {
$segment = $self->session->icon->delete('func=deleteSpecificationConfirm&sid='.$data{Product_specificationId},$self->get("url"),WebGUI::International::get(5,'Asset_Product'))
$segment = $self->session->icon->delete('func=deleteSpecificationConfirm&sid='.$data{Product_specificationId},$self->get("url"),$i18n->get(5))
.$self->session->icon->edit('func=editSpecification&sid='.$data{Product_specificationId},$self->get("url"))
.$self->session->icon->moveUp('func=moveSpecificationUp&sid='.$data{Product_specificationId},$self->get("url"))
.$self->session->icon->moveDown('func=moveSpecificationDown&sid='.$data{Product_specificationId},$self->get("url"));
@ -807,12 +817,12 @@ sub view {
#---accessories
$var{"addaccessory.url"} = $self->getUrl('func=addAccessory');
$var{"addaccessory.label"} = WebGUI::International::get(36,'Asset_Product');
$var{"addaccessory.label"} = $i18n->get(36);
$sth = $self->session->db->read("select Product_accessory.accessoryAssetId from Product_accessory
where Product_accessory.assetId=".$self->session->db->quote($self->getId)."
order by Product_accessory.sequenceNumber");
while (my ($id) = $sth->array) {
$segment = $self->session->icon->delete('func=deleteAccessoryConfirm&aid='.$id,$self->get("url"),WebGUI::International::get(2,'Asset_Product'))
$segment = $self->session->icon->delete('func=deleteAccessoryConfirm&aid='.$id,$self->get("url"),$i18n->get(2))
.$self->session->icon->moveUp('func=moveAccessoryUp&aid='.$id,$self->get("url"))
.$self->session->icon->moveDown('func=moveAccessoryDown&aid='.$id,$self->get("url"));
my $accessory = WebGUI::Asset->newByDynamicClass($id);
@ -827,13 +837,13 @@ sub view {
#---related
$var{"addrelatedproduct.url"} = $self->getUrl('func=addRelated');
$var{"addrelatedproduct.label"} = WebGUI::International::get(37,'Asset_Product');
$var{"addrelatedproduct.label"} = $i18n->get(37);
$sth = $self->session->db->read("select Product_related.relatedAssetId
from Product_related
where Product_related.assetId=".$self->session->db->quote($self->getId)."
order by Product_related.sequenceNumber");
while (my ($id) = $sth->array) {
$segment = $self->session->icon->delete('func=deleteRelatedConfirm&rid='.$id,$self->get("url"),WebGUI::International::get(4,'Asset_Product'))
$segment = $self->session->icon->delete('func=deleteRelatedConfirm&rid='.$id,$self->get("url"),$i18n->get(4))
.$self->session->icon->moveUp('func=moveRelatedUp&rid='.$id,$self->get("url"))
.$self->session->icon->moveDown('func=moveRelatedDown&rid='.$id,$self->get("url"));
my $related = WebGUI::Asset->newByDynamicClass($id);

View file

@ -30,9 +30,11 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_SQLReport");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_SQLReport"),
assetName=>$i18n->get('assetName'),
uiLevel => 9,
icon=>'sqlReport.gif',
tableName=>'SQLReport',
@ -132,23 +134,24 @@ sub definition {
},
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_SQLReport");
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>WebGUI::International::get(72,"Asset_SQLReport"),
-hoverHelp=>WebGUI::International::get('72 description',"Asset_SQLReport"),
-label=>$i18n->get(72),
-hoverHelp=>$i18n->get('72 description'),
-namespace=>"SQLReport"
);
$tabform->getTab("properties")->yesNo(
-name=>"debugMode",
-label=>WebGUI::International::get(16,"Asset_SQLReport"),
-hoverHelp=>WebGUI::International::get('16 description',"Asset_SQLReport"),
-label=>$i18n->get(16),
-hoverHelp=>$i18n->get('16 description'),
-value=>$self->getValue("debugMode")
);
@ -178,24 +181,24 @@ sub getEditForm {
$tabform->getTab("properties")->readOnly(
-value=>"<hr>",
-label=>join '', "<b>", WebGUI::International::get('4','Asset_SQLReport'), $nr,":</b>",
-label=>join '', "<b>", $i18n->get('4'), $nr,":</b>",
);
$tabform->getTab("properties")->yesNo(
-name=>"preprocessMacros".$nr,
-label=>WebGUI::International::get(15,"Asset_SQLReport"),
-hoverHelp=>WebGUI::International::get('15 description',"Asset_SQLReport"),
-label=>$i18n->get(15),
-hoverHelp=>$i18n->get('15 description'),
-value=>$self->getValue("preprocessMacros".$nr)
);
$tabform->getTab("properties")->textarea(
-name=>"placeholderParams".$nr,
-label=>WebGUI::International::get('Placeholder Parameters',"Asset_SQLReport"),
-hoverHelp=>WebGUI::International::get('Placeholder Parameters description',"Asset_SQLReport"),
-label=>$i18n->get('Placeholder Parameters'),
-hoverHelp=>$i18n->get('Placeholder Parameters description'),
-value=>$self->getValue("placeholderParams".$nr)
);
$tabform->getTab("properties")->codearea(
-name=>"dbQuery".$nr,
-label=>WebGUI::International::get(4,"Asset_SQLReport"),
-hoverHelp=>WebGUI::International::get('4 description',"Asset_SQLReport"),
-label=>$i18n->get(4),
-hoverHelp=>$i18n->get('4 description'),
-value=>$self->getValue("dbQuery".$nr)
);
$tabform->getTab("properties")->databaseLink(
@ -206,7 +209,7 @@ sub getEditForm {
# Add a "Add another query" button
if ($nr < 5 and ($self->get("dbQuery".($nr+1)) eq "" || ($self->get("dbQuery".($nr)) eq "" and $self->get("dbQuery".($nr+1)) ne ""))) {
$tabform->getTab("properties")->button(
-value=>WebGUI::International::get('Add another query',"Asset_SQLReport"),
-value=>$i18n->get('Add another query'),
-extras=>'onclick="toggleQuery(\''.($nr+1).'\'); this.style.display=\'none\';"',
-noWait=>1
);
@ -227,8 +230,8 @@ sub getEditForm {
$tabform->getTab("display")->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(14,"Asset_SQLReport"),
-hoverHelp=>WebGUI::International::get('14 description',"Asset_SQLReport"),
-label=>$i18n->get(14),
-hoverHelp=>$i18n->get('14 description'),
-value=>$self->getValue("paginateAfter")
);
return $tabform;
@ -322,8 +325,9 @@ sub _processQuery {
$query = $self->{_query}{$nr}{dbQuery};
}
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(17,"Asset_SQLReport").$query});
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get('debug placeholder parameters',"Asset_SQLReport").join(",",@$placeholderParams)});
my $i18n = WebGUI::International->new($self->session,"Asset_SQLReport");
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get(17).$query});
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get('debug placeholder parameters').join(",",@$placeholderParams)});
my $dbLink = WebGUI::DatabaseLink->new($self->session,$self->{_query}{$nr}{databaseLinkId});
my $dbh = $dbLink->db;
if (defined $dbh) {
@ -341,7 +345,7 @@ sub _processQuery {
my $error = $p->setDataByQuery($query,$dbh,1,$placeholderParams);
if ($error ne "") {
$self->session->errorHandler->warn("There was a problem with the query: ".$error);
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(11,"Asset_SQLReport")." ".$error});
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get(11)." ".$error});
} else {
my $first = 1;
my @columns;
@ -385,16 +389,16 @@ sub _processQuery {
$var{$prefix.'columns.count'} = scalar(@columns);
$var{$prefix.'rows.count'} = $p->getRowCount;
$var{$prefix.'rows.count.isZero'} = ($p->getRowCount < 1);
$var{$prefix.'rows.count.isZero.label'} = WebGUI::International::get(18,"Asset_SQLReport");
$var{$prefix.'rows.count.isZero.label'} = $i18n->get(18);
$p->appendTemplateVars(\%var) if ($nr == 1);
}
} else {
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(10,"Asset_SQLReport")});
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get(10)});
$self->session->errorHandler->warn("SQLReport [".$self->getId."] The SQL query is improperly formatted.");
}
$dbLink->disconnect;
} else {
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(12,"Asset_SQLReport")});
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get(12)});
$self->session->errorHandler->warn("SQLReport [".$self->getId."] Could not connect to database.");
}
return \%var;

View file

@ -276,6 +276,7 @@ defines wobject properties for Stock Data instances
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $properties = {
templateId =>{
@ -299,14 +300,15 @@ sub definition {
defaultValue=>undef
}
};
my $i18n = WebGUI::International->new($session,"Asset_StockData");
push(@{$definition}, {
tableName=>'StockData',
className=>'WebGUI::Asset::Wobject::StockData',
icon=>'stockData.gif',
assetName=>WebGUI::International::get("assetName","Asset_StockData"),
assetName=>$i18n->get("assetName"),
properties=>$properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -319,40 +321,41 @@ returns the tabform object that will be used in generating the edit page for Sto
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_StockData");
$tabform->getTab("display")->template(
-name=>"templateId",
-value=>$self->get("templateId"),
-label=>WebGUI::International::get("template_label","Asset_StockData"),
-label=>$i18n->get("template_label"),
-namespace=>"StockData"
);
$tabform->getTab("display")->template(
-name=>"displayTemplateId",
-value=>$self->get("displayTemplateId"),
-label=>WebGUI::International::get("display_template_label","Asset_StockData"),
-label=>$i18n->get("display_template_label"),
-namespace=>"StockData/Display"
);
$tabform->getTab("properties")->textarea(
-name => "defaultStocks",
-label=> WebGUI::International::get("default_stock_label","Asset_StockData"),
-label=> $i18n->get("default_stock_label"),
-value=> $self->getValue("defaultStocks")
);
$tabform->getTab("properties")->selectList(
-name => "source",
-label=> WebGUI::International::get("stock_source","Asset_StockData"),
-label=> $i18n->get("stock_source"),
-options=>$self->_getStockSources(),
-value=> [$self->getValue("source")],
-hoverHelp=>WebGUI::International::get("stock_source_description","Asset_StockData")
-hoverHelp=>$i18n->get("stock_source_description")
);
$tabform->getTab("properties")->yesNo(
-name=> "failover",
-label=> WebGUI::International::get("failover_label","Asset_StockData"),
-label=> $i18n->get("failover_label"),
-value=>$self->getValue("failover"),
-hoverHelp=> WebGUI::International::get("failover_description","Asset_StockData")
-hoverHelp=> $i18n->get("failover_description")
);
return $tabform;

View file

@ -32,11 +32,12 @@ our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub addAnswer {
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
$_[0]->setCollateral("Survey_answer","Survey_answerId",{
Survey_id=>$_[0]->get("Survey_id"),
Survey_questionId=>$_[2],
Survey_answerId=>"new",
answer=>WebGUI::International::get($_[1],'Asset_Survey')
answer=>$i18n->get($_[1])
},1,0,"Survey_id");
}
@ -63,9 +64,11 @@ sub completeResponse {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,'Asset_Survey');
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName','Asset_Survey'),
assetName=>$i18n->get('assetName'),
uiLevel => 5,
icon=>'survey.gif',
tableName => 'Survey',
@ -125,7 +128,7 @@ sub definition {
},
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -209,38 +212,39 @@ sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new($self->session, 'Asset_Survey');
$tabform->getTab('properties')->hidden(
-name => "Survey_id",
-value => ($self->get("Survey_id") || $self->session->id->generate())
);
$tabform->getTab('display')->template(
-name => 'templateId',
-label => WebGUI::International::get('view template', 'Asset_Survey'),
-hoverHelp => WebGUI::International::get('view template description', 'Asset_Survey'),
-label => $i18n->get('view template'),
-hoverHelp => $i18n->get('view template description'),
-value => $self->getValue('templateId'),
-namespace => 'Survey',
-afterEdit => 'func=edit'
);
$tabform->getTab('display')->template(
-name => 'responseTemplateId',
-label => WebGUI::International::get('response template', 'Asset_Survey'),
-hoverHelp => WebGUI::International::get('response template description', 'Asset_Survey'),
-label => $i18n->get('response template'),
-hoverHelp => $i18n->get('response template description'),
-value => $self->getValue('responseTemplateId'),
-namespace => 'Survey/Response',
-afterEdit => 'func=edit'
);
$tabform->getTab('display')->template(
-name => 'gradebookTemplateId',
-label => WebGUI::International::get('gradebook template', 'Asset_Survey'),
-hoverHelp => WebGUI::International::get('gradebook template description', 'Asset_Survey'),
-label => $i18n->get('gradebook template'),
-hoverHelp => $i18n->get('gradebook template description'),
-value => $self->getValue('gradebookTemplateId'),
-namespace => 'Survey/Gradebook',
-afterEdit => 'func=edit'
);
$tabform->getTab('display')->template(
-name => 'overviewTemplateId',
-label => WebGUI::International::get('overview template', 'Asset_Survey'),
-hoverHelp => WebGUI::International::get('overview template description', 'Asset_Survey'),
-label => $i18n->get('overview template'),
-hoverHelp => $i18n->get('overview template description'),
-value => $self->getValue('overviewTemplateId'),
-namespace => 'Survey/Overview',
-afterEdit => 'func=edit'
@ -249,69 +253,69 @@ sub getEditForm {
$tabform->getTab('display')->selectBox(
-name => "questionOrder",
-options => {
sequential => WebGUI::International::get(5,'Asset_Survey'),
random => WebGUI::International::get(6,'Asset_Survey'),
response => WebGUI::International::get(7,'Asset_Survey'),
section => WebGUI::International::get(106, 'Asset_Survey')
sequential => $i18n->get(5),
random => $i18n->get(6),
response => $i18n->get(7),
section => $i18n->get(106)
},
-label => WebGUI::International::get(8,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('8 description','Asset_Survey'),
-label => $i18n->get(8),
-hoverHelp => $i18n->get('8 description'),
-value => [$self->getValue("questionOrder")]
);
$tabform->getTab('display')->integer(
-name => "questionsPerPage",
-value => $self->getValue("questionsPerPage"),
-label => WebGUI::International::get(83,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('83 description','Asset_Survey')
-label => $i18n->get(83),
-hoverHelp => $i18n->get('83 description')
);
$tabform->getTab('properties')->selectBox(
-name => "mode",
-options => {
survey => WebGUI::International::get(9,'Asset_Survey'),
quiz => WebGUI::International::get(10,'Asset_Survey')
survey => $i18n->get(9),
quiz => $i18n->get(10)
},
-label => WebGUI::International::get(11,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('11 description','Asset_Survey'),
-label => $i18n->get(11),
-hoverHelp => $i18n->get('11 description'),
-value => [$self->getValue("mode")]
);
$tabform->getTab('properties')->yesNo(
-name => "anonymous",
-value => $self->getValue("anonymous"),
-label => WebGUI::International::get(81,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('81 description','Asset_Survey')
-label => $i18n->get(81),
-hoverHelp => $i18n->get('81 description')
);
$tabform->getTab('properties')->integer(
-name => "maxResponsesPerUser",
-value => $self->getValue("maxResponsesPerUser"),
-label => WebGUI::International::get(84,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('84 description','Asset_Survey')
-label => $i18n->get(84),
-hoverHelp => $i18n->get('84 description')
);
$tabform->getTab('properties')->integer(
-name => "questionsPerResponse",
-value => $self->getValue("questionsPerResponse"),
-label => WebGUI::International::get(85,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('85 description','Asset_Survey')
-label => $i18n->get(85),
-hoverHelp => $i18n->get('85 description')
);
$tabform->getTab('security')->group(
-name => "groupToTakeSurvey",
-value => [$self->getValue("groupToTakeSurvey")],
-label => WebGUI::International::get(12,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('12 description','Asset_Survey')
-label => $i18n->get(12),
-hoverHelp => $i18n->get('12 description')
);
$tabform->getTab('security')->group(
-name => "groupToViewReports",
-label => WebGUI::International::get(13,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('13 description','Asset_Survey'),
-label => $i18n->get(13),
-hoverHelp => $i18n->get('13 description'),
-value => [$self->getValue("groupToViewReports")]
);
if ($self->get("assetId") eq "new") {
$tabform->getTab('properties')->whatNext(
-options=>{
editQuestion=>WebGUI::International::get(28,'Asset_Survey'),
viewParent=>WebGUI::International::get(745,'Asset_Survey')
editQuestion=>$i18n->get(28),
viewParent=>$i18n->get(745)
},
-value=>"editQuestion",
-hoverHelp => WebGUI::International::get('what next description','Asset_Survey'),
-hoverHelp => $i18n->get('what next description'),
);
}
@ -329,23 +333,24 @@ sub getIp {
sub getMenuVars {
my $self = shift;
my %var;
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
$var{'user.canViewReports'} = ($self->session->user->isInGroup($self->get("groupToViewReports")));
$var{'delete.all.responses.url'} = $self->getUrl('func=deleteAllResponses');
$var{'delete.all.responses.label'} = WebGUI::International::get(73,'Asset_Survey');
$var{'delete.all.responses.label'} = $i18n->get(73);
$var{'export.answers.url'} = $self->getUrl('func=exportAnswers');
$var{'export.answers.label'} = WebGUI::International::get(62,'Asset_Survey');
$var{'export.answers.label'} = $i18n->get(62);
$var{'export.questions.url'} = $self->getUrl('func=exportQuestions');
$var{'export.questions.label'} = WebGUI::International::get(63,'Asset_Survey');
$var{'export.questions.label'} = $i18n->get(63);
$var{'export.responses.url'} = $self->getUrl('func=exportResponses');
$var{'export.responses.label'} = WebGUI::International::get(64,'Asset_Survey');
$var{'export.responses.label'} = $i18n->get(64);
$var{'export.composite.url'} = $self->getUrl('func=exportComposite');
$var{'export.composite.label'} = WebGUI::International::get(65,'Asset_Survey');
$var{'export.composite.label'} = $i18n->get(65);
$var{'report.gradebook.url'} = $self->getUrl('func=viewGradebook');
$var{'report.gradebook.label'} = WebGUI::International::get(61,'Asset_Survey');
$var{'report.gradebook.label'} = $i18n->get(61);
$var{'report.overview.url'} = $self->getUrl('func=viewStatisticalOverview');
$var{'report.overview.label'} = WebGUI::International::get(59,'Asset_Survey');
$var{'report.overview.label'} = $i18n->get(59);
$var{'survey.url'} = $self->getUrl;
$var{'survey.label'} = WebGUI::International::get(60,'Asset_Survey');
$var{'survey.label'} = $i18n->get(60);
return \%var;
}
@ -404,6 +409,7 @@ sub getQuestionResponseCount {
sub getQuestionVars {
my $self = shift;
my $questionId = shift;
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
my %var;
my $question = $self->session->db->getRow("Survey_question","Survey_questionId",$questionId);
$var{'question.question'} = $question->{question};
@ -412,7 +418,7 @@ sub getQuestionVars {
$var{'question.comment.field'} = WebGUI::Form::textarea({
name=>'comment_'.$questionId
});
$var{'question.comment.label'} = WebGUI::International::get(51,'Asset_Survey');
$var{'question.comment.label'} = $i18n->get(51);
my $answer;
($answer) = $self->session->db->quickArray("select Survey_answerId from Survey_answer where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId}));
@ -566,8 +572,9 @@ sub getUserId {
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
my $i18n = WebGUI::International->new($self->session);
if ($self->session->form->process("assetId") eq "new") {
$self->addSection(WebGUI::International::get(107, 'Asset_Survey'));
$self->addSection($i18n->get(107));
}
}
@ -606,11 +613,12 @@ sub setAnswerType {
sub view {
my $self = shift;
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
my $i18n = WebGUI::International->new($self->session, 'Asset_Survey');
my $var = $self->getMenuVars;
$var->{'question.add.url'} = $self->getUrl('func=editQuestion;qid=new');
$var->{'question.add.label'} = WebGUI::International::get(30,'Asset_Survey');
$var->{'question.add.label'} = $i18n->get(30);
$var->{'section.add.url'} = $self->getUrl('func=editSection;sid=new');
$var->{'section.add.label'} = WebGUI::International::get(104,'Asset_Survey');
$var->{'section.add.label'} = $i18n->get(104);
my @sectionEdit;
# Get Sections
@ -625,7 +633,7 @@ sub view {
while (my %data = $sth2->hash) {
push(@edit,{
'question.edit.controls'=>
$self->session->icon->delete('func=deleteQuestionConfirm;qid='.$data{Survey_questionId}, $self->get("url"), WebGUI::International::get(44,'Asset_Survey')).
$self->session->icon->delete('func=deleteQuestionConfirm;qid='.$data{Survey_questionId}, $self->get("url"), $i18n->get(44)).
$self->session->icon->edit('func=editQuestion;qid='.$data{Survey_questionId}, $self->get("url")).
$self->session->icon->moveUp('func=moveQuestionUp;qid='.$data{Survey_questionId}, $self->get("url")).
$self->session->icon->moveDown('func=moveQuestionDown;qid='.$data{Survey_questionId}, $self->get("url")),
@ -637,7 +645,7 @@ sub view {
push(@sectionEdit,{
'section.edit.controls'=>
$self->session->icon->delete('func=deleteSectionConfirm;sid='.$sectionData{Survey_sectionId}, $self->get("url"), WebGUI::International::get(105,'Asset_Survey')).
$self->session->icon->delete('func=deleteSectionConfirm;sid='.$sectionData{Survey_sectionId}, $self->get("url"), $i18n->get(105)).
$self->session->icon->edit('func=editSection;sid='.$sectionData{Survey_sectionId}, $self->get("url")).
$self->session->icon->moveUp('func=moveSectionUp;sid='.$sectionData{Survey_sectionId}, $self->get("url")).
$self->session->icon->moveDown('func=moveSectionDown;sid='.$sectionData{Survey_sectionId}, $self->get("url")),
@ -677,19 +685,19 @@ sub view {
});
$var->{'form.footer'} = WebGUI::Form::formFooter($self->session,);
$var->{'form.submit'} = WebGUI::Form::submit({
value=>WebGUI::International::get(50,'Asset_Survey')
value=>$i18n->get(50)
});
$var->{'questions.sofar.label'} = WebGUI::International::get(86,'Asset_Survey');
$var->{'start.newResponse.label'} = WebGUI::International::get(87,'Asset_Survey');
$var->{'questions.sofar.label'} = $i18n->get(86);
$var->{'start.newResponse.label'} = $i18n->get(87);
$var->{'start.newResponse.url'} = $self->getUrl("func=view;startNew=1");
$var->{'thanks.survey.label'} = WebGUI::International::get(46,'Asset_Survey');
$var->{'thanks.quiz.label'} = WebGUI::International::get(47,'Asset_Survey');
$var->{'thanks.survey.label'} = $i18n->get(46);
$var->{'thanks.quiz.label'} = $i18n->get(47);
$var->{'questions.total'} = $self->getQuestionCount;
$var->{'questions.correct.count.label'} = WebGUI::International::get(52,'Asset_Survey');
$var->{'questions.correct.percent.label'} = WebGUI::International::get(54,'Asset_Survey');
$var->{'questions.correct.count.label'} = $i18n->get(52);
$var->{'questions.correct.percent.label'} = $i18n->get(54);
$var->{'mode.isSurvey'} = ($self->get("mode") eq "survey");
$var->{'survey.noprivs.label'} = WebGUI::International::get(48,'Asset_Survey');
$var->{'quiz.noprivs.label'} = WebGUI::International::get(49,'Asset_Survey');
$var->{'survey.noprivs.label'} = $i18n->get(48);
$var->{'quiz.noprivs.label'} = $i18n->get(49);
return $self->processTemplate($var, $self->get("templateId"));
}
@ -717,7 +725,8 @@ sub www_deleteQuestionConfirm {
#-------------------------------------------------------------------
sub www_deleteSectionConfirm {
return $self->session->privilege->insufficient() unless ($_[0]->canEdit);
my $none = WebGUI::International::get(107, 'Asset_Survey');
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
my $none = $i18n->get(107);
my ($sectionName) = $self->session->db->quickArray("select sectionName from Survey_section where Survey_sectionId="
.$self->session->db->quote($self->session->form->process("sid")));
if ($sectionName =~ /$none/) {
@ -733,7 +742,8 @@ sub www_deleteSectionConfirm {
#-------------------------------------------------------------------
sub www_deleteResponse {
return "" unless ($self->session->user->isInGroup($_[0]->get("groupToViewReports")));
return $self->session->style->process($_[0]->confirm(WebGUI::International::get(72,'Asset_Survey'),
my $i18n = WebGUI::International->new($self->session, 'Asset_Survey');
return $self->session->style->process($_[0]->confirm($i18n->get(72),
$_[0]->getUrl('func=deleteResponseConfirm;responseId='.$self->session->form->process("responseId"))),$_[0]->getValue("styleTemplateId"));
}
@ -748,7 +758,8 @@ sub www_deleteResponseConfirm {
#-------------------------------------------------------------------
sub www_deleteAllResponses {
return "" unless ($self->session->user->isInGroup($_[0]->get("groupToViewReports")));
return $self->session->style->process($_[0]->confirm(WebGUI::International::get(74,'Asset_Survey'),$_[0]->getUrl('func=deleteAllResponsesConfirm')),$_[0]->getValue("styleTemplateId"));
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
return $self->session->style->process($_[0]->confirm($i18n->get(74),$_[0]->getUrl('func=deleteAllResponsesConfirm')),$_[0]->getValue("styleTemplateId"));
}
#-------------------------------------------------------------------
@ -777,6 +788,7 @@ sub www_editAnswer {
return $self->session->privilege->insufficient() unless ($self->canEdit);
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
$answer = $self->getCollateral("Survey_answer","Survey_answerId",$self->session->form->process("aid"));
$f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
@ -798,15 +810,15 @@ sub www_editAnswer {
$f->text(
-name=>"answer",
-value=>$answer->{answer},
-label=>WebGUI::International::get(19,'Asset_Survey'),
-hoverHelp=>WebGUI::International::get('19 description','Asset_Survey')
-label=>$i18n->get(19),
-hoverHelp=>$i18n->get('19 description')
);
if ($self->get("mode") eq "quiz") {
$f->yesNo(
-name=>"isCorrect",
-value=>$answer->{isCorrect},
-label=>WebGUI::International::get(20,'Asset_Survey'),
-hoverHelp=>WebGUI::International::get('20 description','Asset_Survey')
-label=>$i18n->get(20),
-hoverHelp=>$i18n->get('20 description')
);
} else {
$f->hidden(
@ -817,34 +829,34 @@ sub www_editAnswer {
if ($self->get("questionOrder") eq "response") {
$question = $self->session->db->buildHashRef("select Survey_questionId,question
from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
$question = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$question) };
$question = { ('-1' => $i18n->get(82),%$question) };
$f->selectBox(
-name=>"gotoQuestion",
-options=>$question,
-value=>[$answer->{gotoQuestion}],
-label=>WebGUI::International::get(21,'Asset_Survey'),
-hoverHelp=>WebGUI::International::get('21 description','Asset_Survey')
-label=>$i18n->get(21),
-hoverHelp=>$i18n->get('21 description')
);
}
if ($answer->{Survey_answerId} eq "new") {
my %options;
tie %options, 'Tie::IxHash';
%options = (
"addAnswer"=>WebGUI::International::get(24,'Asset_Survey'),
"addQuestion"=>WebGUI::International::get(28,'Asset_Survey'),
"editQuestion"=>WebGUI::International::get(75,'Asset_Survey'),
"backToPage"=>WebGUI::International::get(745,'Asset_Survey')
"addAnswer"=>$i18n->get(24),
"addQuestion"=>$i18n->get(28),
"editQuestion"=>$i18n->get(75),
"backToPage"=>$i18n->get(745)
);
$f->whatNext(
-options=>\%options,
-value=>"addAnswer",
-hoverHelp=>WebGUI::International::get('what next answer description','Asset_Survey')
-hoverHelp=>$i18n->get('what next answer description')
);
}
$f->submit;
# $self->getAdminConsole->setHelp("answer add/edit","Asset_Survey");
return $self->getAdminConsole->render($f->print, WebGUI::International::get(18,'Asset_Survey'));
return $self->getAdminConsole->render($f->print, $i18n->get(18));
}
@ -877,6 +889,7 @@ sub www_editQuestion {
return $self->session->privilege->insufficient() unless ($self->canEdit);
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
tie %data, 'Tie::CPHash';
$question = $self->getCollateral("Survey_question","Survey_questionId",$self->session->form->process("qid"));
$answerFieldType = $question->{answerFieldType} || "radioList";
@ -901,20 +914,20 @@ sub www_editQuestion {
$f->HTMLArea(
-name => "question",
-value => $question->{question},
-label => WebGUI::International::get(14,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('14 description','Asset_Survey')
-label => $i18n->get(14),
-hoverHelp => $i18n->get('14 description')
);
$f->yesNo(
-name => "allowComment",
-value => $question->{allowComment},
-label => WebGUI::International::get(15,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('15 description','Asset_Survey')
-label => $i18n->get(15),
-hoverHelp => $i18n->get('15 description')
);
$f->yesNo(
-name => "randomizeAnswers",
-value => $question->{randomizeAnswers},
-label => WebGUI::International::get(16,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('16 description','Asset_Survey')
-label => $i18n->get(16),
-hoverHelp => $i18n->get('16 description')
);
my $sectionList = $self->session->db->buildHashRef("select Survey_sectionId,sectionName
@ -924,19 +937,19 @@ sub www_editQuestion {
-name => "section",
-options=> $sectionList,
-value => [$question->{Survey_sectionId}],
-label => WebGUI::International::get(106, 'Asset_Survey')
-label => $i18n->get(106)
);
if ($self->get("questionOrder") eq "response") {
my $ql = $self->session->db->buildHashRef("select Survey_questionId,question
from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
$ql = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$ql) };
$ql = { ('-1' => $i18n->get(82),%$ql) };
$f->selectBox(
-name => "gotoQuestion",
-options=> $ql,
-value => [$question->{gotoQuestion}],
-label => WebGUI::International::get(21,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('21 description','Asset_Survey')
-label => $i18n->get(21),
-hoverHelp => $i18n->get('21 description')
);
}
@ -944,20 +957,20 @@ sub www_editQuestion {
my %options;
tie %options, 'Tie::IxHash';
%options = (
"addMultipleChoiceAnswer" => WebGUI::International::get(24,'Asset_Survey'),
"addTextAnswer" => WebGUI::International::get(29,'Asset_Survey'),
"addBooleanAnswer" => WebGUI::International::get(25,'Asset_Survey'),
"addFrequencyAnswer" => WebGUI::International::get(26,'Asset_Survey'),
"addOpinionAnswer" => WebGUI::International::get(27,'Asset_Survey'),
"addHTMLAreaAnswer" => WebGUI::International::get(100,'Asset_Survey'),
"addTextAreaAnswer" => WebGUI::International::get(101,'Asset_Survey'),
#"addQuestion" => WebGUI::International::get(28,'Asset_Survey'),
"backToPage" => WebGUI::International::get(745,'Asset_Survey')
"addMultipleChoiceAnswer" => $i18n->get(24),
"addTextAnswer" => $i18n->get(29),
"addBooleanAnswer" => $i18n->get(25),
"addFrequencyAnswer" => $i18n->get(26),
"addOpinionAnswer" => $i18n->get(27),
"addHTMLAreaAnswer" => $i18n->get(100),
"addTextAreaAnswer" => $i18n->get(101),
#"addQuestion" => $i18n->get(28),
"backToPage" => $i18n->get(745)
);
$f->whatNext(
-options=> \%options,
-value => "addMultipleChoiceAnswer",
-hoverHelp => WebGUI::International::get('what next question description','Asset_Survey')
-hoverHelp => $i18n->get('what next question description')
);
}
$f->submit;
@ -968,13 +981,13 @@ sub www_editQuestion {
&& $question->{answerFieldType} ne "textArea"
) {
$output .= '<a href="'.$self->getUrl('func=editAnswer;aid=new;qid='
.$question->{Survey_questionId}).'">'.WebGUI::International::get(23,'Asset_Survey').'</a><p />';
.$question->{Survey_questionId}).'">'.$i18n->get(23).'</a><p />';
$sth = $self->session->db->read("select Survey_answerId,answer from Survey_answer
where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId})." order by sequenceNumber");
while (%data = $sth->hash) {
$output .=
$self->session->icon->delete('func=deleteAnswerConfirm;qid='.$question->{Survey_questionId}.';aid='.$data{Survey_answerId},
$self->get("url"),WebGUI::International::get(45,'Asset_Survey')).
$self->get("url"),$i18n->get(45)).
$self->session->icon->edit('func=editAnswer;qid='.$question->{Survey_questionId}.';aid='.$data{Survey_answerId}, $self->get("url")).
$self->session->icon->moveUp('func=moveAnswerUp'.';qid='.$question->{Survey_questionId}.';aid='.$data{Survey_answerId}, $self->get("url")).
$self->session->icon->moveDown('func=moveAnswerDown;qid='.$question->{Survey_questionId}.';aid='.$data{Survey_answerId}, $self->get("url")).
@ -983,7 +996,7 @@ sub www_editQuestion {
$sth->finish;
}
$self->getAdminConsole->setHelp("question add/edit","Asset_Survey");
return $self->getAdminConsole->render($output, WebGUI::International::get(17,'Asset_Survey'));
return $self->getAdminConsole->render($output, $i18n->get(17));
}
#-------------------------------------------------------------------
@ -1040,7 +1053,8 @@ sub www_editQuestionSave {
sub www_editSection {
my ($f, $section, $sectionName, $self);
$self = shift;
my $none = WebGUI::International::get(107, 'Asset_Survey');
my $i18n = WebGUI::International->new($self->sessionet(107, 'Asset_Survey');
my $none = $i18n->get(107);
return $self->session->privilege->insufficient() unless ($self->canEdit);
$section = $self->getCollateral("Survey_section","Survey_sectionId",$self->session->form->process("sid"));
@ -1065,11 +1079,11 @@ sub www_editSection {
$f->text(
-name => "sectionName",
-value => $section->{sectionName},
-label => WebGUI::International::get(102,'Asset_Survey')
-label => $i18n->get(102)
);
$f->submit;
my $output = $f->print;
return $self->getAdminConsole->render($output, WebGUI::International::get(103,'Asset_Survey'));
return $self->getAdminConsole->render($output, $i18n->get(103));
}
#-------------------------------------------------------------------
@ -1210,8 +1224,9 @@ sub www_viewGradebook {
my $self = shift;
return "" unless ($self->session->user->isInGroup($self->get("groupToViewReports")));
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
my $var = $self->getMenuVars;
$var->{title} = WebGUI::International::get(71,'Asset_Survey');
$var->{title} = $i18n->get(71);
my $p = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewGradebook'));
$p->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate from Survey_response
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by username,ipAddress,startDate");
@ -1220,9 +1235,9 @@ sub www_viewGradebook {
if ($var->{'question.count'} > $self->get("questionsPerResponse")) {
$var->{'question.count'} = $self->get("questionsPerResponse");
}
$var->{'response.user.label'} = WebGUI::International::get(67,'Asset_Survey');
$var->{'response.count.label'} = WebGUI::International::get(52,'Asset_Survey');
$var->{'response.percent.label'} = WebGUI::International::get(54,'Asset_Survey');
$var->{'response.user.label'} = $i18n->get(67);
$var->{'response.count.label'} = $i18n->get(52);
$var->{'response.percent.label'} = $i18n->get(54);
my @responseloop;
foreach my $user (@$users) {
my ($correctCount) = $self->session->db->quickArray("select count(*) from Survey_questionResponse a left join
@ -1247,27 +1262,28 @@ sub www_viewIndividualSurvey {
my $self = shift;
return "" unless ($self->session->user->isInGroup($self->get("groupToViewReports")));
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
my $var = $self->getMenuVars;
$var->{'title'} = WebGUI::International::get(70,'Asset_Survey');
$var->{'title'} = $i18n->get(70);
$var->{'delete.url'} = $self->getUrl('func=deleteResponse;responseId='.$self->session->form->process("responseId"));
$var->{'delete.label'} = WebGUI::International::get(69,'Asset_Survey');
$var->{'delete.label'} = $i18n->get(69);
my $response = $self->session->db->getRow("Survey_response","Survey_responseId",$self->session->form->process("responseId"));
$var->{'start.date.label'} = WebGUI::International::get(76,'Asset_Survey');
$var->{'start.date.label'} = $i18n->get(76);
$var->{'start.date.epoch'} = $response->{startDate};
$var->{'start.date.human'} =$self->session->datetime->epochToHuman($response->{startDate},"%z");
$var->{'start.time.human'} =$self->session->datetime->epochToHuman($response->{startDate},"%Z");
$var->{'end.date.label'} = WebGUI::International::get(77,'Asset_Survey');
$var->{'end.date.label'} = $i18n->get(77);
$var->{'end.date.epoch'} = $response->{endDate};
$var->{'end.date.human'} =$self->session->datetime->epochToHuman($response->{endDate},"%z");
$var->{'end.time.human'} =$self->session->datetime->epochToHuman($response->{endDate},"%Z");
$var->{'duration.label'} = WebGUI::International::get(78,'Asset_Survey');
$var->{'duration.label'} = $i18n->get(78);
$var->{'duration.minutes'} = int(($response->{end} - $response->{start})/60);
$var->{'duration.minutes.label'} = WebGUI::International::get(79,'Asset_Survey');
$var->{'duration.minutes.label'} = $i18n->get(79);
$var->{'duration.seconds'} = (($response->{endDate} - $response->{start})%60);
$var->{'duration.seconds.label'} = WebGUI::International::get(80,'Asset_Survey');
$var->{'answer.label'} = WebGUI::International::get(19,'Asset_Survey');
$var->{'response.label'} = WebGUI::International::get(66,'Asset_Survey');
$var->{'comment.label'} = WebGUI::International::get(57,'Asset_Survey');
$var->{'duration.seconds.label'} = $i18n->get(80);
$var->{'answer.label'} = $i18n->get(19);
$var->{'response.label'} = $i18n->get(66);
$var->{'comment.label'} = $i18n->get(57);
my $questions = $self->session->db->read("select Survey_questionId,question,answerFieldType from Survey_question
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
my @questionloop;
@ -1307,17 +1323,18 @@ sub www_viewStatisticalOverview {
return "" unless ($self->session->user->isInGroup($self->get("groupToViewReports")));
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
my $var = $self->getMenuVars;
$var->{title} = WebGUI::International::get(58,'Asset_Survey');
my $i18n = WebGUI::International->new($self->session,'Asset_Survey');
$var->{title} = $i18n->get(58);
my $p = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewStatisticalOverview'));
$p->setDataByQuery("select Survey_questionId,question,answerFieldType,allowComment from Survey_question
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
my $questions = $p->getPageData;
my @questionloop;
$var->{'answer.label'} = WebGUI::International::get(19,'Asset_Survey');
$var->{'response.count.label'} = WebGUI::International::get(53,'Asset_Survey');
$var->{'response.percent.label'} = WebGUI::International::get(54,'Asset_Survey');
$var->{'show.responses.label'} = WebGUI::International::get(55,'Asset_Survey');
$var->{'show.comments.label'} = WebGUI::International::get(56,'Asset_Survey');
$var->{'answer.label'} = $i18n->get(19);
$var->{'response.count.label'} = $i18n->get(53);
$var->{'response.percent.label'} = $i18n->get(54);
$var->{'show.responses.label'} = $i18n->get(55);
$var->{'show.comments.label'} = $i18n->get(56);
foreach my $question (@$questions) {
my @answerloop;
my ($totalResponses) = $self->session->db->quickArray("select count(*) from Survey_questionResponse where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId}));

View file

@ -70,56 +70,58 @@ A hash reference passed in from a subclass definition.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
my $i18n = WebGUI::International->new($session,'Asset_SyndicatedContent');
%properties = (
templateId =>{
tab=>"display",
fieldType=>'template',
defaultValue=>'PBtmpl0000000000000065',
namespace=>'SyndicatedContent',
label=>WebGUI::International::get(72,'Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('72 description','Asset_SyndicatedContent')
label=>$i18n->get(72),
hoverHelp=>$i18n->get('72 description')
},
rssUrl=>{
tab=>"properties",
defaultValue=>undef,
fieldType=>'textarea',
label=>WebGUI::International::get(1,'Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('1 description','Asset_SyndicatedContent')
label=>$i18n->get(1),
hoverHelp=>$i18n->get('1 description')
},
maxHeadlines=>{
tab=>"properties",
fieldType=>'integer',
defaultValue=>10,
label=>WebGUI::International::get(3,'Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('3 description','Asset_SyndicatedContent')
label=>$i18n->get(3),
hoverHelp=>$i18n->get('3 description')
},
displayMode=>{
tab=>"display",
fieldType=>'selectBox',
defaultValue=>'interleaved',
options=>{
'interleaved'=>WebGUI::International::get('interleaved','Asset_SyndicatedContent'),
'grouped'=>WebGUI::International::get('grouped','Asset_SyndicatedContent'),
'interleaved'=>$i18n->get('interleaved'),
'grouped'=>$i18n->get('grouped'),
},
sortByValue=>1,
label=>WebGUI::International::get('displayModeLabel','Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('displayModeLabel description','Asset_SyndicatedContent'),
subtext=>WebGUI::International::get('displayModeSubtext','Asset_SyndicatedContent')
label=>$i18n->get('displayModeLabel'),
hoverHelp=>$i18n->get('displayModeLabel description'),
subtext=>$i18n->get('displayModeSubtext')
},
hasTerms=>{
tab=>"properties",
fieldType=>'text',
defaultValue=>'',
label=>WebGUI::International::get('hasTermsLabel','Asset_SyndicatedContent'),
hoverHelp=>WebGUI::International::get('hasTermsLabel description','Asset_SyndicatedContent'),
label=>$i18n->get('hasTermsLabel'),
hoverHelp=>$i18n->get('hasTermsLabel description'),
maxlength=>255
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName','Asset_SyndicatedContent'),
assetName=>$i18n->get('assetName'),
uiLevel=>6,
autoGenerateForms=>1,
icon=>'syndicatedContent.gif',
@ -127,7 +129,7 @@ sub definition {
className=>'WebGUI::Asset::Wobject::SyndicatedContent',
properties=>\%properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -531,7 +533,8 @@ sub view {
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub _constructRSSHeadTitleLink{
my($var,$rssTitle)=@_;
my $rssFeedSuffix=WebGUI::International::get('RSS Feed Title Suffix','Asset_SyndicatedContent');
my $i18n = WebGUI::International->new($self->session,'Asset_SyndicatedContent');
my $rssFeedSuffix=$i18n->get('RSS Feed Title Suffix');
my $title = ($rssTitle) ? ($rssTitle." ".$rssFeedSuffix) : $rssFeedSuffix;
$title =~ s/\"/&quot;/g;
$self->session->style->setLink($var->{'rss.url'},

View file

@ -36,6 +36,7 @@ sub _create_cache_key {
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $httpHeaderFieldType;
if ($session{'config'}{'soapHttpHeaderOverride'}) {
@ -43,8 +44,9 @@ my $httpHeaderFieldType;
} else {
$httpHeaderFieldType = 'hidden';
}
my $i18n = WebGUI::International->new($session, "Asset_WSClient");
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName', "Asset_WSClient"),
assetName=>$i18n->get('assetName'),
uiLevel=>9,
icon=>'web_services.gif',
tableName=>'WSClient',
@ -107,7 +109,7 @@ my $httpHeaderFieldType;
}
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
@ -116,102 +118,103 @@ my $httpHeaderFieldType;
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session, "Asset_WSClient");
$tabform->getTab("display")->template(
-name => 'templateId',
-value => $self->getValue('templateId'),
-namespace => "WSClient",
-label => WebGUI::International::get(72, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('72 description', "Asset_WSClient"),
-label => WebG$i18n->get(72),
-hoverHelp => $i18n->get('72 description'),
);
$tabform->getTab("display")->yesNo (
-name => 'preprocessMacros',
-label => WebGUI::International::get(8, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('8 description', "Asset_WSClient"),
-label => $i18n->get(8),
-hoverHelp => $i18n->get('8 description'),
-value => $self->get('preprocessMacros'),
);
$tabform->getTab("display")->integer(
-name => 'paginateAfter',
-label => WebGUI::International::get(13, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('13 description', "Asset_WSClient"),
-label => $i18n->get(13),
-hoverHelp => $i18n->get('13 description'),
-value => $self->getValue("paginateAfter")
);
$tabform->getTab("display")->text (
-name => 'paginateVar',
-label => WebGUI::International::get(14, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('14 description', "Asset_WSClient"),
-label => $i18n->get(14),
-hoverHelp => $i18n->get('14 description'),
-value => $self->get('paginateVar'),
);
$tabform->getTab("properties")->text (
-name => 'uri',
-label => WebGUI::International::get(2, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('2 description', "Asset_WSClient"),
-label => $i18n->get(2),
-hoverHelp => $i18n->get('2 description'),
-value => $self->get('uri'),
);
$tabform->getTab("properties")->text (
-name => 'proxy',
-label => WebGUI::International::get(3, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('3 description', "Asset_WSClient"),
-label => $i18n->get(3),
-hoverHelp => $i18n->get('3 description'),
-value => $self->get('proxy'),
);
$tabform->getTab("properties")->text (
-name => 'callMethod',
-label => WebGUI::International::get(4, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('4 description', "Asset_WSClient"),
-label => $i18n->get(4),
-hoverHelp => $i18n->get('4 description'),
-value => $self->get('callMethod'),
);
$tabform->getTab("properties")->textarea (
-name => 'params',
-label => WebGUI::International::get(5, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('5 description', "Asset_WSClient"),
-label => $i18n->get(5),
-hoverHelp => $i18n->get('5 description'),
-value => $self->get('params'),
);
if ($session{'config'}{'soapHttpHeaderOverride'}) {
$tabform->getTab("properties")->text (
-name => 'httpHeader',
-label => WebGUI::International::get(16, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('16 description', "Asset_WSClient"),
-label => $i18n->get(16),
-hoverHelp => $i18n->get('16 description'),
-value => $self->get('httpHeader'),
);
} else {
$tabform->getTab("properties")->hidden (
-name => 'httpHeader',
-label => WebGUI::International::get(16, "Asset_WSClient"),
-label => $i18n->get(16),
-value => $self->get('httpHeader'),
);
}
$tabform->getTab("properties")->yesNo (
-name => 'execute_by_default',
-label => WebGUI::International::get(11, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('11 description', "Asset_WSClient"),
-label => $i18n->get(11),
-hoverHelp => $i18n->get('11 description'),
-value => $self->get('execute_by_default'),
);
$tabform->getTab("properties")->yesNo (
-name => 'debugMode',
-label => WebGUI::International::get(9, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('9 description', "Asset_WSClient"),
-label => $i18n->get(9),
-hoverHelp => $i18n->get('9 description'),
-value => $self->get('debugMode'),
);
$tabform->getTab("properties")->yesNo (
-name => 'decodeUtf8',
-label => WebGUI::International::get(15, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('15 description', "Asset_WSClient"),
-label => $i18n->get(15),
-hoverHelp => $i18n->get('15 description'),
-value => $self->get('decodeUtf8'),
);
my $cacheopts = {
0 => WebGUI::International::get(29, "Asset_WSClient"),
1 => WebGUI::International::get(19, "Asset_WSClient"),
0 => $i18n->get(29),
1 => $i18n->get(19),
};
$tabform->getTab("properties")->radioList (
-name => 'sharedCache',
-options => $cacheopts,
-label => WebGUI::International::get(28, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('28 description', "Asset_WSClient"),
-label => $i18n->get(28),
-hoverHelp => $i18n->get('28 description'),
-value => $self->get('sharedCache'),
);
$tabform->getTab("properties")->interval (
-name => 'cacheTTL',
-label => WebGUI::International::get(27, "Asset_WSClient"),
-hoverHelp => WebGUI::International::get('27 description', "Asset_WSClient"),
-label => $i18n->get(27),
-hoverHelp => $i18n->get('27 description'),
-value => $self->get('cacheTTL'),
);
return $tabform;
@ -248,6 +251,7 @@ sub view {
my $self= shift;
# this page, with important params
$url = $self->getUrl("func=view");
my $i18n = WebGUI::International->new($self->session, "Asset_WSClient");
# This could belong up towards the top of the script, but it's nice to
# have it down right close to the impacted code. Add to this list params
@ -311,7 +315,7 @@ sub view {
$cache_key = _create_cache_key($self, $call, $param_str);
}
$cache = WebGUI::Cache->new($self->session,$cache_key,
WebGUI::International::get(4, "Asset_WSClient"));
$i18n->get(4));
# passing a form param WSClient_skipCache lets us ignore even good caches
if (!$session{'form'}{'WSClient_skipCache'}) {
@ -326,7 +330,7 @@ sub view {
# the solution is to normalize all params to another table
eval "\$arr_ref = [$param_str];";
eval { @params = @$arr_ref; };
$self->session->errorHandler->debug(WebGUI::International::get(22, "Asset_WSClient")) if $@ && $self->get('debugMode');
$self->session->errorHandler->debug($i18n->get(22)) if $@ && $self->get('debugMode');
if ($self->get('execute_by_default') || grep /^$call$/,
@targetWobjects) {
@ -340,7 +344,7 @@ sub view {
$soap = $self->_instantiate_soap;
} else {
$self->session->errorHandler->debug(WebGUI::International::get(23, "Asset_WSClient")) if $self->get('debugMode');
$self->session->errorHandler->debug($i18n->get(23)) if $self->get('debugMode');
}
}
}
@ -362,7 +366,7 @@ sub view {
# a hash reference, a blessed object or a simple scalar. Each type
# requires different handling (woohoo!) before being passed to the
# template system
$self->session->errorHandler->debug(WebGUI::International::get(24, "Asset_WSClient") . (ref $return ? ref $return : 'scalar')) if $self->get('debugMode');
$self->session->errorHandler->debug($i18n->get(24) . (ref $return ? ref $return : 'scalar')) if $self->get('debugMode');
# SOAP object
if ((ref $return) =~ /SOAP/i) {
@ -392,7 +396,7 @@ sub view {
if ($@) {
$self->session->errorHandler->debug($@) if $self->get('debugMode');
$var{'soapError'} = $@;
$self->session->errorHandler->debug(WebGUI::International::get(25, "Asset_WSClient") . $var{'soapError'})
$self->session->errorHandler->debug($i18n->get(25) . $var{'soapError'})
if $self->get('debugMode');
}
@ -475,7 +479,7 @@ sub view {
} else {
$self->session->errorHandler->debug(WebGUI::International::get(26, "Asset_WSClient") . $@) if $self->get('debugMode');
$self->session->errorHandler->debug($i18n->get(26) . $@) if $self->get('debugMode');
}
# did they request a funky http header?

View file

@ -44,8 +44,9 @@ defines wobject properties for WeatherData instances
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new("Asset_WeatherData");
my $i18n = WebGUI::International->new($session, "Asset_WeatherData");
my $properties = {
templateId =>{
fieldType=>"template",
@ -71,7 +72,7 @@ sub definition {
autoGenerateForms=>1,
properties=>$properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -36,7 +36,9 @@ getEditForm method is unnecessary/redundant/useless.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session, 'NewWobject');
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
@ -56,21 +58,21 @@ sub definition {
#This is what will appear when the user hovers the mouse over the label
# of your form field.
hoverHelp=>WebGUI::International::get('templateId label description','Asset_NewWobject'),
hoverHelp=>$i18n->get('templateId label description'),
# This is the text that will appear to the left of your form field.
label=>WebGUI::International::get('templateId label,"Asset_NewWobject")
label=>$i18n->get('templateId label)
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_NewWobject"),
assetName=>$i18n->get('assetName'),
icon=>'newWobject.gif',
autoGenerateForms=>1,
tableName=>'NewWobject',
className=>'WebGUI::Asset::Wobject::NewWobject',
properties=>\%properties
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}

View file

@ -96,14 +96,15 @@ Creates a tabform to edit the Asset Tree. If canEdit returns False, returns insu
sub www_editBranch {
my $self = shift;
my $ac = WebGUI::AdminConsole->new($self->session,"assets");
my $i18n = WebGUI::International->new($self->session,"Asset");
return $self->session->privilege->insufficient() unless ($self->canEdit);
my $tabform = WebGUI::TabForm->new;
$tabform->hidden({name=>"func",value=>"editBranchSave"});
$tabform->addTab("properties",WebGUI::International::get("properties","Asset"),9);
$tabform->addTab("properties",$i18n->get("properties"),9);
$tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get(104,"Asset"),
-label=>$i18n->get(104),
-uiLevel=>9,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_url"}),
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_url"}),
-value=>WebGUI::Form::selectBox({
name=>"baseUrlBy",
extras=>'onchange="toggleSpecificBaseUrl()"',
@ -116,8 +117,8 @@ sub www_editBranch {
}).'<span id="baseUrl"></span> / '.WebGUI::Form::selectBox({
name=>"endOfUrl",
options=>{
menuTitle=>WebGUI::International::get(411,"Asset"),
title=>WebGUI::International::get(99,"Asset"),
menuTitle=>$i18n->get(411),
title=>$i18n->get(99),
currentUrl=>"Current URL"
}
})."<script type=\"text/javascript\">
@ -131,79 +132,79 @@ sub www_editBranch {
toggleSpecificBaseUrl();
</script>"
);
$tabform->addTab("display",WebGUI::International::get(105,"Asset"),5);
$tabform->addTab("display",$i18n->get(105),5);
$tabform->getTab("display")->yesNo(
-name=>"isHidden",
-value=>$self->get("isHidden"),
-label=>WebGUI::International::get(886,"Asset"),
-label=>$i18n->get(886),
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_isHidden"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_isHidden"})
);
$tabform->getTab("display")->yesNo(
-name=>"newWindow",
-value=>$self->get("newWindow"),
-label=>WebGUI::International::get(940,"Asset"),
-label=>$i18n->get(940),
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_newWindow"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_newWindow"})
);
$tabform->getTab("display")->yesNo(
-name=>"displayTitle",
-label=>WebGUI::International::get(174,"Asset"),
-label=>$i18n->get(174),
-value=>$self->getValue("displayTitle"),
-uiLevel=>5,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_displayTitle"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_displayTitle"})
);
$tabform->getTab("display")->template(
-name=>"styleTemplateId",
-label=>WebGUI::International::get(1073,"Asset"),
-label=>$i18n->get(1073),
-value=>$self->getValue("styleTemplateId"),
-namespace=>'style',
-afterEdit=>'op=editPage;npp='.$self->session->form->process("npp"),
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_styleTemplateId"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_styleTemplateId"})
);
$tabform->getTab("display")->template(
-name=>"printableStyleTemplateId",
-label=>WebGUI::International::get(1079,"Asset"),
-label=>$i18n->get(1079),
-value=>$self->getValue("printableStyleTemplateId"),
-namespace=>'style',
-afterEdit=>'op=editPage;npp='.$self->session->form->process("npp"),
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_printableStyleTemplateId"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_printableStyleTemplateId"})
);
$tabform->getTab("display")->interval(
-name=>"cacheTimeout",
-label=>WebGUI::International::get(895,"Asset"),
-label=>$i18n->get(895),
-value=>$self->getValue("cacheTimeout"),
-uiLevel=>8,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_cacheTimeout"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_cacheTimeout"})
);
$tabform->getTab("display")->interval(
-name=>"cacheTimeoutVisitor",
-label=>WebGUI::International::get(896,"Asset"),
-label=>$i18n->get(896),
-value=>$self->getValue("cacheTimeoutVisitor"),
-uiLevel=>8,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_cacheTimeoutVisitor"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_cacheTimeoutVisitor"})
);
$tabform->addTab("security",WebGUI::International::get(107,"Asset"),6);
$tabform->addTab("security",$i18n->get(107),6);
$tabform->getTab("security")->yesNo(
-name=>"encryptPage",
-value=>$self->get("encryptPage"),
-label=>WebGUI::International::get('encrypt page',"Asset"),
-label=>$i18n->get('encrypt page'),
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_encryptPage"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_encryptPage"})
);
$tabform->getTab("security")->dateTime(
-name=>"startDate",
-label=>WebGUI::International::get(497,"Asset"),
-label=>$i18n->get(497),
-value=>$self->get("startDate"),
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_startDate"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_startDate"})
);
$tabform->getTab("security")->dateTime(
-name=>"endDate",
-label=>WebGUI::International::get(498,"Asset"),
-label=>$i18n->get(498),
-value=>$self->get("endDate"),
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_endDate"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_endDate"})
);
my $subtext;
if ($self->session->user->isInGroup(3)) {
@ -223,35 +224,35 @@ sub www_editBranch {
$tabform->getTab("security")->selectBox(
-name=>"ownerUserId",
-options=>$users,
-label=>WebGUI::International::get(108,"Asset"),
-label=>$i18n->get(108),
-value=>[$self->get("ownerUserId")],
-subtext=>$subtext,
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_ownerUserId"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_ownerUserId"})
);
$tabform->getTab("security")->group(
-name=>"groupIdView",
-label=>WebGUI::International::get(872,"Asset"),
-label=>$i18n->get(872),
-value=>[$self->get("groupIdView")],
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_groupIdView"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_groupIdView"})
);
$tabform->getTab("security")->group(
-name=>"groupIdEdit",
-label=>WebGUI::International::get(871,"Asset"),
-label=>$i18n->get(871),
-value=>[$self->get("groupIdEdit")],
-excludeGroups=>[1,7],
-uiLevel=>6,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_groupIdEdit"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_groupIdEdit"})
);
$tabform->addTab("meta",WebGUI::International::get("Metadata","Asset"),3);
$tabform->addTab("meta",$i18n->get("Metadata"),3);
$tabform->getTab("meta")->textarea(
-name=>"extraHeadTags",
-label=>WebGUI::International::get("extra head tags","Asset"),
-hoverHelp=>WebGUI::International::get('extra head tags description',"Asset"),
-label=>$i18n->get("extra head tags"),
-hoverHelp=>$i18n->get('extra head tags description'),
-value=>$self->get("extraHeadTags"),
-uiLevel=>5,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_extraHeadTags"})
-subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_extraHeadTags"})
);
if ($self->session->setting->get("metaDataEnabled")) {
my $meta = $self->getMetaDataFields();
@ -261,7 +262,7 @@ sub www_editBranch {
# Add a "Select..." option on top of a select list to prevent from
# saving the value on top of the list when no choice is made.
if($fieldType eq "selectList") {
$options = {"", WebGUI::International::get("Select","Asset")};
$options = {"", $i18n->get("Select")};
}
$tabform->getTab("meta")->dynamicField(
name=>"metadata_".$meta->{$field}{fieldId},
@ -271,7 +272,7 @@ sub www_editBranch {
extras=>qq/title="$meta->{$field}{description}"/,
possibleValues=>$meta->{$field}{possibleValues},
options=>$options,
subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo($self->session,{name=>"change_metadata_".$meta->{$field}{fieldId}}),
subtext=>'<br />'.$i18n->get("change").' '.WebGUI::Form::yesNo($self->session,{name=>"change_metadata_".$meta->{$field}{fieldId}}),
fieldType=>$fieldType
);
}

View file

@ -308,22 +308,22 @@ sub www_manageClipboard {
my $self = shift;
my $ac = WebGUI::AdminConsole->new($self->session,"clipboard");
return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(12));
my $i18n = WebGUI::International->new($self->session, "Asset");
my ($header,$limit);
$ac->setHelp("clipboard manage");
if ($self->session->form->process("systemClipboard") && $self->session->user->isInGroup(3)) {
$header = WebGUI::International::get(966,"Asset");
$ac->addSubmenuItem($self->getUrl('func=manageClipboard'), WebGUI::International::get(949,"Asset"));
$ac->addSubmenuItem($self->getUrl('func=emptyClipboard;systemClipboard=1'), WebGUI::International::get(959,"Asset"),
'onclick="return window.confirm(\''.WebGUI::International::get(951).'\')"',"Asset");
$header = $i18n->get(966);
$ac->addSubmenuItem($self->getUrl('func=manageClipboard'), $i18n->get(949));
$ac->addSubmenuItem($self->getUrl('func=emptyClipboard;systemClipboard=1'), $i18n->get(959),
'onclick="return window.confirm(\''.$i18n->get(951,"WebGUI").'\')"',"Asset");
} else {
$ac->addSubmenuItem($self->getUrl('func=manageClipboard;systemClipboard=1'), WebGUI::International::get(954,"Asset"));
$ac->addSubmenuItem($self->getUrl('func=emptyClipboard'), WebGUI::International::get(950,"Asset"),
'onclick="return window.confirm(\''.WebGUI::International::get(951).'\')"',"Asset");
$ac->addSubmenuItem($self->getUrl('func=manageClipboard;systemClipboard=1'), $i18n->get(954));
$ac->addSubmenuItem($self->getUrl('func=emptyClipboard'), $i18n->get(950),
'onclick="return window.confirm(\''.$i18n->(951,"WebGUI").'\')"',"Asset");
$limit = 1;
}
$self->session->style->setLink($self->session->config->get("extrasURL").'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
$self->session->style->setScript($self->session->config->get("extrasURL").'/assetManager/assetManager.js', {type=>"text/javascript"});
my $i18n = WebGUI::International->new("Asset");
my $output = "
<script type=\"text/javascript\">
//<![CDATA[

View file

@ -139,44 +139,45 @@ sub www_export {
my $self = shift;
return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(13));
$self->getAdminConsole->setHelp("page export", "Asset");
my $i18n = WebGUI::International->new($self->session);
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
-name => "func",
-value => "exportStatus"
);
$f->integer(
-label=>WebGUI::International::get('Depth',"Asset"),
-hoverHelp=>WebGUI::International::get('Depth description',"Asset"),
-label=>$i18n->get('Depth'),
-hoverHelp=>$i18n->get('Depth description'),
-name=>"depth",
-value=>99,
);
$f->selectBox(
-label=>WebGUI::International::get('Export as user',"Asset"),
-hoverHelp=>WebGUI::International::get('Export as user description',"Asset"),
-label=>$i18n->get('Export as user'),
-hoverHelp=>$i18n->get('Export as user description'),
-name=>"userId",
-options=>$self->session->db->buildHashRef("select userId, username from users"),
-value=>[1],
);
$f->text(
-label=>WebGUI::International::get("directory index","Asset"),
-hoverHelp=>WebGUI::International::get("directory index description","Asset"),
-label=>$i18n->get("directory index"),
-hoverHelp=>$i18n->get("directory index description"),
-name=>"index",
-value=>"index.html"
);
$f->text(
-label=>WebGUI::International::get('Extras URL',"Asset"),
-hoverHelp=>WebGUI::International::get('Extras URL description',"Asset"),
-label=>$i18n->get('Extras URL'),
-hoverHelp=>$i18n->get('Extras URL description'),
-name=>"extrasURL",
-value=>$self->session->config->get("extrasURL")
);
$f->text(
-label=>WebGUI::International::get('Uploads URL',"Asset"),
-hoverHelp=>WebGUI::International::get('Uploads URL description',"Asset"),
-label=>$i18n->get('Uploads URL'),
-hoverHelp=>$i18n->get('Uploads URL description'),
-name=>"uploadsURL",
-value=>$self->session->config->get("uploadsURL")
);
$f->submit;
$self->getAdminConsole->render($self->checkExportPath.$f->print,WebGUI::International::get('Export Page',"Asset"));
$self->getAdminConsole->render($self->checkExportPath.$f->print,$i18n->get('Export Page'));
}
@ -191,14 +192,15 @@ Displays the export status page
sub www_exportStatus {
my $self = shift;
return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(13));
my $i18n = WebGUI::International->new($self->session);
my $iframeUrl = $self->getUrl('func=exportGenerate');
$iframeUrl = $self->session->url->append($iframeUrl, 'index='.$self->session->form->process("index"));
$iframeUrl = $self->session->url->append($iframeUrl, 'depth='.$self->session->form->process("depth"));
$iframeUrl = $self->session->url->append($iframeUrl, 'userId='.$self->session->form->process("userId"));
$iframeUrl = $self->session->url->append($iframeUrl, 'extrasURL='.$self->session->form->process("extrasURL"));
$iframeUrl = $self->session->url->append($iframeUrl, 'uploadsURL='.$self->session->form->process("uploadsURL"));
my $output = '<iframe src="'.$iframeUrl.'" title="'.WebGUI::International::get('Page Export Status',"Asset").'" width="410" height="200"></iframe>';
$self->getAdminConsole->render($output,WebGUI::International::get('Page Export Status',"Asset"),"Asset");
my $output = '<iframe src="'.$iframeUrl.'" title="'.$i18n->get('Page Export Status').'" width="410" height="200"></iframe>';
$self->getAdminConsole->render($output,$i18n->get('Page Export Status'),"Asset");
}
#-------------------------------------------------------------------
@ -222,6 +224,7 @@ sub www_exportGenerate {
print $error;
return;
}
my $i18n = WebGUI::International->new($self->session);
my $userId = $self->session->form->process("userId");
my $extrasURL = $self->session->form->process("extrasURL");
my $uploadsURL = $self->session->form->process("uploadsURL");
@ -229,9 +232,9 @@ sub www_exportGenerate {
my $assets = $self->getLineage(["self","descendants"],{returnObjects=>1,endingLineageLength=>$self->getLineageLength+$self->session->form->process("depth")});
foreach my $asset (@{$assets}) {
my $url = $asset->get("url");
printf WebGUI::International::get('exporting page', 'Asset'), $url;
printf $i18n->get('exporting page'), $url;
unless ($asset->canView($userId)) {
print WebGUI::International::get('bad user privileges', 'Asset')."\n";
print $i18n->get('bad user privileges')."\n";
next;
}
my $path;
@ -252,23 +255,28 @@ sub www_exportGenerate {
$path = $self->session->config->get("exportPath") . "/" . $path;
eval { mkpath($path) };
if($@) {
printf WebGUI::International::get('could not create path', 'Asset'), $path, $@;
printf $i18n->get('could not create path'), $path, $@;
return;
}
}
$path .= "/".$filename;
eval { open(FILE, "> $path") or die "$!" };
if ($@) {
printf WebGUI::International::get('could not open path', 'Asset'), $path, $@;
printf $i18n->get('could not open path'), $path, $@;
return;
} else {
print FILE $asset->exportAsHtml({userId=>$userId,extrasUrl=>$extrasURL,uploadsUrl=>$uploadsURL});
close(FILE);
}
print WebGUI::International::get('done','Asset');
print $i18n->get('done');
}
<<<<<<< .mine
printf $i18n->get('export information'), scalar(@{$assets}), (time()-$startTime);
print '<a target="_parent" href="'.$self->getUrl.'">'.$i18n->get(493).'</a>';
=======
printf WebGUI::International::get('export information','Asset'), scalar(@{$assets}), $self->session->datetime->time()-$startTime);
print '<a target="_parent" href="'.$self->getUrl.'">'.WebGUI::International::get(493,"Asset").'</a>';
>>>>>>> .r425
return;
}

View file

@ -185,19 +185,19 @@ Returns an AdminConsole to deal with assets in the Trash. If isInGroup(4) is Fal
sub www_manageTrash {
my $self = shift;
my $ac = WebGUI::AdminConsole->new($self->session,"trash");
my $i18n = WebGUI::International->new($self->session,"Asset");
return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(12));
my ($header, $limit);
$ac->setHelp("trash manage");
if ($self->session->form->process("systemTrash") && $self->session->user->isInGroup(3)) {
$header = WebGUI::International::get(965,"Asset");
$ac->addSubmenuItem($self->getUrl('func=manageTrash'), WebGUI::International::get(10));
$header = $i18n->get(965);
$ac->addSubmenuItem($self->getUrl('func=manageTrash'), $i18n->(10,"WebGUI"));
} else {
$ac->addSubmenuItem($self->getUrl('func=manageTrash;systemTrash=1'), WebGUI::International::get(964,"Asset"));
$ac->addSubmenuItem($self->getUrl('func=manageTrash;systemTrash=1'), $i18n->get(964));
$limit = 1;
}
$self->session->style->setLink($self->session->config->get("extrasURL").'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
$self->session->style->setScript($self->session->config->get("extrasURL").'/assetManager/assetManager.js', {type=>"text/javascript"});
my $i18n = WebGUI::International->new("Asset");
my $output = "
<script type=\"text/javascript\">
var assetManager = new AssetManager();

View file

@ -346,7 +346,7 @@ sub www_addVersionTag {
my $self = shift;
my $ac = WebGUI::AdminConsole->new($self->session,"versions");
return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(12));
my $i18n = WebGUI::International->new("Asset");
my $i18n = WebGUI::International->new($self->session,"Asset");
$ac->addSubmenuItem($self->getUrl('func=manageVersions'), $i18n->get("manage versions"));
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
my $tag = $self->session->db->getRow("assetVersionTag","tagId",$self->session->form->process("tagId"));

View file

@ -59,7 +59,8 @@ sub _isDuplicateUsername {
return 0 if($self->userId ne "1" && $self->session->user->username eq $username);
my ($otherUser) = $self->session->db->quickArray("select count(*) from users where username=".$self->session->db->quote($username));
return 0 if !$otherUser;
$self->error('<li>'.WebGUI::International::get(77).' "'.$username.'too", "'.$username.'2", '.'"'.$username.'_'.$self->session->datetime->epochToHuman$self->session->datetime->time(),"%y").'"'.'</li>');
my $i18n = $i18n->get($self->session);
$self->error('<li>'.$i18n->get(77).' "'.$username.'too", "'.$username.'2", '.'"'.$username.'_'.$self->session->datetime->epochToHuman$self->session->datetime->time(),"%y").'"'.'</li>');
return 1;
}
@ -77,15 +78,17 @@ sub _isValidUsername {
my $error = "";
return 1 if($self->userId ne "1" && $self->session->user->username eq $username);
my $i18n = WebGUI::International->new($self->session);
if ($username =~ /^\s/ || $username =~ /\s$/) {
$error .= '<li>'.WebGUI::International::get(724).'</li>';
$error .= '<li>'.$i18n->get(724).'</li>';
}
if ($username eq "") {
$error .= '<li>'.WebGUI::International::get(725).'</li>';
$error .= '<li>'.$i18n->get(725).'</li>';
}
unless ($username =~ /^[A-Za-z0-9\-\_\.\,\@]+$/) {
$error .= '<li>'.WebGUI::International::get(747).'</li>';
$error .= '<li>'.$i18n->get(747).'</li>';
}
$self->error($error);
return $error eq "";
@ -134,14 +137,15 @@ Superclass method that performs standard login routines. This method should ret
sub authenticate {
my $self = shift;
my $username = shift;
my $i18n = WebGUI::International->new($self->session);
my $user = $self->session->db->quickHashRef("select userId,authMethod,status from users where username=".$self->session->db->$self->session->db->quote($username));
my $uid = $user->{userId};
#If userId does not exist or is not active, fail login
if(!$uid){
$self->error(WebGUI::International::get(68));
$self->error($i18n->get(68));
return 0;
} elsif($user->{status} ne 'Active'){
$self->error(WebGUI::International::get(820));
$self->error($i18n->get(820));
$self->_logLogin($uid, "failure");
return 0;
}
@ -186,23 +190,27 @@ Array ref of template vars from subclass
=cut
sub createAccount {
my $self = shift;
my $self = shift;
my $method = $_[0];
my $vars = $_[1];
$vars->{title} = WebGUI::International::get(54);
my $i18n = WebGUI::International->new($self->session);
$vars->{title} = $i18n->get(54);
$vars->{'create.form.header'} = WebGUI::Form::formHeader($self->session,{});
$vars->{'create.form.header'} .= WebGUI::Form::hidden($self->session,{"name"=>"op","value"=>"auth"});
$vars->{'create.form.header'} .= WebGUI::Form::hidden($self->session,{"name"=>"method","value"=>$method});
#User Defined Options
$vars->{'create.form.profile'} = WebGUI::Operation::Profile::getRequiredProfileFields();
$vars->{'create.form.profile'} = WebGUI::Operation::Profile::getRequiredProfileFields();
$vars->{'create.form.submit'} = WebGUI::Form::submit($self->session,{});
$vars->{'create.form.footer'} = WebGUI::Form::formFooter($self->session,);
$vars->{'login.url'} = $self->session->url->page('op=auth;method=init');
$vars->{'login.label'} = WebGUI::International::get(58);
$vars->{'login.label'} = $i18n->get(58);
$vars->{'login.url'} = $self->session->url->page('op=auth;method=init');
$vars->{'login.label'} = $i18n->get(58);
return WebGUI::Asset::Template->new($self->session,$self->getCreateAccountTemplateId)->process($vars);
}
@ -238,6 +246,8 @@ sub createAccountSave {
my $password = $_[2];
my $profile = $_[3];
my $i18n = WebGUI::International->new($self->session);
my $u = WebGUI::User->new($self->session,"new");
$self->user($u);
@ -249,10 +259,10 @@ sub createAccountSave {
$self->saveParams($userId,$self->authMethod,$properties);
if ($self->getSetting("sendWelcomeMessage")){
my $authInfo = "\n\n".WebGUI::International::get(50).": ".$username;
$authInfo .= "\n".WebGUI::International::get(51).": ".$password if($password);
my $authInfo = "\n\n".$i18n->get(50).": ".$username;
$authInfo .= "\n".$i18n->get(51).": ".$password if($password);
$authInfo .= "\n\n";
WebGUI::MessageLog::addEntry($self->userId,"",WebGUI::International::get(870),$self->getSetting("welcomeMessage").$authInfo);
WebGUI::MessageLog::addEntry($self->userId,"",$i18n->get(870),$self->getSetting("welcomeMessage").$authInfo);
}
$session->user({user=>$u});
$self->_logLogin($userId,"success");
@ -276,17 +286,18 @@ Auth method that the form for creating users should call
=cut
sub deactivateAccount {
my $self = shift;
my $method = $_[0];
return $self->session->privilege->vitalComponent() if($self->userId eq '1' || $self->userId eq '3');
return $self->session->privilege->adminOnly() if(!$self->session->setting->get("selfDeactivation"));
my %var;
$var{title} = WebGUI::International::get(42);
$var{question} = WebGUI::International::get(60);
my $self = shift;
my $method = $_[0];
return $self->session->privilege->vitalComponent() if($self->userId eq '1' || $self->userId eq '3');
return $self->session->privilege->adminOnly() if(!$self->session->setting->get("selfDeactivation"));
my $i18n = WebGUI::International->new($self->session);
my %var;
$var{title} = $i18n->get(42);
$var{question} = $i18n->get(60);
$var{'yes.url'} = $self->session->url->page('op=auth;method='.$method);
$var{'yes.label'} = WebGUI::International::get(44);
$var{'yes.label'} = $i18n->get(44);
$var{'no.url'} = $self->session->url->page();
$var{'no.label'} = WebGUI::International::get(45);
$var{'no.label'} = $i18n->get(45);
return WebGUI::Asset::Template->new($self->session,"PBtmpl0000000000000057")->process(\%var);
}
@ -341,14 +352,15 @@ sub displayAccount {
my $method = $_[0];
my $vars = $_[1];
$vars->{title} = WebGUI::International::get(61);
my $i18n = WebGUI::International->new($self->session);
$vars->{title} = $i18n->get(61);
$vars->{'account.form.header'} = WebGUI::Form::formHeader($self->session,{});
$vars->{'account.form.header'} .= WebGUI::Form::hidden($self->session,{"name"=>"op","value"=>"auth"});
$vars->{'account.form.header'} .= WebGUI::Form::hidden($self->session,{"name"=>"method","value"=>$method});
if($self->session->setting->get("useKarma")){
$vars->{'account.form.karma'} = $self->session->user->karma;
$vars->{'account.form.karma.label'} = WebGUI::International::get(537);
$vars->{'account.form.karma'} = $self->session->user->karma;
$vars->{'account.form.karma.label'} = $i18n->get(537);
}
$vars->{'account.form.submit'} = WebGUI::Form::submit($self->session,{});
$vars->{'account.form.footer'} = WebGUI::Form::formFooter($self->session,);
@ -380,7 +392,8 @@ sub displayLogin {
unless ($self->session->form->get("op") eq "auth") {
$self->session->scratch->set("redirectAfterLogin",$self->session->url->page($self->session->env->get("QUERY_STRING")));
}
$vars->{title} = WebGUI::International::get(66);
my $i18n = WebGUI::International->new($self->session);
$vars->{title} = $i18n->get(66);
my $action;
if ($self->session->setting->get("encryptLogin")) {
$action = $self->session->url->page(undef,1);
@ -390,14 +403,14 @@ sub displayLogin {
$vars->{'login.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"op","value"=>"auth"});
$vars->{'login.form.hidden'} .= WebGUI::Form::hidden($self->session,{"name"=>"method","value"=>$method});
$vars->{'login.form.username'} = WebGUI::Form::text($self->session,{"name"=>"username"});
$vars->{'login.form.username.label'} = WebGUI::International::get(50);
$vars->{'login.form.username.label'} = $i18n->get(50);
$vars->{'login.form.password'} = WebGUI::Form::password($self->session,{"name"=>"identifier"});
$vars->{'login.form.password.label'} = WebGUI::International::get(51);
$vars->{'login.form.submit'} = WebGUI::Form::submit($self->session,{"value"=>WebGUI::International::get(52)});
$vars->{'login.form.password.label'} = $i18n->get(51);
$vars->{'login.form.submit'} = WebGUI::Form::submit($self->session,{"value"=>$i18n->get(52)});
$vars->{'login.form.footer'} = WebGUI::Form::formFooter($self->session,);
$vars->{'anonymousRegistration.isAllowed'} = ($self->session->setting->get("anonymousRegistration"));
$vars->{'createAccount.url'} = $self->session->url->page('op=auth;method=createAccount');
$vars->{'createAccount.label'} = WebGUI::International::get(67);
$vars->{'createAccount.label'} = $i18n->get(67);
return WebGUI::Asset::Template->new($self->session,$self->getLoginTemplateId)->process($vars);
}

View file

@ -26,15 +26,14 @@ use Net::LDAP;
our @ISA = qw(WebGUI::Auth);
my %ldapStatusCode = map { $_ => WebGUI::International::get("LDAPLink_".$_, "AuthLDAP") }
(0..21, 32,33,34,36, 48..54, 64..71, 80);
#-------------------------------------------------------------------
sub _isValidLDAPUser {
my $self = shift;
my ($uri, $error, $ldap, $search, $auth, $connectDN);
my $i18n = WebGUI::International->new($self->session);
my $connection = $self->{_connection};
$uri = URI->new($connection->{ldapURL}) or $error = WebGUI::International::get(2,'AuthLDAP');
$uri = URI->new($connection->{ldapURL}) or $error = $i18n->get(2,'AuthLDAP');
if($error ne ""){
$self->error($error);
return 0;
@ -55,26 +54,26 @@ sub _isValidLDAPUser {
$connectDN = $search->entry(0)->get_value($connection->{ldapUserRDN});
}
$ldap->unbind;
$ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= WebGUI::International::get(2,'AuthLDAP');
$ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= $i18n->get(2,'AuthLDAP');
$auth = $ldap->bind(dn=>$connectDN, password=>$self->session->form->process("'authLDAP_identifier'"));
if ($auth->code == 48 || $auth->code == 49) {
$error .= '<li>'.WebGUI::International::get(68).'</li>';
$error .= '<li>'.$i18n->get(68).'</li>';
$self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$self->session->form->process("'authLDAP_ldapId'"));
} elsif ($auth->code > 0) {
$error .= '<li>LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69).'</li>';
$self->session->errorHandler->error("LDAP error: ".$ldapStatusCode{$auth->code});
$error .= '<li>LDAP error "'.$self->ldapStatusCode($auth->code).'" occured. '.$i18n->get(69).'</li>';
$self->session->errorHandler->error("LDAP error: ".$self->ldapStatusCode($auth->code));
}
$ldap->unbind;
} else {
$error .= '<li>'.WebGUI::International::get(68).'</li>';
$error .= '<li>'.$i18n->get(68).'</li>';
$self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$self->session->form->process("'authLDAP_ldapId'"));
}
} else {
$error = WebGUI::International::get(2,'AuthLDAP');
$error = $i18n->get(2,'AuthLDAP');
$self->session->errorHandler->error("Couldn't bind to LDAP server: ".$connection->{ldapURL});
}
} else {
$error = WebGUI::International::get(2,'AuthLDAP');
$error = $i18n->get(2,'AuthLDAP');
$self->session->errorHandler->error("Couldn't create LDAP object: ".$uri->host);
}
$self->error($error);
@ -98,6 +97,7 @@ sub addUserForm {
my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink");
my $f = WebGUI::HTMLForm->new($self->session);
my $jscript = "";
my $i18n = WebGUI::International->new($self->session,'AuthLDAP');
if(scalar(keys %{$ldapLinks}) > 0) {
my $jsArray = "";
foreach my $key (keys %{$ldapLinks}) {
@ -114,8 +114,8 @@ sub addUserForm {
</script>|;
$f->selectBox(
-name=>"authLDAP_ldapConnection",
-label=>WebGUI::International::get("ldapConnection",'AuthLDAP'),
-hoverHelp=>WebGUI::International::get("ldapConnection description",'AuthLDAP'),
-label=>$i18n->get("ldapConnection"),
-hoverHelp=>$i18n->get("ldapConnection description"),
-options=>WebGUI::LDAPLink->getList($self->session,),
-value=>[$ldapConnection],
-extras=>q|onchange="this.form.authLDAP_ldapUrl.value=ldapValue[this.options[this.selectedIndex].value];"|
@ -123,12 +123,12 @@ sub addUserForm {
}
$f->url(
-name => "authLDAP_ldapUrl",
-label => WebGUI::International::get(3,'AuthLDAP'),
-label => $i18n->get(3),
-value => $ldapUrl,
);
$f->text(
-name => "authLDAP_connectDN",
-label => WebGUI::International::get(4,'AuthLDAP'),
-label => $i18n->get(4),
-value => $connectDN,
);
$self->session->style->setRawHeadTags($jscript);
@ -162,8 +162,9 @@ sub authenticate {
my $userData = $self->getParams;
$error .= WebGUI::International::get(12,'AuthLDAP') if ($userData->{ldapUrl} eq "");
$error .= WebGUI::International::get(11,'AuthLDAP') if ($userData->{connectDN} eq "");
my $i18n = WebGUI::International->new($self->session);
$error .= $i18n->get(12,'AuthLDAP') if ($userData->{ldapUrl} eq "");
$error .= $i18n->get(11,'AuthLDAP') if ($userData->{connectDN} eq "");
$self->error($error);
if($error ne ""){
@ -172,21 +173,21 @@ sub authenticate {
}
if($uri = URI->new($userData->{ldapUrl})) {
$ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= WebGUI::International::get(2,'AuthLDAP');
$ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= $i18n->get(2,'AuthLDAP');
if($error ne ""){
$self->user(WebGUI::User->new($self->session,1));
return 0 ;
}
$auth = $ldap->bind(dn=>$userData->{connectDN}, password=>$identifier);
if ($auth->code == 48 || $auth->code == 49){
$error .= WebGUI::International::get(68);
$error .= $i18n->get(68);
}elsif($auth->code > 0){
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured.'.WebGUI::International::get(69);
$self->session->errorHandler->error("LDAP error: ".$ldapStatusCode{$auth->code});
$error .= 'LDAP error "'.$self->ldapStatusCode($auth->code).'" occured.'.$i18n->get(69);
$self->session->errorHandler->error("LDAP error: ".$self->ldapStatusCode($auth->code));
}
$ldap->unbind;
}else{
$error .= WebGUI::International::get(13,'AuthLDAP');
$error .= $i18n->get(13,'AuthLDAP');
$self->session->errorHandler->error("Could not process this LDAP URL: ".$userData->{ldapUrl});
}
if($error ne ""){
@ -213,7 +214,8 @@ sub createAccount {
}
my $connection = $self->{_connection};
$vars->{'create.message'} = $_[0] if ($_[0]);
$vars->{'create.form.ldapConnection.label'} = WebGUI::International::get("ldapConnection","AuthLDAP");
my $i18n = WebGUI::International->new($self->session,"AuthLDAP");
$vars->{'create.form.ldapConnection.label'} = $i18n->get("ldapConnection");
my $url = $self->session->url->page("op=auth;method=createAccount;connection=");
$vars->{'create.form.ldapConnection'} = WebGUI::Form::selectBox({
@ -237,10 +239,11 @@ sub createAccountSave {
my $username = $self->session->form->get('authLDAP_ldapId');
my $password = $self->session->form->get('authLDAP_identifier');
my $error = "";
my $i18n = WebGUI::International->new($self->session);
#Validate user in LDAP
if(!$self->_isValidLDAPUser()){
return $self->createAccount("<h1>".WebGUI::International::get(70)."</h1>".$self->error);
return $self->createAccount("<h1>".$i18n->get(70)."</h1>".$self->error);
}
my $connection = $self->{_connection};
@ -271,11 +274,11 @@ sub createAccountSave {
#Validate profile data.
my ($profile, $temp, $warning) = WebGUI::Operation::Profile::validateProfileData();
$error .= $temp;
return $self->createAccount("<h1>".WebGUI::International::get(70)."</h1>".$error) unless ($error eq "");
return $self->createAccount("<h1>".$i18n->get(70)."</h1>".$error) unless ($error eq "");
#If Email address is not unique, a warning is displayed
if($warning ne "" && !$self->session->form->process("confirm")){
$self->session->form->process("confirm") = 1;
return $self->createAccount('<li>'.WebGUI::International::get(1078).'</li>');
return $self->createAccount('<li>'.$i18n->get(1078).'</li>');
}
my $properties;
@ -304,11 +307,12 @@ sub displayAccount {
my $self = shift;
my $vars;
return $self->displayLogin($_[0]) if ($self->userId eq '1');
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(61).'</h1>';
$vars->{'account.message'} = WebGUI::International::get(856);
my $i18n = WebGUI::International->new($self->session);
$vars->{displayTitle} = '<h1>'.$i18n->get(61).'</h1>';
$vars->{'account.message'} = $i18n->get(856);
if($self->session->setting->get("useKarma")){
$vars->{'account.form.karma'} = $self->session->user->profileField("karma");
$vars->{'account.form.karma.label'} = WebGUI::International::get(537);
$vars->{'account.form.karma.label'} = $i18n->get(537);
}
$vars->{'account.options'} = WebGUI::Operation::Shared::accountOptions();
return WebGUI::Asset::Template->new($self->session,$self->getAccountTemplateId)->process($vars);
@ -365,7 +369,8 @@ sub editUserSettingsForm {
options=>WebGUI::LDAPLink->getList($self->session,),
value=>[$self->session->setting->get("ldapConnection")]
});
my $ldapConnectionLabel = WebGUI::International::get("ldapConnection",'AuthLDAP');
my $i18n = WebGUI::International->new($self->session,'AuthLDAP');
my $ldapConnectionLabel = $i18n->get("ldapConnection");
my $buttons = "";
if($self->session->setting->get("ldapConnection")) {
$buttons = $self->session->icon->edit("op=editLDAPLink;returnUrl=".$self->session->url->escape($self->session->url->page("op=editSettings")).";llid=".$self->session->setting->get("ldapConnection"));
@ -398,7 +403,8 @@ sub login {
my $self = shift;
if(!$self->authenticate($self->session->form->process("username"),$self->session->form->process("identifier"))){
$self->session->errorHandler->security("login to account ".$self->session->form->process("username")." with invalid information.");
return $self->displayLogin("<h1>".WebGUI::International::get(70)."</h1>".$self->error);
my $i18n = WebGUI::International->new($self->session);
return $self->displayLogin("<h1>".$i18n->get(70)."</h1>".$self->error);
}
$self->session->scratch->delete("ldapConnection");
return $self->SUPER::login(); #Standard login routine for login
@ -412,8 +418,19 @@ sub new {
my @callable = ('createAccount','deactivateAccount','displayAccount','displayLogin','login','logout','createAccountSave','deactivateAccountConfirm');
my $self = WebGUI::Auth->new($authMethod,$userId,\@callable);
$self->{_connection} = WebGUI::LDAPLink->new($self->session,($self->session->scratch->get("ldapConnection") || $self->session->setting->get("ldapConnection")))->get;
my $i18n = WebGUI::International->new($self->session, "AuthLDAP");
my %ldapStatusCode = map { $_ => $i18n->get("LDAPLink_".$_) }
(0..21, 32,33,34,36, 48..54, 64..71, 80);
$self->{_statusCode} = \%ldapStatusCode;
bless $self, $class;
}
#-------------------------------------------------------------------
sub ldapStatusCode {
my ($self, $code) = @_;
return $self->{_statusCode}->{$code};
}
1;

View file

@ -42,15 +42,16 @@ sub _isValidPassword {
WebGUI::Macro::negate(\$confirm);
my $error = "";
my $i18n = WebGUI::International->new($self->session,'AuthWebGUI');
if ($password ne $confirm) {
$error .= '<li>'.WebGUI::International::get(3,'AuthWebGUI').'</li>';
$error .= '<li>'.$i18n->get(3).'</li>';
}
if ($password eq "") {
$error .= '<li>'.WebGUI::International::get(4,'AuthWebGUI').'</li>';
$error .= '<li>'.$i18n->get(4).'</li>';
}
if ($self->getSetting("passwordLength") && length($password) < $self->getSetting("passwordLength")){
$error .= '<li>'.WebGUI::International::get(7,'AuthWebGUI')." ".$self->getSetting("passwordLength").'</li>';
$error .= '<li>'.$i18n->get(7)." ".$self->getSetting("passwordLength").'</li>';
}
$self->error($error);
@ -81,14 +82,15 @@ sub addUserForm {
my $self = shift;
my $userData = $self->getParams;
my $f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session);
$f->password(
name=>"authWebGUI.identifier",
label=>WebGUI::International::get(51),
label=>$i18n->get(51),
value=>"password"
);
$f->interval(
-name=>"authWebGUI.passwordTimeout",
-label=>WebGUI::International::get(16,'AuthWebGUI'),
-label=>$i18n->get(16,'AuthWebGUI'),
-value=>$userData->{passwordTimeout},
-defaultValue=>$self->session->setting->get("webguiPasswordTimeout")
);
@ -99,7 +101,7 @@ sub addUserForm {
$f->yesNo(
-name=>"authWebGUI.changeUsername",
-value=>$userChange,
-label=>WebGUI::International::get(21,'AuthWebGUI')
-label=>$i18n->get(21,'AuthWebGUI')
);
my $passwordChange = $self->session->setting->get("webguiChangePassword");
if($passwordChange || $passwordChange eq "0"){
@ -108,7 +110,7 @@ sub addUserForm {
$f->yesNo(
-name=>"authWebGUI.changePassword",
-value=>$passwordChange,
-label=>WebGUI::International::get(20,'AuthWebGUI')
-label=>$i18n->get(20,'AuthWebGUI')
);
return $f->printRowsOnly;
}
@ -164,6 +166,7 @@ sub createAccount {
} elsif (!$self->session->setting->get("anonymousRegistration")) {
return $self->displayLogin;
}
my $i18n = WebGUI::International->new($self->session);
$vars->{'create.message'} = $_[0] if ($_[0]);
my $storage = WebGUI::Storage::Image->createTemp;
my ($filename, $challenge) = $storage->addFileFromCaptcha;
@ -172,18 +175,18 @@ sub createAccount {
$vars->{'create.form.captcha'} = WebGUI::Form::text($self->session,{"name"=>"authWebGUI.captcha", size=>6, maxlength=>6})
.WebGUI::Form::hidden($self->session,{name=>"authWebGUI.captcha.validation", value=>Digest::MD5::md5_base64(lc($challenge))})
.'<img src="'.$storage->getUrl($filename).'" border="0" alt="captcha" align="middle" />';
$vars->{'create.form.captcha.label'} = WebGUI::International::get("captcha label","AuthWebGUI");
$vars->{'create.form.captcha.label'} = $i18n->get("captcha label","AuthWebGUI");
}
$vars->{'create.form.username'} = WebGUI::Form::text($self->session,{"name"=>"authWebGUI.username","value"=>$self->session->form->process(""authWebGUI.username"}"));
$vars->{'create.form.username.label'} = WebGUI::International::get(50);
$vars->{'create.form.username.label'} = $i18n->get(50);
$vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifier"});
$vars->{'create.form.password.label'} = WebGUI::International::get(51);
$vars->{'create.form.password.label'} = $i18n->get(51);
$vars->{'create.form.passwordConfirm'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifierConfirm"});
$vars->{'create.form.passwordConfirm.label'} = WebGUI::International::get(2,'AuthWebGUI');
$vars->{'create.form.passwordConfirm.label'} = $i18n->get(2,'AuthWebGUI');
$vars->{'create.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"confirm","value"=>$self->session->form->process("confirm")});
$vars->{'recoverPassword.isAllowed'} = $self->getSetting("passwordRecovery");
$vars->{'recoverPassword.url'} = $self->session->url->page('op=auth;method=recoverPassword');
$vars->{'recoverPassword.label'} = WebGUI::International::get(59);
$vars->{'recoverPassword.label'} = $i18n->get(59);
return $self->SUPER::createAccount("createAccountSave",$vars);
}
@ -198,10 +201,11 @@ sub createAccountSave {
my $passConfirm = $self->session->form->get('authWebGUI.identifierConfirm');
my $error;
my $i18n = WebGUI::International->new($self->session);
$error = $self->error unless($self->validUsername($username));
if ($self->session->setting->get("webguiUseCaptcha")) {
unless ($self->session->form->get('authWebGUI.captcha.validation') eq Digest::MD5::md5_base64(lc($self->session->form->get('authWebGUI.captcha')))) {
$error .= WebGUI::International::get("captcha failure","AuthWebGUI");
$error .= $i18n->get("captcha failure","AuthWebGUI");
}
}
$error .= $self->error unless($self->_isValidPassword($password,$passConfirm));
@ -213,7 +217,7 @@ sub createAccountSave {
#If Email address is not unique, a warning is displayed
if($warning ne "" && !$self->session->form->process("confirm")){
$self->session->form->process("confirm") = 1;
return $self->createAccount('<li>'.WebGUI::International::get(1078).'</li>');
return $self->createAccount('<li>'.$i18n->get(1078).'</li>');
}
my $properties;
@ -229,8 +233,8 @@ sub createAccountSave {
$self->saveParams($self->userId,"WebGUI",{emailValidationKey=>$key});
WebGUI::Mail::send(
$profile->{email},
WebGUI::International::get('email address validation email subject','AuthWebGUI'),
WebGUI::International::get('email address validation email body','AuthWebGUI')."\n\n".$self->session->url->getSiteURL().$self->session->url->page("op=auth;method=validateEmail;key=".$key),
$i18n->get('email address validation email subject','AuthWebGUI'),
$i18n->get('email address validation email body','AuthWebGUI')."\n\n".$self->session->url->getSiteURL().$self->session->url->page("op=auth;method=validateEmail;key=".$key),
);
$self->user->status("Deactivated");
$self->session->var->end($self->session->var->get("sessionId"));
@ -238,7 +242,7 @@ sub createAccountSave {
my $u = WebGUI::User->new($self->session,1);
$self->{user} = $u;
$self->logout;
return $self->displayLogin(WebGUI::International::get('check email for validation','AuthWebGUI'));
return $self->displayLogin($i18n->get('check email for validation','AuthWebGUI'));
}
return "";
}
@ -262,22 +266,23 @@ sub displayAccount {
my $self = shift;
my $vars;
return $self->displayLogin($_[0]) if ($self->userId eq '1');
my $i18n = WebGUI::International->new($self->session);
my $userData = $self->getParams;
$vars->{'account.message'} = $_[0] if ($_[0]);
$vars->{'account.noform'} = 1;
if($userData->{changeUsername} || (!defined $userData->{changeUsername} && $self->session->setting->get("webguiChangeUsername"))){
$vars->{'account.form.username'} = WebGUI::Form::text($self->session,{"name"=>"authWebGUI.username","value"=>$self->username});
$vars->{'account.form.username.label'} = WebGUI::International::get(50);
$vars->{'account.form.username.label'} = $i18n->get(50);
$vars->{'account.noform'} = 0;
}
if($userData->{changePassword} || (!defined $userData->{changePassword} && $self->session->setting->get("webguiChangePassword"))){
$vars->{'account.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifier","value"=>"password"});
$vars->{'account.form.password.label'} = WebGUI::International::get(51);
$vars->{'account.form.password.label'} = $i18n->get(51);
$vars->{'account.form.passwordConfirm'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifierConfirm","value"=>"password"});
$vars->{'account.form.passwordConfirm.label'} = WebGUI::International::get(2,'AuthWebGUI');
$vars->{'account.form.passwordConfirm.label'} = $i18n->get(2,'AuthWebGUI');
$vars->{'account.noform'} = 0;
}
$vars->{'account.nofields'} = WebGUI::International::get(22,'AuthWebGUI');
$vars->{'account.nofields'} = $i18n->get(22,'AuthWebGUI');
return $self->SUPER::displayAccount("updateAccount",$vars);
}
@ -293,10 +298,11 @@ sub displayLogin {
my $self = shift;
my $vars;
return $self->displayAccount($_[0]) if ($self->userId ne "1");
my $i18n = WebGUI::International->new($self->session);
$vars->{'login.message'} = $_[0] if ($_[0]);
$vars->{'recoverPassword.isAllowed'} = $self->getSetting("passwordRecovery");
$vars->{'recoverPassword.url'} = $self->session->url->page('op=auth;method=recoverPassword');
$vars->{'recoverPassword.label'} = WebGUI::International::get(59);
$vars->{'recoverPassword.label'} = $i18n->get(59);
return $self->SUPER::displayLogin("login",$vars);
}
@ -348,93 +354,94 @@ sub editUserFormSave {
sub editUserSettingsForm {
my $self = shift;
my $i18n = WebGUI::International->new($self->session,'AuthWebGUI');
my $f = WebGUI::HTMLForm->new($self->session);
$f->text(
-name=>"webguiPasswordLength",
-value=>$self->session->setting->get("webguiPasswordLength"),
-label=>WebGUI::International::get(15,'AuthWebGUI'),
-label=>$i18n->get(15),
-size=>5,
-maxLength=>5,
);
$f->interval(
-name=>"webguiPasswordTimeout",
-label=>WebGUI::International::get(16,'AuthWebGUI'),
-label=>$i18n->get(16),
-value=>$self->session->setting->get("webguiPasswordTimeout")
);
$f->yesNo(
-name=>"webguiExpirePasswordOnCreation",
-value=>$self->session->setting->get("webguiExpirePasswordOnCreation"),
-label=>WebGUI::International::get(9,'AuthWebGUI')
-label=>$i18n->get(9)
);
$f->yesNo(
-name=>"webguiSendWelcomeMessage",
-value=>$self->session->setting->get("webguiSendWelcomeMessage"),
-label=>WebGUI::International::get(868)
-label=>$i18n->get(868,'WebGUI')
);
$f->textarea(
-name=>"webguiWelcomeMessage",
-value=>$self->session->setting->get("webguiWelcomeMessage"),
-label=>WebGUI::International::get(869)
-label=>$i18n->get(869,'WebGUI')
);
$f->yesNo(
-name=>"webguiChangeUsername",
-value=>$self->session->setting->get("webguiChangeUsername"),
-label=>WebGUI::International::get(19,'AuthWebGUI')
-label=>$i18n->get(19)
);
$f->yesNo(
-name=>"webguiChangePassword",
-value=>$self->session->setting->get("webguiChangePassword"),
-label=>WebGUI::International::get(18,'AuthWebGUI')
-label=>$i18n->get(18)
);
$f->yesNo(
-name=>"webguiPasswordRecovery",
-value=>$self->session->setting->get("webguiPasswordRecovery"),
-label=>WebGUI::International::get(6,'AuthWebGUI')
-label=>$i18n->get(6)
);
$f->textarea(
-name=>"webguiRecoverPasswordEmail",
-label=>WebGUI::International::get(134),
-label=>$i18n->get(134, 'WebGUI'),
-value=>$self->session->setting->get("webguiRecoverPasswordEmail")
);
$f->yesNo(
-name=>"webguiValidateEmail",
-value=>$self->session->setting->get("webguiValidateEmail"),
-label=>WebGUI::International::get('validate email','AuthWebGUI')
-label=>$i18n->get('validate email')
);
$f->yesNo(
-name=>"webguiUseCaptcha",
-value=>$self->session->setting->get("webguiUseCaptcha"),
-label=>WebGUI::International::get('use captcha','AuthWebGUI')
-label=>$i18n->get('use captcha')
);
$f->template(
-name=>"webguiAccountTemplate",
-value=>$self->session->setting->get("webguiAccountTemplate"),
-namespace=>"Auth/WebGUI/Account",
-label=>WebGUI::International::get("account template","AuthWebGUI")
-label=>$i18n->get("account template")
);
$f->template(
-name=>"webguiCreateAccountTemplate",
-value=>$self->session->setting->get("webguiCreateAccountTemplate"),
-namespace=>"Auth/WebGUI/Create",
-label=>WebGUI::International::get("create account template","AuthWebGUI")
-label=>$i18n->get("create account template")
);
$f->template(
-name=>"webguiExpiredPasswordTemplate",
-value=>$self->session->setting->get("webguiExpiredPasswordTemplate"),
-namespace=>"Auth/WebGUI/Expired",
-label=>WebGUI::International::get("expired password template","AuthWebGUI")
-label=>$i18n->get("expired password template")
);
$f->template(
-name=>"webguiLoginTemplate",
-value=>$self->session->setting->get("webguiLoginTemplate"),
-namespace=>"Auth/WebGUI/Login",
-label=>WebGUI::International::get("login template","AuthWebGUI")
-label=>$i18n->get("login template")
);
$f->template(
-name=>"webguiPasswordRecoveryTemplate",
-value=>$self->session->setting->get("webguiPasswordRecoveryTemplate"),
-namespace=>"Auth/WebGUI/Recovery",
-label=>WebGUI::International::get("password recovery template","AuthWebGUI")
-label=>$i18n->get("password recovery template")
);
return $f->printRowsOnly;
}
@ -471,7 +478,8 @@ sub login {
if(!$self->authenticate($self->session->form->process("username"),$self->session->form->process("identifier"))){
$self->session->http->setStatus("401","Incorrect Credentials");
$self->session->errorHandler->security("login to account ".$self->session->form->process("username")." with invalid information.");
return $self->displayLogin("<h1>".WebGUI::International::get(70)."</h1>".$self->error);
my $i18n = WebGUI::International->new($self->session);
return $self->displayLogin("<h1>".$i18n->get(70)."</h1>".$self->error);
}
my $userData = $self->getParams;
@ -504,7 +512,8 @@ sub recoverPassword {
return $self->displayLogin if($self->userId ne "1");
my $template = 'Auth/WebGUI/Recovery';
my $vars;
$vars->{title} = WebGUI::International::get(71);
my $i18n = WebGUI::International->new($self->session);
$vars->{title} = $i18n->get(71);
$vars->{'recover.form.header'} = "\n\n".WebGUI::Form::formHeader($self->session,{});
$vars->{'recover.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"op","value"=>"auth"});
$vars->{'recover.form.hidden'} .= WebGUI::Form::hidden($self->session,{"name"=>"method","value"=>"recoverPasswordFinish"});
@ -512,21 +521,22 @@ sub recoverPassword {
$vars->{'recover.form.submit'} = WebGUI::Form::submit($self->session,{});
$vars->{'recover.form.footer'} = WebGUI::Form::formFooter($self->session,);
$vars->{'login.url'} = $self->session->url->page('op=auth;method=init');
$vars->{'login.label'} = WebGUI::International::get(58);
$vars->{'login.label'} = $i18n->get(58);
$vars->{'anonymousRegistration.isAllowed'} = ($self->session->setting->get("anonymousRegistration"));
$vars->{'createAccount.url'} = $self->session->url->page('op=auth=;method=createAccount');
$vars->{'createAccount.label'} = WebGUI::International::get(67);
$vars->{'createAccount.label'} = $i18n->get(67);
$vars->{'recover.message'} = $_[0] if ($_[0]);
$vars->{'recover.form.email'} = WebGUI::Form::text($self->session,{"name"=>"email"});
$vars->{'recover.form.email.label'} = WebGUI::International::get(56);
$vars->{'recover.form.email.label'} = $i18n->get(56);
return WebGUI::Asset::Template->new($self->session,$self->getPasswordRecoveryTemplateId)->process($vars);
}
#-------------------------------------------------------------------
sub recoverPasswordFinish {
my $self = shift;
return $self->recoverPassword('<ul><li>'.WebGUI::International::get(743).'</li></ul>') if ($self->session->form->process("email") eq "");
my $i18n = WebGUI::International->new($self->session);
return $self->recoverPassword('<ul><li>'.$i18n->get(743).'</li></ul>') if ($self->session->form->process("email") eq "");
return $self->displayLogin unless ($self->session->setting->get("webguiPasswordRecovery"));
my($sth,$username,$userId,$password,$flag,$message,$output,$encryptedPassword,$authMethod);
@ -544,15 +554,15 @@ sub recoverPasswordFinish {
_logSecurityMessage();
$self->session->errorHandler->security("recover a password. Password emailed to: ".$self->session->form->process("email"));
$message = $self->session->setting->get("webguiRecoverPasswordEmail");
$message .= "\n".WebGUI::International::get(50).": ".$username."\n";
$message .= WebGUI::International::get(51).": ".$password."\n";
WebGUI::Mail::send($self->session->form->process("email"),WebGUI::International::get(74),$message);
$message .= "\n".$i18n->get(50).": ".$username."\n";
$message .= $i18n->get(51).": ".$password."\n";
WebGUI::Mail::send($self->session->form->process("email"),$i18n->get(74),$message);
$flag++;
}
$sth->finish();
return $self->displayLogin('<ul><li>'.WebGUI::International::get(75).'</li></ul>') if($flag);
return $self->recoverPassword('<ul><li>'.WebGUI::International::get(76).'</li></ul>');
return $self->displayLogin('<ul><li>'.$i18n->get(75).'</li></ul>') if($flag);
return $self->recoverPassword('<ul><li>'.$i18n->get(76).'</li></ul>');
}
#-------------------------------------------------------------------
@ -560,7 +570,8 @@ sub resetExpiredPassword {
my $self = shift;
my $vars;
$vars->{displayTitle} = '<h3>'.WebGUI::International::get(8,'AuthWebGUI').'</h3>';
my $i18n = WebGUI::International->new($self->session);
$vars->{displayTitle} = '<h3>'.$i18n->get(8,'AuthWebGUI').'</h3>';
$vars->{'expired.message'} = $_[0] if($_[0]);
$vars->{'expired.form.header'} = "\n\n".WebGUI::Form::formHeader($self->session,{});
$vars->{'expired.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"op","value"=>"auth"});
@ -568,11 +579,11 @@ sub resetExpiredPassword {
$vars->{'expired.form.hidden'} .= WebGUI::Form::hidden($self->session,{"name"=>"uid","value"=>$self->session->form->process("uid")});
$vars->{'expired.form.oldPassword'} = WebGUI::Form::password($self->session,{"name"=>"oldPassword"});
$vars->{'expired.form.oldPassword.label'} = WebGUI::International::get(10,'AuthWebGUI');
$vars->{'expired.form.oldPassword.label'} = $i18n->get(10,'AuthWebGUI');
$vars->{'expired.form.password'} = WebGUI::Form::password($self->session,{"name"=>"identifier"});
$vars->{'expired.form.password.label'} = WebGUI::International::get(11,'AuthWebGUI');
$vars->{'expired.form.password.label'} = $i18n->get(11,'AuthWebGUI');
$vars->{'expired.form.passwordConfirm'} = WebGUI::Form::password($self->session,{"name"=>"identifierConfirm"});
$vars->{'expired.form.passwordConfirm.label'} = WebGUI::International::get(2,'AuthWebGUI');
$vars->{'expired.form.passwordConfirm.label'} = $i18n->get(2,'AuthWebGUI');
$vars->{'expired.form.submit'} = WebGUI::Form::submit($self->session,{});
$vars->{'expired.form.footer'} = WebGUI::Form::formFooter($self->session,);
@ -585,14 +596,15 @@ sub resetExpiredPasswordSave {
my ($error,$u,$properties,$msg);
$u = WebGUI::User->new($self->session,$self->session->form->process("uid"));
my $i18n = WebGUI::International->new($self->session);
$self->session->form->process("username") = $u->username;
$error .= $self->error if(!$self->authenticate($u->username,$self->session->form->process("oldPassword")));
$error .= '<li>'.WebGUI::International::get(5,'AuthWebGUI').'</li>' if($self->session->form->process("identifier") eq "password");
$error .= '<li>'.WebGUI::International::get(12,'AuthWebGUI').'</li>' if ($self->session->form->process("oldPassword") eq $self->session->form->process("identifier"));
$error .= '<li>'.$i18n->get(5,'AuthWebGUI').'</li>' if($self->session->form->process("identifier") eq "password");
$error .= '<li>'.$i18n->get(12,'AuthWebGUI').'</li>' if ($self->session->form->process("oldPassword") eq $self->session->form->process("identifier"));
$error .= $self->error if(!$self->_isValidPassword($self->session->form->process("identifier"),$self->session->form->process("identifierConfirm")));
return $self->resetExpiredPassword("<h1>".WebGUI::International::get(70)."</h1>".$error) if($error ne "");
return $self->resetExpiredPassword("<h1>".$i18n->get(70)."</h1>".$error) if($error ne "");
$properties->{identifier} = Digest::MD5::md5_base64($self->session->form->process("identifier"));
$properties->{passwordLastUpdated} =$self->session->datetime->time();
@ -602,7 +614,7 @@ sub resetExpiredPasswordSave {
$msg = $self->login;
if($msg eq ""){
$msg = "<li>".WebGUI::International::get(17,'AuthWebGUI').'</li>';
$msg = "<li>".$i18n->get(17,'AuthWebGUI').'</li>';
}
return $self->displayLogin($msg);
}
@ -630,10 +642,11 @@ sub validateEmail {
sub updateAccount {
my $self = shift;
my $i18n = WebGUI::International->new($self->session);
my $username = $self->session->form->get('authWebGUI.username');
my $password = $self->session->form->get('authWebGUI.identifier');
my $passConfirm = $self->session->form->get('authWebGUI.identifierConfirm');
my $display = '<li>'.WebGUI::International::get(81).'</li>';
my $display = '<li>'.$i18n->get(81).'</li>';
my $error = "";
if($self->userId eq '1'){

View file

@ -82,10 +82,11 @@ sub configurationForm {
$form = shift;
$f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session, 'Commerce');
$f->yesNo(
-name => $self->prepend('enabled'),
-value => $self->enabled,
-label => WebGUI::International::get('enable', 'Commerce'),
-label => $i18n->get('enable'),
);
$f->raw($form);
@ -420,7 +421,7 @@ The period you want the name for.
sub recurringPeriodValues {
my ($i18n, %periods);
$i18n = WebGUI::International->new('Commerce');
$i18n = WebGUI::International->new($self->session, 'Commerce');
tie %periods, "Tie::IxHash";
%periods = (
Weekly => $i18n->get('weekly'),

View file

@ -106,7 +106,7 @@ sub checkoutForm {
my ($self, $u, $f, %months, %years, $i18n);
$self = shift;
$i18n = WebGUI::International->new('CommercePaymentITransact');
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$u = WebGUI::User->new($self->session->user->profileField("userId"));
@ -433,7 +433,7 @@ sub checkoutForm {
sub configurationForm {
my ($self, $f, $i18n);
$self = shift;
$i18n = WebGUI::International->new('CommercePaymentITransact');
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$f = WebGUI::HTMLForm->new($self->session);
$f->text(
@ -567,7 +567,8 @@ sub errorCode {
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get('module name', "CommercePaymentITransact");
my $i18n = WebGUI::International->new($self->session, "CommercePaymentITransact");
return $i18n->get('module name');
}
#-------------------------------------------------------------------
@ -584,10 +585,11 @@ sub normalTransaction {
$normal = shift;
if ($normal) {
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$self->{_recurring} = 0;
$self->{_transactionParams} = {
AMT => sprintf('%.2f', $normal->{amount}),
DESCRIPTION => $normal->{description} || WebGUI::International::get('no description', "CommercePaymentITransact"),
DESCRIPTION => $normal->{description} || $i18n->get('no description'),
INVOICENUMBER => $normal->{invoiceNumber},
ORGID => $normal->{id},
};
@ -608,13 +610,14 @@ sub recurringTransaction {
$initialAmount = ($self->session->datetime->getDaysInMonth(time) - ($self->session->datetime->localtime)[2])*$recurring->{amount}/$self->session->datetime->getDaysInMonth(time);
$initialAmount = $recurring->{amount} if ($initialAmount < 1);
$self->{_recurring} = 1;
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$self->{_transactionParams} = {
START => $recurring->{start} || $self->session->datetime->epochToHuman($self->session->datetime->addToDate(time, 0, 0, 1), '%m%d%y'),
AMT => sprintf('%.2f', $recurring->{amount}),
INITIALAMT => sprintf('%.2f', $initialAmount),
TERM => $recurring->{term} || 9999,
RECIPE => _resolveRecipe($recurring->{payPeriod}),
DESCRIPTION => $recurring->{description} || WebGUI::International::get('no description', "CommercePaymentITransact"),
DESCRIPTION => $recurring->{description} || $i18n->get('no description'),
INVOICENUMBER => $recurring->{invoiceNumber},
ORGID => $recurring->{id},
};

View file

@ -48,10 +48,11 @@ sub configurationForm {
$form = shift;
$f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session, 'Commerce');
$f->yesNo(
-name => $self->prepend('enabled'),
-value => $self->enabled,
-label => WebGUI::International::get('enable', 'Commerce'),
-label => $i18n->get('enable'),
);
$f->raw($form);

View file

@ -24,9 +24,10 @@ sub configurationForm {
$self = shift;
$f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingByPrice');
$f->float(
-name => $self->prepend('percentageOfPrice'),
-label => WebGUI::International::get('percentage of price', 'CommerceShippingByPrice'),
-label => $i18n->get('percentage of price'),
-value => $self->get('percentageOfPrice')
);
@ -45,7 +46,8 @@ sub init {
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get('title', 'CommerceShippingByPrice');
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingByPrice');
return $i18n->get('title');
}
1;

View file

@ -24,9 +24,10 @@ sub configurationForm {
$self = shift;
$f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingByWeight');
$f->float(
-name => $self->prepend('pricePerUnitWeight'),
-label => WebGUI::International::get('price per weight', 'CommerceShippingByWeight'),
-label => $i18n->get('price per weight'),
-value => $self->get('pricePerUnitWeight')
);
@ -45,7 +46,8 @@ sub init {
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get('title', 'CommerceShippingByWeight');
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingByWeight');
return $i18n->get('title');
}
1;

View file

@ -20,9 +20,10 @@ sub configurationForm {
$self = shift;
$f = WebGUI::HTMLForm->new($self->session);
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingPerTransaction');
$f->float(
-name => $self->prepend('pricePerTransaction'),
-label => WebGUI::International::get('price', 'CommerceShippingPerTransaction'),
-label => $i18n->get('price'),
-value => $self->get('pricePerTransaction')
);
@ -41,7 +42,8 @@ sub init {
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get('title', 'CommerceShippingPerTransaction');
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingPerTransaction');
return $i18n->get('title');
}
1;

View file

@ -194,7 +194,8 @@ A reference to the current session.
sub getList {
my $session = shift;
my $list = $session->db->buildHashRef("select databaseLinkId, title from databaseLink order by title");
$list->{'0'} = WebGUI::International::get(1076);
my $i18n = WebGUI::International->new($self->session);
$list->{'0'} = $i18n->get(1076);
return $list;
}

View file

@ -20,7 +20,6 @@ use WebGUI::Asset;
use WebGUI::Form::Button;
use WebGUI::Form::Hidden;
use WebGUI::Form::Text;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -67,22 +66,24 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("asset","Asset")
defaultValue=>$i18n->get("asset");
},
label=>{
defaultValue=>WebGUI::International::get("asset","Asset")
defaultValue=>$i18n->get("asset");
},
name=>{
defaultValue=> "asset"
defaultValue=>"asset";
},
class=>{
defaultValue=> undef
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -55,16 +55,18 @@ The default text to appear on the button. Defaults to an internationalized versi
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session,"WebGUI");
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("button","WebGUI")
defaultValue=>"button"
},
defaultValue=>{
defaultValue=>WebGUI::International::get(62,"WebGUI")
defaultValue=>$i18n->get(62)
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -17,7 +17,6 @@ package WebGUI::Form::CheckList;
use strict;
use base 'WebGUI::Form::List';
use WebGUI::Form::Checkbox;
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -60,10 +59,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($self->session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("941","WebGUI"),
defaultValue=>$i18n->get("941"),
},
vertical=>{
defaultValue=>0
@ -72,7 +73,7 @@ sub definition {
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -16,7 +16,6 @@ package WebGUI::Form::Checkbox;
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
@ -63,10 +62,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("943","WebGUI")
defaultValue=>$i18n->get("943"),
},
checked=>{
defaultValue=> 0
@ -78,7 +79,7 @@ sub definition {
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}

View file

@ -57,16 +57,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("codearea","WebGUI")
defaultValue=>$i18n->get("codearea")
},
profileEnabled=>{
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -48,13 +48,15 @@ See the super class for additional details.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("color","WebGUI")
defaultValue=>$i18n->get("color")
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -57,16 +57,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("combobox","WebGUI")
defaultValue=>$i18n->get("combobox")
},
profileEnabled=>{
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -63,13 +63,15 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("1007","WebGUI")
defaultValue=>$i18n->get("1007")
},
label=>{
defaultValue=>WebGUI::International::get("1007","WebGUI")
defaultValue=>$i18n->get("1007")
},
types=>{
defaultValue=>[qw(mixed html code text)]
@ -78,7 +80,7 @@ sub definition {
defaultValue=>"mixed",
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -18,6 +18,7 @@ use strict;
use WebGUI::Grouping;
use WebGUI::Session;
use WebGUI::Operation::Shared;
use WebGUI::International;
=head1 NAME
@ -51,10 +52,14 @@ The following methods are available via this package.
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
=head2 definition ( $session, [ additionalTerms ] )
Defines the schema or parameters for a form field.
=head3 session
The session object, usually for internationalization.
=head3 additionalTerms
An array reference containing a hash of hashes of parameter names and their definitions.
@ -94,7 +99,7 @@ Add extra attributes to the form tag like
=head4 formName
The internationalized form name.
The key to look up for the form name.
=head4 label
@ -146,6 +151,7 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
@ -300,7 +306,8 @@ Returns a human readable name for this form control type. You MUST override this
sub getName {
my $self = shift;
my $definition = $self->definition;
my $session = shift;
my $definition = $self->definition($session);
return $definition->[0]->{formName}->{defaultValue};
}

View file

@ -73,13 +73,15 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("1075","WebGUI")
defaultValue=>$i18n->get("1075")
},
label=>{
defaultValue=>WebGUI::International::get("1075","WebGUI")
defaultValue=>$i18n->get("1075")
},
name=>{
defaultValue=>"databaseLinkId"

View file

@ -75,13 +75,15 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("479","WebGUI")
defaultValue=>$i18n->get("479")
},
defaultValue=>{
defaultValue=$self->session->datetime->time()
defaultValue=$session->datetime->time()
},
maxlength=>{
defaultValue=> 10
@ -96,7 +98,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -70,13 +70,15 @@ If no value is specified, this will be used. Defaults to today and now.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("972","WebGUI")
defaultValue=>$i18n->get("972")
},
defaultValue=>{
defaultValue=$self->session->datetime->time()
defaultValue=$session->datetime->time()
},
maxlength=>{
defaultValue=> 19
@ -88,7 +90,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -56,16 +56,18 @@ Defaults to "Text". Should be any valid field type.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("475","WebGUI"),
defaultValue=>$i18n->get("475"),
},
fieldType=>{
defaultValue=> "Text"
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
@ -76,7 +78,21 @@ Creates the object for the appropriate field type.
=head3 params
The normal params you'd pass in to the field. Included in this list must be one element called "fieldType" which specifies what type of field to dynamically render.
The normal params you'd pass in to the field. Included in this list
must be one element called "fieldType" which specifies what type of
field to dynamically render. List-type forms, however, can take
two additional parameters:
=head4 possibleValues
This is a newline delimited set of values. A hash will be set by splitting the string
on newlines and making the key and value of each hash entry equal.
=head4 value
For List-type forms which support multiple select, this is normally an arrayref holding all pre-selected
values. However, if it is a scalar string, the string will be split on newlines and the resulting
array will be used.
=cut

View file

@ -56,16 +56,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("480","WebGUI")
defaultValue=>$i18n->get("480")
},
profileEnabled=>{
defaultValue=>1
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -135,7 +135,7 @@ sub toHtml {
$self->session->errorHandler->error("Couldn't compile form control: ".$type.". Root cause: ".$@);
next;
}
$options{$type} = $class->getName;
$options{$type} = $class->getName($self->session);
}
$self->get("options") = \%options;

View file

@ -65,10 +65,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("file","WebGUI")
defaultValue=>$i18n->get("file")
},
name=>{
defaultValue=>"file"
@ -80,7 +82,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -64,22 +64,24 @@ A tooltip for what to do with this field. Defaults to a general explaination of
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("418","WebGUI")
defaultValue=>$i18n->get("418")
},
name=>{
defaultValue=>"filterContent"
},
hoverHelp=>{
defaultValue=>WebGUI::International::get('418 description', 'WebGUI')
defaultValue=>$i18n->get('418 description')
},
defaultValue=>{
defaultValue=>"most",
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -68,10 +68,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("float","WebGUI")
defaultValue=>$i18n->get("float")
},
maxlength=>{
defaultValue=> 14
@ -86,7 +88,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -74,10 +74,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("group","WebGUI")
defaultValue=>$i18n->get("group")
},
size=>{
defaultValue=>1
@ -95,7 +97,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -71,25 +71,27 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("477","WebGUI")
defaultValue=>$i18n->get("477")
},
rows=>{
defaultValue=> $self->session->setting->get("textAreaRows")+20
defaultValue=> $session->setting->get("textAreaRows")+20
},
columns=>{
defaultValue=> $self->session->setting->get("textAreaCols")+10
defaultValue=> $session->setting->get("textAreaCols")+10
},
richEditId=>{
defaultValue=>$self->session->setting->get("richEditor") || "PBrichedit000000000001"
defaultValue=>$session->setting->get("richEditor") || "PBrichedit000000000001"
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -55,16 +55,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("hidden","WebGUI")
defaultValue=>$i18n->get("hidden")
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -63,16 +63,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("hidden list","WebGUI"),
defaultValue=>$i18n->get("hidden list"),
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -67,10 +67,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("image","WebGUI")
defaultValue=>$i18n->get("image")
},
name=>{
defaultValue=>"file"
@ -82,7 +84,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}

View file

@ -68,10 +68,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("482","WebGUI")
defaultValue=>$i18n->get("482")
},
maxlength=>{
defaultValue=> 11
@ -86,7 +88,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -65,10 +65,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("interval","WebGUI"),
defaultValue=>$i18n->get("interval"),
},
defaultValue=>{
defaultValue=>1,
@ -77,7 +79,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -79,13 +79,15 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("LDAPLink_1075","AuthLDAP")
defaultValue=>$i18n->get("LDAPLink_1075","AuthLDAP")
},
label=>{
defaultValue=>WebGUI::International::get("LDAPLink_1075","AuthLDAP")
defaultValue=>$i18n->get("LDAPLink_1075","AuthLDAP")
},
size=>{
defaultValue=>1
@ -103,7 +105,7 @@ sub definition {
defaultValue=>undef
}
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -94,9 +94,14 @@ sub correctValues {
my ($self, $value) = @_;
return unless defined $value;
my @defaultValues;
foreach (split(/\n/, $value)) {
s/\s+$//; # remove trailing spaces
push(@defaultValues, $_);
if (ref $value eq "ARRAY") {
@defaultValues = @{ $value };
}
else {
foreach (split(/\n/, $value)) {
s/\s+$//; # remove trailing spaces
push(@defaultValues, $_);
}
}
$self->get("value") = \@defaultValues;
}
@ -140,10 +145,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("486","WebGUI"),
defaultValue=>$i18n->get("486"),
},
options=>{
defaultValue=>{}
@ -164,7 +171,7 @@ sub definition {
defaultValue=>0
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}

View file

@ -63,10 +63,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("51","WebGUI")
defaultValue=>$i18n->get("51")
},
maxlength=>{
defaultValue=>35
@ -78,7 +80,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -56,16 +56,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("481","WebGUI")
defaultValue=>$i18n->get("481")
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -59,10 +59,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("radio","WebGUI")
defaultValue=>$i18n->get("radio")
},
checked=>{
defaultValue=> 0
@ -71,7 +73,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}

View file

@ -71,10 +71,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("942","WebGUI")
defaultValue=>$i18n->get("942")
},
vertical=>{
defaultValue=>0
@ -83,7 +85,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}

View file

@ -56,16 +56,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("read only","WebGUI")
defaultValue=>$i18n->get("read only")
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -69,10 +69,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("487","WebGUI"),
defaultValue=>$i18n->get("487"),
},
size=>{
defaultValue=>1,
@ -81,7 +83,7 @@ sub definition {
defaultValue=>1,
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -63,10 +63,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("484","WebGUI"),
defaultValue=>$i18n->get("484"),
},
multiple=>{
defaultValue=>1
@ -78,7 +80,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -47,13 +47,15 @@ See the super class for additional details.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("submit","WebGUI")
defaultValue=>$i18n->get("submit")
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -66,13 +66,15 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("assetName","Asset_Template")
defaultValue=>$i18n->get("assetName")
},
label=>{
defaultValue=>WebGUI::International::get("assetName","Asset_Template")
defaultValue=>$i18n->get("assetName")
},
name=>{
defaultValue=>"templateId"
@ -81,7 +83,7 @@ sub definition {
defaultValue=>undef
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -63,22 +63,24 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=> WebGUI::International::get("475","WebGUI")
defaultValue=> $i18n->get("475")
},
maxlength=>{
defaultValue=> 255
},
size=>{
defaultValue=>$self->session->setting->get("textBoxSize") || 30
defaultValue=>$session->setting->get("textBoxSize") || 30
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -67,16 +67,18 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("476","WebGUI")
defaultValue=>$i18n->get("476")
},
rows=>{
defaultValue=> $self->session->setting->get("textAreaRows") || 5
defaultValue=> $session->setting->get("textAreaRows") || 5
},
columns=>{
defaultValue=> $self->session->setting->get("textAreaCols") || 50
defaultValue=> $session->setting->get("textAreaCols") || 50
},
wrap=>{
defaultValue=>"virtual"
@ -85,7 +87,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -67,10 +67,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("971","WebGUI")
defaultValue=>$i18n->get("971")
},
maxlength=>{
defaultValue=>8
@ -82,7 +84,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -48,16 +48,18 @@ See the super class for additional details.
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("timezone","DateTime")
defaultValue=>$i18n->get("timezone")
},
value=>{
defaultValue=>undef
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -60,10 +60,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("478","WebGUI")
defaultValue=>$i18n->get("478")
},
maxlength=>{
defaultValue=> 2048
@ -72,7 +74,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -59,19 +59,21 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("744","WebGUI")
defaultValue=>$i18n->get("744")
},
label=>{
defaultValue=>WebGUI::International::get("744","WebGUI")
defaultValue=>$i18n->get("744")
},
name=>{
defaultValue=>"proceed"
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -60,10 +60,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("483","WebGUI")
defaultValue=>$i18n->get("483")
},
defaultValue=>{
defaultValue=>0
@ -72,7 +74,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -60,10 +60,12 @@ Flag that tells the User Profile system that this is a valid form element in a U
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=> WebGUI::International::get("944","WebGUI")
defaultValue=> $i18n->get("944")
},
maxlength=>{
defaultValue=> 10
@ -72,7 +74,7 @@ sub definition {
defaultValue=>1
},
});
return $class->SUPER::definition($definition);
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------

View file

@ -144,8 +144,46 @@ our $HELP = {
tag => 'matrix add/edit',
namespace => 'Asset_Matrix'
},
],
},
'field add/edit' => {
title => 'field add/edit help title',
body => 'field add/edit help body',
fields => [
{
title => 'field name',
description => 'field name description',
namespace => 'Asset_Matrix',
},
{
title => 'field label',
description => 'field label description',
namespace => 'Asset_Matrix',
},
{
title => 'field type',
description => 'field type description',
namespace => 'Asset_Matrix',
},
{
title => 'field description',
description => 'field description description',
namespace => 'Asset_Matrix',
},
{
title => 'default value',
description => 'default value description',
namespace => 'Asset_Matrix',
},
{
title => 'category',
description => 'category description',
namespace => 'Asset_Matrix',
},
],
related => [
{
tag => 'listing detail template',
tag => 'matrix add/edit',
namespace => 'Asset_Matrix'
},
],

View file

@ -51,7 +51,7 @@ These functions/methods are available from this package:
#-------------------------------------------------------------------
=head2 get ( internationalId [ , namespace, languageId ] )
=head2 get ( internationalId [ , namespace, language ] )
Returns the internationalized message string for the user's language. If there is no internationalized message, this method will return the English string.
@ -63,26 +63,21 @@ An integer that relates to a message in the international table in the WebGUI da
A string that relates to the namespace field in the international table in the WebGUI database. Defaults to 'WebGUI'.
=head3 languageId
=head3 language
An integer that specifies the language that the user should see. Defaults to the user's defined language. If the user hasn't specified a default language it defaults to '1' (English).
A string that specifies the language that the user should see. Defaults to the user's defined language. If the user hasn't specified a default language it defaults to 'English'.
=cut
my $safeRe = qr/[^\w\d\s\/]/;
sub get {
my ($id, $language, $namespace);
if (ref($_[0]) eq "WebGUI::International") {
$id = $_[1];
$namespace = $_[2] || $_[0]->{_namespace} || "WebGUI";
$language = $_[3] || $_[0]->{_language} || $self->session->user->profileField("language") || "English";
} else {
$id = $_[0];
$namespace = $_[1] || "WebGUI";
$language = $_[2] || $self->session->user->profileField("language") || "English";
}
$id =~ s/[^\w\d\s\/]//g;
$language =~ s/[^\w\d\s\/]//g;
$namespace =~ s/[^\w\d\s\/]//g;
my ($self, $id, $namespace, $language) = @_;
$namespace = $namespace || $_[0]->{_namespace} || "WebGUI";
$language = $language || $_[0]->{_language} || $self->session->user->profileField("language") || "English";
$id =~ s/$safeRe//g;
$language =~ s/$safeRe//g;
$namespace =~ s/$safeRe//g;
my $cmd = "WebGUI::i18n::".$language."::".$namespace;
my $load = "use ".$cmd;
eval($load);
@ -90,18 +85,18 @@ sub get {
$cmd = "\$".$cmd."::I18N->{'".$id."'}{message}";
my $output = eval($cmd);
$self->session->errorHandler->warn("Couldn't get value from ".$cmd." because ".$@) if ($@);
$output = get($id,$namespace,"English") if ($output eq "" && $language ne "English");
$output = $self->get($id,$namespace,"English") if ($output eq "" && $language ne "English");
return $output;
}
#-------------------------------------------------------------------
=head2 getLanguage ( [ languageId , propertyName] )
=head2 getLanguage ( [ language , propertyName] )
Returns a hash reference to a particular language's properties.
=head3 languageId
=head3 language
Defaults to "English". The language to retrieve the properties for.
@ -112,8 +107,8 @@ If this is specified, only the value of the property will be returned, instead o
=cut
sub getLanguage {
my $language = shift || "English";
my $property = shift;
my ($self, $language, $property) = @_;
$language = $language || $self->{_language} || "English";
my $cmd = "WebGUI::i18n::".$language;
my $load = "use ".$cmd;
eval($load);
@ -136,11 +131,12 @@ sub getLanguage {
=head2 getLanguages ( )
Returns a hash reference to the languages (languageId/lanugage) installed on this WebGUI system.
Returns a hash reference to the languages installed on this WebGUI system.
=cut
sub getLanguages {
my ($self) = @_;
my ($hashRef);
my $dir = $self->session->config->getWebguiRoot."/lib/WebGUI/i18n";
opendir (DIR,$dir) or $self->session->errorHandler->fatal("Can't open I18N directory! ".$dir);
@ -166,21 +162,15 @@ Manipulates a URL to make sure it will work on the internet. It removes things l
The URL to manipulate.
=head3 languageId
=head3 language
Specify a default language. Defaults to user preference.
Specify a default language. Defaults to user preference or "English".
=cut
sub makeUrlCompliant {
my ($language, $url);
if (ref($_[0]) eq "WebGUI::International") {
$url = $_[1];
$language = $_[2] || $_[0]->{_language} || $self->session->user->profileField("language") || "English";
} else {
$url = $_[0];
$language = $_[1] || $self->session->user->profileField("language") || "English";
}
my ($self, $url, $language) = @_;
$language = $language || $_[0]->{_language} || $self->session->user->profileField("language") || "English";
my $cmd = "WebGUI::i18n::".$language;
my $load = "use ".$cmd;
eval($load);
@ -194,27 +184,44 @@ sub makeUrlCompliant {
#-------------------------------------------------------------------
=head2 new ( [ namespace, languageId ] )
=head2 new ( [ namespace, language ] )
The constructor for the International function if using it in OO mode.
=head3 session
The current user's session variable
=head3 namespace
Specify a default namespace. Defaults to "WebGUI".
=head3 languageId
=head3 language
Specify a default language. Defaults to user preference.
Specify a default language. Defaults to user preference or "English".
=cut
sub new {
my $class = shift;
my $namespace = shift;
my $language = shift;
bless({_namespace=>$namespace,_language=>$language},$class);
my ($class, $session, $namespace, $language) = @_;
bless( {
_session => $session,
_namespace => $namespace,
_language => $language,
},$class);
}
#-------------------------------------------------------------------
=head2 session ( )
Returns the internally stored session variable
=cut
sub session {
return $_[0]->{_session};
}
1;

View file

@ -134,7 +134,8 @@ sub getErrorMessage {
my $errorCode = $_[0] || $self->{_error};
return "" unless $errorCode;
my $i18nCode = "LDAPLink_".$errorCode;
return WebGUI::International::get($i18nCode,"AuthLDAP");
my $i18n = WebGUI::International->new($self->session,"AuthLDAP");
return $i18n->get($i18nCode);
}
#-------------------------------------------------------------------

View file

@ -51,10 +51,11 @@ sub process {
tie %hash, "Tie::IxHash";
tie %hash2, "Tie::IxHash";
tie %cphash, "Tie::CPHash";
my $i18n = WebGUI::International->new($session,'Macro_AdminBar');
$var{'packages.canAdd'} = ($session->user->profileField("uiLevel") >= 7);
$var{'packages.label'} = WebGUI::International::get(376,'Macro_AdminBar');
$var{'contentTypes.label'} = WebGUI::International::get(1083,'Macro_AdminBar');
$var{'clipboard.label'} = WebGUI::International::get(1082,'Macro_AdminBar');
$var{'packages.label'} = $i18n->get(376);
$var{'contentTypes.label'} = $i18n->get(1083);
$var{'clipboard.label'} = $i18n->get(1082);
if ($session->asset) {
foreach my $package (@{$session->asset->getPackageList}) {
my $title = $package->getTitle;
@ -82,7 +83,7 @@ sub process {
#--admin functions
$var{adminConsole_loop} = WebGUI::AdminConsole->getAdminFunction;
return WebGUI::Asset::Template->new($session,$templateId)->process(\%var);
# 'http://validator.w3.org/check?uri=referer'=>WebGUI::International::get(399,'Macro_AdminBar'),
# 'http://validator.w3.org/check?uri=referer'=>$i18n->get(399),
}

View file

@ -50,8 +50,9 @@ sub process {
if ($session->user->isInGroup(12)) {
my %var;
my ($turnOn,$turnOff,$templateName) = @_;
$turnOn ||= WebGUI::International::get(516,'Macro_AdminToggle');
$turnOff ||= WebGUI::International::get(517,'Macro_AdminToggle');
my $i18n = WebGUI::International->new($session,'Macro_AdminToggle');
$turnOn ||= $i18n->get(516);
$turnOff ||= $i18n->get(517);
if ($session->var->isAdminOn) {
$var{'toggle.url'} = $session->url->page('op=switchOffAdmin');
$var{'toggle.text'} = $turnOff;

View file

@ -48,7 +48,8 @@ sub process {
$output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators());
return $output;
} else {
return WebGUI::International::get('invalid url', 'Macro_AssetProxy');
my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy');
return $i18n->get('invalid url');
}
}

Some files were not shown because too many files have changed in this diff Show more