Switching to new wobject API.
This commit is contained in:
parent
4bed7d43db
commit
41cd27de26
22 changed files with 939 additions and 784 deletions
|
|
@ -23,17 +23,6 @@ use WebGUI::Wobject;
|
|||
|
||||
our @ISA = qw(WebGUI::Wobject);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
my ($w);
|
||||
$w = $_[0]->SUPER::duplicate($_[1]);
|
||||
$w = WebGUI::Wobject::SyndicatedContent->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
|
||||
$w->set({
|
||||
rssUrl=>$_[0]->get("rssUrl"),
|
||||
content=>$_[0]->get("content"),
|
||||
lastFetched=>$_[0]->get("lastFetched")
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub name {
|
||||
|
|
@ -45,8 +34,16 @@ sub new {
|
|||
my $class = shift;
|
||||
my $property = shift;
|
||||
my $self = WebGUI::Wobject->new(
|
||||
$property,
|
||||
[qw(rssUrl content lastFetched)]
|
||||
-properties=>$property,
|
||||
-extendedProperties=>{
|
||||
rssUrl=>{},
|
||||
content=>{
|
||||
defaultValue=>'Not yet fetched!'
|
||||
},
|
||||
lastFetched=>{
|
||||
defaultValue=>time()
|
||||
}
|
||||
}
|
||||
);
|
||||
bless $self, $class;
|
||||
}
|
||||
|
|
@ -59,33 +56,32 @@ sub uiLevel {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
my ($output, $f);
|
||||
$output = helpIcon(1,$_[0]->get("namespace"));
|
||||
$output .= '<h1>'.WebGUI::International::get(4,$_[0]->get("namespace")).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->url("rssUrl",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("rssUrl"));
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->url(
|
||||
-name=>"rssUrl",
|
||||
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
|
||||
-value=>$_[0]->getValue("rssUrl")
|
||||
);
|
||||
if ($_[0]->get("wobjectId") ne "new") {
|
||||
$f->readOnly(WebGUI::DateTime::epochToHuman($_[0]->get("lastFetched"),"%z %Z"),WebGUI::International::get(5,$_[0]->get("namespace")));
|
||||
$f->readOnly($_[0]->get("content"),WebGUI::International::get(6,$_[0]->get("namespace")));
|
||||
$f->readOnly(
|
||||
-value=>WebGUI::DateTime::epochToHuman($_[0]->getValue("lastFetched"),"%z %Z"),
|
||||
-label=>WebGUI::International::get(5,$_[0]->get("namespace"))
|
||||
);
|
||||
$f->readOnly(
|
||||
-value=>$_[0]->getValue("content"),
|
||||
-label=>WebGUI::International::get(6,$_[0]->get("namespace"))
|
||||
);
|
||||
} else {
|
||||
$f->hidden("content","Not yet fetched!");
|
||||
$f->hidden("lastFetched",time());
|
||||
$f->hidden("content",$_[0]->getValue("content"));
|
||||
$f->hidden("lastFetched",$_[0]->getValue("lastFetched"));
|
||||
}
|
||||
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
|
||||
return $output;
|
||||
return $_[0]->SUPER::www_edit(
|
||||
-properties=>$f->printRowsOnly,
|
||||
-headingId=>4,
|
||||
-helpId=>1
|
||||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
my ($property);
|
||||
$property->{rssUrl} = $session{form}{rssUrl};
|
||||
$property->{content} = $session{form}{content} if ($session{form}{content} ne "");
|
||||
$property->{lastFetched} = $session{form}{lastFetched} if ($session{form}{lastFetched} ne "");
|
||||
$_[0]->SUPER::www_editSave($property);
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue