USS display is now working...still a ways to go to make it perfect
This commit is contained in:
parent
2e893f053b
commit
b322296e0c
3 changed files with 74 additions and 38 deletions
|
|
@ -6,6 +6,7 @@ use File::Path;
|
||||||
use File::Copy;
|
use File::Copy;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
use strict;
|
use strict;
|
||||||
|
use WebGUI::HTML;
|
||||||
use WebGUI::Id;
|
use WebGUI::Id;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::SQL;
|
use WebGUI::SQL;
|
||||||
|
|
@ -193,9 +194,9 @@ WebGUI::SQL->write("alter table USS_submission drop column USS_id");
|
||||||
WebGUI::SQL->write("alter table USS_submission drop column endDate");
|
WebGUI::SQL->write("alter table USS_submission drop column endDate");
|
||||||
WebGUI::SQL->write("alter table USS_submission drop column USS_submissionId");
|
WebGUI::SQL->write("alter table USS_submission drop column USS_submissionId");
|
||||||
WebGUI::SQL->write("alter table USS_submission drop column pageId");
|
WebGUI::SQL->write("alter table USS_submission drop column pageId");
|
||||||
WebGUI::SQL->write("alter table USS_submission drop column content");
|
|
||||||
WebGUI::SQL->write("alter table USS_submission drop column image");
|
WebGUI::SQL->write("alter table USS_submission drop column image");
|
||||||
WebGUI::SQL->write("alter table USS_submission drop column attachment");
|
WebGUI::SQL->write("alter table USS_submission drop column attachment");
|
||||||
|
WebGUI::SQL->write("alter table USS_submission add primary key (assetId)");
|
||||||
WebGUI::SQL->write("alter table Product_accessory drop column wobjectId");
|
WebGUI::SQL->write("alter table Product_accessory drop column wobjectId");
|
||||||
WebGUI::SQL->write("alter table Product_benefit drop column wobjectId");
|
WebGUI::SQL->write("alter table Product_benefit drop column wobjectId");
|
||||||
WebGUI::SQL->write("alter table Product_feature drop column wobjectId");
|
WebGUI::SQL->write("alter table Product_feature drop column wobjectId");
|
||||||
|
|
@ -1000,6 +1001,7 @@ sub walkTree {
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
rmtree($session{config}{uploadsPath}.'/'.$wobject->{wobjectId});
|
rmtree($session{config}{uploadsPath}.'/'.$wobject->{wobjectId});
|
||||||
} elsif ($wobject->{namespace} eq "Product") {
|
} elsif ($wobject->{namespace} eq "Product") {
|
||||||
|
print "\t\t\tMigrating information for Product ".$wobject->{wobjectId}."\n" unless ($quiet);
|
||||||
my ($newProductStoreId);
|
my ($newProductStoreId);
|
||||||
# do a check to see if they've installed Image::Magick
|
# do a check to see if they've installed Image::Magick
|
||||||
my $hasImageMagick = 1;
|
my $hasImageMagick = 1;
|
||||||
|
|
@ -1039,6 +1041,7 @@ sub walkTree {
|
||||||
WebGUI::SQL->write("update $table set assetId=".quote($wobjectId)." where wobjectId=".quote($wobject->{wobjectId}));
|
WebGUI::SQL->write("update $table set assetId=".quote($wobjectId)." where wobjectId=".quote($wobject->{wobjectId}));
|
||||||
}
|
}
|
||||||
} elsif ($wobject->{namespace} eq "USS") {
|
} elsif ($wobject->{namespace} eq "USS") {
|
||||||
|
print "\t\t\tMigrating submissions for USS ".$wobject->{wobjectId}."\n" unless ($quiet);
|
||||||
#| dateSubmitted | int(11) | YES | | NULL | |
|
#| dateSubmitted | int(11) | YES | | NULL | |
|
||||||
#| username | varchar(30) | YES | | NULL | |
|
#| username | varchar(30) | YES | | NULL | |
|
||||||
#| userId | varchar(22) | YES | | NULL | |
|
#| userId | varchar(22) | YES | | NULL | |
|
||||||
|
|
@ -1062,29 +1065,37 @@ sub walkTree {
|
||||||
#| content | text | YES | | NULL | |
|
#| content | text | YES | | NULL | |
|
||||||
#| image | varchar(255) | YES | | NULL | |
|
#| image | varchar(255) | YES | | NULL | |
|
||||||
#| attachment | varchar(255) | YES | | NULL | |
|
#| attachment | varchar(255) | YES | | NULL | |
|
||||||
my $sth = WebGUI::SQL->read("select * from USS_submission where USS_id=".quote($wobject->{USS_id}));
|
my ($ussId) = WebGUI::SQL->quickArray("select USS_id from USS where wobjectId=".quote($wobject->{wobjectId}));
|
||||||
|
my $sth = WebGUI::SQL->read("select * from USS_submission where USS_id=".quote($ussId));
|
||||||
|
my $usssubrank = 1;
|
||||||
while (my $submission = $sth->hashRef) {
|
while (my $submission = $sth->hashRef) {
|
||||||
|
print "\t\t\t\tMigrating submission ".$submission->{USS_submissionId}."\n" unless ($quiet);
|
||||||
|
my $body = $submission->{content};
|
||||||
|
$body =~ s/\n/\^\-\;/ unless ($body =~ m/\^\-\;/);
|
||||||
|
my @content = split(/\^\-\;/,$body);
|
||||||
|
$content[0] = WebGUI::HTML::filter($content[0],"none");
|
||||||
|
$body =~ s/\^\-\;/\n/;
|
||||||
my $id = WebGUI::SQL->setRow("asset","assetId",{
|
my $id = WebGUI::SQL->setRow("asset","assetId",{
|
||||||
|
assetId => "new",
|
||||||
title => $submission->{title},
|
title => $submission->{title},
|
||||||
menuTitle => $submission->{title},
|
menuTitle => $submission->{title},
|
||||||
startDate => $submission->{startDate},
|
startDate => $submission->{startDate},
|
||||||
endDate => $submission->{endDate},
|
endDate => $submission->{endDate},
|
||||||
url => fixUrl($wobjectId,$submission->{title}),
|
url => fixUrl('notknownyet',$submission->{title}),
|
||||||
className=>'WebGUI::Asset::Wobject::USS_submission',
|
className=>'WebGUI::Asset::USS_submission',
|
||||||
state=>'published',
|
state=>'published',
|
||||||
ownerUserId=>$submission->{userId},
|
ownerUserId=>$submission->{userId},
|
||||||
groupIdView=>,
|
groupIdView=>$page->{groupIdView},
|
||||||
groupIdEdit=>,
|
groupIdEdit=>$page->{groupIdEdit},
|
||||||
synopsis=>,
|
synopsis=>$content[0],
|
||||||
fileSize=>length($submission->{content}),
|
assetSize=>length($submission->{content}),
|
||||||
parentId=>$wobjectId,
|
parentId=>$wobjectId,
|
||||||
lineage=>$wobjectLineage.sprintf("%06d",1),
|
lineage=>$wobjectLineage.sprintf("%06d",$usssubrank),
|
||||||
isHidden => 1
|
isHidden => 1
|
||||||
});
|
});
|
||||||
WebGUI::SQL->setRow("wobject","assetId",{
|
WebGUI::SQL->write("update USS_submission set content=".quote($body).",
|
||||||
description => $submission->{content}
|
assetId=".quote($id)." where USS_submissionId=".quote($submission->{USS_submissionId}));
|
||||||
}, undef, $id);
|
$usssubrank++;
|
||||||
WebGUI::SQL->write("update USS_submission set assetId=".quote($id)." where USS_id=".quote($wobject->{USS_id}));
|
|
||||||
}
|
}
|
||||||
# migrate master forum
|
# migrate master forum
|
||||||
# migrate submissions
|
# migrate submissions
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,12 @@ package WebGUI::Asset::USS_submission;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Tie::CPHash;
|
use Tie::CPHash;
|
||||||
|
use WebGUI::Asset;
|
||||||
|
use WebGUI::Asset::Template;
|
||||||
|
use WebGUI::Asset::Wobject::USS;
|
||||||
use WebGUI::DateTime;
|
use WebGUI::DateTime;
|
||||||
use WebGUI::Forum;
|
#use WebGUI::Forum;
|
||||||
use WebGUI::Forum::UI;
|
#use WebGUI::Forum::UI;
|
||||||
use WebGUI::Grouping;
|
use WebGUI::Grouping;
|
||||||
use WebGUI::HTML;
|
use WebGUI::HTML;
|
||||||
use WebGUI::HTMLForm;
|
use WebGUI::HTMLForm;
|
||||||
|
|
@ -29,12 +32,9 @@ use WebGUI::Privilege;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::SQL;
|
use WebGUI::SQL;
|
||||||
use WebGUI::Style;
|
use WebGUI::Style;
|
||||||
use WebGUI::Template;
|
|
||||||
use WebGUI::URL;
|
use WebGUI::URL;
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use WebGUI::Asset;
|
|
||||||
use WebGUI::Asset::Wobject::USS;
|
|
||||||
|
|
||||||
our @ISA = qw(WebGUI::Asset);
|
our @ISA = qw(WebGUI::Asset);
|
||||||
|
|
||||||
|
|
@ -112,7 +112,8 @@ sub definition {
|
||||||
userDefined5 => {
|
userDefined5 => {
|
||||||
fieldType=>"text",
|
fieldType=>"text",
|
||||||
defaultValue=>undef
|
defaultValue=>undef
|
||||||
},
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return $class->SUPER::definition($definition);
|
return $class->SUPER::definition($definition);
|
||||||
}
|
}
|
||||||
|
|
@ -126,11 +127,31 @@ sub getIcon {
|
||||||
return $session{config}{extrasURL}.'/assets/userSubmissionSystem.gif';
|
return $session{config}{extrasURL}.'/assets/userSubmissionSystem.gif';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub getImageUrl {
|
||||||
|
return '/image.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub getName {
|
sub getName {
|
||||||
return "USS Submission";
|
return "USS Submission";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub getResponseCount {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub getStatus {
|
||||||
|
return 'Approved';
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub getThumbnailUrl {
|
||||||
|
return '/thumbnail.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub processPropertiesFromFormPost {
|
sub processPropertiesFromFormPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
@ -143,13 +164,13 @@ sub processPropertiesFromFormPost {
|
||||||
$data{startDate} = $self->getParent->get("startDate") unless ($session{form}{startDate});
|
$data{startDate} = $self->getParent->get("startDate") unless ($session{form}{startDate});
|
||||||
$data{endDate} = $self->getParent->get("endDate") unless ($session{form}{endDate});
|
$data{endDate} = $self->getParent->get("endDate") unless ($session{form}{endDate});
|
||||||
unless ($session{form}{synopsis}) {
|
unless ($session{form}{synopsis}) {
|
||||||
my $body = $session{form}{description};
|
my $body = $session{form}{content};
|
||||||
$body =~ s/\n/\^\-\;/ unless ($body =~ m/\^\-\;/);
|
$body =~ s/\n/\^\-\;/ unless ($body =~ m/\^\-\;/);
|
||||||
my @content = split(/\^\-\;/,$body);
|
my @content = split(/\^\-\;/,$body);
|
||||||
$content[0] = WebGUI::HTML::filter($content[0],"none");
|
$content[0] = WebGUI::HTML::filter($content[0],"none");
|
||||||
$data{synopsis} = $content[0];
|
$data{synopsis} = $content[0];
|
||||||
$body =~ s/\^\-\;/\n/;
|
$body =~ s/\^\-\;/\n/;
|
||||||
$data{description} = $body;
|
$data{content} = $body;
|
||||||
}
|
}
|
||||||
$self->update(\%data);
|
$self->update(\%data);
|
||||||
}
|
}
|
||||||
|
|
@ -270,7 +291,7 @@ sub view {
|
||||||
{callback=>$callback,title=>$submission->{title},forumId=>$submission->{forumId}},
|
{callback=>$callback,title=>$submission->{title},forumId=>$submission->{forumId}},
|
||||||
$submission->{forumId});
|
$submission->{forumId});
|
||||||
}
|
}
|
||||||
return $self->processTemplate(\%var,"USS/Submission",$self->get("submissionTemplateId"));
|
return $self->processTemplate(\%var,$self->get("submissionTemplateId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -306,8 +327,8 @@ sub www_edit {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||||
my %var;
|
my %var;
|
||||||
if ($submission->{USS_submissionId} eq "new") {
|
if ($session{form}{func} eq "add") {
|
||||||
$submission->{contentType} = "mixed";
|
$self->{_properties}{contentType} = "mixed";
|
||||||
$var{'submission.isNew'} = 1;
|
$var{'submission.isNew'} = 1;
|
||||||
}
|
}
|
||||||
$var{'link.header.label'} = WebGUI::International::get(90,"USS");
|
$var{'link.header.label'} = WebGUI::International::get(90,"USS");
|
||||||
|
|
@ -367,14 +388,14 @@ sub www_edit {
|
||||||
$var{'body.label'} = WebGUI::International::get(31,"USS");
|
$var{'body.label'} = WebGUI::International::get(31,"USS");
|
||||||
$var{'answer.label'} = WebGUI::International::get(86,"USS");
|
$var{'answer.label'} = WebGUI::International::get(86,"USS");
|
||||||
$var{'description.label'} = WebGUI::International::get(85);
|
$var{'description.label'} = WebGUI::International::get(85);
|
||||||
$var{'body.value'} = $self->get("description");
|
$var{'body.value'} = $self->get("content");
|
||||||
$var{'body.form'} = WebGUI::Form::HTMLArea({
|
$var{'body.form'} = WebGUI::Form::HTMLArea({
|
||||||
name=>"body",
|
name=>"body",
|
||||||
value=>$self->get("description")
|
value=>$self->get("content")
|
||||||
});
|
});
|
||||||
$var{'body.form.textarea'} = WebGUI::Form::textarea({
|
$var{'body.form.textarea'} = WebGUI::Form::textarea({
|
||||||
name=>"body",
|
name=>"body",
|
||||||
value=>$self->get("description")
|
value=>$self->get("content")
|
||||||
});
|
});
|
||||||
# $var{'image.label'} = WebGUI::International::get(32,"USS");
|
# $var{'image.label'} = WebGUI::International::get(32,"USS");
|
||||||
# if ($submission->{image} ne "") {
|
# if ($submission->{image} ne "") {
|
||||||
|
|
@ -411,11 +432,11 @@ sub www_edit {
|
||||||
});
|
});
|
||||||
$var{'form.submit'} = WebGUI::Form::submit();
|
$var{'form.submit'} = WebGUI::Form::submit();
|
||||||
$var{'form.footer'} = WebGUI::Form::formFooter();
|
$var{'form.footer'} = WebGUI::Form::formFooter();
|
||||||
return $self->getParent->processStyle($self->processTemplate(\%var,"USS/SubmissionForm",$self->getParent->get("submissionFormTemplate")));
|
return $self->getParent->processStyle($self->processTemplate(\%var,$self->getParent->get("submissionFormTemplate")));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_editSave {
|
sub www_editSave2 {
|
||||||
my ($submission, %hash, $file, $u);
|
my ($submission, %hash, $file, $u);
|
||||||
$submission = $_[0]->getCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
$submission = $_[0]->getCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
||||||
if ($submission->{userId} eq $session{user}{userId}
|
if ($submission->{userId} eq $session{user}{userId}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ use WebGUI::Style;
|
||||||
use WebGUI::URL;
|
use WebGUI::URL;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use WebGUI::Asset::Wobject;
|
use WebGUI::Asset::Wobject;
|
||||||
|
use WebGUI::Asset::USS_submission;
|
||||||
|
|
||||||
our @ISA = qw(WebGUI::Asset::Wobject);
|
our @ISA = qw(WebGUI::Asset::Wobject);
|
||||||
|
|
||||||
|
|
@ -50,6 +51,7 @@ sub _xml_encode {
|
||||||
return $_[0];
|
return $_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
sub definition {
|
sub definition {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $definition = shift;
|
my $definition = shift;
|
||||||
|
|
@ -315,7 +317,7 @@ sub view {
|
||||||
my $constraints;
|
my $constraints;
|
||||||
if ($session{scratch}{search}) {
|
if ($session{scratch}{search}) {
|
||||||
$numResults = $session{scratch}{numResults};
|
$numResults = $session{scratch}{numResults};
|
||||||
$constraints = WebGUI::Search::buildConstraints([qw(USS_submission.username asset.title wobject.description USS_submission.userDefined1 USS_submission.userDefined2 USS_submission.userDefined3 USS_submission.userDefined4 USS_submission.userDefined5)]);
|
$constraints = WebGUI::Search::buildConstraints([qw(USS_submission.username asset.synopsis asset.title USS_submission.content USS_submission.userDefined1 USS_submission.userDefined2 USS_submission.userDefined3 USS_submission.userDefined4 USS_submission.userDefined5)]);
|
||||||
}
|
}
|
||||||
if ($constraints ne "") {
|
if ($constraints ne "") {
|
||||||
$constraints = "USS_submission.status='Approved' and ".$constraints;
|
$constraints = "USS_submission.status='Approved' and ".$constraints;
|
||||||
|
|
@ -326,16 +328,18 @@ sub view {
|
||||||
}
|
}
|
||||||
$constraints .= ")";
|
$constraints .= ")";
|
||||||
}
|
}
|
||||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page('func=view'),$numResults);
|
my $p = WebGUI::Paginator->new($self->getUrl,$numResults);
|
||||||
$p->setDataByQuery("select * from USS_submission left join asset on USS_submission.assetId=asset.assetId
|
my $sql = "select * from USS_submission left join asset on USS_submission.assetId=asset.assetId
|
||||||
where asset.parentId=".quote($self->getId)." and asset.className='WebGUI:Asset::Wobject::USS_submission' and $constraints
|
where asset.parentId=".quote($self->getId)." and asset.className='WebGUI::Asset::USS_submission' and $constraints
|
||||||
order by ".$self->getValue("sortBy")." ".$self->getValue("sortOrder"));
|
order by ".$self->getValue("sortBy")." ".$self->getValue("sortOrder");
|
||||||
|
WebGUI::ErrorHandler::warn($sql);
|
||||||
|
$p->setDataByQuery($sql);
|
||||||
my $page = $p->getPageData;
|
my $page = $p->getPageData;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my $imageURL = "";
|
my $imageURL = "";
|
||||||
foreach my $row (@$page) {
|
foreach my $row (@$page) {
|
||||||
my $submission = WebGUI::Asset::Wobject::USS_submission->newByPropertyHashRef($row);
|
my $submission = WebGUI::Asset::USS_submission->newByPropertyHashRef($row);
|
||||||
my $body = WebGUI::HTML::filter($submission->get("description"),$self->get("filterContent"));
|
my $body = WebGUI::HTML::filter($submission->get("content"),$self->get("filterContent"));
|
||||||
$body = WebGUI::HTML::format($body,$submission->get("contentType"));
|
$body = WebGUI::HTML::format($body,$submission->get("contentType"));
|
||||||
my $controls = deleteIcon('func=delete',$submission->getUrl,WebGUI::International::get(17,"USS")).editIcon('func=edit',$submission->getUrl);
|
my $controls = deleteIcon('func=delete',$submission->getUrl,WebGUI::International::get(17,"USS")).editIcon('func=edit',$submission->getUrl);
|
||||||
if ($self->get("sortBy") eq "lineage") {
|
if ($self->get("sortBy") eq "lineage") {
|
||||||
|
|
@ -354,8 +358,8 @@ sub view {
|
||||||
push(@{$var{submissions_loop}}, {
|
push(@{$var{submissions_loop}}, {
|
||||||
"submission.id"=>$submission->getId,
|
"submission.id"=>$submission->getId,
|
||||||
"submission.url"=>$submission->getUrl,
|
"submission.url"=>$submission->getUrl,
|
||||||
"submission.content"=>$submission->{synopsis},
|
"submission.content"=>$submission->get("synopsis"),
|
||||||
"submission.content.full"=>$submission->{description},
|
"submission.content.full"=>$submission->get("content"),
|
||||||
"submission.responses"=>$submission->getResponseCount,
|
"submission.responses"=>$submission->getResponseCount,
|
||||||
"submission.title"=>$submission->get("title"),
|
"submission.title"=>$submission->get("title"),
|
||||||
"submission.userDefined1"=>$submission->get("userDefined1"),
|
"submission.userDefined1"=>$submission->get("userDefined1"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue