fixed a bug in the new oo page tree stuff

removed a bunch of crap that somehow got readded
added new stuff for autogroups
got rid of magic groups
This commit is contained in:
JT Smith 2004-02-04 02:36:12 +00:00
parent bd4bf924f2
commit 0cb06e0e17
18 changed files with 102 additions and 1548 deletions

View file

@ -1,136 +0,0 @@
package WebGUI::Wobject::ExtraColumn;
#-------------------------------------------------------------------
# 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
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use Tie::CPHash;
use Tie::IxHash;
use WebGUI::DateTime;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Page;
use WebGUI::TabForm;
use WebGUI::Template;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(1,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
spacer=>{
defaultValue=>10
},
width=>{
defaultValue=>200
},
class=>{
defaultValue=>"content"
}
}
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub uiLevel {
return 1;
}
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
my ($output, $f);
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(6,$_[0]->get("namespace")).'</h1>';
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
properties=>{
label=>WebGUI::International::get(893)
},
layout=>{
label=>WebGUI::International::get(105),
uiLevel=>5
},
privileges=>{
label=>WebGUI::International::get(107),
uiLevel=>9
}
);
$f = WebGUI::TabForm->new(\%tabs);
$f->hidden({name=>"wid",value=>$_[0]->get("wobjectId")});
$f->hidden({name=>"namespace",value=>$_[0]->get("namespace")}) if ($_[0]->get("wobjectId") eq "new");
$f->hidden({name=>"func",value=>"editSave"});
$f->getTab("properties")->readOnly(
-value=>$_[0]->get("wobjectId"),
-label=>WebGUI::International::get(499)
);
$f->hidden({name=>"title",value=>$_[0]->name});
$f->hidden({name=>"displayTitle",value=>$_[0]->getValue("displayTitle")});
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),
-value=>[$_[0]->getValue("templatePosition")],
-uiLevel=>5,
-options=>WebGUI::Page::getTemplatePositions($session{page}{templateId}),
-subtext=>WebGUI::Page::drawTemplate($session{page}{templateId})
);
$f->getTab("privileges")->dateTime(
-name=>"startDate",
-label=>WebGUI::International::get(497),
-value=>$_[0]->getValue("startDate")
);
$f->getTab("privileges")->dateTime(
-name=>"endDate",
-label=>WebGUI::International::get(498),
-value=>$_[0]->getValue("endDate")
);
$f->getTab("properties")->integer(
-name=>"spacer",
-label=>WebGUI::International::get(3,$_[0]->get("namespace")),
-value=>,$_[0]->getValue("spacer")
);
$f->getTab("properties")->integer(
-name=>"width",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("width")
);
$f->getTab("properties")->text(
-name=>"class",
-label=>WebGUI::International::get(5,$_[0]->get("namespace")),
-value=>$_[0]->getValue("class")
);
$output .= $f->print;
return $output;
}
#-------------------------------------------------------------------
sub www_view {
return '</td><td width="'.$_[0]->get("spacer").'"></td><td width="'.$_[0]->get("width").'" class="'.$_[0]->get("class").'" valign="top">';
}
1;

View file

