Switching to new wobject API.

This commit is contained in:
JT Smith 2003-03-08 19:26:01 +00:00
parent 4bed7d43db
commit 41cd27de26
22 changed files with 939 additions and 784 deletions

View file

@ -31,19 +31,10 @@ our @ISA = qw(WebGUI::Wobject);
sub duplicate {
my ($file, $w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Article->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$file = WebGUI::Attachment->new($_[0]->get("image"),$_[0]->get("wobjectId"));
$file->copy($w->get("wobjectId"));
$file->copy($w);
$file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId"));
$file->copy($w->get("wobjectId"));
$w->set({
templateId=>$_[0]->get("templateId"),
image=>$_[0]->get("image"),
linkTitle=>$_[0]->get("linkTitle"),
linkURL=>$_[0]->get("linkURL"),
attachment=>$_[0]->get("attachment"),
convertCarriageReturns=>$_[0]->get("convertCarriageReturns")
});
$file->copy($w);
}
#-------------------------------------------------------------------
@ -56,31 +47,31 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(image templateId linkTitle linkURL attachment convertCarriageReturns)],
1
-properties=>$property,
-extendedProperties=>{
image=>{ },
templateId=>{
defaultValue=>1
},
linkTitle=>{ },
linkURL=>{ },
attachment=>{ },
convertCarriageReturns=>{
defaultValue=>0
}
},
-useDiscussion=>1
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $editTimeout, $groupToModerate, $template);
if ($_[0]->get("wobjectId") eq "new") {
$editTimeout = 1;
} else {
$editTimeout = $_[0]->get("editTimeout");
}
$template = $_[0]->get("templateId") || 1;
$groupToModerate = $_[0]->get("groupToModerate") || 4;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</h1>';
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$template,
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(356),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
@ -96,32 +87,32 @@ sub www_edit {
$properties->text(
-name=>"linkTitle",
-label=>WebGUI::International::get(7,$_[0]->get("namespace")),
-value=>$_[0]->get("linkTitle"),
-value=>$_[0]->getValue("linkTitle"),
-uiLevel=>3
);
$properties->url(
-name=>"linkURL",
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("linkURL"),
-value=>$_[0]->getValue("linkURL"),
-uiLevel=>3
);
$layout->yesNo(
-name=>"convertCarriageReturns",
-label=>WebGUI::International::get(10,$_[0]->get("namespace")),
-value=>$_[0]->get("convertCarriageReturns"),
-value=>$_[0]->getValue("convertCarriageReturns"),
-subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,$_[0]->get("namespace")).'</span>',
-uiLevel=>5
);
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-layout=>$layout->printRowsOnly,
-headingId=>12,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($image, $attachment, %property);
$_[0]->SUPER::www_editSave() if ($_[0]->get("wobjectId") eq "new");
$image = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
@ -130,12 +121,7 @@ sub www_editSave {
$attachment->save("attachment");
$property{image} = $image->getFilename if ($image->getFilename ne "");
$property{attachment} = $attachment->getFilename if ($attachment->getFilename ne "");
$property{convertCarriageReturns} = $session{form}{convertCarriageReturns};
$property{linkTitle} = $session{form}{linkTitle};
$property{templateId} = $session{form}{templateId};
$property{linkURL} = $session{form}{linkURL};
$_[0]->SUPER::www_editSave(\%property);
return "";
return $_[0]->SUPER::www_editSave(\%property);
}
#-------------------------------------------------------------------

View file

@ -139,15 +139,6 @@ sub _drawSmallCalendar {
sub duplicate {
my ($sth, $w, @row, $newEventId, $previousRecurringEventId);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::EventsCalendar->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
templateId=>$_[0]->get("templateId"),
eventTemplateId=>$_[0]->get("eventTemplateId"),
startMonth=>$_[0]->get("startMonth"),
endMonth=>$_[0]->get("endMonth"),
defaultMonth=>$_[0]->get("defaultMonth"),
paginateAfter=>$_[0]->get("paginateAfter")
});
$sth = WebGUI::SQL->read("select * from EventsCalendar_event where wobjectId="
.$_[0]->get("wobjectId")." order by EventsCalendar_recurringId");
while (@row = $sth->array) {
@ -156,7 +147,7 @@ sub duplicate {
$row[6] = getNextId("EventsCalendar_recurringId");
$previousRecurringEventId = $row[6];
}
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, ".$w->get("wobjectId").", ".
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, ".$w.", ".
quote($row[2]).", ".quote($row[3]).", '".$row[4]."', '".$row[5]."', $row[6])");
}
$sth->finish;
@ -172,8 +163,27 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId eventTemplateId startMonth endMonth defaultMonth paginateAfter)]
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
},
eventTemplateId=>{
defaultValue=>1
},
startMonth=>{
defaultValue=>"current"
},
endMonth=>{
defaultValue=>"after12"
},
defaultMonth=>{
defaultValue=>"current"
},
paginateAfter=>{
defaultValue=>50
}
}
);
bless $self, $class;
}
@ -214,27 +224,19 @@ sub www_deleteEventConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $startMonth, $endMonth, $afterEdit, $defaultMonth, $paginateAfter);
$paginateAfter = $_[0]->get("paginateAfter") || 50;
$startMonth = $_[0]->get("startMonth") || "current";
$endMonth = $_[0]->get("endMonth") || "after12";
$defaultMonth = $_[0]->get("defaultMonth") || "current";
$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>';
my $afterEdit = 'func=edit&wid='.$_[0]->get("wobjectId") if ($_[0]->get("wobjectId") ne "new");
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(79,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
);
$layout->template(
-name=>"eventTemplateId",
-value=>$_[0]->get("eventTemplateId"),
-value=>$_[0]->getValue("eventTemplateId"),
-namespace=>$_[0]->get("namespace")."/Event",
-label=>WebGUI::International::get(80,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
@ -246,20 +248,23 @@ sub www_edit {
"first"=>WebGUI::International::get(83,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(81,$_[0]->get("namespace")),
-value=>[$startMonth]
-value=>[$_[0]->getValue("startMonth")]
);
my %options;
tie %options, 'Tie::IxHash';
%options = (
"last"=>WebGUI::International::get(85,$_[0]->get("namespace")),
"after12"=>WebGUI::International::get(86,$_[0]->get("namespace")),
"after9"=>WebGUI::International::get(87,$_[0]->get("namespace")),
"after6"=>WebGUI::International::get(88,$_[0]->get("namespace")),
"after3"=>WebGUI::International::get(89,$_[0]->get("namespace")),
"current"=>WebGUI::International::get(82,$_[0]->get("namespace"))
);
$properties->select(
-name=>"endMonth",
-options=>{
"last"=>WebGUI::International::get(85,$_[0]->get("namespace")),
"after12"=>WebGUI::International::get(86,$_[0]->get("namespace")),
"after9"=>WebGUI::International::get(87,$_[0]->get("namespace")),
"after6"=>WebGUI::International::get(88,$_[0]->get("namespace")),
"after3"=>WebGUI::International::get(89,$_[0]->get("namespace")),
"current"=>WebGUI::International::get(82,$_[0]->get("namespace")),
},
-options=>\%options,
-label=>WebGUI::International::get(84,$_[0]->get("namespace")),
-value=>[$endMonth]
-value=>[$_[0]->getValue("endMonth")]
);
$properties->select(
-name=>"defaultMonth",
@ -269,9 +274,13 @@ sub www_edit {
"first"=>WebGUI::International::get(83,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(90,$_[0]->get("namespace")),
-value=>[$defaultMonth]
-value=>[$_[0]->getValue("defaultMonth")]
);
$layout->integer("paginateAfter",WebGUI::International::get(19,$_[0]->get("namespace")),$paginateAfter);
$layout->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(19,$_[0]->get("namespace")),
-value=>$_[0]->getValue("paginateAfter")
);
if ($_[0]->get("wobjectId") eq "new") {
$properties->whatNext(
-options=>{
@ -281,24 +290,17 @@ sub www_edit {
-value=>"backToPage"
);
}
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-layout=>$layout->printRowsOnly,
-helpId=>1,
-headingId=>12
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
templateId=>$session{form}{templateId},
eventTemplateId=>$session{form}{eventTemplateId},
startMonth=>$session{form}{startMonth},
endMonth=>$session{form}{endMonth},
defaultMonth=>$session{form}{defaultMonth},
paginateAfter=>$session{form}{paginateAfter}
});
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addEvent") {
$session{form}{eid} = "new";
return $_[0]->www_editEvent;

View file

@ -27,18 +27,6 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::ExtraColumn->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
spacer=>$_[0]->get("spacer"),
width=>$_[0]->get("width"),
class=>$_[0]->get("class")
});
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
@ -49,8 +37,18 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(spacer width class)]
-properties=>$property,
-extendedProperties=>{
spacer=>{
defaultValue=>10
},
width=>{
defaultValue=>200
},
class=>{
defaultValue=>"content"
}
}
);
bless $self, $class;
}
@ -63,15 +61,9 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $endDate, $width, $class, $spacer,$startDate, $templatePosition);
my ($output, $f);
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
$width = $_[0]->get("width") || 200;
$spacer = $_[0]->get("spacer") || 10;
$templatePosition = $_[0]->get("templatePosition") || 1;
$class = $_[0]->get("class") || "content";
$startDate = $_[0]->get("startDate") || $session{page}{startDate};
$endDate = $_[0]->get("endDate") || $session{page}{endDate};
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
@ -91,37 +83,49 @@ sub www_edit {
$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->getTab("properties")->readOnly(
-value=>$_[0]->get("wobjectId"),
-label=>WebGUI::International::get(499)
);
$f->hidden({name=>"title",value=>$_[0]->name});
$f->hidden({name=>"displayTitle",value=>0});
$f->hidden({name=>"displayTitle",value=>$_[0]->getValue("displayTitle")});
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),
-value=>[$templatePosition],
-value=>[$_[0]->getValue("templatePosition")],
-uiLevel=>5,
-options=>WebGUI::Page::getTemplatePositions($session{page}{templateId}),
-subtext=>WebGUI::Page::drawTemplate($session{page}{templateId})
);
$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);
$f->getTab("privileges")->date(
-name=>"startDate",
-label=>WebGUI::International::get(497),
-value=>$_[0]->getValue("startDate")
);
$f->getTab("privileges")->date(
-name=>"endDate",
-label=>WebGUI::International::get(498),
-value=>$_[0]->getValue("endDate")
);
$f->getTab("properties")->integer(
-name=>"spacer",
-label=>WebGUI::International::get(3,$_[0]->get("namespace"))
-value=>,$_[0]->getValue("spacer")
);
$f->getTab("properties")->integer(
-name=>"width",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("width")
);
$f->getTab("properties")->text(
-name=>"class",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>$_[0]->get("class")
);
$output .= $f->print;
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
spacer=>$session{form}{spacer},
width=>$session{form}{width},
class=>$session{form}{class}
});
return "";
}
#-------------------------------------------------------------------
sub www_view {
return '</td><td width="'.$_[0]->get("spacer").'"></td><td width="'.$_[0]->get("width").'" class="'.$_[0]->get("class").'" valign="top">';

View file

@ -29,14 +29,10 @@ sub duplicate {
my ($w, %data, $newQuestionId, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::FAQ->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
templateId=>$_[0]->get("templateId")
});
$sth = WebGUI::SQL->read("select * from FAQ_question where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newQuestionId = getNextId("FAQ_questionId");
WebGUI::SQL->write("insert into FAQ_question values (".$w->get("wobjectId").", $newQuestionId, "
WebGUI::SQL->write("insert into FAQ_question values (".$w.", $newQuestionId, "
.quote($data{question}).", ".quote($data{answer}).", $data{sequenceNumber})");
}
$sth->finish;
@ -52,8 +48,12 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId)]
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
}
}
);
bless $self, $class;
}
@ -81,14 +81,11 @@ sub www_deleteQuestionConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</h1>';
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(74,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
@ -102,24 +99,21 @@ sub www_edit {
-value=>"addQuestion"
);
}
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-headingId=>8,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
templateId=>$session{form}{templateId}
});
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addQuestion") {
$session{form}{qid} = "new";
return $_[0]->www_editQuestion();
}
return "";
}
#-------------------------------------------------------------------

View file

@ -42,21 +42,16 @@ sub duplicate {
my ($file, $w, %row, $sth, $newDownloadId);
tie %row, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::FileManager->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
paginateAfter=>$_[0]->get("paginateAfter"),
templateId=>$_[0]->get("templateId")
});
$sth = WebGUI::SQL->read("select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId"));
while (%row = $sth->hash) {
$newDownloadId = getNextId("FileManager_fileId");
$file = WebGUI::Attachment->new($row{downloadFile},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w->get("wobjectId"),$newDownloadId);
$file->copy($w,$newDownloadId);
$file = WebGUI::Attachment->new($row{alternateVersion1},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w->get("wobjectId"),$newDownloadId);
$file->copy($w,$newDownloadId);
$file = WebGUI::Attachment->new($row{alternateVersion2},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w->get("wobjectId"),$newDownloadId);
WebGUI::SQL->write("insert into FileManager_file values ($newDownloadId, ".$w->get("wobjectId").", ".
$file->copy($w,$newDownloadId);
WebGUI::SQL->write("insert into FileManager_file values ($newDownloadId, ".$w.", ".
quote($row{fileTitle}).", ".quote($row{downloadFile}).", $row{groupToView}, ".
quote($row{briefSynopsis}).", $row{dateUploaded}, $row{sequenceNumber}, ".
quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).")");
@ -74,17 +69,19 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(paginateAfter templateId)]
-properties=>$property,
-extendedProperties=>{
paginateAfter=>{
defaultValue=>50,
},
templateId=>{
defaultValue=>1
}
}
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(paginateAfter templateId)]);
}
#-------------------------------------------------------------------
sub uiLevel {
return 4;
@ -144,23 +141,19 @@ sub www_download {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
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;
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$layout->integer("paginateAfter",WebGUI::International::get(20,$_[0]->get("namespace")),$paginateAfter);
$layout->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(20,$_[0]->get("namespace")),
-value=>$_[0]->getValue("paginateAfter")
);
if ($_[0]->get("wobjectId") eq "new") {
$properties->whatNext(
-options=>{
@ -170,20 +163,18 @@ sub www_edit {
-value=>"addFile"
);
}
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-headingId=>9,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
paginateAfter=>$session{form}{paginateAfter},
templateId=>$session{form}{templateId}
});
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addFile") {
$session{form}{did} = "new";
return $_[0]->www_editDownload();

View file

@ -27,22 +27,6 @@ use WebGUI::ProxyParse;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
proxiedUrl=>$_[0]->get("proxiedUrl"),
timeout=>$_[0]->get("timeout"),
removeStyle=>$_[0]->get("removeStyle"),
filterHtml=>$_[0]->get("filterHtml"),
followExternal=>$_[0]->get("followExternal"),
followRedirect=>$_[0]->get("followRedirect"),
cookiebox=>$_[0]->get("cookiebox")
});
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(3,$_[0]->get("namespace"));
@ -53,8 +37,30 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(proxiedUrl timeout removeStyle filterHtml followExternal followRedirect cookiebox)]
-properties=>$property,
-extendedProperties=>{
proxiedUrl=>{
defaultValue=>'http://'
},
timeout=>{
defaultValue=>30
},
removeStyle=>{
defaultValue=>1
},
filterHtml=>{
defaultValue=>"javascript"
},
followExternal=>{
defaultValue=>1
},
followRedirect=>{
defaultValue=>0
},
cookiebox=>{
defaultValue=>'/tmp'
}
}
);
bless $self, $class;
}
@ -66,64 +72,56 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
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://');
-name=>"proxiedUrl",
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>$_[0]->getValue("proxiedUrl")
);
$privileges->yesNo(
-name=>"followExternal",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("followExternal")
-value=>$_[0]->getValue("followExternal")
);
$properties->yesNo(
-name=>"followRedirect",
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("followRedirect")
-value=>$_[0]->getValue("followRedirect")
);
$layout->yesNo(
-name=>"removeStyle",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("removeStyle")
-value=>$_[0]->getValue("removeStyle")
);
$layout->filterContent(
-name=>"filterHtml",
-value=>$_[0]->get("filterHtml")||"javascript"
-value=>$_[0]->getValue("filterHtml")
);
$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->select(
-name=>"timeout",
-options=>\%hash,
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>[$_[0]->getValue("timeout")]
);
$properties->text(
-name=>"cookiebox",
-label=>WebGUI::International::get(9,$_[0]->get("namespace")),
-value=>$_[0]->getValue("cookiebox")
);
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-privileges=>$privileges->printRowsOnly
-privileges=>$privileges->printRowsOnly,
-helpId=>1,
-headingId=>2
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
if (WebGUI::Privilege::canEditPage()) {
$_[0]->SUPER::www_editSave();
$_[0]->set({
proxiedUrl=>$session{form}{proxiedUrl},
timeout=>$session{form}{timeout},
removeStyle=>$session{form}{removeStyle},
filterHtml=>$session{form}{filterHtml},
followExternal=>$session{form}{followExternal},
followRedirect=>$session{form}{followRedirect},
cookiebox=>$session{form}{cookiebox}
});
return "";
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_view {

View file

@ -29,14 +29,8 @@ our @ISA = qw(WebGUI::Wobject);
sub duplicate {
my ($w, $f);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Item->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
linkURL=>$_[0]->get("linkURL"),
attachment=>$_[0]->get("attachment"),
templateId=>$_[0]->get("templateId")
});
$f = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId"));
$f->copy($w->get("wobjectId"));
$f->copy($w);
}
#-------------------------------------------------------------------
@ -49,34 +43,40 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(linkURL attachment templateId)]
-properties=>$property,
-extendedProperties=>{
linkURL=>{},
attachment=>{},
templateId=>{
defaultValue=>1
}
}
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my $template = $_[0]->get("templateId") || 1;
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$properties->url("linkURL",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("linkURL"));
$properties->url(
-name=>"linkURL",
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>$_[0]->getValue("linkURL"));
$properties->raw($_[0]->fileProperty("attachment",2));
$layout->template(
-name=>"templateId",
-value=>$template,
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-layout=>$layout->printRowsOnly,
-headingId=>6,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
@ -86,7 +86,6 @@ sub www_editSave {
$_[0]->SUPER::www_editSave() if ($_[0]->get("wobjectId") eq "new");
$attachment = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
$attachment->save("attachment");
$property->{linkURL} = $session{form}{linkURL};
$property->{attachment} = $attachment->getFilename if ($attachment->getFilename ne "");
$_[0]->SUPER::www_editSave($property);
return "";

View file

@ -29,9 +29,6 @@ sub duplicate {
my ($w, $sth, $row);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::LinkList->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
templateId=>$_[0]->get("templateId")
});
$sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId")
." order by sequenceNumber");
while ($row = $sth->hashRef) {
@ -51,8 +48,12 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId)]
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
}
}
);
bless $self, $class;
}
@ -81,17 +82,11 @@ sub www_deleteLinkConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
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>';
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
@ -104,19 +99,18 @@ sub www_edit {
-value=>"addLink"
);
}
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-headingId=>10,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
templateId=>$session{form}{templateId}
});
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addLink") {
$session{form}{lid} = "new";
$_[0]->www_editLink();

View file

@ -26,30 +26,12 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our @fields = qw(width fromField fromStatus toField toStatus
ccField ccStatus bccField bccStatus subjectField subjectStatus acknowledgement storeEntries);
#-------------------------------------------------------------------
sub duplicate {
my ($w, %data, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::MailForm->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
width=>$_[0]->get("width"),
fromField=>$_[0]->get("fromField"),
fromStatus=>$_[0]->get("fromStatus"),
toField=>$_[0]->get("toField"),
toStatus=>$_[0]->get("toStatus"),
ccField=>$_[0]->get("ccField"),
ccStatus=>$_[0]->get("ccStatus"),
bccField=>$_[0]->get("bccField"),
bccStatus=>$_[0]->get("bccStatus"),
subjectField=>$_[0]->get("subjectField"),
subjectStatus=>$_[0]->get("subjectStatus"),
acknowledgement=>$_[0]->get("acknowledgement"),
storeEntries=>$_[0]->get("storeEntries"),
});
$sth = WebGUI::SQL->read("select * from MailForm_field where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$data{MailForm_fieldId} = "new";
@ -68,8 +50,38 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
\@fields
-properties=>$property,
-extendedProperties=>{
width=>{
defaultValue=>45
},
fromField=>{},
fromStatus=>{
defaultValue=>3
},
toField=>{
defaultValue=>$session{setting}{companyEmail}
},
toStatus=>{
defaultValue=>1
},
ccField=>{},
ccStatus=>{
defaultValue=>1
},
bccField=>{},
bccStatus=>{
defaultValue=>1
},
subjectField=>{},
subjectStatus=>{
defaultValue=>3
},
acknowledgement=>{},
storeEntries=>{
defaultValue=>1
}
}
);
bless $self, $class;
}
@ -104,67 +116,91 @@ sub www_deleteFieldConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $proceed);
my %fieldStatus = ( 1 => WebGUI::International::get(4, $_[0]->get("namespace")),
2 => WebGUI::International::get(5, $_[0]->get("namespace")),
3 => WebGUI::International::get(6, $_[0]->get("namespace")) );
# field defaults
my %data = (
width => 45,
fromField => '',
fromStatus => 3,
toField => $session{setting}{companyEmail},
toStatus => 1,
ccField => '',
ccStatus => 1,
bccField => '',
bccStatus => 1,
subjectField => WebGUI::International::get(2, $_[0]->get("namespace")),
subjectStatus => 3,
acknowledgement => WebGUI::International::get(3, $_[0]->get("namespace")),
storeEntries => 1,
);
# initialize fields from existing data, if any
foreach my $field (@fields) {
$data{$field} = $_[0]->get($field) if ($_[0]->get($field));
}
if ($_[0]->get("wobjectId") eq "new") {
$proceed = 1;
}
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(7, $_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->integer("width",WebGUI::International::get(8, $_[0]->get("namespace")),$_[0]->get("width") || 45);
$f->raw( $_[0]->_textSelectRow("fromField",WebGUI::International::get(10, $_[0]->get("namespace")),$data{fromField},128,
"fromStatus",\%fieldStatus,$data{fromStatus}) );
$f->raw( $_[0]->_textSelectRow("toField",WebGUI::International::get(11, $_[0]->get("namespace")),$data{toField},128,
"toStatus",\%fieldStatus,$data{toStatus}) );
$f->raw( $_[0]->_textSelectRow("ccField",WebGUI::International::get(12, $_[0]->get("namespace")),$data{ccField},128,
"ccStatus",\%fieldStatus,$data{ccStatus}) );
$f->raw( $_[0]->_textSelectRow("bccField",WebGUI::International::get(13, $_[0]->get("namespace")),$data{bccField},128,
"bccStatus",\%fieldStatus,$data{bccStatus}) );
$f->raw( $_[0]->_textSelectRow("subjectField",WebGUI::International::get(14, $_[0]->get("namespace")),$data{subjectField},128,
"subjectStatus",\%fieldStatus,$data{subjectStatus}) );
$f->HTMLArea("acknowledgement",WebGUI::International::get(16, $_[0]->get("namespace")),$_[0]->get("acknowledgement") || WebGUI::International::get(3, $_[0]->get("namespace")));
$f->yesNo("storeEntries",WebGUI::International::get(26,$_[0]->get("namespace")),[ $data{storeEntries} ]);
$f->yesNo("proceed",WebGUI::International::get(15,$_[0]->get("namespace")),$proceed);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
return $output;
my $proceed = 1 if ($_[0]->get("wobjectId") eq "new");
my $f = WebGUI::HTMLForm->new;
$f->integer(
-name=>"width",
-label=>WebGUI::International::get(8, $_[0]->get("namespace")),
-value=>$_[0]->getValue("width")
);
$f->raw( $_[0]->_textSelectRow(
"fromField",
WebGUI::International::get(10, $_[0]->get("namespace")),
$_[0]->getValue("fromField"),
128,
"fromStatus",
\%fieldStatus,
$_[0]->getValue("fromStatus")
) );
$f->raw( $_[0]->_textSelectRow(
"toField",
WebGUI::International::get(11, $_[0]->get("namespace")),
$_[0]->getValue("toField"),
128,
"toStatus",
\%fieldStatus,
$_[0]->getValue("toStatus")
) );
$f->raw( $_[0]->_textSelectRow(
"ccField",
WebGUI::International::get(12, $_[0]->get("namespace")),
$_[0]->getValue("ccField"),
128,
"ccStatus",
\%fieldStatus,
$_[0]->getValue("ccStatus")
) );
$f->raw( $_[0]->_textSelectRow(
"bccField",
WebGUI::International::get(13, $_[0]->get("namespace")),
$_[0]->getValue("bccField"),
128,
"bccStatus",
\%fieldStatus,
$_[0]->getValue("bccStatus")
) );
$f->raw( $_[0]->_textSelectRow(
"subjectField",
WebGUI::International::get(14, $_[0]->get("namespace")),
($_[0]->get("subjectField") || WebGUI::International::get(2, $_[0]->get("namespace"))),
128,
"subjectStatus",
\%fieldStatus,
$_[0]->getValue("subjectStatus")
) );
$f->HTMLArea(
-name=>"acknowledgement",
-label=>WebGUI::International::get(16, $_[0]->get("namespace")),
-value=>($_[0]->get("acknowledgement") || WebGUI::International::get(3, $_[0]->get("namespace")))
);
$f->yesNo(
-name=>"storeEntries",
-label=>WebGUI::International::get(26,$_[0]->get("namespace")),
-value=>[ $_[0]->getValue("storeEntries") ]
);
$f->yesNo(
-name=>"proceed",
-label=>WebGUI::International::get(15,$_[0]->get("namespace")),
-label=>$proceed
);
return $_[0]->SUPER::www_edit(
-properties=>$f->printRowsOnly,
-helpId=>1,
-headingId=>7
);
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($property);
foreach my $field (@fields) {
$property->{$field} = $session{form}{$field};
}
$_[0]->SUPER::www_editSave($property);
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed}) {
return $_[0]->www_editField();
return $_[0]->www_editField();
} else {
return "";
return "";
}
}

View file

