6.2.6 bugfixes

This commit is contained in:
JT Smith 2004-09-30 01:16:02 +00:00
parent 9e38cb81e0
commit d2a301e02b
24 changed files with 171 additions and 102 deletions

View file

@ -50,9 +50,9 @@ account if possible.
=cut
sub grabReferral {
if ($session{user}{userId} != 1 && $session{user}{referringAffiliate} > 0) {
if ($session{user}{userId} ne "1" && $session{user}{referringAffiliate}) {
return "";
} elsif ($session{user}{userId} != 1 && (($session{user}{referringAffiliate} == 0 && $session{scratch}{referringAffiliate} > 0) || $session{form}{affiliateId} ne "")) {
} elsif ($session{user}{userId} ne "1" && (($session{user}{referringAffiliate} eq "0" && $session{scratch}{referringAffiliate}) || $session{form}{affiliateId})) {
my $u = WebGUI::User->new($session{user}{userId});
$u->referringAffiliate($session{scratch}{referringAffiliate});
} elsif ($session{user}{userId} != 1) {

View file

@ -1728,6 +1728,8 @@ sub www_post {
if ($var->{'newpost.isNewMessage'}) {
$var->{'subscribe.label'} = WebGUI::International::get(873);
return WebGUI::Privilege::insufficient() unless ($forum->canPost);
my $u = WebGUI::User->new($session{user}{userId});
$u->karma($forum->get("karmaPerPost"),"Forum (".$forum->get("forumId").")","Forum Post") if ($session{setting}{useKarma});
if ($forum->isModerator) {
$var->{'lock.label'} = WebGUI::International::get(1012);
$var->{'lock.form'} = WebGUI::Form::yesNo({

View file

@ -416,6 +416,10 @@ our $HELP = {
{
tag => 'settings manage',
namespace => 'WebGUI'
},
{
tag => 'navigation macros',
namespace => 'WebGUI'
}
]
},
@ -470,7 +474,7 @@ our $HELP = {
namespace => 'WebGUI'
},
{
tag => 'navigation macro',
tag => 'navigation macros',
namespace => 'WebGUI'
},
{
@ -691,7 +695,7 @@ our $HELP = {
}
]
},
'navigation macro' => {
'navigation macros' => {
title => '841',
body => '842',
related => [
@ -1060,7 +1064,7 @@ our $HELP = {
body => '1093',
related => [
{
tag => 'navigation macro',
tag => 'navigation macros',
namespace => 'WebGUI'
},
{
@ -1082,7 +1086,7 @@ our $HELP = {
body => '1095',
related => [
{
tag => 'navigation macro',
tag => 'navigation macros',
namespace => 'WebGUI'
},
{
@ -1100,7 +1104,7 @@ our $HELP = {
body => '1097',
related => [
{
tag => 'navigation macro',
tag => 'navigation macros',
namespace => 'WebGUI'
},
{

View file

@ -144,7 +144,7 @@ sub process {
WebGUI::URL::page('op=listUsers')=>WebGUI::International::get(7),
WebGUI::URL::page('op=viewStatistics')=>WebGUI::International::get(144),
WebGUI::URL::page('op=listDatabaseLinks')=>WebGUI::International::get(981),
WebGUI::URL::page('op=listNavigation')=>'Manage navigation.'
WebGUI::URL::page('op=listNavigation')=>WebGUI::International::get("manage navigation","Navigation")
);
} elsif (WebGUI::Grouping::isInGroup(11)) {
%hash = (

View file

@ -24,7 +24,7 @@ sub process {
@param = WebGUI::Macro::getParams($_[0]);
my $append = 'op=makePrintable';
if ($session{env}{REQUEST_URI} =~ /op\=/) {
$append = 'action2='.WebGUI::URL::escape($append);
$append = 'op2='.WebGUI::URL::escape($append);
}
$temp = WebGUI::URL::append($session{env}{REQUEST_URI},$append);
if ($param[1] ne "") {

View file

@ -310,7 +310,7 @@ sub build {
# Some information about my mother
my $mother = WebGUI::Page->getPage($page->{parentId});
if ($page->{parentId} > 0) {
if ($page->{parentId} ne "0") {
foreach (qw(title urlizedTitle parentId pageId)) {
$pageData->{"page.mother.$_"} = $mother->get($_);
}

View file

@ -533,6 +533,7 @@ sub www_manageUsersInGroup {
$output .= '<td class="tableData">'.epochToHuman($row->{expireDate},"%z").'</td></tr>';
}
$output .= '</table>'.WebGUI::Form::formFooter();
$output .= $p->getBarTraditional;
$output .= '<p><h1>'.WebGUI::International::get(976).'</h1>';
$output .= WebGUI::Operation::User::getUserSearchForm("manageUsersInGroup",{gid=>$session{form}{gid}});
my ($userCount) = WebGUI::SQL->quickArray("select count(*) from users");

View file

@ -128,7 +128,7 @@ sub www_editTemplate {
$f = WebGUI::HTMLForm->new;
$f->hidden("op","editTemplateSave");
$f->readOnly($session{form}{tid},WebGUI::International::get(503));
$f->hidden("action2",$session{form}{afterEdit});
$f->raw('<input type="hidden" name="op2" value="'.$session{form}{afterEdit}.' />');
if ($session{form}{tid} eq "new") {
$namespaces = WebGUI::SQL->buildHashRef("select distinct(namespace),namespace
from template order by namespace");
@ -164,7 +164,7 @@ sub www_editTemplateSave {
name=>$session{form}{name},
template=>$session{form}{template}
});
if ($session{form}{action2} eq "") {
if ($session{form}{op2} eq "") {
return www_listTemplates();
} else {
return "";

View file

@ -114,7 +114,7 @@ sub www_addThemeComponentSave {
$id = $2;
my $componentId = WebGUI::Id::generate();
WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id)
values ($session{form}{themeId}, $componentId, ".quote($type).", ".quote($id).")");
values (".quote($session{form}{themeId}).", ".quote($componentId).", ".quote($type).", ".quote($id).")");
}
return www_editTheme();
}
@ -122,7 +122,6 @@ sub www_addThemeComponentSave {
#-------------------------------------------------------------------
sub www_deleteTheme {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9));
return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0);
my $output = helpIcon("theme delete");
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(907).'<p>';
@ -137,15 +136,14 @@ sub www_deleteTheme {
#-------------------------------------------------------------------
sub www_deleteThemeConfirm {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9));
return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0);
my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".$session{form}{themeId});
my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId}));
unless ($theme->{original}) {
WebGUI::SQL->write("delete from collateralFolder where name=".quote($theme->{name}));
my $sth = WebGUI::SQL->read("select type,Id from themeComponent where themeId=".$session{form}{themeId});
my $sth = WebGUI::SQL->read("select type,Id from themeComponent where themeId=".quote($session{form}{themeId}));
while (my $component = $sth->hashRef) {
if ($component->{type} eq "template") {
my ($id,$namespace) = split("_",$component->{id});
WebGUI::SQL->write("delete from template where templateId=".$id
WebGUI::SQL->write("delete from template where templateId=".quote($id)
." and namespace=".quote($namespace));
} else {
my $c = WebGUI::Collateral->new($component->{id});
@ -154,15 +152,14 @@ sub www_deleteThemeConfirm {
}
$sth->finish;
}
WebGUI::SQL->write("delete from theme where themeId=".$session{form}{themeId});
WebGUI::SQL->write("delete from themeComponent where themeId=".$session{form}{themeId});
WebGUI::SQL->write("delete from theme where themeId=".quote($session{form}{themeId}));
WebGUI::SQL->write("delete from themeComponent where themeId=".quote($session{form}{themeId}));
return www_listThemes();
}
#-------------------------------------------------------------------
sub www_deleteThemeComponent {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9));
return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0);
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(908).'<p>';
$output .= '<div align="center"><a href="'.
@ -176,8 +173,7 @@ sub www_deleteThemeComponent {
#-------------------------------------------------------------------
sub www_deleteThemeComponentConfirm {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9));
return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0);
WebGUI::SQL->write("delete from themeComponent where themeComponentId=".$session{form}{themeComponentId});
WebGUI::SQL->write("delete from themeComponent where themeComponentId=".quote($session{form}{themeComponentId}));
return www_editTheme();
}
@ -186,7 +182,7 @@ sub www_editTheme {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9));
my ($output, $theme, $f);
unless($session{form}{themeId} eq "new") {
$theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=$session{form}{themeId}");
$theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId}));
}
$output .= helpIcon("theme add/edit");
$output .= '<h1>'.WebGUI::International::get(902).'</h1>';
@ -219,7 +215,7 @@ sub www_editTheme {
my $query = "select collateral.name as name, themeComponent.themeComponentId as componentId,
collateral.collateralType as componentType from themeComponent, collateral
where collateral.collateralId=themeComponent.id and themeComponent.type=collateral.collateralType
and themeComponent.themeId=$session{form}{themeId} order by name";
and themeComponent.themeId=".quote($session{form}{themeId})." order by name";
my $sth = WebGUI::SQL->read($query);
while (my $component = $sth->hashRef) {
$output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId}
@ -228,11 +224,11 @@ sub www_editTheme {
}
$sth->finish;
$sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent
where type='template' and themeId=".$session{form}{themeId});
where type='template' and themeId=".quote($session{form}{themeId}));
while (my $data = $sth->hashRef) {
my ($templateId,$namespace) = split("_",$data->{id});
my ($name) = WebGUI::SQL->quickArray("select name from template where
templateId=".$templateId." and namespace=".quote($namespace));
templateId=".quote($templateId)." and namespace=".quote($namespace));
$output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId}
.'&themeComponentId='.$data->{themeComponentId})
.' '.$name.' ('.$componentTypes->{template}.'/'.$namespace.')<br>';
@ -248,10 +244,10 @@ sub www_editThemeSave {
if ($session{form}{themeId} eq "new") {
$session{form}{themeId} = WebGUI::Id::generate();
WebGUI::SQL->write("insert into theme (themeId,webguiVersion,original,versionNumber)
values ($session{form}{themeId},".quote($WebGUI::VERSION).",1,0)");
values (".quote($session{form}{themeId}).",".quote($WebGUI::VERSION).",1,0)");
}
WebGUI::SQL->write("update theme set name=".quote($session{form}{name}).", designer=".quote($session{form}{designer}).",
designerURL=".quote($session{form}{designerURL})." where themeId=".$session{form}{themeId});
designerURL=".quote($session{form}{designerURL})." where themeId=".quote($session{form}{themeId}));
if ($session{form}{proceed} eq "addComponent") {
return www_addThemeComponent();
}
@ -266,9 +262,9 @@ sub www_exportTheme {
my $tempId = "theme".$session{form}{themeId};
my $propertyFile = WebGUI::Attachment->new("_theme.properties","temp",$tempId);
WebGUI::SQL->write("update theme set versionNumber=versionNumber+1, webguiVersion=".quote($WebGUI::VERSION)
." where themeId=".$session{form}{themeId});
my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".$session{form}{themeId});
my $sth = WebGUI::SQL->read("select * from themeComponent where themeId=".$session{form}{themeId});
." where themeId=".quote($session{form}{themeId}));
my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId}));
my $sth = WebGUI::SQL->read("select * from themeComponent where themeId=".quote($session{form}{themeId}));
while (my $component = $sth->hashRef) {
my $key = $component->{themeComponentId};
$theme->{components}{$key}{type} = $component->{type};
@ -294,7 +290,7 @@ sub www_exportTheme {
} elsif ($component->{type} eq "template") {
my ($id, $namespace) = split("_",$component->{id});
$theme->{components}{$key}{properties} = WebGUI::SQL->quickHashRef("select * from template
where templateId=".$id." and namespace=".quote($namespace));
where templateId=".quote($id)." and namespace=".quote($namespace));
}
}
$sth->finish;
@ -388,10 +384,10 @@ sub www_importThemeSave {
my $theme = $propertiesFile->getHashref;
my $themeId = WebGUI::Id::generate();
WebGUI::SQL->write("insert into theme (themeId,name,designer,designerURL,webguiVersion,versionNumber,original) values
($themeId, ".quote($theme->{name}).", ".quote($theme->{designer}).", ".quote($theme->{designerURL})
(".quote($themeId).", ".quote($theme->{name}).", ".quote($theme->{designer}).", ".quote($theme->{designerURL})
.", ".quote($theme->{webguiVersion}).", $theme->{versionNumber}, 0)");
my $collateralFolderId = WebGUI::Id::generate();
WebGUI::SQL->write("insert into collateralFolder (collateralFolderId,name,parentId) values ($collateralFolderId,
WebGUI::SQL->write("insert into collateralFolder (collateralFolderId,name,parentId) values (".quote($collateralFolderId).",
".quote($theme->{name}).", 0)");
foreach my $key (keys %{$theme->{components}}) {
my $type = $theme->{components}{$key}{type};
@ -406,7 +402,7 @@ sub www_importThemeSave {
my $id = $theme->{components}{$key}{properties}{$type."Id"};
$id .= "_".$theme->{components}{$key}{properties}{namespace} if ($type eq "template");
WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id)
values ($themeId, ".WebGUI::Id::generate().", ".quote($type).", ".quote($id).")");
values (".quote($themeId).", ".quote(WebGUI::Id::generate()).", ".quote($type).", ".quote($id).")");
} elsif (isIn($type, qw(image file snippet))) {
$theme->{components}{$key}{properties}{collateralFolderId} = $collateralFolderId;
my $c = WebGUI::Collateral->new("new");
@ -414,7 +410,7 @@ sub www_importThemeSave {
$c->saveFromFilesystem($propertiesFile->getNode->getPath.$session{os}{slash}
.$theme->{components}{$key}{properties}{filename});
WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id)
values ($themeId, ".WebGUI::Id::generate().", ".quote($type).", "
values (".quote($themeId).", ".quote(WebGUI::Id::generate()).", ".quote($type).", "
.quote($c->get("collateralId")).")");
}
}
@ -453,7 +449,7 @@ sub www_listThemes {
sub www_viewTheme {
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9));
my ($output, $theme, $f);
$theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=$session{form}{themeId}");
$theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId}));
$output .= '<h1>'.WebGUI::International::get(930).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->readOnly(
@ -485,18 +481,18 @@ sub www_viewTheme {
my $query = "select collateral.name as name, themeComponent.themeComponentId as componentId,
collateral.collateralType as componentType from themeComponent, collateral
where collateral.collateralId=themeComponent.id and themeComponent.type=collateral.collateralType
and themeComponent.themeId=$session{form}{themeId} order by name";
and themeComponent.themeId=".quote($session{form}{themeId})." order by name";
my $sth = WebGUI::SQL->read($query);
while (my $component = $sth->hashRef) {
$output .= $component->{name}.' ('.$componentTypes->{$component->{componentType}}.')<br>';
}
$sth->finish;
$sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent
where type='template' and themeId=".$session{form}{themeId});
where type='template' and themeId=".quote($session{form}{themeId}));
while (my $data = $sth->hashRef) {
my ($templateId,$namespace) = split("_",$data->{id});
my ($name) = WebGUI::SQL->quickArray("select name from template where
templateId=".$templateId." and namespace=".quote($namespace));
templateId=".quote($templateId)." and namespace=".quote($namespace));
$output .= $name.' ('.$componentTypes->{template}.')<br>';
}
$sth->finish;

View file

@ -440,6 +440,7 @@ sub www_editUserGroup {
$output .= '<td class="tableData">'.epochToHuman($row->{expireDate},"%z").'</td></tr>';
}
$output .= '</table>'.WebGUI::Form::formFooter();
$output .= $p->getBarTraditional;
$output .= '<p><h1>'.WebGUI::International::get(605).'</h1>';
$output .= WebGUI::Operation::Group::getGroupSearchForm("editUserGroup",{uid=>$session{form}{uid}});
my ($groupCount) = WebGUI::SQL->quickArray("select count(*) from users");

View file

@ -69,7 +69,7 @@ These subroutines are available from this package:
#-------------------------------------------------------------------
sub _setupSessionVars {
my (%vars, $uid, $encryptedPassword);
my (%vars, $uid);
tie %vars, 'Tie::CPHash';
if ($_[0] ne "") {
%vars = WebGUI::SQL->quickHash("select * from userSession where sessionId=".quote($_[0]));

View file

@ -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);

View file

@ -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 "") {

View file

@ -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")) {

View file

@ -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;

View file

@ -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"));
}

View file

@ -1,6 +1,12 @@
package WebGUI::i18n::English::Navigation;
our $I18N = {
'manage navigation' => {
message => q|Manage Navigation|,
lastUpdated => 1077081255,
context=>q|Used in the Admin Bar|
},
'33' => {
message => q|Error: This identifier is already in use. Please use an unique value.|,
lastUpdated => 1077081255