WebGUI 3.3.0 release

This commit is contained in:
JT Smith 2002-02-22 05:33:00 +00:00
parent 40bb7fed59
commit 80f7752f32
41 changed files with 1662 additions and 402 deletions

View file

@ -26,13 +26,14 @@ use WebGUI::Widget;
#-------------------------------------------------------------------
sub duplicate {
my (%data, $newWidgetId, $pageId);
my (%data, $newWidgetId, $pageId, $file);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},
$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId);
$file = WebGUI::Attachment->new($data{attachment},$_[0]);
$file->copy($newWidgetId);
WebGUI::SQL->write("insert into Item values ($newWidgetId, ".
quote($data{description}).", ".quote($data{linkURL}).", ".quote($data{attachment}).")");
}
@ -79,7 +80,8 @@ sub www_addSave {
my ($widgetId, $attachment);
if (WebGUI::Privilege::canEditPage()) {
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
$attachment = WebGUI::Attachment::save("attachment",$widgetId);
$attachment = WebGUI::Attachment->new("",$widgetId);
$attachment->save("attachment");
WebGUI::SQL->write("insert into Item values ($widgetId, ".quote($session{form}{description}).", ".quote($session{form}{linkURL}).", ".quote($attachment).")");
return "";
} else {
@ -149,14 +151,17 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_editSave {
my ($attachment);
my ($attachment, $sqlAdd);
if (WebGUI::Privilege::canEditPage()) {
update();
$attachment = WebGUI::Attachment::save("attachment",$session{form}{wid});
if ($attachment ne "") {
$attachment = ', attachment='.quote($attachment);
$attachment = WebGUI::Attachment->new("",$session{form}{wid});
$attachment->save("attachment");
if ($attachment->getFilename ne "") {
$sqlAdd = ', attachment='.quote($attachment->getFilename);
}
WebGUI::SQL->write("update Item set description=".quote($session{form}{description}).", linkURL=".quote($session{form}{linkURL}).$attachment." where widgetId=$session{form}{wid}");
WebGUI::SQL->write("update Item set description=".quote($session{form}{description}).
", linkURL=".quote($session{form}{linkURL}).
$sqlAdd." where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -165,7 +170,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
my (%data, @test, $output, %fileType);
my (%data, @test, $output, $file);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
@ -175,9 +180,8 @@ sub www_view {
$output .= '<span class="itemTitle">'.$data{title}.'</span>';
}
if ($data{attachment} ne "") {
%fileType = WebGUI::Attachment::getType($data{attachment});
$output .= ' - <a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.
$data{attachment}.'"><img src="'.$fileType{icon}.'" border=0 alt="'.
$file = WebGUI::Attachment->new($data{attachment},$_[0]);
$output .= ' - <a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 alt="'.
$data{attachment}.'" width=16 height=16 border=0 align="middle"></a>';
}
if ($data{description} ne "") {
@ -193,7 +197,5 @@ sub www_view {
1;