Merge commit '17ce3572bf' into WebGUI8. All tests passing.

This commit is contained in:
Colin Kuskie 2010-06-30 18:43:27 -07:00
commit 5e502fee53
117 changed files with 2012 additions and 1027 deletions

View file

@ -769,7 +769,7 @@ sub getEventsIn {
&& Event.endTime IS NULL
&&
!(
Event.startDate > '$endDate'
Event.startDate > SUBDATE('$endDate', INTERVAL 1 DAY)
|| Event.endDate < '$startDate'
)
)
@ -794,7 +794,7 @@ sub getEventsIn {
my $orderby = join ',', @order_priority;
my $events
= $self->getLineage(["descendants"], {
= $self->getLineage(["children"], {
returnObjects => 1,
includeOnlyClasses => ['WebGUI::Asset::Event'],
joinClass => 'WebGUI::Asset::Event',

View file

@ -1176,7 +1176,7 @@ sub getThreadsPaginator {
$sortBy =~ s/^\w+\.//;
# Sort by the thread rating instead of the post rating. other places don't care about threads.
$sortBy = $sortBy eq 'rating' ? 'threadRating' : $sortBy;
if (! WebGUI::Utility::isIn($sortBy, qw/userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 title lineage revisionDate creationDate karmaRank threadRating/)) {
if (! WebGUI::Utility::isIn($sortBy, qw/userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 title lineage revisionDate creationDate karmaRank threadRating views replies lastPostDate/)) {
$sortBy = 'revisionDate';
}
if ($sortBy eq 'assetId' || $sortBy eq 'revisionDate') {

View file

@ -409,17 +409,23 @@ sub view {
my %rules;
$rules{endingLineageLength} = $start->getLineageLength+$self->descendantEndPoint;
$rules{assetToPedigree} = $current if (isIn("pedigree",@includedRelationships));
$rules{ancestorLimit} = $self->ancestorEndPoint;
$rules{orderByClause} = 'rpad(asset.lineage, 255, 9) desc' if ($self->reversePageLoop);
my $assets = $start->getLineage(\@includedRelationships,\%rules);
my $currentLineage = $current->lineage;
my $assetIter = $start->getLineageIterator(\@includedRelationships,\%rules);
my $currentLineage = $current->lineage;
my $lineageToSkip = "noskip";
my $absoluteDepthOfLastPage;
my $absoluteDepthOfFirstPage; # Will set on first iteration of loop, below
my %lastChildren;
my $previousPageData = undef;
my $eh = $self->session->errorHandler;
while ( my $asset = $assets->() ) {
while ( 1 ) {
my $asset;
eval { $asset = $assetIter->() };
if ( my $x = WebGUI::Error->caught('WebGUI::Error::ObjectNotFound') ) {
$self->session->log->error($x->full_message);
next;
}
last unless $asset;
# skip pages we shouldn't see
my $pageLineage = $asset->lineage;
next if ($pageLineage =~ m/^$lineageToSkip/);

View file

@ -2408,6 +2408,8 @@ sub editThingData {
my $thingId = shift || $session->form->process('thingId');
my $thingDataId = shift || $session->form->process('thingDataId') || "new";
my $thingProperties = shift || $self->getThing($thingId);
my $errors = shift;
my $resetForm = shift;
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
my $canEditThingData = $self->canEditThingData($thingId, $thingDataId, $thingProperties);
@ -2417,7 +2419,7 @@ sub editThingData {
my (%thingData, $fields,@field_loop,$fieldValue, $privilegedGroup);
my $var = $self->get;
my $url = $self->getUrl;
my $errors = shift;
$var->{error_loop} = $errors if ($errors);
$var->{canEditThings} = $self->canEdit;
@ -2465,14 +2467,17 @@ sub editThingData {
,[$self->getId,$thingId]);
while (my %field = $fields->hash) {
my $fieldName = 'field_'.$field{fieldId};
if ($session->form->process("func") eq "editThingDataSave"){
$fieldValue = $session->form->process($fieldName,$field{fieldType},$field{defaultValue});
$fieldValue = undef;
unless ($resetForm) {
if ($session->form->process("func") eq "editThingDataSave"){
$fieldValue = $session->form->process($fieldName,$field{fieldType},$field{defaultValue});
}
else{
$fieldValue = $thingData{"field_".$field{fieldId}};
}
}
else{
$fieldValue = $thingData{"field_".$field{fieldId}};
}
$field{value} = $fieldValue || $field{defaultValue};
my $formElement .= $self->getFormElement(\%field);
$field{value} = $fieldValue || $field{defaultValue};
my $formElement .= $self->getFormPlugin(\%field,($resetForm eq ""))->toHtml;
my $hidden = ($field{status} eq "hidden" && !$self->session->var->isAdminOn);
my $value = $field{value};
@ -2546,7 +2551,7 @@ sub www_editThingDataSave {
return $self->www_viewThingData($thingId,$newThingDataId);
}
elsif ($thingProperties->{afterSave} eq "addThing") {
return $self->www_editThingData($thingId,"new");
return $self->www_editThingData($thingId,"new",undef,undef,"resetForm");
}
elsif ($thingProperties->{afterSave} =~ m/^searchOther_/x){
$otherThingId = $thingProperties->{afterSave};
@ -2556,7 +2561,7 @@ sub www_editThingDataSave {
elsif ($thingProperties->{afterSave} =~ m/^addOther_/x){
$otherThingId = $thingProperties->{afterSave};
$otherThingId =~ s/^addOther_//x;
return $self->www_editThingData($otherThingId,"new");
return $self->www_editThingData($otherThingId,"new",undef,undef,"resetForm");
}
# if afterSave is thingy default or in any other case return www_view()
else {

View file

@ -353,7 +353,7 @@ sub view {
my $url = $self->session->url;
my $i18n = WebGUI::International->new($self->session, "Asset_UserList");
my (%var, @users, @profileField_loop, @profileFields);
my ($defaultPublicProfile, $defaultPublicEmail, $user, $sth, $sql, $profileField);
my ($user, $sth, $sql, $profileField);
my $currentUrlWithoutSort = $self->getUrl();
foreach ($form->param) {
@ -505,9 +505,6 @@ sub view {
$sortBy = join '.', map { $self->session->db->quoteIdentifier($_) } split /\./, $sortBy;
$sql .= " order by ".$sortBy." ".$sortOrder;
($defaultPublicProfile) = $self->session->db->quickArray("SELECT dataDefault FROM userProfileField WHERE fieldName='publicProfile'");
($defaultPublicEmail) = $self->session->db->quickArray("SELECT dataDefault FROM userProfileField WHERE fieldName='publicEmail'");
my $paginatePage = $form->param('pn') || 1;
my $currentUrl = $self->getUrl();
foreach ($form->param) {