@ -27,16 +27,6 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::MessageBoard->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
messagesPerPage=>$_[0]->get("messagesPerPage"),
templateId=>$_[0]->get("templateId")
});
}
#-------------------------------------------------------------------
sub name {
@ -48,17 +38,19 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId messagesPerPage)]
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
},
messagesPerPage=>{
defaultValue=>50
}
}
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(templateId messagesPerPage)]);
}
#-------------------------------------------------------------------
sub status {
if ($_[0] eq "Approved") {
@ -72,37 +64,29 @@ sub status {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my $messagesPerPage = $_[0]->get("messagesPerPage") || 50;
my $output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->integer("messagesPerPage",WebGUI::International::get(4,$_[0]->get("namespace")),$messagesPerPage);
$layout->integer(
-name=>"messagesPerPage",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("messagesPerPage")
);
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$properties->raw($_[0]->SUPER::discussionProperties);
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly
-properties=>$properties->printRowsOnly,
-headingId=>6,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
messagesPerPage=>$session{form}{messagesPerPage},
templateId=>$session{form}{templateId}
});
return "";
}
#-------------------------------------------------------------------
sub www_showMessage {

View file

@ -31,38 +31,9 @@ our @ISA = qw(WebGUI::Wobject);
sub duplicate {
my ($w, $f, $sth, @row);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Poll->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
active=>$_[0]->get("active"),
randomizeAnswers=>$_[0]->get("randomizeAnswers"),
graphWidth=>$_[0]->get("graphWidth"),
voteGroup=>$_[0]->get("voteGroup"),
question=>$_[0]->get("question"),
karmaPerVote=>$_[0]->get("karmaPerVote"),
a1=>$_[0]->get("a1"),
a2=>$_[0]->get("a2"),
a3=>$_[0]->get("a3"),
a4=>$_[0]->get("a4"),
a5=>$_[0]->get("a5"),
a6=>$_[0]->get("a6"),
a7=>$_[0]->get("a7"),
a8=>$_[0]->get("a8"),
a9=>$_[0]->get("a9"),
a10=>$_[0]->get("a10"),
a11=>$_[0]->get("a11"),
a12=>$_[0]->get("a12"),
a13=>$_[0]->get("a13"),
a14=>$_[0]->get("a14"),
a15=>$_[0]->get("a15"),
a16=>$_[0]->get("a16"),
a17=>$_[0]->get("a17"),
a18=>$_[0]->get("a18"),
a19=>$_[0]->get("a19"),
a20=>$_[0]->get("a20")
});
$sth = WebGUI::SQL->read("select * from Poll_answer where wobjectId=".$_[0]->get("wobjectId"));
while (@row = $sth->array) {
WebGUI::SQL->write("insert into Poll_answer values (".$w->get("wobjectId").", '$row[1]', $row[2], '$row[3]')");
WebGUI::SQL->write("insert into Poll_answer values (".$w.", '$row[1]', $row[2], '$row[3]')");
}
$sth->finish;
}
@ -77,8 +48,45 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(active karmaPerVote graphWidth voteGroup question randomizeAnswers a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20)]
-properties=>$property,
-extendedProperties=>{
active=>{
defaultValue=>1
},
karmaPerVote=>{
defaultValue=>0
},
graphWidth=>{
defaultValue=>150
},
voteGroup=>{
defaultValue=>7
},
question=>{},
randomizeAnswers=>{
defaultValue=>1
},
a1=>{},
a2=>{},
a3=>{},
a4=>{},
a5=>{},
a6=>{},
a7=>{},
a8=>{},
a9=>{},
a10=>{},
a11=>{},
a12=>{},
a13=>{},
a14=>{},
a15=>{},
a16=>{},
a17=>{},
a18=>{},
a19=>{},
a20=>{}
}
);
bless $self, $class;
}
@ -91,42 +99,61 @@ sub purge {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($i, $output, $active, $voteGroup, $graphWidth, $answers, $randomizeAnswers);
if ($_[0]->get("wobjectId") eq "new") {
$active = 1;
$randomizeAnswers = 1;
} else {
$active = $_[0]->get("active");
$randomizeAnswers = $_[0]->get("randomizeAnswers");
}
$voteGroup = $_[0]->get("voteGroup") || 7;
$graphWidth = $_[0]->get("graphWidth") || 150;
my ($i, $active, $voteGroup, $graphWidth, $answers, $randomizeAnswers);
for ($i=1; $i<=20; $i++) {
if ($_[0]->get('a'.$i) =~ /\C/) {
$answers .= $_[0]->get("a".$i)."\n";
$answers .= $_[0]->getValue("a".$i)."\n";
}
}
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(9,$_[0]->get("namespace")).'</h1>';
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]);
$privileges->yesNo(
-name=>"active",
-label=>WebGUI::International::get(3,$_[0]->get("namespace")),
-value=>$_[0]->getValue("active")
);
$privileges->group(
-name=>"voteGroup",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>[$_[0]->getValue("voteGroup")]
);
if ($session{setting}{useKarma}) {
$properties->integer("karmaPerVote",WebGUI::International::get(20,$_[0]->get("namespace")),$_[0]->get("karmaPerVote"));
$properties->integer(
-name=>"karmaPerVote",
-label=>WebGUI::International::get(20,$_[0]->get("namespace")),
-value=>$_[0]->getValue("karmaPerVote")
);
} else {
$properties->hidden("karmaPerVote",$_[0]->get("karmaPerVote"));
$properties->hidden("karmaPerVote",$_[0]->getValue("karmaPerVote"));
}
$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->integer(
-name=>"graphWidth",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>$_[0]->getValue("graphWidth")
);
$properties->text(
-name=>"question",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>$_[0]->getValue("question")
);
$properties->textarea(
-name=>"answers",
-value=>WebGUI::International::get(7,$_[0]->get("namespace")).
-subtext=>'<span class="formSubtext"><br>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</span>',
-value=>$answers
);
$layout->yesNo(
-name=>"randomizeAnswers",
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-value=>$randomizeAnswers
);
my $output = $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly,
-privileges=>$privileges->printRowsOnly
-privileges=>$privileges->printRowsOnly,
-headingId=>9,
-helpId=>1
);
if ($_[0]->get("wobjectId") ne "new") {
$output .= '<p>';
@ -138,20 +165,12 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my (@answer, $i, $property);
@answer = split("\n",$session{form}{answers});
for ($i=1; $i<=20; $i++) {
$property->{'a'.$i} = $answer[($i-1)];
}
$property->{randomizeAnswers} = $session{form}{randomizeAnswers};
$property->{karmaPerVote} = $session{form}{karmaPerVote};
$property->{voteGroup} = $session{form}{voteGroup};
$property->{graphWidth} = $session{form}{graphWidth};
$property->{active} = $session{form}{active};
$property->{question} = $session{form}{question};
$_[0]->SUPER::www_editSave($property);
return "";
return $_[0]->SUPER::www_editSave($property);
}
#-------------------------------------------------------------------

View file

@ -26,21 +26,10 @@ our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $file, %data, $newId, $sth);
my ($w, %data, $file, $row, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Product->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
image1=>$_[0]->get("image1"),
image2=>$_[0]->get("image2"),
image3=>$_[0]->get("image3"),
warranty=>$_[0]->get("warranty"),
manual=>$_[0]->get("manual"),
brochure=>$_[0]->get("brochure"),
price=>$_[0]->get("price"),
templateId=>$_[0]->get("templateId"),
productNumber=>$_[0]->get("productNumber")
});
$file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId"));
$file->copy($w->get("wobjectId"));
$file = WebGUI::Attachment->new($_[0]->get("image2"),$_[0]->get("wobjectId"));
@ -54,24 +43,21 @@ sub duplicate {
$file = WebGUI::Attachment->new($_[0]->get("warranty"),$_[0]->get("wobjectId"));
$file->copy($w->get("wobjectId"));
$sth = WebGUI::SQL->read("select * from Product_feature where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newId = getNextId("Product_featureId");
WebGUI::SQL->write("insert into Product_feature values (".$w->get("wobjectId").", $newId, "
.quote($data{feature}).", $data{sequenceNumber})");
while ($row = $sth->hashRef) {
$row->{"Product_featureId"} = "new";
$w->setCollateral("Product_feature","Product_featureId",$row);
}
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_benefit where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newId = getNextId("Product_benefitId");
WebGUI::SQL->write("insert into Product_benefit values (".$w->get("wobjectId").", $newId, "
.quote($data{benefit}).", $data{sequenceNumber})");
while ($row = $sth->hashRef) {
$row->{"Product_benefitId"} = "new";
$w->setCollateral("Product_benefit","Product_benefitId",$row);
}
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_specification where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newId = getNextId("Product_specificationId");
WebGUI::SQL->write("insert into Product_specification values (".$w->get("wobjectId").", $newId, "
.quote($data{name}).", ".quote($data{value}).", ".quote($data{units}).", $data{sequenceNumber})");
while ($row = $sth->hashRef) {
$row->{"Product_specificationId"} = "new";
$w->setCollateral("Product_specifcation","Product_specificationId",$row);
}
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_accessory where wobjectId=".$_[0]->get("wobjectId"));
@ -98,8 +84,20 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(price templateId productNumber image1 image2 image3 manual brochure warranty)]
-properties=>$property,
-extendedProperties=>{
price=>{},
templateId=>{
defaultValue=>1
},
productNumber=>{},
image1=>{},
image2=>{},
image3=>{},
manual=>{},
brochure=>{},
warranty=>{}
}
);
bless $self, $class;
}
@ -271,37 +269,37 @@ sub www_deleteSpecificationConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
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");
}
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$template,
-value=>$_[0]->getValue("template"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(61,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$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->text(
-name=>"price",
-label=>WebGUI::International::get(10,$_[0]->get("namespace")),
-value=>$_[0]->getValue("price")
);
$properties->text(
-name=>"productNumber",
-label=>WebGUI::International::get(11,$_[0]->get("namespace")),
-value=>$_[0]->getValue("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(
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly
-layout=>$layout->printRowsOnly,
-helpId=>1,
-headingId=>6
);
return $output;
}
#-------------------------------------------------------------------
@ -327,9 +325,6 @@ sub www_editSave {
$file = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
$file->save("warranty");
$property{warranty}=$file->getFilename("warranty") if ($file->getFilename("warranty") ne "");
$property{templateId}=$session{form}{templateId};
$property{price}=$session{form}{price};
$property{productNumber}=$session{form}{productNumber};
$_[0]->SUPER::www_editSave(\%property);
return "";
}

View file

@ -26,23 +26,6 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::SQLReport->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
template=>$_[0]->get("template"),
dbQuery=>$_[0]->get("dbQuery"),
DSN=>$_[0]->get("DSN"),
username=>$_[0]->get("username"),
identifier=>$_[0]->get("identifier"),
convertCarriageReturns=>$_[0]->get("convertCarriageReturns"),
paginateAfter=>$_[0]->get("paginateAfter"),
preprocessMacros=>$_[0]->get("preprocessMacros"),
debugMode=>$_[0]->get("debugMode")
});
}
#-------------------------------------------------------------------
sub name {
@ -55,8 +38,30 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)]
-properties=>$property,
-extendedProperties=>{
template=>{},
dbQuery=>{},
DSN=>{
defaultValue=>$session{config}{dsn}
},
username=>{
defaultValue=>$session{config}{dbuser}
},
identifier=>{},
convertCarriageReturns=>{
defaultValue=>0
},
paginateAfter=>{
defaultValue=>50
},
preprocessMacros=>{
defaultValue=>0
},
debugMode=>{
defaultValue=>0
}
}
);
bless $self, $class;
}
@ -68,49 +73,63 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $dsn, $username, $paginateAfter);
$dsn = $_[0]->get("DSN") || $session{config}{dsn};
$username = $_[0]->get("username") || $session{config}{dbuser};
$paginateAfter = $_[0]->get("paginateAfter") || 50;
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>';
$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(
$properties->yesNo(
-name=>"preprocessMacros",
-label=>WebGUI::International::get(15,$_[0]->get("namespace")),
-value=>$_[0]->getValue("preprocessMacros")
);
$properties->yesNo(
-name=>"debugMode",
-label=>WebGUI::International::get(16,$_[0]->get("namespace")),
-value=>$_[0]->getValue("debugMode")
);
$properties->textarea(
-name=>"dbQuery",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("dbQuery")
);
$layout->textarea(
-name=>"template",
-label=>WebGUI::International::get(3,$_[0]->get("namespace")),
-value=>$_[0]->getValue("template")
);
$privileges->text(
-name=>"DSN",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>$_[0]->getValue("DSN")
);
$privileges->text(
-name=>"username",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>$_[0]->getValue("username")
);
$privileges->password(
-name=>"identifier",
-label=>WebGUI::International::get(7,$_[0]->get("namespace")),
-value=>$_[0]->getValue("identifier")
);
$layout->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(14,$_[0]->get("namespace")),
-value=>$_[0]->getValue("paginateAfter")
);
$layout->yesNo(
-name=>"convertCarriageReturns",
-label=>WebGUI::International::get(13,$_[0]->get("namespace")),
-value=>$_[0]->getValue("convertCarriageReturns")
);
return $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly,
-privileges=>$privileges->printRowsOnly
-privileges=>$privileges->printRowsOnly,
-headingId=>8,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
template=>$session{form}{template},
dbQuery=>$session{form}{dbQuery},
convertCarriageReturns=>$session{form}{convertCarriageReturns},
DSN=>$session{form}{DSN},
username=>$session{form}{username},
identifier=>$session{form}{identifier},
paginateAfter=>$session{form}{paginateAfter},
preprocessMacros=>$session{form}{preprocessMacros},
debugMode=>$session{form}{debugMode}
});
return "";
}
#-------------------------------------------------------------------
sub www_view {

View file

@ -55,18 +55,6 @@ sub _traversePageTree {
return \@pages;
}
#-------------------------------------------------------------------
sub duplicate {
my ($w, $f);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::SiteMap->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
startAtThisLevel=>$_[0]->get("startAtThisLevel"),
templateId=>$_[0]->get("templateId"),
indent=>$_[0]->get("indent"),
depth=>$_[0]->get("depth")
});
}
#-------------------------------------------------------------------
sub name {
@ -78,8 +66,21 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(startAtThisLevel indent templateId depth)]
-properties=>$property,
-extendedProperties=>{
startAtThisLevel=>{
defaultValue=>1
},
indent=>{
defaultValue=>5
},
templateId=>{
defaultValue=>1
},
depth=>{
defaultValue=>0
}
}
);
bless $self, $class;
}
@ -87,52 +88,42 @@ sub new {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $indent, $startLevel);
if ($_[0]->get("wobjectId") eq "new") {
$startLevel = 1;
} else {
$startLevel = $_[0]->get("startAtThisLevel");
}
my $options = WebGUI::SQL->buildHashRef("select pageId,title from page where parentId=0
and (pageId=1 or pageId>999) order by title");
$indent = $_[0]->get("indent") || 5;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(5,$_[0]->get("namespace")).'</h1>';
my $f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->select(
-name=>"startAtThisLevel",
-label=>WebGUI::International::get(3,$_[0]->get("namespace")),
-value=>[$startLevel],
-value=>[$_[0]->getValue("startLevel")],
-options=>{
0=>WebGUI::International::get(75,$_[0]->get("namespace")),
$session{page}{pageId}=>WebGUI::International::get(74,$_[0]->get("namespace")),
%{$options}
}
);
$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(-layout=>$f->printRowsOnly);
return $output;
$f->integer(
-name=>"depth",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("depth")
);
$f->integer(
-name=>"indent",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>$_[0]->getValue("indent")
);
return $_[0]->SUPER::www_edit(
-layout=>$f->printRowsOnly,
-headingId=>5,
-helpId=>1
);
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
indent=>$session{form}{indent},
startAtThisLevel=>$session{form}{startAtThisLevel},
depth=>$session{form}{depth},
templateId=>$session{form}{templateId}
});
return "";
}
#-------------------------------------------------------------------
sub www_view {

View file

@ -71,11 +71,7 @@ sub duplicate {
$w = WebGUI::Wobject::Survey->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$newSurveyId = getNextId("Survey_id");
$w->set({
questionOrder=>$_[0]->get("questionOrder"),
groupToTakeSurvey=>$_[0]->get("groupToTakeSurvey"),
Survey_id=>$newSurveyId,
groupToViewReports=>$_[0]->get("groupToViewReports"),
mode=>$_[0]->get("mode")
Survey_id=>$newSurveyId
});
$a = WebGUI::SQL->read("select * from Survey_question where Survey_id=".$_[0]->get("Survey_id")
." order by sequenceNumber");
@ -116,8 +112,22 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(Survey_id questionOrder groupToTakeSurvey groupToViewReports mode)]
-properties=>$property,
-extendedProperties=>{
Survey_id=>{},
questionOrder=>{
defaultValue=>"sequential"
},
groupToTakeSurvey=>{
defaultValue=>2
},
groupToViewReports=>{
defaultValue=>4
},
mode=>{
defaultValue=>"survey"
}
}
);
bless $self, $class;
}
@ -205,20 +215,12 @@ sub www_deleteAllResponsesConfirm {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $surveyId, $questionOrder, $mode, $groupToViewReports, $sth, %data, $groupToTakeSurvey);
my ($output, $sth, %data);
tie %data, 'Tie::CPHash';
$mode = $_[0]->get("mode") || "survey";
$questionOrder = $_[0]->get("questionOrder") || "sequential";
$groupToViewReports = $_[0]->get("groupToViewReports") || 4;
$groupToTakeSurvey = $_[0]->get("groupToTakeSurvey") || 2;
$surveyId = $_[0]->get("Survey_id") || getNextId("Survey_id");
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(2,$_[0]->get("namespace")).'</h1>';
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
my $privileges = WebGUI::HTMLForm->new;
$properties->hidden("Survey_id",$surveyId);
$properties->hidden("Survey_id",($_[0]->get("Survey_id") || getNextId("Survey_id")));
$layout->select(
-name=>"questionOrder",
-options=>{
@ -227,7 +229,7 @@ sub www_edit {
response => WebGUI::International::get(7,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>[$questionOrder]
-value=>[$_[0]->getValue("questionOrder")]
);
$properties->select(
-name=>"mode",
@ -236,17 +238,17 @@ sub www_edit {
quiz => WebGUI::International::get(10,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(11,$_[0]->get("namespace")),
-value=>[$mode]
-value=>[$_[0]->getValue("mode")]
);
$privileges->group(
-name=>"groupToTakeSurvey",
-value=>[$groupToTakeSurvey],
-value=>[$_[0]->getValue("groupToTakeSurvey")],
-label=>WebGUI::International::get(12,$_[0]->get("namespace"))
);
$privileges->group(
-name=>"groupToViewReports",
-label=>WebGUI::International::get(13,$_[0]->get("namespace")),
-value=>[$groupToViewReports]
-value=>[$_[0]->getValue("groupToViewReports")]
);
if ($_[0]->get("wobjectId") eq "new") {
$properties->whatNext(
@ -257,10 +259,12 @@ sub www_edit {
-value=>"addQuestion"
);
}
$output .= $_[0]->SUPER::www_edit(
$output = $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-privileges=>$privileges->printRowsOnly
-privileges=>$privileges->printRowsOnly,
-headingId=>2,
-helpId=>1
);
if ($_[0]->get("wobjectId") ne "new") {
$output .= '<a href="'.WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=editQuestion&qid=new')
@ -282,13 +286,7 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
groupToTakeSurvey=>$session{form}{groupToTakeSurvey},
groupToViewReports=>$session{form}{groupToViewReports},
mode=>$session{form}{mode},
Survey_id=>$session{form}{Survey_id},
questionOrder=>$session{form}{questionOrder}
});
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addQuestion") {
$session{form}{qid} = "new";
return $_[0]->www_editQuestion;

View file

@ -23,17 +23,6 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::SyndicatedContent->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
rssUrl=>$_[0]->get("rssUrl"),
content=>$_[0]->get("content"),
lastFetched=>$_[0]->get("lastFetched")
});
}
#-------------------------------------------------------------------
sub name {
@ -45,8 +34,16 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(rssUrl content lastFetched)]
-properties=>$property,
-extendedProperties=>{
rssUrl=>{},
content=>{
defaultValue=>'Not yet fetched!'
},
lastFetched=>{
defaultValue=>time()
}
}
);
bless $self, $class;
}
@ -59,33 +56,32 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f);
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(4,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->url("rssUrl",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("rssUrl"));
my $f = WebGUI::HTMLForm->new;
$f->url(
-name=>"rssUrl",
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>$_[0]->getValue("rssUrl")
);
if ($_[0]->get("wobjectId") ne "new") {
$f->readOnly(WebGUI::DateTime::epochToHuman($_[0]->get("lastFetched"),"%z %Z"),WebGUI::International::get(5,$_[0]->get("namespace")));
$f->readOnly($_[0]->get("content"),WebGUI::International::get(6,$_[0]->get("namespace")));
$f->readOnly(
-value=>WebGUI::DateTime::epochToHuman($_[0]->getValue("lastFetched"),"%z %Z"),
-label=>WebGUI::International::get(5,$_[0]->get("namespace"))
);
$f->readOnly(
-value=>$_[0]->getValue("content"),
-label=>WebGUI::International::get(6,$_[0]->get("namespace"))
);
} else {
$f->hidden("content","Not yet fetched!");
$f->hidden("lastFetched",time());
$f->hidden("content",$_[0]->getValue("content"));
$f->hidden("lastFetched",$_[0]->getValue("lastFetched"));
}
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
return $output;
return $_[0]->SUPER::www_edit(
-properties=>$f->printRowsOnly,
-headingId=>4,
-helpId=>1
);
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($property);
$property->{rssUrl} = $session{form}{rssUrl};
$property->{content} = $session{form}{content} if ($session{form}{content} ne "");
$property->{lastFetched} = $session{form}{lastFetched} if ($session{form}{lastFetched} ne "");
$_[0]->SUPER::www_editSave($property);
return "";
}
#-------------------------------------------------------------------
sub www_view {

View file

@ -37,28 +37,18 @@ sub duplicate {
my ($sth, $file, %row, $newSubmissionId, $w);
tie %row, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1],1);
$w = WebGUI::Wobject::USS->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
groupToContribute=>$_[0]->get("groupToContribute"),
submissionsPerPage=>$_[0]->get("submissionsPerPage"),
defaultStatus=>$_[0]->get("defaultStatus"),
groupToApprove=>$_[0]->get("groupToApprove"),
karmaPerSubmission=>$_[0]->get("karmaPerSubmission"),
templateId=>$_[0]->get("templateId"),
submissionTemplateId=>$_[0]->get("submissionTemplateId")
});
$sth = WebGUI::SQL->read("select * from USS_submission where wobjectId=".$_[0]->get("wobjectId"));
while (%row = $sth->hash) {
$newSubmissionId = getNextId("USS_submissionId");
$file = WebGUI::Attachment->new($row{image},$_[0]->get("wobjectId"),$row{USS_submissionId});
$file->copy($w->get("wobjectId"),$newSubmissionId);
$file->copy($w,$newSubmissionId);
$file = WebGUI::Attachment->new($row{attachment},$_[0]->get("wobjectId"),$row{USS_submissionId});
$file->copy($w->get("wobjectId"),$newSubmissionId);
WebGUI::SQL->write("insert into USS_submission values (".$w->get("wobjectId").", $newSubmissionId, ".
$file->copy($w,$newSubmissionId);
WebGUI::SQL->write("insert into USS_submission values (".$w.", $newSubmissionId, ".
quote($row{title}).", $row{dateSubmitted}, ".quote($row{username}).", '$row{userId}', ".quote($row{content}).", ".
quote($row{image}).", ".quote($row{attachment}).", '$row{status}', '$row{convertCarriageReturns}',
'$row{views}')");
WebGUI::Discussion::duplicate($_[0]->get("wobjectId"),$w->get("wobjectId"),$row{USS_submissionId},$newSubmissionId);
WebGUI::Discussion::duplicate($_[0]->get("wobjectId"),$w,$row{USS_submissionId},$newSubmissionId);
}
$sth->finish;
}
@ -73,10 +63,37 @@ sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(submissionsPerPage groupToContribute groupToApprove defaultStatus
submissionTemplateId templateId karmaPerSubmission allowDiscussion)],
1
-properties=>$property,
-useDiscussion=>1<
-extendedProperties=>{
submissionsPerPage=>{
defaultValue=>50
},
groupToContribute=>{
defaultValue=>2
},
groupToApprove=>{
defaultValue=>4
},
defaultStatus=>{
defaultValue=>"Approved"
},
submissionTemplateId=>{
defaultValue=>1
},
templateId=>{
defaultValue=>1
},
karmaPerSubmission=>{
defaultValue=>0
},
allowDiscussion=>{
defaultValue=>0
},
filterContent=>{
defaultValue=>"javascript"
}
}
);
bless $self, $class;
}
@ -172,49 +189,67 @@ sub www_denySubmission {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
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>';
my $layout = WebGUI::HTMLForm->new;
my $privileges = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$layout->template(
-name=>"submissionTemplateId",
-value=>$_[0]->get("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")
);
$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]);
$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("karmaPerSubmission",WebGUI::International::get(30,$_[0]->get("namespace")),$_[0]->get("karmaPerSubmission"));
$properties->integer(
-name=>"karmaPerSubmission",
-label=>WebGUI::International::get(30,$_[0]->get("namespace")),
-value=>$_[0]->getValue("karmaPerSubmission")
);
} else {
$properties->hidden("karmaPerSubmission",$_[0]->get("karmaPerSubmission"));
$properties->hidden("karmaPerSubmission",$_[0]->getValue("karmaPerSubmission"));
}
$layout->filterContent(
-value=>$_[0]->get("filterContent")
-value=>$_[0]->getValue("filterContent")
);
$output .= $_[0]->SUPER::www_edit(
return $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-privileges=>$privileges->printRowsOnly,
-properties=>$properties->printRowsOnly
-properties=>$properties->printRowsOnly,
-headingId=>18,
-helpId=>1
);
return $output;
}
#-------------------------------------------------------------------

View file

@ -26,16 +26,6 @@ use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
proxiedWobjectId=>$_[0]->get("proxiedWobjectId")
});
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(3,$_[0]->get("namespace"));
@ -45,9 +35,11 @@ sub name {
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(proxiedWobjectId)]
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
proxiedWobjectId=>{ }
}
);
bless $self, $class;
}
@ -61,15 +53,12 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $startDate, $endDate, $templatePosition,%wobjects, %page, %wobject, $a, $b);
my ($output, $f, %wobjects, %page, %wobject, $a, $b);
tie %wobject, 'Tie::CPHash';
tie %page, 'Tie::CPHash';
tie %wobjects, 'Tie::IxHash';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(2,$_[0]->get("namespace")).'</h1>';
$templatePosition = $_[0]->get("templatePosition") || 1;
$startDate = $_[0]->get("startDate") || $session{page}{startDate};
$endDate = $_[0]->get("endDate") || $session{page}{endDate};
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
@ -89,19 +78,30 @@ sub www_edit {
$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->getTab("properties")->readOnly(
-value=>$_[0]->get("wobjectId"),
-label=>WebGUI::International::get(499)
);
$f->hidden({name=>"title",value=>$_[0]->name});
$f->hidden({name=>"displayTitle",value=>0});
$f->hidden({name=>"displayTitle",value=>$_[0]->getValue("displayTitle")});
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),
-value=>[$templatePosition],
-value=>[$_[0]->getValue("templatePosition")],
-uiLevel=>5,
-options=>WebGUI::Page::getTemplatePositions($session{page}{templateId}),
-subtext=>WebGUI::Page::drawTemplate($session{page}{templateId})
);
$f->getTab("privileges")->date("startDate",WebGUI::International::get(497),$startDate);
$f->getTab("privileges")->date("endDate",WebGUI::International::get(498),$endDate);
$f->getTab("privileges")->date(
-name=>"startDate",
-label=>WebGUI::International::get(497),
-value=>$_[0]->getValue("startDate")
);
$f->getTab("privileges")->date(
-name=>"endDate",
-label=>WebGUI::International::get(498),
-value=>$_[0]->getValue("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
@ -113,20 +113,16 @@ sub www_edit {
$b->finish;
}
$a->finish;
$f->getTab("properties")->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$_[0]->get("namespace")),[$_[0]->get("proxiedWobjectId")]);
$f->getTab("properties")->select(
-name=>"proxiedWobjectId",
-options=>\%wobjects,
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>[$_[0]->getValue("proxiedWobjectId")]
);
$output .= $f->print;
return $output;
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->SUPER::www_editSave({
proxiedWobjectId=>$session{form}{proxiedWobjectId}
});
return "";
}
#-------------------------------------------------------------------
sub www_view {
return WebGUI::International::get(4,$_[0]->get("namespace"));