@ -1,196 +0,0 @@
package WebGUI::Wobject::FAQ;
#-------------------------------------------------------------------
# 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
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use Tie::CPHash;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w, %data, $newQuestionId, $sth);
tie %data, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$sth = WebGUI::SQL->read("select * from FAQ_question where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newQuestionId = getNextId("FAQ_questionId");
WebGUI::SQL->write("insert into FAQ_question values (".$w.", $newQuestionId, "
.quote($data{question}).", ".quote($data{answer}).", $data{sequenceNumber})");
}
$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(
-properties=>$property,
-extendedProperties=>{},
-useTemplate=>1
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from FAQ_question where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub www_deleteQuestion {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
return $_[0]->confirm(WebGUI::International::get(7,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteQuestionConfirm&wid='.$_[0]->get("wobjectId").'&qid='.$session{form}{qid}));
}
#-------------------------------------------------------------------
sub www_deleteQuestionConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->deleteCollateral("FAQ_question","FAQ_questionId",$session{form}{qid});
$_[0]->reorderCollateral("FAQ_question","FAQ_questionId");
return "";
}
#-------------------------------------------------------------------
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
if ($_[0]->get("wobjectId") eq "new") {
$properties->whatNext(
-options=>{
addQuestion=>WebGUI::International::get(75,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"addQuestion"
);
}
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-headingId=>8,
-helpId=>1
);
}
#-------------------------------------------------------------------
sub www_editSave {
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addQuestion") {
$session{form}{qid} = "new";
return $_[0]->www_editQuestion();
}
}
#-------------------------------------------------------------------
sub www_editQuestion {
my ($output, $question, $f);
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$question = $_[0]->getCollateral("FAQ_question","FAQ_questionId",$session{form}{qid});
$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,$_[0]->get("namespace")),
-value=>$question->{question}
);
$f->HTMLArea(
-name=>"answer",
-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,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
);
}
$f->submit;
$output .= $f->print;
return $output;
}
#-------------------------------------------------------------------
sub www_editQuestionSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->setCollateral("FAQ_question", "FAQ_questionId", {
FAQ_questionId => $session{form}{qid},
question => $session{form}{question},
answer => $session{form}{answer}
});
if ($session{form}{proceed} eq "addQuestion") {
$session{form}{qid} = "new";
return $_[0]->www_editQuestion();
}
return "";
}
#-------------------------------------------------------------------
sub www_moveQuestionDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->moveCollateralDown("FAQ_question","FAQ_questionId",$session{form}{qid});
return "";
}
#-------------------------------------------------------------------
sub www_moveQuestionUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->moveCollateralUp("FAQ_question","FAQ_questionId",$session{form}{qid});
return "";
}
#-------------------------------------------------------------------
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,$_[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})
.editIcon('func=editQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})
.moveUpIcon('func=moveQuestionUp&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})
.moveDownIcon('func=moveQuestionDown&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId});
push(@qa,{
"qa.Id"=>$question{FAQ_questionId},
"qa.answer"=>$question{answer},
"qa.question"=>$question{question},
"qa.controls"=>$controls
});
}
$sth->finish;
$var{qa_loop} = \@qa;
return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
}
1;

View file

@ -1,97 +0,0 @@
package WebGUI::Wobject::Item;
#-------------------------------------------------------------------
# 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
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use Tie::CPHash;
use WebGUI::Attachment;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $f);
$w = $_[0]->SUPER::duplicate($_[1]);
$f = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId"));
$f->copy($w);
}
#-------------------------------------------------------------------
sub name {
return WebGUI::International::get(4,$_[0]->get("namespace"));
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $property = shift;
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
linkURL=>{},
attachment=>{}
},
-useTemplate=>1
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
$properties->url(
-name=>"linkURL",
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>$_[0]->getValue("linkURL"));
$properties->raw($_[0]->fileProperty("attachment",2));
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-headingId=>6,
-helpId=>1
);
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
my ($attachment, $property);
$_[0]->SUPER::www_editSave() if ($_[0]->get("wobjectId") eq "new");
$attachment = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
$attachment->save("attachment");
$property->{attachment} = $attachment->getFilename if ($attachment->getFilename ne "");
$_[0]->SUPER::www_editSave($property);
return "";
}
#-------------------------------------------------------------------
sub www_view {
my ($file, %var);
if ($_[0]->get("attachment") ne "") {
$file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId"));
$var{"attachment.name"} = $file->getFilename;
$var{"attachment.URL"} = $file->getURL;
$var{"attachment.Icon"} = $file->getIcon;
}
return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
}
1;

View file

@ -1,207 +0,0 @@
package WebGUI::Wobject::LinkList;
#-------------------------------------------------------------------
# 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
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use Tie::CPHash;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
#-------------------------------------------------------------------
sub duplicate {
my ($w, $sth, $row);
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::LinkList->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
$sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId")
." order by sequenceNumber");
while ($row = $sth->hashRef) {
$row->{LinkList_linkId} = "new";
$w->setCollateral("LinkList_link","LinkList_linkId",$row);
}
$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(
-properties=>$property,
-extendedProperties=>{},
-useTemplate=>1,
);
bless $self, $class;
}
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from LinkList_link where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
#-------------------------------------------------------------------
sub www_deleteLink {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
return $_[0]->confirm(WebGUI::International::get(9,$_[0]->get("namespace")),
WebGUI::URL::page('func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid}));
}
#-------------------------------------------------------------------
sub www_deleteLinkConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->deleteCollateral("LinkList_link","LinkList_linkId",$session{form}{lid});
$_[0]->reorderCollateral("LinkList_link","LinkList_linkId");
return "";
}
#-------------------------------------------------------------------
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
if ($_[0]->get("wobjectId") eq "new") {
$properties->whatNext(
-options=>{
addLink=>WebGUI::International::get(13,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"addLink"
);
}
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-headingId=>10,
-helpId=>1
);
}
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->SUPER::www_editSave();
if ($session{form}{proceed} eq "addLink") {
$session{form}{lid} = "new";
$_[0]->www_editLink();
} else {
return "";
}
}
#-------------------------------------------------------------------
sub www_editLink {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
my ($output, $link, $f, $linkId, $newWindow);
$link = $_[0]->getCollateral("LinkList_link", "LinkList_linkId",$session{form}{lid});
if ($link->{LinkList_linkId} eq "new") {
$newWindow = 1;
} else {
$newWindow = $link->{newWindow};
}
$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,$_[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,$_[0]->get("namespace")),
backToPage=>WebGUI::International::get(745)
},
-value=>"backToPage"
);
}
$f->submit;
$output .= $f->print;
return $output;
}
#-------------------------------------------------------------------
sub www_editLinkSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->setCollateral("LinkList_link", "LinkList_linkId", {
LinkList_linkId => $session{form}{lid},
description => $session{form}{description},
newWindow => $session{form}{newWindow},
url => $session{form}{url},
name => $session{form}{name},
sequenceNumber=>$session{form}{sequenceNumber}
});
if ($session{form}{proceed} eq "addLink") {
$session{form}{lid} = "new";
return $_[0]->www_editLink();
} else {
return "";
}
}
#-------------------------------------------------------------------
sub www_moveLinkDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->moveCollateralDown("LinkList_link","LinkList_linkId",$session{form}{lid});
return "";
}
#-------------------------------------------------------------------
sub www_moveLinkUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$_[0]->moveCollateralUp("LinkList_link","LinkList_linkId",$session{form}{lid});
return "";
}
#-------------------------------------------------------------------
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,$_[0]->get("namespace"));
$var{canEdit} = WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId"));
$sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId")."
order by sequenceNumber");
while ($link = $sth->hashRef) {
$controls = deleteIcon('func=deleteLink&wid='.$_[0]->get("wobjectId").'&lid='.$link->{LinkList_linkId})
.editIcon('func=editLink&wid='.$_[0]->get("wobjectId").'&lid='.$link->{LinkList_linkId})
.moveUpIcon('func=moveLinkUp&wid='.$_[0]->get("wobjectId").'&lid='.$link->{LinkList_linkId})
.moveDownIcon('func=moveLinkDown&wid='.$_[0]->get("wobjectId").'&lid='.$link->{LinkList_linkId});
push(@linkloop, {
"link.url"=>$link->{url},
"link.controls"=>$controls,
"link.newWindow"=>$link->{newWindow},
"link.name"=>$link->{name},
"link.description"=>$link->{description}
});
}
$sth->finish;
$var{link_loop} = \@linkloop;
return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
}
1;