committing first round of GUID changes

This commit is contained in:
JT Smith 2004-08-09 15:45:44 +00:00
parent 0ba6b7c911
commit 48fd2d44e9
48 changed files with 9012 additions and 8870 deletions

View file

@ -29,6 +29,7 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($file, $w);

View file

@ -893,11 +893,11 @@ sub www_process {
and DataForm_fieldId=".quote($row{DataForm_fieldId}));
if ($exists) {
WebGUI::SQL->write("update DataForm_entryData set value=".quote($value)."
where DataForm_entryId=$entryId and DataForm_fieldId=".quote($row{DataForm_fieldId}));
where DataForm_entryId=".quote($entryId)." and DataForm_fieldId=".quote($row{DataForm_fieldId}));
$updating = 1;
} else {
WebGUI::SQL->write("insert into DataForm_entryData (DataForm_entryId,DataForm_fieldId,wobjectId,value) values
($entryId, $row{DataForm_fieldId}, ".$_[0]->get("wobjectId").", ".quote($value).")");
(".quote($entryId).", ".quote($row{DataForm_fieldId}).", ".quote($_[0]->get("wobjectId")).", ".quote($value).")");
}
}
}

View file

@ -41,8 +41,8 @@ sub duplicate {
$row[6] = getNextId("EventsCalendar_recurringId");
$previousRecurringEventId = $row[6];
}
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, ".$w.", ".
quote($row[2]).", ".quote($row[3]).", '".$row[4]."', '".$row[5]."', $row[6])");
WebGUI::SQL->write("insert into EventsCalendar_event values (".quote($newEventId).", ".$w.", ".
quote($row[2]).", ".quote($row[3]).", ".quote($row[4]).", ".quote($row[5]).", ".quote($row[6]).")");
}
$sth->finish;
}
@ -345,7 +345,7 @@ sub www_editEventSave {
$i = 0;
while ($eventId[$i] > 0) {
WebGUI::SQL->write("insert into EventsCalendar_event values ($eventId[$i],
".$_[0]->get("wobjectId").",
".quote($_[0]->get("wobjectId")).",
".quote($session{form}{name}).",
".quote($session{form}{description}).",
$startDate[$i], $endDate[$i], $recurringEventId)");

View file

@ -53,8 +53,8 @@ sub duplicate {
$file->copy($w,$newDownloadId);
$file = WebGUI::Attachment->new($row{alternateVersion2},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w,$newDownloadId);
WebGUI::SQL->write("insert into FileManager_file values ($newDownloadId, ".$w.", ".
quote($row{fileTitle}).", ".quote($row{downloadFile}).", $row{groupToView}, ".
WebGUI::SQL->write("insert into FileManager_file values (".quote($newDownloadId).", ".quote($w).", ".
quote($row{fileTitle}).", ".quote($row{downloadFile}).", ".quote($row{groupToView}).", ".
quote($row{briefSynopsis}).", $row{dateUploaded}, $row{sequenceNumber}, ".
quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).")");
}

View file

@ -1,10 +1,7 @@
package WebGUI::Wobject::IndexedSearch;
#Test to see if Time::HiRes will load.
my $hasTimeHiRes=1;
eval "use Time::HiRes"; $hasTimeHiRes=0 if $@;
use strict;
use Time::HiRes;
use WebGUI::Wobject::IndexedSearch::Search;
use WebGUI::HTMLForm;
use WebGUI::HTML;
@ -256,14 +253,14 @@ sub www_view {
$var{"select_".$self->getValue("paginateAfter")} = "selected";
# Do the search
my $startTime = ($hasTimeHiRes) ? Time::HiRes::time() : time();
my $startTime = Time::HiRes::time();
my $filter = $self->_buildFilter;
my $search = WebGUI::Wobject::IndexedSearch::Search->new($self->getValue('indexName'));
$search->open;
my $results = $search->search($var{query},$filter);
$var{duration} = (($hasTimeHiRes) ? Time::HiRes::time() : time()) - $startTime;
$var{duration} = sprintf("%.3f", $var{duration}) if $hasTimeHiRes; # Duration rounded to 3 decimal places
$var{duration} = Time::HiRes::time() - $startTime;
$var{duration} = sprintf("%.3f", $var{duration}); # Duration rounded to 3 decimal places
# Let's see if the search returned any results
if (defined ($results)) {

View file

@ -206,11 +206,11 @@ sub www_editForumSave {
my ($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from MessageBoard_forums where wobjectId=".$_[0]->get("wobjectId"));
$seq++;
WebGUI::SQL->write("insert into MessageBoard_forums (wobjectId, forumId, title, description, sequenceNumber) values ("
.$_[0]->get("wobjectId").", ".quote($forumId).", ".quote($session{form}{title}).", ".quote($session{form}{description})
.quote($_[0]->get("wobjectId")).", ".quote($forumId).", ".quote($session{form}{title}).", ".quote($session{form}{description})
.", ".$seq.")");
} else {
WebGUI::SQL->write("update MessageBoard_forums set title=".quote($session{form}{title}).", description="
.quote($session{form}{description})." where forumId=".quote($forumId)." and wobjectId=".$_[0]->get("wobjectId"));
.quote($session{form}{description})." where forumId=".quote($forumId)." and wobjectId=".quote($_[0]->get("wobjectId")));
}
return "";
}

View file

@ -42,7 +42,7 @@ sub duplicate {
$w = $_[0]->SUPER::duplicate($_[1]);
$sth = WebGUI::SQL->read("select * from Poll_answer where wobjectId=".$_[0]->get("wobjectId"));
while (@row = $sth->array) {
WebGUI::SQL->write("insert into Poll_answer values (".$w.", '$row[1]', $row[2], '$row[3]')");
WebGUI::SQL->write("insert into Poll_answer values (".quote($w).", ".quote($row[1]).", ".quote($row[2]).", ".quote($row[3]).")");
}
$sth->finish;
}
@ -281,8 +281,8 @@ sub www_view {
sub www_vote {
my $u;
if ($session{form}{answer} ne "" && WebGUI::Grouping::isInGroup($_[0]->get("voteGroup"),$session{user}{userId}) && !($_[0]->_hasVoted())) {
WebGUI::SQL->write("insert into Poll_answer values (".$_[0]->get("wobjectId").",
".quote($session{form}{answer}).", $session{user}{userId}, '$session{env}{REMOTE_ADDR}')");
WebGUI::SQL->write("insert into Poll_answer values (".quote($_[0]->get("wobjectId")).",
".quote($session{form}{answer}).", ".quote($session{user}{userId}).", '$session{env}{REMOTE_ADDR}')");
if ($session{setting}{useKarma}) {
$u = WebGUI::User->new($session{user}{userId});
$u->karma($_[0]->get("karmaPerVote"),$_[0]->get("namespace")." (".$_[0]->get("wobjectId").")","Voted on this poll.");

View file

@ -62,14 +62,14 @@ sub duplicate {
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_accessory where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
WebGUI::SQL->write("insert into Product_accessory values (".$w->get("wobjectId").",
$data{accessoryWobjectId}, $data{sequenceNumber})");
WebGUI::SQL->write("insert into Product_accessory values (".quote($w->get("wobjectId")).",
".quote($data{accessoryWobjectId}).", $data{sequenceNumber})");
}
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_related where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
WebGUI::SQL->write("insert into Product_related values (".$w->get("wobjectId").",
$data{relatedWobjectId}, $data{sequenceNumber})");
WebGUI::SQL->write("insert into Product_related values (".quote($w->get("wobjectId")).",
".quote($data{relatedWobjectId}).", $data{sequenceNumber})");
}
$sth->finish;
}
@ -187,12 +187,13 @@ sub www_addAccessory {
#-------------------------------------------------------------------
sub www_addAccessorySave {
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
return "" unless ($session{form}{accessoryWobjectId});
$session{page}{useAdminStyle} = 1;
my ($seq);
($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from Product_accessory
where wobjectId=".$_[0]->get("wobjectId"));
WebGUI::SQL->write("insert into Product_accessory (wobjectId,accessoryWobjectId,sequenceNumber) values
(".$_[0]->get("wobjectId").",".quote($session{form}{accessoryWobjectId}).",".($seq+1).")");
(".quote($_[0]->get("wobjectId")).",".quote($session{form}{accessoryWobjectId}).",".($seq+1).")");
if ($session{form}{proceed}) {
return $_[0]->www_addAccessory();
} else {
@ -224,11 +225,12 @@ sub www_addRelated {
#-------------------------------------------------------------------
sub www_addRelatedSave {
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
return "" unless ($session{form}{relatedWobjectId});
my ($seq);
($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from Product_related
where wobjectId=".$_[0]->get("wobjectId"));
WebGUI::SQL->write("insert into Product_related (wobjectId,relatedWobjectId,sequenceNumber) values
(".$_[0]->get("wobjectId").",".quote($session{form}{relatedWobjectId}).",".($seq+1).")");
(".quote($_[0]->get("wobjectId")).",".quote($session{form}{relatedWobjectId}).",".($seq+1).")");
if ($session{form}{proceed}) {
return $_[0]->www_addRelated();
} else {

View file

@ -854,7 +854,7 @@ sub www_respond {
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 (
".$answer->{Survey_answerId}.", ".$answer->{Survey_questionId}.", ".$session{scratch}{$varname}.", ".$answer->{Survey_id}.",
".quote($answer->{Survey_answerId}).", ".quote($answer->{Survey_questionId}).", ".quote($session{scratch}{$varname}).", ".quote($answer->{Survey_id}).",
".quote($session{form}{"comment_".$id}).", ".quote($response).", ".WebGUI::DateTime::time().")");
}
}

View file

@ -62,23 +62,19 @@ sub _xml_encode {
#-------------------------------------------------------------------
sub duplicate {
my ($sth, $file, %row, $newSubmissionId, $w);
my %row;
tie %row, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1],1);
my $props = WebGUI::SQL->quickHashRef("select * from wobject where wobjectId=$w");
my $newWobject = WebGUI::Wobject::USS->new($props);
$sth = WebGUI::SQL->read("select * from USS_submission where USS_id=".$_[0]->get("USS_id"));
my $w = $_[0]->SUPER::duplicate($_[1],1);
$w = WebGUI::Wobject::USS->new({wobjectId=>$w});
my $sth = WebGUI::SQL->read("select * from USS_submission where USS_id=".$_[0]->get("USS_id"));
while (%row = $sth->hash) {
$newSubmissionId = getNextId("USS_submissionId");
$file = WebGUI::Attachment->new($row{image},$_[0]->get("wobjectId"),$row{USS_submissionId});
my $newSubmissionId = getNextId("USS_submissionId");
my $file = WebGUI::Attachment->new($row{image},$_[0]->get("wobjectId"),$row{USS_submissionId});
$file->copy($w,$newSubmissionId);
$file = WebGUI::Attachment->new($row{attachment},$_[0]->get("wobjectId"),$row{USS_submissionId});
$file->copy($w,$newSubmissionId);
WebGUI::SQL->write("insert into USS_submission (USS_submissionId, title, dateSubmitted, username, userId, content,
image, attachment, status, views, forumId, dateUpdated, sequenceNumber, USS_id, contentType) values ($newSubmissionId, ".
quote($row{title}).", $row{dateSubmitted}, ".quote($row{username}).", $row{userId}, ".quote($row{content}).", ".
quote($row{image}).", ".quote($row{attachment}).", '$row{status}', $row{views}, $row{forumId}, $row{dateUpdated},
$row{sequenceNumber}, ".$newWobject->get("USS_id").", ".quote($row{contentType}).")");
$row{USS_submissionId} = $newSubmissionId;
$w->setCollateral("USS_submission","USS_submissionId",\%row);
}
$sth->finish;
}
@ -199,7 +195,7 @@ sub new {
defaultValue=>"desc"
},
USS_id=>{
autoIncrement=>1
autoId=>1
},
submissionFormTemplateId=>{
defaultValue=>1

View file

@ -122,6 +122,12 @@ sub new {
}
#-------------------------------------------------------------------
sub uiLevel {
return 9;
}
#-------------------------------------------------------------------
sub www_edit {
my $layout = WebGUI::HTMLForm->new;