all wobject use tab form interface

This commit is contained in:
JT Smith 2003-03-03 05:23:56 +00:00
parent 56d28572e3
commit 965cba6774
17 changed files with 273 additions and 211 deletions

View file

@ -42,8 +42,7 @@ sub duplicate {
linkTitle=>$_[0]->get("linkTitle"),
linkURL=>$_[0]->get("linkURL"),
attachment=>$_[0]->get("attachment"),
convertCarriageReturns=>$_[0]->get("convertCarriageReturns"),
allowDiscussion=>$_[0]->get("allowDiscussion")
convertCarriageReturns=>$_[0]->get("convertCarriageReturns")
});
}
@ -58,7 +57,7 @@ sub new {
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(image templateId linkTitle linkURL attachment convertCarriageReturns allowDiscussion)],
[qw(image templateId linkTitle linkURL attachment convertCarriageReturns)],
1
);
bless $self, $class;
@ -67,7 +66,7 @@ sub new {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $editTimeout, $groupToModerate, $f, $template);
my ($output, $editTimeout, $groupToModerate, $template);
if ($_[0]->get("wobjectId") eq "new") {
$editTimeout = 1;
} else {
@ -77,55 +76,52 @@ sub www_edit {
$groupToModerate = $_[0]->get("groupToModerate") || 4;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$template,
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(356),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->raw(
$properties->raw(
-value=>$_[0]->fileProperty("image",6),
-uiLevel=>3
);
$f->raw(
$properties->raw(
-value=>$_[0]->fileProperty("attachment",9),
-uiLevel=>1
);
$f->text(
$properties->text(
-name=>"linkTitle",
-label=>WebGUI::International::get(7,$_[0]->get("namespace")),
-value=>$_[0]->get("linkTitle"),
-uiLevel=>3
);
$f->url(
$properties->url(
-name=>"linkURL",
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("linkURL"),
-uiLevel=>3
);
$f->yesNo(
$layout->yesNo(
-name=>"convertCarriageReturns",
-label=>WebGUI::International::get(10,$_[0]->get("namespace")),
-value=>$_[0]->get("convertCarriageReturns"),
-subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,$_[0]->get("namespace")).'</span>',
-uiLevel=>5
);
$f->yesNo(
-name=>"allowDiscussion",
-label=>WebGUI::International::get(18,$_[0]->get("namespace")),
-value=>$_[0]->get("allowDiscussion"),
-uiLevel=>5
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
# return WebGUI::International::get(815).$_[0]->www_edit if ($session{cgi}->cgi_error eq "413 POST too large");
my ($image, $attachment, %property);
$_[0]->SUPER::www_editSave() if ($_[0]->get("wobjectId") eq "new");
$image = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
@ -138,7 +134,6 @@ sub www_editSave {
$property{linkTitle} = $session{form}{linkTitle};
$property{templateId} = $session{form}{templateId};
$property{linkURL} = $session{form}{linkURL};
$property{allowDiscussion} = $session{form}{allowDiscussion};
$_[0]->SUPER::www_editSave(\%property);
return "";
}

View file

@ -215,7 +215,7 @@ sub www_deleteEventConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $startMonth, $endMonth, $afterEdit, $defaultMonth, $f, $paginateAfter);
my ($output, $startMonth, $endMonth, $afterEdit, $defaultMonth, $paginateAfter);
$paginateAfter = $_[0]->get("paginateAfter") || 50;
$startMonth = $_[0]->get("startMonth") || "current";
$endMonth = $_[0]->get("endMonth") || "after12";
@ -223,22 +223,23 @@ sub www_edit {
$afterEdit = 'func=edit&wid='.$_[0]->get("wobjectId") if ($_[0]->get("wobjectId") ne "new");
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(79,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
);
$f->template(
$layout->template(
-name=>"eventTemplateId",
-value=>$_[0]->get("eventTemplateId"),
-namespace=>$_[0]->get("namespace")."/Event",
-label=>WebGUI::International::get(80,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
);
$f->select(
$properties->select(
-name=>"startMonth",
-options=>{
"current"=>WebGUI::International::get(82,$_[0]->get("namespace")),
@ -247,7 +248,7 @@ sub www_edit {
-label=>WebGUI::International::get(81,$_[0]->get("namespace")),
-value=>[$startMonth]
);
$f->select(
$properties->select(
-name=>"endMonth",
-options=>{
"last"=>WebGUI::International::get(85,$_[0]->get("namespace")),
@ -260,7 +261,7 @@ sub www_edit {
-label=>WebGUI::International::get(84,$_[0]->get("namespace")),
-value=>[$endMonth]
);
$f->select(
$properties->select(
-name=>"defaultMonth",
-options=>{
"current"=>WebGUI::International::get(82,$_[0]->get("namespace")),
@ -270,9 +271,9 @@ sub www_edit {
-label=>WebGUI::International::get(90,$_[0]->get("namespace")),
-value=>[$defaultMonth]
);
$f->integer("paginateAfter",WebGUI::International::get(19,$_[0]->get("namespace")),$paginateAfter);
$layout->integer("paginateAfter",WebGUI::International::get(19,$_[0]->get("namespace")),$paginateAfter);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
$properties->whatNext(
-options=>{
addEvent=>WebGUI::International::get(91,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
@ -280,7 +281,10 @@ sub www_edit {
-value=>"backToPage"
);
}
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
return $output;
}

View file

@ -12,14 +12,15 @@ package WebGUI::Wobject::ExtraColumn;
use strict;
use Tie::CPHash;
use Tie::IxHash;
use WebGUI::DateTime;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Page;
use WebGUI::TabForm;
use WebGUI::Template;
use WebGUI::Wobject;
@ -71,14 +72,29 @@ sub www_edit {
$class = $_[0]->get("class") || "content";
$startDate = $_[0]->get("startDate") || $session{page}{startDate};
$endDate = $_[0]->get("endDate") || $session{page}{endDate};
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("namespace",$_[0]->get("namespace")) if ($_[0]->get("wobjectId") eq "new");
$f->hidden("func","editSave");
$f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
$f->hidden("title",$_[0]->get("namespace"));
$f->hidden("displayTitle",0);
$f->select(
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
properties=>{
label=>WebGUI::International::get(893)
},
layout=>{
label=>WebGUI::International::get(105),
uiLevel=>5
},
privileges=>{
label=>WebGUI::International::get(107),
uiLevel=>9
}
);
$f = WebGUI::TabForm->new(\%tabs);
$f->hidden({name=>"wid",value=>$_[0]->get("wobjectId")});
$f->hidden({name=>"namespace",value=>$_[0]->get("namespace")}) if ($_[0]->get("wobjectId") eq "new");
$f->hidden({name=>"func",value=>"editSave"});
$f->getTab("properties")->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
$f->hidden({name=>"title",value=>$_[0]->name});
$f->hidden({name=>"displayTitle",value=>0});
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),
-value=>[$templatePosition],
@ -86,12 +102,11 @@ sub www_edit {
-options=>WebGUI::Page::getTemplatePositions($session{page}{templateId}),
-subtext=>WebGUI::Page::drawTemplate($session{page}{templateId})
);
$f->date("startDate",WebGUI::International::get(497),$startDate);
$f->date("endDate",WebGUI::International::get(498),$endDate);
$f->integer("spacer",WebGUI::International::get(3,$_[0]->get("namespace")),$spacer);
$f->integer("width",WebGUI::International::get(4,$_[0]->get("namespace")),$width);
$f->text("class",WebGUI::International::get(5,$_[0]->get("namespace")),$class);
$f->submit;
$f->getTab("privileges")->date("startDate",WebGUI::International::get(497),$startDate);
$f->getTab("privileges")->date("endDate",WebGUI::International::get(498),$endDate);
$f->getTab("properties")->integer("spacer",WebGUI::International::get(3,$_[0]->get("namespace")),$spacer);
$f->getTab("properties")->integer("width",WebGUI::International::get(4,$_[0]->get("namespace")),$width);
$f->getTab("properties")->text("class",WebGUI::International::get(5,$_[0]->get("namespace")),$class);
$output .= $f->print;
return $output;
}

View file

@ -81,12 +81,12 @@ sub www_deleteQuestionConfirm {
#-------------------------------------------------------------------
sub www_edit {
my ($f, $output);
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$output = helpIcon(1,$_[0]->get("namespace"));
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$_[0]->get("namespace"),
@ -94,7 +94,7 @@ sub www_edit {
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
$properties->whatNext(
-options=>{
addQuestion=>WebGUI::International::get(75,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
@ -102,7 +102,10 @@ sub www_edit {
-value=>"addQuestion"
);
}
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
return $output;
}

View file

@ -145,23 +145,24 @@ sub www_download {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $paginateAfter, $proceed);
my ($output, $paginateAfter, $proceed);
if ($_[0]->get("wobjectId") eq "new") {
$proceed = 1;
}
$output .= helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(9,$_[0]->get("namespace")).'</h1>';
$paginateAfter = $_[0]->get("paginateAfter") || 50;
$f = WebGUI::HTMLForm->new;
$f->template(
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->integer("paginateAfter",WebGUI::International::get(20,$_[0]->get("namespace")),$paginateAfter);
$layout->integer("paginateAfter",WebGUI::International::get(20,$_[0]->get("namespace")),$paginateAfter);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
$properties->whatNext(
-options=>{
addFile=>WebGUI::International::get(74,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
@ -169,7 +170,10 @@ sub www_edit {
-value=>"addFile"
);
}
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
return $output;
}

View file

@ -60,56 +60,50 @@ sub new {
}
#-------------------------------------------------------------------
sub www_copy {
if (WebGUI::Privilege::canEditPage()) {
$_[0]->duplicate;
return "";
} else {
return WebGUI::Privilege::insufficient();
}
sub uiLevel {
return 5;
}
#-------------------------------------------------------------------
sub www_edit {
my (%htmlFilter, $output, $f, $startDate, $endDate, $templatePosition, $proxiedUrl, %hash);
if (WebGUI::Privilege::canEditPage()) {
%hash=(5=>5,10=>10,20=>20,30=>30,60=>60);
%htmlFilter = ('none'=>WebGUI::International::get(420), 'most'=>WebGUI::International::get(421),
'javascript'=>WebGUI::International::get(526), 'all'=>WebGUI::International::get(419));
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(2,$_[0]->get("namespace")).'</h1>';
$templatePosition = $_[0]->get("templatePosition") || '0';
$startDate = $_[0]->get("startDate") || $session{page}{startDate};
$endDate = $_[0]->get("endDate") || $session{page}{endDate};
$f = WebGUI::HTMLForm->new;
$f->url("proxiedUrl", WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("proxiedUrl")||'http://');
$f->yesNo(
-name=>"followExternal",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("followExternal"),
-uiLevel=>5
);
$f->yesNo(
-name=>"followRedirect",
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("followRedirect"),
-uiLevel=>5
);
$f->yesNo(
-name=>"removeStyle",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("removeStyle"),
-uiLevel=>5
);
$f->select("filterHtml",\%htmlFilter,WebGUI::International::get(7,$_[0]->get("namespace")),[$_[0]->get("filterHtml")||"javascript"]);
$f->select("timeout", \%hash, WebGUI::International::get(4,$_[0]->get("namespace")),[$_[0]->get("timeout")||30]);
$f->text("cookiebox", WebGUI::International::get(9,$_[0]->get("namespace")),$_[0]->get("cookiebox")||'/tmp');
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my %hash;
tie %hash, 'Tie::IxHash';
%hash=(5=>5,10=>10,20=>20,30=>30,60=>60);
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(2,$_[0]->get("namespace")).'</h1>';
my $privileges = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$properties->url(
-name=>"proxiedUrl", WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("proxiedUrl")||'http://');
$privileges->yesNo(
-name=>"followExternal",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("followExternal")
);
$properties->yesNo(
-name=>"followRedirect",
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("followRedirect")
);
$layout->yesNo(
-name=>"removeStyle",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("removeStyle")
);
$layout->filterContent(
-name=>"filterHtml",
-value=>$_[0]->get("filterHtml")||"javascript"
);
$properties->select("timeout", \%hash, WebGUI::International::get(4,$_[0]->get("namespace")),[$_[0]->get("timeout")||30]);
$properties->text("cookiebox", WebGUI::International::get(9,$_[0]->get("namespace")),$_[0]->get("cookiebox")||'/tmp');
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-privileges=>$privileges->printRowsOnly
);
return $output;
}
#-------------------------------------------------------------------

View file

@ -58,21 +58,24 @@ sub new {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $template);
$template = $_[0]->get("templateId") || 1;
$output = helpIcon(1,$_[0]->get("namespace"));
my $template = $_[0]->get("templateId") || 1;
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->url("linkURL",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("linkURL"));
$f->raw($_[0]->fileProperty("attachment",2));
$f->template(
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$properties->url("linkURL",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("linkURL"));
$properties->raw($_[0]->fileProperty("attachment",2));
$layout->template(
-name=>"templateId",
-value=>$template,
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
return $output;
}

View file

@ -82,24 +82,21 @@ sub www_deleteLinkConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($proceed, $f, $output, $indent, $lineSpacing, $bullet);
if ($_[0]->get("wobjectId") eq "new") {
$proceed = 1;
}
$bullet = $_[0]->get("bullet") || '&middot;';
$lineSpacing = $_[0]->get("lineSpacing") || 1;
$indent = $_[0]->get("indent") || 5;
$output = helpIcon(1,$_[0]->get("namespace"));
my $bullet = $_[0]->get("bullet") || '&middot;';
my $lineSpacing = $_[0]->get("lineSpacing") || 1;
my $indent = $_[0]->get("indent") || 5;
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(10,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
$properties->whatNext(
-options=>{
addLink=>WebGUI::International::get(13,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
@ -107,7 +104,10 @@ sub www_edit {
-value=>"addLink"
);
}
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
return $output;
}

View file

@ -129,7 +129,6 @@ sub www_edit {
foreach my $field (@fields) {
$data{$field} = $_[0]->get($field) if ($_[0]->get($field));
}
if ($_[0]->get("wobjectId") eq "new") {
$proceed = 1;
}

View file

@ -73,21 +73,24 @@ sub status {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $messagesPerPage);
$messagesPerPage = $_[0]->get("messagesPerPage") || 50;
$output = helpIcon(1,$_[0]->get("namespace"));
my $messagesPerPage = $_[0]->get("messagesPerPage") || 50;
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->integer("messagesPerPage",WebGUI::International::get(4,$_[0]->get("namespace")),$messagesPerPage);
$f->template(
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->integer("messagesPerPage",WebGUI::International::get(4,$_[0]->get("namespace")),$messagesPerPage);
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->raw($_[0]->SUPER::discussionProperties);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$properties->raw($_[0]->SUPER::discussionProperties);
$output .= $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly
);
return $output;
}

View file

@ -92,7 +92,7 @@ sub purge {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($f, $i, $output, $active, $voteGroup, $graphWidth, $answers, $randomizeAnswers);
my ($i, $output, $active, $voteGroup, $graphWidth, $answers, $randomizeAnswers);
if ($_[0]->get("wobjectId") eq "new") {
$active = 1;
$randomizeAnswers = 1;
@ -109,19 +109,25 @@ sub www_edit {
}
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(9,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->yesNo("active",WebGUI::International::get(3,$_[0]->get("namespace")),$active);
$f->group("voteGroup",WebGUI::International::get(4,$_[0]->get("namespace")),[$voteGroup]);
my $privileges = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$privileges->yesNo("active",WebGUI::International::get(3,$_[0]->get("namespace")),$active);
$privileges->group("voteGroup",WebGUI::International::get(4,$_[0]->get("namespace")),[$voteGroup]);
if ($session{setting}{useKarma}) {
$f->integer("karmaPerVote",WebGUI::International::get(20,$_[0]->get("namespace")),$_[0]->get("karmaPerVote"));
$properties->integer("karmaPerVote",WebGUI::International::get(20,$_[0]->get("namespace")),$_[0]->get("karmaPerVote"));
} else {
$f->hidden("karmaPerVote",$_[0]->get("karmaPerVote"));
$properties->hidden("karmaPerVote",$_[0]->get("karmaPerVote"));
}
$f->integer("graphWidth",WebGUI::International::get(5,$_[0]->get("namespace")),$graphWidth);
$f->text("question",WebGUI::International::get(6,$_[0]->get("namespace")),$_[0]->get("question"));
$f->textarea("answers",WebGUI::International::get(7,$_[0]->get("namespace")).'<span class="formSubtext"><br>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</span>',$answers);
$f->yesNo("randomizeAnswers",WebGUI::International::get(72,$_[0]->get("namespace")),$randomizeAnswers);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$layout->integer("graphWidth",WebGUI::International::get(5,$_[0]->get("namespace")),$graphWidth);
$properties->text("question",WebGUI::International::get(6,$_[0]->get("namespace")),$_[0]->get("question"));
$properties->textarea("answers",WebGUI::International::get(7,$_[0]->get("namespace")).'<span class="formSubtext"><br>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</span>',$answers);
$layout->yesNo("randomizeAnswers",WebGUI::International::get(72,$_[0]->get("namespace")),$randomizeAnswers);
$output .= $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly,
-privileges=>$privileges->printRowsOnly
);
if ($_[0]->get("wobjectId") ne "new") {
$output .= '<p>';
$output .= '<a href="'.WebGUI::URL::page('func=resetVotes&wid='.$_[0]->get("wobjectId")).'">'

View file

@ -272,31 +272,35 @@ sub www_deleteSpecificationConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($f, $output, $template);
$output = helpIcon(1,$_[0]->get("namespace"));
my $output = helpIcon(1,$_[0]->get("namespace"));
my $template;
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
if ($_[0]->get("wobjectId") eq "new") {
$template = 1;
} else {
$template = $_[0]->get("templateId");
}
$f = WebGUI::HTMLForm->new;
$f->template(
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$template,
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(61,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->text("price",WebGUI::International::get(10,$_[0]->get("namespace")),$_[0]->get("price"));
$f->text("productNumber",WebGUI::International::get(11,$_[0]->get("namespace")),$_[0]->get("productNumber"));
$f->raw($_[0]->fileProperty("image1",7));
$f->raw($_[0]->fileProperty("image2",8));
$f->raw($_[0]->fileProperty("image3",9));
$f->raw($_[0]->fileProperty("brochure",13));
$f->raw($_[0]->fileProperty("manual",14));
$f->raw($_[0]->fileProperty("warranty",15));
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$properties->text("price",WebGUI::International::get(10,$_[0]->get("namespace")),$_[0]->get("price"));
$properties->text("productNumber",WebGUI::International::get(11,$_[0]->get("namespace")),$_[0]->get("productNumber"));
$properties->raw($_[0]->fileProperty("image1",7));
$properties->raw($_[0]->fileProperty("image2",8));
$properties->raw($_[0]->fileProperty("image3",9));
$properties->raw($_[0]->fileProperty("brochure",13));
$properties->raw($_[0]->fileProperty("manual",14));
$properties->raw($_[0]->fileProperty("warranty",15));
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
);
return $output;
}

View file

@ -69,23 +69,29 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $dsn, $username, $paginateAfter);
my ($output, $dsn, $username, $paginateAfter);
$dsn = $_[0]->get("DSN") || $session{config}{dsn};
$username = $_[0]->get("username") || $session{config}{dbuser};
$paginateAfter = $_[0]->get("paginateAfter") || 50;
$f = WebGUI::HTMLForm->new;
my $privileges = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</h1>';
$f->yesNo("preprocessMacros",WebGUI::International::get(15,$_[0]->get("namespace")),$_[0]->get("preprocessMacros"));
$f->yesNo("debugMode",WebGUI::International::get(16,$_[0]->get("namespace")),$_[0]->get("debugMode"));
$f->textarea("dbQuery",WebGUI::International::get(4,$_[0]->get("namespace")),$_[0]->get("dbQuery"));
$f->textarea("template",WebGUI::International::get(3,$_[0]->get("namespace")),$_[0]->get("template"));
$f->text("DSN",WebGUI::International::get(5,$_[0]->get("namespace")),$dsn);
$f->text("username",WebGUI::International::get(6,$_[0]->get("namespace")),$username);
$f->password("identifier",WebGUI::International::get(7,$_[0]->get("namespace")),$_[0]->get("identifier"));
$f->integer("paginateAfter",WebGUI::International::get(14,$_[0]->get("namespace")),$paginateAfter);
$f->yesNo("convertCarriageReturns",WebGUI::International::get(13,$_[0]->get("namespace")),$_[0]->get("convertCarriageReturns"));
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$properties->yesNo("preprocessMacros",WebGUI::International::get(15,$_[0]->get("namespace")),$_[0]->get("preprocessMacros"));
$properties->yesNo("debugMode",WebGUI::International::get(16,$_[0]->get("namespace")),$_[0]->get("debugMode"));
$properties->textarea("dbQuery",WebGUI::International::get(4,$_[0]->get("namespace")),$_[0]->get("dbQuery"));
$layout->textarea("template",WebGUI::International::get(3,$_[0]->get("namespace")),$_[0]->get("template"));
$privileges->text("DSN",WebGUI::International::get(5,$_[0]->get("namespace")),$dsn);
$privileges->text("username",WebGUI::International::get(6,$_[0]->get("namespace")),$username);
$privileges->password("identifier",WebGUI::International::get(7,$_[0]->get("namespace")),$_[0]->get("identifier"));
$layout->integer("paginateAfter",WebGUI::International::get(14,$_[0]->get("namespace")),$paginateAfter);
$layout->yesNo("convertCarriageReturns",WebGUI::International::get(13,$_[0]->get("namespace")),$_[0]->get("convertCarriageReturns"));
$output .= $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly,
-privileges=>$privileges->printRowsOnly
);
return $output;
}

View file

@ -88,7 +88,7 @@ sub new {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $indent, $startLevel);
my ($output, $indent, $startLevel);
if ($_[0]->get("wobjectId") eq "new") {
$startLevel = 1;
} else {
@ -99,7 +99,7 @@ sub www_edit {
$indent = $_[0]->get("indent") || 5;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(5,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
my $f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
@ -118,7 +118,7 @@ sub www_edit {
);
$f->integer("depth",WebGUI::International::get(4,$_[0]->get("namespace")),$_[0]->get("depth"));
$f->integer("indent",WebGUI::International::get(6,$_[0]->get("namespace")),$indent);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(-layout=>$f->printRowsOnly);
return $output;
}

View file

@ -206,7 +206,7 @@ sub www_deleteAllResponsesConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($f, $output, $surveyId, $questionOrder, $mode, $groupToViewReports, $sth, %data, $groupToTakeSurvey);
my ($output, $surveyId, $questionOrder, $mode, $groupToViewReports, $sth, %data, $groupToTakeSurvey);
tie %data, 'Tie::CPHash';
$mode = $_[0]->get("mode") || "survey";
$questionOrder = $_[0]->get("questionOrder") || "sequential";
@ -215,9 +215,11 @@ sub www_edit {
$surveyId = $_[0]->get("Survey_id") || getNextId("Survey_id");
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(2,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("Survey_id",$surveyId);
$f->select(
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
my $privileges = WebGUI::HTMLForm->new;
$properties->hidden("Survey_id",$surveyId);
$layout->select(
-name=>"questionOrder",
-options=>{
sequential => WebGUI::International::get(5,$_[0]->get("namespace")),
@ -227,7 +229,7 @@ sub www_edit {
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>[$questionOrder]
);
$f->select(
$properties->select(
-name=>"mode",
-options=>{
survey => WebGUI::International::get(9,$_[0]->get("namespace")),
@ -236,18 +238,18 @@ sub www_edit {
-label=>WebGUI::International::get(11,$_[0]->get("namespace")),
-value=>[$mode]
);
$f->group(
$privileges->group(
-name=>"groupToTakeSurvey",
-value=>[$groupToTakeSurvey],
-label=>WebGUI::International::get(12,$_[0]->get("namespace"))
);
$f->group(
$privileges->group(
-name=>"groupToViewReports",
-label=>WebGUI::International::get(13,$_[0]->get("namespace")),
-value=>[$groupToViewReports]
);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
$properties->whatNext(
-options=>{
addQuestion=>WebGUI::International::get(28,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
@ -255,7 +257,11 @@ sub www_edit {
-value=>"addQuestion"
);
}
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$output .= $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-privileges=>$privileges->printRowsOnly
);
if ($_[0]->get("wobjectId") ne "new") {
$output .= '<a href="'.WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=editQuestion&qid=new')
.'">'.WebGUI::International::get(30,$_[0]->get("namespace")).'</a><p>';

View file

@ -43,7 +43,6 @@ sub duplicate {
submissionsPerPage=>$_[0]->get("submissionsPerPage"),
defaultStatus=>$_[0]->get("defaultStatus"),
groupToApprove=>$_[0]->get("groupToApprove"),
allowDiscussion=>$_[0]->get("allowDiscussion"),
karmaPerSubmission=>$_[0]->get("karmaPerSubmission"),
templateId=>$_[0]->get("templateId"),
submissionTemplateId=>$_[0]->get("submissionTemplateId")
@ -174,40 +173,47 @@ sub www_denySubmission {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $defaultStatus, $submissionsPerPage, $groupToApprove);
my ($output, $defaultStatus, $submissionsPerPage, $groupToApprove);
$groupToApprove = $_[0]->get("groupToApprove") || 4;
$submissionsPerPage = $_[0]->get("submissionsPerPage") || 50;
$defaultStatus = $_[0]->get("defaultStatus") || "Approved";
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(18,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
my $layout = WebGUI::HTMLForm->new;
my $privileges = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->template(
$layout->template(
-name=>"submissionTemplateId",
-value=>$_[0]->get("submissionTemplateId"),
-namespace=>$_[0]->get("namespace")."/Submission",
-label=>WebGUI::International::get(73,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->group("groupToApprove",WebGUI::International::get(1,$_[0]->get("namespace")),[$groupToApprove]);
$f->group("groupToContribute",WebGUI::International::get(2,$_[0]->get("namespace")),[$_[0]->get("groupToContribute")]);
$f->integer("submissionsPerPage",WebGUI::International::get(6,$_[0]->get("namespace")),$submissionsPerPage);
$f->select("defaultStatus",{Approved=>status('Approved'),Denied=>status('Denied'),Pending=>status('Pending')}
$privileges->group("groupToApprove",WebGUI::International::get(1,$_[0]->get("namespace")),[$groupToApprove]);
$privileges->group("groupToContribute",WebGUI::International::get(2,$_[0]->get("namespace")),[$_[0]->get("groupToContribute")]);
$layout->integer("submissionsPerPage",WebGUI::International::get(6,$_[0]->get("namespace")),$submissionsPerPage);
$privileges->select("defaultStatus",{Approved=>status('Approved'),Denied=>status('Denied'),Pending=>status('Pending')}
,WebGUI::International::get(563),[$defaultStatus]);
if ($session{setting}{useKarma}) {
$f->integer("karmaPerSubmission",WebGUI::International::get(30,$_[0]->get("namespace")),$_[0]->get("karmaPerSubmission"));
$properties->integer("karmaPerSubmission",WebGUI::International::get(30,$_[0]->get("namespace")),$_[0]->get("karmaPerSubmission"));
} else {
$f->hidden("karmaPerSubmission",$_[0]->get("karmaPerSubmission"));
$properties->hidden("karmaPerSubmission",$_[0]->get("karmaPerSubmission"));
}
$f->yesNo("allowDiscussion",WebGUI::International::get(48,$_[0]->get("namespace")),$_[0]->get("allowDiscussion"));
$f->raw($_[0]->SUPER::discussionProperties);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
$layout->filterContent(
-value=>$_[0]->get("filterContent")
);
$output .= $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-privileges=>$privileges->printRowsOnly,
-properties=>$properties->printRowsOnly
);
return $output;
}
@ -220,9 +226,9 @@ sub www_editSave {
groupToApprove=>$session{form}{groupToApprove},
defaultStatus=>$session{form}{defaultStatus},
karmaPerSubmission=>$session{form}{karmaPerSubmission},
allowDiscussion=>$session{form}{allowDiscussion},
templateId=>$session{form}{templateId},
submissionTemplateId=>$session{form}{submissionTemplateId}
submissionTemplateId=>$session{form}{submissionTemplateId},
filterContent=>$session{form}{filterContent}
});
return "";
}
@ -357,7 +363,7 @@ sub www_view {
$page = $p->getPageData;
$i = 0;
foreach $row (@$page) {
$page->[$i]->{content} = WebGUI::HTML::filter($page->[$i]->{content},$session{setting}{filterContributedHTML});
$page->[$i]->{content} = WebGUI::HTML::filter($page->[$i]->{content},$_[0]->get("filterContent"));
$page->[$i]->{content} =~ s/\n/\^\-\;/ unless ($page->[$i]->{content} =~ m/\^\-\;/);
@content = split(/\^\-\;/,$page->[$i]->{content});
if ($page->[$i]->{image} ne "") {
@ -406,7 +412,7 @@ sub www_viewSubmission {
return $_[0]->www_view unless ($submission->{USS_submissionId});
WebGUI::SQL->write("update USS_submission set views=views+1 where USS_submissionId=$session{form}{sid}");
$var{title} = $submission->{title};
$var{content} = WebGUI::HTML::filter($submission->{content},$session{setting}{filterContributedHTML});
$var{content} = WebGUI::HTML::filter($submission->{content},$_[0]->get("filterContent"));
$var{content} =~ s/\^\-\;//g;
$var{content} =~ s/\n/\<br\>/g if ($submission->{convertCarriageReturns});
$var{"user.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));

View file

@ -13,13 +13,13 @@ package WebGUI::Wobject::WobjectProxy;
use strict;
use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Page;
use WebGUI::TabForm;
use WebGUI::Template;
use WebGUI::Wobject;
@ -70,14 +70,29 @@ sub www_edit {
$templatePosition = $_[0]->get("templatePosition") || 1;
$startDate = $_[0]->get("startDate") || $session{page}{startDate};
$endDate = $_[0]->get("endDate") || $session{page}{endDate};
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("namespace",$_[0]->get("namespace")) if ($_[0]->get("wobjectId") eq "new");
$f->hidden("func","editSave");
$f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
$f->hidden("title",$_[0]->get("namespace"));
$f->hidden("displayTitle",0);
$f->select(
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
properties=>{
label=>WebGUI::International::get(893)
},
layout=>{
label=>WebGUI::International::get(105),
uiLevel=>5
},
privileges=>{
label=>WebGUI::International::get(107),
uiLevel=>9
}
);
$f = WebGUI::TabForm->new(\%tabs);
$f->hidden({name=>"wid",value=>$_[0]->get("wobjectId")});
$f->hidden({name=>"namespace",value=>$_[0]->get("namespace")}) if ($_[0]->get("wobjectId") eq "new");
$f->hidden({name=>"func",value=>"editSave"});
$f->getTab("properties")->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
$f->hidden({name=>"title",value=>$_[0]->name});
$f->hidden({name=>"displayTitle",value=>0});
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),
-value=>[$templatePosition],
@ -85,9 +100,9 @@ sub www_edit {
-options=>WebGUI::Page::getTemplatePositions($session{page}{templateId}),
-subtext=>WebGUI::Page::drawTemplate($session{page}{templateId})
);
$f->date("startDate",WebGUI::International::get(497),$startDate);
$f->date("endDate",WebGUI::International::get(498),$endDate);
$a = WebGUI::SQL->read("select pageId,menuTitle from page where pageId<2 or pageId>25 order by title");
$f->getTab("privileges")->date("startDate",WebGUI::International::get(497),$startDate);
$f->getTab("privileges")->date("endDate",WebGUI::International::get(498),$endDate);
$a = WebGUI::SQL->read("select pageId,menuTitle from page where pageId<2 or pageId>25 order by menuTitle");
while (%page = $a->hash) {
$b = WebGUI::SQL->read("select wobjectId,title from wobject
where pageId=".$page{pageId}." and namespace<>'WobjectProxy' and
@ -98,8 +113,7 @@ sub www_edit {
$b->finish;
}
$a->finish;
$f->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$_[0]->get("namespace")),[$_[0]->get("proxiedWobjectId")]);
$f->submit;
$f->getTab("properties")->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$_[0]->get("namespace")),[$_[0]->get("proxiedWobjectId")]);
$output .= $f->print;
return $output;
}