Switching wobjects over to new API.

This commit is contained in:
JT Smith 2003-03-03 02:16:15 +00:00
parent d1066988b1
commit 6c4771d0ca
20 changed files with 708 additions and 511 deletions

View file

@ -519,7 +519,7 @@ sub name {
#-------------------------------------------------------------------
=head2 new ( properties [, extendedProperties, allowDiscussion] )
=head2 new ( properties [, extendedProperties, useDiscussion] )
Constructor.
@ -548,7 +548,7 @@ Then the extended property list would be "[something, foo, bar]".
NOTE: This is used to define the wobject and should only be passed in by a wobject subclass.
=item allowDiscussion
=item useDiscussion
Defaults to "0". If set to "1" this will add a discussion properties tab to this wobject to enable content managers to set the properties of a discussion attached to this wobject.
@ -562,14 +562,14 @@ sub new {
my $self = shift;
my $properties = shift;
my $extendedProperties = shift;
my $allowDiscussion = shift || 0;
my $useDiscussion = shift || 0;
my $wobjectProperties = [qw(userDefined1 userDefined2 userDefined3 userDefined4 userDefined5
moderationType groupToModerate groupToPost karmaPerPost editTimeout filterPost addEditStampToPosts
title displayTitle description pageId templatePosition startDate endDate sequenceNumber)];
bless({
_property=>$properties,
_extendedProperties=>$extendedProperties,
_allowDiscussion=>$allowDiscussion,
_useDiscussion=>$useDiscussion,
_wobjectProperties=>$wobjectProperties
},
$self);
@ -593,11 +593,7 @@ sub new {
=cut
sub processMacros {
if ($_[0]->get("processMacros")) {
return WebGUI::Macro::process($_[1]);
} else {
return $_[1];
}
return WebGUI::Macro::process($_[1]);
}
#-------------------------------------------------------------------
@ -1109,7 +1105,7 @@ sub www_edit {
-value=>$_[0]->get("description")
);
$f->raw($_[1]);
if ($_[0]->{_allowDiscussion}) {
if ($_[0]->{_useDiscussion}) {
$f->raw($_[0]->discussionProperties);
}
$f->submit;

View file

@ -25,14 +25,13 @@ use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "Article";
#-------------------------------------------------------------------
sub duplicate {
my ($file, $w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Article->new({wobjectId=>$w,namespace=>$namespace});
$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 = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId"));
@ -50,12 +49,19 @@ sub duplicate {
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(1,$namespace);
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
$_[0]->SUPER::new($_[1],[qw(image templateId linkTitle linkURL attachment convertCarriageReturns allowDiscussion)],1);
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(image templateId linkTitle linkURL attachment convertCarriageReturns allowDiscussion)],
1
);
bless $self, $class;
}
#-------------------------------------------------------------------
@ -69,13 +75,13 @@ sub www_edit {
}
$template = $_[0]->get("templateId") || 1;
$groupToModerate = $_[0]->get("groupToModerate") || 4;
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(12,$namespace).'</h1>';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$template,
-namespace=>$namespace,
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(356),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
@ -89,26 +95,26 @@ sub www_edit {
);
$f->text(
-name=>"linkTitle",
-label=>WebGUI::International::get(7,$namespace),
-label=>WebGUI::International::get(7,$_[0]->get("namespace")),
-value=>$_[0]->get("linkTitle"),
-uiLevel=>3
);
$f->url(
-name=>"linkURL",
-label=>WebGUI::International::get(8,$namespace),
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("linkURL"),
-uiLevel=>3
);
$f->yesNo(
-name=>"convertCarriageReturns",
-label=>WebGUI::International::get(10,$namespace),
-label=>WebGUI::International::get(10,$_[0]->get("namespace")),
-value=>$_[0]->get("convertCarriageReturns"),
-subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,$namespace).'</span>',
-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,$namespace),
-label=>WebGUI::International::get(18,$_[0]->get("namespace")),
-value=>$_[0]->get("allowDiscussion"),
-uiLevel=>5
);
@ -139,7 +145,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_showMessage {
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(27,$namespace).'</a><br>');
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(27,$_[0]->get("namespace")).'</a><br>');
}
#-------------------------------------------------------------------
@ -165,9 +171,9 @@ sub www_view {
($var{"replies.count"}) = WebGUI::SQL->quickArray("select count(*) from discussion
where wobjectId=".$_[0]->get("wobjectId"));
$var{"replies.URL"} = WebGUI::URL::page('func=showMessage&wid='.$_[0]->get("wobjectId"));
$var{"replies.label"} = WebGUI::International::get(28,$namespace);
$var{"replies.label"} = WebGUI::International::get(28,$_[0]->get("namespace"));
$var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(24,$namespace);
$var{"post.label"} = WebGUI::International::get(24,$_[0]->get("namespace"));
}
return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
}

View file

@ -27,8 +27,6 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "EventsCalendar";
our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
sub _drawBigCalendar {
@ -141,7 +139,7 @@ sub _drawSmallCalendar {
sub duplicate {
my ($sth, $w, @row, $newEventId, $previousRecurringEventId);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::EventsCalendar->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::EventsCalendar->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
templateId=>$_[0]->get("templateId"),
eventTemplateId=>$_[0]->get("eventTemplateId"),
@ -165,14 +163,25 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from EventsCalendar_event where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
sub name {
return WebGUI::International::get(2,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(templateId eventTemplateId startMonth endMonth defaultMonth paginateAfter)]);
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId eventTemplateId startMonth endMonth defaultMonth paginateAfter)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from EventsCalendar_event where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
@ -180,14 +189,14 @@ sub www_deleteEvent {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output);
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(75,$namespace).'<p><blockquote>';
$output .= WebGUI::International::get(75,$_[0]->get("namespace")).'<p><blockquote>';
$output .= '<a href="'.WebGUI::URL::page('func=deleteEventConfirm&wid='.$session{form}{wid}.'&eid='
.$session{form}{eid}).'">'.WebGUI::International::get(76,$namespace).'</a><p>';
.$session{form}{eid}).'">'.WebGUI::International::get(76,$_[0]->get("namespace")).'</a><p>';
$output .= '<a href="'.WebGUI::URL::page('func=deleteEventConfirm&wid='.$session{form}{wid}.'&eid='
.$session{form}{eid}.'&rid='.$session{form}{rid}).'">'
.WebGUI::International::get(77,$namespace).'</a><p>';
.WebGUI::International::get(77,$_[0]->get("namespace")).'</a><p>';
$output .= '<a href="'.WebGUI::URL::page('func=edit&wid='.$session{form}{wid}).'">'
.WebGUI::International::get(78,$namespace).'</a>';
.WebGUI::International::get(78,$_[0]->get("namespace")).'</a>';
$output .= '</blockquote>';
return $output;
}
@ -212,60 +221,60 @@ sub www_edit {
$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,$namespace);
$output .= '<h1>'.WebGUI::International::get(12,$namespace).'</h1>';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-label=>WebGUI::International::get(79,$namespace),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(79,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
);
$f->template(
-name=>"eventTemplateId",
-value=>$_[0]->get("eventTemplateId"),
-namespace=>$namespace."/Event",
-label=>WebGUI::International::get(80,$namespace),
-namespace=>$_[0]->get("namespace")."/Event",
-label=>WebGUI::International::get(80,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
);
$f->select(
-name=>"startMonth",
-options=>{
"current"=>WebGUI::International::get(82,$namespace),
"first"=>WebGUI::International::get(83,$namespace)
"current"=>WebGUI::International::get(82,$_[0]->get("namespace")),
"first"=>WebGUI::International::get(83,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(81,$namespace),
-label=>WebGUI::International::get(81,$_[0]->get("namespace")),
-value=>[$startMonth]
);
$f->select(
-name=>"endMonth",
-options=>{
"last"=>WebGUI::International::get(85,$namespace),
"after12"=>WebGUI::International::get(86,$namespace),
"after9"=>WebGUI::International::get(87,$namespace),
"after6"=>WebGUI::International::get(88,$namespace),
"after3"=>WebGUI::International::get(89,$namespace),
"current"=>WebGUI::International::get(82,$namespace),
"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")),
},
-label=>WebGUI::International::get(84,$namespace),
-label=>WebGUI::International::get(84,$_[0]->get("namespace")),
-value=>[$endMonth]
);
$f->select(
-name=>"defaultMonth",
-options=>{
"current"=>WebGUI::International::get(82,$namespace),
"last"=>WebGUI::International::get(85,$namespace),
"first"=>WebGUI::International::get(83,$namespace)
"current"=>WebGUI::International::get(82,$_[0]->get("namespace")),
"last"=>WebGUI::International::get(85,$_[0]->get("namespace")),
"first"=>WebGUI::International::get(83,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(90,$namespace),
-label=>WebGUI::International::get(90,$_[0]->get("namespace")),
-value=>[$defaultMonth]
);
$f->integer("paginateAfter",WebGUI::International::get(19,$namespace),$paginateAfter);
$f->integer("paginateAfter",WebGUI::International::get(19,$_[0]->get("namespace")),$paginateAfter);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
-options=>{
addEvent=>WebGUI::International::get(91,$namespace),
addEvent=>WebGUI::International::get(91,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
@ -301,7 +310,7 @@ sub www_editEvent {
tie %event, 'Tie::CPHash';
tie %recursEvery, 'Tie::IxHash';
if ($session{form}{eid} eq "new") {
%recursEvery = ('never'=>WebGUI::International::get(4,$namespace),
%recursEvery = ('never'=>WebGUI::International::get(4,$_[0]->get("namespace")),
'day'=>WebGUI::International::get(700),
'week'=>WebGUI::International::get(701),
'month'=>WebGUI::International::get(702),
@ -309,10 +318,10 @@ sub www_editEvent {
);
$event{endDate} = $event{endDate};
$f = WebGUI::HTMLForm->new(1);
$f->raw('<tr><td class="formdescription" valign="top">'.WebGUI::International::get(8,$namespace).'</td><td class="tableData">');
$f->raw('<tr><td class="formdescription" valign="top">'.WebGUI::International::get(8,$_[0]->get("namespace")).'</td><td class="tableData">');
$f->integer("interval","",1,"","","",3);
$f->select("recursEvery",\%recursEvery);
$f->raw(' '.WebGUI::International::get(9,$namespace).' ');
$f->raw(' '.WebGUI::International::get(9,$_[0]->get("namespace")).' ');
$f->date("until");
$f->raw("</td><tr>");
$special = $f->printRowsOnly;
@ -322,19 +331,19 @@ sub www_editEvent {
$f->hidden("until");
$special = $f->printRowsOnly;
}
$output = helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(13,$namespace).'</h1>';
$output = helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(13,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("eid",$session{form}{eid});
$f->hidden("func","editEventSave");
$f->text("name",WebGUI::International::get(99),$event{name});
$f->HTMLArea("description",WebGUI::International::get(85),$event{description});
$f->date("startDate",WebGUI::International::get(14,$namespace),$event{startDate},
$f->date("startDate",WebGUI::International::get(14,$_[0]->get("namespace")),$event{startDate},
'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"');
$f->date(
-name=>"endDate",
-label=>WebGUI::International::get(15,$namespace),
-label=>WebGUI::International::get(15,$_[0]->get("namespace")),
-value=>$event{endDate},
-extras=>'onBlur="this.form.until.value=this.form.endDate.value;"'
);
@ -342,7 +351,7 @@ sub www_editEvent {
if ($session{form}{eid} eq "new") {
$f->whatNext(
-options=>{
addEvent=>WebGUI::International::get(91,$namespace),
addEvent=>WebGUI::International::get(91,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
@ -417,7 +426,7 @@ sub www_view {
my (%var, $junk, $sameDate, $p, @list, $date, $flag, %previous, @row, $i, $maxDate, $minDate);
tie %previous, 'Tie::CPHash';
$var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId"));
$var{"addevent.label"} = WebGUI::International::get(20,$namespace);
$var{"addevent.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
if ($_[0]->get("startMonth") eq "first") {
($minDate) = WebGUI::SQL->quickArray("select min(startDate) from EventsCalendar_event
where wobjectId=".$_[0]->get("wobjectId"));
@ -519,9 +528,9 @@ sub www_viewEvent {
tie %event, 'Tie::CPHash';
%event = WebGUI::SQL->quickHash("select * from EventsCalendar_event where EventsCalendar_eventId=$session{form}{eid}");
$var{title} = $event{name};
$var{"start.label"} = WebGUI::International::get(14,$namespace);
$var{"start.label"} = WebGUI::International::get(14,$_[0]->get("namespace"));
$var{"start.date"} = epochToHuman($event{startDate},"%z");
$var{"end.label"} = WebGUI::International::get(15,$namespace);
$var{"end.label"} = WebGUI::International::get(15,$_[0]->get("namespace"));
$var{"end.date"} = epochToHuman($event{endDate},"%z");
$var{canEdit} = WebGUI::Privilege::canEditPage();
$var{"edit.url"} = WebGUI::URL::page('func=editEvent&eid='.$session{form}{eid}.'&wid='.$session{form}{wid});
@ -532,12 +541,12 @@ sub www_viewEvent {
($id) = WebGUI::SQL->quickArray("select EventsCalendar_eventId from EventsCalendar_event
where EventsCalendar_eventId<>$event{EventsCalendar_eventId} and
startDate<=$event{startDate} order by startDate desc, endDate desc");
$var{"previous.label"} = '&laquo;'.WebGUI::International::get(92,$namespace);
$var{"previous.label"} = '&laquo;'.WebGUI::International::get(92,$_[0]->get("namespace"));
$var{"previous.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id);
($id) = WebGUI::SQL->quickArray("select EventsCalendar_eventId from EventsCalendar_event
where EventsCalendar_eventId<>$event{EventsCalendar_eventId} and
startDate>=$event{startDate} order by startDate, endDate");
$var{"next.label"} = WebGUI::International::get(93,$namespace).'&raquo;';
$var{"next.label"} = WebGUI::International::get(93,$_[0]->get("namespace")).'&raquo;';
$var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id);
$var{description} = $event{description};
return WebGUI::Template::process( WebGUI::Template::get( $_[0]->get("eventTemplateId"), "EventsCalendar/Event"), \%var);

View file

@ -24,15 +24,13 @@ use WebGUI::Template;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "ExtraColumn";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::ExtraColumn->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::ExtraColumn->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
spacer=>$_[0]->get("spacer"),
width=>$_[0]->get("width"),
@ -41,8 +39,19 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(spacer width class)]);
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(spacer width class)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
@ -54,8 +63,8 @@ sub uiLevel {
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $endDate, $width, $class, $spacer,$startDate, $templatePosition);
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(6,$namespace).'</h1>';
$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;
@ -67,7 +76,7 @@ sub www_edit {
$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",$namespace);
$f->hidden("title",$_[0]->get("namespace"));
$f->hidden("displayTitle",0);
$f->select(
-name=>"templatePosition",
@ -79,9 +88,9 @@ sub www_edit {
);
$f->date("startDate",WebGUI::International::get(497),$startDate);
$f->date("endDate",WebGUI::International::get(498),$endDate);
$f->integer("spacer",WebGUI::International::get(3,$namespace),$spacer);
$f->integer("width",WebGUI::International::get(4,$namespace),$width);
$f->text("class",WebGUI::International::get(5,$namespace),$class);
$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;
$output .= $f->print;
return $output;

View file

@ -22,8 +22,6 @@ use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "FAQ";
our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
@ -31,7 +29,7 @@ sub duplicate {
my ($w, %data, $newQuestionId, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::FAQ->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::FAQ->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
templateId=>$_[0]->get("templateId")
});
@ -44,21 +42,32 @@ sub duplicate {
$sth->finish;
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(2,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from FAQ_question where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(templateId)]);
}
#-------------------------------------------------------------------
sub www_deleteQuestion {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
return $_[0]->confirm(WebGUI::International::get(7,$namespace),
return $_[0]->confirm(WebGUI::International::get(7,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteQuestionConfirm&wid='.$_[0]->get("wobjectId").'&qid='.$session{form}{qid}));
}
@ -74,20 +83,20 @@ sub www_deleteQuestionConfirm {
sub www_edit {
my ($f, $output);
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(8,$namespace).'</h1>';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(8,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-label=>WebGUI::International::get(74,$namespace),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(74,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
-options=>{
addQuestion=>WebGUI::International::get(75,$namespace),
addQuestion=>WebGUI::International::get(75,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"addQuestion"
@ -115,26 +124,26 @@ sub www_editQuestion {
my ($output, $question, $f);
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$question = $_[0]->getCollateral("FAQ_question","FAQ_questionId",$session{form}{qid});
$output = helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
$output = helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(10,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("qid",$question->{FAQ_questionId});
$f->hidden("func","editQuestionSave");
$f->textarea(
-name=>"question",
-label=>WebGUI::International::get(5,$namespace),
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>$question->{question}
);
$f->HTMLArea(
-name=>"answer",
-label=>WebGUI::International::get(6,$namespace),
-label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>$question->{answer}
);
if ($question->{FAQ_questionId} eq "new") {
$f->whatNext(
-options=>{
addQuestion=>WebGUI::International::get(75,$namespace),
addQuestion=>WebGUI::International::get(75,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
@ -179,7 +188,7 @@ sub www_view {
my (%question, $controls, $sth, %var, @qa);
tie %question,'Tie::CPHash';
$var{"addquestion.url"} = WebGUI::URL::page('func=editQuestion&wid='.$_[0]->get("wobjectId"));
$var{"addquestion.label"} = WebGUI::International::get(9,$namespace);
$var{"addquestion.label"} = WebGUI::International::get(9,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select * from FAQ_question where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
while (%question = $sth->hash) {
$controls = deleteIcon('func=deleteQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})

View file

@ -26,12 +26,10 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "FileManager";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
sub _sortByColumn {
if ($session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sortDirection"} eq "asc") {
if ($session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection"} eq "asc") {
return WebGUI::URL::append($_[2],'sort='.$_[1]."&sortDirection=desc");
} else {
return WebGUI::URL::append($_[2],'sort='.$_[1]."&sortDirection=asc");
@ -44,7 +42,7 @@ 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=>$namespace});
$w = WebGUI::Wobject::FileManager->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
paginateAfter=>$_[0]->get("paginateAfter"),
templateId=>$_[0]->get("templateId")
@ -67,9 +65,19 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from FileManager_file where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(paginateAfter templateId)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
@ -93,7 +101,7 @@ sub www_deleteFile {
#-------------------------------------------------------------------
sub www_deleteDownload {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
return $_[0]->confirm(WebGUI::International::get(12,$namespace),
return $_[0]->confirm(WebGUI::International::get(12,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteDownloadConfirm&wid='.$session{form}{wid}.'&did='.$session{form}{did}));
}
@ -141,21 +149,21 @@ sub www_edit {
if ($_[0]->get("wobjectId") eq "new") {
$proceed = 1;
}
$output .= helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(9,$namespace).'</h1>';
$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(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->integer("paginateAfter",WebGUI::International::get(20,$namespace),$paginateAfter);
$f->integer("paginateAfter",WebGUI::International::get(20,$_[0]->get("namespace")),$paginateAfter);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
-options=>{
addFile=>WebGUI::International::get(74,$namespace),
addFile=>WebGUI::International::get(74,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"addFile"
@ -185,40 +193,40 @@ sub www_editDownload {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $file, $f);
$file = $_[0]->getCollateral("FileManager_file","FileManager_fileId",$session{form}{did});
$output .= helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
$output .= helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(10,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("did",$file->{FileManager_fileId});
$f->hidden("func","editDownloadSave");
$f->text("fileTitle",WebGUI::International::get(5,$namespace),$file->{fileTitle});
$f->text("fileTitle",WebGUI::International::get(5,$_[0]->get("namespace")),$file->{fileTitle});
if ($file->{downloadFile} ne "") {
$f->readOnly('<a href="'.WebGUI::URL::page('func=deleteFile&file=downloadFile&wid='.
$_[0]->get("wobjectId").'&did='.$file->{FileManager_fileId}).'">'.WebGUI::International::get(391).
'</a>',WebGUI::International::get(6,$namespace));
'</a>',WebGUI::International::get(6,$_[0]->get("namespace")));
} else {
$f->file("downloadFile",WebGUI::International::get(6,$namespace));
$f->file("downloadFile",WebGUI::International::get(6,$_[0]->get("namespace")));
}
if ($file->{alternateVersion1} ne "") {
$f->readOnly('<a href="'.WebGUI::URL::page('func=deleteFile&file=alternateVersion1&wid='.
$_[0]->get("wobjectId").'&did='.$file->{FileManager_fileId}).'">'.
WebGUI::International::get(391).'</a>',WebGUI::International::get(17,$namespace));
WebGUI::International::get(391).'</a>',WebGUI::International::get(17,$_[0]->get("namespace")));
} else {
$f->file("alternateVersion1",WebGUI::International::get(17,$namespace));
$f->file("alternateVersion1",WebGUI::International::get(17,$_[0]->get("namespace")));
}
if ($file->{alternateVersion2} ne "") {
$f->readOnly('<a href="'.WebGUI::URL::page('func=deleteFile&file=alternateVersion2&wid='.
$_[0]->get("wobjectId").'&did='.$file->{FileManager_fileId}).'">'.
WebGUI::International::get(391).'</a>',WebGUI::International::get(18,$namespace));
WebGUI::International::get(391).'</a>',WebGUI::International::get(18,$_[0]->get("namespace")));
} else {
$f->file("alternateVersion2",WebGUI::International::get(18,$namespace));
$f->file("alternateVersion2",WebGUI::International::get(18,$_[0]->get("namespace")));
}
$f->text("briefSynopsis",WebGUI::International::get(8,$namespace),$file->{briefSynopsis});
$f->group("groupToView",WebGUI::International::get(7,$namespace),[$file->{groupToView}]);
$f->text("briefSynopsis",WebGUI::International::get(8,$_[0]->get("namespace")),$file->{briefSynopsis});
$f->group("groupToView",WebGUI::International::get(7,$_[0]->get("namespace")),[$file->{groupToView}]);
if ($file->{FileManager_fileId} eq "new") {
$f->whatNext(
-options=>{
addFile=>WebGUI::International::get(74,$namespace),
addFile=>WebGUI::International::get(74,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
@ -269,8 +277,8 @@ sub www_editDownloadSave {
#-------------------------------------------------------------------
sub www_moveDownloadDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection","-delete-");
WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort","-delete-");
WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection","-delete-");
WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort","-delete-");
$_[0]->moveCollateralUp("FileManager_file","FileManager_fileId",$session{form}{did});
return "";
}
@ -278,8 +286,8 @@ sub www_moveDownloadDown {
#-------------------------------------------------------------------
sub www_moveDownloadUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection","-delete-");
WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort","-delete-");
WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection","-delete-");
WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort","-delete-");
$_[0]->moveCollateralDown("FileManager_file","FileManager_fileId",$session{form}{did});
return "";
}
@ -289,21 +297,21 @@ sub www_view {
my ($sortDirection, %var, @fileloop, $files, $sort, $file, $p, $file1, $file2, $file3, $constraints,
$url, $numResults, $sql, $flag);
$url = WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId"));
WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection",$session{form}{sortDirection});
WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort",$session{form}{sort});
WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection",$session{form}{sortDirection});
WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort",$session{form}{sort});
$numResults = $_[0]->get("paginateAfter") || 25;
$var{"titleColumn.label"} = WebGUI::International::get(14,$namespace);
$var{"titleColumn.label"} = WebGUI::International::get(14,$_[0]->get("namespace"));
$var{"titleColumn.url"} = $_[0]->_sortByColumn("fileTitle",$url);
$var{"descriptionColumn.label"} = WebGUI::International::get(15,$namespace);
$var{"descriptionColumn.label"} = WebGUI::International::get(15,$_[0]->get("namespace"));
$var{"descriptionColumn.url"} = $_[0]->_sortByColumn("briefSynopsis",$url);
$var{"dateColumn.label"} = WebGUI::International::get(16,$namespace);
$var{"dateColumn.label"} = WebGUI::International::get(16,$_[0]->get("namespace"));
$var{"dateColumn.url"} = $_[0]->_sortByColumn("dateUploaded",$url);
$session{form}{sort} = "sequenceNumber" if ($session{form}{sort} eq "");
$var{"search.form"} = WebGUI::Search::form({wid=>$_[0]->get("wobjectId"),func=>"view"});
$var{"search.url"} = WebGUI::Search::toggleURL();
$var{"search.label"} = WebGUI::International::get(364);
$var{"addfile.url"} = WebGUI::URL::page('func=editDownload&did=new&wid='.$_[0]->get("wobjectId"));
$var{"addfile.label"} = WebGUI::International::get(11,$namespace);
$var{"addfile.label"} = WebGUI::International::get(11,$_[0]->get("namespace"));
$sql = "select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId")." ";
if ($session{scratch}{search}) {
$numResults = $session{scratch}{numResults};
@ -311,8 +319,8 @@ sub www_view {
[qw(fileTitle downloadFile alternateVersion1 alternateVersion2 briefSynopsis)]);
$sql .= " and ".$constraints if ($constraints ne "");
}
$sort = $session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sort"} || "sequenceNumber";
$sortDirection = $session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sortDirection"} || "desc";
$sort = $session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort"} || "sequenceNumber";
$sortDirection = $session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection"} || "desc";
$sql .= " order by $sort $sortDirection";
$p = WebGUI::Paginator->new($url,[],$numResults);
$p->setDataByQuery($sql);
@ -357,7 +365,7 @@ sub www_view {
});
$flag = 1;
}
$var{"noresults.message"} = WebGUI::International::get(19,$namespace);
$var{"noresults.message"} = WebGUI::International::get(19,$_[0]->get("namespace"));
$var{noresults} = !$flag;
$var{file_loop} = \@fileloop;
$var{firstPage} = $p->getFirstPageLink;

View file

@ -1,7 +1,7 @@
package WebGUI::Wobject::HttpProxy;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black LLC.
# WebGUI is Copyright 2001-2003 Plain Black LLC.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
@ -9,7 +9,6 @@ package WebGUI::Wobject::HttpProxy;
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
# Len Kranendonk - 20021212
use strict;
use URI;
@ -26,15 +25,13 @@ use WebGUI::Wobject;
use WebGUI::ProxyParse;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "HttpProxy";
our $name = WebGUI::International::get(3,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
proxiedUrl=>$_[0]->get("proxiedUrl"),
timeout=>$_[0]->get("timeout"),
@ -47,17 +44,19 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub new {
my ($self, $class, $property);
$class = shift;
$property = shift;
$self = WebGUI::Wobject->new($property);
bless $self, $class;
sub name {
return WebGUI::International::get(3,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(proxiedUrl timeout removeStyle filterHtml followExternal followRedirect cookiebox)]);
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(proxiedUrl timeout removeStyle filterHtml followExternal followRedirect cookiebox)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
@ -77,35 +76,35 @@ sub www_edit {
%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,$namespace);
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
$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,$namespace),$_[0]->get("proxiedUrl")||'http://');
$f->url("proxiedUrl", WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("proxiedUrl")||'http://');
$f->yesNo(
-name=>"followExternal",
-label=>WebGUI::International::get(5,$namespace),
-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,$namespace),
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>$_[0]->get("followRedirect"),
-uiLevel=>5
);
$f->yesNo(
-name=>"removeStyle",
-label=>WebGUI::International::get(6,$namespace),
-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,$namespace),[$_[0]->get("filterHtml")||"javascript"]);
$f->select("timeout", \%hash, WebGUI::International::get(4,$namespace),[$_[0]->get("timeout")||30]);
$f->text("cookiebox", WebGUI::International::get(9,$namespace),$_[0]->get("cookiebox")||'/tmp');
$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 {
@ -144,7 +143,7 @@ sub www_view {
return "<b>Error while opening cookie directory ".$_[0]->get("cookiebox")."</b><p><i>$!</i>";
}
$cookiebox = $_[0]->get("cookiebox").'/'.$namespace.'_cookie_'.WebGUI::URL::escape($session{var}{sessionId}).'.jar';
$cookiebox = $_[0]->get("cookiebox").'/'.$_[0]->get("namespace").'_cookie_'.WebGUI::URL::escape($session{var}{sessionId}).'.jar';
$jar = HTTP::Cookies->new(File => $cookiebox, AutoSave => 1);
if($session{form}{wid} == $_[0]->get("wobjectId") && $session{form}{func}!~/editSave/i) {

View file

@ -24,14 +24,12 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "Item";
our $name = WebGUI::International::get(4,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $f);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Item->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::Item->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
linkURL=>$_[0]->get("linkURL"),
attachment=>$_[0]->get("attachment"),
@ -42,8 +40,19 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(linkURL attachment templateId)]);
sub name {
return WebGUI::International::get(4,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(linkURL attachment templateId)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
@ -52,15 +61,15 @@ sub www_edit {
my ($output, $f, $template);
$template = $_[0]->get("templateId") || 1;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$namespace).'</h1>';
$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(
-name=>"templateId",
-value=>$template,
-namespace=>$namespace,
-label=>WebGUI::International::get(72,$namespace),
-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);

View file

@ -22,15 +22,13 @@ use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "LinkList";
our $name = WebGUI::International::get(6,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $sth, $row);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::LinkList->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::LinkList->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
templateId=>$_[0]->get("templateId")
});
@ -43,21 +41,33 @@ sub duplicate {
$sth->finish;
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(6,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from LinkList_link where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(templateId)]);
}
#-------------------------------------------------------------------
sub www_deleteLink {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
return $_[0]->confirm(WebGUI::International::get(9,$namespace),
return $_[0]->confirm(WebGUI::International::get(9,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid}));
}
@ -79,19 +89,19 @@ sub www_edit {
$bullet = $_[0]->get("bullet") || '&middot;';
$lineSpacing = $_[0]->get("lineSpacing") || 1;
$indent = $_[0]->get("indent") || 5;
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(10,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
-options=>{
addLink=>WebGUI::International::get(13,$namespace),
addLink=>WebGUI::International::get(13,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"addLink"
@ -125,21 +135,21 @@ sub www_editLink {
} else {
$newWindow = $link->{newWindow};
}
$output = helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(12,$namespace).'</h1>';
$output = helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("lid",$link->{LinkList_linkId});
$f->hidden("func","editLinkSave");
$f->text("name",WebGUI::International::get(99),$link->{name});
$f->url("url",WebGUI::International::get(8,$namespace),$link->{url});
$f->yesNo("newWindow",WebGUI::International::get(3,$namespace),$newWindow);
$f->url("url",WebGUI::International::get(8,$_[0]->get("namespace")),$link->{url});
$f->yesNo("newWindow",WebGUI::International::get(3,$_[0]->get("namespace")),$newWindow);
$f->textarea("description",WebGUI::International::get(85),$link->{description});
if ($link->{LinkList_linkId} eq "new") {
$f->hidden("sequenceNumber",-1);
$f->whatNext(
-options=>{
addLink=>WebGUI::International::get(13,$namespace),
addLink=>WebGUI::International::get(13,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
@ -187,7 +197,7 @@ sub www_moveLinkUp {
sub www_view {
my (%var, @linkloop, $controls, $link, $sth);
$var{"addlink.url"} = WebGUI::URL::page('func=editLink&lid=new&wid='.$_[0]->get("wobjectId"));
$var{"addlink.label"} = WebGUI::International::get(13,$namespace);
$var{"addlink.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId")."
order by sequenceNumber");
while ($link = $sth->hashRef) {

View file

@ -25,8 +25,6 @@ use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "MailForm";
our $name = WebGUI::International::get(1,$namespace);
our @fields = qw(width fromField fromStatus toField toStatus
ccField ccStatus bccField bccStatus subjectField subjectStatus acknowledgement storeEntries);
@ -36,7 +34,7 @@ sub duplicate {
my ($w, %data, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::MailForm->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::MailForm->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
width=>$_[0]->get("width"),
fromField=>$_[0]->get("fromField"),
@ -60,6 +58,22 @@ sub duplicate {
$sth->finish;
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
\@fields
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from MailForm_field where wobjectId=".$_[0]->get("wobjectId"));
@ -68,11 +82,6 @@ sub purge {
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[@fields]);
}
#-------------------------------------------------------------------
sub uiLevel {
return 5;
@ -81,7 +90,7 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_deleteField {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
return $_[0]->confirm(WebGUI::International::get(19,$namespace),
return $_[0]->confirm(WebGUI::International::get(19,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteFieldConfirm&wid='.$_[0]->get("wobjectId").'&fid='.$session{form}{fid}));
}
@ -97,9 +106,9 @@ 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, $namespace),
2 => WebGUI::International::get(5, $namespace),
3 => WebGUI::International::get(6, $namespace) );
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,
@ -111,9 +120,9 @@ sub www_edit {
ccStatus => 1,
bccField => '',
bccStatus => 1,
subjectField => WebGUI::International::get(2, $namespace),
subjectField => WebGUI::International::get(2, $_[0]->get("namespace")),
subjectStatus => 3,
acknowledgement => WebGUI::International::get(3, $namespace),
acknowledgement => WebGUI::International::get(3, $_[0]->get("namespace")),
storeEntries => 1,
);
# initialize fields from existing data, if any
@ -125,22 +134,22 @@ sub www_edit {
$proceed = 1;
}
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(7, $namespace).'</h1>';
$output .= '<h1>'.WebGUI::International::get(7, $_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->integer("width",WebGUI::International::get(8, $namespace),$_[0]->get("width") || 45);
$f->raw( $_[0]->_textSelectRow("fromField",WebGUI::International::get(10, $namespace),$data{fromField},128,
$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, $namespace),$data{toField},128,
$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, $namespace),$data{ccField},128,
$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, $namespace),$data{bccField},128,
$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, $namespace),$data{subjectField},128,
$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, $namespace),$_[0]->get("acknowledgement") || WebGUI::International::get(3, $namespace));
$f->yesNo("storeEntries",WebGUI::International::get(26,$namespace),[ $data{storeEntries} ]);
$f->yesNo("proceed",WebGUI::International::get(15,$namespace),$proceed);
$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;
}
@ -168,9 +177,9 @@ sub www_editField {
tie %fieldTypes, 'Tie::IxHash';
tie %validation, 'Tie::IxHash';
%fieldStatus = ( 1 => WebGUI::International::get(4, $namespace),
2 => WebGUI::International::get(5, $namespace),
3 => WebGUI::International::get(6, $namespace) );
%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")) );
%fieldTypes = ( text => "Textbox",
checkbox => "Checkbox",
@ -193,13 +202,13 @@ sub www_editField {
%field = WebGUI::SQL->quickHash("select * from MailForm_field where MailForm_fieldId='$session{form}{fid}'");
$output = helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(20,$namespace).'</h1>';
$output .= '<h1>'.WebGUI::International::get(20,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$session{form}{fid} = "new" if ($session{form}{fid} eq "");
$f->hidden("fid",$session{form}{fid});
$f->hidden("func","editFieldSave");
$f->text("name",WebGUI::International::get(21,$namespace),$field{name});
$f->text("name",WebGUI::International::get(21,$_[0]->get("namespace")),$field{name});
$f->text(
-name=>"subtext",
@ -209,21 +218,21 @@ sub www_editField {
);
my $status = [ $field{status} ||= 3 ]; # make it modifiable by default
$f->select("status",\%fieldStatus,WebGUI::International::get(22,$namespace),$status);
$f->select("status",\%fieldStatus,WebGUI::International::get(22,$_[0]->get("namespace")),$status);
my $type = [ $field{type} ||= "text" ];
$f->select("type",\%fieldTypes,WebGUI::International::get(23,$namespace),$type);
$f->select("type",\%fieldTypes,WebGUI::International::get(23,$_[0]->get("namespace")),$type);
$f->select("validation",\%validation,"Input validation", [$field{validation} || "none"]);
$f->integer("width",WebGUI::International::get(8, $namespace),$field{width} || $_[0]->get("width") || 45);
$f->integer("width",WebGUI::International::get(8, $_[0]->get("namespace")),$field{width} || $_[0]->get("width") || 45);
$f->integer(
-name=>"rows",
-value=>$field{rows} || "",
-label=>WebGUI::International::get(27, $namespace),
-subtext=>WebGUI::International::get(28, $namespace),
-label=>WebGUI::International::get(27, $_[0]->get("namespace")),
-subtext=>WebGUI::International::get(28, $_[0]->get("namespace")),
);
$f->textarea("possibleValues",WebGUI::International::get(24,$namespace),$field{possibleValues});
$f->textarea("defaultValue",WebGUI::International::get(25,$namespace),$field{defaultValue});
$f->yesNo("proceed",WebGUI::International::get(15,$namespace));
$f->textarea("possibleValues",WebGUI::International::get(24,$_[0]->get("namespace")),$field{possibleValues});
$f->textarea("defaultValue",WebGUI::International::get(25,$_[0]->get("namespace")),$field{defaultValue});
$f->yesNo("proceed",WebGUI::International::get(15,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -280,16 +289,16 @@ sub www_view {
# get all international text for each field caption
my %text = (
from => WebGUI::International::get(10, $namespace),
to => WebGUI::International::get(11, $namespace),
cc => WebGUI::International::get(12, $namespace),
bcc => WebGUI::International::get(13, $namespace),
subject => WebGUI::International::get(14, $namespace),
from => WebGUI::International::get(10, $_[0]->get("namespace")),
to => WebGUI::International::get(11, $_[0]->get("namespace")),
cc => WebGUI::International::get(12, $_[0]->get("namespace")),
bcc => WebGUI::International::get(13, $_[0]->get("namespace")),
subject => WebGUI::International::get(14, $_[0]->get("namespace")),
);
if ($session{var}{adminOn}) {
$output .= '<a href="'.WebGUI::URL::page('func=editField&wid='.$_[0]->get("wobjectId")).'">'
.WebGUI::International::get(9,$namespace).'</a>';
.WebGUI::International::get(9,$_[0]->get("namespace")).'</a>';
}
$f = WebGUI::HTMLForm->new();
@ -343,7 +352,7 @@ sub www_view {
$f->raw($row);
}
$f->submit(WebGUI::International::get(73, $namespace));
$f->submit(WebGUI::International::get(73, $_[0]->get("namespace")));
$output .= $f->print;
return $output;
@ -637,7 +646,7 @@ sub www_send {
$output = $_[0]->displayTitle;
$error = $@ if $@;
$output .= ($error || $_[0]->get("acknowledgement"))."<p>\n<a href=\"./$session{page}{urlizedTitle}\">".WebGUI::International::get(18, $namespace)."</a>";
$output .= ($error || $_[0]->get("acknowledgement"))."<p>\n<a href=\"./$session{page}{urlizedTitle}\">".WebGUI::International::get(18, $_[0]->get("namespace"))."</a>";
return $output;
}
@ -652,10 +661,10 @@ sub _validate {
word => qr/^\w+$/,
email => qr/^\s*<?[^@<>]+@[^@.<>]+(?:\.[^@.<>]+)+>?\s*$/,
);
my %message = ( notnull => "&quot;$fieldName&quot; ".WebGUI::International::get(29,$namespace),
number => "&quot;$fieldName&quot; ".WebGUI::International::get(30,$namespace),
word => "&quot;$fieldName&quot; ".WebGUI::International::get(31,$namespace),
email => "&quot;$value&quot; " .WebGUI::International::get(32,$namespace),
my %message = ( notnull => "&quot;$fieldName&quot; ".WebGUI::International::get(29,$_[0]->get("namespace")),
number => "&quot;$fieldName&quot; ".WebGUI::International::get(30,$_[0]->get("namespace")),
word => "&quot;$fieldName&quot; ".WebGUI::International::get(31,$_[0]->get("namespace")),
email => "&quot;$value&quot; " .WebGUI::International::get(32,$_[0]->get("namespace")),
);
if ($value !~ $regex{$validation}) {

View file

@ -26,20 +26,34 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "MessageBoard";
our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::MessageBoard->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::MessageBoard->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
messagesPerPage=>$_[0]->get("messagesPerPage"),
templateId=>$_[0]->get("templateId")
});
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(2,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(templateId messagesPerPage)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(templateId messagesPerPage)]);
@ -61,15 +75,15 @@ sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $messagesPerPage);
$messagesPerPage = $_[0]->get("messagesPerPage") || 50;
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(6,$namespace).'</h1>';
$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,$namespace),$messagesPerPage);
$f->integer("messagesPerPage",WebGUI::International::get(4,$_[0]->get("namespace")),$messagesPerPage);
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-label=>WebGUI::International::get(72,$namespace),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->raw($_[0]->SUPER::discussionProperties);
@ -89,7 +103,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_showMessage {
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(11,$namespace).'</a><br>');
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(11,$_[0]->get("namespace")).'</a><br>');
}
#-------------------------------------------------------------------
@ -99,15 +113,15 @@ sub www_view {
$var{description} = $_[0]->get("description");
$var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"));
$var{"post.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(17,$namespace);
$var{"post.label"} = WebGUI::International::get(17,$_[0]->get("namespace"));
$var{"search.url"} = WebGUI::URL::page('func=search&wid='.$_[0]->get("wobjectId"));
$var{"search.label"} = WebGUI::International::get(364);
$var{"subject.label"} = WebGUI::International::get(229);
$var{"user.label"} = WebGUI::International::get(15,$namespace);
$var{"date.label"} = WebGUI::International::get(18,$namespace);
$var{"user.label"} = WebGUI::International::get(15,$_[0]->get("namespace"));
$var{"date.label"} = WebGUI::International::get(18,$_[0]->get("namespace"));
$var{"views.label"} = WebGUI::International::get(514);
$var{"replies.label"} = WebGUI::International::get(19,$namespace);
$var{"last.label"} = WebGUI::International::get(20,$namespace);
$var{"replies.label"} = WebGUI::International::get(19,$_[0]->get("namespace"));
$var{"last.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
$p = WebGUI::Paginator->new(WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=view'),[],$_[0]->get("messagesPerPage"));
$p->setDataByQuery("select messageId,subject,username,dateOfPost,userId,views,status
from discussion where wobjectId=".$_[0]->get("wobjectId")." and pid=0

View file

@ -25,15 +25,13 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "Poll";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $f, $sth, @row);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Poll->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::Poll->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
active=>$_[0]->get("active"),
randomizeAnswers=>$_[0]->get("randomizeAnswers"),
@ -70,14 +68,25 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from Poll_answer where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[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)]);
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)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from Poll_answer where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
@ -98,25 +107,25 @@ sub www_edit {
$answers .= $_[0]->get("a".$i)."\n";
}
}
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(9,$namespace).'</h1>';
$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,$namespace),$active);
$f->group("voteGroup",WebGUI::International::get(4,$namespace),[$voteGroup]);
$f->yesNo("active",WebGUI::International::get(3,$_[0]->get("namespace")),$active);
$f->group("voteGroup",WebGUI::International::get(4,$_[0]->get("namespace")),[$voteGroup]);
if ($session{setting}{useKarma}) {
$f->integer("karmaPerVote",WebGUI::International::get(20,$namespace),$_[0]->get("karmaPerVote"));
$f->integer("karmaPerVote",WebGUI::International::get(20,$_[0]->get("namespace")),$_[0]->get("karmaPerVote"));
} else {
$f->hidden("karmaPerVote",$_[0]->get("karmaPerVote"));
}
$f->integer("graphWidth",WebGUI::International::get(5,$namespace),$graphWidth);
$f->text("question",WebGUI::International::get(6,$namespace),$_[0]->get("question"));
$f->textarea("answers",WebGUI::International::get(7,$namespace).'<span class="formSubtext"><br>'.WebGUI::International::get(8,$namespace).'</span>',$answers);
$f->yesNo("randomizeAnswers",WebGUI::International::get(72,$namespace),$randomizeAnswers);
$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);
if ($_[0]->get("wobjectId") ne "new") {
$output .= '<p>';
$output .= '<a href="'.WebGUI::URL::page('func=resetVotes&wid='.$_[0]->get("wobjectId")).'">'
.WebGUI::International::get(10,$namespace).'</a>';
.WebGUI::International::get(10,$_[0]->get("namespace")).'</a>';
}
return $output;
}
@ -181,7 +190,7 @@ sub www_view {
$f->raw($answer);
}
$f->raw('<br>');
$f->submit(WebGUI::International::get(11,$namespace));
$f->submit(WebGUI::International::get(11,$_[0]->get("namespace")));
$output .= $f->print;
} else {
($totalResponses) = WebGUI::SQL->quickArray("select count(*) from Poll_answer where wobjectId=".$_[0]->get("wobjectId"));
@ -199,7 +208,7 @@ sub www_view {
round(100*$data[0]/$totalResponses).'% ('.($data[0]+0).')</td></tr></table>';
}
}
$output .= '<span class="pollAnswer"><hr size="1"><b>'.WebGUI::International::get(12,$namespace).'</b> '.$totalResponses.'</span>';
$output .= '<span class="pollAnswer"><hr size="1"><b>'.WebGUI::International::get(12,$_[0]->get("namespace")).'</b> '.$totalResponses.'</span>';
}
return $output;
}
@ -213,7 +222,7 @@ sub www_vote {
'$session{form}{answer}', $session{user}{userId}, '$session{env}{REMOTE_ADDR}')");
if ($session{setting}{useKarma}) {
$u = WebGUI::User->new($session{user}{userId});
$u->karma($_[0]->get("karmaPerVote"),$namespace." (".$_[0]->get("wobjectId").")","Voted on this poll.");
$u->karma($_[0]->get("karmaPerVote"),$_[0]->get("namespace")." (".$_[0]->get("wobjectId").")","Voted on this poll.");
}
}
return "";

View file

@ -23,15 +23,13 @@ use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "Product";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $file, %data, $newId, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Product->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::Product->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
image1=>$_[0]->get("image1"),
image2=>$_[0]->get("image2"),
@ -90,6 +88,22 @@ sub duplicate {
$sth->finish;
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(price templateId productNumber image1 image2 image3 manual brochure warranty)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from Product_accessory where wobjectId=".$_[0]->get("wobjectId")."
@ -102,17 +116,13 @@ sub purge {
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(price templateId productNumber image1 image2 image3 manual brochure warranty)]);
}
#-------------------------------------------------------------------
sub www_addAccessory {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $accessory, @usedAccessories);
$output = helpIcon(4,$namespace);
$output .= '<h1>'.WebGUI::International::get(16,$namespace).'</h1>';
$output = helpIcon(4,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(16,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("func","addAccessorySave");
@ -121,8 +131,8 @@ sub www_addAccessory {
push(@usedAccessories,$session{form}{wid});
$accessory = WebGUI::SQL->buildHashRef("select wobjectId,title from wobject where namespace='Product'
and wobjectId not in (".join(",",@usedAccessories).")");
$f->select("accessoryWobjectId",$accessory,WebGUI::International::get(17,$namespace));
$f->yesNo("proceed",WebGUI::International::get(18,$namespace));
$f->select("accessoryWobjectId",$accessory,WebGUI::International::get(17,$_[0]->get("namespace")));
$f->yesNo("proceed",WebGUI::International::get(18,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -147,8 +157,8 @@ sub www_addAccessorySave {
sub www_addRelated {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, $related, @usedRelated);
$output = helpIcon(5,$namespace);
$output .= '<h1>'.WebGUI::International::get(19,$namespace).'</h1>';
$output = helpIcon(5,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(19,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("func","addRelatedSave");
@ -157,8 +167,8 @@ sub www_addRelated {
push(@usedRelated,$session{form}{wid});
$related = WebGUI::SQL->buildHashRef("select wobjectId,title from wobject where namespace='Product'
and wobjectId not in (".join(",",@usedRelated).")");
$f->select("relatedWobjectId",$related,WebGUI::International::get(20,$namespace));
$f->yesNo("proceed",WebGUI::International::get(21,$namespace));
$f->select("relatedWobjectId",$related,WebGUI::International::get(20,$_[0]->get("namespace")));
$f->yesNo("proceed",WebGUI::International::get(21,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -182,7 +192,7 @@ sub www_addRelatedSave {
#-------------------------------------------------------------------
sub www_deleteAccessory {
return $_[0]->confirm(
WebGUI::International::get(2,$namespace),
WebGUI::International::get(2,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteAccessoryConfirm&wid='.$_[0]->get("wobjectId").'&aid='.$session{form}{aid})
);
}
@ -198,7 +208,7 @@ sub www_deleteAccessoryConfirm {
#-------------------------------------------------------------------
sub www_deleteBenefit {
return $_[0]->confirm(
WebGUI::International::get(48,$namespace),
WebGUI::International::get(48,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteBenefitConfirm&wid='.$_[0]->get("wobjectId").'&bid='.$session{form}{bid})
);
}
@ -214,7 +224,7 @@ sub www_deleteBenefitConfirm {
#-------------------------------------------------------------------
sub www_deleteFeature {
return $_[0]->confirm(
WebGUI::International::get(3,$namespace),
WebGUI::International::get(3,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteFeatureConfirm&wid='.$_[0]->get("wobjectId").'&fid='.$session{form}{fid})
);
}
@ -230,7 +240,7 @@ sub www_deleteFeatureConfirm {
#-------------------------------------------------------------------
sub www_deleteRelated {
return $_[0]->confirm(
WebGUI::International::get(4,$namespace),
WebGUI::International::get(4,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteRelatedConfirm&wid='.$_[0]->get("wobjectId").'&rid='.$session{form}{rid})
);
}
@ -246,7 +256,7 @@ sub www_deleteRelatedConfirm {
#-------------------------------------------------------------------
sub www_deleteSpecification {
return $_[0]->confirm(
WebGUI::International::get(5,$namespace),
WebGUI::International::get(5,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteSpecificationConfirm&wid='.$_[0]->get("wobjectId").'&sid='.$session{form}{sid})
);
}
@ -263,8 +273,8 @@ sub www_deleteSpecificationConfirm {
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($f, $output, $template);
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(6,$namespace).'</h1>';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
if ($_[0]->get("wobjectId") eq "new") {
$template = 1;
} else {
@ -274,12 +284,12 @@ sub www_edit {
$f->template(
-name=>"templateId",
-value=>$template,
-namespace=>$namespace,
-label=>WebGUI::International::get(61,$namespace),
-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,$namespace),$_[0]->get("price"));
$f->text("productNumber",WebGUI::International::get(11,$namespace),$_[0]->get("productNumber"));
$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));
@ -325,15 +335,15 @@ sub www_editBenefit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f, $benefits);
$data = $_[0]->getCollateral("Product_benefit","Product_benefitId",$session{form}{bid});
$output = helpIcon(6,$namespace);
$output .= '<h1>'.WebGUI::International::get(53,$namespace).'</h1>';
$output = helpIcon(6,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(53,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("bid",$data->{Product_benefitId});
$f->hidden("func","editBenefitSave");
$benefits = WebGUI::SQL->buildHashRef("select benefit,benefit from Product_benefit order by benefit");
$f->combo("benefit",$benefits,WebGUI::International::get(51,$namespace),[$data->{benefits}]);
$f->yesNo("proceed",WebGUI::International::get(52,$namespace));
$f->combo("benefit",$benefits,WebGUI::International::get(51,$_[0]->get("namespace")),[$data->{benefits}]);
$f->yesNo("proceed",WebGUI::International::get(52,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -360,15 +370,15 @@ sub www_editFeature {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f, $features);
$data = $_[0]->getCollateral("Product_feature","Product_featureId",$session{form}{fid});
$output = helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(22,$namespace).'</h1>';
$output = helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(22,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("fid",$data->{Product_featureId});
$f->hidden("func","editFeatureSave");
$features = WebGUI::SQL->buildHashRef("select feature,feature from Product_feature order by feature");
$f->combo("feature",$features,WebGUI::International::get(23,$namespace),[$data->{feature}]);
$f->yesNo("proceed",WebGUI::International::get(24,$namespace));
$f->combo("feature",$features,WebGUI::International::get(23,$_[0]->get("namespace")),[$data->{feature}]);
$f->yesNo("proceed",WebGUI::International::get(24,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -395,18 +405,18 @@ sub www_editSpecification {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f, $hashRef);
$data = $_[0]->getCollateral("Product_specification","Product_specificationId",$session{form}{sid});
$output = helpIcon(3,$namespace);
$output .= '<h1>'.WebGUI::International::get(25,$namespace).'</h1>';
$output = helpIcon(3,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(25,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("sid",$data->{Product_specificationId});
$f->hidden("func","editSpecificationSave");
$hashRef = WebGUI::SQL->buildHashRef("select name,name from Product_specification order by name");
$f->combo("name",$hashRef,WebGUI::International::get(26,$namespace),[$data->{name}]);
$f->text("value",WebGUI::International::get(27,$namespace),$data->{value});
$f->combo("name",$hashRef,WebGUI::International::get(26,$_[0]->get("namespace")),[$data->{name}]);
$f->text("value",WebGUI::International::get(27,$_[0]->get("namespace")),$data->{value});
$hashRef = WebGUI::SQL->buildHashRef("select units,units from Product_specification order by units");
$f->combo("units",$hashRef,WebGUI::International::get(29,$namespace),[$data->{units}]);
$f->yesNo("proceed",WebGUI::International::get(28,$namespace));
$f->combo("units",$hashRef,WebGUI::International::get(29,$_[0]->get("namespace")),[$data->{units}]);
$f->yesNo("proceed",WebGUI::International::get(28,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -509,21 +519,21 @@ sub www_view {
if ($_[0]->get("brochure")) {
$file = WebGUI::Attachment->new($_[0]->get("brochure"),$_[0]->get("wobjectId"));
$var{"brochure.icon"} = $file->getIcon;
$var{"brochure.label"} = WebGUI::International::get(13,$namespace);
$var{"brochure.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
$var{"brochure.URL"} = $file->getURL;
}
#---manual
if ($_[0]->get("manual")) {
$file = WebGUI::Attachment->new($_[0]->get("manual"),$_[0]->get("wobjectId"));
$var{"manual.icon"} = $file->getIcon;
$var{"manual.label"} = WebGUI::International::get(14,$namespace);
$var{"manual.label"} = WebGUI::International::get(14,$_[0]->get("namespace"));
$var{"manual.URL"} = $file->getURL;
}
#---warranty
if ($_[0]->get("warranty")) {
$file = WebGUI::Attachment->new($_[0]->get("warranty"),$_[0]->get("wobjectId"));
$var{"warranty.icon"} = $file->getIcon;
$var{"warranty.label"} = WebGUI::International::get(15,$namespace);
$var{"warranty.label"} = WebGUI::International::get(15,$_[0]->get("namespace"));
$var{"warranty.URL"} = $file->getURL;
}
#---image1
@ -547,7 +557,7 @@ sub www_view {
#---features
$var{"addFeature.url"} = WebGUI::URL::page('func=editFeature&fid=new&wid='.$_[0]->get("wobjectId"));
$var{"addFeature.label"} = WebGUI::International::get(34,$namespace);
$var{"addFeature.label"} = WebGUI::International::get(34,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select feature,Product_featureId from Product_feature where wobjectId="
.$_[0]->get("wobjectId")." order by sequenceNumber");
while (%data = $sth->hash) {
@ -565,7 +575,7 @@ sub www_view {
#---benefits
$var{"addBenefit.url"} = WebGUI::URL::page('func=editBenefit&fid=new&wid='.$_[0]->get("wobjectId"));
$var{"addBenefit.label"} = WebGUI::International::get(55,$namespace);
$var{"addBenefit.label"} = WebGUI::International::get(55,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select benefit,Product_benefitId from Product_benefit where wobjectId="
.$_[0]->get("wobjectId")." order by sequenceNumber");
while (%data = $sth->hash) {
@ -583,7 +593,7 @@ sub www_view {
#---specifications
$var{"addSpecification.url"} = WebGUI::URL::page('func=editSpecification&sid=new&wid='.$_[0]->get("wobjectId"));
$var{"addSpecification.label"} = WebGUI::International::get(35,$namespace);
$var{"addSpecification.label"} = WebGUI::International::get(35,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select name,value,units,Product_specificationId from Product_specification
where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
while (%data = $sth->hash) {
@ -603,7 +613,7 @@ sub www_view {
#---accessories
$var{"addaccessory.url"} = WebGUI::URL::page('func=addAccessory&wid='.$_[0]->get("wobjectId"));
$var{"addaccessory.label"} = WebGUI::International::get(36,$namespace);
$var{"addaccessory.label"} = WebGUI::International::get(36,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_accessory.accessoryWobjectId
from Product_accessory,wobject,page
where Product_accessory.wobjectId=".$_[0]->get("wobjectId")."
@ -624,7 +634,7 @@ sub www_view {
#---related
$var{"addrelatedproduct.url"} = WebGUI::URL::page('func=addRelated&wid='.$_[0]->get("wobjectId"));
$var{"addrelatedproduct.label"} = WebGUI::International::get(37,$namespace);
$var{"addrelatedproduct.label"} = WebGUI::International::get(37,$_[0]->get("namespace"));
$sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_related.relatedWobjectId
from Product_related,wobject,page
where Product_related.wobjectId=".$_[0]->get("wobjectId")."

View file

@ -25,14 +25,12 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "SQLReport";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::SQLReport->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::SQLReport->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
template=>$_[0]->get("template"),
dbQuery=>$_[0]->get("dbQuery"),
@ -47,8 +45,20 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)]);
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
@ -64,17 +74,17 @@ sub www_edit {
$username = $_[0]->get("username") || $session{config}{dbuser};
$paginateAfter = $_[0]->get("paginateAfter") || 50;
$f = WebGUI::HTMLForm->new;
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(8,$namespace).'</h1>';
$f->yesNo("preprocessMacros",WebGUI::International::get(15,$namespace),$_[0]->get("preprocessMacros"));
$f->yesNo("debugMode",WebGUI::International::get(16,$namespace),$_[0]->get("debugMode"));
$f->textarea("dbQuery",WebGUI::International::get(4,$namespace),$_[0]->get("dbQuery"));
$f->textarea("template",WebGUI::International::get(3,$namespace),$_[0]->get("template"));
$f->text("DSN",WebGUI::International::get(5,$namespace),$dsn);
$f->text("username",WebGUI::International::get(6,$namespace),$username);
$f->password("identifier",WebGUI::International::get(7,$namespace),$_[0]->get("identifier"));
$f->integer("paginateAfter",WebGUI::International::get(14,$namespace),$paginateAfter);
$f->yesNo("convertCarriageReturns",WebGUI::International::get(13,$namespace),$_[0]->get("convertCarriageReturns"));
$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);
return $output;
}
@ -107,7 +117,7 @@ sub www_view {
$dsn = $_[0]->get("DSN");
$output = $_[0]->displayTitle;
$output .= $_[0]->description;
$output .= WebGUI::International::get(17,$namespace)." ".$query."<p>" if ($_[0]->get("debugMode"));
$output .= WebGUI::International::get(17,$_[0]->get("namespace"))." ".$query."<p>" if ($_[0]->get("debugMode"));
if ($dsn eq $session{config}{dsn}) {
$dbh = $session{dbh};
} elsif ($dsn =~ /\DBI\:\w+\:\w+/) {
@ -117,7 +127,7 @@ sub www_view {
undef $dbh;
}
} else {
$output .= WebGUI::International::get(9,$namespace).'<p>' if ($_[0]->get("debugMode"));
$output .= WebGUI::International::get(9,$_[0]->get("namespace")).'<p>' if ($_[0]->get("debugMode"));
WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] The DSN specified is of an improper format.");
}
if (defined $dbh) {
@ -125,7 +135,7 @@ sub www_view {
$sth = WebGUI::SQL->unconditionalRead($query,$dbh);
unless ($sth->errorCode < 1) {
$errorMessage = $sth->errorMessage;
$output .= WebGUI::International::get(11,$namespace).' : '.$errorMessage.'<p>' if ($_[0]->get("debugMode"));
$output .= WebGUI::International::get(11,$_[0]->get("namespace")).' : '.$errorMessage.'<p>' if ($_[0]->get("debugMode"));
WebGUI::ErrorHandler::warn("There was a problem with the query: ".$errorMessage);
} else {
if ($_[0]->get("template") ne "") {
@ -158,7 +168,7 @@ sub www_view {
}
if ($sth->rows < 1) {
$output .= $template[2];
$output .= WebGUI::International::get(18,$namespace).'<p>';
$output .= WebGUI::International::get(18,$_[0]->get("namespace")).'<p>';
} else {
$url = WebGUI::URL::page('&wid='.$_[0]->get("wobjectId").'&func=view');
foreach (keys %{$session{form}}) {
@ -175,12 +185,12 @@ sub www_view {
$sth->finish;
}
} else {
$output .= WebGUI::International::get(10,$namespace).'<p>' if ($_[0]->get("debugMode"));
$output .= WebGUI::International::get(10,$_[0]->get("namespace")).'<p>' if ($_[0]->get("debugMode"));
WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] The SQL query is improperly formatted.");
}
$dbh->disconnect() unless ($dsn eq $session{config}{dsn});
} else {
$output .= WebGUI::International::get(12,$namespace).'<p>' if ($_[0]->get("debugMode"));
$output .= WebGUI::International::get(12,$_[0]->get("namespace")).'<p>' if ($_[0]->get("debugMode"));
WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] Could not connect to database.");
}
return $output;

View file

@ -22,8 +22,6 @@ use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "SiteMap";
our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
sub _traversePageTree {
@ -61,7 +59,7 @@ sub _traversePageTree {
sub duplicate {
my ($w, $f);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::SiteMap->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::SiteMap->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
startAtThisLevel=>$_[0]->get("startAtThisLevel"),
templateId=>$_[0]->get("templateId"),
@ -71,10 +69,22 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(startAtThisLevel indent templateId depth)]);
sub name {
return WebGUI::International::get(2,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(startAtThisLevel indent templateId depth)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
@ -88,26 +98,26 @@ sub www_edit {
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,$namespace).'</h1>';
$output .= '<h1>'.WebGUI::International::get(5,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->select(
-name=>"startAtThisLevel",
-label=>WebGUI::International::get(3,$namespace),
-label=>WebGUI::International::get(3,$_[0]->get("namespace")),
-value=>[$startLevel],
-options=>{
0=>WebGUI::International::get(75,$namespace),
$session{page}{pageId}=>WebGUI::International::get(74,$namespace),
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,$namespace),$_[0]->get("depth"));
$f->integer("indent",WebGUI::International::get(6,$namespace),$indent);
$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);
return $output;
}

View file

@ -24,8 +24,6 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "Survey";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
@ -34,7 +32,7 @@ sub _addAnswer {
Survey_id=>$_[0]->get("Survey_id"),
Survey_questionId=>$_[2],
Survey_answerId=>"new",
answer=>WebGUI::International::get($_[1],$namespace)
answer=>WebGUI::International::get($_[1],$_[0]->get("namespace"))
},1,0,"Survey_id");
}
@ -55,13 +53,13 @@ sub _submenu {
<tr><td width="70%" class="tableData" valign="top">';
$output .= $_[1];
$output .= '</td><td width="30%" class="tableMenu" valign="top">';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportAnswers&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(62,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportQuestions&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(63,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportResponses&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(64,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportComposite&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(65,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=viewGradebook&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(61,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=viewStatisticalOverview&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(59,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(60,$namespace).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportAnswers&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(62,$_[0]->get("namespace")).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportQuestions&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(63,$_[0]->get("namespace")).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportResponses&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(64,$_[0]->get("namespace")).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=exportComposite&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(65,$_[0]->get("namespace")).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=viewGradebook&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(61,$_[0]->get("namespace")).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('func=viewStatisticalOverview&wid='.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(59,$_[0]->get("namespace")).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(60,$_[0]->get("namespace")).'</a>';
$output .= '</td></tr></table>';
return $output;
}
@ -70,7 +68,7 @@ sub _submenu {
sub duplicate {
my ($w, $newSurveyId, $qdata, $adata, $rdata, $a, $b, $c);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::Survey->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::Survey->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$newSurveyId = getNextId("Survey_id");
$w->set({
questionOrder=>$_[0]->get("questionOrder"),
@ -108,6 +106,22 @@ sub duplicate {
$a->finish;
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(Survey_id questionOrder groupToTakeSurvey groupToViewReports mode)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey where Survey_id=".$_[0]->get("Survey_id"));
@ -119,10 +133,6 @@ sub purge {
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(Survey_id questionOrder groupToTakeSurvey groupToViewReports mode)]);
}
#-------------------------------------------------------------------
sub uiLevel {
@ -132,7 +142,7 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_deleteAnswer {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
return $_[0]->confirm(WebGUI::International::get(45,$namespace),
return $_[0]->confirm(WebGUI::International::get(45,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteAnswerConfirm&wid='.$_[0]->get("wobjectId").'&aid='
.$session{form}{aid}.'&qid='.$session{form}{qid}));
}
@ -149,7 +159,7 @@ sub www_deleteAnswerConfirm {
#-------------------------------------------------------------------
sub www_deleteQuestion {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
return $_[0]->confirm(WebGUI::International::get(44,$namespace),
return $_[0]->confirm(WebGUI::International::get(44,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteQuestionConfirm&wid='.$_[0]->get("wobjectId").'&qid='.$session{form}{qid}));
}
@ -166,7 +176,7 @@ sub www_deleteQuestionConfirm {
#-------------------------------------------------------------------
sub www_deleteResponses {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(72,$namespace),
return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(72,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteResponsesConfirm&wid='.$_[0]->get("wobjectId").'&uid='
.$session{form}{uid}.'&ip='.$session{form}{ip})));
}
@ -182,7 +192,7 @@ sub www_deleteResponsesConfirm {
#-------------------------------------------------------------------
sub www_deleteAllResponses {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(74,$namespace),
return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(74,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteAllResponsesConfirm&wid='.$_[0]->get("wobjectId"))));
}
@ -203,43 +213,43 @@ sub www_edit {
$groupToViewReports = $_[0]->get("groupToViewReports") || 4;
$groupToTakeSurvey = $_[0]->get("groupToTakeSurvey") || 2;
$surveyId = $_[0]->get("Survey_id") || getNextId("Survey_id");
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
$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(
-name=>"questionOrder",
-options=>{
sequential => WebGUI::International::get(5,$namespace),
random => WebGUI::International::get(6,$namespace),
response => WebGUI::International::get(7,$namespace)
sequential => WebGUI::International::get(5,$_[0]->get("namespace")),
random => WebGUI::International::get(6,$_[0]->get("namespace")),
response => WebGUI::International::get(7,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(8,$namespace),
-label=>WebGUI::International::get(8,$_[0]->get("namespace")),
-value=>[$questionOrder]
);
$f->select(
-name=>"mode",
-options=>{
survey => WebGUI::International::get(9,$namespace),
quiz => WebGUI::International::get(10,$namespace)
survey => WebGUI::International::get(9,$_[0]->get("namespace")),
quiz => WebGUI::International::get(10,$_[0]->get("namespace"))
},
-label=>WebGUI::International::get(11,$namespace),
-label=>WebGUI::International::get(11,$_[0]->get("namespace")),
-value=>[$mode]
);
$f->group(
-name=>"groupToTakeSurvey",
-value=>[$groupToTakeSurvey],
-label=>WebGUI::International::get(12,$namespace)
-label=>WebGUI::International::get(12,$_[0]->get("namespace"))
);
$f->group(
-name=>"groupToViewReports",
-label=>WebGUI::International::get(13,$namespace),
-label=>WebGUI::International::get(13,$_[0]->get("namespace")),
-value=>[$groupToViewReports]
);
if ($_[0]->get("wobjectId") eq "new") {
$f->whatNext(
-options=>{
addQuestion=>WebGUI::International::get(28,$namespace),
addQuestion=>WebGUI::International::get(28,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"addQuestion"
@ -248,7 +258,7 @@ sub www_edit {
$output .= $_[0]->SUPER::www_edit($f->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,$namespace).'</a><p>';
.'">'.WebGUI::International::get(30,$_[0]->get("namespace")).'</a><p>';
$sth = WebGUI::SQL->read("select Survey_questionId,question from Survey_question where Survey_id="
.$_[0]->get("Survey_id")." order by sequenceNumber");
while (%data = $sth->hash) {
@ -285,7 +295,7 @@ sub www_editAnswer {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($question, $output, $f, $answer);
$answer = $_[0]->getCollateral("Survey_answer","Survey_answerId",$session{form}{aid});
$output = '<h1>'.WebGUI::International::get(18,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(18,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$session{form}{wid});
$f->hidden("func","editAnswerSave");
@ -294,13 +304,13 @@ sub www_editAnswer {
$f->text(
-name=>"answer",
-value=>$answer->{answer},
-label=>WebGUI::International::get(19,$namespace)
-label=>WebGUI::International::get(19,$_[0]->get("namespace"))
);
if ($_[0]->get("mode") eq "quiz") {
$f->yesNo(
-name=>"isCorrect",
-value=>$answer->{isCorrect},
-label=>WebGUI::International::get(20,$namespace)
-label=>WebGUI::International::get(20,$_[0]->get("namespace"))
);
} else {
$f->hidden("isCorrect",0);
@ -312,16 +322,16 @@ sub www_editAnswer {
-name=>"gotoQuestion",
-options=>$question,
-value=>[$answer->{gotoQuestion}],
-label=>WebGUI::International::get(21,$namespace)
-label=>WebGUI::International::get(21,$_[0]->get("namespace"))
);
}
if ($answer->{Survey_answerId} eq "new") {
my %options;
tie %options, 'Tie::IxHash';
%options = (
"addAnswer"=>WebGUI::International::get(24,$namespace),
"addQuestion"=>WebGUI::International::get(28,$namespace),
"editQuestion"=>WebGUI::International::get(75,$namespace),
"addAnswer"=>WebGUI::International::get(24,$_[0]->get("namespace")),
"addQuestion"=>WebGUI::International::get(28,$_[0]->get("namespace")),
"editQuestion"=>WebGUI::International::get(75,$_[0]->get("namespace")),
"backToPage"=>WebGUI::International::get(745)
);
$f->whatNext(
@ -362,7 +372,7 @@ sub www_editQuestion {
my ($output, $f, $question, $answerFieldType, $sth, %data);
tie %data, 'Tie::CPHash';
$question = $_[0]->getCollateral("Survey_question","Survey_questionId",$session{form}{qid});
$output = '<h1>'.WebGUI::International::get(17,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(17,$_[0]->get("namespace")).'</h1>';
$answerFieldType = $question->{answerFieldType} || "radioList";
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
@ -372,28 +382,28 @@ sub www_editQuestion {
$f->HTMLArea(
-name=>"question",
-value=>$question->{question},
-label=>WebGUI::International::get(14,$namespace)
-label=>WebGUI::International::get(14,$_[0]->get("namespace"))
);
$f->yesNo(
-name=>"allowComment",
-value=>$question->{allowComment},
-label=>WebGUI::International::get(15,$namespace)
-label=>WebGUI::International::get(15,$_[0]->get("namespace"))
);
$f->yesNo(
-name=>"randomizeAnswers",
-value=>$question->{randomizeAnswers},
-label=>WebGUI::International::get(16,$namespace)
-label=>WebGUI::International::get(16,$_[0]->get("namespace"))
);
if ($question->{Survey_questionId} eq "new") {
my %options;
tie %options, 'Tie::IxHash';
%options = (
"addMultipleChoiceAnswer"=>WebGUI::International::get(24,$namespace),
"addTextAnswer"=>WebGUI::International::get(29,$namespace),
"addBooleanAnswer"=>WebGUI::International::get(25,$namespace),
"addFrequencyAnswer"=>WebGUI::International::get(26,$namespace),
"addOpinionAnswer"=>WebGUI::International::get(27,$namespace),
#"addQuestion"=>WebGUI::International::get(28,$namespace),
"addMultipleChoiceAnswer"=>WebGUI::International::get(24,$_[0]->get("namespace")),
"addTextAnswer"=>WebGUI::International::get(29,$_[0]->get("namespace")),
"addBooleanAnswer"=>WebGUI::International::get(25,$_[0]->get("namespace")),
"addFrequencyAnswer"=>WebGUI::International::get(26,$_[0]->get("namespace")),
"addOpinionAnswer"=>WebGUI::International::get(27,$_[0]->get("namespace")),
#"addQuestion"=>WebGUI::International::get(28,$_[0]->get("namespace")),
"backToPage"=>WebGUI::International::get(745)
);
$f->whatNext(
@ -405,7 +415,7 @@ sub www_editQuestion {
$output .= $f->print;
if ($question->{Survey_questionId} ne "new" && $question->{answerFieldType} ne "text") {
$output .= '<a href="'.WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=editAnswer&aid=new&qid='
.$question->{Survey_questionId}).'">'.WebGUI::International::get(23,$namespace).'</a><p>';
.$question->{Survey_questionId}).'">'.WebGUI::International::get(23,$_[0]->get("namespace")).'</a><p>';
$sth = WebGUI::SQL->read("select Survey_answerId,answer from Survey_answer
where Survey_questionId=".$question->{Survey_questionId}." order by sequenceNumber");
while (%data = $sth->hash) {
@ -564,7 +574,7 @@ sub www_view {
$output .= $_[0]->description;
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))) {
$output .= '<a href="'.WebGUI::URL::page('func=viewStatisticalOverview&wid='.$_[0]->get("wobjectId")).'">'
.WebGUI::International::get(68,$namespace).'</a><p/>';
.WebGUI::International::get(68,$_[0]->get("namespace")).'</a><p/>';
}
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToTakeSurvey"))) {
$previousResponse = WebGUI::SQL->quickHashRef("select Survey_questionId, Survey_answerId from Survey_response
@ -645,16 +655,16 @@ sub www_view {
if ($question->{allowComment}) {
$f->textarea(
-name=>"comment",
-label=>WebGUI::International::get(51,$namespace)
-label=>WebGUI::International::get(51,$_[0]->get("namespace"))
);
}
$f->submit(WebGUI::International::get(50,$namespace));
$f->submit(WebGUI::International::get(50,$_[0]->get("namespace")));
$output .= $f->print;
} else {
if ($_[0]->get("mode") eq "survey") {
$output .= WebGUI::International::get(46,$namespace);
$output .= WebGUI::International::get(46,$_[0]->get("namespace"));
} else {
$output .= WebGUI::International::get(47,$namespace);
$output .= WebGUI::International::get(47,$_[0]->get("namespace"));
my ($questionCount) = WebGUI::SQL->quickArray("select count(*) from Survey_question
where Survey_id=".$_[0]->get("Survey_id"));
my ($correctCount) = WebGUI::SQL->quickArray("select count(*) from Survey_response a,
@ -663,18 +673,18 @@ sub www_view {
(userId=1 and ipAddress='$session{env}{REMOTE_ADDR}'))
and a.Survey_answerId=b.Survey_answerId and b.isCorrect=1");
if ($questionCount > 0) {
$output .= "<h1>".WebGUI::International::get(52,$namespace).": "
$output .= "<h1>".WebGUI::International::get(52,$_[0]->get("namespace")).": "
.$correctCount."/".$questionCount
."<br/>".WebGUI::International::get(54,$namespace).": "
."<br/>".WebGUI::International::get(54,$_[0]->get("namespace")).": "
.round(($correctCount/$questionCount)*100)."%</h1>";
}
}
}
} else {
if ($_[0]->get("mode") eq "survey") {
$output .= WebGUI::International::get(48,$namespace);
$output .= WebGUI::International::get(48,$_[0]->get("namespace"));
} else {
$output .= WebGUI::International::get(49,$namespace);
$output .= WebGUI::International::get(49,$_[0]->get("namespace"));
}
}
return $output;
@ -684,7 +694,7 @@ sub www_view {
sub www_viewComments {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
my ($output, $sth, $comment);
$output = '<h1>'.WebGUI::International::get(57,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(57,$_[0]->get("namespace")).'</h1>';
$sth = WebGUI::SQL->read("select comment from Survey_response where Survey_questionId=".$session{form}{qid});
while (($comment) = $sth->array) {
$output .= $comment."<p/>\n";
@ -697,7 +707,7 @@ sub www_viewComments {
sub www_viewGradebook {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
my ($output, $p, $users, $user);
$output = '<h1>'.WebGUI::International::get(71,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(71,$_[0]->get("namespace")).'</h1>';
$p = WebGUI::Paginator->new('func=viewGradebook&wid='.$_[0]->get("wobjectId"));
$p->setDataByQuery("select userId,username,ipAddress from Survey_response
group by userId,username,ipAddress order by username,ipAddress");
@ -705,9 +715,9 @@ sub www_viewGradebook {
my ($questionCount) = WebGUI::SQL->quickArray("select count(*) from Survey_question
where Survey_id=".$_[0]->get("Survey_id"));
$output .= '<table class="tableData">';
$output .= '<tr class="tableHeader"><td width="60%">'.WebGUI::International::get(67,$namespace).'</td>
<td width="20%">'.WebGUI::International::get(52,$namespace).'</td>
<td width="20%">'.WebGUI::International::get(54,$namespace).'</td></tr>';
$output .= '<tr class="tableHeader"><td width="60%">'.WebGUI::International::get(67,$_[0]->get("namespace")).'</td>
<td width="20%">'.WebGUI::International::get(52,$_[0]->get("namespace")).'</td>
<td width="20%">'.WebGUI::International::get(54,$_[0]->get("namespace")).'</td></tr>';
foreach $user (@$users) {
$output .= '<tr>';
$output .= '<td><a href="'.WebGUI::URL::page('func=viewIndividualSurvey&wid='.$_[0]->get("wobjectId")
@ -737,20 +747,20 @@ sub www_viewGradebook {
sub www_viewIndividualSurvey {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
my ($output, $questions, $sth, $qdata, $rdata, $adata, $p);
$output = '<h1>'.WebGUI::International::get(70,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(70,$_[0]->get("namespace")).'</h1>';
$output .= '<a href="'.WebGUI::URL::page('func=deleteResponses&wid='.$_[0]->get("wobjectId")
.'&uid='.$session{form}{uid}.'&ip='.$session{form}{ip}).'">'.WebGUI::International::get(69,$namespace).'</a><p/>';
.'&uid='.$session{form}{uid}.'&ip='.$session{form}{ip}).'">'.WebGUI::International::get(69,$_[0]->get("namespace")).'</a><p/>';
my ($start) = WebGUI::SQL->quickArray("select min(dateOfResponse) from Survey_response
where Survey_id=".$_[0]->get("Survey_id")." and ((userId=".$session{form}{uid}." and userId<>1)
or (userId=1 and ipAddress='".$session{form}{ip}."'))");
my ($end) = WebGUI::SQL->quickArray("select max(dateOfResponse) from Survey_response
where Survey_id=".$_[0]->get("Survey_id")." and ((userId=".$session{form}{uid}." and userId<>1)
or (userId=1 and ipAddress='".$session{form}{ip}."'))");
$output .= '<b>'.WebGUI::International::get(76,$namespace).':</b> '.epochToHuman($start).'<br/>';
$output .= '<b>'.WebGUI::International::get(77,$namespace).':</b> '.epochToHuman($end).'<br/>';
$output .= '<b>'.WebGUI::International::get(78,$namespace).':</b> '.int(($end-$start)/60).' '
.WebGUI::International::get(79,$namespace).', '.(($end-$start)%60).' '
.WebGUI::International::get(80,$namespace).'<p/>';
$output .= '<b>'.WebGUI::International::get(76,$_[0]->get("namespace")).':</b> '.epochToHuman($start).'<br/>';
$output .= '<b>'.WebGUI::International::get(77,$_[0]->get("namespace")).':</b> '.epochToHuman($end).'<br/>';
$output .= '<b>'.WebGUI::International::get(78,$_[0]->get("namespace")).':</b> '.int(($end-$start)/60).' '
.WebGUI::International::get(79,$_[0]->get("namespace")).', '.(($end-$start)%60).' '
.WebGUI::International::get(80,$_[0]->get("namespace")).'<p/>';
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=viewIndividualSurvey&wid='.$_[0]->get("wobjectId")
.'&uid='.$session{form}{uid}.'&ip='.$session{form}{ip}));
$p->setDataByQuery("select Survey_questionId,question,answerFieldType from Survey_question
@ -761,7 +771,7 @@ sub www_viewIndividualSurvey {
.'<table class="tableData" width="100%">';
if ($qdata->{answerFieldType} eq "radioList") {
$output .= '<tr><td valign="top" class="tableHeader" width="25%">'
.WebGUI::International::get(19,$namespace).'</td><td width="75%">';
.WebGUI::International::get(19,$_[0]->get("namespace")).'</td><td width="75%">';
$sth = WebGUI::SQL->read("select Survey_answerId,answer from Survey_answer
where Survey_questionId=".$qdata->{Survey_questionId}." and isCorrect=1 order by sequenceNumber");
while ($adata = $sth->hashRef) {
@ -771,7 +781,7 @@ sub www_viewIndividualSurvey {
$output .= '</td></tr>';
}
$output .= '<tr><td width="25%" valign="top" class="tableHeader">'
.WebGUI::International::get(66,$namespace).'</td>';
.WebGUI::International::get(66,$_[0]->get("namespace")).'</td>';
$rdata = WebGUI::SQL->quickHashRef("select Survey_answerId,response,comment from Survey_response
where Survey_questionId=".$qdata->{Survey_questionId}."
and ((userId=".$session{form}{uid}." and userId<>1)
@ -779,7 +789,7 @@ sub www_viewIndividualSurvey {
$output .= '<td width="75%">'.$rdata->{response}.'</td></tr>';
if ($rdata->{comment} ne "") {
$output .= '<tr><td valign="top" class="tableHeader">'
.WebGUI::International::get(57,$namespace).'</td>'
.WebGUI::International::get(57,$_[0]->get("namespace")).'</td>'
.'<td>'.$rdata->{comment}.'</td></tr>';
}
$output .= "</table><p/>\n";
@ -791,7 +801,7 @@ sub www_viewIndividualSurvey {
sub www_viewResponses {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
my ($output, $sth, $response);
$output = '<h1>'.WebGUI::International::get(66,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(66,$_[0]->get("namespace")).'</h1>';
$sth = WebGUI::SQL->read("select response from Survey_response where Survey_questionId=".$session{form}{qid});
while (($response) = $sth->array) {
$output .= $response."<p/>\n";
@ -804,9 +814,9 @@ sub www_viewResponses {
sub www_viewStatisticalOverview {
return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports")));
my ($output, $p, $questions, $question, $sth, $answer, $totalResponses, $data);
$output = '<h1>'.WebGUI::International::get(58,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(58,$_[0]->get("namespace")).'</h1>';
$output .= '<a href="'.WebGUI::URL::page('func=deleteAllResponses&wid='.$_[0]->get("wobjectId"))
.'">'.WebGUI::International::get(73,$namespace).'</a><p/>';
.'">'.WebGUI::International::get(73,$_[0]->get("namespace")).'</a><p/>';
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewStatisticalOverview'));
$p->setDataByQuery("select Survey_questionId,question,answerFieldType,allowComment from Survey_question
where Survey_id=".$_[0]->get("Survey_id")." order by sequenceNumber");
@ -815,9 +825,9 @@ sub www_viewStatisticalOverview {
$output .= '<b>'.$question->{question}.'</b>';
if ($question->{answerFieldType} eq "radioList") {
$output .= '<table class="tableData">';
$output .= '<tr class="tableHeader"><td width="60%">'.WebGUI::International::get(19,$namespace).'</td>
<td width="20%">'.WebGUI::International::get(53,$namespace).'</td>
<td width="20%">'.WebGUI::International::get(54,$namespace).'</td></tr>';
$output .= '<tr class="tableHeader"><td width="60%">'.WebGUI::International::get(19,$_[0]->get("namespace")).'</td>
<td width="20%">'.WebGUI::International::get(53,$_[0]->get("namespace")).'</td>
<td width="20%">'.WebGUI::International::get(54,$_[0]->get("namespace")).'</td></tr>';
($totalResponses) = WebGUI::SQL->quickArray("select count(*) from Survey_response
where Survey_questionId=".$question->{Survey_questionId});
$sth = WebGUI::SQL->read("select Survey_answerId,answer,isCorrect from Survey_answer where
@ -845,12 +855,12 @@ sub www_viewStatisticalOverview {
$output .= "</table>";
} else {
$output .= '<br/><a href="'.WebGUI::URL::page('func=viewResponses&wid='.$_[0]->get("wobjectId")
.'&qid='.$question->{Survey_questionId}).'">'.WebGUI::International::get(55,$namespace)
.'&qid='.$question->{Survey_questionId}).'">'.WebGUI::International::get(55,$_[0]->get("namespace"))
.'</a><br/>';
}
if ($question->{allowComment}) {
$output .= '<a href="'.WebGUI::URL::page('func=viewComments&wid='.$_[0]->get("wobjectId")
.'&qid='.$question->{Survey_questionId}).'">'.WebGUI::International::get(56,$namespace).'</a>';
.'&qid='.$question->{Survey_questionId}).'">'.WebGUI::International::get(56,$_[0]->get("namespace")).'</a>';
}
$output .= '<br/><br/><br/>';
}

View file

@ -22,14 +22,12 @@ use WebGUI::SQL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "SyndicatedContent";
our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::SyndicatedContent->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::SyndicatedContent->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
rssUrl=>$_[0]->get("rssUrl"),
content=>$_[0]->get("content"),
@ -38,10 +36,22 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1], [qw(rssUrl content lastFetched)]);
sub name {
return WebGUI::International::get(2,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(rssUrl content lastFetched)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub uiLevel {
return 6;
@ -51,13 +61,13 @@ sub uiLevel {
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f);
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(4,$namespace).'</h1>';
$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,$namespace),$_[0]->get("rssUrl"));
$f->url("rssUrl",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("rssUrl"));
if ($_[0]->get("wobjectId") ne "new") {
$f->readOnly(WebGUI::DateTime::epochToHuman($_[0]->get("lastFetched"),"%z %Z"),WebGUI::International::get(5,$namespace));
$f->readOnly($_[0]->get("content"),WebGUI::International::get(6,$namespace));
$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")));
} else {
$f->hidden("content","Not yet fetched!");
$f->hidden("lastFetched",time());

View file

@ -31,15 +31,13 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "USS";
our $name = WebGUI::International::get(29,$namespace);
#-------------------------------------------------------------------
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=>$namespace});
$w = WebGUI::Wobject::USS->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
groupToContribute=>$_[0]->get("groupToContribute"),
submissionsPerPage=>$_[0]->get("submissionsPerPage"),
@ -67,15 +65,27 @@ sub duplicate {
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from USS_submission where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
sub name {
return WebGUI::International::get(29,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(submissionsPerPage groupToContribute groupToApprove defaultStatus
submissionTemplateId templateId karmaPerSubmission allowDiscussion)]);
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(submissionsPerPage groupToContribute groupToApprove defaultStatus
submissionTemplateId templateId karmaPerSubmission allowDiscussion)],
1
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from USS_submission where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
@ -97,7 +107,7 @@ sub www_approveSubmission {
%submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=$session{form}{sid}");
WebGUI::SQL->write("update USS_submission set status='Approved' where USS_submissionId=$session{form}{sid}");
WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='.
$session{form}{wid}.'&sid='.$session{form}{sid}),4,$namespace);
$session{form}{wid}.'&sid='.$session{form}{sid}),4,$_[0]->get("namespace"));
WebGUI::MessageLog::completeEntry($session{form}{mlog});
return WebGUI::Operation::www_viewMessageLog();
} else {
@ -124,7 +134,7 @@ sub www_deleteSubmission {
my ($owner);
($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=$session{form}{sid}");
if ($owner == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) {
return $_[0]->confirm(WebGUI::International::get(17,$namespace),
return $_[0]->confirm(WebGUI::International::get(17,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}));
} else {
return WebGUI::Privilege::insufficient();
@ -153,7 +163,7 @@ sub www_denySubmission {
%submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=$session{form}{sid}");
WebGUI::SQL->write("update USS_submission set status='Denied' where USS_submissionId=$session{form}{sid}");
WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='.
$session{form}{wid}.'&sid='.$session{form}{sid}),5,$namespace);
$session{form}{wid}.'&sid='.$session{form}{sid}),5,$_[0]->get("namespace"));
WebGUI::MessageLog::completeEntry($session{form}{mlog});
return WebGUI::Operation::www_viewMessageLog();
} else {
@ -168,34 +178,34 @@ sub www_edit {
$groupToApprove = $_[0]->get("groupToApprove") || 4;
$submissionsPerPage = $_[0]->get("submissionsPerPage") || 50;
$defaultStatus = $_[0]->get("defaultStatus") || "Approved";
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(18,$namespace).'</h1>';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(18,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->template(
-name=>"templateId",
-value=>$_[0]->get("templateId"),
-namespace=>$namespace,
-label=>WebGUI::International::get(72,$namespace),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$f->template(
-name=>"submissionTemplateId",
-value=>$_[0]->get("submissionTemplateId"),
-namespace=>$namespace."/Submission",
-label=>WebGUI::International::get(73,$namespace),
-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,$namespace),[$groupToApprove]);
$f->group("groupToContribute",WebGUI::International::get(2,$namespace),[$_[0]->get("groupToContribute")]);
$f->integer("submissionsPerPage",WebGUI::International::get(6,$namespace),$submissionsPerPage);
$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')}
,WebGUI::International::get(563),[$defaultStatus]);
if ($session{setting}{useKarma}) {
$f->integer("karmaPerSubmission",WebGUI::International::get(30,$namespace),$_[0]->get("karmaPerSubmission"));
$f->integer("karmaPerSubmission",WebGUI::International::get(30,$_[0]->get("namespace")),$_[0]->get("karmaPerSubmission"));
} else {
$f->hidden("karmaPerSubmission",$_[0]->get("karmaPerSubmission"));
}
$f->yesNo("allowDiscussion",WebGUI::International::get(48,$namespace),$_[0]->get("allowDiscussion"));
$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);
return $output;
@ -225,7 +235,7 @@ sub www_editSubmission {
$submission->{userId} = $session{user}{userId};
}
if (WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")) || $submission->{userId} == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) {
$output = '<h1>'.WebGUI::International::get(19,$namespace).'</h1>';
$output = '<h1>'.WebGUI::International::get(19,$_[0]->get("namespace")).'</h1>';
$f = WebGUI::HTMLForm->new;
if ($session{user}{userId} == 1 && $submission->{USS_submissionId} eq "new") {
$f->text("visitorName",WebGUI::International::get(438));
@ -233,23 +243,23 @@ sub www_editSubmission {
$f->hidden("wid",$session{form}{wid});
$f->hidden("sid",$submission->{USS_submissionId});
$f->hidden("func","editSubmissionSave");
$f->text("title",WebGUI::International::get(35,$namespace),$submission->{title});
$f->HTMLArea("body",WebGUI::International::get(31,$namespace),$submission->{content});
$f->text("title",WebGUI::International::get(35,$_[0]->get("namespace")),$submission->{title});
$f->HTMLArea("body",WebGUI::International::get(31,$_[0]->get("namespace")),$submission->{content});
if ($submission->{image} ne "") {
$f->readOnly('<a href="'.WebGUI::URL::page('func=deleteFile&file=image&wid='.$session{form}{wid}.'&sid='.$submission->{USS_submissionId}).'">'
.WebGUI::International::get(391).'</a>',WebGUI::International::get(32,$namespace));
.WebGUI::International::get(391).'</a>',WebGUI::International::get(32,$_[0]->get("namespace")));
} else {
$f->file("image",WebGUI::International::get(32,$namespace));
$f->file("image",WebGUI::International::get(32,$_[0]->get("namespace")));
}
if ($submission->{attachment} ne "") {
$f->readOnly('<a href="'.WebGUI::URL::page('func=deleteFile&file=attachment&wid='.$session{form}{wid}
.'&sid='.$submission->{USS_submissionId}).'">'
.WebGUI::International::get(391).'</a>',WebGUI::International::get(33,$namespace));
.WebGUI::International::get(391).'</a>',WebGUI::International::get(33,$_[0]->get("namespace")));
} else {
$f->file("attachment",WebGUI::International::get(33,$namespace));
$f->file("attachment",WebGUI::International::get(33,$_[0]->get("namespace")));
}
$f->yesNo("convertCarriageReturns",WebGUI::International::get(34,$namespace),$submission->{convertCarriageReturns},
'',' &nbsp; '.WebGUI::International::get(38,$namespace));
$f->yesNo("convertCarriageReturns",WebGUI::International::get(34,$_[0]->get("namespace")),$submission->{convertCarriageReturns},
'',' &nbsp; '.WebGUI::International::get(38,$_[0]->get("namespace")));
$f->submit;
$output .= $f->print;
return $output;
@ -273,13 +283,13 @@ sub www_editSubmissionSave {
$hash{USS_submissionId} = "new";
if ($session{setting}{useKarma}) {
$u = WebGUI::User->new($session{user}{userId});
$u->karma($_[0]->get("karmaPerSubmission"),$namespace." (".$_[0]->get("wobjectId")
$u->karma($_[0]->get("karmaPerSubmission"),$_[0]->get("namespace")." (".$_[0]->get("wobjectId")
."/".$session{form}{sid}.")","User submission.");
}
$session{form}{sid} = $_[0]->setCollateral("USS_submission","USS_submissionId",\%hash,0);
%hash = ();
}
$hash{title} = WebGUI::HTML::filter($session{form}{title},'all') || WebGUI::International::get(16,$namespace);
$hash{title} = WebGUI::HTML::filter($session{form}{title},'all') || WebGUI::International::get(16,$_[0]->get("namespace"));
$hash{USS_submissionId} = $session{form}{sid};
$hash{dateSubmitted} = time();
$hash{content} = $session{form}{body};
@ -295,7 +305,7 @@ sub www_editSubmissionSave {
$hash{status} = $_[0]->get("defaultStatus");
WebGUI::MessageLog::addInternationalizedEntry('',$_[0]->get("groupToApprove"),
WebGUI::URL::page('func=viewSubmission&wid='.$_[0]->get("wobjectId").'&sid='.
$session{form}{sid}),3,$namespace,'pending');
$session{form}{sid}),3,$_[0]->get("namespace"),'pending');
} else {
$hash{status} = "Approved";
}
@ -310,21 +320,21 @@ sub www_editSubmissionSave {
#-------------------------------------------------------------------
sub www_showMessage {
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page('func=viewSubmission&wid='.$session{form}{wid}
.'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(45,$namespace).'</a><br>'
.'<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(28,$namespace).'</a><br>');
.'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(45,$_[0]->get("namespace")).'</a><br>'
.'<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(28,$_[0]->get("namespace")).'</a><br>');
}
#-------------------------------------------------------------------
sub www_view {
my (%var, $row, $page, $p, $constraints, @submission, @content, $image, $i, $numResults, $thumbnail, $responses);
$numResults = $_[0]->get("submissionsPerPage");
$var{"readmore.label"} = WebGUI::International::get(46,$namespace);
$var{"responses.label"} = WebGUI::International::get(57,$namespace);
$var{"readmore.label"} = WebGUI::International::get(46,$_[0]->get("namespace"));
$var{"responses.label"} = WebGUI::International::get(57,$_[0]->get("namespace"));
$var{title} = $_[0]->get("title");
$var{description} = $_[0]->get("description");
$var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute"));
$var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(20,$namespace);
$var{"post.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
$var{"search.label"} = WebGUI::International::get(364);
$var{"search.Form"} = WebGUI::Search::form({wid=>$_[0]->get("wobjectId"),func=>'view',search=>1});
$var{"search.url"} = WebGUI::Search::toggleURL();
@ -338,9 +348,9 @@ sub www_view {
$constraints = "(status='Approved' or userId=$session{user}{userId})";
}
$var{"title.label"} = WebGUI::International::get(99);
$var{"thumbnail.label"} = WebGUI::International::get(52,$namespace);
$var{"date.label"} = WebGUI::International::get(13,$namespace);
$var{"by.label"} = WebGUI::International::get(21,$namespace);
$var{"thumbnail.label"} = WebGUI::International::get(52,$_[0]->get("namespace"));
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
$var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults);
$p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username
from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and $constraints order by dateSubmitted desc");
@ -399,37 +409,37 @@ sub www_viewSubmission {
$var{content} = WebGUI::HTML::filter($submission->{content},$session{setting}{filterContributedHTML});
$var{content} =~ s/\^\-\;//g;
$var{content} =~ s/\n/\<br\>/g if ($submission->{convertCarriageReturns});
$var{"user.label"} = WebGUI::International::get(21,$namespace);
$var{"user.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
$var{"user.Profile"} = WebGUI::URL::page('op=viewProfile&uid='.$submission->{userId});
$var{"user.Id"} = $submission->{userId};
$var{"user.username"} = $submission->{username};
$var{"date.label"} = WebGUI::International::get(13,$namespace);
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
$var{"date.epoch"} = $submission->{dateSubmitted};
$var{"date.human"} = epochToHuman($submission->{dateSubmitted});
$var{"status.label"} = WebGUI::International::get(14,$namespace);
$var{"status.label"} = WebGUI::International::get(14,$_[0]->get("namespace"));
$var{"status.status"} = status($submission->{status});
$var{"views.label"} = WebGUI::International::get(514);
$var{"views.count"} = $submission->{views};
$var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute"));
$var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(20,$namespace);
$var{"post.label"} = WebGUI::International::get(20,$_[0]->get("namespace"));
@data = WebGUI::SQL->quickArray("select max(USS_submissionId) from USS_submission
where wobjectId=".$_[0]->get("wobjectId")." and USS_submissionId<$submission->{USS_submissionId}
and (userId=$submission->{userId} or status='Approved')");
$var{"previous.more"} = ($data[0] ne "");
$var{"previous.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$data[0].'&wid='.$session{form}{wid});
$var{"previous.label"} = WebGUI::International::get(58,$namespace);
$var{"previous.label"} = WebGUI::International::get(58,$_[0]->get("namespace"));
@data = WebGUI::SQL->quickArray("select min(USS_submissionId) from USS_submission
where wobjectId=$submission->{wobjectId} and USS_submissionId>$submission->{USS_submissionId}
and (userId=$submission->{userId} or status='Approved')");
$var{"next.more"} = ($data[0] ne "");
$var{"next.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$data[0].'&wid='.$session{form}{wid});
$var{"next.label"} = WebGUI::International::get(59,$namespace);
$var{"next.label"} = WebGUI::International::get(59,$_[0]->get("namespace"));
$var{canEdit} = ($submission->{userId} == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove")));
$var{"delete.url"} = WebGUI::URL::page('func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid});
$var{"delete.label"} = WebGUI::International::get(37,$namespace);
$var{"delete.label"} = WebGUI::International::get(37,$_[0]->get("namespace"));
$var{"edit.url"} = WebGUI::URL::page('func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid});
$var{"edit.label"} = WebGUI::International::get(27,$namespace);
$var{"edit.label"} = WebGUI::International::get(27,$_[0]->get("namespace"));
$var{canChangeStatus} = WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"),$session{user}{userId});
$var{"approve.url"} = WebGUI::URL::page('func=approveSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog});
$var{"approve.label"} = WebGUI::International::get(572);
@ -439,11 +449,11 @@ sub www_viewSubmission {
$var{"deny.label"} = WebGUI::International::get(574);
$var{"canReply"} = ($_[0]->get("allowDiscussion"));
$var{"reply.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId").'&sid='.$session{form}{sid});
$var{"reply.label"} = WebGUI::International::get(47,$namespace);
$var{"reply.label"} = WebGUI::International::get(47,$_[0]->get("namespace"));
$var{"search.url"} = WebGUI::Search::toggleURL();
$var{"search.label"} = WebGUI::International::get(364);
$var{"back.url"} = WebGUI::URL::page();
$var{"back.label"} = WebGUI::International::get(28,$namespace);
$var{"back.label"} = WebGUI::International::get(28,$_[0]->get("namespace"));
if ($submission->{image} ne "") {
$file = WebGUI::Attachment->new($submission->{image},$session{form}{wid},$session{form}{sid});
$var{"image.url"} = $file->getURL;

View file

@ -24,25 +24,35 @@ use WebGUI::Template;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "WobjectProxy";
our $name = WebGUI::International::get(3,$namespace);
#-------------------------------------------------------------------
sub duplicate {
my ($w);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$w->set({
proxiedWobjectId=>$_[0]->get("proxiedWobjectId")
});
}
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(proxiedWobjectId)]);
sub name {
return WebGUI::International::get(3,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
$property,
[qw(proxiedWobjectId)]
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub uiLevel {
return 8;
@ -55,8 +65,8 @@ sub www_edit {
tie %wobject, 'Tie::CPHash';
tie %page, 'Tie::CPHash';
tie %wobjects, 'Tie::IxHash';
$output = helpIcon(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
$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};
@ -65,7 +75,7 @@ sub www_edit {
$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",$namespace);
$f->hidden("title",$_[0]->get("namespace"));
$f->hidden("displayTitle",0);
$f->select(
-name=>"templatePosition",
@ -88,7 +98,7 @@ sub www_edit {
$b->finish;
}
$a->finish;
$f->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$namespace),[$_[0]->get("proxiedWobjectId")]);
$f->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$_[0]->get("namespace")),[$_[0]->get("proxiedWobjectId")]);
$f->submit;
$output .= $f->print;
return $output;
@ -105,7 +115,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
return WebGUI::International::get(4,$namespace);
return WebGUI::International::get(4,$_[0]->get("namespace"));
}