no more getSlave, convert code to use dbSlave instead
more form accessor fixes Form/Template.pm, all asset calls need a session var
This commit is contained in:
parent
77f9ae07b2
commit
197dacadec
9 changed files with 13 additions and 15 deletions
|
|
@ -195,7 +195,7 @@ sub getNextThread {
|
||||||
)
|
)
|
||||||
group by assetData.assetId
|
group by assetData.assetId
|
||||||
order by ".$sortBy." asc
|
order by ".$sortBy." asc
|
||||||
",$self->session->db->getSlave);
|
",$self->session->dbSlave);
|
||||||
$self->{_next} = WebGUI::Asset->new($id,$class,$version);
|
$self->{_next} = WebGUI::Asset->new($id,$class,$version);
|
||||||
# delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
|
# delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
|
||||||
};
|
};
|
||||||
|
|
@ -232,7 +232,7 @@ sub getPreviousThread {
|
||||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
|
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->userId)." and assetData.ownerUserId<>'1')
|
||||||
)
|
)
|
||||||
group by assetData.assetId
|
group by assetData.assetId
|
||||||
order by ".$sortBy." desc, assetData.revisionDate desc ",$self->session->db->getSlave);
|
order by ".$sortBy." desc, assetData.revisionDate desc ",$self->session->dbSlave);
|
||||||
$self->{_previous} = WebGUI::Asset::Post::Thread->new($id,$class,$version);
|
$self->{_previous} = WebGUI::Asset::Post::Thread->new($id,$class,$version);
|
||||||
# delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
|
# delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ sub getList {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
my $namespace = shift;
|
my $namespace = shift;
|
||||||
my $sql = "select asset.assetId, assetData.revisionDate from template left join asset on asset.assetId=template.assetId left join assetData on assetData.revisionDate=template.revisionDate and assetData.assetId=template.assetId where template.namespace=".$session->db->quote($namespace)." and template.showInForms=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=".$session->db->quote($session->scratch->get("versionTag")).")) order by assetData.title";
|
my $sql = "select asset.assetId, assetData.revisionDate from template left join asset on asset.assetId=template.assetId left join assetData on assetData.revisionDate=template.revisionDate and assetData.assetId=template.assetId where template.namespace=".$session->db->quote($namespace)." and template.showInForms=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=".$session->db->quote($session->scratch->get("versionTag")).")) order by assetData.title";
|
||||||
my $sth = $session->db->read($sql,$session->db->getSlave);
|
my $sth = $session->db->read($sql,$session->dbSlave);
|
||||||
my %templates;
|
my %templates;
|
||||||
tie %templates, 'Tie::IxHash';
|
tie %templates, 'Tie::IxHash';
|
||||||
while (my ($id, $version) = $sth->array) {
|
while (my ($id, $version) = $sth->array) {
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ sub getCollateral {
|
||||||
if ($keyValue eq "new" || $keyValue eq "") {
|
if ($keyValue eq "new" || $keyValue eq "") {
|
||||||
return {$keyName=>"new"};
|
return {$keyName=>"new"};
|
||||||
} else {
|
} else {
|
||||||
return $self->session->db->quickHashRef("select * from $table where $keyName=".$self->session->db->quote($keyValue),$self->session->db->getSlave);
|
return $self->session->db->quickHashRef("select * from $table where $keyName=".$self->session->db->quote($keyValue),$self->session->dbSlave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ sub toHtml {
|
||||||
'most'=>$i18n->get(421),
|
'most'=>$i18n->get(421),
|
||||||
'all'=>$i18n->get(419)
|
'all'=>$i18n->get(419)
|
||||||
);
|
);
|
||||||
$self->get("options") = \%filter;
|
$self->set("options", \%filter);
|
||||||
return $self->SUPER::toHtml();
|
return $self->SUPER::toHtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ Renders a database connection picker control.
|
||||||
|
|
||||||
sub toHtml {
|
sub toHtml {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->get("options") = WebGUI::LDAPLink->getList($self->session,);
|
$self->set("options", WebGUI::LDAPLink->getList($self->session));
|
||||||
return $self->SUPER::toHtml();
|
return $self->SUPER::toHtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ Creates a series of hidden fields representing the data in the list.
|
||||||
|
|
||||||
sub toHtmlAsHidden {
|
sub toHtmlAsHidden {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->get("options") = WebGUI::LDAPLink->getList($self->session,);
|
$self->set("options", WebGUI::LDAPLink->getList($self->session));
|
||||||
return $self->SUPER::toHtmlAsHidden();
|
return $self->SUPER::toHtmlAsHidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@ sub toHtmlWithWrapper {
|
||||||
$subtext = $self->session->icon->edit("op=editLDAPLink;llid=".$self->get("value").";afterEdit=".$self->session->url->escape($self->get("afterEdit")));
|
$subtext = $self->session->icon->edit("op=editLDAPLink;llid=".$self->get("value").";afterEdit=".$self->session->url->escape($self->get("afterEdit")));
|
||||||
}
|
}
|
||||||
$subtext .= $self->session->icon->manage("op=listLDAPLinks");
|
$subtext .= $self->session->icon->manage("op=listLDAPLinks");
|
||||||
$self->get("subtext") = $subtext . $self->get("subtext");
|
$self->set("subtext", $subtext . $self->get("subtext"));
|
||||||
}
|
}
|
||||||
return $self->SUPER::toHtmlWithWrapper;
|
return $self->SUPER::toHtmlWithWrapper;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,15 +93,15 @@ Renders a template picker control.
|
||||||
|
|
||||||
sub toHtml {
|
sub toHtml {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $templateList = WebGUI::Asset::Template->getList($self->get("namespace"));
|
my $templateList = WebGUI::Asset::Template->getList($self->session, $self->get("namespace"));
|
||||||
#Remove entries from template list that the user does not have permission to view.
|
#Remove entries from template list that the user does not have permission to view.
|
||||||
for my $assetId ( keys %{$templateList} ) {
|
for my $assetId ( keys %{$templateList} ) {
|
||||||
my $asset = WebGUI::Asset::Template->new($assetId);
|
my $asset = WebGUI::Asset::Template->new($self->session, $assetId);
|
||||||
if (!$asset->canView($self->session->user->userId)) {
|
if (!$asset->canView($self->session->user->userId)) {
|
||||||
delete $templateList->{$assetId};
|
delete $templateList->{$assetId};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$self->get("options") = $templateList;
|
$self->set("options", $templateList);
|
||||||
$self->setManageIcons();
|
$self->setManageIcons();
|
||||||
return $self->SUPER::toHtml();
|
return $self->SUPER::toHtml();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ sub processReplacements {
|
||||||
$content =~ s/\Q$searchFor/$replaceWith/gs;
|
$content =~ s/\Q$searchFor/$replaceWith/gs;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
my $sth = $session->db->read("select searchFor,replaceWith from replacements",$session->db->getSlave);
|
my $sth = $session->db->read("select searchFor,replaceWith from replacements",$session->dbSlave);
|
||||||
while (my ($searchFor,$replaceWith) = $sth->array) {
|
while (my ($searchFor,$replaceWith) = $sth->array) {
|
||||||
$replacements->{$searchFor} = $replaceWith;
|
$replacements->{$searchFor} = $replaceWith;
|
||||||
$content =~ s/\Q$searchFor/$replaceWith/gs;
|
$content =~ s/\Q$searchFor/$replaceWith/gs;
|
||||||
|
|
|
||||||
|
|
@ -536,7 +536,7 @@ A value to match the dynamicPageNumberKey.
|
||||||
sub setDataByQuery {
|
sub setDataByQuery {
|
||||||
my ($sth, $rowCount, @row);
|
my ($sth, $rowCount, @row);
|
||||||
my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_;
|
my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_;
|
||||||
$dbh ||= $self->session->db->getSlave;
|
$dbh ||= $self->session->dbSlave;
|
||||||
if ($unconditional) {
|
if ($unconditional) {
|
||||||
$sth = $dbh->unconditionalRead($sql,$placeholders);
|
$sth = $dbh->unconditionalRead($sql,$placeholders);
|
||||||
return $sth->errorMessage if ($sth->errorCode > 0);
|
return $sth->errorMessage if ($sth->errorCode > 0);
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,6 @@ Package for interfacing with SQL databases. This package implements Perl DBI fun
|
||||||
$hashRef = $db->quickHashRef($sql);
|
$hashRef = $db->quickHashRef($sql);
|
||||||
$text = $db->quickTab($sql);
|
$text = $db->quickTab($sql);
|
||||||
|
|
||||||
$dbh = $db->getSlave;
|
|
||||||
|
|
||||||
$id = $db->getNextId("someId");
|
$id = $db->getNextId("someId");
|
||||||
$string = $db->quote($string);
|
$string = $db->quote($string);
|
||||||
$string = $db->quoteAndJoin(\@array);
|
$string = $db->quoteAndJoin(\@array);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue