6.2.6 bugfixes
This commit is contained in:
parent
9e38cb81e0
commit
d2a301e02b
24 changed files with 171 additions and 102 deletions
|
|
@ -12,6 +12,7 @@ package WebGUI::Wobject::EventsCalendar;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::FormProcessor;
|
||||
use WebGUI::HTMLForm;
|
||||
|
|
@ -30,6 +31,14 @@ use WebGUI::Wobject;
|
|||
our @ISA = qw(WebGUI::Wobject);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub deleteCache {
|
||||
my $self = shift;
|
||||
my $cache = WebGUI::Cache->new("EventsCalendar_".$self->wid);
|
||||
$cache->delete;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
my ($sth, $w, @row, $newEventId, $previousRecurringEventId);
|
||||
|
|
@ -233,6 +242,7 @@ sub www_edit {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
$_[0]->SUPER::www_editSave();
|
||||
$_[0]->deleteCache;
|
||||
if ($session{form}{proceed} eq "addEvent") {
|
||||
$session{form}{eid} = "new";
|
||||
return $_[0]->www_editEvent;
|
||||
|
|
@ -308,6 +318,7 @@ sub www_editEvent {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editEventSave {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->deleteCache;
|
||||
my (@startDate, @endDate, $until, @eventId, $i, $recurringEventId);
|
||||
$startDate[0] = WebGUI::FormProcessor::dateTime("startDate");
|
||||
$startDate[0] = time() unless ($startDate[0] > 0);
|
||||
|
|
@ -368,6 +379,9 @@ sub www_editEventSave {
|
|||
sub www_view {
|
||||
$_[0]->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
my ( $junk, $sameDate, $p, @list, $date, $flag, %previous, $maxDate, $minDate);
|
||||
my $cache = WebGUI::Cache->new("EventsCalendar_".$_[0]->wid);
|
||||
my $monthloop = $cache->get;
|
||||
unless (defined $monthloop) {
|
||||
# figure out the date range
|
||||
tie %previous, 'Tie::CPHash';
|
||||
if ($_[0]->get("startMonth") eq "first") {
|
||||
|
|
@ -409,14 +423,7 @@ sub www_view {
|
|||
$session{form}{calPn} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# create template variables
|
||||
my %var;
|
||||
$var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId"));
|
||||
$var{"addevent.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
|
||||
my @monthloop;
|
||||
for (my $i=1;$i<$monthCount;$i++) {
|
||||
# if ($session{form}{calPn} == ($i)) {
|
||||
my $thisMonth = WebGUI::DateTime::addToDate($minDate,0,($i-1),0);
|
||||
my ($monthStart, $monthEnd) = WebGUI::DateTime::monthStartEnd($thisMonth);
|
||||
my @thisMonthDate = WebGUI::DateTime::epochToArray($thisMonth);
|
||||
|
|
@ -506,7 +513,7 @@ sub www_view {
|
|||
});
|
||||
$dayOfWeekCounter++;
|
||||
}
|
||||
push(@monthloop, {
|
||||
push(@$monthloop, {
|
||||
'daysInMonth'=>$daysInMonth,
|
||||
'day_loop'=>\@dayloop,
|
||||
'prepad_loop'=>\@prepad,
|
||||
|
|
@ -514,13 +521,17 @@ sub www_view {
|
|||
'month'=>WebGUI::DateTime::getMonthName($date[1]),
|
||||
'year'=>$date[0]
|
||||
});
|
||||
# }
|
||||
# $row[$i-1] = "page";
|
||||
}
|
||||
$cache->set($monthloop,3600);
|
||||
}
|
||||
# create template variables
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),$_[0]->get("paginateAfter"),"calPn");
|
||||
$p->setDataByArrayRef(\@monthloop);
|
||||
$p->setDataByArrayRef($monthloop);
|
||||
my %var;
|
||||
$var{month_loop} = $p->getPageData;
|
||||
$p->appendTemplateVars(\%var);
|
||||
$var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId"));
|
||||
$var{"addevent.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
|
||||
$var{'sunday.label'} = WebGUI::DateTime::getDayName(7);
|
||||
$var{'monday.label'} = WebGUI::DateTime::getDayName(1);
|
||||
$var{'tuesday.label'} = WebGUI::DateTime::getDayName(2);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ sub _recurseCrumbTrail {
|
|||
my ($sth, %data, $output);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select pageId,parentId,menuTitle,urlizedTitle from page where pageId=".quote($_[0]));
|
||||
if ($data{pageId} > 1) {
|
||||
if ($data{pageId}) {
|
||||
$output .= _recurseCrumbTrail($data{parentId});
|
||||
}
|
||||
if ($data{menuTitle} ne "") {
|
||||
|
|
|
|||
|
|
@ -292,11 +292,11 @@ sub getResponseDrivenQuestionIds {
|
|||
if ($previousResponse->{Survey_answerId}) {
|
||||
($questionId) = WebGUI::SQL->quickArray("select gotoQuestion from Survey_answer where
|
||||
Survey_answerId=".quote($previousResponse->{Survey_answerId}));
|
||||
unless ($questionId > 0) {
|
||||
unless ($questionId) {
|
||||
($questionId) = WebGUI::SQL->quickArray("select gotoQuestion from Survey_question where
|
||||
Survey_questionId=".quote($previousResponse->{Survey_questionId}));
|
||||
}
|
||||
unless ($questionId > 0) { # terminate survey
|
||||
unless ($questionId) { # terminate survey
|
||||
$self->completeResponse($responseId);
|
||||
return ();
|
||||
}
|
||||
|
|
@ -854,12 +854,12 @@ sub www_respond {
|
|||
return "" unless ($session{scratch}{$varname});
|
||||
my $userId = ($self->get("anonymous")) ? substr(md5_hex($session{user}{userId}),0,8) : $session{user}{userId};
|
||||
foreach my $key (keys %{$session{form}}) {
|
||||
if ($key =~ /answerId_(\d+)/) {
|
||||
if ($key =~ /^answerId_(.+)$/) {
|
||||
my $id = $1;
|
||||
my ($previousResponse) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse
|
||||
where Survey_answerId=".quote($session{form}{"answerId_".$id})." and Survey_responseId=".quote($session{scratch}{$varname}));
|
||||
next if ($previousResponse);
|
||||
my $answer = $self->getCollateral("Survey_answer","Survey_answerId",quote($session{form}{"answerId_".$id}));
|
||||
my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$session{form}{"answerId_".$id});
|
||||
my $response = $session{form}{"textResponse_".$id} || $answer->{answer};
|
||||
WebGUI::SQL->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values (
|
||||
".quote($answer->{Survey_answerId}).", ".quote($answer->{Survey_questionId}).", ".quote($session{scratch}{$varname}).", ".quote($answer->{Survey_id}).",
|
||||
|
|
@ -955,7 +955,7 @@ sub www_viewGradebook {
|
|||
$var->{title} = WebGUI::International::get(71,$self->get("namespace"));
|
||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page('func=viewGradebook&wid='.$self->get("wobjectId")));
|
||||
$p->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate from Survey_response
|
||||
where isComplete=1 and Survey_id=".$self->get("Survey_id")." order by username,ipAddress,startDate");
|
||||
where isComplete=1 and Survey_id=".quote($self->get("Survey_id"))." order by username,ipAddress,startDate");
|
||||
my $users = $p->getPageData;
|
||||
($var->{'question.count'}) = WebGUI::SQL->quickArray("select count(*) from Survey_question where Survey_id=".quote($self->get("Survey_id")));
|
||||
if ($var->{'question.count'} > $self->get("questionsPerResponse")) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Wobject::USS;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Attachment;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Forum;
|
||||
use WebGUI::Forum::UI;
|
||||
|
|
@ -59,6 +60,15 @@ sub _xml_encode {
|
|||
return $_[0];
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub deleteCachedSubmission {
|
||||
my $self = shift;
|
||||
my $submissionId = shift;
|
||||
my $cache = WebGUI::Cache->new("USS_submission_".$submissionId);
|
||||
$cache->delete;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
WebGUI::ErrorHandler::warn("USS wobjects cannot be duplicated until after 6.3.");
|
||||
|
|
@ -247,14 +257,16 @@ sub viewSubmissionAsPage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_approveSubmission {
|
||||
my $self = shift;
|
||||
my (%submission);
|
||||
tie %submission, 'Tie::CPHash';
|
||||
if (WebGUI::Grouping::isInGroup(4,$session{user}{userId}) || WebGUI::Grouping::isInGroup(3,$session{user}{userId})) {
|
||||
%submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=".quote($session{form}{sid}));
|
||||
WebGUI::SQL->write("update USS_submission set status='Approved' where USS_submissionId=".quote($session{form}{sid}));
|
||||
WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='.
|
||||
$session{form}{wid}.'&sid='.$session{form}{sid}),4,$_[0]->get("namespace"));
|
||||
$session{form}{wid}.'&sid='.$session{form}{sid}),4,$self->get("namespace"));
|
||||
WebGUI::MessageLog::completeEntry($session{form}{mlog});
|
||||
$self->deleteCachedSubmission;
|
||||
return WebGUI::Operation::www_viewMessageLog();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -269,13 +281,15 @@ sub www_copy {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteFile {
|
||||
my $self = shift;
|
||||
my ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=".quote($session{form}{sid}));
|
||||
if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) {
|
||||
$_[0]->setCollateral("USS_submission","USS_submissionId",{
|
||||
if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) {
|
||||
$self->setCollateral("USS_submission","USS_submissionId",{
|
||||
$session{form}{file}=>'',
|
||||
USS_submissionId=>$session{form}{sid}
|
||||
},0,0);
|
||||
return $_[0]->www_editSubmission();
|
||||
$self->deleteCachedSubmission;
|
||||
return $self->www_editSubmission();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
|
|
@ -283,9 +297,10 @@ sub www_deleteFile {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubmission {
|
||||
my $self = shift;
|
||||
my ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=".quote($session{form}{sid}));
|
||||
if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) {
|
||||
return $_[0]->confirm(WebGUI::International::get(17,$_[0]->get("namespace")),
|
||||
if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) {
|
||||
return $self->confirm(WebGUI::International::get(17,$self->get("namespace")),
|
||||
WebGUI::URL::page('func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}));
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -294,8 +309,9 @@ sub www_deleteSubmission {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubmissionConfirm {
|
||||
my $self = shift;
|
||||
my ($owner, $forumId, $pageId) = WebGUI::SQL->quickArray("select userId,forumId,pageId from USS_submission where USS_submissionId=".quote($session{form}{sid}));
|
||||
if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) {
|
||||
if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) {
|
||||
my ($inUseElsewhere) = WebGUI::SQL->quickArray("select count(*) from USS_submission where forumId=".quote($forumId));
|
||||
unless ($inUseElsewhere > 1) {
|
||||
my $forum = WebGUI::Forum->new($forumId);
|
||||
|
|
@ -303,7 +319,8 @@ sub www_deleteSubmissionConfirm {
|
|||
}
|
||||
my $page = WebGUI::Page->new($pageId);
|
||||
$page->purge;
|
||||
$_[0]->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
||||
$self->deleteCachedSubmission;
|
||||
$self->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
||||
my $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
|
||||
$file->deleteNode;
|
||||
return "";
|
||||
|
|
@ -314,14 +331,16 @@ sub www_deleteSubmissionConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_denySubmission {
|
||||
my $self = shift;
|
||||
my (%submission);
|
||||
tie %submission, 'Tie::CPHash';
|
||||
if (WebGUI::Grouping::isInGroup(4,$session{user}{userId}) || WebGUI::Grouping::isInGroup(3,$session{user}{userId})) {
|
||||
%submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=".quote($session{form}{sid}));
|
||||
WebGUI::SQL->write("update USS_submission set status='Denied' where USS_submissionId=".quote($session{form}{sid}));
|
||||
WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='.
|
||||
$session{form}{wid}.'&sid='.$session{form}{sid}),5,$_[0]->get("namespace"));
|
||||
$session{form}{wid}.'&sid='.$session{form}{sid}),5,$self->get("namespace"));
|
||||
WebGUI::MessageLog::completeEntry($session{form}{mlog});
|
||||
$self->deleteCachedSubmission;
|
||||
return WebGUI::Operation::www_viewMessageLog();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -674,6 +693,7 @@ sub www_editSubmissionSave {
|
|||
my $page = WebGUI::Page->new($submission->{pageId});
|
||||
$page->set(\%pageVars);
|
||||
$_[0]->setCollateral("USS_submission", "USS_submissionId", \%hash, 1, 0, "USS_id", $_[0]->get("USS_id"));
|
||||
$_[0]->deleteCachedSubmission;
|
||||
return $_[0]->www_viewSubmission();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -715,7 +735,7 @@ sub www_view {
|
|||
WebGUI::Style::setLink($var{"rss.url"},{ rel=>'alternate', type=>'application/rss+xml', title=>'RSS' });
|
||||
if ($session{scratch}{search}) {
|
||||
$numResults = $session{scratch}{numResults};
|
||||
$constraints = WebGUI::Search::buildConstraints([qw(USS_submission.username USS_submission.title USS_submission.content)]);
|
||||
$constraints = WebGUI::Search::buildConstraints([qw(USS_submission.username USS_submission.title USS_submission.content USS_submission.userDefined1 USS_submission.userDefined2 USS_submission.userDefined3 USS_submission.userDefined4 USS_submission.userDefined5)]);
|
||||
}
|
||||
if ($constraints ne "") {
|
||||
$constraints = "USS_submission.status='Approved' and ".$constraints;
|
||||
|
|
@ -746,6 +766,9 @@ sub www_view {
|
|||
$i = 0;
|
||||
my $imageURL = "";
|
||||
foreach $row (@$page) {
|
||||
my $cache = WebGUI::Cache->new("USS_submission_".$row->{USS_submissionId});
|
||||
my $submission = $cache->get;
|
||||
unless (defined $submission) {
|
||||
$page->[$i]->{content} = WebGUI::HTML::filter($page->[$i]->{content},$_[0]->get("filterContent"));
|
||||
$page->[$i]->{content} =~ s/\n/\^\-\;/ unless ($page->[$i]->{content} =~ m/\^\-\;/);
|
||||
$page->[$i]->{content} = WebGUI::HTML::format($page->[$i]->{content},$page->[$i]->{contentType});
|
||||
|
|
@ -779,7 +802,7 @@ sub www_view {
|
|||
$inDateRange = 1;
|
||||
}
|
||||
else { $inDateRange = 0; }
|
||||
push (@submission,{
|
||||
$submission = {
|
||||
"submission.id"=>$page->[$i]->{USS_submissionId},
|
||||
"submission.url"=>WebGUI::URL::gateway($page->[$i]->{urlizedTitle}),
|
||||
"submission.content"=>$content[0],
|
||||
|
|
@ -798,7 +821,6 @@ sub www_view {
|
|||
"submission.image"=>$imageURL,
|
||||
"submission.date"=>epochToHuman($page->[$i]->{dateSubmitted}),
|
||||
"submission.date.updated"=>epochToHuman($page->[$i]->{dateUpdated}),
|
||||
"submission.currentUser"=>($session{user}{userId} eq $page->[$i]->{userId} && $session{user}{userId} != 1),
|
||||
"submission.userProfile"=>WebGUI::URL::page('op=viewProfile&uid='.$page->[$i]->{userId}),
|
||||
"submission.edit.url"=>WebGUI::URL::page($quickurl.'editSubmission'),
|
||||
"submission.secondColumn"=>(($i+1)%2==0),
|
||||
|
|
@ -807,7 +829,11 @@ sub www_view {
|
|||
"submission.fifthColumn"=>(($i+1)%5==0),
|
||||
'submission.controls'=>$controls,
|
||||
'submission.inDateRange'=>$inDateRange
|
||||
});
|
||||
};
|
||||
$cache->set($submission,3600);
|
||||
}
|
||||
$submission->{"submission.currentUser"}=($session{user}{userId} eq $submission->{"submission.userId"} && $session{user}{userId} != 1);
|
||||
push(@submission,$submission);
|
||||
$i++;
|
||||
}
|
||||
$var{submissions_loop} = \@submission;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ sub new {
|
|||
-properties => $property,
|
||||
-useMetaData => 1,
|
||||
-extendedProperties => {
|
||||
call => {
|
||||
callMethod => {
|
||||
fieldType => 'textarea',
|
||||
},
|
||||
debugMode => {
|
||||
|
|
@ -165,9 +165,9 @@ sub www_edit {
|
|||
-value => $_[0]->get('proxy'),
|
||||
);
|
||||
$properties->text (
|
||||
-name => 'call',
|
||||
-name => 'callMethod',
|
||||
-label => WebGUI::International::get(4, $_[0]->get('namespace')),
|
||||
-value => $_[0]->get('call'),
|
||||
-value => $_[0]->get('callMethod'),
|
||||
);
|
||||
$properties->textarea (
|
||||
-name => 'params',
|
||||
|
|
@ -262,7 +262,7 @@ sub www_view {
|
|||
|
||||
# snag our SOAP call and preprocess if needed
|
||||
if ($self->get('preprocessMacros')) {
|
||||
$call = WebGUI::Macro::process($self->get("call"));
|
||||
$call = WebGUI::Macro::process($self->get("callMethod"));
|
||||
$param_str = WebGUI::Macro::process($self->get("params"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue