urls as resources - part 1
This commit is contained in:
parent
378e8d6160
commit
23cb5bd41c
9 changed files with 141 additions and 113 deletions
|
|
@ -64,6 +64,9 @@
|
|||
- RFE [ 747859 ] RSS Encoding (Len Kranendonk) NB: Needs perl 5.8.0 or up.
|
||||
- RFE [ 906852 ] Extended forum sorting (Leendert Bottelberghs).
|
||||
- Bugfix [ 998588 ] (Leendert Bottelberghs).
|
||||
- Changed page system to support multiple types of pages and to make URLs
|
||||
resources in WebGUI rather than tied specifically to content pages.
|
||||
|
||||
|
||||
6.1.1
|
||||
- bugfix [ 991313 ] Manage Translations doesn't work
|
||||
|
|
|
|||
|
|
@ -259,17 +259,20 @@ delete from incrementer where incrementerId in ("messageLogId","profileCategoryI
|
|||
alter table forum change postsPerPage threadsPerPage int(11) default 30;
|
||||
alter table forum add postsPerPage int(11) default 10 after threadsPerPage;
|
||||
update page set title='Nameless Root',menuTitle='Nameless Root',urlizedTitle='nameless_root', redirectUrl='/' where pageId=0;
|
||||
create table urls (
|
||||
urlId char(22) not null primary key,
|
||||
url varchar(255) not null unique key,
|
||||
subroutine varchar(255) not null,
|
||||
params text
|
||||
);
|
||||
|
||||
update template set templateId=-1 where templateId=1 and namespace='style';
|
||||
update template set templateId=1 where templateId=2 and namespace='style';
|
||||
update template set templateId=2 where templateId=-1 and namespace='style';
|
||||
update page set styleId=-1 where styleId=1;
|
||||
update page set styleId=1 where styleId=2;
|
||||
update page set styleId=2 where styleId=-1;
|
||||
alter table page drop column id;
|
||||
alter table page add subroutine varchar(255) not null default 'generate';
|
||||
alter table page add subroutinePackage varchar(255) not null default 'WebGUI::Page';
|
||||
alter table page add subroutineParams text;
|
||||
alter table forum add postPreviewTemplateId varchar(22) NULL after postformTemplateId;
|
||||
alter table forum add usePreview int(11) NOT NULL default 1;
|
||||
INSERT INTO template VALUES (1,'Default Post Preview','<h2><tmpl_var newpost.header></h2>\n\n<h1><tmpl_var post.subject></h1>\n\n<table width=\"100%\">\n<tr>\n<td class=\"content\" valign=\"top\">\n<tmpl_var post.message>\n</td>\n</tr>\n</table>\n\n<tmpl_var form.begin>\n<input type=\"button\" value=\"cancel\" onclick=\"window.history.go(-1)\"><tmpl_var form.submit>\n<tmpl_var form.end>\n','Forum/PostPreview',1,1);
|
||||
UPDATE userProfileField SET dataValues = '{\r\n6=>WebGUI::International::get(\'HTMLArea 3\'),\r\n1=>WebGUI::International::get(495), #htmlArea\r\n#2=>WebGUI::International::get(494), #editOnPro2\r\n3=>WebGUI::International::get(887), #midas\r\n4=>WebGUI::International::get(879), #classic\r\n5=>WebGUI::International::get(880),\r\nnone=>WebGUI::International::get(881)\r\n}' WHERE fieldName = 'richEditor';
|
||||
INSERT INTO template VALUES ('6','HTMLArea 3 (Mozilla / IE)','<script language=\"JavaScript\"> \r\nfunction fixChars(element) { \r\nelement.value = element.value.replace(/-/mg,\"-\"); \r\n} \r\n</script> \r\n\r\n<tmpl_if htmlArea3.supported> \r\n\r\n<script type=\"text/javascript\"> \r\n_editor_url = \"<tmpl_var session.config.extrasURL>/htmlArea3/\"; \r\n_editor_lang = \"en\"; \r\n</script> \r\n<script type=\"text/javascript\" src=\"<tmpl_var session.config.extrasURL>/htmlArea3/htmlarea.js\"></script> \r\n<script language=\"JavaScript\"> \r\nHTMLArea.loadPlugin(\"TableOperations\"); \r\nHTMLArea.loadPlugin(\"FullPage\"); \r\nfunction initEditor() { \r\n// create an editor for the textbox \r\neditor = new HTMLArea(\"<tmpl_var form.name>\"); \r\n\r\n// register the FullPage plugin \r\neditor.registerPlugin(FullPage); \r\n\r\n// register the SpellChecker plugin \r\neditor.registerPlugin(TableOperations); \r\n\r\nsetTimeout(function() { \r\neditor.generate(); \r\n}, 500); \r\nreturn false; \r\n} \r\nwindow.setTimeout(\"initEditor()\", 250); \r\n</script> \r\n</tmpl_if> \r\n\r\n<tmpl_var textarea> ','richEditor',1,1);
|
||||
alter table page add encryptPage int(11) default 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ use WebGUI::Privilege;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Style;
|
||||
use WebGUI::Page;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::PassiveProfiling;
|
||||
|
||||
|
|
@ -48,6 +47,36 @@ sub _generatePage {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getPageInfo {
|
||||
my $sql = "select * from page where ";
|
||||
my $url = shift || $ENV{PATH_INFO};
|
||||
$url = lc($url);
|
||||
$url =~ s/\/$//;
|
||||
$url =~ s/^\///;
|
||||
$url =~ s/\'//;
|
||||
$url =~ s/\"//;
|
||||
my $pageData;
|
||||
if ($url ne "") {
|
||||
$pageData = WebGUI::SQL->quickHashRef($sql."urlizedTitle=".quote($url));
|
||||
if ($pageData->{subroutine} eq "") {
|
||||
if($ENV{"MOD_PERL"}) {
|
||||
my $r = Apache->request;
|
||||
if(defined($r)) {
|
||||
$r->custom_response(404, $url);
|
||||
$r->status(404);
|
||||
}
|
||||
} else {
|
||||
$session{http}{status} = '404';
|
||||
}
|
||||
$pageData = WebGUI::SQL->quickHashRef($sql."pageId=".quote($session{setting}{pageNotFound}));
|
||||
}
|
||||
} else {
|
||||
$pageData = WebGUI::SQL->quickHashRef($sql."pageId=".quote($session{setting}{defaultPage}));
|
||||
}
|
||||
$session{page} = $pageData;
|
||||
return $pageData;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _processAction {
|
||||
|
|
@ -82,10 +111,11 @@ sub page {
|
|||
my $webguiRoot = shift;
|
||||
my $configFile = shift;
|
||||
my $useExistingSession = shift; # used for static page generation functions where you may generate more than one page at a time.
|
||||
my $pageUrl = shift;
|
||||
WebGUI::Session::open($webguiRoot,$configFile) unless ($useExistingSession);
|
||||
|
||||
# JT: don't forget to do something with action 2
|
||||
|
||||
my $page = _getPageInfo($pageUrl);
|
||||
my $output = _processOperations();
|
||||
if ($output ne "") {
|
||||
$output = _generatePage($output);
|
||||
|
|
@ -105,7 +135,14 @@ sub page {
|
|||
$output = $cache->get;
|
||||
}
|
||||
unless ($output) {
|
||||
$output = WebGUI::Page::generate();
|
||||
my $cmd = "use ".$page->{subroutinePackage};
|
||||
eval ($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("Couldn't compile page package: ".$page->{subroutinePackage}.". Root cause: ".$@) if ($@);
|
||||
my $params = eval $page->{subroutineParams};
|
||||
WebGUI::ErrorHandler::fatalError("Couldn't interpret page params: ".$page->{subroutineParams}.". Root cause: ".$@) if ($@);
|
||||
$cmd = $page->{subroutinePackage}."::".$page->{subroutine};
|
||||
$output = eval{&$cmd($params)};
|
||||
WebGUI::ErrorHandler::fatalError("Couldn't execute page command: ".$page->{subroutine}.". Root cause: ".$@) if ($@);
|
||||
if (WebGUI::HTTP::getMimeType() eq "text/html") {
|
||||
$output = _generatePage($output);
|
||||
}
|
||||
|
|
@ -116,8 +153,8 @@ sub page {
|
|||
$ttl = $session{page}{cacheTimeout};
|
||||
}
|
||||
$cache->set($output, $ttl) if ($useCache);
|
||||
WebGUI::PassiveProfiling::addPage(); # add wobjects on page to passive profile log
|
||||
}
|
||||
WebGUI::PassiveProfiling::addPage(); # add wobjects on page to passive profile log
|
||||
}
|
||||
WebGUI::Affiliate::grabReferral(); # process affilliate tracking request
|
||||
my $httpHeader = WebGUI::HTTP::getHeader();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ sub generate {
|
|||
# Caching
|
||||
if($self->get('noCache')) {
|
||||
$session{page}{cacheTimeout} = 0;
|
||||
$session{page}{cacheTimeoutVisitor} = 0;
|
||||
$session{page}{cacheTimeoutVisitor} = 0;
|
||||
}
|
||||
|
||||
# Uploads / Extras URL
|
||||
|
|
@ -125,7 +125,7 @@ sub generate {
|
|||
$session{page}{styleId} = $self->get('styleId') || $session{page}{styleId};
|
||||
|
||||
# Generate the page
|
||||
my $content = WebGUI::page(undef, undef, 1);
|
||||
my $content = WebGUI::page(undef, undef, 1, $session{page}{urlizedTitle});
|
||||
|
||||
if($self->get('stripHTML')) {
|
||||
$content = WebGUI::HTML::html2text($content);
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ Returns a thread object for the next (newer) thread in the same forum.
|
|||
sub getNextThread {
|
||||
my ($self) = @_;
|
||||
unless (exists $self->{_next}) {
|
||||
my ($nextId) = WebGUI::SQL->quickArray("select min(lastPostDate) from forumThread where forumId=".quote($self->get("forumId"))."
|
||||
and lastPostDate>".quote($self->get("lastPostDate")),WebGUI::SQL->getSlave);
|
||||
my ($nextId) = WebGUI::SQL->quickArray("select lastPostId from forumThread where forumId=".quote($self->get("forumId"))."
|
||||
and lastPostDate>".quote($self->get("lastPostDate")." order by lastPostDate asc"),WebGUI::SQL->getSlave);
|
||||
$self->{_next} = WebGUI::Forum::Thread->new($nextId);
|
||||
}
|
||||
return $self->{_next};
|
||||
|
|
@ -213,8 +213,8 @@ Returns a thread object for the previous (older) thread in the same forum.
|
|||
sub getPreviousThread {
|
||||
my ($self) = @_;
|
||||
unless (exists $self->{_previous}) {
|
||||
my ($nextId) = WebGUI::SQL->quickArray("select max(lastPostDate) from forumThread where forumId=".quote($self->get("forumId"))."
|
||||
and lastPostDate<".quote($self->get("lastPostDate")),WebGUI::SQL->getSlave);
|
||||
my ($nextId) = WebGUI::SQL->quickArray("select lastPostId from forumThread where forumId=".quote($self->get("forumId"))."
|
||||
and lastPostDate<".quote($self->get("lastPostDate")." order by lastPostDate desc"),WebGUI::SQL->getSlave);
|
||||
$self->{_previous} = WebGUI::Forum::Thread->new($nextId);
|
||||
}
|
||||
return $self->{_previous};
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ package WebGUI::Page;
|
|||
|
||||
=cut
|
||||
|
||||
use warnings;
|
||||
use HTML::Template;
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Grouping;
|
||||
|
|
@ -658,23 +658,24 @@ sub generation {
|
|||
|
||||
=head2 get( property )
|
||||
|
||||
Returns the disired page property.
|
||||
Returns a hash reference of all the page properties.
|
||||
|
||||
=over
|
||||
|
||||
=item property
|
||||
|
||||
The name of the property you wanna have
|
||||
Returns a scalar containing the value of the specififed proeprty.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub get {
|
||||
my ($self, $property);
|
||||
($self, $property) = @_;
|
||||
|
||||
return $self->{_pageProperties}->{$_[1]};
|
||||
my ($self, $property) = @_;
|
||||
if ($property) {
|
||||
return $self->{_pageProperties}->{$property};
|
||||
}
|
||||
return $self->{_pageProperties};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -213,14 +213,15 @@ URL name value pairs (this=that&foo=bar) to be passed with this toggle.
|
|||
=cut
|
||||
|
||||
sub toggleURL {
|
||||
my $pairs = shift;
|
||||
my $url = shift || $session{page}{urlizedTitle};
|
||||
WebGUI::Session::setScratch("search",$session{form}{search});
|
||||
my $url;
|
||||
if ($session{scratch}{search}) {
|
||||
$url = WebGUI::URL::page("search=0");
|
||||
$url = WebGUI::URL::gateway($url,"search=0");
|
||||
} else {
|
||||
$url = WebGUI::URL::page("search=1");
|
||||
$url = WebGUI::URL::gateway($url,"search=1");
|
||||
}
|
||||
$url = WebGUI::URL::append($url,$_[0]) if ($_[0]);
|
||||
$url = WebGUI::URL::append($url,$pairs) if ($pairs);
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,39 +67,6 @@ These subroutines are available from this package:
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _setupPageInfo {
|
||||
my (%page, $pageId, $pageName);
|
||||
tie %page, 'Tie::CPHash';
|
||||
($pageId) = $_[0];
|
||||
if ($pageId eq "") {
|
||||
$pageName = lc($ENV{PATH_INFO});
|
||||
$pageName =~ s/\/$//;
|
||||
$pageName =~ s/\///;
|
||||
$pageName =~ s/\'//;
|
||||
$pageName =~ s/\"//;
|
||||
if ($pageName ne "") {
|
||||
($pageId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle=".quote($pageName));
|
||||
if ($pageId eq "") {
|
||||
$pageId = $session{setting}{notFoundPage};
|
||||
if($ENV{"MOD_PERL"}) {
|
||||
my $r = Apache->request;
|
||||
if(defined($r)) {
|
||||
$r->custom_response(404, $pageName);
|
||||
$r->status(404);
|
||||
}
|
||||
} else {
|
||||
$session{http}{status} = '404';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pageId = $session{setting}{defaultPage};
|
||||
}
|
||||
}
|
||||
%page = WebGUI::SQL->quickHash("select * from page where pageId=".quote($pageId));
|
||||
$session{page} = \%page;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _setupSessionVars {
|
||||
my (%vars, $uid, $encryptedPassword);
|
||||
|
|
@ -402,9 +369,6 @@ sub open {
|
|||
} else {
|
||||
_setupSessionVars($session{cookie}{wgSession});
|
||||
}
|
||||
###----------------------------
|
||||
### current page's properties (from page table)
|
||||
_setupPageInfo("");
|
||||
###----------------------------
|
||||
### current user's account and profile information (from users and userProfileData tables)
|
||||
_setupUserInfo($session{var}{userId});
|
||||
|
|
@ -412,7 +376,7 @@ sub open {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 refreshPageInfo ( [ pageId ] )
|
||||
=head2 refreshPageInfo ( pageId )
|
||||
|
||||
Updates the WebGUI session to reflect new page information.
|
||||
|
||||
|
|
@ -420,15 +384,15 @@ Updates the WebGUI session to reflect new page information.
|
|||
|
||||
=item pageId
|
||||
|
||||
Defaults to the current page. Specify the page id to change this WebGUI session to use.
|
||||
Specify which page you want to change to.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub refreshPageInfo {
|
||||
my $pageId = $_[0];
|
||||
_setupPageInfo($pageId);
|
||||
my $pageId = shift;
|
||||
$session{page} = WebGUI::SQL->quickHashRef("select * from page where pageId=".quote($pageId));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use WebGUI::Id;
|
|||
use WebGUI::International;
|
||||
use WebGUI::MessageLog;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Page;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -38,26 +39,23 @@ use WebGUI::Wobject;
|
|||
|
||||
our @ISA = qw(WebGUI::Wobject);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# format the date according to rfc 822 (for RSS export)
|
||||
my @_months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
||||
sub _get_rfc822_date {
|
||||
my ($time) = @_;
|
||||
|
||||
my ($year, $mon, $mday, $hour, $min, $sec) = WebGUI::DateTime::localtime($time);
|
||||
|
||||
my $month = $_months[$mon - 1];
|
||||
|
||||
return sprintf("%02d %s %04d %02d:%02d:%02d GMT",
|
||||
$mday, $month, $year, $hour, $min, $sec);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# encode a string to include in xml (for RSS export)
|
||||
sub _xml_encode {
|
||||
|
||||
$_[0] =~ s/&/&/g;
|
||||
$_[0] =~ s/</</g;
|
||||
$_[0] =~ s/\]\]>/\]\]>/g;
|
||||
|
||||
return $_[0];
|
||||
}
|
||||
|
||||
|
|
@ -233,6 +231,16 @@ sub status {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# NOTE: Not a method. Used by the page tree.
|
||||
sub viewSubmissionAsPage {
|
||||
my $params = shift;
|
||||
my $properties = WebGUI::SQL->getRow("wobject","wobjectId",$params->{wobjectId});
|
||||
my $w = WebGUI::Wobject::USS->new($properties);
|
||||
return $w->www_viewSubmission($params->{submissionId});
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_approveSubmission {
|
||||
my (%submission);
|
||||
|
|
@ -801,15 +809,18 @@ sub www_viewRSS {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewSubmission {
|
||||
$_[0]->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
return "" unless ($session{form}{sid});
|
||||
my $self = shift;
|
||||
my $submissionId = shift || $session{form}{sid};
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
return "" unless ($submissionId);
|
||||
my ($file, @data, %var, $replies);
|
||||
my $submission = $_[0]->getCollateral("USS_submission","USS_submissionId",$session{form}{sid});
|
||||
my $submission = $self->getCollateral("USS_submission","USS_submissionId",$submissionId);
|
||||
return "" unless ($submission->{USS_submissionId});
|
||||
return "" unless ($submission->{status} eq 'Approved' ||
|
||||
($submission->{userId} == $session{user}{userId} && $session{user}{userId} != 1) ||
|
||||
WebGUI::Grouping::isInGroup($_[0]->getValue("groupToApprove")));
|
||||
my $callback = WebGUI::URL::page("func=viewSubmission&wid=".$_[0]->get("wobjectId")."&sid=".$submission->{USS_submissionId});
|
||||
WebGUI::Grouping::isInGroup($self->getValue("groupToApprove")));
|
||||
my $parentsPage = WebGUI::Page->new($self->get("pageId"));
|
||||
my $callback = WebGUI::URL::gateway($parentsPage->get("urlizedTitle"),"func=viewSubmission&wid=".$self->wid."&sid=".$submission->{USS_submissionId});
|
||||
if ($session{form}{forumOp} ne "" && $session{form}{forumOp} ne "viewForum") {
|
||||
return WebGUI::Forum::UI::forumOp({
|
||||
callback=>$callback,
|
||||
|
|
@ -817,82 +828,90 @@ sub www_viewSubmission {
|
|||
forumId=>$submission->{forumId}
|
||||
});
|
||||
}
|
||||
WebGUI::SQL->write("update USS_submission set views=views+1 where USS_submissionId=".quote($session{form}{sid}));
|
||||
WebGUI::SQL->write("update USS_submission set views=views+1 where USS_submissionId=".quote($submissionId));
|
||||
$var{title} = $submission->{title};
|
||||
$var{content} = WebGUI::HTML::filter($submission->{content},$_[0]->get("filterContent"));
|
||||
$var{content} = WebGUI::HTML::filter($submission->{content},$self->get("filterContent"));
|
||||
$var{content} =~ s/\^\-\;//g;
|
||||
$var{content} = WebGUI::HTML::format($var{content},$submission->{contentType});
|
||||
$var{"user.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
|
||||
$var{"user.label"} = WebGUI::International::get(21,$self->get("namespace"));
|
||||
$var{"user.Profile"} = WebGUI::URL::page('op=viewProfile&uid='.$submission->{userId});
|
||||
$var{"user.Id"} = $submission->{userId};
|
||||
$var{"user.username"} = $submission->{username};
|
||||
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
|
||||
$var{"date.label"} = WebGUI::International::get(13,$self->get("namespace"));
|
||||
$var{"date.epoch"} = $submission->{dateSubmitted};
|
||||
$var{"date.human"} = epochToHuman($submission->{dateSubmitted});
|
||||
$var{"date.updated.label"} = WebGUI::International::get(78,$_[0]->get("namespace"));
|
||||
$var{"date.updated.label"} = WebGUI::International::get(78,$self->get("namespace"));
|
||||
$var{"date.updated.human"} = epochToHuman($submission->{dateUpdated});
|
||||
$var{"date.updated.epoch"} = $submission->{dateUpdated};
|
||||
$var{"status.label"} = WebGUI::International::get(14,$_[0]->get("namespace"));
|
||||
$var{"status.label"} = WebGUI::International::get(14,$self->get("namespace"));
|
||||
$var{"status.status"} = status($submission->{status});
|
||||
$var{"views.label"} = WebGUI::International::get(514);
|
||||
$var{"views.count"} = $submission->{views};
|
||||
$var{canPost} = WebGUI::Grouping::isInGroup($_[0]->get("groupToContribute"));
|
||||
$var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId"));
|
||||
$var{"post.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
|
||||
@data = WebGUI::SQL->quickArray("select max(USS_submissionId) from USS_submission
|
||||
where USS_id=".quote($_[0]->get("USS_id"))." and USS_submissionId<".quote($submission->{USS_submissionId})."
|
||||
and (userId=".quote($submission->{userId})." or status='Approved')",WebGUI::SQL->getSlave);
|
||||
$var{canPost} = WebGUI::Grouping::isInGroup($self->get("groupToContribute"));
|
||||
$var{"post.url"} = WebGUI::URL::gateway($parentsPage->get("urlizedTitle"),'func=editSubmission&sid=new&wid='.$self->wid);
|
||||
$var{"post.label"} = WebGUI::International::get(20,$self->get("namespace"));
|
||||
@data = WebGUI::SQL->quickArray("select USS_submissionId from USS_submission
|
||||
where USS_id=".quote($self->get("USS_id"))." and dateSubmitted<".quote($submission->{USS_submissionId})."
|
||||
and (userId=".quote($submission->{userId})." or status='Approved') order by dateSubmitted desc",WebGUI::SQL->getSlave);
|
||||
$var{"previous.more"} = ($data[0] ne "");
|
||||
$var{"previous.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$data[0].'&wid='.$session{form}{wid});
|
||||
$var{"previous.label"} = WebGUI::International::get(58,$_[0]->get("namespace"));
|
||||
@data = WebGUI::SQL->quickArray("select min(USS_submissionId) from USS_submission
|
||||
if ($var{"previous.more"}) {
|
||||
my $previousSubmission = $self->getCollateral("USS_submission","USS_submissionId",$data[0]);
|
||||
my $previousPage = WebGUI::Page->new($previousSubmission->{pageId});
|
||||
$var{"previous.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$previousPage->get("urlizedTitle").'&wid='.$self->wid);
|
||||
}
|
||||
$var{"previous.label"} = WebGUI::International::get(58,$self->get("namespace"));
|
||||
@data = WebGUI::SQL->quickArray("select USS_submissionId from USS_submission
|
||||
where USS_id=".quote($submission->{USS_id})." and USS_submissionId>".quote($submission->{USS_submissionId})."
|
||||
and (userId=".quote($submission->{userId})." or status='Approved')",WebGUI::SQL->getSlave);
|
||||
and (userId=".quote($submission->{userId})." or status='Approved') order by dateSubmitted asc",WebGUI::SQL->getSlave);
|
||||
$var{"next.more"} = ($data[0] ne "");
|
||||
$var{"next.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$data[0].'&wid='.$session{form}{wid});
|
||||
$var{"next.label"} = WebGUI::International::get(59,$_[0]->get("namespace"));
|
||||
$var{canEdit} = (($submission->{userId} == $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) && $session{user}{userId} != 1);
|
||||
$var{"delete.url"} = WebGUI::URL::page('func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid});
|
||||
$var{"delete.label"} = WebGUI::International::get(37,$_[0]->get("namespace"));
|
||||
$var{"edit.url"} = WebGUI::URL::page('func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid});
|
||||
$var{"edit.label"} = WebGUI::International::get(27,$_[0]->get("namespace"));
|
||||
$var{canChangeStatus} = WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"),$session{user}{userId});
|
||||
$var{"approve.url"} = WebGUI::URL::page('func=approveSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog});
|
||||
if ($var{"next.more"}) {
|
||||
my $nextSubmission = $self->getCollateral("USS_submission","USS_submissionId",$data[0]);
|
||||
my $nextPage = WebGUI::Page->new($nextSubmission->{pageId});
|
||||
$var{"next.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$nextPage->get("urlizedTitle").'&wid='.$self->wid);
|
||||
}
|
||||
$var{"next.label"} = WebGUI::International::get(59,$self->get("namespace"));
|
||||
$var{canEdit} = (($submission->{userId} == $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) && $session{user}{userId} != 1);
|
||||
$var{"delete.url"} = WebGUI::URL::gateway($parentsPage->get("urlizedTitle"),'func=deleteSubmission&wid='.$self->wid.'&sid='.$submissionId);
|
||||
$var{"delete.label"} = WebGUI::International::get(37,$self->get("namespace"));
|
||||
$var{"edit.url"} = WebGUI::URL::page('func=editSubmission&wid='.$self->wid.'&sid='.$submissionId);
|
||||
$var{"edit.label"} = WebGUI::International::get(27,$self->get("namespace"));
|
||||
$var{canChangeStatus} = WebGUI::Grouping::isInGroup($self->get("groupToApprove"),$session{user}{userId});
|
||||
$var{"approve.url"} = WebGUI::URL::page('func=approveSubmission&wid='.$self->wid.'&sid='.$submissionId.'&mlog='.$session{form}{mlog});
|
||||
$var{"approve.label"} = WebGUI::International::get(572);
|
||||
$var{"leave.url"} = WebGUI::URL::page('op=viewMessageLog');
|
||||
$var{"leave.label"} = WebGUI::International::get(573);
|
||||
$var{"deny.url"} = WebGUI::URL::page('func=denySubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog});
|
||||
$var{"deny.url"} = WebGUI::URL::page('func=denySubmission&wid='.$self->wid.'&sid='.$submissionId.'&mlog='.$session{form}{mlog});
|
||||
$var{"deny.label"} = WebGUI::International::get(574);
|
||||
$var{"canReply"} = ($_[0]->get("allowDiscussion"));
|
||||
$var{"canReply"} = ($self->get("allowDiscussion"));
|
||||
$var{"reply.url"} = WebGUI::Forum::UI::formatNewThreadURL($callback,$submission->{forumId});
|
||||
$var{"reply.label"} = WebGUI::International::get(47,$_[0]->get("namespace"));
|
||||
$var{"search.url"} = WebGUI::Search::toggleURL();
|
||||
$var{"reply.label"} = WebGUI::International::get(47,$self->get("namespace"));
|
||||
$var{"search.url"} = WebGUI::Search::toggleURL("",$parentsPage->get("urlizedTitle"));
|
||||
$var{"search.label"} = WebGUI::International::get(364);
|
||||
$var{"back.url"} = WebGUI::URL::page();
|
||||
$var{"back.label"} = WebGUI::International::get(28,$_[0]->get("namespace"));
|
||||
$var{"back.url"} = WebGUI::URL::gateway($parentsPage->get("urlizedTitle"));
|
||||
$var{"back.label"} = WebGUI::International::get(28,$self->get("namespace"));
|
||||
$var{'userDefined1.value'} = $submission->{userDefined1};
|
||||
$var{'userDefined2.value'} = $submission->{userDefined2};
|
||||
$var{'userDefined3.value'} = $submission->{userDefined3};
|
||||
$var{'userDefined4.value'} = $submission->{userDefined4};
|
||||
$var{'userDefined5.value'} = $submission->{userDefined5};
|
||||
if ($submission->{image} ne "") {
|
||||
$file = WebGUI::Attachment->new($submission->{image},$session{form}{wid},$session{form}{sid});
|
||||
$file = WebGUI::Attachment->new($submission->{image},$self->wid,$submissionId);
|
||||
$var{"image.url"} = $file->getURL;
|
||||
$var{"image.thumbnail"} = $file->getThumbnail;
|
||||
}
|
||||
if ($submission->{attachment} ne "") {
|
||||
$file = WebGUI::Attachment->new($submission->{attachment},$session{form}{wid},$session{form}{sid});
|
||||
$file = WebGUI::Attachment->new($submission->{attachment},$self->wid,$submissionId);
|
||||
$var{"attachment.box"} = $file->box;
|
||||
$var{"attachment.url"} = $file->getURL;
|
||||
$var{"attachment.icon"} = $file->getIcon;
|
||||
$var{"attachment.name"} = $file->getFilename;
|
||||
}
|
||||
if ($_[0]->get("allowDiscussion")) {
|
||||
if ($self->get("allowDiscussion")) {
|
||||
$var{"replies"} = WebGUI::Forum::UI::www_viewForum(
|
||||
{callback=>$callback,title=>$submission->{title},forumId=>$submission->{forumId}},
|
||||
$submission->{forumId});
|
||||
}
|
||||
return $_[0]->processTemplate($_[0]->get("submissionTemplateId"),\%var,"USS/Submission");
|
||||
return $self->processTemplate($self->get("submissionTemplateId"),\%var,"USS/Submission");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue