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
|
|
@ -364,7 +364,7 @@ sub getAssetAdderLinks {
|
|||
my $addToUrl = shift;
|
||||
my $type = shift || "assets";
|
||||
my %links;
|
||||
foreach my $class (@{$session{config}{$type}}) {
|
||||
foreach my $class (@{$self->session->config->get("$type}")) {
|
||||
next unless $class;
|
||||
my $load = "use ".$class;
|
||||
eval ($load);
|
||||
|
|
@ -964,7 +964,7 @@ sub getValue {
|
|||
my $self = shift;
|
||||
my $key = shift;
|
||||
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);
|
||||
return $storedValue if (defined $storedValue);
|
||||
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}}) {
|
||||
if ($form =~ /^metadata_(.*)$/) {
|
||||
$self->updateMetaData($1,$session{form}{$form});
|
||||
$self->updateMetaData($1,$self->session->form->process("$form"));
|
||||
}
|
||||
}
|
||||
$data{title} = "Untitled" unless ($data{title});
|
||||
|
|
@ -1416,7 +1416,7 @@ sub www_add {
|
|||
$self->session->errorHandler->security("tried to call an invalid class ".$class);
|
||||
return "";
|
||||
}
|
||||
if ($session{form}{'prototype'}) {
|
||||
if ($self->session->form->process("'prototype'")) {
|
||||
my $prototype = WebGUI::Asset->new($self->session->form->process("prototype"),$class);
|
||||
foreach my $definition (@{$prototype->definition}) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab
|
||||
foreach my $property (keys %{$definition->{properties}}) {
|
||||
|
|
|
|||
|
|
@ -202,9 +202,9 @@ sub processPropertiesFromFormPost {
|
|||
my %data;
|
||||
$data{filename} = $filename;
|
||||
$data{storageId} = $storage->getId;
|
||||
$data{title} = $filename unless ($session{form}{title});
|
||||
$data{menuTitle} = $filename unless ($session{form}{menuTitle});
|
||||
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
|
||||
$data{title} = $filename unless ($self->session->form->process("title"));
|
||||
$data{menuTitle} = $filename unless ($self->session->form->process("menuTitle"));
|
||||
$data{url} = $self->getParent->get('url').'/'.$filename unless ($self->session->form->process("url"));
|
||||
$self->update(\%data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -660,7 +660,7 @@ sub processPropertiesFromFormPost {
|
|||
);
|
||||
$data{url} = $self->fixUrl($self->getThread->get("url")."/1") if ($self->isReply);
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1002,7 +1002,7 @@ sub www_edit {
|
|||
});
|
||||
$var{'lock.form'} = WebGUI::Form::yesNo({
|
||||
name=>'lock',
|
||||
value=>$session{form}{'lock'}
|
||||
value=>$self->session->form->process("'lock'")
|
||||
});
|
||||
}
|
||||
$var{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||
|
|
@ -1035,7 +1035,7 @@ sub www_edit {
|
|||
($var{'preview.synopsis'}, $var{'preview.content'}) = $self->getSynopsisAndContentFromFormPost;
|
||||
$var{'preview.content'} = $self->formatContent($var{'preview.content'},$self->session->form->process("contentType"));
|
||||
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,);
|
||||
|
|
|
|||
|
|
@ -647,7 +647,7 @@ sub view {
|
|||
$var->{'lock.url'} = $self->getLockUrl;
|
||||
$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
|
||||
left join assetData on assetData.assetId=asset.assetId
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
|
|
|
|||
|
|
@ -463,8 +463,8 @@ sub getShortcutByCriteria {
|
|||
my $scratchId;
|
||||
if ($assetId) {
|
||||
$scratchId = "Shortcut_" . $assetId;
|
||||
if($session{scratch}{$scratchId} && !$self->getValue("disableContentLock")) {
|
||||
return $session{scratch}{$scratchId} unless ($self->session->var->get("adminOn"));
|
||||
if($self->session->scratch->get("$scratchId") && !$self->getValue("disableContentLock")) {
|
||||
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.sentence"} = $var{"description.first.2sentences"};
|
||||
$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 "") {
|
||||
$var{description} =~ s/\^\-\;//g;
|
||||
$p->setDataByArrayRef([$var{description}]);
|
||||
|
|
|
|||
|
|
@ -894,9 +894,9 @@ sub view {
|
|||
my $self = shift;
|
||||
my $scratchSortBy = $self->getId."_sortBy";
|
||||
my $scratchSortOrder = $self->getId."_sortDir";
|
||||
my $sortBy = $self->session->form->process("sortBy") || $session{scratch}{$scratchSortBy} || $self->get("sortBy");
|
||||
my $sortOrder = $session{scratch}{$scratchSortOrder} || $self->get("sortOrder");
|
||||
if ($sortBy ne $session{scratch}{$scratchSortBy} && $self->session->form->process("func") ne "editSave") {
|
||||
my $sortBy = $self->session->form->process("sortBy") || $self->session->scratch->get("$scratchSortBy") || $self->get("sortBy");
|
||||
my $sortOrder = $self->session->scratch->get("$scratchSortOrder") || $self->get("sortOrder");
|
||||
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"));
|
||||
} elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") {
|
||||
if ($sortOrder eq "asc") {
|
||||
|
|
@ -938,7 +938,7 @@ sub view {
|
|||
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
|
||||
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->appendTemplateLabels(\%var);
|
||||
return $self->processTemplate(\%var,$self->get("collaborationTemplateId"));
|
||||
|
|
@ -965,28 +965,28 @@ sub www_search {
|
|||
.WebGUI::Form::hidden($self->session,{ name=>"doit", value=>1 });
|
||||
$var{'all.form'} = WebGUI::Form::text({
|
||||
name=>'all',
|
||||
value=>$session{scratch}{$self->getId."_all"},
|
||||
value=>$self->session->scratch->get("$self->getId."_all""),
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
$var{'exactphrase.form'} = WebGUI::Form::text({
|
||||
name=>'exactPhrase',
|
||||
value=>$session{scratch}{$self->getId."_exactPhrase"},
|
||||
value=>$self->session->scratch->get("$self->getId."_exactPhrase""),
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
$var{'atleastone.form'} = WebGUI::Form::text({
|
||||
name=>'atLeastOne',
|
||||
value=>$session{scratch}{$self->getId."_atLeastOne"},
|
||||
value=>$self->session->scratch->get("$self->getId."_atLeastOne""),
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
$var{'without.form'} = WebGUI::Form::text({
|
||||
name=>'without',
|
||||
value=>$session{scratch}{$self->getId."_without"},
|
||||
value=>$self->session->scratch->get("$self->getId."_without""),
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
my %results;
|
||||
tie %results, 'Tie::IxHash';
|
||||
%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({
|
||||
name=>"numResults",
|
||||
options=>\%results,
|
||||
|
|
@ -1000,10 +1000,10 @@ sub www_search {
|
|||
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 $all;
|
||||
if ($session{scratch}{$self->getId."_all"} ne "") {
|
||||
$session{scratch}{$self->getId."_all"} =~ s/,/ /g;
|
||||
$session{scratch}{$self->getId."_all"} =~ s/\s+/ /g;
|
||||
my @words = split(/ /,$session{scratch}{$self->getId."_all"});
|
||||
if ($self->session->scratch->get("$self->getId."_all"") ne "") {
|
||||
$self->session->scratch->get("$self->getId."_all"") =~ s/,/ /g;
|
||||
$self->session->scratch->get("$self->getId."_all"") =~ s/\s+/ /g;
|
||||
my @words = split(/ /,$self->session->scratch->get("$self->getId."_all""));
|
||||
foreach my $word (@words) {
|
||||
$all .= " and " if ($all ne "");
|
||||
$all .= "(";
|
||||
|
|
@ -1018,17 +1018,17 @@ sub www_search {
|
|||
}
|
||||
}
|
||||
my $exactPhrase;
|
||||
if ($session{scratch}{$self->getId."_exactPhrase"} ne "") {
|
||||
if ($self->session->scratch->get("$self->getId."_exactPhrase"") ne "") {
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$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;
|
||||
if ($session{scratch}{$self->getId."_atLeastOne"} ne "") {
|
||||
$session{scratch}{$self->getId."_atLeastOne"} =~ s/,/ /g;
|
||||
$session{scratch}{$self->getId."_atLeastOne"} =~ s/\s+/ /g;
|
||||
my @words = split(/ /,$session{scratch}{$self->getId."_atLeastOne"});
|
||||
if ($self->session->scratch->get("$self->getId."_atLeastOne"") ne "") {
|
||||
$self->session->scratch->get("$self->getId."_atLeastOne"") =~ s/,/ /g;
|
||||
$self->session->scratch->get("$self->getId."_atLeastOne"") =~ s/\s+/ /g;
|
||||
my @words = split(/ /,$self->session->scratch->get("$self->getId."_atLeastOne""));
|
||||
foreach my $word (@words) {
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$atLeastOne .= " or " if ($atLeastOne ne "");
|
||||
|
|
@ -1037,10 +1037,10 @@ sub www_search {
|
|||
}
|
||||
}
|
||||
my $without;
|
||||
if ($session{scratch}{$self->getId."_without"} ne "") {
|
||||
$session{scratch}{$self->getId."_without"} =~ s/,/ /g;
|
||||
$session{scratch}{$self->getId."_without"} =~ s/\s+/ /g;
|
||||
my @words = split(/ /,$session{scratch}{$self->getId."_without"});
|
||||
if ($self->session->scratch->get("$self->getId."_without"") ne "") {
|
||||
$self->session->scratch->get("$self->getId."_without"") =~ s/,/ /g;
|
||||
$self->session->scratch->get("$self->getId."_without"") =~ s/\s+/ /g;
|
||||
my @words = split(/ /,$self->session->scratch->get("$self->getId."_without""));
|
||||
foreach my $word (@words) {
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$without .= " and " if ($without ne "");
|
||||
|
|
@ -1071,7 +1071,7 @@ sub www_search {
|
|||
$sql .= " and " if ($sql ne "" && $without ne "");
|
||||
$sql .= " ($without) " if ($without ne "");
|
||||
$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);
|
||||
}
|
||||
return $self->processStyle($self->processTemplate(\%var, $self->get("searchTemplateId")));
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ sub _createField {
|
|||
my %param;
|
||||
$param{name} = $data->{name};
|
||||
$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{size} = $data->{width};
|
||||
$param{rows} = $data->{rows} || 5;
|
||||
|
|
@ -53,7 +53,7 @@ sub _createField {
|
|||
}
|
||||
if (isIn($data->{type},qw(selectList checkList))) {
|
||||
my @defaultValues;
|
||||
if ($session{form}{$param{name}}) {
|
||||
if ($self->session->form->process("$param{name}")) {
|
||||
@defaultValues = $self->session->form->selectList($param{name});
|
||||
} else {
|
||||
foreach (split(/\n/, $data->{value})) {
|
||||
|
|
@ -426,7 +426,7 @@ sub getRecordTemplateVars {
|
|||
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");
|
||||
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) {
|
||||
$data{value} = $formValue;
|
||||
$data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date");
|
||||
|
|
@ -470,7 +470,7 @@ sub getRecordTemplateVars {
|
|||
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");
|
||||
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) {
|
||||
$data{value} = $formValue;
|
||||
$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}}) {
|
||||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||
$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
|
||||
|
|
@ -245,13 +245,13 @@ sub view {
|
|||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||
$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
|
||||
@formUpload=($uploadFile, qq/$session{form}{'HttpProxy_'.$input_name}/);
|
||||
@formUpload=($uploadFile, qq/$self->session->form->process("'HttpProxy_'.$input_name")/);
|
||||
$formdata{$input_name}=\@formUpload;
|
||||
$contentType = 'form-data'; # Different Content Type header for file upload
|
||||
} else {
|
||||
$formdata{$input_name}=qq/$session{form}{'HttpProxy_'.$input_name}/;
|
||||
$formdata{$input_name}=qq/$self->session->form->process("'HttpProxy_'.$input_name")/;
|
||||
}
|
||||
}
|
||||
# Create POST request
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ sub view {
|
|||
|
||||
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,
|
||||
users.userId,
|
||||
|
|
@ -433,7 +433,7 @@ sub www_viewReport {
|
|||
$var{showReport} = 1;
|
||||
$endDate = $self->session->datetime->addToTime($endDate,24,0,0);
|
||||
my $lastDepartment = "_none_";
|
||||
my $p = WebGUI::Paginator->new($url, $pageReportAfter);
|
||||
my $p = WebGUI::Paginator->new($self->session,$url, $pageReportAfter);
|
||||
|
||||
my $sql = "select users.username,
|
||||
users.userId,
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ sub view {
|
|||
map {$url .= "&namespaces=".$self->session->url->escape($_)} $self->session->request->param('namespaces');
|
||||
map {$url .= "&contentTypes=".$self->session->url->escape($_)} $self->session->request->param('contentTypes');
|
||||
$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);
|
||||
$var{startNr} = 1;
|
||||
if($self->session->form->process("pn")) {
|
||||
|
|
|
|||
|
|
@ -749,11 +749,11 @@ sub www_rate {
|
|||
if ($first) {
|
||||
$first=0;
|
||||
} else {
|
||||
if ($lastRating != $session{form}{$category}) {
|
||||
if ($lastRating != $self->session->form->process("$category")) {
|
||||
$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.
|
||||
$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");
|
||||
while (my ($name,$fieldType) = $sth->array) {
|
||||
next unless ($session{form}{$name});
|
||||
next unless ($self->session->form->process("$name"));
|
||||
push(@list,0);
|
||||
my $where;
|
||||
if ($fieldType ne "goodBad") {
|
||||
$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<".$self->session->db->quote($session{form}{$name})
|
||||
#." or a.value<".$self->session->db->quote($self->session->form->process("$name"))
|
||||
." or a.value='Free'"
|
||||
.")";
|
||||
} else {
|
||||
|
|
@ -832,13 +832,13 @@ sub www_search {
|
|||
if ($data->{fieldType} ne "goodBad") {
|
||||
$data->{form} = WebGUI::Form::text({
|
||||
name=>$data->{name},
|
||||
value=>$session{form}{$data->{name}}
|
||||
value=>$self->session->form->process("$data->{name}")
|
||||
});
|
||||
} else {
|
||||
$data->{form} = WebGUI::Form::checkbox({
|
||||
name=>$data->{name},
|
||||
value=>"1",
|
||||
checked=>$session{form}{$data->{name}}
|
||||
checked=>$self->session->form->process("$data->{name}")
|
||||
});
|
||||
}
|
||||
push(@loop,$data);
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ sub www_preview {
|
|||
showSystemPages=>$self->session->form->process("showSystemPages"),
|
||||
showHiddenPages=>$self->session->form->process("showHiddenPages"),
|
||||
showUnprivilegedPages=>$self->session->form->process("showUnprivilegedPages"),
|
||||
'reverse'=>$session{form}{'reverse'},
|
||||
'reverse'=>$self->session->form->process("'reverse'"),
|
||||
);
|
||||
my $output = qq(
|
||||
<table width="100%" border="0" cellpadding="5" cellspacing="0">
|
||||
|
|
@ -474,7 +474,7 @@ sub www_preview {
|
|||
stopAtLevel: $self->session->form->process("stopAtLevel")<br />
|
||||
depth: $self->session->form->process("depth")<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 />
|
||||
showHiddenPages: $self->session->form->process("showHiddenPages")<br />
|
||||
showUnprivilegedPages: $self->session->form->process("showUnprivilegedPages")<br />
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ sub _parsePlaceholderParams {
|
|||
my ($type,$field) = split(/:/,$row);
|
||||
my $param;
|
||||
if($type =~ /^form/) {
|
||||
$param = $session{form}{$field};
|
||||
$param = $self->session->form->process("$field");
|
||||
} elsif ($type =~ /^query(\d)/) {
|
||||
$param = $self->{_query}{$1}{rowData}{$field};
|
||||
}
|
||||
|
|
@ -332,12 +332,12 @@ sub _processQuery {
|
|||
foreach (keys %{$session{form}}) {
|
||||
unless ($_ eq "pn" || $_ eq "func" || $_ =~ /identifier/i || $_ =~ /password/i) {
|
||||
$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");
|
||||
$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);
|
||||
if ($error ne "") {
|
||||
$self->session->errorHandler->warn("There was a problem with the query: ".$error);
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ sub duplicate {
|
|||
sub generateResponseId {
|
||||
my $self = shift;
|
||||
my $varname = $self->getResponseIdString;
|
||||
if ($session{scratch}{$varname}) {
|
||||
if ($self->session->scratch->get("$varname")) {
|
||||
$self->completeResponse;
|
||||
}
|
||||
my $ipAddress = $self->getIp;
|
||||
|
|
@ -532,7 +532,7 @@ sub getSectionDrivenQuestionIds {
|
|||
#-------------------------------------------------------------------
|
||||
sub getResponseId {
|
||||
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;
|
||||
return "" unless ($self->session->user->isInGroup($self->get("groupToTakeSurvey")));
|
||||
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 $terminate = 0;
|
||||
foreach my $key (keys %{$session{form}}) {
|
||||
if ($key =~ /^answerId_(.+)$/) {
|
||||
my $id = $1;
|
||||
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);
|
||||
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 "") {
|
||||
$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->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($session{form}{"comment_".$id}).", ".$self->session->db->quote($response).", ".$self->session->datetime->time().")");
|
||||
".$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($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) {
|
||||
$self->session->db->setRow("Survey_response","Survey_responseId",{
|
||||
isComplete=>1,
|
||||
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"));
|
||||
|
|
@ -1212,7 +1212,7 @@ sub www_viewGradebook {
|
|||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my $var = $self->getMenuVars;
|
||||
$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
|
||||
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by username,ipAddress,startDate");
|
||||
my $users = $p->getPageData;
|
||||
|
|
@ -1308,7 +1308,7 @@ sub www_viewStatisticalOverview {
|
|||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my $var = $self->getMenuVars;
|
||||
$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
|
||||
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my $questions = $p->getPageData;
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ sub view {
|
|||
# this case hasn't ever happened running against my dev SOAP::Lite
|
||||
# services, but let's assume it might. If our results array has
|
||||
# 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);
|
||||
@result = ();
|
||||
@result = @$p;
|
||||
|
|
@ -431,7 +431,7 @@ sub view {
|
|||
if (my $aref = $result[0]->{$self->get('paginateVar')}) {
|
||||
|
||||
$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);
|
||||
$result[0]->{$self->get('paginateVar')} = $p->getPageData;
|
||||
|
||||
|
|
@ -443,21 +443,21 @@ sub view {
|
|||
# prevent the wobject from dying
|
||||
for (keys %{$result[0]}) {
|
||||
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]->{$_});
|
||||
last;
|
||||
}
|
||||
}
|
||||
$p ||= WebGUI::Paginator->new($url);
|
||||
$p ||= WebGUI::Paginator->new($self->session,$url);
|
||||
$result[0]->{$_} = $p->getPageData;
|
||||
|
||||
} 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]);
|
||||
$result[0] = $p->getPageData;
|
||||
|
||||
} else {
|
||||
$p = WebGUI::Paginator->new($url, $self->get('paginateAfter'));
|
||||
$p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter'));
|
||||
$p->setDataByArrayRef([$result[0]]);
|
||||
$result[0] = $p->getPageData;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ sub www_editBranchSave {
|
|||
if ($form =~ /^metadata_(.*)$/) {
|
||||
my $fieldName = $1;
|
||||
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"));
|
||||
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> ';
|
||||
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
|
||||
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")));
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ sub _isValidLDAPUser {
|
|||
$auth = $ldap->bind;
|
||||
}
|
||||
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 ($connection->{ldapUserRDN} eq 'dn') {
|
||||
$connectDN = $search->entry(0)->dn;
|
||||
|
|
@ -56,10 +56,10 @@ sub _isValidLDAPUser {
|
|||
}
|
||||
$ldap->unbind;
|
||||
$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) {
|
||||
$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) {
|
||||
$error .= '<li>LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69).'</li>';
|
||||
$self->session->errorHandler->error("LDAP error: ".$ldapStatusCode{$auth->code});
|
||||
|
|
@ -67,7 +67,7 @@ sub _isValidLDAPUser {
|
|||
$ldap->unbind;
|
||||
} else {
|
||||
$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 {
|
||||
$error = WebGUI::International::get(2,'AuthLDAP');
|
||||
|
|
@ -92,9 +92,9 @@ sub addUserForm {
|
|||
my $self = shift;
|
||||
my $userData = $self->getParams;
|
||||
my $connection = $self->{_connection};
|
||||
my $ldapUrl = $session{form}{'authLDAP_ldapUrl'} || $userData->{ldapUrl} || $connection->{ldapURL};
|
||||
my $connectDN = $session{form}{'authLDAP_connectDN'} || $userData->{connectDN};
|
||||
my $ldapConnection = $session{form}{'authLDAP_ldapConnection'} || $userData->{ldapConnection};
|
||||
my $ldapUrl = $self->session->form->process("'authLDAP_ldapUrl'} || $userData->{ldapUrl} || $connection->{ldapURL");
|
||||
my $connectDN = $self->session->form->process("'authLDAP_connectDN'} || $userData->{connectDN");
|
||||
my $ldapConnection = $self->session->form->process("'authLDAP_ldapConnection'} || $userData->{ldapConnection");
|
||||
my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink");
|
||||
my $f = WebGUI::HTMLForm->new($self->session);
|
||||
my $jscript = "";
|
||||
|
|
@ -146,9 +146,9 @@ sub addUserForm {
|
|||
sub addUserFormSave {
|
||||
my $self = shift;
|
||||
my $properties;
|
||||
$properties->{connectDN} = $session{form}{'authLDAP_connectDN'};
|
||||
$properties->{ldapUrl} = $session{form}{'authLDAP_ldapUrl'};
|
||||
$properties->{ldapConnection} = $session{form}{'authLDAP_ldapConnection'};
|
||||
$properties->{connectDN} = $self->session->form->process("'authLDAP_connectDN'");
|
||||
$properties->{ldapUrl} = $self->session->form->process("'authLDAP_ldapUrl'");
|
||||
$properties->{ldapConnection} = $self->session->form->process("'authLDAP_ldapConnection'");
|
||||
$self->SUPER::addUserFormSave($properties);
|
||||
}
|
||||
|
||||
|
|
@ -222,9 +222,9 @@ sub createAccount {
|
|||
value=>[$connection->{ldapLinkId}],
|
||||
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.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.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" />';
|
||||
$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.password'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifier"});
|
||||
$vars->{'create.form.password.label'} = WebGUI::International::get(51);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@ http://www.plainblack.com info@plainblack.com
|
|||
|
||||
use Net::SMTP;
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -75,60 +72,60 @@ The email address for the BCC line.
|
|||
=cut
|
||||
|
||||
sub send {
|
||||
my ($smtp, $message, $from);
|
||||
foreach my $option (\$_[0], \$_[1], \$_[3], \$_[4], \$_[5]) {
|
||||
if(${$option}) {
|
||||
if (${$option} =~ /(?:From|To|Date|X-Mailer|Subject|Received|Message-Id)\s*:/is) {
|
||||
use WebGUI::ErrorHandler;
|
||||
return $self->session->errorHandler->security("pass a malicious value to the mail header.");
|
||||
}
|
||||
}
|
||||
}
|
||||
$from = $_[4] || $self->session->setting->get("companyEmail");
|
||||
#header
|
||||
my $to = $self->session->config->get("emailOverride") || $_[0];
|
||||
$message = "To: $to\n";
|
||||
$message .= "From: $from\n";
|
||||
$message .= "CC: $_[3]\n" if ($_[3] && !$self->session->config->get("emailOverride"));
|
||||
$message .= "BCC: $_[5]\n" if ($_[5] && !$self->session->config->get("emailOverride"));
|
||||
$message .= "Subject: ".$_[1]."\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)) {
|
||||
$message .= "Content-Type: text/html; charset=UTF-8\n";
|
||||
} else {
|
||||
$message .= "Content-Type: text/plain; charset=UTF-8\n";
|
||||
}
|
||||
$message .= "\n";
|
||||
WebGUI::Macro::process($self->session,\$message);
|
||||
# my ($smtp, $message, $from);
|
||||
# foreach my $option (\$_[0], \$_[1], \$_[3], \$_[4], \$_[5]) {
|
||||
# if(${$option}) {
|
||||
# if (${$option} =~ /(?:From|To|Date|X-Mailer|Subject|Received|Message-Id)\s*:/is) {
|
||||
# use WebGUI::ErrorHandler;
|
||||
# return $self->session->errorHandler->security("pass a malicious value to the mail header.");
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# $from = $_[4] || $self->session->setting->get("companyEmail");
|
||||
# #header
|
||||
# my $to = $self->session->config->get("emailOverride") || $_[0];
|
||||
# $message = "To: $to\n";
|
||||
# $message .= "From: $from\n";
|
||||
# $message .= "CC: $_[3]\n" if ($_[3] && !$self->session->config->get("emailOverride"));
|
||||
# $message .= "BCC: $_[5]\n" if ($_[5] && !$self->session->config->get("emailOverride"));
|
||||
# $message .= "Subject: ".$_[1]."\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)) {
|
||||
# $message .= "Content-Type: text/html; charset=UTF-8\n";
|
||||
# } else {
|
||||
# $message .= "Content-Type: text/plain; charset=UTF-8\n";
|
||||
# }
|
||||
# $message .= "\n";
|
||||
# WebGUI::Macro::process($self->session,\$message);
|
||||
#body
|
||||
$message .= $_[2]."\n";
|
||||
# $message .= $_[2]."\n";
|
||||
#footer
|
||||
my $footer = "\n".$self->session->setting->get("mailFooter");
|
||||
WebGUI::Macro::process($self->session,\$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"));
|
||||
if ($self->session->setting->get("smtpServer") =~ /\/sendmail/) {
|
||||
if (open(MAIL,"| $self->session->setting->get("smtpServer") -t -oi")) {
|
||||
print MAIL $message;
|
||||
close(MAIL) or $self->session->errorHandler->warn("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer"));
|
||||
} else {
|
||||
$self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
||||
}
|
||||
} else {
|
||||
$smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server
|
||||
if (defined $smtp) {
|
||||
$smtp->mail($from); # use the sender's address here
|
||||
$smtp->to($to); # recipient's address
|
||||
$smtp->cc($_[3]) if ($_[3] && !$self->session->config->get("emailOverride"));
|
||||
$smtp->bcc($_[5]) if ($_[5] && !$self->session->config->get("emailOverride"));
|
||||
$smtp->data(); # Start the mail
|
||||
$smtp->datasend($message);
|
||||
$smtp->dataend(); # Finish sending the mail
|
||||
$smtp->quit; # Close the SMTP connection
|
||||
} else {
|
||||
$self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
||||
}
|
||||
}
|
||||
# my $footer = "\n".$self->session->setting->get("mailFooter");
|
||||
# WebGUI::Macro::process($self->session,\$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"));
|
||||
# if ($self->session->setting->get("smtpServer") =~ /\/sendmail/) {
|
||||
# if (open(MAIL,"| $self->session->setting->get("smtpServer") -t -oi")) {
|
||||
# print MAIL $message;
|
||||
# close(MAIL) or $self->session->errorHandler->warn("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer"));
|
||||
# } else {
|
||||
# $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
||||
# }
|
||||
# } else {
|
||||
# $smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server
|
||||
# if (defined $smtp) {
|
||||
# $smtp->mail($from); # use the sender's address here
|
||||
# $smtp->to($to); # recipient's address
|
||||
# $smtp->cc($_[3]) if ($_[3] && !$self->session->config->get("emailOverride"));
|
||||
# $smtp->bcc($_[5]) if ($_[5] && !$self->session->config->get("emailOverride"));
|
||||
# $smtp->data(); # Start the mail
|
||||
# $smtp->datasend($message);
|
||||
# $smtp->dataend(); # Finish sending the mail
|
||||
# $smtp->quit; # Close the SMTP connection
|
||||
# } else {
|
||||
# $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer"));
|
||||
# }
|
||||
# }
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -17,14 +17,8 @@ package WebGUI::MessageLog;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Id;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Mail;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -114,37 +108,37 @@ The addressee email address. Defaults to company email.
|
|||
=cut
|
||||
|
||||
sub addEntry {
|
||||
my ($u, @users, $messageLogId, $sth, $userId, $groupId, $subject, $message, $url, $status, $user, $from);
|
||||
$messageLogId = $self->session->id->generate();
|
||||
$userId = $_[0];
|
||||
$groupId = $_[1];
|
||||
$subject = $_[2];
|
||||
$message = $_[3];
|
||||
$url = $_[4];
|
||||
if ($url && !$url =~ /^http/) {
|
||||
$url = $self->session->url->getSiteURL().$url;
|
||||
}
|
||||
if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
||||
$url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
||||
}
|
||||
$status = $_[5];
|
||||
$from = $_[6];
|
||||
if ($groupId ne "") {
|
||||
@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));
|
||||
foreach $user (@users) {
|
||||
$u = WebGUI::User->new($user);
|
||||
if ($u->userId ne "") {
|
||||
$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).",
|
||||
".$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 "") {
|
||||
$message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
||||
}
|
||||
_notify($u,$subject,$message,$from);
|
||||
}
|
||||
}
|
||||
# my ($u, @users, $messageLogId, $sth, $userId, $groupId, $subject, $message, $url, $status, $user, $from);
|
||||
# $messageLogId = $self->session->id->generate();
|
||||
# $userId = $_[0];
|
||||
# $groupId = $_[1];
|
||||
# $subject = $_[2];
|
||||
# $message = $_[3];
|
||||
# $url = $_[4];
|
||||
# if ($url && !$url =~ /^http/) {
|
||||
# $url = $self->session->url->getSiteURL().$url;
|
||||
# }
|
||||
# if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
||||
# $url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
||||
# }
|
||||
# $status = $_[5];
|
||||
# $from = $_[6];
|
||||
# if ($groupId ne "") {
|
||||
# @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));
|
||||
# foreach $user (@users) {
|
||||
# $u = WebGUI::User->new($user);
|
||||
# if ($u->userId ne "") {
|
||||
# $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).",
|
||||
# ".$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 "") {
|
||||
# $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
||||
# }
|
||||
# _notify($u,$subject,$message,$from);
|
||||
# }
|
||||
# }
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -184,45 +178,45 @@ Defaults to 'notice'. Can be 'pending', 'notice', or 'completed'.
|
|||
=cut
|
||||
|
||||
sub addInternationalizedEntry {
|
||||
my ($u, $userId, $url, $groupId, $internationalId, @users, $messageLogId,$sth, $user, %message, %subject, $message, $subject, $namespace, $status);
|
||||
$messageLogId = $self->session->id->generate();
|
||||
$userId = $_[0];
|
||||
$groupId = $_[1];
|
||||
$url = $_[2];
|
||||
if ($url && !$url =~ /^http/) {
|
||||
$url = $self->session->url->getSiteURL().$url;
|
||||
}
|
||||
if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
||||
$url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
||||
}
|
||||
$internationalId = $_[3];
|
||||
$namespace = $_[4] || "WebGUI";
|
||||
$status = $_[5] || 'notice';
|
||||
my $languages = WebGUI::International::getLanguages();
|
||||
foreach my $language (keys %{$languages}) {
|
||||
$message{$language} = WebGUI::International::get($internationalId,$namespace,$language);
|
||||
$subject{$language} = WebGUI::International::get(523,"WebGUI",$language);
|
||||
}
|
||||
if ($groupId ne "") {
|
||||
@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));
|
||||
foreach $user (@users) {
|
||||
$u = WebGUI::User->new($user);
|
||||
if ($u->userId ne "") {
|
||||
$subject{$u->profileField("language")} = $subject{1} if ($subject{$u->profileField("language")} eq "");
|
||||
$subject = $subject{$u->profileField("language")};
|
||||
$message{$u->profileField("language")} = $message{1} if ($message{$u->profileField("language")} eq "");
|
||||
$message = $message{$u->profileField("language")};
|
||||
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->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($message).",".$self->session->db->quote($status).")");
|
||||
if ($url ne "") {
|
||||
$message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
||||
}
|
||||
_notify($u,$subject,$message);
|
||||
}
|
||||
}
|
||||
# my ($u, $userId, $url, $groupId, $internationalId, @users, $messageLogId,$sth, $user, %message, %subject, $message, $subject, $namespace, $status);
|
||||
# $messageLogId = $self->session->id->generate();
|
||||
# $userId = $_[0];
|
||||
# $groupId = $_[1];
|
||||
# $url = $_[2];
|
||||
# if ($url && !$url =~ /^http/) {
|
||||
# $url = $self->session->url->getSiteURL().$url;
|
||||
# }
|
||||
# if ($url && !($url =~ /func=/ || $url =~ /op=/)) {
|
||||
# $url = $self->session->url->append($url, "op=viewMessageLogMessage");
|
||||
# }
|
||||
# $internationalId = $_[3];
|
||||
# $namespace = $_[4] || "WebGUI";
|
||||
# $status = $_[5] || 'notice';
|
||||
# my $languages = WebGUI::International::getLanguages();
|
||||
# foreach my $language (keys %{$languages}) {
|
||||
# $message{$language} = WebGUI::International::get($internationalId,$namespace,$language);
|
||||
# $subject{$language} = WebGUI::International::get(523,"WebGUI",$language);
|
||||
# }
|
||||
# if ($groupId ne "") {
|
||||
# @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));
|
||||
# foreach $user (@users) {
|
||||
# $u = WebGUI::User->new($user);
|
||||
# if ($u->userId ne "") {
|
||||
# $subject{$u->profileField("language")} = $subject{1} if ($subject{$u->profileField("language")} eq "");
|
||||
# $subject = $subject{$u->profileField("language")};
|
||||
# $message{$u->profileField("language")} = $message{1} if ($message{$u->profileField("language")} eq "");
|
||||
# $message = $message{$u->profileField("language")};
|
||||
# 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->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($message).",".$self->session->db->quote($status).")");
|
||||
# if ($url ne "") {
|
||||
# $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId);
|
||||
# }
|
||||
# _notify($u,$subject,$message);
|
||||
# }
|
||||
# }
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -238,7 +232,7 @@ The id of the message to complete.
|
|||
=cut
|
||||
|
||||
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++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=viewActiveSessions'));
|
||||
$p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
||||
|
|
|
|||
|
|
@ -527,10 +527,10 @@ sub www_editCommerceSettingsSave {
|
|||
type => $1,
|
||||
namespace => $2,
|
||||
fieldName => $3,
|
||||
fieldValue => $session{form}{$_}
|
||||
fieldValue => $session->form->process("$_")
|
||||
});
|
||||
} 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");
|
||||
|
||||
$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);
|
||||
|
||||
$transactions = $p->getPageData;
|
||||
|
|
@ -776,7 +776,7 @@ my $shoppingCart = WebGUI::Commerce::ShoppingCart->new;
|
|||
|
||||
foreach my $formElement (keys(%{$session{form}})) {
|
||||
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)
|
||||
and groupId not in (".$session->db->quoteAndJoin($groupFilter).") order by groupName";
|
||||
if ($returnPaginator) {
|
||||
my $p = WebGUI::Paginator->new($session->url->page($op));
|
||||
my $p = WebGUI::Paginator->new($session,$session->url->page($op));
|
||||
$p->setDataByQuery($sql);
|
||||
return $p;
|
||||
} else {
|
||||
|
|
@ -579,7 +579,7 @@ sub www_listGroups {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listGroups'));
|
||||
$p = WebGUI::Paginator->new($session,$session->url->page('op=listGroups'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$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>
|
||||
<td class="tableHeader">'.WebGUI::International::get(50).'</td>
|
||||
<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
|
||||
from groupings,users where groupings.groupId=".$session->db->quote($session->form->process("gid"))." and groupings.userId=users.userId
|
||||
order by users.username");
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ sub www_listLDAPLinks {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listLDAPLinks'));
|
||||
$p = WebGUI::Paginator->new($session,$session->url->page('op=listLDAPLinks'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="3" cellspacing="0" align="center">';
|
||||
$output .= $p->getPage;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ sub www_viewLoginHistory {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=viewLoginHistory'));
|
||||
$p = WebGUI::Paginator->new($session,$session->url->page('op=viewLoginHistory'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ sub www_viewMessageLog {
|
|||
my (@msg, $vars);
|
||||
return $session->privilege->insufficient() unless ($session->user->isInGroup(2,$session->user->profileField("userId")));
|
||||
$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";
|
||||
$p->setDataByQuery($query);
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ sub www_saveSettings {
|
|||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||
my ($key, $value);
|
||||
foreach $key (keys %{$session{form}}) {
|
||||
$value = $session{form}{$key};
|
||||
$value = $session->form->process("$key");
|
||||
if ($key =~ m/(.*)_interval/) {
|
||||
$value = $session->form->interval($1);
|
||||
$key = $1;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ sub www_editSubscriptionSave {
|
|||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||
|
||||
@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();
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ sub www_listSubscriptionCodeBatches {
|
|||
|
||||
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");
|
||||
|
||||
$batches = $p->getPageData;
|
||||
|
|
@ -359,7 +359,7 @@ sub www_listSubscriptionCodes {
|
|||
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);
|
||||
|
||||
$codes = $p->getPageData;
|
||||
|
|
@ -396,7 +396,7 @@ sub www_listSubscriptions {
|
|||
|
||||
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');
|
||||
$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.")
|
||||
and users.userId not in (".$session->db->quoteAndJoin($userFilter).") order by users.username";
|
||||
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);
|
||||
return $p;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ Package that paginates rows of arbitrary data for display on the web.
|
|||
=head1 SYNOPSIS
|
||||
|
||||
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->setDataByQuery($sql);
|
||||
|
||||
|
|
@ -421,10 +421,14 @@ sub getRowCount {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( currentURL [, paginateAfter, pageNumber, formVar ] )
|
||||
=head2 new ( session, currentURL [, paginateAfter, pageNumber, formVar ] )
|
||||
|
||||
Constructor.
|
||||
|
||||
=head3 session
|
||||
|
||||
A reference to the current session.
|
||||
|
||||
=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.
|
||||
|
|
@ -445,13 +449,28 @@ Specify the form variable the paginator should use in it's links. Defaults to "
|
|||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $currentURL = shift;
|
||||
my $rowsPerPage = shift || 25;
|
||||
my $formVar = shift || "pn";
|
||||
my $pn = shift || $session{form}{$formVar} || 1;
|
||||
bless {_url => $currentURL, _rpp => $rowsPerPage, _formVar => $formVar, _pn => $pn}, $class;
|
||||
my $pn = shift || $session->form->process($formVar) || 1;
|
||||
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 )
|
||||
|
|
@ -486,7 +505,7 @@ An SQL query that will retrieve a data set.
|
|||
|
||||
=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
|
||||
|
||||
|
|
@ -511,10 +530,10 @@ sub setDataByQuery {
|
|||
my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_;
|
||||
$dbh ||= $self->session->db->getSlave;
|
||||
if ($unconditional) {
|
||||
$sth = $self->session->db->unconditionalRead($sql,$dbh,$placeholders);
|
||||
$sth = $dbh->unconditionalRead($sql,$placeholders);
|
||||
return $sth->errorMessage if ($sth->errorCode > 0);
|
||||
} else {
|
||||
$sth = $self->session->db->read($sql,$dbh,$placeholders);
|
||||
$sth = $dbh->read($sql,$placeholders);
|
||||
}
|
||||
my $defaultPageNumber = $self->getPageNumber;
|
||||
$self->{_totalRows} = $sth->rows;
|
||||
|
|
|
|||
|
|
@ -140,12 +140,12 @@ sub formField {
|
|||
}
|
||||
$properties->{options} = $orderedValues;
|
||||
my $default;
|
||||
if ($session{form}{$properties->{name}}) {
|
||||
$default = $session{form}{$properties->{name}};
|
||||
if ($self->session->form->process("$properties->{name}")) {
|
||||
$default = $self->session->form->process("$properties->{name}");
|
||||
} elsif (defined $u && $u->profileField($properties->{name})) {
|
||||
$default = $u->profileField($properties->{name});
|
||||
} elsif (!defined $u && $session{user}{$properties->{name}}) {
|
||||
$default = $session{user}{$properties->{name}};
|
||||
} elsif (!defined $u && $self->session->user->profileField("$properties->{name}")) {
|
||||
$default = $self->session->user->profileField("$properties->{name}");
|
||||
} else {
|
||||
$default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue