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

View file

@ -45,9 +45,16 @@ updateHelpTemplate();
fixImportNodePrivileges(); fixImportNodePrivileges();
addAdManager(); addAdManager();
updateMatrix(); updateMatrix();
updateFolder();
finish($session); # this line required 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 { sub updateMatrix {
print "\tAdding new features to the matrix.\n"; print "\tAdding new features to the matrix.\n";

View file

@ -74,6 +74,10 @@ sub definition {
label => $i18n->get("visitor cache timeout"), label => $i18n->get("visitor cache timeout"),
hoverHelp => $i18n->get("visitor cache timeout help") hoverHelp => $i18n->get("visitor cache timeout help")
}, },
sortAlphabetically => {
fieldType=>"yesNo",
defaultValue=>0
},
templateId =>{ templateId =>{
fieldType=>"template", fieldType=>"template",
defaultValue=>'PBtmpl0000000000000078' defaultValue=>'PBtmpl0000000000000078'
@ -105,6 +109,12 @@ sub getEditForm {
-uiLevel=>8, -uiLevel=>8,
-defaultValue=>3600 -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( $tabform->getTab("display")->template(
-value=>$self->getValue('templateId'), -value=>$self->getValue('templateId'),
-label=>$i18n->get('folder template title'), -label=>$i18n->get('folder template title'),
@ -162,7 +172,9 @@ sub view {
my $out = WebGUI::Cache->new($self->session,"view_".$self->getId)->get; my $out = WebGUI::Cache->new($self->session,"view_".$self->getId)->get;
return $out if $out; 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; my %vars;
foreach my $child (@{$children}) { foreach my $child (@{$children}) {
if (ref($child) eq "WebGUI::Asset::Wobject::Folder") { 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. A string containing extra where clause information for the query.
=head4 orderByClause
A string containing an order by clause (without the "order by").
=cut =cut
sub getLineage { sub getLineage {

View file

@ -2,6 +2,16 @@ package WebGUI::i18n::English::Asset_Folder;
our $I18N = { 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' => { 'visitor cache timeout' => {
message => q|Visitor Cache Timeout|, message => q|Visitor Cache Timeout|,
lastUpdated => 0 lastUpdated => 0