WebGUI 1.0.0 release
This commit is contained in:
parent
597b9ff2b0
commit
655ba6d283
40 changed files with 606 additions and 267 deletions
|
|
@ -1,5 +1,4 @@
|
|||
package WebGUI::Config;
|
||||
# This package was originally Data::Config
|
||||
package Data::Config;
|
||||
|
||||
use strict;
|
||||
use Carp;
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
package WebGUI;
|
||||
our $VERSION = "1.0.0";
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -52,7 +53,8 @@ sub _displayAdminBar {
|
|||
$session{page}{url}.'?op=listStyles'=>'Manage Styles',
|
||||
$session{page}{url}.'?op=listUsers'=>'Manage Users',
|
||||
$session{env}{SCRIPT_NAME}.'/clipboard'=>'View Clipboard',
|
||||
$session{env}{SCRIPT_NAME}.'/trash'=>'View Trash'
|
||||
$session{env}{SCRIPT_NAME}.'/trash'=>'View Trash',
|
||||
$session{page}{url}.'?op=purgeTrash'=>'Empty Trash'
|
||||
);
|
||||
}
|
||||
%hash = ( $session{page}{url}=>'Admin...',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ErrorHandler;
|
||||
package WebGUI::ErrorHandler;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -15,25 +15,65 @@ use WebGUI::Session;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub fatalError {
|
||||
my ($key, $logfile);
|
||||
print Session::httpHeader();
|
||||
$logfile = FileHandle->new(">".$session{config}{logfile}) or die "Can't open log file.";
|
||||
print $logfile localtime(time);
|
||||
print "<h1>WebGUI Fatal Error</h1>Something unexpected happened that caused this system to fault. Please send this message to ";#.$session{setting}{adminEmail}."<p>";
|
||||
my ($key, $log, $cgi, $logfile, $config);
|
||||
if (exists $session{cgi}) {
|
||||
$cgi = $session{cgi};
|
||||
} else {
|
||||
use CGI;
|
||||
$cgi = CGI->new;
|
||||
}
|
||||
print $cgi->header;
|
||||
if (exists $session{config}{logfile}) {
|
||||
$logfile = $session{config}{logfile};
|
||||
} else {
|
||||
use Data::Config;
|
||||
$config = new Data::Config '../etc/WebGUI.conf';
|
||||
$logfile = $config->param('logfile');
|
||||
}
|
||||
$log = FileHandle->new(">>$logfile") or die "Can't open log file.";
|
||||
print "<h1>WebGUI Fatal Error</h1>Something unexpected happened that caused this system to fault.<p>";
|
||||
print $0." at ".localtime(time)." reported:<br>";
|
||||
print $log localtime(time)." ".$0." ".$_[0]."\n";
|
||||
print $_[0];
|
||||
print "<p><h3>Caller</h3><table border=1><tr><td valign=top>";
|
||||
print "<b>Level 1</b><br>".join("<br>",caller(1));
|
||||
print $log "\t".join(",",caller(1))."\n";
|
||||
print "</td><td valign=top>"."<b>Level 2</b><br>".join("<br>",caller(2));
|
||||
print $log "\t".join(",",caller(2))."\n";
|
||||
print "</td><td valign=top>"."<b>Level 3</b><br>".join("<br>",caller(3));
|
||||
print "</td><td valign=top>"."<b>Level 4</b><br>".join("<br>",caller(4));
|
||||
print "</td></tr></table><p><h3>Form Variables</h3>";
|
||||
#foreach $key (keys %{$session(form}}) {
|
||||
# print $key." = ".$session{form}{$key}."<br>";
|
||||
#}
|
||||
$logfile->close();
|
||||
print $log "\t".join(",",caller(3))."\n";
|
||||
print "</td></tr></table>";
|
||||
print "<h3>Form Variables</h3>";
|
||||
print $log "\t";
|
||||
if (exists $session{form}) {
|
||||
foreach $key (keys %{$session{form}}) {
|
||||
print $key." = ".$session{form}{$key}."<br>";
|
||||
print $log $key."=".$session{form}{$key}." ";
|
||||
}
|
||||
print $log "\n";
|
||||
} else {
|
||||
print "Cannot retrieve session information.";
|
||||
print $log "Session not accessible for form variable dump.\n";
|
||||
}
|
||||
print $log "\n";
|
||||
$log->close;
|
||||
exit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub warn {
|
||||
my ($log, $logfile, $config);
|
||||
if (exists $session{config}{logfile}) {
|
||||
$logfile = $session{config}{logfile};
|
||||
} else {
|
||||
use Data::Config;
|
||||
$config = new Data::Config '../etc/WebGUI.conf';
|
||||
$logfile = $config->param('logfile');
|
||||
}
|
||||
$log = FileHandle->new(">>".$logfile) or fatalError("Can't open log file for warning.");
|
||||
print $log localtime(time)." ".$0." WARNING: ".$_[0]."\n";
|
||||
$log->close;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use WebGUI::Operation::Page;
|
|||
use WebGUI::Operation::Settings;
|
||||
use WebGUI::Operation::Style;
|
||||
use WebGUI::Operation::Submission;
|
||||
use WebGUI::Operation::Trash;
|
||||
use WebGUI::Operation::User;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,11 @@ sub www_displayAccount {
|
|||
$output .= '</form> ';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if (WebGUI::Privilege::isInGroup(3) || WebGUI::Privilege::isInGroup(4)) {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">Turn admin on.</a>';
|
||||
if ($session{var}{adminOn}) {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOffAdmin">Turn admin off.</a>';
|
||||
} else {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">Turn admin on.</a>';
|
||||
}
|
||||
}
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=logout">Logout.</a><li><a href="'.$session{page}{url}.'?op=deactivateAccount">Please deactivate my account permanently.</a></ul></div>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -115,33 +115,37 @@ sub www_editGroupSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listGroups {
|
||||
my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage);
|
||||
my ($output, $pn, $sth, @data, @row, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from groups where groupName<>'Reserved'",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=10"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Groups</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addGroup">Add a new group.</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td valign="top">'.$data[1].'</td>';
|
||||
$output .= '<td valign="top">'.$data[2].'</td></tr>';
|
||||
$row[$i] = '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[1].'</td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[2].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$output .= $row[$i];
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listGroups">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listGroups">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ sub www_editSettings {
|
|||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<hr size=1>Build Version: '.$session{wg}{version}.'<br>Release Date: '.$session{wg}{date};
|
||||
$output .= '<hr size=1>Build Version: '.$WebGUI::VERSION;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,32 +112,36 @@ sub www_editStyleSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listStyles {
|
||||
my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage);
|
||||
my ($output, $pn, $sth, @data, @row, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from style where name<>'Reserved'",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=9"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Styles</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addStyle">Add a new style.</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td valign="top">'.$data[1].'</td>';
|
||||
$row[$i] = '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[1].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$output .= $row[$i];
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listStyles">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listStyles">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
|
|
|
|||
71
lib/WebGUI/Operation/Trash.pm
Normal file
71
lib/WebGUI/Operation/Trash.pm
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package WebGUI::Operation::Trash;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 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 Exporter;
|
||||
use strict qw(vars subs);
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _purgeWidgets {
|
||||
my ($b, $widgetId, $widgetType, $func);
|
||||
$b = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=$_[0]",$session{dbh});
|
||||
while (($widgetId,$widgetType) = $b->array) {
|
||||
$func = "WebGUI::Widget::".$widgetType."::purge";
|
||||
&$func($widgetId,$session{dbh});
|
||||
}
|
||||
$b->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _recursePageTree {
|
||||
my ($a, $pageId);
|
||||
$a = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh});
|
||||
while (($pageId) = $a->array) {
|
||||
_recursePageTree($pageId);
|
||||
_purgeWidgets($pageId);
|
||||
WebGUI::SQL->write("delete from page where pageId=$pageId",$session{dbh});
|
||||
}
|
||||
$a->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_purgeTrash {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you wish to purge all the pages and widgets in the trash?<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=purgeTrashConfirm">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_purgeTrashConfirm {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_recursePageTree(3);
|
||||
_purgeWidgets(3);
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -138,38 +138,42 @@ sub www_editUserSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listUsers {
|
||||
my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage);
|
||||
my ($output, $sth, @data, @row, $pn, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from user where username<>'Reserved'",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=8"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Users</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addUser">Add a new user.</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from user where username<>'Reserved' order by username limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from user where username<>'Reserved' order by username",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
#$output .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
$output .= '<td>'.$data[1].'</td>';
|
||||
$output .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
|
||||
$row[$i] = '<tr><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
#$row[$i] .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
$row[$i] .= '<td>'.$data[1].'</td>';
|
||||
$row[$i] .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listUsers&pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listUsers&pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$output .= $row[$i];
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listUsers">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listUsers">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ sub isInGroup {
|
|||
}
|
||||
($result) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId='$gid' && userId='$uid'",$session{dbh});
|
||||
if ($result < 1 && $gid == 1) { # registered users can
|
||||
isInGroup(2, $uid); # do anything visitors
|
||||
$result = isInGroup(2, $uid); # do anything visitors
|
||||
} # can do
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use CGI::Carp qw(fatalsToBrowser);
|
|||
use DBI;
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::ErrorHandler;
|
||||
|
||||
# Note: This class is really not necessary, I just decided to wrapper DBI in case
|
||||
# I wanted to change to some other DB connector in the future. Also, it shorthands
|
||||
|
|
@ -21,7 +22,7 @@ use Tie::IxHash;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub array {
|
||||
return $_[0]->{_sth}->fetchrow_array() or croak DBI->errstr;
|
||||
return $_[0]->{_sth}->fetchrow_array() or WebGUI::ErrorHandler::fatalError(DBI->errstr);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -56,7 +57,7 @@ sub finish {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub hash {
|
||||
return $_[0]->{_sth}->fetchrow_hashref() or croak DBI->errstr;
|
||||
return $_[0]->{_sth}->fetchrow_hashref() or WebGUI::ErrorHandler::fatalError(DBI->errstr);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -65,8 +66,8 @@ sub new {
|
|||
$class = shift;
|
||||
$sql = shift;
|
||||
$dbh = shift;
|
||||
$sth = $dbh->prepare($sql) or croak "Couldn't prepare statement: ".$sql." : ". DBI->errstr;
|
||||
$sth->execute or croak "Couldn't execute statement: ".$sql." : ". DBI->errstr;
|
||||
$sth = $dbh->prepare($sql) or WebGUI::ErrorHandler::fatalError("Couldn't prepare statement: ".$sql." : ". DBI->errstr);
|
||||
$sth->execute or WebGUI::ErrorHandler::fatalError("Couldn't execute statement: ".$sql." : ". DBI->errstr);
|
||||
bless ({_sth => $sth}, $class);
|
||||
}
|
||||
|
||||
|
|
@ -97,9 +98,9 @@ sub read {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub write {
|
||||
$_[2]->do($_[1]) or croak "Couldn't prepare statement: ".$_[1]." : ". DBI->errstr;
|
||||
$_[2]->do($_[1]) or WebGUI::ErrorHandler::fatalError("Couldn't prepare statement: ".$_[1]." : ". DBI->errstr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use CGI;
|
|||
use DBI;
|
||||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::Config;
|
||||
use Data::Config;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
|
|
@ -93,9 +93,8 @@ sub httpRedirect {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub open {
|
||||
my ($key, %WebGUI, %CONFIG, %VARS, %PAGE, %FORM, $query, %COOKIES, $config, %USER, %SETTINGS, $dbh);
|
||||
%WebGUI = (version=>"0.12.0", date=>"2001-08-26");
|
||||
$config = new WebGUI::Config '../etc/WebGUI.conf';
|
||||
my ($key, %CONFIG, %VARS, %PAGE, %FORM, $query, %COOKIES, $config, %USER, %SETTINGS, $dbh);
|
||||
$config = new Data::Config '../etc/WebGUI.conf';
|
||||
foreach ($config->param) {
|
||||
$CONFIG{$_} = $config->param($_);
|
||||
}
|
||||
|
|
@ -124,7 +123,6 @@ sub open {
|
|||
page => \%PAGE, # variables related to the current page
|
||||
header => {}, # settings to be passed back through the http header
|
||||
dbh => $dbh, # interface to the default WebGUI database
|
||||
wg => \%WebGUI # WebGUI internal settings
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_jumpDown &www_jumpUp &update &www_moveUp &www_moveDown &www_delete &www_deleteConfirm &www_cut &create &www_paste);
|
||||
our @EXPORT = qw(&purgeWidget &www_jumpDown &www_jumpUp &update &www_moveUp &www_moveDown &www_delete &www_deleteConfirm &www_cut &create &www_paste);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _reorderWidgets {
|
||||
|
|
@ -46,6 +46,11 @@ sub update {
|
|||
WebGUI::SQL->write("update widget set title=".quote($session{form}{title}).", displayTitle='$session{form}{displayTitle}', description=".quote($session{form}{description}).", processMacros='$session{form}{processMacros}', lastEdited=now(), editedBy='$session{user}{userId}' where widgetId=$session{form}{wid}",$session{dbh});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purgeWidget {
|
||||
WebGUI::SQL->write("delete from widget where widgetId=$_[0]",$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_cut {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from Article where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Article";
|
||||
|
|
@ -41,6 +47,7 @@ sub www_add {
|
|||
$output .= '<tr><td class="formDescription">Link Title</td><td>'.WebGUI::Form::text("linkTitle",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Link URL</td><td>'.WebGUI::Form::text("linkURL",20,2048).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1).' <span style="font-size: 8pt;">(check if you\'re not adding <br> manually)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -57,7 +64,7 @@ sub www_addSave {
|
|||
$widgetId = create();
|
||||
$image = saveAttachment("image",$widgetId);
|
||||
$attachment = saveAttachment("attachment",$widgetId);
|
||||
WebGUI::SQL->write("insert into Article set widgetId=$widgetId, startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."', body=".quote($session{form}{body}).", image=".quote($image).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).", attachment=".quote($attachment),$session{dbh});
|
||||
WebGUI::SQL->write("insert into Article set widgetId=$widgetId, startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".quote($session{form}{body}).", image=".quote($image).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).", attachment=".quote($attachment),$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -88,7 +95,7 @@ sub www_deleteImage {
|
|||
sub www_edit {
|
||||
my ($output, %article);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%article = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, date_format(Article.startDate,'%m/%d/%Y') as start, date_format(Article.endDate,'%m/%d/%Y') as end, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment, widget.processMacros from widget left join Article on (widget.widgetId=Article.widgetId) where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
%article = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, date_format(Article.startDate,'%m/%d/%Y') as start, date_format(Article.endDate,'%m/%d/%Y') as end, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment, widget.processMacros, Article.convertCarriageReturns from widget left join Article on (widget.widgetId=Article.widgetId) where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=24"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Article</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
|
|
@ -111,6 +118,7 @@ sub www_edit {
|
|||
} else {
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$article{convertCarriageReturns}).' <span style="font-size: 8pt;">(check if you\'re not adding <br> manually)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -132,7 +140,7 @@ sub www_editSave {
|
|||
if ($attachment ne "") {
|
||||
$attachment = ', attachment='.quote($attachment);
|
||||
}
|
||||
WebGUI::SQL->write("update Article set startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}",$session{dbh});
|
||||
WebGUI::SQL->write("update Article set startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($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}",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -143,14 +151,17 @@ sub www_editSave {
|
|||
sub www_view {
|
||||
my (%data, @test, $output, $widgetId);
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, widget.processMacros, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment from widget,Article where widget.widgetId='$widgetId' and widget.WidgetId=Article.widgetId and Article.startDate<now() and Article.endDate>now()",$session{dbh});
|
||||
%data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, widget.processMacros, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment, Article.convertCarriageReturns from widget,Article where widget.widgetId='$widgetId' and widget.WidgetId=Article.widgetId and Article.startDate<now() and Article.endDate>now()",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{image} ne "") {
|
||||
$output .= '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/'.$widgetId.'/'.$data{image}.'" border="0" align="right">';
|
||||
}
|
||||
if ($data{convertCarriageReturns}) {
|
||||
$data{body} =~ s/\n/\<br\>/g;
|
||||
}
|
||||
$output .= $data{body};
|
||||
if ($data{linkURL} ne "" && $data{linkTitle} ne "") {
|
||||
$output .= '<p><a href="'.$data{linkURL}.'">'.$data{linkTitle}.'</a>';
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from event where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Events Calendar";
|
||||
|
|
@ -193,12 +199,12 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle}) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select name, description, date_format(startDate,'%M'), date_format(startDate,'%e'), date_format(startDate,'%Y'), date_format(endDate,'%e') from event where widgetId='$widgetId' and startDate>now() order by startDate",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select name, description, date_format(startDate,'%M'), date_format(startDate,'%e'), date_format(startDate,'%Y'), date_format(endDate,'%e') from event where widgetId='$widgetId' and to_days(startDate)>(to_days(now())-1) order by startDate",$session{dbh});
|
||||
while (@event = $sth->array) {
|
||||
$output .= "<b>$event[2] $event[3]";
|
||||
if ($event[3] ne $event[5]) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from ExtraColumn where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Extra Column";
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ sub _reorderQuestions {
|
|||
$sth->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from faqQuestion where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "F.A.Q.";
|
||||
|
|
@ -103,7 +109,7 @@ sub www_deleteQuestion {
|
|||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output = 'Are you certain that you want to delete this question?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteQuestionConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid}.'">Yes, I\'m sure.</a> <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">No, I made a mistake.</a></div>';
|
||||
$output = 'Are you certain that you want to delete this question?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteQuestionConfirm&wid='.$session{form}{wid}.'&qid='.$session{form}{qid}.'">Yes, I\'m sure.</a> <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">No, I made a mistake.</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -186,7 +192,7 @@ sub www_editQuestion {
|
|||
sub www_editQuestionSave {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("update faqQuestion set question=".quote($session{form}{question}).", answer=".quote($session{form}{answer})." where questionId=$session{form}{qid}",$session{dbh});
|
||||
return "";
|
||||
return www_edit();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
|
|
@ -231,7 +237,7 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description};
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ sub _reorderLinks {
|
|||
$sth->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from link where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Link List";
|
||||
|
|
@ -234,7 +240,7 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle}) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ sub _traverseReplyTree {
|
|||
return $html;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from message where widgetId=$_[0]",$_[1]);
|
||||
WebGUI::SQL->write("delete from MessageBoard where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Message Board";
|
||||
|
|
@ -310,18 +317,12 @@ sub www_showMessage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my ($sth, @data, $html, %board, $itemsPerPage, $currentPage, $totalItems);
|
||||
my ($sth, @data, $html, %board, $itemsPerPage, $i, @row, $pn);
|
||||
%board = _getBoardProperties($_[0]);
|
||||
$itemsPerPage = $board{messagesPerPage};
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
if ($board{description} ne "") {
|
||||
$html .= $board{description}.'<p>';
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from message where widgetId=$_[0]",$session{dbh});
|
||||
$html .= '<table width="100%"><tr><td class="boardTitle">';
|
||||
if ($board{displayTitle}) {
|
||||
$html .= $board{title};
|
||||
|
|
@ -329,32 +330,34 @@ sub www_view {
|
|||
$html .= '</td><td align="right" valign="bottom" class="boardMenu"><a href="'.$session{page}{url}.'?func=postNewMessage&wid='.$_[0].'">Post New Message</a></td></tr></table>';
|
||||
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||
$html .= '<tr><td class="tableHeader">Subject</td><td class="tableHeader">Author</td><td class="tableHeader">Thread Started</td><td class="tableHeader">Replies</td><td class="tableHeader">Last Reply</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select messageId,substring(subject,1,30),count(messageId)-1,username,date_format(dateOfPost,'%c/%e %l:%i%p'),date_format(max(dateOfPost),'%c/%e %l:%i%p'),max(messageId) from message where widgetId=$_[0] group by rid order by messageId desc limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage, $session{dbh});
|
||||
$sth = WebGUI::SQL->read("select messageId,substring(subject,1,30),count(messageId)-1,username,date_format(dateOfPost,'%c/%e %l:%i%p'),date_format(max(dateOfPost),'%c/%e %l:%i%p'),max(messageId) from message where widgetId=$_[0] group by rid order by messageId desc", $session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$html .= '<tr><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$_[0].'">'.$data[1].'</a></td><td class="tableData">'.$data[3].'</td><td class="tableData">'.$data[4].'</td><td class="tableData">'.$data[2].'</td><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[6].'&wid='.$_[0].'">'.$data[5].'</a></td></tr>';
|
||||
}
|
||||
$html .= "</table>";
|
||||
$sth->finish;
|
||||
$html .= '<div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
} else {
|
||||
$html .= '«Previous Page';
|
||||
}
|
||||
$html .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
} else {
|
||||
$html .= 'Next Page»';
|
||||
}
|
||||
$html .= '</div>';
|
||||
$row[$i] = '<tr><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$_[0].'">'.$data[1].'</a></td><td class="tableData">'.$data[3].'</td><td class="tableData">'.$data[4].'</td><td class="tableData">'.$data[2].'</td><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[6].'&wid='.$_[0].'">'.$data[5].'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$html .= $row[$i];
|
||||
}
|
||||
$html .= '</table>';
|
||||
$html .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'">«Previous Page</a>';
|
||||
} else {
|
||||
$html .= '«Previous Page';
|
||||
}
|
||||
$html .= ' · ';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'">Next Page»</a>';
|
||||
} else {
|
||||
$html .= 'Next Page»';
|
||||
}
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ sub _viewPoll {
|
|||
%poll = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %poll) {
|
||||
if ($poll{displayTitle} == 1) {
|
||||
$output = "<h2>".$poll{title}."</h2>";
|
||||
$output = "<h1>".$poll{title}."</h1>";
|
||||
}
|
||||
if ($poll{description} ne "") {
|
||||
$output .= $poll{description}.'<p>';
|
||||
|
|
@ -52,7 +52,7 @@ sub _viewResults {
|
|||
%poll = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %poll) {
|
||||
if ($poll{displayTitle} == 1) {
|
||||
$output = "<h2>".$poll{title}."</h2>";
|
||||
$output = "<h1>".$poll{title}."</h1>";
|
||||
}
|
||||
if ($poll{description} ne "") {
|
||||
$output .= $poll{description}.'<p>';
|
||||
|
|
@ -73,6 +73,13 @@ sub _viewResults {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from pollAnswer where widgetId=$_[0]",$_[1]);
|
||||
WebGUI::SQL->write("delete from Poll where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Poll";
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::SQLReport;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -18,6 +19,12 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from SQLReport where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "SQL Report";
|
||||
|
|
@ -108,7 +115,7 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$widgetId and widget.widgetId=SQLReport.widgetId",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
|
|
@ -119,9 +126,15 @@ sub www_view {
|
|||
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
|
||||
} else {
|
||||
$output .= '<b>Error</b>: The DSN specified is of an improper format.<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] The DSN specified is of an improper format.");
|
||||
}
|
||||
if (defined $dbh) {
|
||||
$sth = WebGUI::SQL->read($data{dbQuery},$dbh);
|
||||
if ($data{dbQuery} =~ /select/i) {
|
||||
$sth = WebGUI::SQL->read($data{dbQuery},$dbh);
|
||||
} else {
|
||||
$output .= '<b>Error</b>: The SQL query is improperly formatted.<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] The SQL query is improperly formatted.");
|
||||
}
|
||||
if (defined $sth) {
|
||||
while (@result = $sth->array) {
|
||||
$temp = $template[1];
|
||||
|
|
@ -133,11 +146,13 @@ sub www_view {
|
|||
}
|
||||
$sth->finish;
|
||||
} else {
|
||||
$output .= '<b>Error</b>: There was a problem with the query.';
|
||||
$output .= '<b>Error</b>: There was a problem with the query.<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] There was a problem with the query.");
|
||||
}
|
||||
$dbh->disconnect();
|
||||
} else {
|
||||
$output .= '<b>Error</b>: Could not connect to remote database.';
|
||||
$output .= '<b>Error</b>: Could not connect to remote database.<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] Could not connect to remote database.");
|
||||
}
|
||||
$output .= $template[2];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ sub _mnogoSearch {
|
|||
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
|
||||
} else {
|
||||
$output .= '<b>Error</b>: The DSN specified is of an improper format.<p>';
|
||||
WebGUI::ErrorHandler::warn("Search (MnoGo) The DSN specified is of an improper format.");
|
||||
}
|
||||
if (defined $dbh) {
|
||||
foreach $word (@keyword) {
|
||||
|
|
@ -38,6 +39,7 @@ sub _mnogoSearch {
|
|||
$sth->finish;
|
||||
} else {
|
||||
$output .= '<b>Error</b>: There was a problem with the query.<p>';
|
||||
WebGUI::ErrorHandler::warn("Search (MnoGo) There was a problem with the query.");
|
||||
}
|
||||
}
|
||||
foreach $key (sort {$result{$b} <=> $result{$a}} keys %result) {
|
||||
|
|
@ -50,10 +52,17 @@ sub _mnogoSearch {
|
|||
$dbh->disconnect();
|
||||
} else {
|
||||
$output .= '<b>Error</b>: Could not connect to remote database.<p>';
|
||||
WebGUI::ErrorHandler::warn("Search (MnoGo) Could not connect to remote database.");
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from SearchMnoGo where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Search (MnoGo)";
|
||||
|
|
@ -63,7 +72,7 @@ sub widgetName {
|
|||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Search (MnoGo)</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=42"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Search (MnoGo)</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","SearchMnoGo");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
|
|
@ -99,7 +108,7 @@ sub www_edit {
|
|||
my ($output, %data);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SearchMnoGo where widget.widgetId=SearchMnoGo.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<h1>Edit Search (MnoGo)</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=43"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Search (MnoGo)</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
|
|
@ -135,7 +144,7 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget,SearchMnoGo where widget.widgetId='$widgetId' and widget.WidgetId=SearchMnoGo.widgetId",$session{dbh});
|
||||
if (%data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ sub _traversePageTree {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from SiteMap where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Site Map";
|
||||
|
|
@ -86,7 +92,7 @@ sub www_edit {
|
|||
$output .= '<tr><td class="formDescription">Display title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Starting from this level?</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Show only one level?uuuu</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,$data{showOnlyThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Show only one level?</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,$data{showOnlyThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from SyndicatedContent where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Syndicated Content";
|
||||
|
|
@ -98,7 +104,7 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget,SyndicatedContent where widget.widgetId=$widgetId",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@ use WebGUI::SQL;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from submission where widgetId=$_[0]",$_[1]);
|
||||
WebGUI::SQL->write("delete from UserSubmission where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "User Submission System";
|
||||
|
|
@ -27,7 +34,7 @@ sub www_add {
|
|||
my ($output, %hash);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add User Submission System</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=44"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add User Submission System</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","UserSubmission");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
|
|
@ -73,11 +80,12 @@ sub www_addSubmission {
|
|||
$output .= '<tr><td class="formDescription">Content</td><td>'.WebGUI::Form::textArea("content",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Image</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,1).' <span style="font-size: 8pt;">(uncheck if you\'re writing an HTML submission)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
|
||||
$output .= '<tr><td class="tableHeader">Edit/Delete</td><td class="tableHeader">Title</td><td class="tableHeader">Date Submitted</td><td class="tableHeader">Status</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,date_format(dateSubmitted,'%c/%e %l:%i%p'),status from submission where widgetId='$session{form}{wid}' and userId=$session{user}{userId} order by dateSubmitted desc",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,date_format(dateSubmitted,'%c/%e/%Y'),status from submission where widgetId='$session{form}{wid}' and userId=$session{user}{userId} order by dateSubmitted desc",$session{dbh});
|
||||
while (@submission = $sth->array) {
|
||||
$output .= '<tr><td class="tableData"><a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$submission[1].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?wid='.$session{form}{wid}.'&sid='.$submission[1].'&func=deleteSubmission"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a></td><td class="tableData"><a href="'.$session{page}{url}.'?wid='.$session{form}{wid}.'&func=viewSubmission&sid='.$submission[1].'">'.$submission[0].'</a></td><td class="tableData">'.$submission[2].'</td><td class="tableData">'.$submission[3].'</td></tr>';
|
||||
}
|
||||
|
|
@ -91,13 +99,18 @@ sub www_addSubmission {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addSubmissionSave {
|
||||
my ($submissionId, $image, $attachment, $status, $groupToContribute);
|
||||
my ($title, $submissionId, $image, $attachment, $status, $groupToContribute);
|
||||
($status, $groupToContribute) = WebGUI::SQL->quickArray("select defaultStatus,groupToContribute from UserSubmission where widgetId=$session{form}{wid}",$session{dbh});
|
||||
if (WebGUI::Privilege::isInGroup($groupToContribute,$session{user}{userId})) {
|
||||
$submissionId = getNextId("submissionId");
|
||||
$image = saveAttachment("image",$session{form}{wid},$submissionId);
|
||||
$attachment = saveAttachment("attachment",$session{form}{wid},$submissionId);
|
||||
WebGUI::SQL->write("insert into submission set widgetId=$session{form}{wid}, submissionId=$submissionId, title=".quote($session{form}{title}).", username=".quote($session{user}{username}).", status='$status', dateSubmitted=now(), userId='$session{user}{userId}', content=".quote($session{form}{content}).", image=".quote($image).", attachment=".quote($attachment),$session{dbh});
|
||||
if ($session{form}{title} ne "") {
|
||||
$title = $session{form}{title};
|
||||
} else {
|
||||
$title = "Untitled";
|
||||
}
|
||||
WebGUI::SQL->write("insert into submission set widgetId=$session{form}{wid}, submissionId=$submissionId, convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", username=".quote($session{user}{username}).", status='$status', dateSubmitted=now(), userId='$session{user}{userId}', content=".quote($session{form}{content}).", image=".quote($image).", attachment=".quote($attachment),$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -158,7 +171,7 @@ sub www_edit {
|
|||
my ($output, %data, @array, $sth, %hash);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,UserSubmission where widget.widgetId=$session{form}{wid} and widget.widgetId=UserSubmission.widgetId",$session{dbh});
|
||||
$output = '<h1>Edit User Submission System</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=45"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit User Submission System</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
|
|
@ -214,6 +227,7 @@ sub www_editSubmission {
|
|||
} else {
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$submission{convertCarriageReturns}).' <span style="font-size: 8pt;">(uncheck if you\'re writing an HTML submission)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -225,7 +239,7 @@ sub www_editSubmission {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubmissionSave {
|
||||
my ($owner,$status,$image,$attachment);
|
||||
my ($owner,$status,$image,$attachment,$title);
|
||||
($owner) = WebGUI::SQL->quickArray("select userId from submission where submissionId=$session{form}{sid}",$session{dbh});
|
||||
if ($owner == $session{user}{userId}) {
|
||||
($status) = WebGUI::SQL->quickArray("select defaultStatus from UserSubmission where widgetId=$session{form}{wid}",$session{dbh});
|
||||
|
|
@ -237,7 +251,12 @@ sub www_editSubmissionSave {
|
|||
if ($attachment ne "") {
|
||||
$attachment = 'attachment='.quote($attachment).', ';
|
||||
}
|
||||
WebGUI::SQL->write("update submission set title=".quote($session{form}{title}).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$status' where submissionId=$session{form}{sid}",$session{dbh});
|
||||
if ($session{form}{title} ne "") {
|
||||
$title = $session{form}{title};
|
||||
} else {
|
||||
$title = "Untitled";
|
||||
}
|
||||
WebGUI::SQL->write("update submission set convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$status' where submissionId=$session{form}{sid}",$session{dbh});
|
||||
return www_viewSubmission();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -251,12 +270,12 @@ sub www_view {
|
|||
%data = WebGUI::SQL->quickHash("select * from widget,UserSubmission where widget.widgetId=$widgetId and widget.widgetId=UserSubmission.widgetId",$session{dbh});
|
||||
if (%data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,date_format(dateSubmitted,'%c/%e %l:%i%p'),username,userId from submission where widgetId='$widgetId' and status='Approved' order by dateSubmitted desc",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,date_format(dateSubmitted,'%c/%e/%Y'),username,userId from submission where widgetId='$widgetId' and status='Approved' order by dateSubmitted desc",$session{dbh});
|
||||
while (@submission = $sth->array) {
|
||||
$row[$i] = '<tr><td class="tableData"><a href="'.$session{page}{url}.'?wid='.$widgetId.'&func=viewSubmission&sid='.$submission[1].'">'.$submission[0].'</a></td><td class="tableData">'.$submission[2].'</td><td class="tableData">'.$submission[3].'</td></tr>';
|
||||
$i++;
|
||||
|
|
@ -295,7 +314,7 @@ sub www_view {
|
|||
sub www_viewSubmission {
|
||||
my ($output, %submission);
|
||||
%submission = WebGUI::SQL->quickHash("select * from submission where submissionId=$session{form}{sid}",$session{dbh});
|
||||
$output = "<h2>".$submission{title}."</h2>";
|
||||
$output = "<h1>".$submission{title}."</h1>";
|
||||
$output .= '<b>Submitted By:</b> '.$submission{username}.'<br>';
|
||||
$output .= '<b>Date Submitted:</b> '.$submission{dateSubmitted}.'<p>';
|
||||
if ($submission{image} ne "") {
|
||||
|
|
@ -307,7 +326,10 @@ sub www_viewSubmission {
|
|||
$output .= '<a href="'.$session{page}{url}.'?op=viewPendingSubmissions">Leave Pending</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=denySubmission&sid='.$session{form}{sid}.'">Deny</a> ';
|
||||
$output .= '</div>';
|
||||
}
|
||||
}
|
||||
if ($submission{convertCarriageReturns}) {
|
||||
$submission{content} =~ s/\n/\<br\>/g;
|
||||
}
|
||||
$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>';
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ use DBI;
|
|||
use HTTP::Request;
|
||||
use LWP::UserAgent;
|
||||
use strict;
|
||||
use WebGUI::Config;
|
||||
use Data::Config;
|
||||
use WebGUI::SQL;
|
||||
use XML::RSS;
|
||||
|
||||
my $config = new WebGUI::Config '../etc/WebGUI.conf';
|
||||
my $config = new Data::Config '../etc/WebGUI.conf';
|
||||
our $dbh = DBI->connect($config->param('dsn'), $config->param('dbuser'), $config->param('dbpass'));
|
||||
|
||||
deleteExpiredSessions();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue