WebGUI 3.1.0 release

This commit is contained in:
JT Smith 2002-02-01 06:57:00 +00:00
parent d1c1445ea1
commit 71cd27d3bc
56 changed files with 2025 additions and 238 deletions

View file

@ -33,7 +33,7 @@ sub duplicate {
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
WebGUI::Attachment::copy($data{image},$_[0],$newWidgetId);
WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId);
WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}')");
WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}', ".quote($data{alignImage}).")");
}
#-------------------------------------------------------------------
@ -48,7 +48,7 @@ sub widgetName {
#-------------------------------------------------------------------
sub www_add {
my ($output, %hash);
my ($output, %hash, @array);
tie %hash, "Tie::IxHash";
if (WebGUI::Privilege::canEditPage()) {
$output = helpLink(1,$namespace);
@ -66,6 +66,14 @@ sub www_add {
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("endDate",20,30,'01/01/2037',1));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::textArea("body",'',50,10,1));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::file("image"));
%hash = (
right => WebGUI::International::get(15,$namespace),
left => WebGUI::International::get(16,$namespace),
center => WebGUI::International::get(17,$namespace)
);
$array[0] = "right";
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
WebGUI::Form::selectList("alignImage",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("linkTitle",20,128));
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("linkURL",20,2048));
$output .= tableFormRow(WebGUI::International::get(9,$namespace),WebGUI::Form::file("attachment"));
@ -86,7 +94,7 @@ sub www_addSave {
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
$image = WebGUI::Attachment::save("image",$widgetId);
$attachment = WebGUI::Attachment::save("attachment",$widgetId);
WebGUI::SQL->write("insert into Article values ($widgetId, '".setToEpoch($session{form}{startDate})."', '".setToEpoch($session{form}{endDate})."', ".quote($session{form}{body}).", ".quote($image).", ".quote($session{form}{linkTitle}).", ".quote($session{form}{linkURL}).", ".quote($attachment).", '$session{form}{convertCarriageReturns}')");
WebGUI::SQL->write("insert into Article values ($widgetId, '".setToEpoch($session{form}{startDate})."', '".setToEpoch($session{form}{endDate})."', ".quote($session{form}{body}).", ".quote($image).", ".quote($session{form}{linkTitle}).", ".quote($session{form}{linkURL}).", ".quote($attachment).", '$session{form}{convertCarriageReturns}', ".quote($session{form}{alignImage}).")");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -150,6 +158,14 @@ sub www_edit {
} else {
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::file("image"));
}
%hash = (
right => WebGUI::International::get(15,$namespace),
left => WebGUI::International::get(16,$namespace),
center => WebGUI::International::get(17,$namespace)
);
$array[0] = $data{alignImage};
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
WebGUI::Form::selectList("alignImage",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("linkTitle",20,128,$data{linkTitle}));
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("linkURL",20,2048,$data{linkURL}));
if ($data{attachment} ne "") {
@ -179,7 +195,7 @@ sub www_editSave {
if ($attachment ne "") {
$attachment = ', attachment='.quote($attachment);
}
WebGUI::SQL->write("update Article set startDate='".setToEpoch($session{form}{startDate})."', endDate='".setToEpoch($session{form}{endDate})."', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}");
WebGUI::SQL->write("update Article set alignImage=".quote($session{form}{alignImage}).", startDate='".setToEpoch($session{form}{startDate})."', endDate='".setToEpoch($session{form}{endDate})."', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -188,7 +204,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
my (%data, @test, $output);
my (%data, @test, $output, $image);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if ($data{startDate}<time() && $data{endDate}>time()) {
@ -196,7 +212,16 @@ sub www_view {
$output = "<h1>".$data{title}."</h1>";
}
if ($data{image} ne "") {
$output .= '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{image}.'" border="0" align="right">';
$image = '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{image}.'"';
if ($data{alignImage} ne "center") {
$image .= ' align="'.$data{alignImage}.'"';
}
$image .= ' border="0">';
if ($data{alignImage} eq "center") {
$output .= '<div align="center">'.$image.'</div>';
} else {
$output .= $image;
}
}
if ($data{convertCarriageReturns}) {
$data{body} =~ s/\n/\<br\>/g;
@ -206,7 +231,7 @@ sub www_view {
$output .= '<p><a href="'.$data{linkURL}.'">'.$data{linkTitle}.'</a>';
}
if ($data{attachment} ne "") {
$output .= '<p><a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{attachment}.'"><img src="'.$session{setting}{lib}.'/attachment.gif" border=0 alt="'.WebGUI::International::get(14,$namespace).'"></a>';
$output .= attachmentBox($data{attachment},$_[0]);
}
}
if ($data{processMacros} == 1) {

View file

@ -0,0 +1,581 @@
package WebGUI::Widget::DownloadManager;
our $namespace = "DownloadManager";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black Software.
#-------------------------------------------------------------------
# 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::DateTime;
use WebGUI::Form;
use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::Utility;
use WebGUI::Widget;
#-------------------------------------------------------------------
sub _reorderDownloads {
my ($sth, $i, $did);
$sth = WebGUI::SQL->read("select downloadId from DownloadManager_file where widgetId=$_[0] order by sequenceNumber");
while (($did) = $sth->array) {
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber='$i' where downloadId=$did");
$i++;
}
$sth->finish;
}
#-------------------------------------------------------------------
sub duplicate {
my (%data, $newWidgetId, $pageId, %row, $sth, $newDownloadId);
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::SQL->write("insert into DownloadManager values ($newWidgetId, $data{paginateAfter})");
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0]");
while (%row = $sth->hash) {
$newDownloadId = getNextId("downloadId");
WebGUI::Attachment::copy($row{downloadFile},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
WebGUI::Attachment::copy($row{alternateVersion1},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
WebGUI::Attachment::copy($row{alternateVersion2},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
WebGUI::SQL->write("insert into DownloadManager_file values ($newDownloadId, $newWidgetId, ".
quote($row{fileTitle}).", ".quote($row{downloadFile}).", $row{groupToView}, ".
quote($row{briefSynopsis}).", $row{dateUploaded}, $row{sequenceNumber}, ".
quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).")");
}
$sth->finish;
}
#-------------------------------------------------------------------
sub purge {
purgeWidget($_[0],$_[1],$namespace);
WebGUI::SQL->write("delete from DownloadManager_file where widgetId=$_[0]");
}
#-------------------------------------------------------------------
sub widgetName {
return WebGUI::International::get(1,$namespace);
}
#-------------------------------------------------------------------
sub www_add {
my ($output, %hash);
tie %hash,'Tie::IxHash';
if (WebGUI::Privilege::canEditPage()) {
$output = helpLink(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("widget",$namespace);
$output .= WebGUI::Form::hidden("func","addSave");
$output .= '<table>';
$output .= tableFormRow(
WebGUI::International::get(99),
WebGUI::Form::text("title",20,30,widgetName())
);
$output .= tableFormRow(
WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle",1,1)
);
$output .= tableFormRow(
WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros",1,1)
);
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(
WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash)
);
$output .= tableFormRow(
WebGUI::International::get(85),
WebGUI::Form::textArea("description",'',50,5,1)
);
$output .= tableFormRow(
WebGUI::International::get(20,$namespace),
WebGUI::Form::text("paginateAfter",20,30,50)
);
$output .= tableFormRow(
WebGUI::International::get(3,$namespace),
WebGUI::Form::checkbox("proceed",1,1)
);
$output .= formSave();
$output .= '</table></form>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
return $output;
}
#-------------------------------------------------------------------
sub www_addSave {
my ($widgetId);
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}
);
WebGUI::SQL->write("insert into DownloadManager values ($widgetId, '$session{form}{paginateAfter}')");
if ($session{form}{proceed} == 1) {
$session{form}{wid} = $widgetId;
return www_addDownload();
} else {
return "";
}
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_addDownload {
my ($output);
if (WebGUI::Privilege::canEditPage()) {
$output .= '<h1>'.WebGUI::International::get(4,$namespace).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("func","addDownloadSave");
$output .= '<table>';
$output .= tableFormRow(
WebGUI::International::get(6,$namespace),
WebGUI::Form::file("downloadFile")
);
$output .= tableFormRow(
WebGUI::International::get(17,$namespace),
WebGUI::Form::file("alternateVersion1")
);
$output .= tableFormRow(
WebGUI::International::get(18,$namespace),
WebGUI::Form::file("alternateVersion2")
);
$output .= tableFormRow(
WebGUI::International::get(5,$namespace),
WebGUI::Form::text("fileTitle",20,128,WebGUI::International::get(5,$namespace))
);
$output .= tableFormRow(
WebGUI::International::get(8,$namespace),
WebGUI::Form::text("briefSynopsis",50,256)
);
$output .= tableFormRow(
WebGUI::International::get(7,$namespace),
WebGUI::Form::groupList("groupToView",2)
);
$output .= formSave();
$output .= '</table></form>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_addDownloadSave {
my ($downloadId,$file,$alt1,$alt2,$sequenceNumber);
if (WebGUI::Privilege::canEditPage()) {
$downloadId = getNextId("downloadId");
$file = WebGUI::Attachment::save("downloadFile",$session{form}{wid},$downloadId);
$alt1 = WebGUI::Attachment::save("alternateVersion1",$session{form}{wid},$downloadId);
$alt2 = WebGUI::Attachment::save("alternateVersion2",$session{form}{wid},$downloadId);
($sequenceNumber) = WebGUI::SQL->quickArray("select count(*)+1 from DownloadManager_file where widgetId=$session{form}{wid}");
WebGUI::SQL->write("insert into DownloadManager_file values (".
$downloadId.
", ".$session{form}{wid}.
", ".quote($session{form}{fileTitle}).
", ".quote($file).
", '$session{form}{groupToView}'".
", ".quote($session{form}{briefSynopsis}).
", ".time().
", ".$sequenceNumber.
", ".quote($alt1).
", ".quote($alt2).
")");
return www_edit();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_copy {
if (WebGUI::Privilege::canEditPage()) {
duplicate($session{form}{wid});
return "";
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_deleteFile {
my ($delete);
if (WebGUI::Privilege::canEditPage()) {
if ($session{form}{alt} == 1) {
$delete = "alternateVersion1";
} elsif ($session{form}{alt} == 2) {
$delete = "alternateVersion2";
} else {
$delete = "downloadFile";
}
WebGUI::SQL->write("update DownloadManager_file set $delete='' where downloadId=$session{form}{did}");
return www_editDownload();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_deleteDownload {
my ($output);
if (WebGUI::Privilege::canEditPage()) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(12,$namespace).'<p>';
$output .= '<div align="center">'.
'<a href="'.$session{page}{url}.
'?func=deleteDownloadConfirm&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
WebGUI::International::get(44).'</a>';
$output .= ' &nbsp; <a href="'.$session{page}{url}.
'?func=edit&wid='.$session{form}{wid}.'">'.
WebGUI::International::get(45).'</a></div>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_deleteDownloadConfirm {
my ($output);
if (WebGUI::Privilege::canEditPage()) {
WebGUI::SQL->write("delete from DownloadManager_file where downloadId=$session{form}{did}");
_reorderDownloads($session{form}{wid});
return www_edit();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_download {
my (%download);
tie %download,'Tie::CPHash';
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId=$session{form}{did}");
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
$session{header}{redirect} = WebGUI::Session::httpRedirect(
$session{setting}{attachmentDirectoryWeb}."/".
$session{form}{wid}."/".$session{form}{did}."/".$download{downloadFile}
);
return "";
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_edit {
my ($output, %data, %hash, @array, $sth, @download);
tie %data, 'Tie::CPHash';
tie %hash, 'Tie::IxHash';
if (WebGUI::Privilege::canEditPage()) {
%data = getProperties($namespace,$session{form}{wid});
$output .= helpLink(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(9,$namespace).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>';
$output .= tableFormRow(
WebGUI::International::get(99),
WebGUI::Form::text("title",20,30,$data{title})
);
$output .= tableFormRow(
WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle})
);
$output .= tableFormRow(
WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros","1",
$data{processMacros})
);
%hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition};
$output .= tableFormRow(
WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array)
);
$output .= tableFormRow(
WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},50,5,1)
);
$output .= tableFormRow(
WebGUI::International::get(20,$namespace),
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter})
);
$output .= formSave();
$output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addDownload&wid='.
$session{form}{wid}.'">'.WebGUI::International::get(11,$namespace).'</a><p>';
$output .= '<table border=1 cellpadding=3 cellspacing=0>';
$sth = WebGUI::SQL->read("select downloadId,fileTitle from DownloadManager_file where widgetId='$session{form}{wid}' order by sequenceNumber");
while (@download = $sth->array) {
$output .= '<tr><td><a href="'.$session{page}{url}.
'?func=editDownload&wid='.$session{form}{wid}.
'&did='.$download[0].'"><img src="'.
$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.
$session{page}{url}.'?func=deleteDownload&wid='.
$session{form}{wid}.'&did='.$download[0].'"><img src="'.
$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
$session{page}{url}.'?func=moveDownloadUp&wid='.
$session{form}{wid}.'&did='.$download[0].'"><img src="'.
$session{setting}{lib}.'/upArrow.gif" border=0></a><a href="'.
$session{page}{url}.'?func=moveDownloadDown&wid='.
$session{form}{wid}.'&did='.$download[0].
'"><img src="'.$session{setting}{lib}.
'/downArrow.gif" border=0></a></td><td>'.$download[1].'</td><tr>';
}
$sth->finish;
$output .= '</table>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_editSave {
if (WebGUI::Privilege::canEditPage()) {
update();
WebGUI::SQL->write("update DownloadManager set paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_editDownload {
my ($output, %download);
tie %download,'Tie::CPHash';
if (WebGUI::Privilege::canEditPage()) {
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId='$session{form}{did}'");
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("did",$session{form}{did});
$output .= WebGUI::Form::hidden("func","editDownloadSave");
$output .= '<table>';
if ($download{downloadFile} ne "") {
$output .= tableFormRow(
WebGUI::International::get(6,$namespace),
'<a href="'.$session{page}{url}.'?func=deleteFile&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
WebGUI::International::get(13,$namespace).'</a>
');
} else {
$output .= tableFormRow(
WebGUI::International::get(6,$namespace),
WebGUI::Form::file("downloadFile")
);
}
if ($download{alternateVersion1} ne "") {
$output .= tableFormRow(
WebGUI::International::get(17,$namespace),
'<a href="'.$session{page}{url}.'?func=deleteFile&alt=1&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
WebGUI::International::get(13,$namespace).'</a>
');
} else {
$output .= tableFormRow(
WebGUI::International::get(17,$namespace),
WebGUI::Form::file("alternateVersion1")
);
}
if ($download{alternateVersion2} ne "") {
$output .= tableFormRow(
WebGUI::International::get(18,$namespace),
'<a href="'.$session{page}{url}.'?func=deleteFile&alt=2&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
WebGUI::International::get(13,$namespace).'</a>
');
} else {
$output .= tableFormRow(
WebGUI::International::get(18,$namespace),
WebGUI::Form::file("alternateVersion2")
);
}
$output .= tableFormRow(
WebGUI::International::get(5,$namespace),
WebGUI::Form::text("fileTitle",20,128,$download{fileTitle})
);
$output .= tableFormRow(
WebGUI::International::get(8,$namespace),
WebGUI::Form::text("briefSynopsis",50,256,$download{briefSynopsis})
);
$output .= tableFormRow(
WebGUI::International::get(7,$namespace),
WebGUI::Form::groupList("groupToView",$download{groupToView})
);
$output .= formSave();
$output .= '</table></form>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_editDownloadSave {
my ($file, $alt1, $alt2);
if (WebGUI::Privilege::canEditPage()) {
$file = WebGUI::Attachment::save("downloadFile",$session{form}{wid},$session{form}{did});
if ($file ne "") {
$file = ', downloadFile='.quote($file);
}
$alt1 = WebGUI::Attachment::save("alternateVersion1",$session{form}{wid},$session{form}{did});
if ($alt1 ne "") {
$alt1 = ', alternateVersion1='.quote($alt1);
}
$alt2 = WebGUI::Attachment::save("alternateVersion2",$session{form}{wid},$session{form}{did});
if ($alt2 ne "") {
$alt2 = ', alternateVersion2='.quote($alt2);
}
WebGUI::SQL->write("update DownloadManager_file set ".
" downloadId=".$session{form}{did}.
", widgetId=".$session{form}{wid}.
", fileTitle=".quote($session{form}{fileTitle}).
$file.$alt1.$alt2.
", groupToView='$session{form}{groupToView}'".
", briefSynopsis=".quote($session{form}{briefSynopsis}).
", dateUploaded=".time().
" where downloadId=".$session{form}{did}
);
return www_edit();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_moveDownloadDown {
my (@data, $thisSeq);
if (WebGUI::Privilege::canEditPage()) {
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from DownloadManager_file where downloadId=$session{form}{did}");
@data = WebGUI::SQL->quickArray("select downloadId from DownloadManager_file where widgetId=$session{form}{wid} and sequenceNumber=$thisSeq+1 group by widgetId");
if ($data[0] ne "") {
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber+1 where downloadId=$session{form}{did}");
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber-1 where downloadId=$data[0]");
}
return www_edit();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_moveDownloadUp {
my (@data, $thisSeq);
if (WebGUI::Privilege::canEditPage()) {
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from DownloadManager_file where downloadId=$session{form}{did}");
@data = WebGUI::SQL->quickArray("select downloadId from DownloadManager_file where widgetId=$session{form}{wid} and sequenceNumber=$thisSeq-1 group by widgetId");
if ($data[0] ne "") {
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber-1 where downloadId=$session{form}{did}");
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber+1 where downloadId=$data[0]");
}
return www_edit();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_view {
my (@row, $i, $dataRows, $prevNextBar, %data, @test, %fileType, $output, $sth, %download, $flag);
tie %download, 'Tie::CPHash';
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
if ($data{displayTitle} == 1) {
$output .= '<h1>'.$data{title}.'</h1>';
}
if ($data{description} ne "") {
$output .= $data{description}.'<p>';
}
$output .= '<table cellpadding="3" cellspacing="1" border="0" width="100%">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(14,$namespace).
'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace).
'</td><td class="tableHeader">'.WebGUI::International::get(16,$namespace).'</td></tr>';
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0] order by sequenceNumber");
while (%download = $sth->hash) {
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
%fileType = WebGUI::Attachment::getType($download{downloadFile});
$row[$i] = '<tr><td class="tableData" valign="top">';
$row[$i] .= '<a href="'.$session{page}{url}.'?func=download&wid='.$_[0].
'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}.
'" border=0 width=16 height=16 align="middle">'.
$download{fileTitle}.' ('.$fileType{extension}.')</a>';
if ($download{alternateVersion1}) {
%fileType = WebGUI::Attachment::getType($download{alternateVersion1});
$row[$i] .= ' &middot; <a href="'.$session{page}{url}.'?func=download&wid='.
$_[0].'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}.
'" border=0 width=16 height=16 align="middle">('.
$fileType{extension}.')</a>';
}
if ($download{alternateVersion2}) {
%fileType = WebGUI::Attachment::getType($download{alternateVersion2});
$row[$i] .= ' &middot; <a href="'.$session{page}{url}.'?func=download&wid='.
$_[0].'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}.
'" border=0 width=16 height=16 align="middle">('.
$fileType{extension}.')</a>';
}
$row[$i] .= '</td><td class="tableData" valign="top">'.$download{briefSynopsis}.'</td>'.
'<td class="tableData" valign="top">'.
epochToHuman($download{dateUploaded},"%M/%D/%y").'</td>'.
'</tr>';
$flag = 1;
$i++;
}
}
$sth->finish;
unless ($flag) {
$output .= '<tr><td class="tableData" colspan="3">'.
WebGUI::International::get(19,$namespace).'</td></tr>';
}
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row);
$output .= $dataRows;
$output .= '</table>';
$output .= $prevNextBar;
if ($data{processMacros} == 1) {
$output = WebGUI::Macro::process($output);
}
}
return $output;
}
1;

View file

@ -29,8 +29,9 @@ sub duplicate {
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::SQL->write("insert into EventsCalendar values ($newWidgetId)");
$newWidgetId = create($pageId,$namespace,$data{title},
$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into EventsCalendar values ($newWidgetId, '$data{calendarLayout}', '$data{paginateAfter}')");
$sth = WebGUI::SQL->read("select * from EventsCalendar_event where widgetId=$_[0] order by recurringEventId");
while (@row = $sth->array) {
$newEventId = getNextId("eventId");
@ -38,7 +39,9 @@ sub duplicate {
$row[6] = getNextId("recurringEventId");
$previousRecurringEventId = $row[6];
}
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, $newWidgetId, ".quote($row[2]).", ".quote($row[3]).", '".$row[4]."', '".$row[5]."', $row[6])");
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, $newWidgetId, ".
quote($row[2]).", ".quote($row[3]).", '".$row[4].
"', '".$row[5]."', $row[6])");
}
$sth->finish;
}
@ -65,12 +68,20 @@ sub www_add {
$output .= WebGUI::Form::hidden("widget",$namespace);
$output .= WebGUI::Form::hidden("func","addSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'Events Calendar'));
$output .= tableFormRow(WebGUI::International::get(99),
WebGUI::Form::text("title",20,128,'Events Calendar'));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
%hash = (list => WebGUI::International::get(17,$namespace),
calendar => WebGUI::International::get(18,$namespace));
$output .= tableFormRow(WebGUI::International::get(16,$namespace),
WebGUI::Form::selectList("calendarLayout",\%hash));
$output .= tableFormRow(WebGUI::International::get(19,$namespace),
WebGUI::Form::text("paginateAfter",20,30,50));
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::checkbox("proceed",1,1));
$output .= formSave();
$output .= '</table></form>';
@ -85,8 +96,10 @@ sub www_add {
sub www_addSave {
my ($widgetId);
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});
WebGUI::SQL->write("insert into EventsCalendar values ($widgetId)");
$widgetId = create($session{page}{pageId},$session{form}{widget},
$session{form}{title},$session{form}{displayTitle},$session{form}{description},
$session{form}{processMacros},$session{form}{templatePosition});
WebGUI::SQL->write("insert into EventsCalendar values ($widgetId, '$session{form}{calendarLayout}', '$session{form}{paginateAfter}')");
if ($session{form}{proceed} == 1) {
$session{form}{wid} = $widgetId;
return www_addEvent();
@ -114,9 +127,12 @@ sub www_addEvent {
$output .= WebGUI::Form::hidden("func","addEventSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("name",20,128));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,10,1));
$output .= tableFormRow(WebGUI::International::get(176),WebGUI::Form::text("startDate",20,30,$today,1,'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"'));
$output .= tableFormRow(WebGUI::International::get(177),WebGUI::Form::text("endDate",20,30,$today,1));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",'',50,10,1));
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
WebGUI::Form::text("startDate",20,30,$today,1,'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"'));
$output .= tableFormRow(WebGUI::International::get(15,$namespace),
WebGUI::Form::text("endDate",20,30,$today,1));
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::selectList("recursEvery",\%recursEvery).' '.WebGUI::International::get(9,$namespace).' '.WebGUI::Form::text("until",20,30,$today,1));
$output .= formSave();
$output .= '</table></form>';
@ -220,12 +236,23 @@ sub www_edit {
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,5,1));
$output .= tableFormRow(WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},50,5,1));
%hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
%hash = (list => WebGUI::International::get(17,$namespace),
calendar => WebGUI::International::get(18,$namespace));
$array[0] = $data{calendarLayout};
$output .= tableFormRow(WebGUI::International::get(16,$namespace),
WebGUI::Form::selectList("calendarLayout",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(19,$namespace),
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter}));
$output .= formSave();
$output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addEvent&wid='.$session{form}{wid}.'">Add New Event</a><p>';
@ -246,6 +273,7 @@ sub www_edit {
sub www_editSave {
if (WebGUI::Privilege::canEditPage()) {
update();
WebGUI::SQL->write("update EventsCalendar set calendarLayout='$session{form}{calendarLayout}', paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -264,10 +292,14 @@ sub www_editEvent {
$output .= WebGUI::Form::hidden("eid",$session{form}{eid});
$output .= WebGUI::Form::hidden("func","editEventSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("name",20,128,$event{name}));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$event{description},50,10,1));
$output .= tableFormRow(WebGUI::International::get(176),WebGUI::Form::text("startDate",20,30,epochToSet($event{startDate}),1));
$output .= tableFormRow(WebGUI::International::get(177),WebGUI::Form::text("endDate",20,30,epochToSet($event{endDate}),1));
$output .= tableFormRow(WebGUI::International::get(99),
WebGUI::Form::text("name",20,128,$event{name}));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$event{description},50,10,1));
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
WebGUI::Form::text("startDate",20,30,epochToSet($event{startDate}),1));
$output .= tableFormRow(WebGUI::International::get(15,$namespace),
WebGUI::Form::text("endDate",20,30,epochToSet($event{endDate}),1));
$output .= formSave();
$output .= '</table></form>';
return $output;

View file

@ -155,7 +155,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
my (%data, @test, $output);
my (%data, @test, $output, %fileType);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
@ -165,12 +165,18 @@ sub www_view {
$output .= '<span class="itemTitle">'.$data{title}.'</span>';
}
if ($data{attachment} ne "") {
$output .= ' - <a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{attachment}.'"><img src="'.$session{setting}{lib}.'/smallAttachment.gif" border=0 alt="'.WebGUI::International::get(5,$namespace).'"></a>';
%fileType = WebGUI::Attachment::getType($data{attachment});
$output .= ' - <a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.
$data{attachment}.'"><img src="'.$fileType{icon}.'" border=0 alt="'.
$data{attachment}.'" width=16 height=16 border=0 align="middle"></a>';
}
if ($data{description} ne "") {
$output .= ' - '.$data{description};
}
}
if ($data{processMacros} == 1) {
$output = WebGUI::Macro::process($output);
}
return $output;
}

View file

@ -58,17 +58,20 @@ sub www_add {
$output .= WebGUI::Form::hidden("widget",$namespace);
$output .= WebGUI::Form::hidden("func","addSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'Message Board'));
$output .= tableFormRow(WebGUI::International::get(99),
WebGUI::Form::text("title",20,128,'Message Board'));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$array[0] = 2;
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::selectList("groupToPost",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("messagesPerPage",20,2,30));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("editTimeout",20,3,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::groupList("groupToPost",2));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::text("messagesPerPage",20,2,30));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("editTimeout",20,3,1));
$output .= formSave();
$output .= '</table></form>';
return $output;
@ -120,9 +123,8 @@ sub www_edit {
$array[0] = $board{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$board{description},50,5,1));
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$array[0] = $board{groupToPost};
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::selectList("groupToPost",\%hash,\@array,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::selectList("groupToPost",$board{groupToPost}));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage}));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("editTimeout",20,2,$board{editTimeout}));
$output .= formSave();

View file

@ -94,8 +94,8 @@ sub widgetName {
#-------------------------------------------------------------------
sub www_add {
my ($output, %hash, @array);
tie %hash, "Tie::IxHash";
my ($output, %hash);
tie %hash, 'Tie::IxHash';
if (WebGUI::Privilege::canEditPage()) {
$output = helpLink(1,$namespace);
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
@ -107,15 +107,17 @@ sub www_add {
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::checkbox("active",1,1));
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$array[0] = 1;
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::selectList("voteGroup",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("graphWidth",20,3,150));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::groupList("voteGroup",1));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("graphWidth",20,3,150));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("question",50,255));
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',WebGUI::Form::textArea("answers",'',50,8,0,'on'));
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',
WebGUI::Form::textArea("answers",'',50,8,0,'on'));
$output .= formSave();
$output .= '</table></form>';
return $output;
@ -162,19 +164,26 @@ sub www_edit {
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
$output .= tableFormRow(WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
%hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::checkbox("active",1,$data{active}));
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$array[0] = $data{voteGroup};
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::selectList("voteGroup",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("graphWidth",20,3,$data{graphWidth}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("question",50,255,$data{question}));
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on'));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::checkbox("active",1,$data{active}));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::groupList("voteGroup",$data{voteGroup}));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("graphWidth",20,3,$data{graphWidth}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
WebGUI::Form::text("question",50,255,$data{question}));
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',
WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on'));
$output .= formSave();
$output .= tableFormRow("",'<a href="'.$session{page}{url}.'?func=resetVotes&wid='.$session{form}{wid}.'">'.WebGUI::International::get(10,$namespace).'</a>');
$output .= '</table></form>';

View file

@ -29,8 +29,11 @@ sub duplicate {
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::SQL->write("insert into SQLReport values($newWidgetId, ".quote($data{template}).", ".quote($data{dbQuery}).", ".quote($data{DSN}).", ".quote($data{username}).", ".quote($data{identifier}).", '$data{convertCarriageReturns}')");
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},
$data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into SQLReport values($newWidgetId, ".quote($data{template}).", ".
quote($data{dbQuery}).", ".quote($data{DSN}).", ".quote($data{username}).", ".
quote($data{identifier}).", '$data{convertCarriageReturns}', '$data{paginateAfter}')");
}
#-------------------------------------------------------------------
@ -54,18 +57,31 @@ sub www_add {
$output .= WebGUI::Form::hidden("widget",$namespace);
$output .= WebGUI::Form::hidden("func","addSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'SQL Report'));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,1));
$output .= tableFormRow(WebGUI::International::get(99),
WebGUI::Form::text("title",20,128,widgetName()));
$output .= tableFormRow(WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle",1,1));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros",1,1));
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'','','',1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::textArea("template",'','','',1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::textArea("dbQuery",''));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("DSN",20,255,$session{config}{dsn}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("username",20,255,$session{config}{dbuser}));
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::password("identifier",20,255));
$output .= tableFormRow(WebGUI::International::get(183),WebGUI::Form::checkbox("convertCarriageReturns",1));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",'','','',1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::textArea("template",'','','',1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::textArea("dbQuery",''));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("DSN",20,255,$session{config}{dsn}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
WebGUI::Form::text("username",20,255,$session{config}{dbuser}));
$output .= tableFormRow(WebGUI::International::get(7,$namespace),
WebGUI::Form::password("identifier",20,255));
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
WebGUI::Form::text("paginateAfter",20,30,50));
$output .= tableFormRow(WebGUI::International::get(13,$namespace),
WebGUI::Form::checkbox("convertCarriageReturns",1));
$output .= formSave();
$output .= '</table></form>';
return $output;
@ -79,8 +95,15 @@ sub www_add {
sub www_addSave {
my ($widgetId);
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});
WebGUI::SQL->write("insert into SQLReport values($widgetId, ".quote($session{form}{template}).", ".quote($session{form}{dbQuery}).", ".quote($session{form}{DSN}).", ".quote($session{form}{username}).", ".quote($session{form}{identifier}).", '$session{form}{convertCarriageReturns}')");
$widgetId = create($session{page}{pageId},$session{form}{widget},
$session{form}{title},$session{form}{displayTitle},
$session{form}{description},$session{form}{processMacros},
$session{form}{templatePosition});
WebGUI::SQL->write("insert into SQLReport values($widgetId, ".
quote($session{form}{template}).", ".quote($session{form}{dbQuery}).", ".
quote($session{form}{DSN}).", ".quote($session{form}{username}).", ".
quote($session{form}{identifier}).
", '$session{form}{convertCarriageReturns}', '$session{form}{paginateAfter}')");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -110,19 +133,32 @@ sub www_edit {
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
$output .= tableFormRow(WebGUI::International::get(99),
WebGUI::Form::text("title",20,128,$data{title}));
$output .= tableFormRow(WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
%hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,10,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::textArea("template",$data{template},50,10,1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10,1));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("DSN",20,255,$data{DSN}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("username",20,255,$data{username}));
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::password("identifier",20,255,$data{identifier}));
$output .= tableFormRow(WebGUI::International::get(183),WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},50,10,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::textArea("template",$data{template},50,10,1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("DSN",20,255,$data{DSN}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
WebGUI::Form::text("username",20,255,$data{username}));
$output .= tableFormRow(WebGUI::International::get(7,$namespace),
WebGUI::Form::password("identifier",20,255,$data{identifier}));
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter}));
$output .= tableFormRow(WebGUI::International::get(13,$namespace),
WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}));
$output .= formSave();
$output .= '</table></form>';
return $output;
@ -136,7 +172,12 @@ sub www_editSave {
my ($widgetId, $displayTitle, $image, $attachment);
if (WebGUI::Privilege::canEditPage()) {
update();
WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).", dbQuery=".quote($session{form}{dbQuery}).", convertCarriageReturns='$session{form}{convertCarriageReturns}', DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier})." where widgetId=$session{form}{wid}");
WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).
", dbQuery=".quote($session{form}{dbQuery}).
", convertCarriageReturns='$session{form}{convertCarriageReturns}', DSN=".
quote($session{form}{DSN}).", username=".quote($session{form}{username}).
", identifier=".quote($session{form}{identifier}).
", paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -145,7 +186,8 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
my ($ouch, %data, $output, $sth, $dbh, @result, @template, $temp);
my (@row, $i, $dataRows, $prevNextBar, $ouch, %data, $output, $sth, $dbh, @result,
@template, $temp, $col);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
@ -155,8 +197,6 @@ sub www_view {
if ($data{description} ne "") {
$output .= $data{description}.'<p>';
}
@template = split(/\^\-\;/,$data{template});
$output .= $template[0];
if ($data{DSN} =~ /\DBI\:\w+\:\w+/) {
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
} else {
@ -171,15 +211,39 @@ sub www_view {
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The SQL query is improperly formatted.");
}
if ($sth->rows > 0) {
if ($data{template} ne "") {
@template = split(/\^\-\;/,$data{template});
} else {
$i = 0;
$template[0] = '<table width="100%"><tr>';
$template[1] = '<tr>';
foreach $col ($sth->getColumnNames) {
$template[0] .= '<td class="tableHeader">'.$col.'</td>';
$template[1] .= '<td class="tableData">^'.$i.';</td>';
$i++;
}
$template[0] .= '</tr>';
$template[1] .= '</tr>';
$template[2] = '</table>';
$i = 0;
}
$output .= $template[0];
while (@result = $sth->array) {
$temp = $template[1];
$temp =~ s/\^(\d)\;/$result[$1]/g;
$temp =~ s/\^(\d*)\;/$result[$1]/g;
if ($data{convertCarriageReturns}) {
$temp =~ s/\n/\<br\>/g;
}
$output .= $temp;
$row[$i] = $temp;
$i++;
}
$sth->finish;
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row);
$output .= $dataRows;
$output .= $template[2];
if ($#row > $data{paginateAfter}) {
$output .= $prevNextBar;
}
} else {
$output .= WebGUI::International::get(11,$namespace).'<p>';
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] There was a problem with the query.");
@ -189,7 +253,6 @@ sub www_view {
$output .= WebGUI::International::get(12,$namespace).'<p>';
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] Could not connect to remote database.");
}
$output .= $template[2];
}
if ($data{processMacros} == 1) {
$output = WebGUI::Macro::process($output);

View file

@ -40,7 +40,8 @@ sub _traversePageTree {
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber");
while (@data = $sth->array) {
if (WebGUI::Privilege::canViewPage($data[2])) {
$output .= $depth.$_[4].' <a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[0].'">'.$data[1].'</a>';
$output .= $depth.$_[4].' <a href="'.$session{config}{scripturl}.
'/'.$data[0].'">'.$data[1].'</a>';
$output .= $lineSpacing;
$output .= _traversePageTree($data[2],$_[1]+1,$_[2],$_[3],$_[4],$_[5]);
}

View file

@ -38,6 +38,7 @@ sub duplicate {
$sth = WebGUI::SQL->read("select * from UserSubmission_submission where widgetId=$_[0]");
while (@row = $sth->array) {
$newSubmissionId = getNextId("submissionId");
WebGUI::Attachment::copy($row[8],$_[0],$newWidgetId,$row[1],$newSubmissionId);
WebGUI::SQL->write("insert into UserSubmission_submission values ($newWidgetId, $newSubmissionId, ".quote($row[2]).", $row[3], ".quote($row[4]).", '$row[5]', ".quote($row[6]).", ".quote($row[7]).", ".quote($row[8]).", '$row[9]', '$row[10]')");
}
$sth->finish;
@ -71,11 +72,10 @@ sub www_add {
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$array[0] = 4;
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::selectList("groupToApprove",\%hash,\@array));
$array[0] = 2;
$output .= tableFormRow(WebGUI::International::get(2,$namespace),WebGUI::Form::selectList("groupToContribute",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(1,$namespace),
WebGUI::Form::groupList("groupToApprove",4));
$output .= tableFormRow(WebGUI::International::get(2,$namespace),
WebGUI::Form::groupList("groupToContribute",2));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("submissionsPerPage",20,2,50));
%hash = ("Approved"=>WebGUI::International::get(7,$namespace),"Denied"=>WebGUI::International::get(8,$namespace),"Pending"=>WebGUI::International::get(9,$namespace));
$output .= tableFormRow(WebGUI::International::get(10,$namespace),WebGUI::Form::selectList("defaultStatus",\%hash,'',1));
@ -265,11 +265,10 @@ sub www_edit {
$array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description}));
$array[0] = $data{groupToApprove};
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::selectList("groupToApprove",\%hash,\@array,1));
$array[0] = $data{groupToContribute};
$output .= tableFormRow(WebGUI::International::get(2,$namespace),WebGUI::Form::selectList("groupToContribute",\%hash,\@array,1));
$output .= tableFormRow(WebGUI::International::get(1,$namespace),
WebGUI::Form::groupList("groupToApprove",$data{groupToApprove}));
$output .= tableFormRow(WebGUI::International::get(2,$namespace),
WebGUI::Form::groupList("groupToContribute",$data{groupToContribute}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("submissionsPerPage",20,2,$data{submissionsPerPage}));
%hash = ("Approved"=>WebGUI::International::get(7,$namespace),"Denied"=>WebGUI::International::get(8,$namespace),"Pending"=>WebGUI::International::get(9,$namespace));
$array[0] = $data{defaultStatus};
@ -404,7 +403,7 @@ sub www_viewSubmission {
#---menu
$output .= '<a href="'.$session{page}{url}.'">'.WebGUI::International::get(28,$namespace).'</a><br>';
if ($submission{userId} == $session{user}{userId}) {
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(186).'</a><br>';
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(37,$namespace).'</a><br>';
$output .= '<a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(27,$namespace).'</a><br>';
}
if ($submission{status} eq "Pending" && (WebGUI::Privilege::isInGroup(3,$session{user}{userId}) || WebGUI::Privilege::isInGroup(4,$session{user}{userId}))) {
@ -422,7 +421,7 @@ sub www_viewSubmission {
}
$output .= $submission{content}.'<p>';
if ($submission{attachment} ne "") {
$output .= '<p><a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$session{form}{wid}.'/'.$session{form}{sid}.'/'.$submission{attachment}.'"><img src="'.$session{setting}{lib}.'/attachment.gif" border=0 alt="Download Attachment"></a><p>';
$output .= attachmentBox($submission{attachment},$session{form}{wid},$session{form}{sid});
}
$output .= '</td></tr></table>';
return $output;