migrating paginator api to new session system
fixed a few old style session vars
This commit is contained in:
parent
65a40d75ac
commit
877bf082a0
34 changed files with 280 additions and 262 deletions
|
|
@ -576,28 +576,28 @@ Fix $session{config}
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{config}{webguiRoot}!\$self->session->config->getWebguiRoot!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{config}{webguiRoot}!\$self->session->config->getWebguiRoot!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!\$session{config}{configFile}!\$self->session->config->getFilename!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{config}{configFile}!\$self->session->config->getFilename!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!\$session{config}{(\w+)}!\$self->session->config->get("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{config}{(.*)}!\$self->session->config->get("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
Fix $session{setting}
|
Fix $session{setting}
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{setting}{(\w+)}!\$self->session->setting->get("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{setting}{(.*)}!\$self->session->setting->get("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
Fix $session{user}
|
Fix $session{user}
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{user}{(username|userId)}!\$self->session->user->$1!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{user}{(username|userId)}!\$self->session->user->$1!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!\$session{user}{(\w+)}!\$self->session->user->profileField("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{user}{(.*)}!\$self->session->user->profileField("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
Fix $session{env}
|
Fix $session{env}
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{env}{(\w+)}!\$self->session->env->get("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{env}{(.*)}!\$self->session->env->get("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
Fix $session{os}
|
Fix $session{os}
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{os}{(\w+)}!\$self->session->os->get("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{os}{(.*)}!\$self->session->os->get("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
Fix $session{var}
|
Fix $session{var}
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{var}{(\w+)}!\$self->session->var->get("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{var}{(.*)}!\$self->session->var->get("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
Fix $session{req}
|
Fix $session{req}
|
||||||
|
|
||||||
|
|
@ -613,7 +613,7 @@ perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteAllScratch!\$self->session->scratc
|
||||||
perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteScratch!\$self->session->scratch->delete!g' fileNameGoesHere
|
perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteScratch!\$self->session->scratch->delete!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!WebGUI\:\:Session\:\:setScratch!\$self->session->scratch->set!g' fileNameGoesHere
|
perl -pi.bak -e 's!WebGUI\:\:Session\:\:setScratch!\$self->session->scratch->set!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!WebGUI\:\:Session\:\:getScratch!\$self->session->scratch->get!g' fileNameGoesHere
|
perl -pi.bak -e 's!WebGUI\:\:Session\:\:getScratch!\$self->session->scratch->get!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!\$session{scratch}{(\w+)}!\$self->session->scratch->get("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{scratch}{(.*)}!\$self->session->scratch->get("$1")!g' fileNameGoesHere
|
||||||
|
|
||||||
|
|
||||||
5.23.1 WebGUI::SQL API Refactored
|
5.23.1 WebGUI::SQL API Refactored
|
||||||
|
|
@ -636,7 +636,7 @@ perl -pi.bak -e 's!quote\(!\$self->session->db->quote(!g' fileNameGoesHere
|
||||||
Instead of accessing $session{form} or WebGUI::FormProcessor getting form data
|
Instead of accessing $session{form} or WebGUI::FormProcessor getting form data
|
||||||
is done through the new session system via $session->form->process("param","Text");
|
is done through the new session system via $session->form->process("param","Text");
|
||||||
|
|
||||||
perl -pi.bak -e 's!\$session{form}{(\w+)}!\$self->session->form->process("$1")!g' fileNameGoesHere
|
perl -pi.bak -e 's!\$session{form}{(.*)}!\$self->session->form->process("$1")!g' fileNameGoesHere
|
||||||
perl -pi.bak -e 's!WebGUI\:\:FormProcessor\:\:!\$self->session->form->!g' fileNameGoesHere
|
perl -pi.bak -e 's!WebGUI\:\:FormProcessor\:\:!\$self->session->form->!g' fileNameGoesHere
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -789,6 +789,14 @@ perl -pi.bak -e 's!WebGUI\:\:LDAPLink\:\:getList\(!WebGUI::LDAPLink->getList(\$s
|
||||||
perl -pi.bak -e 's!WebGUI\:\:LDAPLink\:\:get\((.*)\)!WebGUI::LDAPLink->new(\$self->session,$1)->get!g' fileNameGoesHere
|
perl -pi.bak -e 's!WebGUI\:\:LDAPLink\:\:get\((.*)\)!WebGUI::LDAPLink->new(\$self->session,$1)->get!g' fileNameGoesHere
|
||||||
|
|
||||||
|
|
||||||
|
5.23.18 WebGUI::Paginator API Refactored
|
||||||
|
|
||||||
|
WebGUI::Paginator API was changed to use the new session API.
|
||||||
|
|
||||||
|
perl -pi.bak -e 's!WebGUI\:\:Paginator\-\>new\(!WebGUI::Paginator->new(\$self->session,!g' fileNameGoesHere
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
6. Automatic list of Assets in Help System.
|
6. Automatic list of Assets in Help System.
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
6.1 Starting in WebGUI 6.7, there is now an automatic list of all Assets
|
6.1 Starting in WebGUI 6.7, there is now an automatic list of all Assets
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ sub getAssetAdderLinks {
|
||||||
my $addToUrl = shift;
|
my $addToUrl = shift;
|
||||||
my $type = shift || "assets";
|
my $type = shift || "assets";
|
||||||
my %links;
|
my %links;
|
||||||
foreach my $class (@{$session{config}{$type}}) {
|
foreach my $class (@{$self->session->config->get("$type}")) {
|
||||||
next unless $class;
|
next unless $class;
|
||||||
my $load = "use ".$class;
|
my $load = "use ".$class;
|
||||||
eval ($load);
|
eval ($load);
|
||||||
|
|
@ -964,7 +964,7 @@ sub getValue {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $key = shift;
|
my $key = shift;
|
||||||
if (defined $key) {
|
if (defined $key) {
|
||||||
# return $session{form}{$key} if (exists $session{form}{$key}); # Security Hazard!
|
# return $self->session->form->process("$key} if (exists $session{form}{$key")); # Security Hazard!
|
||||||
my $storedValue = $self->get($key);
|
my $storedValue = $self->get($key);
|
||||||
return $storedValue if (defined $storedValue);
|
return $storedValue if (defined $storedValue);
|
||||||
unless (exists $self->{_propertyDefinitions}) { # check to see if the definitions have been merged and cached
|
unless (exists $self->{_propertyDefinitions}) { # check to see if the definitions have been merged and cached
|
||||||
|
|
@ -1201,7 +1201,7 @@ sub processPropertiesFromFormPost {
|
||||||
}
|
}
|
||||||
foreach my $form (keys %{$session{form}}) {
|
foreach my $form (keys %{$session{form}}) {
|
||||||
if ($form =~ /^metadata_(.*)$/) {
|
if ($form =~ /^metadata_(.*)$/) {
|
||||||
$self->updateMetaData($1,$session{form}{$form});
|
$self->updateMetaData($1,$self->session->form->process("$form"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data{title} = "Untitled" unless ($data{title});
|
$data{title} = "Untitled" unless ($data{title});
|
||||||
|
|
@ -1416,7 +1416,7 @@ sub www_add {
|
||||||
$self->session->errorHandler->security("tried to call an invalid class ".$class);
|
$self->session->errorHandler->security("tried to call an invalid class ".$class);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if ($session{form}{'prototype'}) {
|
if ($self->session->form->process("'prototype'")) {
|
||||||
my $prototype = WebGUI::Asset->new($self->session->form->process("prototype"),$class);
|
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}) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab
|
||||||
foreach my $property (keys %{$definition->{properties}}) {
|
foreach my $property (keys %{$definition->{properties}}) {
|
||||||
|
|
|
||||||
|
|
@ -202,9 +202,9 @@ sub processPropertiesFromFormPost {
|
||||||
my %data;
|
my %data;
|
||||||
$data{filename} = $filename;
|
$data{filename} = $filename;
|
||||||
$data{storageId} = $storage->getId;
|
$data{storageId} = $storage->getId;
|
||||||
$data{title} = $filename unless ($session{form}{title});
|
$data{title} = $filename unless ($self->session->form->process("title"));
|
||||||
$data{menuTitle} = $filename unless ($session{form}{menuTitle});
|
$data{menuTitle} = $filename unless ($self->session->form->process("menuTitle"));
|
||||||
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
|
$data{url} = $self->getParent->get('url').'/'.$filename unless ($self->session->form->process("url"));
|
||||||
$self->update(\%data);
|
$self->update(\%data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -660,7 +660,7 @@ sub processPropertiesFromFormPost {
|
||||||
);
|
);
|
||||||
$data{url} = $self->fixUrl($self->getThread->get("url")."/1") if ($self->isReply);
|
$data{url} = $self->fixUrl($self->getThread->get("url")."/1") if ($self->isReply);
|
||||||
if ($self->getThread->getParent->canModerate) {
|
if ($self->getThread->getParent->canModerate) {
|
||||||
$self->getThread->lock if ($session{form}{'lock'});
|
$self->getThread->lock if ($self->session->form->process("'lock'"));
|
||||||
$self->getThread->stick if ($self->session->form->process("stick"));
|
$self->getThread->stick if ($self->session->form->process("stick"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1002,7 +1002,7 @@ sub www_edit {
|
||||||
});
|
});
|
||||||
$var{'lock.form'} = WebGUI::Form::yesNo({
|
$var{'lock.form'} = WebGUI::Form::yesNo({
|
||||||
name=>'lock',
|
name=>'lock',
|
||||||
value=>$session{form}{'lock'}
|
value=>$self->session->form->process("'lock'")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$var{'subscribe.form'} = WebGUI::Form::yesNo({
|
$var{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||||
|
|
@ -1035,7 +1035,7 @@ sub www_edit {
|
||||||
($var{'preview.synopsis'}, $var{'preview.content'}) = $self->getSynopsisAndContentFromFormPost;
|
($var{'preview.synopsis'}, $var{'preview.content'}) = $self->getSynopsisAndContentFromFormPost;
|
||||||
$var{'preview.content'} = $self->formatContent($var{'preview.content'},$self->session->form->process("contentType"));
|
$var{'preview.content'} = $self->formatContent($var{'preview.content'},$self->session->form->process("contentType"));
|
||||||
for my $i (1..5) {
|
for my $i (1..5) {
|
||||||
$var{'preview.userDefined'.$i} = WebGUI::HTML::filter($session{form}{'userDefined'.$i},"macros");
|
$var{'preview.userDefined'.$i} = WebGUI::HTML::filter($self->session->form->process("'userDefined'.$i"),"macros");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$var{'form.footer'} = WebGUI::Form::formFooter($self->session,);
|
$var{'form.footer'} = WebGUI::Form::formFooter($self->session,);
|
||||||
|
|
|
||||||
|
|
@ -647,7 +647,7 @@ sub view {
|
||||||
$var->{'lock.url'} = $self->getLockUrl;
|
$var->{'lock.url'} = $self->getLockUrl;
|
||||||
$var->{'unlock.url'} = $self->getUnlockUrl;
|
$var->{'unlock.url'} = $self->getUnlockUrl;
|
||||||
|
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl,$self->getParent->get("postsPerPage"));
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->getParent->get("postsPerPage"));
|
||||||
my $sql = "select asset.assetId, asset.className, assetData.revisionDate as revisionDate from asset
|
my $sql = "select asset.assetId, asset.className, assetData.revisionDate as revisionDate from asset
|
||||||
left join assetData on assetData.assetId=asset.assetId
|
left join assetData on assetData.assetId=asset.assetId
|
||||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||||
|
|
|
||||||
|
|
@ -463,8 +463,8 @@ sub getShortcutByCriteria {
|
||||||
my $scratchId;
|
my $scratchId;
|
||||||
if ($assetId) {
|
if ($assetId) {
|
||||||
$scratchId = "Shortcut_" . $assetId;
|
$scratchId = "Shortcut_" . $assetId;
|
||||||
if($session{scratch}{$scratchId} && !$self->getValue("disableContentLock")) {
|
if($self->session->scratch->get("$scratchId") && !$self->getValue("disableContentLock")) {
|
||||||
return $session{scratch}{$scratchId} unless ($self->session->var->get("adminOn"));
|
return $self->session->scratch->get("$scratchId") unless ($self->session->var->get("adminOn"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ sub view {
|
||||||
$var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s;
|
$var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s;
|
||||||
$var{"description.first.sentence"} = $var{"description.first.2sentences"};
|
$var{"description.first.sentence"} = $var{"description.first.2sentences"};
|
||||||
$var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s;
|
$var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s;
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl,1);
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,1);
|
||||||
if ($self->session->form->process("makePrintable") || $var{description} eq "") {
|
if ($self->session->form->process("makePrintable") || $var{description} eq "") {
|
||||||
$var{description} =~ s/\^\-\;//g;
|
$var{description} =~ s/\^\-\;//g;
|
||||||
$p->setDataByArrayRef([$var{description}]);
|
$p->setDataByArrayRef([$var{description}]);
|
||||||
|
|
|
||||||
|
|
@ -894,9 +894,9 @@ sub view {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $scratchSortBy = $self->getId."_sortBy";
|
my $scratchSortBy = $self->getId."_sortBy";
|
||||||
my $scratchSortOrder = $self->getId."_sortDir";
|
my $scratchSortOrder = $self->getId."_sortDir";
|
||||||
my $sortBy = $self->session->form->process("sortBy") || $session{scratch}{$scratchSortBy} || $self->get("sortBy");
|
my $sortBy = $self->session->form->process("sortBy") || $self->session->scratch->get("$scratchSortBy") || $self->get("sortBy");
|
||||||
my $sortOrder = $session{scratch}{$scratchSortOrder} || $self->get("sortOrder");
|
my $sortOrder = $self->session->scratch->get("$scratchSortOrder") || $self->get("sortOrder");
|
||||||
if ($sortBy ne $session{scratch}{$scratchSortBy} && $self->session->form->process("func") ne "editSave") {
|
if ($sortBy ne $self->session->scratch->get("$scratchSortBy") && $self->session->form->process("func") ne "editSave") {
|
||||||
$self->session->scratch->set($scratchSortBy,$self->session->form->process("sortBy"));
|
$self->session->scratch->set($scratchSortBy,$self->session->form->process("sortBy"));
|
||||||
} elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") {
|
} elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") {
|
||||||
if ($sortOrder eq "asc") {
|
if ($sortOrder eq "asc") {
|
||||||
|
|
@ -938,7 +938,7 @@ sub view {
|
||||||
left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate = assetData.revisionDate
|
left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate = assetData.revisionDate
|
||||||
where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) and $constraints
|
where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) and $constraints
|
||||||
group by assetData.assetId order by Thread.isSticky desc, ".$sortBy." ".$sortOrder;
|
group by assetData.assetId order by Thread.isSticky desc, ".$sortBy." ".$sortOrder;
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage"));
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->get("threadsPerPage"));
|
||||||
$self->appendPostListTemplateVars(\%var, $sql, $p);
|
$self->appendPostListTemplateVars(\%var, $sql, $p);
|
||||||
$self->appendTemplateLabels(\%var);
|
$self->appendTemplateLabels(\%var);
|
||||||
return $self->processTemplate(\%var,$self->get("collaborationTemplateId"));
|
return $self->processTemplate(\%var,$self->get("collaborationTemplateId"));
|
||||||
|
|
@ -965,28 +965,28 @@ sub www_search {
|
||||||
.WebGUI::Form::hidden($self->session,{ name=>"doit", value=>1 });
|
.WebGUI::Form::hidden($self->session,{ name=>"doit", value=>1 });
|
||||||
$var{'all.form'} = WebGUI::Form::text({
|
$var{'all.form'} = WebGUI::Form::text({
|
||||||
name=>'all',
|
name=>'all',
|
||||||
value=>$session{scratch}{$self->getId."_all"},
|
value=>$self->session->scratch->get("$self->getId."_all""),
|
||||||
size=>($self->session->setting->get("textBoxSize")-5)
|
size=>($self->session->setting->get("textBoxSize")-5)
|
||||||
});
|
});
|
||||||
$var{'exactphrase.form'} = WebGUI::Form::text({
|
$var{'exactphrase.form'} = WebGUI::Form::text({
|
||||||
name=>'exactPhrase',
|
name=>'exactPhrase',
|
||||||
value=>$session{scratch}{$self->getId."_exactPhrase"},
|
value=>$self->session->scratch->get("$self->getId."_exactPhrase""),
|
||||||
size=>($self->session->setting->get("textBoxSize")-5)
|
size=>($self->session->setting->get("textBoxSize")-5)
|
||||||
});
|
});
|
||||||
$var{'atleastone.form'} = WebGUI::Form::text({
|
$var{'atleastone.form'} = WebGUI::Form::text({
|
||||||
name=>'atLeastOne',
|
name=>'atLeastOne',
|
||||||
value=>$session{scratch}{$self->getId."_atLeastOne"},
|
value=>$self->session->scratch->get("$self->getId."_atLeastOne""),
|
||||||
size=>($self->session->setting->get("textBoxSize")-5)
|
size=>($self->session->setting->get("textBoxSize")-5)
|
||||||
});
|
});
|
||||||
$var{'without.form'} = WebGUI::Form::text({
|
$var{'without.form'} = WebGUI::Form::text({
|
||||||
name=>'without',
|
name=>'without',
|
||||||
value=>$session{scratch}{$self->getId."_without"},
|
value=>$self->session->scratch->get("$self->getId."_without""),
|
||||||
size=>($self->session->setting->get("textBoxSize")-5)
|
size=>($self->session->setting->get("textBoxSize")-5)
|
||||||
});
|
});
|
||||||
my %results;
|
my %results;
|
||||||
tie %results, 'Tie::IxHash';
|
tie %results, 'Tie::IxHash';
|
||||||
%results = (10=>'10', 25=>'25', 50=>'50', 100=>'100');
|
%results = (10=>'10', 25=>'25', 50=>'50', 100=>'100');
|
||||||
my $numResults = $session{scratch}{$self->getId."_numResults"} || $self->get("threadsPerPage");
|
my $numResults = $self->session->scratch->get("$self->getId."_numResults"") || $self->get("threadsPerPage");
|
||||||
$var{'results.form'} = WebGUI::Form::selectBox({
|
$var{'results.form'} = WebGUI::Form::selectBox({
|
||||||
name=>"numResults",
|
name=>"numResults",
|
||||||
options=>\%results,
|
options=>\%results,
|
||||||
|
|
@ -1000,10 +1000,10 @@ sub www_search {
|
||||||
if ($self->session->form->process("doit")) {
|
if ($self->session->form->process("doit")) {
|
||||||
my @fieldsToSearch = qw(assetData.title assetData.synopsis Post.content Post.username Post.userDefined1 Post.userDefined2 Post.userDefined3 Post.userDefined4 Post.userDefined5);
|
my @fieldsToSearch = qw(assetData.title assetData.synopsis Post.content Post.username Post.userDefined1 Post.userDefined2 Post.userDefined3 Post.userDefined4 Post.userDefined5);
|
||||||
my $all;
|
my $all;
|
||||||
if ($session{scratch}{$self->getId."_all"} ne "") {
|
if ($self->session->scratch->get("$self->getId."_all"") ne "") {
|
||||||
$session{scratch}{$self->getId."_all"} =~ s/,/ /g;
|
$self->session->scratch->get("$self->getId."_all"") =~ s/,/ /g;
|
||||||
$session{scratch}{$self->getId."_all"} =~ s/\s+/ /g;
|
$self->session->scratch->get("$self->getId."_all"") =~ s/\s+/ /g;
|
||||||
my @words = split(/ /,$session{scratch}{$self->getId."_all"});
|
my @words = split(/ /,$self->session->scratch->get("$self->getId."_all""));
|
||||||
foreach my $word (@words) {
|
foreach my $word (@words) {
|
||||||
$all .= " and " if ($all ne "");
|
$all .= " and " if ($all ne "");
|
||||||
$all .= "(";
|
$all .= "(";
|
||||||
|
|
@ -1018,17 +1018,17 @@ sub www_search {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $exactPhrase;
|
my $exactPhrase;
|
||||||
if ($session{scratch}{$self->getId."_exactPhrase"} ne "") {
|
if ($self->session->scratch->get("$self->getId."_exactPhrase"") ne "") {
|
||||||
foreach my $field (@fieldsToSearch) {
|
foreach my $field (@fieldsToSearch) {
|
||||||
$exactPhrase .= " or " if ($exactPhrase ne "");
|
$exactPhrase .= " or " if ($exactPhrase ne "");
|
||||||
$exactPhrase .= " $field like ".$self->session->db->quote("%".$session{scratch}{$self->getId."_exactPhrase"}."%");
|
$exactPhrase .= " $field like ".$self->session->db->quote("%".$self->session->scratch->get("$self->getId."_exactPhrase"")."%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $atLeastOne;
|
my $atLeastOne;
|
||||||
if ($session{scratch}{$self->getId."_atLeastOne"} ne "") {
|
if ($self->session->scratch->get("$self->getId."_atLeastOne"") ne "") {
|
||||||
$session{scratch}{$self->getId."_atLeastOne"} =~ s/,/ /g;
|
$self->session->scratch->get("$self->getId."_atLeastOne"") =~ s/,/ /g;
|
||||||
$session{scratch}{$self->getId."_atLeastOne"} =~ s/\s+/ /g;
|
$self->session->scratch->get("$self->getId."_atLeastOne"") =~ s/\s+/ /g;
|
||||||
my @words = split(/ /,$session{scratch}{$self->getId."_atLeastOne"});
|
my @words = split(/ /,$self->session->scratch->get("$self->getId."_atLeastOne""));
|
||||||
foreach my $word (@words) {
|
foreach my $word (@words) {
|
||||||
foreach my $field (@fieldsToSearch) {
|
foreach my $field (@fieldsToSearch) {
|
||||||
$atLeastOne .= " or " if ($atLeastOne ne "");
|
$atLeastOne .= " or " if ($atLeastOne ne "");
|
||||||
|
|
@ -1037,10 +1037,10 @@ sub www_search {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $without;
|
my $without;
|
||||||
if ($session{scratch}{$self->getId."_without"} ne "") {
|
if ($self->session->scratch->get("$self->getId."_without"") ne "") {
|
||||||
$session{scratch}{$self->getId."_without"} =~ s/,/ /g;
|
$self->session->scratch->get("$self->getId."_without"") =~ s/,/ /g;
|
||||||
$session{scratch}{$self->getId."_without"} =~ s/\s+/ /g;
|
$self->session->scratch->get("$self->getId."_without"") =~ s/\s+/ /g;
|
||||||
my @words = split(/ /,$session{scratch}{$self->getId."_without"});
|
my @words = split(/ /,$self->session->scratch->get("$self->getId."_without""));
|
||||||
foreach my $word (@words) {
|
foreach my $word (@words) {
|
||||||
foreach my $field (@fieldsToSearch) {
|
foreach my $field (@fieldsToSearch) {
|
||||||
$without .= " and " if ($without ne "");
|
$without .= " and " if ($without ne "");
|
||||||
|
|
@ -1071,7 +1071,7 @@ sub www_search {
|
||||||
$sql .= " and " if ($sql ne "" && $without ne "");
|
$sql .= " and " if ($sql ne "" && $without ne "");
|
||||||
$sql .= " ($without) " if ($without ne "");
|
$sql .= " ($without) " if ($without ne "");
|
||||||
$sql .= " group by assetData.assetId order by Post.dateSubmitted desc";
|
$sql .= " group by assetData.assetId order by Post.dateSubmitted desc";
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl("func=search;doit=1"),$numResults);
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl("func=search;doit=1"),$numResults);
|
||||||
$self->appendPostListTemplateVars(\%var, $sql, $p);
|
$self->appendPostListTemplateVars(\%var, $sql, $p);
|
||||||
}
|
}
|
||||||
return $self->processStyle($self->processTemplate(\%var, $self->get("searchTemplateId")));
|
return $self->processStyle($self->processTemplate(\%var, $self->get("searchTemplateId")));
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ sub _createField {
|
||||||
my %param;
|
my %param;
|
||||||
$param{name} = $data->{name};
|
$param{name} = $data->{name};
|
||||||
$param{name} = "field_".$data->{sequenceNumber} if ($param{name} eq ""); # Empty fieldname not allowed
|
$param{name} = "field_".$data->{sequenceNumber} if ($param{name} eq ""); # Empty fieldname not allowed
|
||||||
$session{form}{$param{name}} =~ s/\^.*?\;//gs ; # remove macro's from user input
|
$self->session->form->process("$param{name}") =~ s/\^.*?\;//gs ; # remove macro's from user input
|
||||||
$param{value} = $data->{value};
|
$param{value} = $data->{value};
|
||||||
$param{size} = $data->{width};
|
$param{size} = $data->{width};
|
||||||
$param{rows} = $data->{rows} || 5;
|
$param{rows} = $data->{rows} || 5;
|
||||||
|
|
@ -53,7 +53,7 @@ sub _createField {
|
||||||
}
|
}
|
||||||
if (isIn($data->{type},qw(selectList checkList))) {
|
if (isIn($data->{type},qw(selectList checkList))) {
|
||||||
my @defaultValues;
|
my @defaultValues;
|
||||||
if ($session{form}{$param{name}}) {
|
if ($self->session->form->process("$param{name}")) {
|
||||||
@defaultValues = $self->session->form->selectList($param{name});
|
@defaultValues = $self->session->form->selectList($param{name});
|
||||||
} else {
|
} else {
|
||||||
foreach (split(/\n/, $data->{value})) {
|
foreach (split(/\n/, $data->{value})) {
|
||||||
|
|
@ -426,7 +426,7 @@ sub getRecordTemplateVars {
|
||||||
my @fields;
|
my @fields;
|
||||||
my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId=".$self->session->db->quote($tab{DataForm_tabId})." order by a.sequenceNumber");
|
my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId=".$self->session->db->quote($tab{DataForm_tabId})." order by a.sequenceNumber");
|
||||||
while (%data = $sth->hash) {
|
while (%data = $sth->hash) {
|
||||||
my $formValue = $session{form}{$data{name}};
|
my $formValue = $self->session->form->process("$data{name}");
|
||||||
if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) {
|
if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) {
|
||||||
$data{value} = $formValue;
|
$data{value} = $formValue;
|
||||||
$data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date");
|
$data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date");
|
||||||
|
|
@ -470,7 +470,7 @@ sub getRecordTemplateVars {
|
||||||
my @fields;
|
my @fields;
|
||||||
my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId = 0 order by a.sequenceNumber");
|
my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId = 0 order by a.sequenceNumber");
|
||||||
while (%data = $sth->hash) {
|
while (%data = $sth->hash) {
|
||||||
my $formValue = $session{form}{$data{name}};
|
my $formValue = $self->session->form->process("$data{name}");
|
||||||
if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) {
|
if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) {
|
||||||
$data{value} = $formValue;
|
$data{value} = $formValue;
|
||||||
$data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date");
|
$data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date");
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ sub view {
|
||||||
foreach my $input_name (keys %{$session{form}}) {
|
foreach my $input_name (keys %{$session{form}}) {
|
||||||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||||
$input_name =~ s/^HttpProxy_//;
|
$input_name =~ s/^HttpProxy_//;
|
||||||
$proxiedUrl=$self->session->url->append($proxiedUrl,"$input_name=$session{form}{'HttpProxy_'.$input_name}");
|
$proxiedUrl=$self->session->url->append($proxiedUrl,"$input_name=$self->session->form->process("'HttpProxy_'.$input_name")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$request = HTTP::Request->new(GET => $proxiedUrl, $header) || return "wrong url"; # Create GET request
|
$request = HTTP::Request->new(GET => $proxiedUrl, $header) || return "wrong url"; # Create GET request
|
||||||
|
|
@ -245,13 +245,13 @@ sub view {
|
||||||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||||
$input_name =~ s/^HttpProxy_//;
|
$input_name =~ s/^HttpProxy_//;
|
||||||
|
|
||||||
my $uploadFile = $self->session->request->tmpFileName($session{form}{'HttpProxy_'.$input_name});
|
my $uploadFile = $self->session->request->tmpFileName($self->session->form->process("'HttpProxy_'.$input_name"));
|
||||||
if(-r $uploadFile) { # Found uploaded file
|
if(-r $uploadFile) { # Found uploaded file
|
||||||
@formUpload=($uploadFile, qq/$session{form}{'HttpProxy_'.$input_name}/);
|
@formUpload=($uploadFile, qq/$self->session->form->process("'HttpProxy_'.$input_name")/);
|
||||||
$formdata{$input_name}=\@formUpload;
|
$formdata{$input_name}=\@formUpload;
|
||||||
$contentType = 'form-data'; # Different Content Type header for file upload
|
$contentType = 'form-data'; # Different Content Type header for file upload
|
||||||
} else {
|
} else {
|
||||||
$formdata{$input_name}=qq/$session{form}{'HttpProxy_'.$input_name}/;
|
$formdata{$input_name}=qq/$self->session->form->process("'HttpProxy_'.$input_name")/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Create POST request
|
# Create POST request
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ sub view {
|
||||||
|
|
||||||
my $lastDepartment = "_nothing_";
|
my $lastDepartment = "_nothing_";
|
||||||
|
|
||||||
my $p = WebGUI::Paginator->new($url, $self->getValue("paginateAfter"));
|
my $p = WebGUI::Paginator->new($self->session,$url, $self->getValue("paginateAfter"));
|
||||||
|
|
||||||
my $sql = "select users.username,
|
my $sql = "select users.username,
|
||||||
users.userId,
|
users.userId,
|
||||||
|
|
@ -433,7 +433,7 @@ sub www_viewReport {
|
||||||
$var{showReport} = 1;
|
$var{showReport} = 1;
|
||||||
$endDate = $self->session->datetime->addToTime($endDate,24,0,0);
|
$endDate = $self->session->datetime->addToTime($endDate,24,0,0);
|
||||||
my $lastDepartment = "_none_";
|
my $lastDepartment = "_none_";
|
||||||
my $p = WebGUI::Paginator->new($url, $pageReportAfter);
|
my $p = WebGUI::Paginator->new($self->session,$url, $pageReportAfter);
|
||||||
|
|
||||||
my $sql = "select users.username,
|
my $sql = "select users.username,
|
||||||
users.userId,
|
users.userId,
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ sub view {
|
||||||
map {$url .= "&namespaces=".$self->session->url->escape($_)} $self->session->request->param('namespaces');
|
map {$url .= "&namespaces=".$self->session->url->escape($_)} $self->session->request->param('namespaces');
|
||||||
map {$url .= "&contentTypes=".$self->session->url->escape($_)} $self->session->request->param('contentTypes');
|
map {$url .= "&contentTypes=".$self->session->url->escape($_)} $self->session->request->param('contentTypes');
|
||||||
$url .= "&paginateAfter=".$self->getValue("paginateAfter");
|
$url .= "&paginateAfter=".$self->getValue("paginateAfter");
|
||||||
my $p = WebGUI::Paginator->new($self->session->url->page($url), $self->getValue("paginateAfter"));
|
my $p = WebGUI::Paginator->new($self->session,$self->session->url->page($url), $self->getValue("paginateAfter"));
|
||||||
$p->setDataByArrayRef($results);
|
$p->setDataByArrayRef($results);
|
||||||
$var{startNr} = 1;
|
$var{startNr} = 1;
|
||||||
if($self->session->form->process("pn")) {
|
if($self->session->form->process("pn")) {
|
||||||
|
|
|
||||||
|
|
@ -749,11 +749,11 @@ sub www_rate {
|
||||||
if ($first) {
|
if ($first) {
|
||||||
$first=0;
|
$first=0;
|
||||||
} else {
|
} else {
|
||||||
if ($lastRating != $session{form}{$category}) {
|
if ($lastRating != $self->session->form->process("$category")) {
|
||||||
$sameRating = 0;
|
$sameRating = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$lastRating = $session{form}{$category};
|
$lastRating = $self->session->form->process("$category");
|
||||||
}
|
}
|
||||||
return $self->www_viewDetail("",1) if ($hasRated || $sameRating); # Throw out ratings that are all the same number, or if the user rates twice.
|
return $self->www_viewDetail("",1) if ($hasRated || $sameRating); # Throw out ratings that are all the same number, or if the user rates twice.
|
||||||
$self->setRatings($self->session->form->process("listingId"),$session{form});
|
$self->setRatings($self->session->form->process("listingId"),$session{form});
|
||||||
|
|
@ -773,14 +773,14 @@ sub www_search {
|
||||||
}
|
}
|
||||||
my $sth = $self->session->db->read("select name,fieldType from Matrix_field");
|
my $sth = $self->session->db->read("select name,fieldType from Matrix_field");
|
||||||
while (my ($name,$fieldType) = $sth->array) {
|
while (my ($name,$fieldType) = $sth->array) {
|
||||||
next unless ($session{form}{$name});
|
next unless ($self->session->form->process("$name"));
|
||||||
push(@list,0);
|
push(@list,0);
|
||||||
my $where;
|
my $where;
|
||||||
if ($fieldType ne "goodBad") {
|
if ($fieldType ne "goodBad") {
|
||||||
$where = "("
|
$where = "("
|
||||||
."a.value like ".$self->session->db->quote("%".$session{form}{$name}."%")
|
."a.value like ".$self->session->db->quote("%".$self->session->form->process("$name")."%")
|
||||||
." or a.value='Any'"
|
." or a.value='Any'"
|
||||||
#." or a.value<".$self->session->db->quote($session{form}{$name})
|
#." or a.value<".$self->session->db->quote($self->session->form->process("$name"))
|
||||||
." or a.value='Free'"
|
." or a.value='Free'"
|
||||||
.")";
|
.")";
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -832,13 +832,13 @@ sub www_search {
|
||||||
if ($data->{fieldType} ne "goodBad") {
|
if ($data->{fieldType} ne "goodBad") {
|
||||||
$data->{form} = WebGUI::Form::text({
|
$data->{form} = WebGUI::Form::text({
|
||||||
name=>$data->{name},
|
name=>$data->{name},
|
||||||
value=>$session{form}{$data->{name}}
|
value=>$self->session->form->process("$data->{name}")
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$data->{form} = WebGUI::Form::checkbox({
|
$data->{form} = WebGUI::Form::checkbox({
|
||||||
name=>$data->{name},
|
name=>$data->{name},
|
||||||
value=>"1",
|
value=>"1",
|
||||||
checked=>$session{form}{$data->{name}}
|
checked=>$self->session->form->process("$data->{name}")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
push(@loop,$data);
|
push(@loop,$data);
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ sub www_preview {
|
||||||
showSystemPages=>$self->session->form->process("showSystemPages"),
|
showSystemPages=>$self->session->form->process("showSystemPages"),
|
||||||
showHiddenPages=>$self->session->form->process("showHiddenPages"),
|
showHiddenPages=>$self->session->form->process("showHiddenPages"),
|
||||||
showUnprivilegedPages=>$self->session->form->process("showUnprivilegedPages"),
|
showUnprivilegedPages=>$self->session->form->process("showUnprivilegedPages"),
|
||||||
'reverse'=>$session{form}{'reverse'},
|
'reverse'=>$self->session->form->process("'reverse'"),
|
||||||
);
|
);
|
||||||
my $output = qq(
|
my $output = qq(
|
||||||
<table width="100%" border="0" cellpadding="5" cellspacing="0">
|
<table width="100%" border="0" cellpadding="5" cellspacing="0">
|
||||||
|
|
@ -474,7 +474,7 @@ sub www_preview {
|
||||||
stopAtLevel: $self->session->form->process("stopAtLevel")<br />
|
stopAtLevel: $self->session->form->process("stopAtLevel")<br />
|
||||||
depth: $self->session->form->process("depth")<br />
|
depth: $self->session->form->process("depth")<br />
|
||||||
templateId: $self->session->form->process("templateId")<br />
|
templateId: $self->session->form->process("templateId")<br />
|
||||||
reverse: $session{form}{'reverse'}<br />
|
reverse: $self->session->form->process("'reverse'")<br />
|
||||||
showSystemPages: $self->session->form->process("showSystemPages")<br />
|
showSystemPages: $self->session->form->process("showSystemPages")<br />
|
||||||
showHiddenPages: $self->session->form->process("showHiddenPages")<br />
|
showHiddenPages: $self->session->form->process("showHiddenPages")<br />
|
||||||
showUnprivilegedPages: $self->session->form->process("showUnprivilegedPages")<br />
|
showUnprivilegedPages: $self->session->form->process("showUnprivilegedPages")<br />
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ sub _parsePlaceholderParams {
|
||||||
my ($type,$field) = split(/:/,$row);
|
my ($type,$field) = split(/:/,$row);
|
||||||
my $param;
|
my $param;
|
||||||
if($type =~ /^form/) {
|
if($type =~ /^form/) {
|
||||||
$param = $session{form}{$field};
|
$param = $self->session->form->process("$field");
|
||||||
} elsif ($type =~ /^query(\d)/) {
|
} elsif ($type =~ /^query(\d)/) {
|
||||||
$param = $self->{_query}{$1}{rowData}{$field};
|
$param = $self->{_query}{$1}{rowData}{$field};
|
||||||
}
|
}
|
||||||
|
|
@ -332,12 +332,12 @@ sub _processQuery {
|
||||||
foreach (keys %{$session{form}}) {
|
foreach (keys %{$session{form}}) {
|
||||||
unless ($_ eq "pn" || $_ eq "func" || $_ =~ /identifier/i || $_ =~ /password/i) {
|
unless ($_ eq "pn" || $_ eq "func" || $_ =~ /identifier/i || $_ =~ /password/i) {
|
||||||
$url = $self->session->url->append($url, $self->session->url->escape($_)
|
$url = $self->session->url->append($url, $self->session->url->escape($_)
|
||||||
.'='.$self->session->url->escape($session{form}{$_}));
|
.'='.$self->session->url->escape($self->session->form->process("$_")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $paginateAfter = $self->get("paginateAfter");
|
my $paginateAfter = $self->get("paginateAfter");
|
||||||
$paginateAfter = 1000 if($nr > 1);
|
$paginateAfter = 1000 if($nr > 1);
|
||||||
my $p = WebGUI::Paginator->new($url,$paginateAfter);
|
my $p = WebGUI::Paginator->new($self->session,$url,$paginateAfter);
|
||||||
my $error = $p->setDataByQuery($query,$dbh,1,$placeholderParams);
|
my $error = $p->setDataByQuery($query,$dbh,1,$placeholderParams);
|
||||||
if ($error ne "") {
|
if ($error ne "") {
|
||||||
$self->session->errorHandler->warn("There was a problem with the query: ".$error);
|
$self->session->errorHandler->warn("There was a problem with the query: ".$error);
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ sub duplicate {
|
||||||
sub generateResponseId {
|
sub generateResponseId {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $varname = $self->getResponseIdString;
|
my $varname = $self->getResponseIdString;
|
||||||
if ($session{scratch}{$varname}) {
|
if ($self->session->scratch->get("$varname")) {
|
||||||
$self->completeResponse;
|
$self->completeResponse;
|
||||||
}
|
}
|
||||||
my $ipAddress = $self->getIp;
|
my $ipAddress = $self->getIp;
|
||||||
|
|
@ -532,7 +532,7 @@ sub getSectionDrivenQuestionIds {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub getResponseId {
|
sub getResponseId {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $session{scratch}{$self->getResponseIdString};
|
return $self->session->scratch->get("$self->getResponseIdString");
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -1161,31 +1161,31 @@ sub www_respond {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return "" unless ($self->session->user->isInGroup($self->get("groupToTakeSurvey")));
|
return "" unless ($self->session->user->isInGroup($self->get("groupToTakeSurvey")));
|
||||||
my $varname = $self->getResponseIdString;
|
my $varname = $self->getResponseIdString;
|
||||||
return "" unless ($session{scratch}{$varname});
|
return "" unless ($self->session->scratch->get("$varname"));
|
||||||
my $userId = ($self->get("anonymous")) ? substr(md5_hex($self->session->user->profileField("userId")),0,8) : $self->session->user->profileField("userId");
|
my $userId = ($self->get("anonymous")) ? substr(md5_hex($self->session->user->profileField("userId")),0,8) : $self->session->user->profileField("userId");
|
||||||
my $terminate = 0;
|
my $terminate = 0;
|
||||||
foreach my $key (keys %{$session{form}}) {
|
foreach my $key (keys %{$session{form}}) {
|
||||||
if ($key =~ /^answerId_(.+)$/) {
|
if ($key =~ /^answerId_(.+)$/) {
|
||||||
my $id = $1;
|
my $id = $1;
|
||||||
my ($previousResponse) = $self->session->db->quickArray("select count(*) from Survey_questionResponse
|
my ($previousResponse) = $self->session->db->quickArray("select count(*) from Survey_questionResponse
|
||||||
where Survey_answerId=".$self->session->db->quote($session{form}{"answerId_".$id})." and Survey_responseId=".$self->session->db->quote($session{scratch}{$varname}));
|
where Survey_answerId=".$self->session->db->quote($self->session->form->process(""answerId_".$id"))." and Survey_responseId=".$self->session->db->quote($self->session->scratch->get("$varname")));
|
||||||
next if ($previousResponse);
|
next if ($previousResponse);
|
||||||
my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$session{form}{"answerId_".$id});
|
my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$self->session->form->process(""answerId_".$id"));
|
||||||
if ($self->get("questionOrder") eq "response" && $answer->{gotoQuestion} eq "") {
|
if ($self->get("questionOrder") eq "response" && $answer->{gotoQuestion} eq "") {
|
||||||
$terminate = 1;
|
$terminate = 1;
|
||||||
}
|
}
|
||||||
my $response = $session{form}{"textResponse_".$id} || $answer->{answer};
|
my $response = $self->session->form->process(""textResponse_".$id} || $answer->{answer");
|
||||||
$self->session->db->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values (
|
$self->session->db->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values (
|
||||||
".$self->session->db->quote($answer->{Survey_answerId}).", ".$self->session->db->quote($answer->{Survey_questionId}).", ".$self->session->db->quote($session{scratch}{$varname}).", ".$self->session->db->quote($answer->{Survey_id}).",
|
".$self->session->db->quote($answer->{Survey_answerId}).", ".$self->session->db->quote($answer->{Survey_questionId}).", ".$self->session->db->quote($self->session->scratch->get("$varname}).", ".$self->session->db->quote($answer->{Survey_id")).",
|
||||||
".$self->session->db->quote($session{form}{"comment_".$id}).", ".$self->session->db->quote($response).", ".$self->session->datetime->time().")");
|
".$self->session->db->quote($self->session->form->process(""comment_".$id")).", ".$self->session->db->quote($response).", ".$self->session->datetime->time().")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $responseCount = $self->getQuestionResponseCount($session{scratch}{$varname});
|
my $responseCount = $self->getQuestionResponseCount($self->session->scratch->get("$varname"));
|
||||||
if ($terminate || $responseCount >= $self->getValue("questionsPerResponse") || $responseCount >= $self->getQuestionCount) {
|
if ($terminate || $responseCount >= $self->getValue("questionsPerResponse") || $responseCount >= $self->getQuestionCount) {
|
||||||
$self->session->db->setRow("Survey_response","Survey_responseId",{
|
$self->session->db->setRow("Survey_response","Survey_responseId",{
|
||||||
isComplete=>1,
|
isComplete=>1,
|
||||||
endDate=>$self->session->datetime->time(),
|
endDate=>$self->session->datetime->time(),
|
||||||
Survey_responseId=>$session{scratch}{$varname}
|
Survey_responseId=>$self->session->scratch->get("$varname")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||||
|
|
@ -1212,7 +1212,7 @@ sub www_viewGradebook {
|
||||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||||
my $var = $self->getMenuVars;
|
my $var = $self->getMenuVars;
|
||||||
$var->{title} = WebGUI::International::get(71,'Asset_Survey');
|
$var->{title} = WebGUI::International::get(71,'Asset_Survey');
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl('func=viewGradebook'));
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewGradebook'));
|
||||||
$p->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate from Survey_response
|
$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");
|
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by username,ipAddress,startDate");
|
||||||
my $users = $p->getPageData;
|
my $users = $p->getPageData;
|
||||||
|
|
@ -1308,7 +1308,7 @@ sub www_viewStatisticalOverview {
|
||||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||||
my $var = $self->getMenuVars;
|
my $var = $self->getMenuVars;
|
||||||
$var->{title} = WebGUI::International::get(58,'Asset_Survey');
|
$var->{title} = WebGUI::International::get(58,'Asset_Survey');
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl('func=viewStatisticalOverview'));
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewStatisticalOverview'));
|
||||||
$p->setDataByQuery("select Survey_questionId,question,answerFieldType,allowComment from Survey_question
|
$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");
|
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||||
my $questions = $p->getPageData;
|
my $questions = $p->getPageData;
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ sub view {
|
||||||
# this case hasn't ever happened running against my dev SOAP::Lite
|
# this case hasn't ever happened running against my dev SOAP::Lite
|
||||||
# services, but let's assume it might. If our results array has
|
# services, but let's assume it might. If our results array has
|
||||||
# more than one element, let's hope if contains scalars
|
# more than one element, let's hope if contains scalars
|
||||||
$p = WebGUI::Paginator->new($url, $self->get('paginateAfter'));
|
$p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter'));
|
||||||
$p->setDataByArrayRef(\@result);
|
$p->setDataByArrayRef(\@result);
|
||||||
@result = ();
|
@result = ();
|
||||||
@result = @$p;
|
@result = @$p;
|
||||||
|
|
@ -431,7 +431,7 @@ sub view {
|
||||||
if (my $aref = $result[0]->{$self->get('paginateVar')}) {
|
if (my $aref = $result[0]->{$self->get('paginateVar')}) {
|
||||||
|
|
||||||
$var{'numResults'} = scalar @$aref;
|
$var{'numResults'} = scalar @$aref;
|
||||||
$p = WebGUI::Paginator->new($url, $self->get('paginateAfter'));
|
$p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter'));
|
||||||
$p->setDataByArrayRef($aref);
|
$p->setDataByArrayRef($aref);
|
||||||
$result[0]->{$self->get('paginateVar')} = $p->getPageData;
|
$result[0]->{$self->get('paginateVar')} = $p->getPageData;
|
||||||
|
|
||||||
|
|
@ -443,21 +443,21 @@ sub view {
|
||||||
# prevent the wobject from dying
|
# prevent the wobject from dying
|
||||||
for (keys %{$result[0]}) {
|
for (keys %{$result[0]}) {
|
||||||
if ((ref $result[0]->{$_}) =~ /ARRAY/) {
|
if ((ref $result[0]->{$_}) =~ /ARRAY/) {
|
||||||
$p = WebGUI::Paginator->new($url, $self->get('paginateAfter'));
|
$p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter'));
|
||||||
$p->setDataByArrayRef($result[0]->{$_});
|
$p->setDataByArrayRef($result[0]->{$_});
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$p ||= WebGUI::Paginator->new($url);
|
$p ||= WebGUI::Paginator->new($self->session,$url);
|
||||||
$result[0]->{$_} = $p->getPageData;
|
$result[0]->{$_} = $p->getPageData;
|
||||||
|
|
||||||
} elsif ((ref $result[0]) =~ /ARRAY/) {
|
} elsif ((ref $result[0]) =~ /ARRAY/) {
|
||||||
$p = WebGUI::Paginator->new($url, $self->get('paginateAfter'));
|
$p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter'));
|
||||||
$p->setDataByArrayRef($result[0]);
|
$p->setDataByArrayRef($result[0]);
|
||||||
$result[0] = $p->getPageData;
|
$result[0] = $p->getPageData;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$p = WebGUI::Paginator->new($url, $self->get('paginateAfter'));
|
$p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter'));
|
||||||
$p->setDataByArrayRef([$result[0]]);
|
$p->setDataByArrayRef([$result[0]]);
|
||||||
$result[0] = $p->getPageData;
|
$result[0] = $p->getPageData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ sub www_editBranchSave {
|
||||||
if ($form =~ /^metadata_(.*)$/) {
|
if ($form =~ /^metadata_(.*)$/) {
|
||||||
my $fieldName = $1;
|
my $fieldName = $1;
|
||||||
if ($self->session->form->yesNo("change_metadata_".$fieldName)) {
|
if ($self->session->form->yesNo("change_metadata_".$fieldName)) {
|
||||||
$newRevision->updateMetaData($fieldName,$session{form}{$form});
|
$newRevision->updateMetaData($fieldName,$self->session->form->process("$form"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ sub www_manageRevisionsInTag {
|
||||||
$ac->addSubmenuItem($self->getUrl('func=manageVersions'), $i18n->get("manage versions"));
|
$ac->addSubmenuItem($self->getUrl('func=manageVersions'), $i18n->get("manage versions"));
|
||||||
my $output = '<table width=100% class="content">
|
my $output = '<table width=100% class="content">
|
||||||
<tr><th></th><th>Title</th><th>Type</th><th>Revision Date</th><th>Revised By</th></tr> ';
|
<tr><th></th><th>Title</th><th>Type</th><th>Revision Date</th><th>Revised By</th></tr> ';
|
||||||
my $p = WebGUI::Paginator->new($self->getUrl("func=manageRevisionsInTag;tagId=".$self->session->form->process("tagId")));
|
my $p = WebGUI::Paginator->new($self->session,$self->getUrl("func=manageRevisionsInTag;tagId=".$self->session->form->process("tagId")));
|
||||||
$p->setDataByQuery("select assetData.revisionDate, users.username, asset.assetId, asset.className from assetData
|
$p->setDataByQuery("select assetData.revisionDate, users.username, asset.assetId, asset.className from assetData
|
||||||
left join asset on assetData.assetId=asset.assetId left join users on assetData.revisedBy=users.userId
|
left join asset on assetData.assetId=asset.assetId left join users on assetData.revisedBy=users.userId
|
||||||
where assetData.tagId=".$self->session->db->quote($self->session->form->process("tagId")));
|
where assetData.tagId=".$self->session->db->quote($self->session->form->process("tagId")));
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ sub _isValidLDAPUser {
|
||||||
$auth = $ldap->bind;
|
$auth = $ldap->bind;
|
||||||
}
|
}
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$search = $ldap->search ( base=>$uri->dn, filter=>$connection->{ldapIdentity}."=".$session{form}{'authLDAP_ldapId'});
|
$search = $ldap->search ( base=>$uri->dn, filter=>$connection->{ldapIdentity}."=".$self->session->form->process("'authLDAP_ldapId'"));
|
||||||
if (defined $search->entry(0)) {
|
if (defined $search->entry(0)) {
|
||||||
if ($connection->{ldapUserRDN} eq 'dn') {
|
if ($connection->{ldapUserRDN} eq 'dn') {
|
||||||
$connectDN = $search->entry(0)->dn;
|
$connectDN = $search->entry(0)->dn;
|
||||||
|
|
@ -56,10 +56,10 @@ sub _isValidLDAPUser {
|
||||||
}
|
}
|
||||||
$ldap->unbind;
|
$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 .= WebGUI::International::get(2,'AuthLDAP');
|
||||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{'authLDAP_identifier'});
|
$auth = $ldap->bind(dn=>$connectDN, password=>$self->session->form->process("'authLDAP_identifier'"));
|
||||||
if ($auth->code == 48 || $auth->code == 49) {
|
if ($auth->code == 48 || $auth->code == 49) {
|
||||||
$error .= '<li>'.WebGUI::International::get(68).'</li>';
|
$error .= '<li>'.WebGUI::International::get(68).'</li>';
|
||||||
$self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{'authLDAP_ldapId'});
|
$self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$self->session->form->process("'authLDAP_ldapId'"));
|
||||||
} elsif ($auth->code > 0) {
|
} elsif ($auth->code > 0) {
|
||||||
$error .= '<li>LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69).'</li>';
|
$error .= '<li>LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69).'</li>';
|
||||||
$self->session->errorHandler->error("LDAP error: ".$ldapStatusCode{$auth->code});
|
$self->session->errorHandler->error("LDAP error: ".$ldapStatusCode{$auth->code});
|
||||||
|
|
@ -67,7 +67,7 @@ sub _isValidLDAPUser {
|
||||||
$ldap->unbind;
|
$ldap->unbind;
|
||||||
} else {
|
} else {
|
||||||
$error .= '<li>'.WebGUI::International::get(68).'</li>';
|
$error .= '<li>'.WebGUI::International::get(68).'</li>';
|
||||||
$self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{'authLDAP_ldapId'});
|
$self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$self->session->form->process("'authLDAP_ldapId'"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error = WebGUI::International::get(2,'AuthLDAP');
|
$error = WebGUI::International::get(2,'AuthLDAP');
|
||||||
|
|
@ -92,9 +92,9 @@ sub addUserForm {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $userData = $self->getParams;
|
my $userData = $self->getParams;
|
||||||
my $connection = $self->{_connection};
|
my $connection = $self->{_connection};
|
||||||
my $ldapUrl = $session{form}{'authLDAP_ldapUrl'} || $userData->{ldapUrl} || $connection->{ldapURL};
|
my $ldapUrl = $self->session->form->process("'authLDAP_ldapUrl'} || $userData->{ldapUrl} || $connection->{ldapURL");
|
||||||
my $connectDN = $session{form}{'authLDAP_connectDN'} || $userData->{connectDN};
|
my $connectDN = $self->session->form->process("'authLDAP_connectDN'} || $userData->{connectDN");
|
||||||
my $ldapConnection = $session{form}{'authLDAP_ldapConnection'} || $userData->{ldapConnection};
|
my $ldapConnection = $self->session->form->process("'authLDAP_ldapConnection'} || $userData->{ldapConnection");
|
||||||
my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink");
|
my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink");
|
||||||
my $f = WebGUI::HTMLForm->new($self->session);
|
my $f = WebGUI::HTMLForm->new($self->session);
|
||||||
my $jscript = "";
|
my $jscript = "";
|
||||||
|
|
@ -146,9 +146,9 @@ sub addUserForm {
|
||||||
sub addUserFormSave {
|
sub addUserFormSave {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $properties;
|
my $properties;
|
||||||
$properties->{connectDN} = $session{form}{'authLDAP_connectDN'};
|
$properties->{connectDN} = $self->session->form->process("'authLDAP_connectDN'");
|
||||||
$properties->{ldapUrl} = $session{form}{'authLDAP_ldapUrl'};
|
$properties->{ldapUrl} = $self->session->form->process("'authLDAP_ldapUrl'");
|
||||||
$properties->{ldapConnection} = $session{form}{'authLDAP_ldapConnection'};
|
$properties->{ldapConnection} = $self->session->form->process("'authLDAP_ldapConnection'");
|
||||||
$self->SUPER::addUserFormSave($properties);
|
$self->SUPER::addUserFormSave($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,9 +222,9 @@ sub createAccount {
|
||||||
value=>[$connection->{ldapLinkId}],
|
value=>[$connection->{ldapLinkId}],
|
||||||
extras=>qq|onchange="location.href='$url'+this.options[this.selectedIndex].value"|
|
extras=>qq|onchange="location.href='$url'+this.options[this.selectedIndex].value"|
|
||||||
});
|
});
|
||||||
$vars->{'create.form.ldapId'} = WebGUI::Form::text($self->session,{"name"=>"authLDAP_ldapId","value"=>$session{form}{"authLDAP_ldapId"}});
|
$vars->{'create.form.ldapId'} = WebGUI::Form::text($self->session,{"name"=>"authLDAP_ldapId","value"=>$self->session->form->process(""authLDAP_ldapId"}"));
|
||||||
$vars->{'create.form.ldapId.label'} = $connection->{ldapIdentityName};
|
$vars->{'create.form.ldapId.label'} = $connection->{ldapIdentityName};
|
||||||
$vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authLDAP_identifier","value"=>$session{form}{"authLDAP_identifier"}});
|
$vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authLDAP_identifier","value"=>$self->session->form->process(""authLDAP_identifier"}"));
|
||||||
$vars->{'create.form.password.label'} = $connection->{ldapPasswordName};
|
$vars->{'create.form.password.label'} = $connection->{ldapPasswordName};
|
||||||
|
|
||||||
$vars->{'create.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"confirm","value"=>$self->session->form->process("confirm")});
|
$vars->{'create.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"confirm","value"=>$self->session->form->process("confirm")});
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ sub createAccount {
|
||||||
.'<img src="'.$storage->getUrl($filename).'" border="0" alt="captcha" align="middle" />';
|
.'<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'} = WebGUI::International::get("captcha label","AuthWebGUI");
|
||||||
}
|
}
|
||||||
$vars->{'create.form.username'} = WebGUI::Form::text($self->session,{"name"=>"authWebGUI.username","value"=>$session{form}{"authWebGUI.username"}});
|
$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'} = WebGUI::International::get(50);
|
||||||
$vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifier"});
|
$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'} = WebGUI::International::get(51);
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,7 @@ http://www.plainblack.com info@plainblack.com
|
||||||
|
|
||||||
use Net::SMTP;
|
use Net::SMTP;
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::DateTime;
|
|
||||||
use WebGUI::ErrorHandler;
|
|
||||||
use WebGUI::Macro;
|
use WebGUI::Macro;
|
||||||
use WebGUI::Session;
|
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -75,60 +72,60 @@ The email address for the BCC line.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub send {
|
sub send {
|
||||||
my ($smtp, $message, $from);
|
# my ($smtp, $message, $from);
|
||||||
foreach my $option (\$_[0], \$_[1], \$_[3], \$_[4], \$_[5]) {
|
# foreach my $option (\$_[0], \$_[1], \$_[3], \$_[4], \$_[5]) {
|
||||||
if(${$option}) {
|
# if(${$option}) {
|
||||||
if (${$option} =~ /(?:From|To|Date|X-Mailer|Subject|Received|Message-Id)\s*:/is) {
|
# if (${$option} =~ /(?:From|To|Date|X-Mailer|Subject|Received|Message-Id)\s*:/is) {
|
||||||
use WebGUI::ErrorHandler;
|
# use WebGUI::ErrorHandler;
|
||||||
return $self->session->errorHandler->security("pass a malicious value to the mail header.");
|
# return $self->session->errorHandler->security("pass a malicious value to the mail header.");
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
$from = $_[4] || $self->session->setting->get("companyEmail");
|
# $from = $_[4] || $self->session->setting->get("companyEmail");
|
||||||
#header
|
# #header
|
||||||
my $to = $self->session->config->get("emailOverride") || $_[0];
|
# my $to = $self->session->config->get("emailOverride") || $_[0];
|
||||||
$message = "To: $to\n";
|
# $message = "To: $to\n";
|
||||||
$message .= "From: $from\n";
|
# $message .= "From: $from\n";
|
||||||
$message .= "CC: $_[3]\n" if ($_[3] && !$self->session->config->get("emailOverride"));
|
# $message .= "CC: $_[3]\n" if ($_[3] && !$self->session->config->get("emailOverride"));
|
||||||
$message .= "BCC: $_[5]\n" if ($_[5] && !$self->session->config->get("emailOverride"));
|
# $message .= "BCC: $_[5]\n" if ($_[5] && !$self->session->config->get("emailOverride"));
|
||||||
$message .= "Subject: ".$_[1]."\n";
|
# $message .= "Subject: ".$_[1]."\n";
|
||||||
$message .= "Date: ".$self->session->datetime->epochToHuman("","%W, %d %C %y %j:%n:%s %O")."\n";
|
# $message .= "Date: ".$self->session->datetime->epochToHuman("","%W, %d %C %y %j:%n:%s %O")."\n";
|
||||||
if (($_[2] =~ m/<html>/i) || ($_[2] =~ m/<a\sname=/i)) {
|
# if (($_[2] =~ m/<html>/i) || ($_[2] =~ m/<a\sname=/i)) {
|
||||||
$message .= "Content-Type: text/html; charset=UTF-8\n";
|
# $message .= "Content-Type: text/html; charset=UTF-8\n";
|
||||||
} else {
|
# } else {
|
||||||
$message .= "Content-Type: text/plain; charset=UTF-8\n";
|
# $message .= "Content-Type: text/plain; charset=UTF-8\n";
|
||||||
}
|
# }
|
||||||
$message .= "\n";
|
# $message .= "\n";
|
||||||
WebGUI::Macro::process($self->session,\$message);
|
# WebGUI::Macro::process($self->session,\$message);
|
||||||
#body
|
#body
|
||||||
$message .= $_[2]."\n";
|
# $message .= $_[2]."\n";
|
||||||
#footer
|
#footer
|
||||||
my $footer = "\n".$self->session->setting->get("mailFooter");
|
# my $footer = "\n".$self->session->setting->get("mailFooter");
|
||||||
WebGUI::Macro::process($self->session,\$footer);
|
# WebGUI::Macro::process($self->session,\$footer);
|
||||||
$message .= $footer;
|
# $message .= $footer;
|
||||||
$message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n" if ($self->session->config->get("emailOverride"));
|
# $message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n" if ($self->session->config->get("emailOverride"));
|
||||||
if ($self->session->setting->get("smtpServer") =~ /\/sendmail/) {
|
# if ($self->session->setting->get("smtpServer") =~ /\/sendmail/) {
|
||||||
if (open(MAIL,"| $self->session->setting->get("smtpServer") -t -oi")) {
|
# if (open(MAIL,"| $self->session->setting->get("smtpServer") -t -oi")) {
|
||||||
print MAIL $message;
|
# print MAIL $message;
|
||||||
close(MAIL) or $self->session->errorHandler->warn("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer"));
|
# close(MAIL) or $self->session->errorHandler->warn("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer"));
|
||||||
} else {
|
# } else {
|
||||||
$self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
# $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
||||||
}
|
# }
|
||||||
} else {
|
# } else {
|
||||||
$smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server
|
# $smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server
|
||||||
if (defined $smtp) {
|
# if (defined $smtp) {
|
||||||
$smtp->mail($from); # use the sender's address here
|
# $smtp->mail($from); # use the sender's address here
|
||||||
$smtp->to($to); # recipient's address
|
# $smtp->to($to); # recipient's address
|
||||||
$smtp->cc($_[3]) if ($_[3] && !$self->session->config->get("emailOverride"));
|
# $smtp->cc($_[3]) if ($_[3] && !$self->session->config->get("emailOverride"));
|
||||||
$smtp->bcc($_[5]) if ($_[5] && !$self->session->config->get("emailOverride"));
|
# $smtp->bcc($_[5]) if ($_[5] && !$self->session->config->get("emailOverride"));
|
||||||
$smtp->data(); # Start the mail
|
# $smtp->data(); # Start the mail
|
||||||
$smtp->datasend($message);
|
# $smtp->datasend($message);
|
||||||
$smtp->dataend(); # Finish sending the mail
|
# $smtp->dataend(); # Finish sending the mail
|
||||||
$smtp->quit; # Close the SMTP connection
|
# $smtp->quit; # Close the SMTP connection
|
||||||
} else {
|
# } else {
|
||||||
$self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
# $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,8 @@ package WebGUI::MessageLog;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Tie::CPHash;
|
use Tie::CPHash;
|
||||||
use WebGUI::DateTime;
|
|
||||||
use WebGUI::Id;
|
|
||||||
use WebGUI::International;
|
|
||||||
use WebGUI::Macro;
|
use WebGUI::Macro;
|
||||||
use WebGUI::Mail;
|
use WebGUI::Mail;
|
||||||
use WebGUI::Session;
|
|
||||||
use WebGUI::SQL;
|
|
||||||
use WebGUI::URL;
|
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
|
||||||
|
|
@ -114,37 +108,37 @@ The addressee email address. Defaults to company email.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub addEntry {
|
sub addEntry {
|
||||||
my ($u, @users, $messageLogId, $sth, $userId, $groupId, $subject, $message, $url, $status, $user, $from);
|
# my ($u, @users, $messageLogId, $sth, $userId, $groupId, $subject, $message, $url, $status, $user, $from);
|
||||||
$messageLogId = $self->session->id->generate();
|
# $messageLogId = $self->session->id->generate();
|
||||||
$userId = $_[0];
|
# $userId = $_[0];
|
||||||
$groupId = $_[1];
|
# $groupId = $_[1];
|
||||||
$subject = $_[2];
|
# $subject = $_[2];
|
||||||
$message = $_[3];
|
# $message = $_[3];
|
||||||
$url = $_[4];
|
# $url = $_[4];
|
||||||
if ($url && !$url =~ /^http/) {
|
# if ($url && !$url =~ /^http/) {
|
||||||
$url = $self->session->url->getSiteURL().$url;
|
# $url = $self->session->url->getSiteURL().$url;
|
||||||
}
|
# }
|
||||||
if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
# if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
||||||
$url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
# $url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
||||||
}
|
# }
|
||||||
$status = $_[5];
|
# $status = $_[5];
|
||||||
$from = $_[6];
|
# $from = $_[6];
|
||||||
if ($groupId ne "") {
|
# if ($groupId ne "") {
|
||||||
@users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId));
|
# @users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId));
|
||||||
}
|
# }
|
||||||
@users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users));
|
# @users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users));
|
||||||
foreach $user (@users) {
|
# foreach $user (@users) {
|
||||||
$u = WebGUI::User->new($user);
|
# $u = WebGUI::User->new($user);
|
||||||
if ($u->userId ne "") {
|
# if ($u->userId ne "") {
|
||||||
$self->session->db->write("insert into messageLog (messageLogId, userId, message, url, dateOfEntry,
|
# $self->session->db->write("insert into messageLog (messageLogId, userId, message, url, dateOfEntry,
|
||||||
subject, status) values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).",
|
# subject, status) values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).",
|
||||||
".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($subject).", ".$self->session->db->quote($status).")");
|
# ".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($subject).", ".$self->session->db->quote($status).")");
|
||||||
if ($url ne "") {
|
# if ($url ne "") {
|
||||||
$message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
# $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
||||||
}
|
# }
|
||||||
_notify($u,$subject,$message,$from);
|
# _notify($u,$subject,$message,$from);
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -184,45 +178,45 @@ Defaults to 'notice'. Can be 'pending', 'notice', or 'completed'.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub addInternationalizedEntry {
|
sub addInternationalizedEntry {
|
||||||
my ($u, $userId, $url, $groupId, $internationalId, @users, $messageLogId,$sth, $user, %message, %subject, $message, $subject, $namespace, $status);
|
# my ($u, $userId, $url, $groupId, $internationalId, @users, $messageLogId,$sth, $user, %message, %subject, $message, $subject, $namespace, $status);
|
||||||
$messageLogId = $self->session->id->generate();
|
# $messageLogId = $self->session->id->generate();
|
||||||
$userId = $_[0];
|
# $userId = $_[0];
|
||||||
$groupId = $_[1];
|
# $groupId = $_[1];
|
||||||
$url = $_[2];
|
# $url = $_[2];
|
||||||
if ($url && !$url =~ /^http/) {
|
# if ($url && !$url =~ /^http/) {
|
||||||
$url = $self->session->url->getSiteURL().$url;
|
# $url = $self->session->url->getSiteURL().$url;
|
||||||
}
|
# }
|
||||||
if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
# if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
||||||
$url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
# $url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
||||||
}
|
# }
|
||||||
$internationalId = $_[3];
|
# $internationalId = $_[3];
|
||||||
$namespace = $_[4] || "WebGUI";
|
# $namespace = $_[4] || "WebGUI";
|
||||||
$status = $_[5] || 'notice';
|
# $status = $_[5] || 'notice';
|
||||||
my $languages = WebGUI::International::getLanguages();
|
# my $languages = WebGUI::International::getLanguages();
|
||||||
foreach my $language (keys %{$languages}) {
|
# foreach my $language (keys %{$languages}) {
|
||||||
$message{$language} = WebGUI::International::get($internationalId,$namespace,$language);
|
# $message{$language} = WebGUI::International::get($internationalId,$namespace,$language);
|
||||||
$subject{$language} = WebGUI::International::get(523,"WebGUI",$language);
|
# $subject{$language} = WebGUI::International::get(523,"WebGUI",$language);
|
||||||
}
|
# }
|
||||||
if ($groupId ne "") {
|
# if ($groupId ne "") {
|
||||||
@users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId));
|
# @users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId));
|
||||||
}
|
# }
|
||||||
@users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users));
|
# @users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users));
|
||||||
foreach $user (@users) {
|
# foreach $user (@users) {
|
||||||
$u = WebGUI::User->new($user);
|
# $u = WebGUI::User->new($user);
|
||||||
if ($u->userId ne "") {
|
# if ($u->userId ne "") {
|
||||||
$subject{$u->profileField("language")} = $subject{1} if ($subject{$u->profileField("language")} eq "");
|
# $subject{$u->profileField("language")} = $subject{1} if ($subject{$u->profileField("language")} eq "");
|
||||||
$subject = $subject{$u->profileField("language")};
|
# $subject = $subject{$u->profileField("language")};
|
||||||
$message{$u->profileField("language")} = $message{1} if ($message{$u->profileField("language")} eq "");
|
# $message{$u->profileField("language")} = $message{1} if ($message{$u->profileField("language")} eq "");
|
||||||
$message = $message{$u->profileField("language")};
|
# $message = $message{$u->profileField("language")};
|
||||||
WebGUI::Macro::process($self->session,\$message);
|
# WebGUI::Macro::process($self->session,\$message);
|
||||||
$self->session->db->write("insert into messageLog values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).",
|
# $self->session->db->write("insert into messageLog values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).",
|
||||||
".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($message).",".$self->session->db->quote($status).")");
|
# ".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($message).",".$self->session->db->quote($status).")");
|
||||||
if ($url ne "") {
|
# if ($url ne "") {
|
||||||
$message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
# $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
||||||
}
|
# }
|
||||||
_notify($u,$subject,$message);
|
# _notify($u,$subject,$message);
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -238,7 +232,7 @@ The id of the message to complete.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub completeEntry {
|
sub completeEntry {
|
||||||
$self->session->db->write("update messageLog set status='completed', dateOfEntry="$self->session->datetime->time()." where messageLogId=".$self->session->db->quote($_[0]));
|
# $self->session->db->write("update messageLog set status='completed', dateOfEntry="$self->session->datetime->time()." where messageLogId=".$self->session->db->quote($_[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ sub www_viewActiveSessions {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=viewActiveSessions'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions'));
|
||||||
$p->setDataByArrayRef(\@row);
|
$p->setDataByArrayRef(\@row);
|
||||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||||
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
||||||
|
|
|
||||||
|
|
@ -527,10 +527,10 @@ sub www_editCommerceSettingsSave {
|
||||||
type => $1,
|
type => $1,
|
||||||
namespace => $2,
|
namespace => $2,
|
||||||
fieldName => $3,
|
fieldName => $3,
|
||||||
fieldValue => $session{form}{$_}
|
fieldValue => $session->form->process("$_")
|
||||||
});
|
});
|
||||||
} elsif ($_ ne 'op') {
|
} elsif ($_ ne 'op') {
|
||||||
WebGUI::Setting::set($_,$session{form}{$_});
|
WebGUI::Setting::set($_,$session->form->process("$_"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +545,7 @@ sub www_listPendingTransactions {
|
||||||
|
|
||||||
$i18n = WebGUI::International->new("Commerce");
|
$i18n = WebGUI::International->new("Commerce");
|
||||||
|
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=listPendingTransactions'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=listPendingTransactions'));
|
||||||
$p->setDataByArrayRef(WebGUI::Commerce::Transaction->pendingTransactions);
|
$p->setDataByArrayRef(WebGUI::Commerce::Transaction->pendingTransactions);
|
||||||
|
|
||||||
$transactions = $p->getPageData;
|
$transactions = $p->getPageData;
|
||||||
|
|
@ -776,7 +776,7 @@ my $shoppingCart = WebGUI::Commerce::ShoppingCart->new;
|
||||||
|
|
||||||
foreach my $formElement (keys(%{$session{form}})) {
|
foreach my $formElement (keys(%{$session{form}})) {
|
||||||
if ($formElement =~ m/^quantity~([^~]*)~([^~]*)$/) {
|
if ($formElement =~ m/^quantity~([^~]*)~([^~]*)$/) {
|
||||||
$shoppingCart->setQuantity($2, $1, $session{form}{$formElement});
|
$shoppingCart->setQuantity($2, $1, $session->form->process("$formElement"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ sub doGroupSearch {
|
||||||
my $sql = "select groupId,groupName,description from groups where isEditable=1 and (groupName like $keyword or description like $keyword)
|
my $sql = "select groupId,groupName,description from groups where isEditable=1 and (groupName like $keyword or description like $keyword)
|
||||||
and groupId not in (".$session->db->quoteAndJoin($groupFilter).") order by groupName";
|
and groupId not in (".$session->db->quoteAndJoin($groupFilter).") order by groupName";
|
||||||
if ($returnPaginator) {
|
if ($returnPaginator) {
|
||||||
my $p = WebGUI::Paginator->new($session->url->page($op));
|
my $p = WebGUI::Paginator->new($session,$session->url->page($op));
|
||||||
$p->setDataByQuery($sql);
|
$p->setDataByQuery($sql);
|
||||||
return $p;
|
return $p;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -579,7 +579,7 @@ sub www_listGroups {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=listGroups'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=listGroups'));
|
||||||
$p->setDataByArrayRef(\@row);
|
$p->setDataByArrayRef(\@row);
|
||||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
|
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
|
||||||
|
|
@ -642,7 +642,7 @@ sub www_manageUsersInGroup {
|
||||||
.WebGUI::Icon::_getBaseURL().'delete.gif" border="0"></td>
|
.WebGUI::Icon::_getBaseURL().'delete.gif" border="0"></td>
|
||||||
<td class="tableHeader">'.WebGUI::International::get(50).'</td>
|
<td class="tableHeader">'.WebGUI::International::get(50).'</td>
|
||||||
<td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
<td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||||
my $p = WebGUI::Paginator->new($session->url->page("op=manageUsersInGroup;gid=".$session->form->process("gid")));
|
my $p = WebGUI::Paginator->new($session,$session->url->page("op=manageUsersInGroup;gid=".$session->form->process("gid")));
|
||||||
$p->setDataByQuery("select users.username,users.userId,groupings.expireDate
|
$p->setDataByQuery("select users.username,users.userId,groupings.expireDate
|
||||||
from groupings,users where groupings.groupId=".$session->db->quote($session->form->process("gid"))." and groupings.userId=users.userId
|
from groupings,users where groupings.groupId=".$session->db->quote($session->form->process("gid"))." and groupings.userId=users.userId
|
||||||
order by users.username");
|
order by users.username");
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ sub www_listLDAPLinks {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=listLDAPLinks'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=listLDAPLinks'));
|
||||||
$p->setDataByArrayRef(\@row);
|
$p->setDataByArrayRef(\@row);
|
||||||
$output .= '<table border="1" cellpadding="3" cellspacing="0" align="center">';
|
$output .= '<table border="1" cellpadding="3" cellspacing="0" align="center">';
|
||||||
$output .= $p->getPage;
|
$output .= $p->getPage;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ sub www_viewLoginHistory {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=viewLoginHistory'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=viewLoginHistory'));
|
||||||
$p->setDataByArrayRef(\@row);
|
$p->setDataByArrayRef(\@row);
|
||||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||||
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ sub www_viewMessageLog {
|
||||||
my (@msg, $vars);
|
my (@msg, $vars);
|
||||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2,$session->user->profileField("userId")));
|
return $session->privilege->insufficient() unless ($session->user->isInGroup(2,$session->user->profileField("userId")));
|
||||||
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(159).'</h1>';
|
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(159).'</h1>';
|
||||||
my $p = WebGUI::Paginator->new($session->url->page('op=viewMessageLog'));
|
my $p = WebGUI::Paginator->new($session,$session->url->page('op=viewMessageLog'));
|
||||||
my $query = "select messageLogId,subject,url,dateOfEntry,status from messageLog where userId=".$session->db->quote($session->user->profileField("userId"))." order by dateOfEntry desc";
|
my $query = "select messageLogId,subject,url,dateOfEntry,status from messageLog where userId=".$session->db->quote($session->user->profileField("userId"))." order by dateOfEntry desc";
|
||||||
$p->setDataByQuery($query);
|
$p->setDataByQuery($query);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ sub www_saveSettings {
|
||||||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||||
my ($key, $value);
|
my ($key, $value);
|
||||||
foreach $key (keys %{$session{form}}) {
|
foreach $key (keys %{$session{form}}) {
|
||||||
$value = $session{form}{$key};
|
$value = $session->form->process("$key");
|
||||||
if ($key =~ m/(.*)_interval/) {
|
if ($key =~ m/(.*)_interval/) {
|
||||||
$value = $session->form->interval($1);
|
$value = $session->form->interval($1);
|
||||||
$key = $1;
|
$key = $1;
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ sub www_editSubscriptionSave {
|
||||||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||||
|
|
||||||
@relevantFields = qw(subscriptionId name price description subscriptionGroup duration executeOnSubscription karma);
|
@relevantFields = qw(subscriptionId name price description subscriptionGroup duration executeOnSubscription karma);
|
||||||
WebGUI::Subscription->new($session->form->process("sid"))->set({map {$_ => $session{form}{$_}} @relevantFields});
|
WebGUI::Subscription->new($session->form->process("sid"))->set({map {$_ => $session->form->process("$_}} @relevantFields"));
|
||||||
|
|
||||||
return www_listSubscriptions();
|
return www_listSubscriptions();
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +284,7 @@ sub www_listSubscriptionCodeBatches {
|
||||||
|
|
||||||
my $i18n = WebGUI::International->new("Subscription");
|
my $i18n = WebGUI::International->new("Subscription");
|
||||||
|
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=listSubscriptionCodeBatches'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=listSubscriptionCodeBatches'));
|
||||||
$p->setDataByQuery("select * from subscriptionCodeBatch");
|
$p->setDataByQuery("select * from subscriptionCodeBatch");
|
||||||
|
|
||||||
$batches = $p->getPageData;
|
$batches = $p->getPageData;
|
||||||
|
|
@ -359,7 +359,7 @@ sub www_listSubscriptionCodes {
|
||||||
return _submenu($output, 'listSubscriptionCodes title', 'subscription codes manage');
|
return _submenu($output, 'listSubscriptionCodes title', 'subscription codes manage');
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=listSubscriptionCodes'.$ops));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=listSubscriptionCodes'.$ops));
|
||||||
$p->setDataByQuery("select t1.*, t2.* from subscriptionCode as t1, subscriptionCodeBatch as t2 where t1.batchId=t2.batchId ".$where);
|
$p->setDataByQuery("select t1.*, t2.* from subscriptionCode as t1, subscriptionCodeBatch as t2 where t1.batchId=t2.batchId ".$where);
|
||||||
|
|
||||||
$codes = $p->getPageData;
|
$codes = $p->getPageData;
|
||||||
|
|
@ -396,7 +396,7 @@ sub www_listSubscriptions {
|
||||||
|
|
||||||
my $i18n = WebGUI::International->new("Subscription");
|
my $i18n = WebGUI::International->new("Subscription");
|
||||||
|
|
||||||
$p = WebGUI::Paginator->new($session->url->page('op=listSubscriptions'));
|
$p = WebGUI::Paginator->new($session,$session->url->page('op=listSubscriptions'));
|
||||||
$p->setDataByQuery('select subscriptionId, name from subscription where deleted != 1');
|
$p->setDataByQuery('select subscriptionId, name from subscription where deleted != 1');
|
||||||
$subscriptions = $p->getPageData;
|
$subscriptions = $p->getPageData;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ sub doUserSearch {
|
||||||
where $selectedStatus and (users.username like ".$keyword." or useralias.fieldData like ".$keyword." or email.fieldData like ".$keyword.")
|
where $selectedStatus and (users.username like ".$keyword." or useralias.fieldData like ".$keyword." or email.fieldData like ".$keyword.")
|
||||||
and users.userId not in (".$session->db->quoteAndJoin($userFilter).") order by users.username";
|
and users.userId not in (".$session->db->quoteAndJoin($userFilter).") order by users.username";
|
||||||
if ($returnPaginator) {
|
if ($returnPaginator) {
|
||||||
my $p = WebGUI::Paginator->new($session->url->page("op=".$op));
|
my $p = WebGUI::Paginator->new($session,$session->url->page("op=".$op));
|
||||||
$p->setDataByQuery($sql);
|
$p->setDataByQuery($sql);
|
||||||
return $p;
|
return $p;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ Package that paginates rows of arbitrary data for display on the web.
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
use WebGUI::Paginator;
|
use WebGUI::Paginator;
|
||||||
$p = WebGUI::Paginator->new("/index.pl/page_name?this=that");
|
$p = WebGUI::Paginator->new($self->session,"/index.pl/page_name?this=that");
|
||||||
$p->setDataByArrayRef(\@array);
|
$p->setDataByArrayRef(\@array);
|
||||||
$p->setDataByQuery($sql);
|
$p->setDataByQuery($sql);
|
||||||
|
|
||||||
|
|
@ -421,10 +421,14 @@ sub getRowCount {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 new ( currentURL [, paginateAfter, pageNumber, formVar ] )
|
=head2 new ( session, currentURL [, paginateAfter, pageNumber, formVar ] )
|
||||||
|
|
||||||
Constructor.
|
Constructor.
|
||||||
|
|
||||||
|
=head3 session
|
||||||
|
|
||||||
|
A reference to the current session.
|
||||||
|
|
||||||
=head3 currentURL
|
=head3 currentURL
|
||||||
|
|
||||||
The URL of the current page including attributes. The page number will be appended to this in all links generated by the paginator.
|
The URL of the current page including attributes. The page number will be appended to this in all links generated by the paginator.
|
||||||
|
|
@ -445,13 +449,28 @@ Specify the form variable the paginator should use in it's links. Defaults to "
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
|
my $session = shift;
|
||||||
my $currentURL = shift;
|
my $currentURL = shift;
|
||||||
my $rowsPerPage = shift || 25;
|
my $rowsPerPage = shift || 25;
|
||||||
my $formVar = shift || "pn";
|
my $formVar = shift || "pn";
|
||||||
my $pn = shift || $session{form}{$formVar} || 1;
|
my $pn = shift || $session->form->process($formVar) || 1;
|
||||||
bless {_url => $currentURL, _rpp => $rowsPerPage, _formVar => $formVar, _pn => $pn}, $class;
|
bless {_session=>$session, _url => $currentURL, _rpp => $rowsPerPage, _formVar => $formVar, _pn => $pn}, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 session ( )
|
||||||
|
|
||||||
|
Returns a reference to the current session.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub session {
|
||||||
|
my $self = shift;
|
||||||
|
$self->{_session};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 setDataByArrayRef ( arrayRef )
|
=head2 setDataByArrayRef ( arrayRef )
|
||||||
|
|
@ -486,7 +505,7 @@ An SQL query that will retrieve a data set.
|
||||||
|
|
||||||
=head3 dbh
|
=head3 dbh
|
||||||
|
|
||||||
A DBI-style database handler. Defaults to the WebGUI site handler.
|
A WebGUI::SQL database handler. Defaults to the WebGUI site handler.
|
||||||
|
|
||||||
=head3 unconditional
|
=head3 unconditional
|
||||||
|
|
||||||
|
|
@ -511,10 +530,10 @@ sub setDataByQuery {
|
||||||
my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_;
|
my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_;
|
||||||
$dbh ||= $self->session->db->getSlave;
|
$dbh ||= $self->session->db->getSlave;
|
||||||
if ($unconditional) {
|
if ($unconditional) {
|
||||||
$sth = $self->session->db->unconditionalRead($sql,$dbh,$placeholders);
|
$sth = $dbh->unconditionalRead($sql,$placeholders);
|
||||||
return $sth->errorMessage if ($sth->errorCode > 0);
|
return $sth->errorMessage if ($sth->errorCode > 0);
|
||||||
} else {
|
} else {
|
||||||
$sth = $self->session->db->read($sql,$dbh,$placeholders);
|
$sth = $dbh->read($sql,$placeholders);
|
||||||
}
|
}
|
||||||
my $defaultPageNumber = $self->getPageNumber;
|
my $defaultPageNumber = $self->getPageNumber;
|
||||||
$self->{_totalRows} = $sth->rows;
|
$self->{_totalRows} = $sth->rows;
|
||||||
|
|
|
||||||
|
|
@ -140,12 +140,12 @@ sub formField {
|
||||||
}
|
}
|
||||||
$properties->{options} = $orderedValues;
|
$properties->{options} = $orderedValues;
|
||||||
my $default;
|
my $default;
|
||||||
if ($session{form}{$properties->{name}}) {
|
if ($self->session->form->process("$properties->{name}")) {
|
||||||
$default = $session{form}{$properties->{name}};
|
$default = $self->session->form->process("$properties->{name}");
|
||||||
} elsif (defined $u && $u->profileField($properties->{name})) {
|
} elsif (defined $u && $u->profileField($properties->{name})) {
|
||||||
$default = $u->profileField($properties->{name});
|
$default = $u->profileField($properties->{name});
|
||||||
} elsif (!defined $u && $session{user}{$properties->{name}}) {
|
} elsif (!defined $u && $self->session->user->profileField("$properties->{name}")) {
|
||||||
$default = $session{user}{$properties->{name}};
|
$default = $self->session->user->profileField("$properties->{name}");
|
||||||
} else {
|
} else {
|
||||||
$default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault});
|
$default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue