more session changes
This commit is contained in:
parent
657ae8baf7
commit
f429daa942
27 changed files with 857 additions and 666 deletions
|
|
@ -25,6 +25,7 @@ use WebGUI::ProfileCategory;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
my $help = shift;
|
||||
|
|
@ -34,24 +35,25 @@ sub _submenu {
|
|||
if ($help) {
|
||||
$ac->setHelp($help,"WebGUIProfile");
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editProfileCategory;cid=new"), WebGUI::International::get(490,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editProfileField;fid=new"), WebGUI::International::get(491,"WebGUIProfile"));
|
||||
if ((($session{form}{op} eq "editProfileField" && $session{form}{fid} ne "new") || $session{form}{op} eq "deleteProfileField") && $session{form}{cid} eq "") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editProfileField;fid='.$session{form}{fid}), WebGUI::International::get(787,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteProfileField;fid='.$session{form}{fid}), WebGUI::International::get(788,"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"));
|
||||
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"));
|
||||
}
|
||||
if ((($session{form}{op} eq "editProfileCategory" && $session{form}{cid} ne "new") || $session{form}{op} eq "deleteProfileCategory") && $session{form}{fid} eq "") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editProfileCategory;cid='.$session{form}{cid}), WebGUI::International::get(789,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteProfileCategory;cid='.$session{form}{cid}), WebGUI::International::get(790,"WebGUIProfile"));
|
||||
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(WebGUI::URL::page("op=editProfileSettings"), WebGUI::International::get(492,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem($session->url->page("op=editProfileSettings"), WebGUI::International::get(492,"WebGUIProfile"));
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileCategoryConfirm {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $category = WebGUI::ProfileCategory->new($session{form}{cid});
|
||||
my $category = WebGUI::ProfileCategory->new($session->form->process("cid"));
|
||||
return WebGUI::AdminConsole->new("userProfiling")->render(WebGUI::Privilege::vitalComponent()) if ($category->isProtected);
|
||||
$category->delete;
|
||||
return www_editProfileSettings();
|
||||
|
|
@ -59,8 +61,9 @@ sub www_deleteProfileCategoryConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileFieldConfirm {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $field = WebGUI::ProfileField->new($session{form}{fid});
|
||||
my $field = WebGUI::ProfileField->new($session->form->process("fid"));
|
||||
return WebGUI::AdminConsole->new("userProfiling")->render(WebGUI::Privilege::vitalComponent()) if ($field->isProtected);
|
||||
$field->delete;
|
||||
return www_editProfileSettings();
|
||||
|
|
@ -68,6 +71,7 @@ sub www_deleteProfileFieldConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileCategory {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $data = {};
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
|
|
@ -75,16 +79,16 @@ sub www_editProfileCategory {
|
|||
-name => "op",
|
||||
-value => "editProfileCategorySave",
|
||||
);
|
||||
if ($session{form}{cid}) {
|
||||
if ($session->form->process("cid")) {
|
||||
$f->hidden(
|
||||
-name => "cid",
|
||||
-value => $session{form}{cid},
|
||||
-value => $session->form->process("cid"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-name => $session{form}{cid},
|
||||
-name => $session->form->process("cid"),
|
||||
-label => WebGUI::International::get(469,"WebGUIProfile"),
|
||||
);
|
||||
$data = WebGUI::ProfileCategory->new($session{form}{cid})->get;
|
||||
$data = WebGUI::ProfileCategory->new($session->form->process("cid"))->get;
|
||||
} else {
|
||||
$f->hidden(
|
||||
-name => "cid",
|
||||
|
|
@ -115,23 +119,25 @@ sub www_editProfileCategory {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileCategorySave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my %data = (
|
||||
label=>WebGUI::FormProcessor::text("label"),
|
||||
visible=>WebGUI::FormProcessor::yesNo("visible"),
|
||||
editable=>WebGUI::FormProcessor::yesNo("editable"),
|
||||
label=>$session->form->text("label"),
|
||||
visible=>$session->form->yesNo("visible"),
|
||||
editable=>$session->form->yesNo("editable"),
|
||||
);
|
||||
if ($session{form}{cid} eq "new") {
|
||||
if ($session->form->process("cid") eq "new") {
|
||||
my $category = WebGUI::ProfileCategory->create(\%data);
|
||||
$session{form}{cid} = $category->getId;
|
||||
$session->form->process("cid") = $category->getId;
|
||||
} else {
|
||||
WebGUI::ProfileCategory->new($session{form}{cid})->set(\%data);
|
||||
WebGUI::ProfileCategory->new($session->form->process("cid"))->set(\%data);
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileField {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
|
|
@ -139,17 +145,17 @@ sub www_editProfileField {
|
|||
-value => "editProfileFieldSave",
|
||||
);
|
||||
my $data = {};
|
||||
if ($session{form}{fid} ne 'new') {
|
||||
if ($session->form->process("fid") ne 'new') {
|
||||
$f->hidden(
|
||||
-name => "fid",
|
||||
-value => $session{form}{fid},
|
||||
-value => $session->form->process("fid"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-value => $session{form}{fid},
|
||||
-value => $session->form->process("fid"),
|
||||
-label => WebGUI::International::get(475,"WebGUIProfile"),
|
||||
-hoverHelp => WebGUI::International::get('475 description',"WebGUIProfile"),
|
||||
);
|
||||
$data = WebGUI::ProfileField->new($session{form}{fid})->get;
|
||||
$data = WebGUI::ProfileField->new($session->form->process("fid"))->get;
|
||||
} else {
|
||||
$f->hidden(
|
||||
-name => "new",
|
||||
|
|
@ -232,22 +238,23 @@ sub www_editProfileField {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileFieldSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my %data = (
|
||||
label=>WebGUI::FormProcessor::text("label"),
|
||||
editable=>WebGUI::FormProcessor::yesNo("editable"),
|
||||
visible=>WebGUI::FormProcessor::yesNo("visible"),
|
||||
required=>WebGUI::FormProcessor::yesNo("required"),
|
||||
possibleValues=>WebGUI::FormProcessor::textarea("possibleValues"),
|
||||
dataDefault=>WebGUI::FormProcessor::textarea("dataDefault"),
|
||||
fieldType=>WebGUI::FormProcessor::fieldType("fieldType"),
|
||||
label=>$session->form->text("label"),
|
||||
editable=>$session->form->yesNo("editable"),
|
||||
visible=>$session->form->yesNo("visible"),
|
||||
required=>$session->form->yesNo("required"),
|
||||
possibleValues=>$session->form->textarea("possibleValues"),
|
||||
dataDefault=>$session->form->textarea("dataDefault"),
|
||||
fieldType=>$session->form->fieldType("fieldType"),
|
||||
);
|
||||
my $categoryId = WebGUI::FormProcessor::selectBox("profileCategoryId");
|
||||
if ($session{form}{new}) {
|
||||
my $field = WebGUI::ProfileField->create(WebGUI::FormProcessor::text("fid"), \%data, $categoryId);
|
||||
$session{form}{fid} = $field->getId;
|
||||
my $categoryId = $session->form->selectBox("profileCategoryId");
|
||||
if ($session->form->process("new")) {
|
||||
my $field = WebGUI::ProfileField->create($session->form->text("fid"), \%data, $categoryId);
|
||||
$session->form->process("fid") = $field->getId;
|
||||
} else {
|
||||
my $field = WebGUI::ProfileField->new($session{form}{fid});
|
||||
my $field = WebGUI::ProfileField->new($session->form->process("fid"));
|
||||
$field->set(\%data);
|
||||
$field->setCategory($categoryId);
|
||||
}
|
||||
|
|
@ -256,6 +263,7 @@ sub www_editProfileFieldSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSettings {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $output = "";
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
|
|
@ -279,29 +287,33 @@ sub www_editProfileSettings {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileCategoryDown {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileCategory->new($session{form}{cid})->moveDown;
|
||||
WebGUI::ProfileCategory->new($session->form->process("cid"))->moveDown;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileCategoryUp {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileCategory->new($session{form}{cid})->moveUp;
|
||||
WebGUI::ProfileCategory->new($session->form->process("cid"))->moveUp;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileFieldDown {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileField->new($session{form}{fid})->moveDown;
|
||||
WebGUI::ProfileField->new($session->form->process("fid"))->moveDown;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileFieldUp {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileField->new($session{form}{fid})->moveUp;
|
||||
WebGUI::ProfileField->new($session->form->process("fid"))->moveUp;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue