package WebGUI::Wobject::Article; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2002 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::DateTime; use WebGUI::HTML; 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); our $namespace = "Article"; our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- sub duplicate { my ($file, $w); $w = $_[0]->SUPER::duplicate($_[1]); $w = WebGUI::Wobject::Article->new({wobjectId=>$w,namespace=>$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")); $file->copy($w->get("wobjectId")); $w->set({ image=>$_[0]->get("image"), linkTitle=>$_[0]->get("linkTitle"), linkURL=>$_[0]->get("linkURL"), attachment=>$_[0]->get("attachment"), convertCarriageReturns=>$_[0]->get("convertCarriageReturns"), alignImage=>$_[0]->get("alignImage"), allowDiscussion=>$_[0]->get("allowDiscussion") }); } #------------------------------------------------------------------- sub set { $_[0]->SUPER::set($_[1],[qw(image linkTitle linkURL attachment convertCarriageReturns alignImage allowDiscussion)]); } #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $editTimeout, $groupToModerate, %hash, $f); tie %hash, 'Tie::IxHash'; if ($_[0]->get("wobjectId") eq "new") { $editTimeout = 1; } else { $editTimeout = $_[0]->get("editTimeout"); } $groupToModerate = $_[0]->get("groupToModerate") || 4; $output = helpIcon(1,$namespace); $output .= '
| ';
}
$output .= $_[0]->displayTitle;
if ($_[0]->get("image") ne "") {
$image = WebGUI::Attachment->new($_[0]->get("image"),$_[0]->get("wobjectId"));
$image = ' '.$image.' ';
} else {
$output .= $image;
}
}
$body = $_[0]->description;
if ($_[0]->get("convertCarriageReturns")) {
$body =~ s/\n/\/g; } $output .= $body; if ($_[0]->get("linkURL") ne "" && $_[0]->get("linkTitle") ne "") { $output .= ' '.$_[0]->get("linkTitle").''; } if ($_[0]->get("attachment") ne "") { $file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId")); $output .= $file->box; } if ($_[0]->get("image") ne "") { $output .= " |
| '. WebGUI::International::get(28,$namespace).' ('.$replies.') | '; $output .= ''. WebGUI::International::get(24,$namespace).' |