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

@ -30,22 +30,23 @@ sub _submenu {
my $title = shift;
my $help = shift;
my $namespace = shift;
$title = WebGUI::International::get($title,$namespace) if ($title);
my $i18n = WebGUI::International->new($session,"WebGUIProfile");
$title = $i18n->get($title,$namespace) if ($title);
my $ac = WebGUI::AdminConsole->new($session,"userProfiling");
if ($help) {
$ac->setHelp($help,"WebGUIProfile");
}
$ac->addSubmenuItem($session->url->page("op=editProfileCategory;cid=new"), WebGUI::International::get(490,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page("op=editProfileField;fid=new"), WebGUI::International::get(491,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page("op=editProfileCategory;cid=new"), $i18n->get(490));
$ac->addSubmenuItem($session->url->page("op=editProfileField;fid=new"), $i18n->get(491));
if ((($session->form->process("op") eq "editProfileField" && $session->form->process("fid") ne "new") || $session->form->process("op") eq "deleteProfileField") && $session->form->process("cid") eq "") {
$ac->addSubmenuItem($session->url->page('op=editProfileField;fid='.$session->form->process("fid")), WebGUI::International::get(787,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page('op=deleteProfileField;fid='.$session->form->process("fid")), WebGUI::International::get(788,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page('op=editProfileField;fid='.$session->form->process("fid")), $i18n->get(787));
$ac->addSubmenuItem($session->url->page('op=deleteProfileField;fid='.$session->form->process("fid")), $i18n->get(788));
}
if ((($session->form->process("op") eq "editProfileCategory" && $session->form->process("cid") ne "new") || $session->form->process("op") eq "deleteProfileCategory") && $session->form->process("fid") eq "") {
$ac->addSubmenuItem($session->url->page('op=editProfileCategory;cid='.$session->form->process("cid")), WebGUI::International::get(789,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page('op=deleteProfileCategory;cid='.$session->form->process("cid")), WebGUI::International::get(790,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page('op=editProfileCategory;cid='.$session->form->process("cid")), $i18n->get(789));
$ac->addSubmenuItem($session->url->page('op=deleteProfileCategory;cid='.$session->form->process("cid")), $i18n->get(790));
}
$ac->addSubmenuItem($session->url->page("op=editProfileSettings"), WebGUI::International::get(492,"WebGUIProfile"));
$ac->addSubmenuItem($session->url->page("op=editProfileSettings"), $i18n->get(492));
return $ac->render($workarea, $title);
}
@ -74,6 +75,7 @@ sub www_editProfileCategory {
my $session = shift;
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
my $data = {};
my $i18n = WebGUI::International->new($session,"WebGUIProfile");
my $f = WebGUI::HTMLForm->new($session);
$f->hidden(
-name => "op",
@ -86,7 +88,7 @@ sub www_editProfileCategory {
);
$f->readOnly(
-name => $session->form->process("cid"),
-label => WebGUI::International::get(469,"WebGUIProfile"),
-label => $i18n->get(469),
);
$data = WebGUI::ProfileCategory->new($session->form->process("cid"))->get;
} else {
@ -97,21 +99,21 @@ sub www_editProfileCategory {
}
$f->text(
-name => "label",
-label => WebGUI::International::get(470,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('470 description',"WebGUIProfile"),
-label => $i18n->get(470),
-hoverHelp => $i18n->get('470 description'),
-value => $data->{label},
);
$f->yesNo(
-name=>"visible",
-label=>WebGUI::International::get(473,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('473 description',"WebGUIProfile"),
-label=>$i18n->get(473),
-hoverHelp=>$i18n->get('473 description'),
-value=>$data->{visible}
);
$f->yesNo(
-name=>"editable",
-value=>$data->{editable},
-label=>WebGUI::International::get(897,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('897 description',"WebGUIProfile"),
-label=>$i18n->get(897),
-hoverHelp=>$i18n->get('897 description'),
);
$f->submit;
return _submenu($f->print,'468','user profile category add/edit','WebGUIProfile');
@ -139,6 +141,7 @@ sub www_editProfileCategorySave {
sub www_editProfileField {
my $session = shift;
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
my $i18n = WebGUI::International->new($session,"WebGUIProfile");
my $f = WebGUI::HTMLForm->new($session);
$f->hidden(
-name => "op",
@ -152,8 +155,8 @@ sub www_editProfileField {
);
$f->readOnly(
-value => $session->form->process("fid"),
-label => WebGUI::International::get(475,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('475 description',"WebGUIProfile"),
-label => $i18n->get(475),
-hoverHelp => $i18n->get('475 description'),
);
$data = WebGUI::ProfileField->new($session->form->process("fid"))->get;
} else {
@ -163,38 +166,38 @@ sub www_editProfileField {
);
$f->text(
-name => "fid",
-label => WebGUI::International::get(475,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('475 description',"WebGUIProfile"),
-label => $i18n->get(475),
-hoverHelp => $i18n->get('475 description'),
);
}
$f->text(
-name => "label",
-label => WebGUI::International::get(472,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('472 description',"WebGUIProfile"),
-label => $i18n->get(472),
-hoverHelp => $i18n->get('472 description'),
-value => $data->{label},
);
$f->yesNo(
-name=>"visible",
-label=>WebGUI::International::get(473,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('473 description',"WebGUIProfile"),
-label=>$i18n->get(473),
-hoverHelp=>$i18n->get('473 description'),
-value=>$data->{visible}
);
$f->yesNo(
-name=>"editable",
-value=>$data->{editable},
-label=>WebGUI::International::get(897,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('897 description',"WebGUIProfile"),
-label=>$i18n->get(897),
-hoverHelp=>$i18n->get('897 description'),
);
$f->yesNo(
-name=>"required",
-label=>WebGUI::International::get(474,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('474 description',"WebGUIProfile"),
-label=>$i18n->get(474),
-hoverHelp=>$i18n->get('474 description'),
-value=>$data->{required}
);
my $fieldType = WebGUI::Form::FieldType->new(
-name=>"fieldType",
-label=>WebGUI::International::get(486,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('486 description',"WebGUIProfile"),
-label=>$i18n->get(486),
-hoverHelp=>$i18n->get('486 description'),
-value=>ucfirst $data->{fieldType},
-defaultValue=>"Text",
);
@ -211,14 +214,14 @@ sub www_editProfileField {
$f->raw($fieldType->toHtmlWithWrapper());
$f->textarea(
-name => "possibleValues",
-label => WebGUI::International::get(487,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('487 description',"WebGUIProfile"),
-label => $i18n->get(487),
-hoverHelp => $i18n->get('487 description'),
-value => $data->{possibleValues},
);
$f->textarea(
-name => "dataDefault",
-label => WebGUI::International::get(488,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('488 description',"WebGUIProfile"),
-label => $i18n->get(488),
-hoverHelp => $i18n->get('488 description'),
-value => $data->{dataDefault},
);
my %hash;
@ -228,8 +231,8 @@ sub www_editProfileField {
$f->selectBox(
-name=>"profileCategoryId",
-options=>\%hash,
-label=>WebGUI::International::get(489,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('489 description',"WebGUIProfile"),
-label=>$i18n->get(489),
-hoverHelp=>$i18n->get('489 description'),
-value=>$data->{profileCategoryId}
);
$f->submit;
@ -265,9 +268,10 @@ sub www_editProfileFieldSave {
sub www_editProfileSettings {
my $session = shift;
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
my $i18n = WebGUI::International->new($session,"WebGUIProfile");
my $output = "";
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
$output .= $session->icon->delete('op=deleteProfileCategoryConfirm;cid='.$category->getId,'',WebGUI::International::get(466,"WebGUIProfile"));
$output .= $session->icon->delete('op=deleteProfileCategoryConfirm;cid='.$category->getId,'',$i18n->get(466));
$output .= $session->icon->edit('op=editProfileCategory;cid='.$category->getId);
$output .= $session->icon->moveUp('op=moveProfileCategoryUp;cid='.$category->getId);
$output .= $session->icon->moveDown('op=moveProfileCategoryDown;cid='.$category->getId);
@ -275,7 +279,7 @@ sub www_editProfileSettings {
foreach my $field (@{$category->getFields}) {
next if $field->getId =~ /contentPositions/;
$output .= '     ';
$output .= $session->icon->delete('op=deleteProfileFieldConfirm;fid='.$field->getId,'',WebGUI::International::get(467,"WebGUIProfile"));
$output .= $session->icon->delete('op=deleteProfileFieldConfirm;fid='.$field->getId,'',$i18n->get(467));
$output .= $session->icon->edit('op=editProfileField;fid='.$field->getId);
$output .= $session->icon->moveUp('op=moveProfileFieldUp;fid='.$field->getId);
$output .= $session->icon->moveDown('op=moveProfileFieldDown;fid='.$field->getId);