added a sort alphabetically option to the folder asset

This commit is contained in:
JT Smith 2006-04-14 02:35:35 +00:00
parent 6726f56af3
commit fd4453df58
5 changed files with 35 additions and 1 deletions

View file

@ -37,6 +37,7 @@
everything should cache in the same way.
- Converted WebGUI to use a new object oriented session system. More details
in migation.txt.
- Added a sort alphabetically option to the folder asset.
- Added a screenshot feature to the matrix.
- Added an option to delete Matrix fields.
- Added an API for retrieving email from POP3 servers.

View file

@ -45,9 +45,16 @@ updateHelpTemplate();
fixImportNodePrivileges();
addAdManager();
updateMatrix();
updateFolder();
finish($session); # this line required
#-------------------------------------------------
sub updateFolder {
print "\tAdding sort option to folder.\n";
$session->db->write("alter table Folder add column sortAlphabetically int not null default 0");
}
#-------------------------------------------------
sub updateMatrix {
print "\tAdding new features to the matrix.\n";

View file

@ -74,6 +74,10 @@ sub definition {
label => $i18n->get("visitor cache timeout"),
hoverHelp => $i18n->get("visitor cache timeout help")
},
sortAlphabetically => {
fieldType=>"yesNo",
defaultValue=>0
},
templateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000078'
@ -105,6 +109,12 @@ sub getEditForm {
-uiLevel=>8,
-defaultValue=>3600
);
$tabform->getTab("display")->yesNo(
-value=>$self->getValue('sortAlphabetically'),
-label=>$i18n->get('sort alphabetically'),
-hoverHelp=>$i18n->get('sort alphabetically help'),
-name=>"sortAlphabetically"
);
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>$i18n->get('folder template title'),
@ -162,7 +172,9 @@ sub view {
my $out = WebGUI::Cache->new($self->session,"view_".$self->getId)->get;
return $out if $out;
}
my $children = $self->getLineage( ["children"], { returnObjects=>1 });
my %rules = ( returnObjects => 1);
$rules{orderByClause} = 'assetData.title' if ($self->get("sortAlphabetically"));
my $children = $self->getLineage( ["children"], \%rules);
my %vars;
foreach my $child (@{$children}) {
if (ref($child) eq "WebGUI::Asset::Wobject::Folder") {

View file

@ -257,6 +257,10 @@ An array reference containing asset classes to join in. There is no real reason
A string containing extra where clause information for the query.
=head4 orderByClause
A string containing an order by clause (without the "order by").
=cut
sub getLineage {

View file

@ -2,6 +2,16 @@ package WebGUI::i18n::English::Asset_Folder;
our $I18N = {
'sort alphabetically' => {
message => q|Sort alphabetically?|,
lastUpdated => 0
},
'sort alphabetically help' => {
message => q|Do you want to sort the items in this folder alphabetically? If you select no then it will sort according to rank.|,
lastUpdated => 0
},
'visitor cache timeout' => {
message => q|Visitor Cache Timeout|,
lastUpdated => 0