Encapsulate a method to get the list of content prototypes.
Performance improvements for the list retrieval.
This commit is contained in:
parent
7c4ae06e33
commit
801efdbda7
3 changed files with 29 additions and 7 deletions
|
|
@ -6,6 +6,7 @@
|
|||
- fixed: displaying performance profile data only to an allowed IP address.
|
||||
- fixed #10528: Thingy css error
|
||||
- fixed: Performance improvements with getting the list of asset packages.
|
||||
- fixed: Performance improvements with getting the list of content prototypes.
|
||||
|
||||
7.7.10
|
||||
- Made a change to LDAP auth that adds an OR to that query so that it also searches for a row with fieldData REGEXP '^uid=(value-from-ldap-directory-server),'. (Wes Morgan)
|
||||
|
|
|
|||
|
|
@ -1279,6 +1279,32 @@ sub getNotFound {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPrototypeList ( )
|
||||
|
||||
Returns an array of all assets that the user can view and edit that are prototypes.
|
||||
|
||||
=cut
|
||||
|
||||
sub getPrototypeList {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $db = $session->db;
|
||||
my @prototypeIds = $db->buildArray("select distinct assetId from assetData where isPrototype=1");
|
||||
my $userUiLevel = $session->user->profileField('uiLevel');
|
||||
my @assets;
|
||||
ID: foreach my $id (@prototypeIds) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($session, $id);
|
||||
next ID unless defined $asset;
|
||||
next ID unless $asset->get('isPrototype');
|
||||
next ID unless ($asset->get('status') eq 'approved' || $asset->get('tagId') eq $session->scratch->get("versionTag"));
|
||||
push @assets, $asset;
|
||||
}
|
||||
return \@assets;
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getRoot ( session )
|
||||
|
|
|
|||
|
|
@ -146,15 +146,10 @@ sub process {
|
|||
}
|
||||
|
||||
# prototypes
|
||||
my $sth = $session->db->read("select asset.className,asset.assetId,assetData.revisionDate from asset
|
||||
left join assetData on asset.assetId=assetData.assetId
|
||||
where assetData.isPrototype=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId)
|
||||
group by assetData.assetId");
|
||||
while (my ($class, $id, $date) = $sth->array) {
|
||||
my $prototype = WebGUI::Asset->new($session,$id,$class,$date);
|
||||
foreach my $prototype (@{ $session->asset->getPrototypeList }) {
|
||||
next unless ($prototype->canView && $prototype->canAdd($session) && $prototype->getUiLevel <= $userUiLevel);
|
||||
$categories{prototypes}{items}{$prototype->getTitle} = {
|
||||
url => $asset->getUrl("func=add;class=".$class.";prototype=".$prototype->getId),
|
||||
url => $asset->getUrl("func=add;class=".$prototype->get('className').";prototype=".$prototype->getId),
|
||||
icon => $prototype->getIcon(1),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue