fixing navigation
This commit is contained in:
parent
d67b97c18b
commit
63345d79fe
6 changed files with 529 additions and 261 deletions
|
|
@ -130,8 +130,80 @@ WebGUI::SQL->write("alter table Article drop column attachment");
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
print "\tUpdating navigation to work with asset tree\n" unless ($quiet);
|
||||
WebGUI::SQL->write("alter table Navigation add column assetsToInclude text");
|
||||
WebGUI::SQL->write("alter table Navigation add column startType varchar(35)");
|
||||
WebGUI::SQL->write("alter table Navigation add column startPoint varchar(35)");
|
||||
WebGUI::SQL->write("alter table Navigation add column baseType varchar(35)");
|
||||
WebGUI::SQL->write("alter table Navigation add column basePage varchar(255)");
|
||||
WebGUI::SQL->write("alter table Navigation add column endType varchar(35)");
|
||||
WebGUI::SQL->write("alter table Navigation add column endPoint varchar(35)");
|
||||
my $sth = WebGUI::SQL->read("select * from Navigation");
|
||||
while (my $data = $sth->hashRef) {
|
||||
my %newNav;
|
||||
$newNav{navigationId} = $data->{navigationId};
|
||||
$newNav{identifier} = $data->{identifier};
|
||||
$newNav{showSystemPages} = $data->{showSystemPages};
|
||||
$newNav{showHiddenPages} = $data->{showHiddenPages};
|
||||
$newNav{showUnprivilegedPages} = $data->{showUnprivilegedPages};
|
||||
$newNav{startType} = "relativeToRoot";
|
||||
$newNav{startPoint} = $data->{stopAtLevel}+1;
|
||||
if ($data->{startAt} eq "root") {
|
||||
$newNav{baseType} = "relativeToRoot";
|
||||
$newNav{basePage} = "0";
|
||||
} elsif ($data->{startAt} eq "WebGUIroot") {
|
||||
$newNav{baseType} = "relativeToRoot";
|
||||
$newNav{basePage} = "1";
|
||||
} elsif ($data->{startAt} eq "top") {
|
||||
$newNav{baseType} = "relativeToRoot";
|
||||
$newNav{basePage} = "2";
|
||||
} elsif ($data->{startAt} eq "grandmother") {
|
||||
$newNav{baseType} = "relativeToCurrentPage";
|
||||
$newNav{basePage} = "-2";
|
||||
} elsif ($data->{startAt} eq "mother") {
|
||||
$newNav{baseType} = "relativeToCurrentPage";
|
||||
$newNav{basePage} = "-1";
|
||||
} elsif ($data->{startAt} eq "current") {
|
||||
$newNav{baseType} = "relativeToCurrentPage";
|
||||
$newNav{basePage} = "0";
|
||||
} elsif ($data->{startAt} eq "daughter") {
|
||||
$newNav{baseType} = "relativeToCurrentPage";
|
||||
$newNav{basePage} = "1";
|
||||
} else {
|
||||
$newNav{baseType} = "specificUrl";
|
||||
$newNav{basePage} = $data->{startAt};
|
||||
}
|
||||
$newNav{endType} = "relativeToBasePage";
|
||||
$newNav{endPoint} = ($data->{depth} == 99)?55:$data->{stopAtLevel});
|
||||
if ($data->{method} eq "daughters") {
|
||||
$newNav{assetsToInclude} = "descendants";
|
||||
} elsif ($data->{method} eq "sisters") {
|
||||
$newNav{assetsToInclude} = "siblings";
|
||||
} elsif ($data->{method} eq "self_and_sisters") {
|
||||
$newNav{assetsToInclude} = "self,siblings";
|
||||
} elsif ($data->{method} eq "descendants") {
|
||||
$newNav{assetsToInclude} = "descendants";
|
||||
} elsif ($data->{method} eq "self_and_descendants") {
|
||||
$newNav{assetsToInclude} = "self,descendants";
|
||||
} elsif ($data->{method} eq "leaves_under") {
|
||||
$newNav{assetsToInclude} = "descendants";
|
||||
} elsif ($data->{method} eq "generation") {
|
||||
$newNav{assetsToInclude} = "self,sisters";
|
||||
} elsif ($data->{method} eq "ancestors") {
|
||||
$newNav{assetsToInclude} = "ancestors";
|
||||
} elsif ($data->{method} eq "self_and_ancestors") {
|
||||
$newNav{assetsToInclude} = "self,ancestors";
|
||||
} elsif ($data->{method} eq "pedigree") {
|
||||
$newNav{assetsToInclude} = "pedigree";
|
||||
}
|
||||
WebGUI::SQL->setRow("Navigation","navigationId",\%newNav);
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::SQL->write("alter table Navigation drop column depth");
|
||||
WebGUI::SQL->write("alter table Navigation drop column startAt");
|
||||
WebGUI::SQL->write("alter table Navigation drop column stopAtLevel");
|
||||
WebGUI::SQL->write("alter table Navigation drop column method");
|
||||
WebGUI::SQL->write("alter table Navigation drop column reverse");
|
||||
|
||||
|
||||
WebGUI::Session::close();
|
||||
|
|
|
|||
|
|
@ -428,14 +428,18 @@ sub getLineage {
|
|||
$whereDescendants .= " and length(lineage) <= ".($rules->{endingLineageLength}*6);
|
||||
}
|
||||
}
|
||||
my $sql = "select assetId,className from asset where $whereSiblings $whereExact $whereDescendants $whereExclusion order by lineage";
|
||||
my $columns = "assetId, className";
|
||||
$columns = "*" if ($rules->{returnQuickReadObjects});
|
||||
my $sql = "select $columns from asset where $whereSiblings $whereExact $whereDescendants $whereExclusion order by lineage";
|
||||
my @lineage;
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
while (my ($assetId,$className) = $sth->array) {
|
||||
while (my $properties = $sth->hashRef) {
|
||||
if ($rules->{returnObjects}) {
|
||||
push(@lineage,WebGUI::Asset->newByDynamicClass($assetId, $className));
|
||||
push(@lineage,WebGUI::Asset->newByDynamicClass($properties->{assetId}, $properties->{className}));
|
||||
} elsif ($rules->{returnQuickReadObjects}) {
|
||||
push(@lineage,WebGUI::Asset->newByPropertyHashRef($properties));
|
||||
} else {
|
||||
push(@lineage,$assetId);
|
||||
push(@lineage,$properties->{assetId});
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -556,6 +560,15 @@ sub new {
|
|||
return undef;
|
||||
}
|
||||
|
||||
sub newByPropertyHashRef {
|
||||
my $class = shift;
|
||||
my $properties = shift;
|
||||
my $className = $properties->{className};
|
||||
my $cmd = "use ".$className;
|
||||
eval ($cmd);
|
||||
WebGUI::ErrorHandler::fatalError("Couldn't compile asset package: ".$className.". Root cause: ".$@) if ($@);
|
||||
bless {_properties => $properties}, $className;
|
||||
}
|
||||
|
||||
sub newByDynamicClass {
|
||||
my $class = shift;
|
||||
|
|
|
|||
|
|
@ -157,6 +157,84 @@ sub duplicate {
|
|||
$sth->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = $self->getEditForm;
|
||||
$tabform->getTab("layout")->template(
|
||||
-name=>"submissionTemplateId",
|
||||
-value=>$self->getValue("submissionTemplateId"),
|
||||
-namespace=>$self->get("namespace")."/Submission",
|
||||
-label=>WebGUI::International::get(73,$self->get("namespace")),
|
||||
-afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
);
|
||||
$tabform->getTab("layout")->template(
|
||||
-name=>"submissionFormTemplateId",
|
||||
-value=>$self->getValue("submissionFormTemplateId"),
|
||||
-namespace=>$self->get("namespace")."/SubmissionForm",
|
||||
-label=>WebGUI::International::get(87,$self->get("namespace")),
|
||||
-afterEdit=>'func=edit&wid='.$self->get("wobjectId")
|
||||
);
|
||||
$tabform->getTab("privileges")->group(
|
||||
-name=>"groupToApprove",
|
||||
-label=>WebGUI::International::get(1,$self->get("namespace")),
|
||||
-value=>[$self->getValue("groupToApprove")]
|
||||
);
|
||||
$tabform->getTab("privileges")->group(
|
||||
-name=>"groupToContribute",
|
||||
-label=>WebGUI::International::get(2,$self->get("namespace")),
|
||||
-value=>[$self->getValue("groupToContribute")]
|
||||
);
|
||||
$tabform->getTab("layout")->integer(
|
||||
-name=>"submissionsPerPage",
|
||||
-label=>WebGUI::International::get(6,$self->get("namespace")),
|
||||
-value=>$self->getValue("submissionsPerPage")
|
||||
);
|
||||
$tabform->getTab("privileges")->selectList(
|
||||
-name=>"defaultStatus",
|
||||
-options=>{
|
||||
Approved=>status('Approved'),
|
||||
Denied=>status('Denied'),
|
||||
Pending=>status('Pending')
|
||||
},
|
||||
-label=>WebGUI::International::get(563),
|
||||
-value=>[$self->getValue("defaultStatus")]
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
$tabform->getTab("properties")->integer(
|
||||
-name=>"karmaPerSubmission",
|
||||
-label=>WebGUI::International::get(30,$self->get("namespace")),
|
||||
-value=>$self->getValue("karmaPerSubmission")
|
||||
);
|
||||
} else {
|
||||
$tabform->getTab("properties")->hidden("karmaPerSubmission",$self->getValue("karmaPerSubmission"));
|
||||
}
|
||||
$tabform->getTab("layout")->filterContent(
|
||||
-value=>$self->getValue("filterContent")
|
||||
);
|
||||
$tabform->getTab("layout")->selectList(
|
||||
-name=>"sortBy",
|
||||
-value=>[$self->getValue("sortBy")],
|
||||
-options=>{
|
||||
sequenceNumber=>WebGUI::International::get(88,$self->get("namespace")),
|
||||
dateUpdated=>WebGUI::International::get(78,$self->get("namespace")),
|
||||
dateSubmitted=>WebGUI::International::get(13,$self->get("namespace")),
|
||||
title=>WebGUI::International::get(35,$self->get("namespace"))
|
||||
},
|
||||
-label=>WebGUI::International::get(79,$self->get("namespace"))
|
||||
);
|
||||
$tabform->getTab("layout")->selectList(
|
||||
-name=>"sortOrder",
|
||||
-value=>[$self->getValue("sortOrder")],
|
||||
-options=>{
|
||||
asc=>WebGUI::International::get(81,$self->get("namespace")),
|
||||
desc=>WebGUI::International::get(82,$self->get("namespace"))
|
||||
},
|
||||
-label=>WebGUI::International::get(80,$self->get("namespace"))
|
||||
);
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getIcon {
|
||||
my $self = shift;
|
||||
|
|
@ -237,31 +315,17 @@ sub getIndexerParams {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub name {
|
||||
sub getName {
|
||||
return WebGUI::International::get(29,"USS");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $sth = WebGUI::SQL->read("select forumId,pageId,USS_submissionId from USS_submission where USS_id=".quote($_[0]->get("USS_id")));
|
||||
while (my ($forumId, $pageId,$submissionId) = $sth->array) {
|
||||
my ($inUseElsewhere) = WebGUI::SQL->quickArray("select count(*) from USS_submission where forumId=".quote($forumId));
|
||||
unless ($inUseElsewhere > 1) {
|
||||
my $forum = WebGUI::Forum->new($forumId);
|
||||
$forum->purge;
|
||||
}
|
||||
my $page = WebGUI::Page->new($pageId);
|
||||
if (defined $page) {
|
||||
$page->purge;
|
||||
} else {
|
||||
WebGUI::ErrorHandler::warn("Submission ".$submissionId." of USS ".$_[0]->get("USS_id")." didn't have real page attached to it. This could be a minor problem caused by a bug of old, or it could indicate major data corruption issues.");
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::SQL->write("delete from USS_submission where USS_id=".quote($_[0]->get("USS_id")));
|
||||
$_[0]->SUPER::purge();
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
$self->deleteAllCachedSubmissions;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub status {
|
||||
if ($_[0] eq "Approved") {
|
||||
|
|
@ -273,20 +337,133 @@ sub status {
|
|||
}
|
||||
}
|
||||
|
||||
sub view {
|
||||
return "USS";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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 view {
|
||||
$_[0]->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
my (%var, $row, $page, $p, $constraints, @submission, @content, $image, $i, $numResults, $thumbnail, $responses);
|
||||
$numResults = $_[0]->get("submissionsPerPage");
|
||||
$var{"readmore.label"} = WebGUI::International::get(46,$_[0]->get("namespace"));
|
||||
$var{"responses.label"} = WebGUI::International::get(57,$_[0]->get("namespace"));
|
||||
$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"));
|
||||
$var{"addquestion.label"} = WebGUI::International::get(83,$_[0]->get("namespace"));
|
||||
$var{"addlink.label"} = WebGUI::International::get(89,$_[0]->get("namespace"));
|
||||
$var{"search.label"} = WebGUI::International::get(364);
|
||||
$var{"search.Form"} = WebGUI::Search::form({wid=>$_[0]->get("wobjectId"),func=>'view',search=>1});
|
||||
$var{"search.url"} = WebGUI::Search::toggleURL("wid=".$_[0]->get("wobjectId")."&func=view");
|
||||
$var{"rss.url"} = WebGUI::URL::page('func=viewRSS&wid='.$_[0]->get("wobjectId"),1);
|
||||
$var{canModerate} = WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"),$session{user}{userId});
|
||||
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 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;
|
||||
} else {
|
||||
$constraints = "(USS_submission.status='Approved' or (USS_submission.userId=".quote($session{user}{userId})." and USS_submission.userId<>1)";
|
||||
if ($var{canModerate}) {
|
||||
$constraints .= " or USS_submission.status='Pending'";
|
||||
}
|
||||
$constraints .= ")";
|
||||
}
|
||||
$var{"title.label"} = WebGUI::International::get(99);
|
||||
$var{"thumbnail.label"} = WebGUI::International::get(52,$_[0]->get("namespace"));
|
||||
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
|
||||
$var{"date.updated.label"} = WebGUI::International::get(78,$_[0]->get("namespace"));
|
||||
$var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
|
||||
$var{"submission.edit.label"} = WebGUI::International::get(27,$_[0]->get("namespace"));
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),$numResults);
|
||||
$p->setDataByQuery("select USS_submission.USS_submissionId, USS_submission.content, USS_submission.title,
|
||||
USS_submission.userId, USS_submission.status, USS_submission.image, USS_submission.dateSubmitted,
|
||||
USS_submission.dateUpdated, USS_submission.username, USS_submission.contentType, USS_submission.forumId,
|
||||
USS_submission.userDefined1, USS_submission.userDefined2, USS_submission.userDefined3,
|
||||
USS_submission.userDefined4, USS_submission.userDefined5, USS_submission.startDate,
|
||||
USS_submission.endDate, page.urlizedTitle
|
||||
from USS_submission left join page on USS_submission.pageId=page.pageId
|
||||
where USS_submission.USS_id=".quote($_[0]->get("USS_Id"))."
|
||||
and $constraints order by USS_submission.".$_[0]->getValue("sortBy")." ".$_[0]->getValue("sortOrder"));
|
||||
$page = $p->getPageData;
|
||||
$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});
|
||||
@content = split(/\^\-\;/,$page->[$i]->{content});
|
||||
if ($page->[$i]->{image} ne "") {
|
||||
$image = WebGUI::Attachment->new($page->[$i]->{image},$_[0]->get("wobjectId"),$page->[$i]->{USS_submissionId});
|
||||
$thumbnail = $image->getThumbnail;
|
||||
$imageURL = $image->getURL;
|
||||
} else {
|
||||
$thumbnail = "";
|
||||
$imageURL = "";
|
||||
}
|
||||
($responses) = WebGUI::SQL->quickArray("select count(*) from forumPost left join forumThread on
|
||||
forumThread.forumThreadId=forumPost.forumThreadId where forumThread.forumId=".quote($row->{forumId}),WebGUI::SQL->getSlave);
|
||||
my $quickurl = 'wid='.$_[0]->get("wobjectId").'&sid='.$page->[$i]->{USS_submissionId}.'&func=';
|
||||
my $controls = deleteIcon($quickurl.'deleteSubmissionConfirm','',WebGUI::International::get(17,$_[0]->get("namespace")))
|
||||
.editIcon($quickurl.'editSubmission');
|
||||
if ($_[0]->get("sortBy") eq "sequenceNumber") {
|
||||
if ($_[0]->get("sortOrder") eq "desc") {
|
||||
$controls .= moveUpIcon($quickurl.'moveSubmissionDown')
|
||||
.moveDownIcon($quickurl.'moveSubmissionUp');
|
||||
} else {
|
||||
$controls .= moveUpIcon($quickurl.'moveSubmissionUp')
|
||||
.moveDownIcon($quickurl.'moveSubmissionDown');
|
||||
}
|
||||
}
|
||||
my $inDateRange;
|
||||
if ($page->[$i]->{startDate} < WebGUI::DateTime::time() &&
|
||||
$page->[$i]->{endDate} > WebGUI::DateTime::time())
|
||||
{
|
||||
$inDateRange = 1;
|
||||
}
|
||||
else { $inDateRange = 0; }
|
||||
$submission = {
|
||||
"submission.id"=>$page->[$i]->{USS_submissionId},
|
||||
"submission.url"=>WebGUI::URL::gateway($page->[$i]->{urlizedTitle}),
|
||||
"submission.content"=>$content[0],
|
||||
"submission.content.full"=>join("\n",@content),
|
||||
"submission.responses"=>$responses,
|
||||
"submission.title"=>$page->[$i]->{title},
|
||||
"submission.userDefined1"=>$page->[$i]->{userDefined1},
|
||||
"submission.userDefined2"=>$page->[$i]->{userDefined2},
|
||||
"submission.userDefined3"=>$page->[$i]->{userDefined3},
|
||||
"submission.userDefined4"=>$page->[$i]->{userDefined4},
|
||||
"submission.userDefined5"=>$page->[$i]->{userDefined5},
|
||||
"submission.userId"=>$page->[$i]->{userId},
|
||||
"submission.username"=>$page->[$i]->{username},
|
||||
"submission.status"=>$page->[$i]->{status},
|
||||
"submission.thumbnail"=>$thumbnail,
|
||||
"submission.image"=>$imageURL,
|
||||
"submission.date"=>epochToHuman($page->[$i]->{dateSubmitted}),
|
||||
"submission.date.updated"=>epochToHuman($page->[$i]->{dateUpdated}),
|
||||
"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),
|
||||
"submission.thirdColumn"=>(($i+1)%3==0),
|
||||
"submission.fourthColumn"=>(($i+1)%4==0),
|
||||
"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;
|
||||
$p->appendTemplateVars(\%var);
|
||||
return $_[0]->processTemplate(\%var,"USS",$_[0]->get("templateId"));
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_approveSubmission {
|
||||
my $self = shift;
|
||||
|
|
@ -305,11 +482,6 @@ sub www_approveSubmission {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_copy {
|
||||
return "Copying of User Submission Systems has been disabled until 6.3.";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteFile {
|
||||
|
|
@ -367,97 +539,14 @@ sub www_denySubmission {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub www_edit {
|
||||
my $layout = WebGUI::HTMLForm->new;
|
||||
my $privileges = WebGUI::HTMLForm->new;
|
||||
my $properties = WebGUI::HTMLForm->new;
|
||||
$layout->template(
|
||||
-name=>"submissionTemplateId",
|
||||
-value=>$_[0]->getValue("submissionTemplateId"),
|
||||
-namespace=>$_[0]->get("namespace")."/Submission",
|
||||
-label=>WebGUI::International::get(73,$_[0]->get("namespace")),
|
||||
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
|
||||
);
|
||||
$layout->template(
|
||||
-name=>"submissionFormTemplateId",
|
||||
-value=>$_[0]->getValue("submissionFormTemplateId"),
|
||||
-namespace=>$_[0]->get("namespace")."/SubmissionForm",
|
||||
-label=>WebGUI::International::get(87,$_[0]->get("namespace")),
|
||||
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
|
||||
);
|
||||
$privileges->group(
|
||||
-name=>"groupToApprove",
|
||||
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
|
||||
-value=>[$_[0]->getValue("groupToApprove")]
|
||||
);
|
||||
$privileges->group(
|
||||
-name=>"groupToContribute",
|
||||
-label=>WebGUI::International::get(2,$_[0]->get("namespace")),
|
||||
-value=>[$_[0]->getValue("groupToContribute")]
|
||||
);
|
||||
$layout->integer(
|
||||
-name=>"submissionsPerPage",
|
||||
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
|
||||
-value=>$_[0]->getValue("submissionsPerPage")
|
||||
);
|
||||
$privileges->selectList(
|
||||
-name=>"defaultStatus",
|
||||
-options=>{
|
||||
Approved=>status('Approved'),
|
||||
Denied=>status('Denied'),
|
||||
Pending=>status('Pending')
|
||||
},
|
||||
-label=>WebGUI::International::get(563),
|
||||
-value=>[$_[0]->getValue("defaultStatus")]
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
$properties->integer(
|
||||
-name=>"karmaPerSubmission",
|
||||
-label=>WebGUI::International::get(30,$_[0]->get("namespace")),
|
||||
-value=>$_[0]->getValue("karmaPerSubmission")
|
||||
);
|
||||
} else {
|
||||
$properties->hidden("karmaPerSubmission",$_[0]->getValue("karmaPerSubmission"));
|
||||
}
|
||||
$layout->filterContent(
|
||||
-value=>$_[0]->getValue("filterContent")
|
||||
);
|
||||
$layout->selectList(
|
||||
-name=>"sortBy",
|
||||
-value=>[$_[0]->getValue("sortBy")],
|
||||
-options=>{
|
||||
sequenceNumber=>WebGUI::International::get(88,$_[0]->get("namespace")),
|
||||
dateUpdated=>WebGUI::International::get(78,$_[0]->get("namespace")),
|
||||
dateSubmitted=>WebGUI::International::get(13,$_[0]->get("namespace")),
|
||||
title=>WebGUI::International::get(35,$_[0]->get("namespace"))
|
||||
},
|
||||
-label=>WebGUI::International::get(79,$_[0]->get("namespace"))
|
||||
);
|
||||
$layout->selectList(
|
||||
-name=>"sortOrder",
|
||||
-value=>[$_[0]->getValue("sortOrder")],
|
||||
-options=>{
|
||||
asc=>WebGUI::International::get(81,$_[0]->get("namespace")),
|
||||
desc=>WebGUI::International::get(82,$_[0]->get("namespace"))
|
||||
},
|
||||
-label=>WebGUI::International::get(80,$_[0]->get("namespace"))
|
||||
);
|
||||
return $_[0]->SUPER::www_edit(
|
||||
-layout=>$layout->printRowsOnly,
|
||||
-privileges=>$privileges->printRowsOnly,
|
||||
-properties=>$properties->printRowsOnly,
|
||||
-headingId=>18,
|
||||
-helpId=>"user submission system add/edit"
|
||||
);
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("user submission system add/edit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("18","USS"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
$_[0]->deleteAllCachedSubmissions;
|
||||
$_[0]->SUPER::www_editSave()
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubmission {
|
||||
|
|
@ -744,131 +833,6 @@ sub www_moveSubmissionUp {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
$_[0]->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
my (%var, $row, $page, $p, $constraints, @submission, @content, $image, $i, $numResults, $thumbnail, $responses);
|
||||
$numResults = $_[0]->get("submissionsPerPage");
|
||||
$var{"readmore.label"} = WebGUI::International::get(46,$_[0]->get("namespace"));
|
||||
$var{"responses.label"} = WebGUI::International::get(57,$_[0]->get("namespace"));
|
||||
$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"));
|
||||
$var{"addquestion.label"} = WebGUI::International::get(83,$_[0]->get("namespace"));
|
||||
$var{"addlink.label"} = WebGUI::International::get(89,$_[0]->get("namespace"));
|
||||
$var{"search.label"} = WebGUI::International::get(364);
|
||||
$var{"search.Form"} = WebGUI::Search::form({wid=>$_[0]->get("wobjectId"),func=>'view',search=>1});
|
||||
$var{"search.url"} = WebGUI::Search::toggleURL("wid=".$_[0]->get("wobjectId")."&func=view");
|
||||
$var{"rss.url"} = WebGUI::URL::page('func=viewRSS&wid='.$_[0]->get("wobjectId"),1);
|
||||
$var{canModerate} = WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"),$session{user}{userId});
|
||||
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 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;
|
||||
} else {
|
||||
$constraints = "(USS_submission.status='Approved' or (USS_submission.userId=".quote($session{user}{userId})." and USS_submission.userId<>1)";
|
||||
if ($var{canModerate}) {
|
||||
$constraints .= " or USS_submission.status='Pending'";
|
||||
}
|
||||
$constraints .= ")";
|
||||
}
|
||||
$var{"title.label"} = WebGUI::International::get(99);
|
||||
$var{"thumbnail.label"} = WebGUI::International::get(52,$_[0]->get("namespace"));
|
||||
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
|
||||
$var{"date.updated.label"} = WebGUI::International::get(78,$_[0]->get("namespace"));
|
||||
$var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
|
||||
$var{"submission.edit.label"} = WebGUI::International::get(27,$_[0]->get("namespace"));
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),$numResults);
|
||||
$p->setDataByQuery("select USS_submission.USS_submissionId, USS_submission.content, USS_submission.title,
|
||||
USS_submission.userId, USS_submission.status, USS_submission.image, USS_submission.dateSubmitted,
|
||||
USS_submission.dateUpdated, USS_submission.username, USS_submission.contentType, USS_submission.forumId,
|
||||
USS_submission.userDefined1, USS_submission.userDefined2, USS_submission.userDefined3,
|
||||
USS_submission.userDefined4, USS_submission.userDefined5, USS_submission.startDate,
|
||||
USS_submission.endDate, page.urlizedTitle
|
||||
from USS_submission left join page on USS_submission.pageId=page.pageId
|
||||
where USS_submission.USS_id=".quote($_[0]->get("USS_Id"))."
|
||||
and $constraints order by USS_submission.".$_[0]->getValue("sortBy")." ".$_[0]->getValue("sortOrder"));
|
||||
$page = $p->getPageData;
|
||||
$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});
|
||||
@content = split(/\^\-\;/,$page->[$i]->{content});
|
||||
if ($page->[$i]->{image} ne "") {
|
||||
$image = WebGUI::Attachment->new($page->[$i]->{image},$_[0]->get("wobjectId"),$page->[$i]->{USS_submissionId});
|
||||
$thumbnail = $image->getThumbnail;
|
||||
$imageURL = $image->getURL;
|
||||
} else {
|
||||
$thumbnail = "";
|
||||
$imageURL = "";
|
||||
}
|
||||
($responses) = WebGUI::SQL->quickArray("select count(*) from forumPost left join forumThread on
|
||||
forumThread.forumThreadId=forumPost.forumThreadId where forumThread.forumId=".quote($row->{forumId}),WebGUI::SQL->getSlave);
|
||||
my $quickurl = 'wid='.$_[0]->get("wobjectId").'&sid='.$page->[$i]->{USS_submissionId}.'&func=';
|
||||
my $controls = deleteIcon($quickurl.'deleteSubmissionConfirm','',WebGUI::International::get(17,$_[0]->get("namespace")))
|
||||
.editIcon($quickurl.'editSubmission');
|
||||
if ($_[0]->get("sortBy") eq "sequenceNumber") {
|
||||
if ($_[0]->get("sortOrder") eq "desc") {
|
||||
$controls .= moveUpIcon($quickurl.'moveSubmissionDown')
|
||||
.moveDownIcon($quickurl.'moveSubmissionUp');
|
||||
} else {
|
||||
$controls .= moveUpIcon($quickurl.'moveSubmissionUp')
|
||||
.moveDownIcon($quickurl.'moveSubmissionDown');
|
||||
}
|
||||
}
|
||||
my $inDateRange;
|
||||
if ($page->[$i]->{startDate} < WebGUI::DateTime::time() &&
|
||||
$page->[$i]->{endDate} > WebGUI::DateTime::time())
|
||||
{
|
||||
$inDateRange = 1;
|
||||
}
|
||||
else { $inDateRange = 0; }
|
||||
$submission = {
|
||||
"submission.id"=>$page->[$i]->{USS_submissionId},
|
||||
"submission.url"=>WebGUI::URL::gateway($page->[$i]->{urlizedTitle}),
|
||||
"submission.content"=>$content[0],
|
||||
"submission.content.full"=>join("\n",@content),
|
||||
"submission.responses"=>$responses,
|
||||
"submission.title"=>$page->[$i]->{title},
|
||||
"submission.userDefined1"=>$page->[$i]->{userDefined1},
|
||||
"submission.userDefined2"=>$page->[$i]->{userDefined2},
|
||||
"submission.userDefined3"=>$page->[$i]->{userDefined3},
|
||||
"submission.userDefined4"=>$page->[$i]->{userDefined4},
|
||||
"submission.userDefined5"=>$page->[$i]->{userDefined5},
|
||||
"submission.userId"=>$page->[$i]->{userId},
|
||||
"submission.username"=>$page->[$i]->{username},
|
||||
"submission.status"=>$page->[$i]->{status},
|
||||
"submission.thumbnail"=>$thumbnail,
|
||||
"submission.image"=>$imageURL,
|
||||
"submission.date"=>epochToHuman($page->[$i]->{dateSubmitted}),
|
||||
"submission.date.updated"=>epochToHuman($page->[$i]->{dateUpdated}),
|
||||
"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),
|
||||
"submission.thirdColumn"=>(($i+1)%3==0),
|
||||
"submission.fourthColumn"=>(($i+1)%4==0),
|
||||
"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;
|
||||
$p->appendTemplateVars(\%var);
|
||||
return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# print out RSS 2.0 feed describing the items visible on the first page
|
||||
|
|
|
|||
|
|
@ -1511,8 +1511,8 @@ sub new {
|
|||
"method"=>$method,
|
||||
"enctype"=>$enctype
|
||||
});
|
||||
$header .= "\n<table ".$tableExtras.'>' unless ($noTable);
|
||||
$footer = "</table>\n" unless ($noTable);
|
||||
$header .= "\n<table ".$tableExtras.'><tbody>' unless ($noTable);
|
||||
$footer = "</tbody></table>\n" unless ($noTable);
|
||||
$footer .= WebGUI::Form::formFooter();
|
||||
bless {_noTable => $noTable, _header => $header, _footer => $footer, _data => ''}, $self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,10 @@ package WebGUI::Navigation;
|
|||
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use Tie::IxHash;
|
||||
use warnings;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Operation::Navigation;
|
||||
use WebGUI::Page;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Template;
|
||||
|
|
@ -217,6 +215,15 @@ in the class and returns HTML.
|
|||
|
||||
sub build {
|
||||
my $self = shift;
|
||||
my $config = $self->getConfig;
|
||||
my $base = WebGUI::Asset->newByDynamicClass($config->{basePage});
|
||||
my (@relatives, %rules);
|
||||
foreach my $relative ("ancestors","self","siblings","descendants") {
|
||||
push(@relatives,$relative) if ($config->{relative});
|
||||
}
|
||||
$rules{returnQuickReadObjects} = 1;
|
||||
$base->getLineage(\@relatives,\%rules);
|
||||
|
||||
my @interestingPageProperties = ('pageId', 'parentId', 'title', 'ownerId', 'urlizedTitle',
|
||||
'synopsis', 'newWindow', 'menuTitle', 'encryptLogin');
|
||||
my $var = {'page_loop' => []};
|
||||
|
|
|
|||
|
|
@ -83,8 +83,220 @@ sub www_deleteNavigationConfirm {
|
|||
return www_listNavigation();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub www_editNavigation {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $identifier = shift || $session{form}{identifier};
|
||||
my $config = WebGUI::Navigation::getConfig($identifier);
|
||||
if ($config->{identifier}) {
|
||||
# Existing config
|
||||
} else {
|
||||
$config->{navigationId} = 'new';
|
||||
$config->{identifier} = $identifier || 'myIdentifier';
|
||||
$config->{assetsToInclude} = "descendants";
|
||||
$config->{startType} = "relativeToRoot";
|
||||
$config->{startPoint} = 0;
|
||||
$config->{baseType} = "relativeToCurrentPage";
|
||||
$config->{basePage} = "0";
|
||||
$config->{endType} = "relativeToBasePage";
|
||||
$config->{endPoint} = "55";
|
||||
$config->{templateId} = 1;
|
||||
$config->{showSystemPages} = 0;
|
||||
$config->{showHiddenPages} = 0;
|
||||
$config->{showUnprivilegedPages} = 0;
|
||||
}
|
||||
my $tabform = WebGUI::TabForm->new;
|
||||
$tabform->hidden({
|
||||
name=>'op',
|
||||
value=>'editNavigationSave'
|
||||
});
|
||||
$tabform->hidden({
|
||||
name=>'navigationId',
|
||||
value=>$config->{navigationId}
|
||||
});
|
||||
$tabform->addTab("properties",WebGUI::International::get(23, 'Navigation'));
|
||||
$tabform->getTab("properties")->raw('<input type="hidden" name="op2" value="'.$session{form}{afterEdit}.'" />');
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-value=>$config->{navigationId},
|
||||
-label=>'navigationId'
|
||||
);
|
||||
$tabform->getTab("properties")->text(
|
||||
-name=>'identifier',
|
||||
-value=>$config->{identifier},
|
||||
-label=>WebGUI::International::get(24, 'Navigation')
|
||||
);
|
||||
my ($ancestorsChecked, $descendantsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my @assetsToInclude = split(",",$config->{assetsToInclude});
|
||||
my $afterScript;
|
||||
foreach my $item (@assetsToInclude) {
|
||||
if ($item eq "self") {
|
||||
$selfChecked = 1;
|
||||
} elsif ($item eq "descendants") {
|
||||
$descendantsChecked = 1;
|
||||
$afterScript = "displayNavEndPoint = false;";
|
||||
} elsif ($item eq "ancestors") {
|
||||
$ancestorsChecked = 1;
|
||||
$afterScript = "displayNavStartPoint = false;";
|
||||
} elsif ($item eq "siblings") {
|
||||
$siblingsChecked = 1;
|
||||
} elsif ($item eq "pedigree") {
|
||||
$pedigreeChecked = 1;
|
||||
}
|
||||
}
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>"Pages to Include",
|
||||
-value=>WebGUI::Form::checkbox({
|
||||
checked=>$ancestorsChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"ancestors",
|
||||
extras=>'onChange="toggleStartPoint()"'
|
||||
}).'Ancestors<br />'
|
||||
.WebGUI::Form::checkbox({
|
||||
checked=>$selfChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"self"
|
||||
}).'Self<br />'
|
||||
.WebGUI::Form::checkbox({
|
||||
checked=>$siblingsChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"siblings"
|
||||
}).'Siblings<br />'
|
||||
.WebGUI::Form::checkbox({
|
||||
checked=>$descendantsChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"descendants",
|
||||
extras=>'onChange="toggleEndPoint()"'
|
||||
}).'Descendants<br />'
|
||||
.WebGUI::Form::checkbox({
|
||||
checked=>$pedigreeChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"pedigree"
|
||||
}).'Pedigree<br />'
|
||||
);
|
||||
$tabform->getTab("properties")->raw(
|
||||
'</tbody><tbody id="navStart"><tr><td class="formDescription">Start Type</td><td>'
|
||||
.WebGUI::Form::selectList({
|
||||
name=>"startType",
|
||||
value=>[$config->{startType}],
|
||||
extras=>'id="navStartType" onChange="changeStartPoint()"',
|
||||
options=>{
|
||||
relativeToRoot=>"Relative To Root",
|
||||
relativeToCurrentPage=>"Relative To Current Page"
|
||||
}
|
||||
})
|
||||
.'</td></tr><tr><td class="formDescription">Start Point</td><td><div id="navStartPoint"></div></td></tr></tbody><tbody>'
|
||||
);
|
||||
$tabform->getTab("properties")->selectList(
|
||||
-name=>"baseType",
|
||||
-options=>{
|
||||
specificUrl=>'Specific URL',
|
||||
relativeToCurrentPage=>'Relative To Current Page',
|
||||
relativeToRoot=>'Relative To Root'
|
||||
},
|
||||
-value=>[$config->{baseType}],
|
||||
-label=>"Base Type",
|
||||
-extras=>'id="navBaseType" onChange="changeBasePage()"'
|
||||
);
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>"Base Page",
|
||||
-value=>'<div id="navBasePage"></div>'
|
||||
);
|
||||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
%options = (
|
||||
'55'=>'Infinity',
|
||||
'1'=>'./a/ (+1)',
|
||||
'2'=>'./a/b/ (+2)',
|
||||
'3'=>'./a/b/c/ (+3)',
|
||||
'4'=>'./a/b/c/d/ (+4)',
|
||||
'5'=>'./a/b/c/d/e/ (+5)'
|
||||
);
|
||||
$tabform->getTab("properties")->raw(
|
||||
'</tbody><tbody id="navEnd"><tr><td class="formDescription">End Type</td><td>'
|
||||
.WebGUI::Form::selectList({
|
||||
name=>"endType",
|
||||
value=>[$config->{endType}],
|
||||
options=>{
|
||||
relativeToStartPage=>"Relative To Start Page",
|
||||
relativeToBasePage=>"Relative To Base Page"
|
||||
}
|
||||
})
|
||||
.'</td></tr><tr><td class="formDescription">End Point</td><td>'
|
||||
.WebGUI::Form::selectList({
|
||||
name=>"endPoint",
|
||||
value=>[$config->{endPoint}],
|
||||
options=>\%options
|
||||
})
|
||||
.'</td></tr></tbody><tbody>'
|
||||
);
|
||||
$tabform->addTab("layout",WebGUI::International::get(105));
|
||||
$tabform->getTab("layout")->template(
|
||||
-name=>'templateId',
|
||||
-label=>WebGUI::International::get(913),
|
||||
-value=>$session{form}{templateId} || $config->{templateId},
|
||||
-namespace=>'Navigation',
|
||||
);
|
||||
$tabform->getTab("layout")->yesNo(
|
||||
-name=>'showSystemPages',
|
||||
-label=>WebGUI::International::get(30,'Navigation'),
|
||||
-value=>$session{form}{showSystemPages} || $config->{showSystemPages}
|
||||
);
|
||||
$tabform->getTab("layout")->yesNo(
|
||||
-name=>'showHiddenPages',
|
||||
-label=>WebGUI::International::get(31,'Navigation'),
|
||||
-value=>$session{form}{showHiddenPages} || $config->{showHiddenPages}
|
||||
);
|
||||
$tabform->getTab("layout")->yesNo(
|
||||
-name=>'showUnprivilegedPages',
|
||||
-label=>WebGUI::International::get(32,'Navigation'),
|
||||
-value=>$session{form}{showUnprivilegedPages} || $config->{showUnprivilegedPages}
|
||||
);
|
||||
my $script = "<script type=\"text/javascript\">
|
||||
var displayNavStartPoint = true;
|
||||
function toggleStartPoint () {
|
||||
if (displayNavStartPoint) {
|
||||
document.getElementById('navStart').style.display='none';
|
||||
displayNavStartPoint = false;
|
||||
} else {
|
||||
document.getElementById('navStart').style.display='';
|
||||
displayNavStartPoint = true;
|
||||
}
|
||||
}
|
||||
var displayNavEndPoint = true;
|
||||
function toggleEndPoint () {
|
||||
if (displayNavEndPoint) {
|
||||
document.getElementById('navEnd').style.display='none';
|
||||
displayNavEndPoint = false;
|
||||
} else {
|
||||
document.getElementById('navEnd').style.display='';
|
||||
displayNavEndPoint = true;
|
||||
}
|
||||
}
|
||||
var relativeToRoot ='<select name=\"basePage\"><option value=\"0\"".(($config->{basePage} eq "0")?' selected=\"1\"':'').">/ (0)</option><option value=\"1\"".(($config->{basePage} eq "1")?' selected=\"1\"':'').">/a/ (+1)</option><option value=\"2\"".(($config->{basePage} eq "2")?' selected=\"1\"':'').">/a/b/ (+2)</option><option value=\"3\"".(($config->{basePage} eq "3")?' selected=\"1\"':'').">/a/b/c/ (+3)</option><option value=\"4\"".(($config->{basePage} eq "4")?' selected=\"1\"':'').">/a/b/c/d/ (+4)</option><option value=\"5\"".(($config->{basePage} eq "5")?' selected=\"1\"':'').">/a/b/c/d/e/ (+5)</option><option value=\"6\"".(($config->{basePage} eq "6")?' selected=\"1\"':'').">/a/b/c/d/e/f/ (+6)</option><option value=\"7\"".(($config->{basePage} eq "7")?' selected=\"1\"':'').">/a/b/c/d/e/f/g/h/ (+7)</option><option value=\"8\"".(($config->{basePage} eq "8")?' selected=\"1\"':'').">/a/b/c/d/e/f/g/h/ (+8)</option><option value=\"9\"".(($config->{basePage} eq "9")?' selected=\"1\"':'').">/a/b/c/d/e/f/g/h/i/ (+9)</option></select>';
|
||||
function changeBasePage () {
|
||||
var types = new Array();
|
||||
types['specificUrl']='<input type=\"text\" name=\"basePage\">';
|
||||
types['relativeToRoot']=relativeToRoot;
|
||||
types['relativeToCurrentPage']='<select name=\"basePage\"><option value=\"-3\"".(($config->{basePage} eq "-3")?' selected=\"1\"':'').">../../.././ (-3)</option><option value=\"-2\"".(($config->{basePage} eq "-2")?' selected=\"1\"':'').">../.././ (-2)</option><option value=\"-1\"".(($config->{basePage} eq "-1")?' selected=\"1\"':'').">.././ (-1)</option><option value=\"0\"".(($config->{basePage} eq "0")?' selected=\"1\"':'').">./ (0)</option><option value=\"1\"".(($config->{basePage} eq "1")?' selected=\"1\"':'').">./a/ (+1)</option><option value=\"2\"".(($config->{basePage} eq "2")?' selected=\"1\"':'').">./a/b/ (+2)</option><option value=\"3\"".(($config->{basePage} eq "3")?' selected=\"1\"':'').">./a/b/c/ (+3)</option></select>';
|
||||
document.getElementById('navBasePage').innerHTML=types[document.getElementById('navBaseType').options[document.getElementById('navBaseType').selectedIndex].value];
|
||||
}
|
||||
function changeStartPoint () {
|
||||
var types = new Array();
|
||||
types['relativeToRoot']=relativeToRoot;
|
||||
types['relativeToCurrentPage']='<select name=\"basePage\"><option value=\"-3\"".(($config->{basePage} eq "-3")?' selected=\"1\"':'').">../../.././ (-3)</option><option value=\"-2\"".(($config->{basePage} eq "-2")?' selected=\"1\"':'').">../.././ (-2)</option><option value=\"-1\"".(($config->{basePage} eq "-1")?' selected=\"1\"':'').">.././ (-1)</option></select>';
|
||||
document.getElementById('navStartPoint').innerHTML=types[document.getElementById('navStartType').options[document.getElementById('navStartType').selectedIndex].value];
|
||||
}
|
||||
".$afterScript."
|
||||
changeBasePage();
|
||||
changeStartPoint();
|
||||
toggleStartPoint();
|
||||
toggleEndPoint();
|
||||
</script>";
|
||||
return _submenu($tabform->print.$script,'22',"navigation add/edit");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editNavigationOld {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $identifier = shift || $session{form}{identifier};
|
||||
my $config = WebGUI::Navigation::getConfig($identifier);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue