WebGUI 3.2.0 release

This commit is contained in:
JT Smith 2002-02-11 04:15:00 +00:00
parent 71cd27d3bc
commit cb88a99e52
60 changed files with 1284 additions and 474 deletions

File diff suppressed because one or more lines are too long

View file

@ -7,6 +7,12 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief. save you many hours of grief.
3.2.0
--------------------------------------------------------------------
* You need to get two new Perl modules before you upgrade. Those
are Date::Calc and HTML::CalendarMonthSimple.
3.0.2 3.0.2
-------------------------------------------------------------------- --------------------------------------------------------------------
* 3.0.2 was accidentally released with an internal version number * 3.0.2 was accidentally released with an internal version number

View file

@ -22,6 +22,8 @@ QnD INSTALL INSTRUCTIONS:
Digest::MD5 Digest::MD5
Net::LDAP Net::LDAP
Tie::CPHash Tie::CPHash
Date::Calc
HTML::CalendarMonthSimple
3. Install Apache (with or without mod_perl) and set up your config. 3. Install Apache (with or without mod_perl) and set up your config.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
package WebGUI; package WebGUI;
our $VERSION = "3.1.0"; our $VERSION = "3.2.0";
#------------------------------------------------------------------- #-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black Software. # WebGUI is Copyright 2001-2002 Plain Black Software.
@ -23,77 +23,81 @@ use WebGUI::SQL;
use WebGUI::Style; use WebGUI::Style;
use WebGUI::Template; use WebGUI::Template;
use WebGUI::Template::Default; use WebGUI::Template::Default;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _displayAdminBar { sub _displayAdminBar {
my ($widgetName, $key, %hash2, $miscSelect, $adminSelect, $clipboardSelect, $widget, @widgetArray, %hash, $output, $contentSelect); my ($widgetName, $key, %hash2, $miscSelect, $adminSelect, $clipboardSelect,
$widget, @widgetArray, %hash, $output, $contentSelect);
tie %hash, "Tie::IxHash"; tie %hash, "Tie::IxHash";
tie %hash2, "Tie::IxHash"; tie %hash2, "Tie::IxHash";
#--content adder #--content adder
@widgetArray = @_; @widgetArray = @_;
$hash{$session{page}{url}} = WebGUI::International::get(1); $hash{WebGUI::URL::page()} = WebGUI::International::get(1);
$hash{$session{page}{url}.'?op=addPage'} = WebGUI::International::get(2); $hash{WebGUI::URL::page('op=addPage')} = WebGUI::International::get(2);
$hash{$session{page}{url}.'?op=selectPackageToDeploy'} = WebGUI::International::get(376); $hash{WebGUI::URL::page('op=selectPackageToDeploy')} = WebGUI::International::get(376);
foreach $widget (@widgetArray) { foreach $widget (@widgetArray) {
$widgetName = "WebGUI::Widget::".$widget."::widgetName"; $widgetName = "WebGUI::Widget::".$widget."::widgetName";
$hash2{$session{page}{url}.'?func=add&widget='.$widget} = &$widgetName; $hash2{WebGUI::URL::page('func=add&widget='.$widget)} = &$widgetName;
} }
%hash2 = sortHash(%hash2); %hash2 = sortHash(%hash2);
%hash = (%hash, %hash2); %hash = (%hash, %hash2);
$contentSelect = WebGUI::Form::selectList("contentSelect",\%hash,"","","","goContent()"); $contentSelect = WebGUI::Form::selectList("contentSelect",\%hash,"","","","goContent()");
#--clipboard paster #--clipboard paster
%hash2 = (); %hash2 = ();
$hash2{$session{page}{url}} = WebGUI::International::get(3); $hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
%hash = WebGUI::SQL->buildHash("select pageId,title from page where parentId=2 order by title"); %hash = WebGUI::SQL->buildHash("select pageId,title from page where parentId=2 order by title");
foreach $key (keys %hash) { foreach $key (keys %hash) {
$hash2{$session{page}{url}.'?op=pastePage&pageId='.$key} = $hash{$key}; $hash2{WebGUI::URL::page('op=pastePage&pageId='.$key)} = $hash{$key};
} }
%hash = WebGUI::SQL->buildHash("select widgetId,title from widget where pageId=2 order by title"); %hash = WebGUI::SQL->buildHash("select widgetId,title from widget where pageId=2 order by title");
foreach $key (keys %hash) { foreach $key (keys %hash) {
$hash2{$session{page}{url}.'?func=paste&wid='.$key} = $hash{$key}; $hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key};
} }
$clipboardSelect = WebGUI::Form::selectList("clipboardSelect",\%hash2,"","","","goClipboard()"); $clipboardSelect = WebGUI::Form::selectList("clipboardSelect",\%hash2,"","","","goClipboard()");
#--admin functions #--admin functions
%hash = (); %hash = ();
if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) { if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) {
%hash = ( %hash = (
$session{page}{url}.'?op=listGroups'=>WebGUI::International::get(5), WebGUI::URL::page('op=listGroups')=>WebGUI::International::get(5),
$session{page}{url}.'?op=manageSettings'=>WebGUI::International::get(4), WebGUI::URL::page('op=manageSettings')=>WebGUI::International::get(4),
$session{page}{url}.'?op=listUsers'=>WebGUI::International::get(7), WebGUI::URL::page('op=listUsers')=>WebGUI::International::get(7),
$session{config}{scripturl}.'/page_not_found'=>WebGUI::International::get(8), WebGUI::URL::gateway('page_not_found')=>WebGUI::International::get(8),
$session{config}{scripturl}.'/trash'=>WebGUI::International::get(10), WebGUI::URL::gateway('trash')=>WebGUI::International::get(10),
$session{page}{url}.'?op=purgeTrash'=>WebGUI::International::get(11), WebGUI::URL::page('op=purgeTrash')=>WebGUI::International::get(11),
$session{page}{url}.'?op=viewStatistics'=>WebGUI::International::get(144) WebGUI::URL::page('op=viewStatistics')=>WebGUI::International::get(144)
); );
} }
if (WebGUI::Privilege::isInGroup(4,$session{user}{userId})) { if (WebGUI::Privilege::isInGroup(4,$session{user}{userId})) {
%hash = ( %hash = (
$session{page}{url}.'?op=listImages'=>WebGUI::International::get(394), 'http://validator.w3.org/check?uri=http%3A%2F%2F'.$session{env}{SERVER_NAME}.
$session{config}{scripturl}.'/clipboard'=>WebGUI::International::get(9), $session{page}{url}=>WebGUI::International::get(399),
WebGUI::URL::page('op=listImages')=>WebGUI::International::get(394),
WebGUI::URL::gateway('clipboard')=>WebGUI::International::get(9),
%hash %hash
); );
} }
if (WebGUI::Privilege::isInGroup(5,$session{user}{userId})) { if (WebGUI::Privilege::isInGroup(5,$session{user}{userId})) {
%hash = ( %hash = (
$session{page}{url}.'?op=listStyles'=>WebGUI::International::get(6), WebGUI::URL::page('op=listStyles')=>WebGUI::International::get(6),
%hash %hash
); );
} }
if (WebGUI::Privilege::isInGroup(6,$session{user}{userId})) { if (WebGUI::Privilege::isInGroup(6,$session{user}{userId})) {
%hash = ( %hash = (
$session{config}{scripturl}.'/packages'=>WebGUI::International::get(374), WebGUI::URL::gateway('packages')=>WebGUI::International::get(374),
%hash %hash
); );
} }
%hash = ( %hash = (
$session{page}{url}.'?op=viewHelpIndex'=>WebGUI::International::get(13), WebGUI::URL::page('op=viewHelpIndex')=>WebGUI::International::get(13),
%hash %hash
); );
%hash = sortHash(%hash); %hash = sortHash(%hash);
%hash = ( %hash = (
$session{page}{url}.'?'=>WebGUI::International::get(82), WebGUI::URL::page()=>WebGUI::International::get(82),
$session{page}{url}.'?op=switchOffAdmin'=>WebGUI::International::get(12), WebGUI::URL::page('op=switchOffAdmin')=>WebGUI::International::get(12),
%hash %hash
); );
$adminSelect = WebGUI::Form::selectList("adminSelect",\%hash,"","","","goAdmin()"); $adminSelect = WebGUI::Form::selectList("adminSelect",\%hash,"","","","goAdmin()");
@ -175,12 +179,12 @@ sub page {
} else { } else {
if (WebGUI::Privilege::canViewPage()) { if (WebGUI::Privilege::canViewPage()) {
if ($session{var}{adminOn}) { if ($session{var}{adminOn}) {
$pageEdit = '<br><img src="'.$session{setting}{lib}.'/page.gif" border=0 alt="Page Settings:"><a href="'.$session{page}{url}.'?op=editPage"><img src="'.$session{setting}{lib}.'/edit.gif" border=0 alt="Edit Page"></a><a href="'.$session{page}{url}.'?op=cutPage"><img src="'.$session{setting}{lib}.'/cut.gif" border=0 alt="Cut Page"></a><a href="'.$session{page}{url}.'?op=deletePage"><img src="'.$session{setting}{lib}.'/delete.gif" border=0 alt="Delete Page"></a><a href="'.$session{page}{url}.'?op=movePageUp"><img src="'.$session{setting}{lib}.'/pageUp.gif" border=0 alt="Move Page Up"></a><a href="'.$session{page}{url}.'?op=movePageDown"><img src="'.$session{setting}{lib}.'/pageDown.gif" border=0 alt="Move Page Down"></a></span>'."\n\n"; $pageEdit = '<br><img src="'.$session{setting}{lib}.'/page.gif" border=0 alt="Page Settings:"><a href="'.WebGUI::URL::page('op=editPage').'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0 alt="Edit Page"></a><a href="'.WebGUI::URL::page('op=cutPage').'"><img src="'.$session{setting}{lib}.'/cut.gif" border=0 alt="Cut Page"></a><a href="'.WebGUI::URL::page('op=deletePage').'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0 alt="Delete Page"></a><a href="'.WebGUI::URL::page('op=movePageUp').'"><img src="'.$session{setting}{lib}.'/pageUp.gif" border=0 alt="Move Page Up"></a><a href="'.WebGUI::URL::page('op=movePageDown').'"><img src="'.$session{setting}{lib}.'/pageDown.gif" border=0 alt="Move Page Down"></a></span>'."\n\n";
} }
$sth = WebGUI::SQL->read("select widgetId, namespace, templatePosition from widget where pageId=".$session{page}{pageId}." order by sequenceNumber, widgetId"); $sth = WebGUI::SQL->read("select widgetId, namespace, templatePosition from widget where pageId=".$session{page}{pageId}." order by sequenceNumber, widgetId");
while (@widgetList = $sth->array) { while (@widgetList = $sth->array) {
if ($session{var}{adminOn}) { if ($session{var}{adminOn}) {
$contentHash{$widgetList[2]} .= '<hr><a href="'.$session{page}{url}.'?func=edit&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0 alt="Edit"></a><a href="'.$session{page}{url}.'?func=cut&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/cut.gif" border=0 alt="Cut"></a><a href="'.$session{page}{url}.'?func=copy&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/copy.gif" border=0 alt="Copy"></a><a href="'.$session{page}{url}.'?wid='.$widgetList[0].'&func=delete"><img src="'.$session{setting}{lib}.'/delete.gif" border=0 alt="Delete"></a><a href="'.$session{page}{url}.'?func=moveUp&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/upArrow.gif" border=0 alt="Move Up"></a><a href="'.$session{page}{url}.'?func=moveDown&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/downArrow.gif" border=0 alt="Move Down"></a><a href="'.$session{page}{url}.'?func=jumpUp&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/jumpUp.gif" border=0 alt="Move to Top"></a><a href="'.$session{page}{url}.'?func=jumpDown&wid='.$widgetList[0].'"><img src="'.$session{setting}{lib}.'/jumpDown.gif" border=0 alt="Move to Bottom"></a><br>'; $contentHash{$widgetList[2]} .= '<hr><a href="'.WebGUI::URL::page('func=edit&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0 alt="Edit"></a><a href="'.WebGUI::URL::page('func=cut&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/cut.gif" border=0 alt="Cut"></a><a href="'.WebGUI::URL::page('func=copy&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/copy.gif" border=0 alt="Copy"></a><a href="'.WebGUI::URL::page('wid='.$widgetList[0].'&func=delete').'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0 alt="Delete"></a><a href="'.WebGUI::URL::page('func=moveUp&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/upArrow.gif" border=0 alt="Move Up"></a><a href="'.WebGUI::URL::page('func=moveDown&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/downArrow.gif" border=0 alt="Move Down"></a><a href="'.WebGUI::URL::page('func=jumpUp&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/jumpUp.gif" border=0 alt="Move to Top"></a><a href="'.WebGUI::URL::page('func=jumpDown&wid='.$widgetList[0]).'"><img src="'.$session{setting}{lib}.'/jumpDown.gif" border=0 alt="Move to Bottom"></a><br>';
} }
$cmd = "WebGUI::Widget::".$widgetList[1]."::www_view"; $cmd = "WebGUI::Widget::".$widgetList[1]."::www_view";
$contentHash{$widgetList[2]} .= &$cmd($widgetList[0])."<p>\n\n"; $contentHash{$widgetList[2]} .= &$cmd($widgetList[0])."<p>\n\n";

View file

@ -16,6 +16,7 @@ use FileHandle;
use POSIX; use POSIX;
use strict; use strict;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -117,7 +118,7 @@ sub save {
$urlizedFilename =~ s/\./\_/g; $urlizedFilename =~ s/\./\_/g;
$urlizedFilename .= ".txt"; $urlizedFilename .= ".txt";
} }
$urlizedFilename = urlize($urlizedFilename); $urlizedFilename = WebGUI::URL::urlize($urlizedFilename);
$path = $session{setting}{attachmentDirectoryLocal}."/".$_[1]."/"; $path = $session{setting}{attachmentDirectoryLocal}."/".$_[1]."/";
mkdir ($path,0755); mkdir ($path,0755);
if ($_[2] ne "") { if ($_[2] ne "") {

View file

@ -10,13 +10,14 @@ package WebGUI::DateTime;
# http://www.plainblack.com info@plainblack.com # http://www.plainblack.com info@plainblack.com
#------------------------------------------------------------------- #-------------------------------------------------------------------
use Date::Calc;
use Exporter; use Exporter;
use strict; use strict;
use Time::Local; use Time::Local;
use WebGUI::International; use WebGUI::International;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&epochToHuman &epochToSet &humanToEpoch &setToEpoch); our @EXPORT = qw(&addToTime &addToDate &epochToHuman &epochToSet &humanToEpoch &setToEpoch &monthStartEnd);
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _getMonth { sub _getMonth {
@ -51,6 +52,24 @@ sub _getWeekday {
return %weekday; return %weekday;
} }
#-------------------------------------------------------------------
sub addToDate {
my ($year,$month,$day, $hour,$min,$sec, $newDate);
($year,$month,$day, $hour,$min,$sec) = Date::Calc::Time_to_Date($_[0]);
($year,$month,$day) = Date::Calc::Add_Delta_YMD($year,$month,$day, $_[1],$_[2],$_[3]);
$newDate = Date::Calc::Date_to_Time($year,$month,$day, $hour,$min,$sec);
return $newDate;
}
#-------------------------------------------------------------------
sub addToTime {
my ($year,$month,$day, $hour,$min,$sec, $newDate);
($year,$month,$day, $hour,$min,$sec) = Date::Calc::Time_to_Date($_[0]);
($year,$month,$day, $hour,$min,$sec) = Date::Calc::Add_Delta_DHMS($year,$month,$day,$hour,$min,$sec,0,$_[1],$_[2],$_[3]);
$newDate = Date::Calc::Date_to_Time($year,$month,$day, $hour,$min,$sec);
return $newDate;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub epochToHuman { sub epochToHuman {
my ($hour12, $value, $output, @date, %weekday, %month); my ($hour12, $value, $output, @date, %weekday, %month);
@ -150,6 +169,16 @@ sub humanToEpoch {
return $output; return $output;
} }
#-------------------------------------------------------------------
sub monthStartEnd {
my ($year,$month,$day, $hour,$min,$sec, $start, $end);
($year,$month,$day, $hour,$min,$sec) = Date::Calc::Time_to_Date($_[0]);
$start = Date::Calc::Date_to_Time($year,$month,1,0,0,0);
($year,$month,$day, $hour,$min,$sec) = Date::Calc::Time_to_Date(addToDate($_[0],0,1,0));
$end = Date::Calc::Date_to_Time($year,$month,1,0,0,0)-1;
return ($start, $end);
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub setToEpoch { sub setToEpoch {
my @date = localtime(time()); my @date = localtime(time());

View file

@ -15,15 +15,30 @@ use Tie::CPHash;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
#-------------------------------------------------------------------
sub _deleteReplyTree {
my ($sth, %data, $messageId);
$sth = WebGUI::SQL->read("select messageId from discussion where pid=$_[0] order by messageId");
while (%data = $sth->hash) {
_deleteReplyTree($data{messageId});
WebGUI::SQL->write("delete from discussion where messageId=$data{messageId}");
}
$sth->finish;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _duplicateReplyTree { sub _duplicateReplyTree {
my (@row, $sth, %data, $newMessageId); my ($sth, %data, $newMessageId);
$sth = WebGUI::SQL->read("select * from discussion where pid=$_[0] order by messageId"); $sth = WebGUI::SQL->read("select * from discussion where pid=$_[0] order by messageId");
while (%data = $sth->hash) { while (%data = $sth->hash) {
$newMessageId = getNextId("messageId"); $newMessageId = getNextId("messageId");
WebGUI::SQL->write("insert into discussion values ($newMessageId, $_[2], $_[3], $_[1], $data{userId}, ".quote($data{username}).", ".quote($data{subject}).", ".quote($data{message}).", $data{dateOfPost}, $_[4])"); WebGUI::SQL->write("insert into discussion values ($newMessageId, $_[2], $_[3], $_[1], $data{userId}, "
.quote($data{username}).", ".quote($data{subject}).", ".quote($data{message}).
", $data{dateOfPost}, $_[4])");
_duplicateReplyTree($data{messageId},$newMessageId,$_[2],$_[3],$_[4]); _duplicateReplyTree($data{messageId},$newMessageId,$_[2],$_[3],$_[4]);
} }
$sth->finish; $sth->finish;
@ -43,19 +58,45 @@ sub duplicate {
$sth->finish; $sth->finish;
} }
#-------------------------------------------------------------------
sub deleteMessage {
my ($output);
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(401);
$output .= '<p>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('func=deleteMessageConfirm&wid='.
$session{form}{wid}.'&mid='.$session{form}{mid}).'">';
$output .= WebGUI::International::get(44);
$output .= '</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('func=showMessage&wid='.
$session{form}{wid}.'&mid='.$session{form}{mid}).'">';
$output .= WebGUI::International::get(45);
$output .= '</a></div>';
return $output;
}
#-------------------------------------------------------------------
sub deleteMessageConfirm {
_deleteReplyTree($session{form}{mid});
WebGUI::SQL->write("delete from discussion where messageId=$session{form}{mid}");
return "";
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub editMessage { sub editMessage {
my ($html, %message); my ($html, %message);
tie %message, 'Tie::CPHash'; tie %message, 'Tie::CPHash';
%message = getMessage($session{form}{mid}); %message = getMessage($session{form}{mid});
$html = '<h1>'.WebGUI::International::get(228).'</h1>'; $html = '<h1>'.WebGUI::International::get(228).'</h1>';
$html .= '<form action="'.$session{page}{url}.'" method="post"><table>'; $html .= formHeader().'<table>';
$html .= WebGUI::Form::hidden("func","editMessageSave"); $html .= WebGUI::Form::hidden("func","editMessageSave");
$html .= WebGUI::Form::hidden("wid",$session{form}{wid}); $html .= WebGUI::Form::hidden("wid",$session{form}{wid});
$html .= WebGUI::Form::hidden("sid",$session{form}{sid}); $html .= WebGUI::Form::hidden("sid",$session{form}{sid});
$html .= WebGUI::Form::hidden("mid",$session{form}{mid}); $html .= WebGUI::Form::hidden("mid",$session{form}{mid});
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).'</td><td>'.WebGUI::Form::text("subject",30,255,$message{subject}).'</td></tr>'; $html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",$message{message},50,6,1).'</td></tr>'; '</td><td>'.WebGUI::Form::text("subject",30,255,$message{subject}).'</td></tr>';
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).
'</td><td>'.WebGUI::Form::textArea("message",$message{message},50,6,1).'</td></tr>';
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>'; $html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
$html .= '</table></form>'; $html .= '</table></form>';
$html .= showMessage(); $html .= showMessage();
@ -70,7 +111,10 @@ sub editMessageSave {
if ($session{form}{message} eq "") { if ($session{form}{message} eq "") {
$session{form}{subject} .= ' '.WebGUI::International::get(233); $session{form}{subject} .= ' '.WebGUI::International::get(233);
} }
WebGUI::SQL->write("update discussion set subject=".quote($session{form}{subject}).", message=".quote("\n --- (Edited at ".localtime(time)." by $session{user}{username}) --- \n\n".$session{form}{message}).", subId='$session{form}{sid}' where messageId=$session{form}{mid}"); WebGUI::SQL->write("update discussion set subject=".quote($session{form}{subject}).
", message=".quote("\n --- (Edited at ".localtime(time).
" by $session{user}{username}) --- \n\n".$session{form}{message}).
", subId='$session{form}{sid}' where messageId=$session{form}{mid}");
return showMessage(); return showMessage();
} }
@ -78,7 +122,7 @@ sub editMessageSave {
sub getMessage { sub getMessage {
my (%message); my (%message);
tie %message, 'Tie::CPHash'; tie %message, 'Tie::CPHash';
%message = WebGUI::SQL->quickHash("select * from discussion where messageId=$_[0]"); %message = WebGUI::SQL->quickHash("select * from discussion where messageId='$_[0]'");
$message{message} =~ s/\n/\<br\>/g; $message{message} =~ s/\n/\<br\>/g;
return %message; return %message;
} }
@ -87,7 +131,7 @@ sub getMessage {
sub postNewMessage { sub postNewMessage {
my ($html); my ($html);
$html = '<h1>'.WebGUI::International::get(231).'</h1>'; $html = '<h1>'.WebGUI::International::get(231).'</h1>';
$html .= '<form action="'.$session{page}{url}.'" method="post"><table>'; $html .= formHeader().'<table>';
$html .= WebGUI::Form::hidden("func","postNewMessageSave"); $html .= WebGUI::Form::hidden("func","postNewMessageSave");
$html .= WebGUI::Form::hidden("wid",$session{form}{wid}); $html .= WebGUI::Form::hidden("wid",$session{form}{wid});
$html .= WebGUI::Form::hidden("sid",$session{form}{sid}); $html .= WebGUI::Form::hidden("sid",$session{form}{sid});
@ -118,7 +162,7 @@ sub postReply {
($subject) = WebGUI::SQL->quickArray("select subject from discussion where messageId=$session{form}{mid}"); ($subject) = WebGUI::SQL->quickArray("select subject from discussion where messageId=$session{form}{mid}");
$subject = "Re: ".$subject; $subject = "Re: ".$subject;
$html = '<h1>'.WebGUI::International::get(234).'</h1>'; $html = '<h1>'.WebGUI::International::get(234).'</h1>';
$html .= '<form action="'.$session{page}{url}.'" method="post"><table>'; $html .= formHeader().'<table>';
$html .= WebGUI::Form::hidden("func","postReplySave"); $html .= WebGUI::Form::hidden("func","postReplySave");
$html .= WebGUI::Form::hidden("wid",$session{form}{wid}); $html .= WebGUI::Form::hidden("wid",$session{form}{wid});
$html .= WebGUI::Form::hidden("sid",$session{form}{sid}); $html .= WebGUI::Form::hidden("sid",$session{form}{sid});
@ -156,14 +200,18 @@ sub showMessage {
my ($html, %message); my ($html, %message);
tie %message, 'Tie::CPHash'; tie %message, 'Tie::CPHash';
%message = getMessage($session{form}{mid}); %message = getMessage($session{form}{mid});
$html = '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">'; if ($message{messageId}) {
$html .= '<b>'.WebGUI::International::get(237).'</b>'.$message{subject}.'<br>'; $html = '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
$html .= '<b>'.WebGUI::International::get(238).'</b> <a href="'.$session{page}{url}.'?op=viewProfile&uid='.$message{userId}.'">'.$message{username}.'</a><br>'; $html .= '<b>'.WebGUI::International::get(237).'</b>'.$message{subject}.'<br>';
$html .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>"; $html .= '<b>'.WebGUI::International::get(238).'</b> <a href="'.WebGUI::URL::page('op=viewProfile&uid='.$message{userId}).'">'.$message{username}.'</a><br>';
$html .= "<b>".WebGUI::International::get(240)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>"; $html .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>";
$html .= '</td></tr><tr><td class="tableData">'; $html .= "<b>".WebGUI::International::get(240)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
$html .= $message{message}; $html .= '</td></tr><tr><td class="tableData">';
$html .= '</td></tr></table>'; $html .= $message{message};
$html .= '</td></tr></table>';
} else {
$html = WebGUI::International::get(402);
}
return $html; return $html;
} }
@ -172,10 +220,14 @@ sub showReplyTree {
my (@data, $html, %message); my (@data, $html, %message);
tie %message, 'Tie::CPHash'; tie %message, 'Tie::CPHash';
%message = getMessage($session{form}{mid}); %message = getMessage($session{form}{mid});
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">'; if ($message{messageId}) {
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td><td class="tableHeader">'.WebGUI::International::get(244).'</td><td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>'; $html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
$html .= traverseReplyTree($message{rid},0); $html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).
$html .= "</table>"; '</td><td class="tableHeader">'.WebGUI::International::get(244).
'</td><td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>';
$html .= traverseReplyTree($message{rid},0);
$html .= "</table>";
}
return $html; return $html;
} }
@ -191,7 +243,7 @@ sub traverseReplyTree {
if ($session{form}{mid} eq $data[0]) { if ($session{form}{mid} eq $data[0]) {
$html .= ' class="highlight"'; $html .= ' class="highlight"';
} }
$html .= '><td class="tableData">'.$depth.'<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.substr($data[1],0,30).'</a></td><td class="tableData"><a href="'.$session{page}{url}.'?op=viewProfile&uid='.$data[4].'">'.$data[2].'</a></td><td class="tableData">'.epochToHuman($data[3],"%M/%D %H:%n%p").'</td></tr>'; $html .= '><td class="tableData">'.$depth.'<a href="'.WebGUI::URL::page('func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}).'">'.substr($data[1],0,30).'</a></td><td class="tableData"><a href="'.WebGUI::URL::page('op=viewProfile&uid='.$data[4]).'">'.$data[2].'</a></td><td class="tableData">'.epochToHuman($data[3],"%M/%D %H:%n%p").'</td></tr>';
$html .= traverseReplyTree($data[0],$_[1]+1); $html .= traverseReplyTree($data[0],$_[1]+1);
} }
$sth->finish; $sth->finish;

View file

@ -159,13 +159,27 @@ sub textArea {
$rows = 5; $rows = 5;
} }
if ($htmlEdit > 0) { if ($htmlEdit > 0) {
$output .= '<script language="JavaScript"> var formObj; var extrasDir="'.$session{setting}{lib}.'"; function openEditWindow(obj) { formObj = obj; if (navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE")+5,1)>=5) window.open("'.$session{setting}{lib}.'/ieEdit.html","editWindow","width=490,height=400"); else window.open("'.$session{setting}{lib}.'/nonIeEdit.html","editWindow","width=450,height=240"); } function setContent(content) { formObj.value = content; } </script>'; $output .= '<script language="JavaScript">
$output .= '<input type="button" onClick="openEditWindow(this.form.'.$name.')" value="'.WebGUI::International::get(171).'" style="font-size: 8pt;"><br>'; var formObj;
var extrasDir="'.$session{setting}{lib}.'";
function openEditWindow(obj) {
formObj = obj;
if (navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE")+5,1)>=5)
window.open("'.$session{setting}{lib}.'/ieEdit.html","editWindow","width=490,height=400");
else
window.open("'.$session{setting}{lib}.'/nonIeEdit.html","editWindow","width=490,height=400");
}
function setContent(content) {
formObj.value = content;
} </script>';
$output .= '<input type="button" onClick="openEditWindow(this.form.'.$name.')" value="'.
WebGUI::International::get(171).'" style="font-size: 8pt;"><br>';
} }
if ($wrap eq "") { if ($wrap eq "") {
$wrap = "virtual"; $wrap = "virtual";
} }
$output .= '<textarea name="'.$name.'" cols="'.$cols.'" rows="'.$rows.'" wrap="'.$wrap.'" onBlur="fixChars(this.form.'.$name.')">'.$value.'</textarea>'; $output .= '<textarea name="'.$name.'" cols="'.$cols.'" rows="'.$rows.'" wrap="'.$wrap.
'" onBlur="fixChars(this.form.'.$name.')">'.$value.'</textarea>';
return $output; return $output;
} }

View file

@ -12,12 +12,13 @@ package WebGUI::Macro::Backslash_pageUrl;
use strict; use strict;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
my ($output); my ($output);
$output = $_[0]; $output = $_[0];
$output =~ s/\^\\\;/$session{page}{url}/g; $output =~ s/\^\\\;/WebGUI::URL::page()/ge;
return $output; return $output;
} }

View file

@ -12,8 +12,10 @@ package WebGUI::Macro::C_crumbTrail;
use strict; use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::Macro;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _recurseCrumbTrail { sub _recurseCrumbTrail {
@ -24,16 +26,23 @@ sub _recurseCrumbTrail {
$output .= _recurseCrumbTrail($data{parentId}); $output .= _recurseCrumbTrail($data{parentId});
} }
if ($data{title} ne "") { if ($data{title} ne "") {
$output .= '<a class="crumbTrail" href="'.$session{config}{scripturl}. $output .= '<a class="crumbTrail" href="'.WebGUI::URL::gateway($data{urlizedTitle})
'/'.$data{urlizedTitle}.'">'.$data{title}.'</a> &gt; '; .'">'.$data{title}.'</a>'.$_[1];
} }
return $output; return $output;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my (@param, $temp); my (@param, $temp, $delimeter);
$temp = '<span class="crumbTrail">'._recurseCrumbTrail($session{page}{parentId}).'<a href="'.$session{page}{url}.'">'.$session{page}{title}.'</a></span>'; @param = WebGUI::Macro::getParams($_[0]);
if ($param[0] eq "") {
$delimeter = " &gt; ";
} else {
$delimeter = " ".$param[0]." ";
}
$temp = '<span class="crumbTrail">'._recurseCrumbTrail($session{page}{parentId},$delimeter).
'<a href="'.WebGUI::URL::page().'">'.$session{page}{title}.'</a></span>';
return $temp; return $temp;
} }
@ -41,6 +50,7 @@ sub _replacement {
sub process { sub process {
my ($output, $temp); my ($output, $temp);
$output = $_[0]; $output = $_[0];
$output =~ s/\^C\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^C\;/_replacement()/ge; $output =~ s/\^C\;/_replacement()/ge;
return $output; return $output;
} }

View file

@ -14,6 +14,7 @@ use strict;
use WebGUI::Macro; use WebGUI::Macro;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
@ -35,8 +36,8 @@ sub _reversePageTree {
if ($_[1] == $data[0]) { if ($_[1] == $data[0]) {
$output .= '<span class="selectedMenuItem">'; $output .= '<span class="selectedMenuItem">';
} }
$output .= '<a class="verticalMenu" href="'.$session{config}{scripturl}. $output .= '<a class="verticalMenu" href="'.WebGUI::URL::gateway($data[3]).
'/'.$data[3].'">'.$data[2].'</a><br>'; '">'.$data[2].'</a><br>';
if ($_[1] == $data[0]) { if ($_[1] == $data[0]) {
$output .= '</span>'; $output .= '</span>';
} }

View file

@ -19,7 +19,7 @@ use WebGUI::Session;
sub _replacement { sub _replacement {
my (@param, $temp); my (@param, $temp);
@param = WebGUI::Macro::getParams($1); @param = WebGUI::Macro::getParams($1);
$temp = '<a class="homeLink" href="'.$session{config}{scripturl}.'/home">'; $temp = '<a class="homeLink" href="'.WebGUI::URL::gateway('home').'">';
if ($param[0] ne "") { if ($param[0] ne "") {
$temp .= $param[0]; $temp .= $param[0];
} else { } else {

View file

@ -15,6 +15,7 @@ use WebGUI::Form;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro::Backslash_pageUrl; use WebGUI::Macro::Backslash_pageUrl;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
@ -22,11 +23,11 @@ sub _replacement {
$temp = '<div class="loginBox">'; $temp = '<div class="loginBox">';
if ($session{var}{sessionId}) { if ($session{var}{sessionId}) {
$temp .= WebGUI::International::get(48); $temp .= WebGUI::International::get(48);
$temp .= ' <a href="'.$session{page}{url}.'?op=displayAccount">'.$session{user}{username}.'</a>.'; $temp .= ' <a href="'.WebGUI::URL::page('op=displayAccount').'">'.$session{user}{username}.'</a>.';
$temp .= WebGUI::International::get(49); $temp .= WebGUI::International::get(49);
$temp = WebGUI::Macro::Backslash_pageUrl::process($temp); $temp = WebGUI::Macro::Backslash_pageUrl::process($temp);
} else { } else {
$temp .= '<form method="post" action="'.$session{page}{url}.'"> '; $temp .= '<form method="post" action="'.WebGUI::URL::page().'"> ';
$temp .= WebGUI::Form::hidden("op","login").'<span class="formSubtext">'; $temp .= WebGUI::Form::hidden("op","login").'<span class="formSubtext">';
$temp .= WebGUI::International::get(50); $temp .= WebGUI::International::get(50);
$temp .= '<br></span>'; $temp .= '<br></span>';
@ -36,7 +37,7 @@ sub _replacement {
$temp .= WebGUI::Form::password("identifier",12,30).'<span class="formSubtext"><br></span>'; $temp .= WebGUI::Form::password("identifier",12,30).'<span class="formSubtext"><br></span>';
$temp .= WebGUI::Form::submit(WebGUI::International::get(52)); $temp .= WebGUI::Form::submit(WebGUI::International::get(52));
$temp .= '</form>'; $temp .= '</form>';
$temp .= '<a href="'.$session{page}{url}.'?op=createAccount">Click here to register.</a>'; $temp .= '<a href="'.WebGUI::URL::page('op=createAccount').'">Click here to register.</a>';
} }
$temp .= '</div>'; $temp .= '</div>';
return $temp; return $temp;

View file

@ -14,12 +14,13 @@ use strict;
use WebGUI::Form; use WebGUI::Form;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
my ($output, $temp); my ($output, $temp);
$output = $_[0]; $output = $_[0];
$temp = '<form class="searchBox" method="post" action="'.$session{page}{url}.'">'; $temp = '<form class="searchBox" method="post" action="'.WebGUI::URL::page().'">';
$temp .= WebGUI::Form::hidden("op","search"); $temp .= WebGUI::Form::hidden("op","search");
$temp .= WebGUI::Form::text("keywords",10,100,$session{form}{keywords}); $temp .= WebGUI::Form::text("keywords",10,100,$session{form}{keywords});
$temp .= WebGUI::Form::submit(WebGUI::International::get(364)); $temp .= WebGUI::Form::submit(WebGUI::International::get(364));

View file

@ -15,6 +15,7 @@ use Tie::CPHash;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&traversePageTree); our @EXPORT = qw(&traversePageTree);
@ -40,7 +41,7 @@ sub traversePageTree {
while (@data = $sth->array) { while (@data = $sth->array) {
if (WebGUI::Privilege::canViewPage($data[2])) { if (WebGUI::Privilege::canViewPage($data[2])) {
$output .= $depth.'<a class="verticalMenu" href="'. $output .= $depth.'<a class="verticalMenu" href="'.
$session{config}{scripturl}.'/'.$data[0].'">'.$data[1].'</a><br>'; WebGUI::URL::gateway($data[0]).'">'.$data[1].'</a><br>';
$output .= traversePageTree($data[2],$_[1]+1,$toLevel); $output .= traversePageTree($data[2],$_[1]+1,$toLevel);
} }
} }

View file

@ -12,12 +12,13 @@ package WebGUI::Macro::Slash_gatewayUrl;
use strict; use strict;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
my ($output); my ($output);
$output = $_[0]; $output = $_[0];
$output =~ s/\^\/\;/$session{config}{scripturl}/g; $output =~ s/\^\/\;/WebGUI::URL::gateway()/ge;
return $output; return $output;
} }

View file

@ -14,12 +14,13 @@ use strict;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro; use WebGUI::Macro;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my (@param, $temp); my (@param, $temp);
@param = WebGUI::Macro::getParams($_[0]); @param = WebGUI::Macro::getParams($_[0]);
$temp = '<a class="myAccountLink" href="'.$session{page}{url}.'?op=displayAccount">'; $temp = '<a class="myAccountLink" href="'.WebGUI::URL::page('op=displayAccount').'">';
if ($param[0] ne "") { if ($param[0] ne "") {
$temp .= $param[0]; $temp .= $param[0];
} else { } else {

View file

@ -11,13 +11,21 @@ package WebGUI::Macro::m_currentMenuHorizontal;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use WebGUI::Macro;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my ($temp, @data, $sth, $first); my ($temp, @data, $sth, $first, @param, $delimeter);
@param = WebGUI::Macro::getParams($_[0]);
if ($param[0] eq "") {
$delimeter = " &middot; ";
} else {
$delimeter = " ".$param[0]." ";
}
$temp = '<span class="horizontalMenu">'; $temp = '<span class="horizontalMenu">';
$first = 1; $first = 1;
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber"); $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber");
@ -26,10 +34,10 @@ sub _replacement {
if ($first) { if ($first) {
$first = 0; $first = 0;
} else { } else {
$temp .= " &middot; "; $temp .= $delimeter;
} }
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}. $temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).
'/'.$data[1].'">'.$data[0].'</a>'; '">'.$data[0].'</a>';
} }
} }
$sth->finish; $sth->finish;
@ -41,6 +49,7 @@ sub _replacement {
sub process { sub process {
my ($output, $temp, @data, $sth, $first); my ($output, $temp, @data, $sth, $first);
$output = $_[0]; $output = $_[0];
$output =~ s/\^m\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^m\;/_replacement()/ge; $output =~ s/\^m\;/_replacement()/ge;
return $output; return $output;
} }

View file

@ -15,10 +15,17 @@ use WebGUI::Macro;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my ($temp, @data, $sth, $first); my ($temp, @data, $sth, $first, @param, $delimeter);
@param = WebGUI::Macro::getParams($_[0]);
if ($param[0] eq "") {
$delimeter = " &middot; ";
} else {
$delimeter = " ".$param[0]." ";
}
$temp = '<span class="horizontalMenu">'; $temp = '<span class="horizontalMenu">';
$first = 1; $first = 1;
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber"); $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber");
@ -27,9 +34,9 @@ sub _replacement {
if ($first) { if ($first) {
$first = 0; $first = 0;
} else { } else {
$temp .= " &middot; "; $temp .= $delimeter;
} }
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}.'/'.$data[1].'">'.$data[0].'</a>'; $temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).'">'.$data[0].'</a>';
} }
} }
$sth->finish; $sth->finish;
@ -41,6 +48,7 @@ sub _replacement {
sub process { sub process {
my ($output, $temp, @data, $sth, $first); my ($output, $temp, @data, $sth, $first);
$output = $_[0]; $output = $_[0];
$output =~ s/\^p\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^p\;/_replacement()/ge; $output =~ s/\^p\;/_replacement()/ge;
return $output; return $output;
} }

View file

@ -14,13 +14,14 @@ use strict;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro; use WebGUI::Macro;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my ($temp, @param); my ($temp, @param);
@param = WebGUI::Macro::getParams($_[0]); @param = WebGUI::Macro::getParams($_[0]);
$temp = appendToUrl($session{env}{REQUEST_URI},'makePrintable=1'); $temp = WebGUI::URL::append($session{env}{REQUEST_URI},'makePrintable=1');
$temp = '<a class="makePrintableLink" href="'.$temp.'">'; $temp = '<a class="makePrintableLink" href="'.$temp.'">';
if ($param[0] ne "") { if ($param[0] ne "") {
$temp .= $param[0]; $temp .= $param[0];

View file

@ -11,15 +11,22 @@ package WebGUI::Macro::s_specificMenuHorizontal;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use WebGUI::Macro;
use WebGUI::Macro::Shared; use WebGUI::Macro::Shared;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my ($temp, @data, $pageTitle, $parentId, $sth, $first, @param); my ($temp, @data, $pageTitle, $parentId, $sth, $first, @param, $delimeter);
@param = WebGUI::Macro::getParams($_[0]); @param = WebGUI::Macro::getParams($_[0]);
if ($param[1] eq "") {
$delimeter = " &middot; ";
} else {
$delimeter = " ".$param[1]." ";
}
$temp = '<span class="horizontalMenu">'; $temp = '<span class="horizontalMenu">';
$first = 1; $first = 1;
($parentId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'"); ($parentId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
@ -29,10 +36,10 @@ sub _replacement {
if ($first) { if ($first) {
$first = 0; $first = 0;
} else { } else {
$temp .= " &middot; "; $temp .= $delimeter;
} }
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}. $temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).'">'.
'/'.$data[1].'">'.$data[0].'</a>'; $data[0].'</a>';
} }
} }
$sth->finish; $sth->finish;
@ -45,7 +52,6 @@ sub process {
my ($output,@data, $pageTitle, $parentId, $sth, $first, $temp); my ($output,@data, $pageTitle, $parentId, $sth, $first, $temp);
$output = $_[0]; $output = $_[0];
$output =~ s/\^s\((.*?)\)\;/_replacement($1)/ge; $output =~ s/\^s\((.*?)\)\;/_replacement($1)/ge;
#$output =~ s/\^s\;/_replacement()/ge;
return $output; return $output;
} }

View file

@ -11,13 +11,20 @@ package WebGUI::Macro::t_topMenuHorizontal;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use WebGUI::Macro;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my ($temp, @data, $sth, $first); my ($temp, @data, $sth, $first, @param, $delimeter);
@param = WebGUI::Macro::getParams($_[0]);
if ($param[0] eq "") {
$delimeter = " &middot; ";
} else {
$delimeter = " ".$param[0]." ";
}
$temp = '<span class="horizontalMenu">'; $temp = '<span class="horizontalMenu">';
$first = 1; $first = 1;
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber"); $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber");
@ -26,10 +33,10 @@ sub _replacement {
if ($first) { if ($first) {
$first = 0; $first = 0;
} else { } else {
$temp .= " &middot; "; $temp .= $delimeter;
} }
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}.'/' $temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1])
.$data[1].'">'.$data[0].'</a>'; .'">'.$data[0].'</a>';
} }
} }
$sth->finish; $sth->finish;
@ -41,6 +48,7 @@ sub _replacement {
sub process { sub process {
my ($output, $temp, @data, $sth, $first); my ($output, $temp, @data, $sth, $first);
$output = $_[0]; $output = $_[0];
$output =~ s/\^t\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^t\;/_replacement()/ge; $output =~ s/\^t\;/_replacement()/ge;
return $output; return $output;
} }

View file

@ -24,6 +24,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -36,17 +37,20 @@ sub _accountOptions {
$output = '<div class="accountOptions"><ul>'; $output = '<div class="accountOptions"><ul>';
if (WebGUI::Privilege::isInGroup(3) || WebGUI::Privilege::isInGroup(4) || WebGUI::Privilege::isInGroup(5) || WebGUI::Privilege::isInGroup(6)) { if (WebGUI::Privilege::isInGroup(3) || WebGUI::Privilege::isInGroup(4) || WebGUI::Privilege::isInGroup(5) || WebGUI::Privilege::isInGroup(6)) {
if ($session{var}{adminOn}) { if ($session{var}{adminOn}) {
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOffAdmin">'.WebGUI::International::get(12).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=switchOffAdmin').'">'.
WebGUI::International::get(12).'</a>';
} else { } else {
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">'.WebGUI::International::get(63).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=switchOnAdmin').'">'.WebGUI::International::get(63).'</a>';
} }
} }
$output .= '<li><a href="'.$session{page}{url}.'?op=displayAccount">'.WebGUI::International::get(342).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=displayAccount').'">'.WebGUI::International::get(342).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editProfile">'.WebGUI::International::get(341).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editProfile').'">'.WebGUI::International::get(341).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=viewProfile&uid='.$session{user}{userId}.'">'.WebGUI::International::get(343).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=viewProfile&uid='.$session{user}{userId}).'">'.
$output .= '<li><a href="'.$session{page}{url}.'?op=viewMessageLog">'.WebGUI::International::get(354).'</a>'; WebGUI::International::get(343).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=logout">'.WebGUI::International::get(64).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=viewMessageLog').'">'.WebGUI::International::get(354).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=deactivateAccount">'.WebGUI::International::get(65).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=logout').'">'.WebGUI::International::get(64).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=deactivateAccount').'">'.
WebGUI::International::get(65).'</a>';
$output .= '</ul></div>'; $output .= '</ul></div>';
return $output; return $output;
} }
@ -117,9 +121,11 @@ sub www_createAccount {
$output .= '</table>'; $output .= '</table>';
$output .= '</form> '; $output .= '</form> ';
$output .= '<div class="accountOptions"><ul>'; $output .= '<div class="accountOptions"><ul>';
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">'.WebGUI::International::get(58).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=displayLogin').'">'.
WebGUI::International::get(58).'</a>';
if ($session{setting}{authMethod} eq "WebGUI") { if ($session{setting}{authMethod} eq "WebGUI") {
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">'.WebGUI::International::get(59).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=recoverPassword').'">'.
WebGUI::International::get(59).'</a>';
} }
$output .= '</ul></div>'; $output .= '</ul></div>';
} }
@ -196,8 +202,9 @@ sub www_deactivateAccount {
} else { } else {
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(60).'<p>'; $output .= WebGUI::International::get(60).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deactivateAccountConfirm">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deactivateAccountConfirm').'">'.
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>'; WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(45).'</a></div>';
} }
return $output; return $output;
} }
@ -265,10 +272,12 @@ sub www_displayLogin {
$output .= '</form>'; $output .= '</form>';
$output .= '<div class="accountOptions"><ul>'; $output .= '<div class="accountOptions"><ul>';
if ($session{setting}{anonymousRegistration} eq "yes") { if ($session{setting}{anonymousRegistration} eq "yes") {
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">'.WebGUI::International::get(67).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=createAccount').'">'.
WebGUI::International::get(67).'</a>';
} }
if ($session{setting}{authMethod} eq "WebGUI") { if ($session{setting}{authMethod} eq "WebGUI") {
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">'.WebGUI::International::get(59).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=recoverPassword').'">'.
WebGUI::International::get(59).'</a>';
} }
$output .= '</ul></div>'; $output .= '</ul></div>';
} }
@ -397,15 +406,18 @@ sub www_recoverPassword {
$output .= formHeader(); $output .= formHeader();
$output .= WebGUI::Form::hidden("op","recoverPasswordFinish"); $output .= WebGUI::Form::hidden("op","recoverPasswordFinish");
$output .= '<table>'; $output .= '<table>';
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>'; $output .= '<tr><td class="formDescription">'.WebGUI::International::get(56).
'</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(72)).'</td></tr>'; $output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(72)).'</td></tr>';
$output .= '</table>'; $output .= '</table>';
$output .= '</form>'; $output .= '</form>';
$output .= '<div class="accountOptions"><ul>'; $output .= '<div class="accountOptions"><ul>';
if ($session{setting}{anonymousRegistration} eq "yes") { if ($session{setting}{anonymousRegistration} eq "yes") {
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">'.WebGUI::International::get(67).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=createAccount').'">'.
WebGUI::International::get(67).'</a>';
} }
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">'.WebGUI::International::get(73).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=displayLogin').'">'.
WebGUI::International::get(73).'</a>';
$output .= '</ul></div>'; $output .= '</ul></div>';
} }
return $output; return $output;
@ -484,7 +496,7 @@ sub www_viewMessageLog {
while (@data = $sth->array) { while (@data = $sth->array) {
$row[$i] = '<tr><td class="tableData">'; $row[$i] = '<tr><td class="tableData">';
if ($data[2] ne "") { if ($data[2] ne "") {
$data[2] = appendToUrl($data[2],'mlog='.$data[0]); $data[2] = WebGUI::URL::append($data[2],'mlog='.$data[0]);
$row[$i] .= '<a href="'.$data[2].'">'; $row[$i] .= '<a href="'.$data[2].'">';
} }
$row[$i] .= $data[1]; $row[$i] .= $data[1];
@ -495,7 +507,7 @@ sub www_viewMessageLog {
$i++; $i++;
} }
$sth->finish; $sth->finish;
($dataRows, $prevNextBar) = paginate(50,$session{page}{url}.'?op=viewMessageLog',\@row); ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=viewMessageLog'),\@row);
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>'; $output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(351).'</td><td class="tableHeader">'.WebGUI::International::get(352).'</td></tr>'; $output .= '<tr><td class="tableHeader">'.WebGUI::International::get(351).'</td><td class="tableHeader">'.WebGUI::International::get(352).'</td></tr>';
if ($dataRows eq "") { if ($dataRows eq "") {

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -67,8 +68,11 @@ sub www_deleteGroup {
$output .= helpLink(15); $output .= helpLink(15);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(86).'<p>'; $output .= WebGUI::International::get(86).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteGroupConfirm&gid='.$session{form}{gid}.'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(45).'</a></div>'; WebGUI::URL::page('op=deleteGroupConfirm&gid='.$session{form}{gid}).
'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('op=listGroups').'">'.
WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();
@ -112,8 +116,14 @@ sub www_editGroup {
$output .= '<table><tr><td class="tableHeader">&nbsp;</td><td class="tableHeader">'.WebGUI::International::get(50).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>'; $output .= '<table><tr><td class="tableHeader">&nbsp;</td><td class="tableHeader">'.WebGUI::International::get(50).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
$sth = WebGUI::SQL->read("select users.username,users.userId,groupings.expireDate from groupings,users where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId order by users.username"); $sth = WebGUI::SQL->read("select users.username,users.userId,groupings.expireDate from groupings,users where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId order by users.username");
while (%hash = $sth->hash) { while (%hash = $sth->hash) {
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>'; $output .= '<tr><td><a href="'.
$output .= '<td class="tableData"><a href="'.$session{page}{url}.'/op=editUser&uid='.$hash{userId}.'">'.$hash{username}.'</a></td>'; WebGUI::URL::page('op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
WebGUI::URL::page('op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
$output .= '<td class="tableData"><a href="'.
WebGUI::URL::page('op=editUser&uid='.$hash{userId})
.'">'.$hash{username}.'</a></td>';
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>'; $output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
} }
$sth->finish; $sth->finish;
@ -140,17 +150,22 @@ sub www_listGroups {
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(10); $output = helpLink(10);
$output .= '<h1>'.WebGUI::International::get(89).'</h1>'; $output .= '<h1>'.WebGUI::International::get(89).'</h1>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addGroup">'.WebGUI::International::get(90).'</a></div>'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=addGroup').
'">'.WebGUI::International::get(90).'</a></div>';
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">'; $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"); $sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName");
while (@data = $sth->array) { while (@data = $sth->array) {
$row[$i] = '<tr><td valign="top" class="tableData"><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] = '<tr><td valign="top" class="tableData"><a href="'.
WebGUI::URL::page('op=deleteGroup&gid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
WebGUI::URL::page('op=editGroup&gid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td>'; $row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data[2].'</td></tr>'; $row[$i] .= '<td valign="top" class="tableData">'.$data[2].'</td></tr>';
$i++; $i++;
} }
$sth->finish; $sth->finish;
($dataRows, $prevNextBar) = paginate(50,$session{page}{url}.'?op=listGroups',\@row); ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listGroups'),\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">'; $output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $dataRows; $output .= $dataRows;
$output .= '</table>'; $output .= '</table>';

View file

@ -16,6 +16,7 @@ use Tie::CPHash;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex); our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex);
@ -31,16 +32,19 @@ sub www_viewHelp {
$output .= '<p><b>'.WebGUI::International::get(94).':'; $output .= '<p><b>'.WebGUI::International::get(94).':';
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}' and action<>'$help{action}' and language='$session{user}{language}' order by action"); $sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}' and action<>'$help{action}' and language='$session{user}{language}' order by action");
while (@data = $sth->array) { while (@data = $sth->array) {
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'&namespace='.$data[3].'">'.$data[1].' '.$data[2].'</a>,'; $output .= ' <a href="'.WebGUI::URL::page('op=viewHelp&hid='.$data[0].'&namespace='.$data[3])
.'">'.$data[1].' '.$data[2].'</a>,';
} }
$sth->finish; $sth->finish;
$sth = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})"); $sth = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})");
while (@data = $sth->array) { while (@data = $sth->array) {
%seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]' and namespace='$data[1]' and language='$session{user}{language}'"); %seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]' and namespace='$data[1]' and language='$session{user}{language}'");
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$seeAlso{helpId}.'&namespace='.$seeAlso{namespace}.'">'.$seeAlso{action}.' '.$seeAlso{object}.'</a>,'; $output .= ' <a href="'.
WebGUI::URL::page('op=viewHelp&hid='.$seeAlso{helpId}.'&namespace='.$seeAlso{namespace})
.'">'.$seeAlso{action}.' '.$seeAlso{object}.'</a>,';
} }
$sth->finish; $sth->finish;
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelpIndex">'.WebGUI::International::get(95).'</a>'; $output .= ' <a href="'.WebGUI::URL::page('op=viewHelpIndex').'">'.WebGUI::International::get(95).'</a>';
return $output; return $output;
} }
@ -55,7 +59,8 @@ sub www_viewHelpIndex {
$output .= '<p><b>'.$data[1].'</b><br>'; $output .= '<p><b>'.$data[1].'</b><br>';
$previous = $data[1]; $previous = $data[1];
} }
$output .= '<li><a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'&namespace='.$data[3].'">'.$data[2].'</a><br>'; $output .= '<li><a href="'.WebGUI::URL::page('op=viewHelp&hid='.$data[0].'&namespace='.$data[3])
.'">'.$data[2].'</a><br>';
} }
$sth->finish; $sth->finish;
$output .= '</td><td valign="top"><b>'.WebGUI::International::get(97).'</b><p>'; $output .= '</td><td valign="top"><b>'.WebGUI::International::get(97).'</b><p>';
@ -65,7 +70,8 @@ sub www_viewHelpIndex {
$output .= '<p><b>'.$data[1].'</b><br>'; $output .= '<p><b>'.$data[1].'</b><br>';
$previous = $data[1]; $previous = $data[1];
} }
$output .= '<li><a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'&namespace='.$data[3].'">'.$data[2].'</a><br>'; $output .= '<li><a href="'.WebGUI::URL::page('op=viewHelp&hid='.$data[0].'&namespace='.$data[3])
.'">'.$data[2].'</a><br>';
} }
$sth->finish; $sth->finish;
$output .= '</td></tr></table>'; $output .= '</td></tr></table>';

View file

@ -21,6 +21,7 @@ use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::Template; use WebGUI::Template;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -72,9 +73,10 @@ sub www_deleteImage {
$output .= helpLink(23); $output .= helpLink(23);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(392).'<p>'; $output .= WebGUI::International::get(392).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}. $output .= '<div align="center"><a href="'.
'?op=deleteImageConfirm&iid='.$session{form}{iid}.'">'.WebGUI::International::get(44).'</a>'; WebGUI::URL::page('op=deleteImageConfirm&iid='.$session{form}{iid})
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listImages">'. .'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('op=listImages').'">'.
WebGUI::International::get(45).'</a></div>'; WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
@ -122,7 +124,7 @@ sub www_editImage {
WebGUI::Form::text("name",20,128,$data{name})); WebGUI::Form::text("name",20,128,$data{name}));
if ($data{filename} ne "") { if ($data{filename} ne "") {
$output .= tableFormRow(WebGUI::International::get(384), $output .= tableFormRow(WebGUI::International::get(384),
'<a href="'.$session{page}{url}.'?op=deleteImageFile&iid='.$data{imageId}.'">'. '<a href="'.WebGUI::URL::page('op=deleteImageFile&iid='.$data{imageId}).'">'.
WebGUI::International::get(391).'</a>'); WebGUI::International::get(391).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(384), $output .= tableFormRow(WebGUI::International::get(384),
@ -168,7 +170,7 @@ sub www_listImages {
$output = helpLink(26); $output = helpLink(26);
$output .= '<h1>'.WebGUI::International::get(393).'</h1>'; $output .= '<h1>'.WebGUI::International::get(393).'</h1>';
$output .= '<table class="tableData" align="center" width="75%"><tr><td>'; $output .= '<table class="tableData" align="center" width="75%"><tr><td>';
$output .= '<a href="'.$session{page}{url}.'?op=addImage">'.WebGUI::International::get(395).'</a>'; $output .= '<a href="'.WebGUI::URL::page('op=addImage').'">'.WebGUI::International::get(395).'</a>';
$output .= '</td>'.formHeader().'<td align="right">'; $output .= '</td>'.formHeader().'<td align="right">';
$output .= WebGUI::Form::hidden("op","listImages"); $output .= WebGUI::Form::hidden("op","listImages");
$output .= WebGUI::Form::text("keyword",20,50); $output .= WebGUI::Form::text("keyword",20,50);
@ -182,12 +184,12 @@ sub www_listImages {
while (%data = $sth->hash) { while (%data = $sth->hash) {
$row[$i] = '<tr class="tableData"><td>'; $row[$i] = '<tr class="tableData"><td>';
if ($session{user}{userId} == $data{userId}) { if ($session{user}{userId} == $data{userId}) {
$row[$i] .= '<a href="'.$session{page}{url}.'?op=deleteImage&iid='.$data{imageId}. $row[$i] .= '<a href="'.WebGUI::URL::page('op=deleteImage&iid='.$data{imageId}).
'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>'; '"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>';
$row[$i] .= '<a href="'.$session{page}{url}.'?op=editImage&iid='.$data{imageId}. $row[$i] .= '<a href="'.WebGUI::URL::page('op=editImage&iid='.$data{imageId}).
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>'; '"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>';
} else { } else {
$row[$i] .= '<a href="'.$session{page}{url}.'?op=viewImage&iid='.$data{imageId}. $row[$i] .= '<a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId}).
'"><img src="'.$session{setting}{lib}.'/view.gif" border=0></a>'; '"><img src="'.$session{setting}{lib}.'/view.gif" border=0></a>';
} }
$row[$i] .= '</td>'; $row[$i] .= '</td>';
@ -198,7 +200,7 @@ sub www_listImages {
$i++; $i++;
} }
$sth->finish; $sth->finish;
($dataRows, $prevNextBar) = paginate(50,$session{page}{url}.'?op=listImages',\@row); ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listImages'),\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">'; $output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $dataRows; $output .= $dataRows;
$output .= '</table>'; $output .= '</table>';
@ -216,7 +218,7 @@ sub www_viewImage {
if (WebGUI::Privilege::isInGroup(4)) { if (WebGUI::Privilege::isInGroup(4)) {
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}"); %data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
$output .= '<h1>'.WebGUI::International::get(396).'</h1>'; $output .= '<h1>'.WebGUI::International::get(396).'</h1>';
$output .= '<a href="'.$session{page}{url}.'?op=listImages">'.WebGUI::International::get(397).'</a>'; $output .= '<a href="'.WebGUI::URL::page('op=listImages').'">'.WebGUI::International::get(397).'</a>';
$output .= '<table>'; $output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(389),$data{imageId}); $output .= tableFormRow(WebGUI::International::get(389),$data{imageId});
$output .= tableFormRow(WebGUI::International::get(383),$data{name}); $output .= tableFormRow(WebGUI::International::get(383),$data{name});

View file

@ -16,6 +16,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy); our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy);
@ -61,7 +62,8 @@ sub www_selectPackageToDeploy {
$output .= '<ul>'; $output .= '<ul>';
$sth = WebGUI::SQL->read("select * from page where parentId=5"); $sth = WebGUI::SQL->read("select * from page where parentId=5");
while (%data = $sth->hash) { while (%data = $sth->hash) {
$output .= '<li> <a href="'.$session{page}{url}.'?op=deployPackage&pid='.$data{pageId}.'">'.$data{title}.'</a>'; $output .= '<li> <a href="'.WebGUI::URL::page('op=deployPackage&pid='.$data{pageId})
.'">'.$data{title}.'</a>';
$flag = 1; $flag = 1;
} }
$sth->finish; $sth->finish;

View file

@ -19,6 +19,7 @@ use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::Template; use WebGUI::Template;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -90,7 +91,7 @@ sub www_addPageSave {
if ($session{form}{title} eq "") { if ($session{form}{title} eq "") {
$session{form}{title} = "no title"; $session{form}{title} = "no title";
} }
$urlizedTitle = urlize($session{form}{title}); $urlizedTitle = WebGUI::URL::urlize($session{form}{title});
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle'")) { while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle'")) {
$urlizedTitle .= 2; $urlizedTitle .= 2;
} }
@ -124,8 +125,10 @@ sub www_deletePage {
$output .= helpLink(3); $output .= helpLink(3);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(101).'<p>'; $output .= WebGUI::International::get(101).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deletePageConfirm">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deletePageConfirm').
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>'; '">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'.
WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -158,30 +161,44 @@ sub www_editPage {
$output .= WebGUI::Form::hidden("op","editPageSave"); $output .= WebGUI::Form::hidden("op","editPageSave");
$output .= '<table>'; $output .= '<table>';
$output .= '<tr><td colspan=2><b>'.WebGUI::International::get(103).'</b></td></tr>'; $output .= '<tr><td colspan=2><b>'.WebGUI::International::get(103).'</b></td></tr>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$session{page}{title})); $output .= tableFormRow(WebGUI::International::get(99),
$output .= tableFormRow(WebGUI::International::get(104),WebGUI::Form::text("urlizedTitle",20,128,$session{page}{urlizedTitle})); WebGUI::Form::text("title",20,128,$session{page}{title}));
$output .= tableFormRow(WebGUI::International::get(104),
WebGUI::Form::text("urlizedTitle",20,128,$session{page}{urlizedTitle}));
%hash = sortHash(WebGUI::Template::getList()); %hash = sortHash(WebGUI::Template::getList());
$array[0] = $session{page}{template}; $array[0] = $session{page}{template};
$output .= '<script language="JavaScript"> function updateTemplateImage(template) { document.template.src = "'.$session{setting}{lib}.'/templates/"+template+".gif"; } </script>'; $output .= '<script language="JavaScript"> function updateTemplateImage(template) { document.template.src = "'.$session{setting}{lib}.'/templates/"+template+".gif"; } </script>';
$output .= tableFormRow(WebGUI::International::get(356),WebGUI::Form::selectList("template",\%hash,\@array,1,0,"updateTemplateImage(this.form.template.value)").'<br><img src="'.$session{setting}{lib}.'/templates/'.$session{page}{template}.'.gif" name="template">'); $output .= tableFormRow(WebGUI::International::get(356),
WebGUI::Form::selectList("template",\%hash,\@array,1,0,"updateTemplateImage(this.form.template.value)").'<br><img src="'.$session{setting}{lib}.'/templates/'.$session{page}{template}.'.gif" name="template">');
$output .= tableFormRow(WebGUI::International::get(100),WebGUI::Form::textArea("metaTags",$session{page}{metaTags})); $output .= tableFormRow(WebGUI::International::get(100),WebGUI::Form::textArea("metaTags",$session{page}{metaTags}));
$output .= tableFormRow(WebGUI::International::get(307),WebGUI::Form::checkbox("defaultMetaTags",1,$session{page}{defaultMetaTags})); $output .= tableFormRow(WebGUI::International::get(307),WebGUI::Form::checkbox("defaultMetaTags",1,$session{page}{defaultMetaTags}));
$output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(105).'</b></td></tr>'; $output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(105).'</b></td></tr>';
%hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name"); %hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name");
$array[0] = $session{page}{styleId}; $array[0] = $session{page}{styleId};
$output .= tableFormRow(WebGUI::International::get(105),WebGUI::Form::selectList("styleId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(6).'</a></span>'); $output .= tableFormRow(WebGUI::International::get(105),
WebGUI::Form::selectList("styleId",\%hash,\@array).
' <span class="formSubtext"><a href="'.WebGUI::URL::page('op=listStyles').
'">'.WebGUI::International::get(6).'</a></span>');
$output .= tableFormRow("",WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">'.WebGUI::International::get(106).'</span>'); $output .= tableFormRow("",WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">'.WebGUI::International::get(106).'</span>');
$output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(107).'</b></td></tr>'; $output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(107).'</b></td></tr>';
%hash = WebGUI::SQL->buildHash("select users.userId,users.username from users,groupings where groupings.groupId=4 and groupings.userId=users.userId order by users.username"); %hash = WebGUI::SQL->buildHash("select users.userId,users.username from users,groupings where groupings.groupId=4 and groupings.userId=users.userId order by users.username");
$array[0] = $session{page}{ownerId}; $array[0] = $session{page}{ownerId};
$output .= tableFormRow(WebGUI::International::get(108),WebGUI::Form::selectList("ownerId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(7).'</a></span>'); $output .= tableFormRow(WebGUI::International::get(108),
WebGUI::Form::selectList("ownerId",\%hash,\@array).
' <span class="formSubtext"><a href="'.WebGUI::URL::page('op=listUsers').'">'.
WebGUI::International::get(7).'</a></span>');
$array[0] = $session{page}{ownerView}; $array[0] = $session{page}{ownerView};
$output .= tableFormRow(WebGUI::International::get(109),WebGUI::Form::selectList("ownerView",\%yesNo,\@array)); $output .= tableFormRow(WebGUI::International::get(109),
WebGUI::Form::selectList("ownerView",\%yesNo,\@array));
$array[0] = $session{page}{ownerEdit}; $array[0] = $session{page}{ownerEdit};
$output .= tableFormRow(WebGUI::International::get(110),WebGUI::Form::selectList("ownerEdit",\%yesNo,\@array)); $output .= tableFormRow(WebGUI::International::get(110),
WebGUI::Form::selectList("ownerEdit",\%yesNo,\@array));
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName"); %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
$array[0] = $session{page}{groupId}; $array[0] = $session{page}{groupId};
$output .= tableFormRow(WebGUI::International::get(111),WebGUI::Form::selectList("groupId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(5).'</a></span>'); $output .= tableFormRow(WebGUI::International::get(111),
WebGUI::Form::selectList("groupId",\%hash,\@array).
' <span class="formSubtext"><a href="'.WebGUI::URL::page('op=listGroups').'">'.
WebGUI::International::get(5).'</a></span>');
$array[0] = $session{page}{groupView}; $array[0] = $session{page}{groupView};
$output .= tableFormRow(WebGUI::International::get(112),WebGUI::Form::selectList("groupView",\%yesNo,\@array)); $output .= tableFormRow(WebGUI::International::get(112),WebGUI::Form::selectList("groupView",\%yesNo,\@array));
$array[0] = $session{page}{groupEdit}; $array[0] = $session{page}{groupEdit};
@ -206,7 +223,7 @@ sub www_editPageSave {
if ($session{form}{title} eq "") { if ($session{form}{title} eq "") {
$session{form}{title} = "no title"; $session{form}{title} = "no title";
} }
$urlizedTitle = urlize($session{form}{urlizedTitle}); $urlizedTitle = WebGUI::URL::urlize($session{form}{urlizedTitle});
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle' and pageId<>$session{page}{pageId}")) { while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle' and pageId<>$session{page}{pageId}")) {
$urlizedTitle .= 2; $urlizedTitle .= 2;
} }

View file

@ -18,6 +18,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -68,7 +69,7 @@ sub www_search {
} }
} }
if ($row[0] ne "") { if ($row[0] ne "") {
($dataRows, $prevNextBar) = paginate(20,$session{page}{url}.'?op=search',\@row); ($dataRows, $prevNextBar) = paginate(20,WebGUI::URL::page('op=search'),\@row);
$output .= WebGUI::International::get(365).'<p><ol>'; $output .= WebGUI::International::get(365).'<p><ol>';
$output .= $dataRows; $output .= $dataRows;
$output .= '</ol>'.$prevNextBar; $output .= '</ol>'.$prevNextBar;

View file

@ -18,6 +18,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_editProfileSettings &www_editProfileSettingsSave &www_editAuthenticationSettings &www_editAuthenticationSettingsSave &www_editCompanyInformation &www_editCompanyInformationSave &www_editFileSettings &www_editFileSettingsSave &www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings &www_editMiscSettingsSave &www_manageSettings); our @EXPORT = qw(&www_editProfileSettings &www_editProfileSettingsSave &www_editAuthenticationSettings &www_editAuthenticationSettingsSave &www_editCompanyInformation &www_editCompanyInformationSave &www_editFileSettings &www_editFileSettingsSave &www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings &www_editMiscSettingsSave &www_manageSettings);
@ -169,8 +170,9 @@ sub www_editMailSettingsSave {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editMiscSettings { sub www_editMiscSettings {
my ($output, @array, %notFoundPage); my ($output, @array, %notFoundPage, %yesNo);
%notFoundPage = (1=>WebGUI::International::get(136), 4=>WebGUI::International::get(137)); %notFoundPage = (1=>WebGUI::International::get(136), 4=>WebGUI::International::get(137));
%yesNo = ('1'=>WebGUI::International::get(138), '0'=>WebGUI::International::get(139));
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output .= helpLink(24); $output .= helpLink(24);
$output .= '<h1>'.WebGUI::International::get(140).'</h1>'; $output .= '<h1>'.WebGUI::International::get(140).'</h1>';
@ -178,8 +180,15 @@ sub www_editMiscSettings {
$output .= WebGUI::Form::hidden("op","editMiscSettingsSave"); $output .= WebGUI::Form::hidden("op","editMiscSettingsSave");
$output .= '<table>'; $output .= '<table>';
$array[0] = $session{setting}{notFoundPage}; $array[0] = $session{setting}{notFoundPage};
$output .= tableFormRow(WebGUI::International::get(141),WebGUI::Form::selectList("notFoundPage",\%notFoundPage,\@array)); $output .= tableFormRow(WebGUI::International::get(141),
$output .= tableFormRow(WebGUI::International::get(142),WebGUI::Form::text("sessionTimeout",30,11,$session{setting}{sessionTimeout})); WebGUI::Form::selectList("notFoundPage",\%notFoundPage,\@array));
$output .= tableFormRow(WebGUI::International::get(142),
WebGUI::Form::text("sessionTimeout",30,11,$session{setting}{sessionTimeout}));
$output .= tableFormRow(WebGUI::International::get(398),
WebGUI::Form::text("docTypeDec", 70, 255, $session{setting}{docTypeDec}));
$array[0] = $session{setting}{preventProxyCache};
$output .= tableFormRow(WebGUI::International::get(400),
WebGUI::Form::selectList("preventProxyCache",\%yesNo,\@array));
$output .= formSave(); $output .= formSave();
$output .= '</table>'; $output .= '</table>';
$output .= '</form> '; $output .= '</form> ';
@ -192,8 +201,14 @@ sub www_editMiscSettings {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editMiscSettingsSave { sub www_editMiscSettingsSave {
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout})." where name='sessionTimeout'"); WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout}).
WebGUI::SQL->write("update settings set value=".quote($session{form}{notFoundPage})." where name='notFoundPage'"); " where name='sessionTimeout'");
WebGUI::SQL->write("update settings set value=".quote($session{form}{notFoundPage}).
" where name='notFoundPage'");
WebGUI::SQL->write("update settings set value=".quote($session{form}{docTypeDec}).
" where name='docTypeDec'");
WebGUI::SQL->write("update settings set value=".quote($session{form}{preventProxyCache}).
" where name='preventProxyCache'");
return www_manageSettings(); return www_manageSettings();
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();
@ -250,12 +265,18 @@ sub www_manageSettings {
$output .= helpLink(12); $output .= helpLink(12);
$output .= '<h1>'.WebGUI::International::get(143).'</h1>'; $output .= '<h1>'.WebGUI::International::get(143).'</h1>';
$output .= '<ul>'; $output .= '<ul>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editAuthenticationSettings">'.WebGUI::International::get(117).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editAuthenticationSettings').
$output .= '<li><a href="'.$session{page}{url}.'?op=editCompanyInformation">'.WebGUI::International::get(124).'</a>'; '">'.WebGUI::International::get(117).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editFileSettings">'.WebGUI::International::get(128).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editCompanyInformation').
$output .= '<li><a href="'.$session{page}{url}.'?op=editMailSettings">'.WebGUI::International::get(133).'</a>'; '">'.WebGUI::International::get(124).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editMiscSettings">'.WebGUI::International::get(140).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editFileSettings').
$output .= '<li><a href="'.$session{page}{url}.'?op=editProfileSettings">'.WebGUI::International::get(308).'</a>'; '">'.WebGUI::International::get(128).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editMailSettings').
'">'.WebGUI::International::get(133).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editMiscSettings').
'">'.WebGUI::International::get(140).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editProfileSettings').
'">'.WebGUI::International::get(308).'</a>';
$output .= '</ul>'; $output .= '</ul>';
} else { } else {
$output = WebGUI::Privilege::adminOnly(); $output = WebGUI::Privilege::adminOnly();

View file

@ -30,6 +30,7 @@ sub www_viewStatistics {
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$userAgent = new LWP::UserAgent; $userAgent = new LWP::UserAgent;
$userAgent->agent("WebGUI-Check/2.0"); $userAgent->agent("WebGUI-Check/2.0");
$userAgent->timeout(10);
$header = new HTTP::Headers; $header = new HTTP::Headers;
$referer = "http://webgui.web.getversion/".$session{env}{SERVER_NAME}.$session{env}{REQUEST_URI}; $referer = "http://webgui.web.getversion/".$session{env}{SERVER_NAME}.$session{env}{REQUEST_URI};
chomp $referer; chomp $referer;

View file

@ -19,6 +19,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -79,8 +80,11 @@ sub www_deleteStyle {
$output .= helpLink(4); $output .= helpLink(4);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(155).'<p>'; $output .= WebGUI::International::get(155).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteStyleConfirm&sid='.$session{form}{sid}.'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(45).'</a></div>'; WebGUI::URL::page('op=deleteStyleConfirm&sid='.$session{form}{sid})
.'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('op=listStyles').
'">'.WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();
@ -142,15 +146,22 @@ sub www_listStyles {
if (WebGUI::Privilege::isInGroup(5)) { if (WebGUI::Privilege::isInGroup(5)) {
$output = helpLink(9); $output = helpLink(9);
$output .= '<h1>'.WebGUI::International::get(157).'</h1>'; $output .= '<h1>'.WebGUI::International::get(157).'</h1>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addStyle">'.WebGUI::International::get(158).'</a></div>'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=addStyle').
'">'.WebGUI::International::get(158).'</a></div>';
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name"); $sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name");
while (@data = $sth->array) { while (@data = $sth->array) {
$row[$i] = '<tr><td valign="top" class="tableData"><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><a href="'.$session{page}{url}.'?op=copyStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/copy.gif" border=0></a></td>'; $row[$i] = '<tr><td valign="top" class="tableData"><a href="'.
WebGUI::URL::page('op=deleteStyle&sid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
WebGUI::URL::page('op=editStyle&sid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.
WebGUI::URL::page('op=copyStyle&sid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/copy.gif" border=0></a></td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td></tr>'; $row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td></tr>';
$i++; $i++;
} }
$sth->finish; $sth->finish;
($dataRows, $prevNextBar) = paginate(50,$session{page}{url}.'?op=listStyles',\@row); ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listStyles'),\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">'; $output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $dataRows; $output .= $dataRows;
$output .= '</table>'; $output .= '</table>';

View file

@ -16,6 +16,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm); our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm);
@ -50,8 +51,10 @@ sub www_purgeTrash {
$output = helpLink(46); $output = helpLink(46);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(162).'<p>'; $output .= WebGUI::International::get(162).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=purgeTrashConfirm">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=purgeTrashConfirm').
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>'; '">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'.
WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();

View file

@ -21,6 +21,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -122,8 +123,11 @@ sub www_deleteUser {
$output .= helpLink(7); $output .= helpLink(7);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(167).'<p>'; $output .= WebGUI::International::get(167).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteUserConfirm&uid='.$session{form}{uid}.'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(45).'</a></div>'; WebGUI::URL::page('op=deleteUserConfirm&uid='.$session{form}{uid}).
'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('op=listUsers').'">'.
WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();
@ -250,11 +254,11 @@ sub www_editUser {
$output .= '<table><tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>'; $output .= '<table><tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
$sth = WebGUI::SQL->read("select groups.groupId,groups.groupName,groupings.expireDate from groupings,groups where groupings.groupId=groups.groupId and groupings.userId=$session{form}{uid} order by groups.groupName"); $sth = WebGUI::SQL->read("select groups.groupId,groups.groupName,groupings.expireDate from groupings,groups where groupings.groupId=groups.groupId and groupings.userId=$session{form}{uid} order by groups.groupName");
while (%hash = $sth->hash) { while (%hash = $sth->hash) {
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='. $output .= '<tr><td><a href="'.WebGUI::URL::page('op=deleteGrouping&uid='.
$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'. $session{form}{uid}.'&gid='.$hash{groupId}).'"><img src="'.
$session{setting}{lib}.'/delete.gif" border=0></a><a href="'. $session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
$session{page}{url}.'?op=editGrouping&uid='.$session{form}{uid}. WebGUI::URL::page('op=editGrouping&uid='.$session{form}{uid}.
'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}. '&gid='.$hash{groupId}).'"><img src="'.$session{setting}{lib}.
'/edit.gif" border=0></a></td>'; '/edit.gif" border=0></a></td>';
$output .= '<td class="tableData">'.$hash{groupName}.'</td>'; $output .= '<td class="tableData">'.$hash{groupName}.'</td>';
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>'; $output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
@ -312,7 +316,7 @@ sub www_listUsers {
$output = helpLink(8); $output = helpLink(8);
$output .= '<h1>'.WebGUI::International::get(149).'</h1>'; $output .= '<h1>'.WebGUI::International::get(149).'</h1>';
$output .= '<table class="tableData" align="center" width="75%"><tr><td>'; $output .= '<table class="tableData" align="center" width="75%"><tr><td>';
$output .= '<a href="'.$session{page}{url}.'?op=addUser">'.WebGUI::International::get(169).'</a>'; $output .= '<a href="'.WebGUI::URL::page('op=addUser').'">'.WebGUI::International::get(169).'</a>';
$output .= '</td>'.formHeader().'<td align="right">'; $output .= '</td>'.formHeader().'<td align="right">';
$output .= WebGUI::Form::hidden("op","listUsers"); $output .= WebGUI::Form::hidden("op","listUsers");
$output .= WebGUI::Form::text("keyword",20,50); $output .= WebGUI::Form::text("keyword",20,50);
@ -324,17 +328,21 @@ sub www_listUsers {
$sth = WebGUI::SQL->read("select userId,username,email from users where username<>'Reserved' $search order by username"); $sth = WebGUI::SQL->read("select userId,username,email from users where username<>'Reserved' $search order by username");
while (@data = $sth->array) { while (@data = $sth->array) {
$row[$i] = '<tr class="tableData"><td>'; $row[$i] = '<tr class="tableData"><td>';
$row[$i] .= '<a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>'; $row[$i] .= '<a href="'.WebGUI::URL::page('op=deleteUser&uid='.$data[0]).
$row[$i] .= '<a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>'; '"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>';
$row[$i] .= '<a href="'.$session{page}{url}.'?op=becomeUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/become.gif" border=0></a>'; $row[$i] .= '<a href="'.WebGUI::URL::page('op=editUser&uid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>';
$row[$i] .= '<a href="'.WebGUI::URL::page('op=becomeUser&uid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/become.gif" border=0></a>';
$row[$i] .= '</td>'; $row[$i] .= '</td>';
$row[$i] .= '<td><a href="'.$session{page}{url}.'?op=viewProfile&uid='.$data[0].'">'.$data[1].'</a></td>'; $row[$i] .= '<td><a href="'.WebGUI::URL::page('?op=viewProfile&uid='.$data[0])
.'">'.$data[1].'</a></td>';
#$row[$i] .= '<td>'.$data[1].'</td>'; #$row[$i] .= '<td>'.$data[1].'</td>';
$row[$i] .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>'; $row[$i] .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
$i++; $i++;
} }
$sth->finish; $sth->finish;
($dataRows, $prevNextBar) = paginate(50,$session{page}{url}.'?op=listUsers',\@row); ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('?op=listUsers'),\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">'; $output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $dataRows; $output .= $dataRows;
$output .= '</table>'; $output .= '</table>';

View file

@ -13,6 +13,7 @@ package WebGUI::Privilege;
use strict; use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::International; use WebGUI::International;
use WebGUI::Operation::Account ();
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
@ -71,10 +72,14 @@ sub canViewPage {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub insufficient { sub insufficient {
my ($output); my ($output);
$output = '<h1>'.WebGUI::International::get(37).'</h1>'; if ($session{user}{userId} == 1) {
$output .= WebGUI::International::get(38); $output = WebGUI::Operation::Account();
$output .= '<p>'; } else {
$output = WebGUI::Macro::process($output); $output = '<h1>'.WebGUI::International::get(37).'</h1>';
$output .= WebGUI::International::get(38);
$output .= '<p>';
$output = WebGUI::Macro::process($output);
}
return $output; return $output;
} }

View file

@ -146,7 +146,7 @@ sub open {
sub refreshPageInfo { sub refreshPageInfo {
my (%PAGE); my (%PAGE);
tie %PAGE, 'Tie::CPHash'; tie %PAGE, 'Tie::CPHash';
%PAGE = _getPageInfo($_[0],$session{dbh},$session{setting}{notFoundPage}); %PAGE = _getPageInfo($_[0],$session{dbh},$session{setting}{notFoundPage},$session{config}{scripturl});
$session{page} = \%PAGE; $session{page} = \%PAGE;
} }

View file

@ -15,6 +15,7 @@ use strict;
use WebGUI::Attachment; use WebGUI::Attachment;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&attachmentBox &formHeader &formSave &tableFormRow &helpLink); our @EXPORT = qw(&attachmentBox &formHeader &formSave &tableFormRow &helpLink);
@ -44,7 +45,7 @@ sub attachmentBox {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub formHeader { sub formHeader {
my ($output); my ($output);
$output = '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">'; $output = '<form method="post" enctype="multipart/form-data" action="'.WebGUI::URL::page().'">';
return $output; return $output;
} }
@ -59,7 +60,7 @@ sub formSave {
sub helpLink { sub helpLink {
my ($output, $namespace); my ($output, $namespace);
$namespace = $_[1] || "WebGUI"; $namespace = $_[1] || "WebGUI";
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid='.$_[0].'&namespace='.$namespace. $output = '<a href="'.WebGUI::URL::page('op=viewHelp&hid='.$_[0].'&namespace='.$namespace).
'" target="_blank"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>'; '" target="_blank"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
return $output; return $output;
} }

View file

@ -28,7 +28,7 @@ sub getStyle {
} else { } else {
tie %style, 'Tie::CPHash'; tie %style, 'Tie::CPHash';
%style = WebGUI::SQL->quickHash("select header,footer,styleSheet from style where styleId=$session{page}{styleId}"); %style = WebGUI::SQL->quickHash("select header,footer,styleSheet from style where styleId=$session{page}{styleId}");
$header = '<!-- WebGUI '.$WebGUI::VERSION.' --> $header = $session{setting}{docTypeDec}."\n".'<!-- WebGUI '.$WebGUI::VERSION.' -->
<html> <html>
<head> <head>
<title>'; <title>';

65
lib/WebGUI/URL.pm Normal file
View file

@ -0,0 +1,65 @@
package WebGUI::URL;
#-------------------------------------------------------------------
# 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 WebGUI::Session;
use WebGUI::Utility;
#-------------------------------------------------------------------
sub append {
my ($url);
$url = $_[0];
if ($url =~ /\?/) {
$url .= '&'.$_[1];
} else {
$url .= '?'.$_[1];
}
return $url;
}
#-------------------------------------------------------------------
sub gateway {
my ($url);
$url = $session{config}{scripturl}.'/'.$_[0];
if ($_[1]) {
$url = append($url,$_[1]);
}
if ($session{setting}{preventProxyCache} == 1) {
$url = append($url,randint(0,1000).';'.time());
}
return $url;
}
#-------------------------------------------------------------------
sub page {
my ($url);
$url = $session{page}{url};
if ($_[0]) {
$url = append($url,$_[0]);
}
if ($session{setting}{preventProxyCache} == 1) {
$url = append($url,randint(0,1000).';'.time());
}
return $url;
}
#-------------------------------------------------------------------
sub urlize {
my ($title);
$title = lc($_[0]);
$title =~ s/ /_/g;
$title =~ s/[^a-z0-9\-\.\_]//g;
return $title;
}
1;

View file

@ -16,21 +16,11 @@ use Tie::IxHash;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&sortHashDescending &sortHash &paginate &appendToUrl &randint &round &urlize); our @EXPORT = qw(&sortByColumn &sortHashDescending &sortHash
&paginate &randint &round);
#-------------------------------------------------------------------
sub appendToUrl {
my ($url);
$url = $_[0];
if ($url =~ /\?/) {
$url .= '&'.$_[1];
} else {
$url .= '?'.$_[1];
}
return $url;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub paginate { sub paginate {
@ -46,19 +36,23 @@ sub paginate {
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) { for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
$dataRows .= $row[$i]; $dataRows .= $row[$i];
} }
$prevNextBar = '<div class="pagination">'; if ($#row+1 > $itemsPerPage) {
if ($pn > 0) { $prevNextBar = '<div class="pagination">';
$prevNextBar .= '<a href="'.appendToUrl($url,('pn='.($pn-1))).'">&laquo;'.WebGUI::International::get(91).'</a>'; if ($pn > 0) {
} else { $prevNextBar .= '<a href="'.WebGUI::URL::append($url,('pn='.($pn-1))).'">&laquo;'.
$prevNextBar .= '&laquo;'.WebGUI::International::get(91); WebGUI::International::get(91).'</a>';
} else {
$prevNextBar .= '&laquo;'.WebGUI::International::get(91);
}
$prevNextBar .= ' &middot; ';
if (($pn+1) < (($#row+1)/$itemsPerPage)) {
$prevNextBar .= '<a href="'.WebGUI::URL::append($url,('pn='.($pn+1))).'">'.
WebGUI::International::get(92).'&raquo;</a>';
} else {
$prevNextBar .= WebGUI::International::get(92).'&raquo;';
}
$prevNextBar .= '</div>';
} }
$prevNextBar .= ' &middot; ';
if (($pn+1) < (($#row+1)/$itemsPerPage)) {
$prevNextBar .= '<a href="'.appendToUrl($url,('pn='.($pn+1))).'">'.WebGUI::International::get(92).'&raquo;</a>';
} else {
$prevNextBar .= WebGUI::International::get(92).'&raquo;';
}
$prevNextBar .= '</div>';
return ($dataRows, $prevNextBar); return ($dataRows, $prevNextBar);
} }
@ -76,6 +70,27 @@ sub round {
return sprintf("%.0f", $_[0]); return sprintf("%.0f", $_[0]);
} }
#-------------------------------------------------------------------
# example: sortByColumn(columnToSort,columnLabel);
sub sortByColumn {
my ($output);
$output = '<a href="'.WebGUI::URL::page('sort='.$_[0].'&sortDirection=');
if ($session{form}{sortDirection} eq "asc") {
$output .= "desc";
} else {
$output .= "asc";
}
$output .= '">'.$_[1].'</a>';
if ($session{form}{sort} eq $_[0]) {
if ($session{form}{sortDirection} eq "desc") {
$output .= ' <img src="'.$session{setting}{lib}.'/desc.gif">';
} else {
$output .= ' <img src="'.$session{setting}{lib}.'/asc.gif">';
}
}
return $output;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub sortHash { sub sortHash {
my (%hash, %reversedHash, %newHash, $key); my (%hash, %reversedHash, %newHash, $key);
@ -106,14 +121,6 @@ sub sortHashDescending {
return %reversedHash; return %reversedHash;
} }
#-------------------------------------------------------------------
sub urlize {
my ($title);
$title = lc($_[0]);
$title =~ s/ /_/g;
$title =~ s/[^a-z0-9\-\.\_]//g;
return $title;
}
1; 1;

View file

@ -20,6 +20,7 @@ use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::Template; use WebGUI::Template;
use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&getProperties &purgeWidget &www_jumpDown &www_jumpUp &update &www_moveUp &www_moveDown &www_delete &www_deleteConfirm &www_cut &create &www_paste); our @EXPORT = qw(&getProperties &purgeWidget &www_jumpDown &www_jumpUp &update &www_moveUp &www_moveDown &www_delete &www_deleteConfirm &www_cut &create &www_paste);
@ -87,14 +88,16 @@ sub www_cut {
sub www_delete { sub www_delete {
my ($output); my ($output);
if (WebGUI::Privilege::canEditPage()) { if (WebGUI::Privilege::canEditPage()) {
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=14"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>'; $output = '<a href="'.WebGUI::URL::page('op=viewHelp&hid=14').'"><img src="'.
$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(43); $output .= WebGUI::International::get(43);
$output .= '<p>'; $output .= '<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteConfirm&wid='.$session{form}{wid}.'">'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('func=deleteConfirm&wid='.
$session{form}{wid}).'">';
$output .= WebGUI::International::get(44); $output .= WebGUI::International::get(44);
$output .= '</a>'; $output .= '</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'">'; $output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">';
$output .= WebGUI::International::get(45); $output .= WebGUI::International::get(45);
$output .= '</a></div>'; $output .= '</a></div>';
return $output; return $output;

View file

@ -22,6 +22,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget; use WebGUI::Widget;
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -154,7 +155,9 @@ sub www_edit {
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("endDate",20,30,epochToSet($data{endDate}),1)); $output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("endDate",20,30,epochToSet($data{endDate}),1));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::textArea("body",$data{body},50,10,1)); $output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::textArea("body",$data{body},50,10,1));
if ($data{image} ne "") { if ($data{image} ne "") {
$output .= tableFormRow(WebGUI::International::get(6,$namespace),'<a href="'.$session{page}{url}.'?func=deleteImage&wid='.$session{form}{wid}.'">'.WebGUI::International::get(13,$namespace).'</a>'); $output .= tableFormRow(WebGUI::International::get(6,$namespace),'<a href="'.
WebGUI::URL::page('func=deleteImage&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(13,$namespace).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::file("image")); $output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::file("image"));
} }
@ -169,7 +172,9 @@ sub www_edit {
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("linkTitle",20,128,$data{linkTitle})); $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})); $output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("linkURL",20,2048,$data{linkURL}));
if ($data{attachment} ne "") { if ($data{attachment} ne "") {
$output .= tableFormRow(WebGUI::International::get(9,$namespace),'<a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'">'.WebGUI::International::get(13,$namespace).'</a>'); $output .= tableFormRow(WebGUI::International::get(9,$namespace),'<a href="'.
WebGUI::URL::page('func=deleteAttachment&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(13,$namespace).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(9,$namespace),WebGUI::Form::file("attachment")); $output .= tableFormRow(WebGUI::International::get(9,$namespace),WebGUI::Form::file("attachment"));
} }

View file

@ -22,6 +22,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
use WebGUI::Widget; use WebGUI::Widget;
@ -254,12 +255,10 @@ sub www_deleteDownload {
$output = '<h1>'.WebGUI::International::get(42).'</h1>'; $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(12,$namespace).'<p>'; $output .= WebGUI::International::get(12,$namespace).'<p>';
$output .= '<div align="center">'. $output .= '<div align="center">'.
'<a href="'.$session{page}{url}. '<a href="'.WebGUI::URL::page('func=deleteDownloadConfirm&wid='.
'?func=deleteDownloadConfirm&wid='. $session{form}{wid}.'&did='.$session{form}{did}).'">'.
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
WebGUI::International::get(44).'</a>'; WebGUI::International::get(44).'</a>';
$output .= ' &nbsp; <a href="'.$session{page}{url}. $output .= ' &nbsp; <a href="'.WebGUI::URL::page('func=edit&wid='.$session{form}{wid}).'">'.
'?func=edit&wid='.$session{form}{wid}.'">'.
WebGUI::International::get(45).'</a></div>'; WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
@ -337,24 +336,23 @@ sub www_edit {
); );
$output .= formSave(); $output .= formSave();
$output .= '</table></form>'; $output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addDownload&wid='. $output .= '<p><a href="'.WebGUI::URL::page('func=addDownload&wid='.$session{form}{wid})
$session{form}{wid}.'">'.WebGUI::International::get(11,$namespace).'</a><p>'; .'">'.WebGUI::International::get(11,$namespace).'</a><p>';
$output .= '<table border=1 cellpadding=3 cellspacing=0>'; $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"); $sth = WebGUI::SQL->read("select downloadId,fileTitle from DownloadManager_file where widgetId='$session{form}{wid}' order by sequenceNumber");
while (@download = $sth->array) { while (@download = $sth->array) {
$output .= '<tr><td><a href="'.$session{page}{url}. $output .= '<tr><td><a href="'.
'?func=editDownload&wid='.$session{form}{wid}. WebGUI::URL::page('func=editDownload&wid='.$session{form}{wid}.'&did='.$download[0])
'&did='.$download[0].'"><img src="'. .'"><img src="'.
$session{setting}{lib}.'/edit.gif" border=0></a><a href="'. $session{setting}{lib}.'/edit.gif" border=0></a><a href="'.
$session{page}{url}.'?func=deleteDownload&wid='. WebGUI::URL::page('func=deleteDownload&wid='.$session{form}{wid}.'&did='.$download[0])
$session{form}{wid}.'&did='.$download[0].'"><img src="'. .'"><img src="'.
$session{setting}{lib}.'/delete.gif" border=0></a><a href="'. $session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
$session{page}{url}.'?func=moveDownloadUp&wid='. WebGUI::URL::page('func=moveDownloadUp&wid='.$session{form}{wid}.'&did='.$download[0])
$session{form}{wid}.'&did='.$download[0].'"><img src="'. .'"><img src="'.
$session{setting}{lib}.'/upArrow.gif" border=0></a><a href="'. $session{setting}{lib}.'/upArrow.gif" border=0></a><a href="'.
$session{page}{url}.'?func=moveDownloadDown&wid='. WebGUI::URL::page('func=moveDownloadDown&wid='.$session{form}{wid}.'&did='.$download[0])
$session{form}{wid}.'&did='.$download[0]. .'"><img src="'.$session{setting}{lib}.
'"><img src="'.$session{setting}{lib}.
'/downArrow.gif" border=0></a></td><td>'.$download[1].'</td><tr>'; '/downArrow.gif" border=0></a></td><td>'.$download[1].'</td><tr>';
} }
$sth->finish; $sth->finish;
@ -391,8 +389,8 @@ sub www_editDownload {
if ($download{downloadFile} ne "") { if ($download{downloadFile} ne "") {
$output .= tableFormRow( $output .= tableFormRow(
WebGUI::International::get(6,$namespace), WebGUI::International::get(6,$namespace),
'<a href="'.$session{page}{url}.'?func=deleteFile&wid='. '<a href="'.WebGUI::URL::page('func=deleteFile&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'. $session{form}{wid}.'&did='.$session{form}{did}).'">'.
WebGUI::International::get(13,$namespace).'</a> WebGUI::International::get(13,$namespace).'</a>
'); ');
} else { } else {
@ -404,8 +402,8 @@ sub www_editDownload {
if ($download{alternateVersion1} ne "") { if ($download{alternateVersion1} ne "") {
$output .= tableFormRow( $output .= tableFormRow(
WebGUI::International::get(17,$namespace), WebGUI::International::get(17,$namespace),
'<a href="'.$session{page}{url}.'?func=deleteFile&alt=1&wid='. '<a href="'.WebGUI::URL::page('func=deleteFile&alt=1&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'. $session{form}{wid}.'&did='.$session{form}{did}).'">'.
WebGUI::International::get(13,$namespace).'</a> WebGUI::International::get(13,$namespace).'</a>
'); ');
} else { } else {
@ -417,8 +415,8 @@ sub www_editDownload {
if ($download{alternateVersion2} ne "") { if ($download{alternateVersion2} ne "") {
$output .= tableFormRow( $output .= tableFormRow(
WebGUI::International::get(18,$namespace), WebGUI::International::get(18,$namespace),
'<a href="'.$session{page}{url}.'?func=deleteFile&alt=2&wid='. '<a href="'.WebGUI::URL::page('func=deleteFile&alt=2&wid='.
$session{form}{wid}.'&did='.$session{form}{did}.'">'. $session{form}{wid}.'&did='.$session{form}{did}).'">'.
WebGUI::International::get(13,$namespace).'</a> WebGUI::International::get(13,$namespace).'</a>
'); ');
} else { } else {
@ -513,41 +511,69 @@ sub www_moveDownloadUp {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_view { sub www_view {
my (@row, $i, $dataRows, $prevNextBar, %data, @test, %fileType, $output, $sth, %download, $flag); my ($url, @row, $i, $dataRows, $search, $prevNextBar, %data, @test, %fileType, $output, $sth,
%download, $flag, $sort, $sortDirection);
tie %download, 'Tie::CPHash'; tie %download, 'Tie::CPHash';
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]); %data = getProperties($namespace,$_[0]);
if (defined %data) { if (defined %data) {
$url = WebGUI::URL::page();
if ($data{displayTitle} == 1) { if ($data{displayTitle} == 1) {
$output .= '<h1>'.$data{title}.'</h1>'; $output .= '<h1>'.$data{title}.'</h1>';
} }
if ($data{description} ne "") { if ($data{description} ne "") {
$output .= $data{description}.'<p>'; $output .= $data{description}.'<p>';
} }
$output .= formHeader();
$output .= WebGUI::Form::text("keyword",20,50);
$output .= WebGUI::Form::submit(WebGUI::International::get(170));
$output .= '</form>';
$output .= '<table cellpadding="3" cellspacing="1" border="0" width="100%">'; $output .= '<table cellpadding="3" cellspacing="1" border="0" width="100%">';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(14,$namespace). if ($session{form}{keyword} ne "") {
'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace). $search = " and (fileTitle like '%".$session{form}{keyword}.
'</td><td class="tableHeader">'.WebGUI::International::get(16,$namespace).'</td></tr>'; "%' or downloadFile like '%".$session{form}{keyword}.
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0] order by sequenceNumber"); "%' or alternateVersion1 like '%".$session{form}{keyword}.
"%' or alternateVersion2 like '%".$session{form}{keyword}.
"%' or briefSynopsis like '%".$session{form}{keyword}."%') ";
$url = WebGUI::URL::append($url,"keyword=".$session{form}{keyword});
}
if ($session{form}{sort} ne "") {
$sort = " order by ".$session{form}{sort};
$url = WebGUI::URL::append($url,"sort=".$session{form}{sort});
} else {
$sort = " order by sequenceNumber";
}
if ($session{form}{sortDirection} ne "") {
$sortDirection = $session{form}{sortDirection};
$url = WebGUI::URL::append($url,"sortDirection=".$session{form}{sortDirection});
}
$output .= '<tr><td class="tableHeader">'.
sortByColumn("fileTitle",WebGUI::International::get(14,$namespace)).
'</td><td class="tableHeader">'.
sortByColumn("briefSynopsis",WebGUI::International::get(15,$namespace)).
'</td><td class="tableHeader">'.
sortByColumn("dateUploaded",WebGUI::International::get(16,$namespace)).
'</td></tr>';
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0] $search $sort $sortDirection");
while (%download = $sth->hash) { while (%download = $sth->hash) {
if (WebGUI::Privilege::isInGroup($download{groupToView})) { if (WebGUI::Privilege::isInGroup($download{groupToView})) {
%fileType = WebGUI::Attachment::getType($download{downloadFile}); %fileType = WebGUI::Attachment::getType($download{downloadFile});
$row[$i] = '<tr><td class="tableData" valign="top">'; $row[$i] = '<tr><td class="tableData" valign="top">';
$row[$i] .= '<a href="'.$session{page}{url}.'?func=download&wid='.$_[0]. $row[$i] .= '<a href="'.WebGUI::URL::page('func=download&wid='.$_[0].
'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}. '&did='.$download{downloadId}).'"><img src="'.$fileType{icon}.
'" border=0 width=16 height=16 align="middle">'. '" border=0 width=16 height=16 align="middle">'.
$download{fileTitle}.' ('.$fileType{extension}.')</a>'; $download{fileTitle}.' ('.$fileType{extension}.')</a>';
if ($download{alternateVersion1}) { if ($download{alternateVersion1}) {
%fileType = WebGUI::Attachment::getType($download{alternateVersion1}); %fileType = WebGUI::Attachment::getType($download{alternateVersion1});
$row[$i] .= ' &middot; <a href="'.$session{page}{url}.'?func=download&wid='. $row[$i] .= ' &middot; <a href="'.WebGUI::URL::page('func=download&wid='.
$_[0].'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}. $_[0].'&did='.$download{downloadId}).'"><img src="'.$fileType{icon}.
'" border=0 width=16 height=16 align="middle">('. '" border=0 width=16 height=16 align="middle">('.
$fileType{extension}.')</a>'; $fileType{extension}.')</a>';
} }
if ($download{alternateVersion2}) { if ($download{alternateVersion2}) {
%fileType = WebGUI::Attachment::getType($download{alternateVersion2}); %fileType = WebGUI::Attachment::getType($download{alternateVersion2});
$row[$i] .= ' &middot; <a href="'.$session{page}{url}.'?func=download&wid='. $row[$i] .= ' &middot; <a href="'.WebGUI::URL::page('func=download&wid='.
$_[0].'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}. $_[0].'&did='.$download{downloadId}).'"><img src="'.$fileType{icon}.
'" border=0 width=16 height=16 align="middle">('. '" border=0 width=16 height=16 align="middle">('.
$fileType{extension}.')</a>'; $fileType{extension}.')</a>';
} }
@ -564,7 +590,7 @@ sub www_view {
$output .= '<tr><td class="tableData" colspan="3">'. $output .= '<tr><td class="tableData" colspan="3">'.
WebGUI::International::get(19,$namespace).'</td></tr>'; WebGUI::International::get(19,$namespace).'</td></tr>';
} }
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row); ($dataRows, $prevNextBar) = paginate($data{paginateAfter},$url,\@row);
$output .= $dataRows; $output .= $dataRows;
$output .= '</table>'; $output .= '</table>';
$output .= $prevNextBar; $output .= $prevNextBar;

View file

@ -13,6 +13,7 @@ our $namespace = "EventsCalendar";
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use HTML::CalendarMonthSimple;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::International; use WebGUI::International;
@ -21,8 +22,47 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Widget; use WebGUI::Widget;
#-------------------------------------------------------------------
sub _calendarLayout {
my ($thisMonth, $calendar, $start, $end, $sth, %event, $nextDate);
$thisMonth = epochToHuman($_[1],"%M %y");
$calendar = new HTML::CalendarMonthSimple('year'=>epochToHuman($_[1],"%y"),'month'=>epochToHuman($_[1],"%M"));
$calendar->width("100%");
$calendar->border(1);
$calendar->cellclass("tableData");
$calendar->todaycellclass("tableHeader");
$calendar->headerclass("tableHeader");
($start,$end) = monthStartEnd($_[1]);
$sth = WebGUI::SQL->read("select name, description, startDate, endDate from EventsCalendar_event where widgetId='$_[0]' order by startDate,endDate");
while (%event = $sth->hash) {
if (epochToHuman($event{startDate},"%M %y") eq $thisMonth ||
epochToHuman($event{endDate},"%M %y") eq $thisMonth) {
if ($event{startDate} == $event{endDate}) {
$calendar->addcontent(epochToHuman($event{startDate},"%D"),
'<a href=\'javascript:popUp("'.$event{description}.'");\'>'.
$event{name}.'</a><br>');
} else {
$nextDate = $event{startDate};
while($nextDate < $event{endDate}) {
if (epochToHuman($nextDate,"%M %y") eq $thisMonth) {
$calendar->addcontent(epochToHuman($nextDate,"%D"),
'<a href=\'javascript:popUp("'.
$event{description}
.'");\'>'.$event{name}.'</a><br>');
}
$nextDate = addToDate($nextDate,0,0,1);
}
}
}
}
$sth->finish;
return '<script language="JavaScript">function popUp(message) { alert(message); }</script>'.$calendar->as_HTML;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub duplicate { sub duplicate {
my ($sth, %data, $newWidgetId, $pageId, @row, $newEventId, $previousRecurringEventId); my ($sth, %data, $newWidgetId, $pageId, @row, $newEventId, $previousRecurringEventId);
@ -200,7 +240,12 @@ sub www_deleteEvent {
if ($session{form}{rid} > 0) { if ($session{form}{rid} > 0) {
$output .= ' '.WebGUI::International::get(11,$namespace); $output .= ' '.WebGUI::International::get(11,$namespace);
} }
$output .= '?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteEventConfirm&wid='.$session{form}{wid}.'&eid='.$session{form}{eid}.'&rid='.$session{form}{rid}.'">'.WebGUI::International::get(44).'</a> &nbsp; <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>'; $output .= '?<p><div align="center"><a href="'.
WebGUI::URL::page('func=deleteEventConfirm&wid='.$session{form}{wid}.
'&eid='.$session{form}{eid}.'&rid='.$session{form}{rid}).'">'.
WebGUI::International::get(44).'</a> &nbsp; <a href="'.
WebGUI::URL::page('func=edit&wid='.$session{form}{wid}).'">'.
WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -255,11 +300,16 @@ sub www_edit {
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter})); WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter}));
$output .= formSave(); $output .= formSave();
$output .= '</table></form>'; $output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addEvent&wid='.$session{form}{wid}.'">Add New Event</a><p>'; $output .= '<p><a href="'.WebGUI::URL::page('func=addEvent&wid='.$session{form}{wid})
.'">Add New Event</a><p>';
$output .= '<table border=1 cellpadding=3 cellspacing=0>'; $output .= '<table border=1 cellpadding=3 cellspacing=0>';
$sth = WebGUI::SQL->read("select eventId, name, recurringEventId from EventsCalendar_event where widgetId='$session{form}{wid}' order by startDate"); $sth = WebGUI::SQL->read("select eventId, name, recurringEventId from EventsCalendar_event where widgetId='$session{form}{wid}' order by startDate");
while (@event = $sth->array) { while (@event = $sth->array) {
$output .= '<tr><td><a href="'.$session{page}{url}.'?func=editEvent&wid='.$session{form}{wid}.'&eid='.$event[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?func=deleteEvent&wid='.$session{form}{wid}.'&eid='.$event[0].'&rid='.$event[2].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a></td><td>'.$event[1].'</td></td>'; $output .= '<tr><td><a href="'.WebGUI::URL::page('func=editEvent&wid='.$session{form}{wid}.
'&eid='.$event[0]).'"><img src="'.$session{setting}{lib}.
'/edit.gif" border=0></a><a href="'.WebGUI::URL::page('func=deleteEvent&wid='.
$session{form}{wid}.'&eid='.$event[0].'&rid='.$event[2]).'"><img src="'.
$session{setting}{lib}.'/delete.gif" border=0></a></td><td>'.$event[1].'</td></td>';
} }
$sth->finish; $sth->finish;
$output .= '</table>'; $output .= '</table>';
@ -322,8 +372,11 @@ sub www_editEventSave {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_view { sub www_view {
my (%data, @event, $output, $sth, $flag, @previous); my (%data, %event, $dataRows, $prevNextBar, $output, $sth, $flag, %previous,
@row, $i, $maxDate, $minDate, $nextDate, $defaultPn);
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
tie %event, 'Tie::CPHash';
tie %previous, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]); %data = getProperties($namespace,$_[0]);
if (defined %data) { if (defined %data) {
if ($data{displayTitle}) { if ($data{displayTitle}) {
@ -332,34 +385,53 @@ sub www_view {
if ($data{description} ne "") { if ($data{description} ne "") {
$output .= $data{description}.'<p>'; $output .= $data{description}.'<p>';
} }
$sth = WebGUI::SQL->read("select name, description, startDate, endDate from EventsCalendar_event where widgetId='$_[0]' and endDate>".(time()-86400)." order by startDate,endDate"); ($minDate) = WebGUI::SQL->quickArray("select min(startDate) from EventsCalendar_event where widgetId=$_[0]");
while (@event = $sth->array) { ($maxDate) = WebGUI::SQL->quickArray("select max(endDate) from EventsCalendar_event where widgetId=$_[0]");
unless ($event[2] == $previous[0] && $event[3] == $previous[1]) { if ($data{calendarLayout} eq "calendar") {
$output .= "<b>".epochToHuman($event[2],"%c")." ".epochToHuman($event[2],"%D"); $nextDate = $minDate;
if (epochToHuman($event[2],"%y") ne epochToHuman($event[3],"%y")) { while ($nextDate < $maxDate) {
$output .= ", ".epochToHuman($event[2],"%y"); $row[$i] = _calendarLayout($_[0],$nextDate);
$flag = 1; if ($session{form}{pn} eq "" && $nextDate <= time()) {
$defaultPn = $i;
} }
if ($flag || epochToHuman($event[2],"%c") ne epochToHuman($event[3],"%c")) { $i++;
$output .= " - ".epochToHuman($event[3],"%c"); $nextDate = addToDate($nextDate,0,1,0);
$output .= " ".epochToHuman($event[3],"%D"); }
} elsif (epochToHuman($event[2],"%D") ne epochToHuman($event[3],"%D")) { if ($session{form}{pn} eq "") {
$output .= " - ".epochToHuman($event[3],"%D"); $session{form}{pn} = $defaultPn;
}
($dataRows, $prevNextBar) = paginate(1,WebGUI::URL::page(),\@row);
$output .= $prevNextBar.$dataRows.$prevNextBar;
} else {
$sth = WebGUI::SQL->read("select name, description, startDate, endDate from EventsCalendar_event where widgetId='$_[0]' and endDate>".(time()-86400)." order by startDate,endDate");
while (%event = $sth->hash) {
unless ($event{startDate} == $previous{startDate}
&& $event{endDate} == $previous{endDate}) {
$output .= "<b>".epochToHuman($event{startDate},"%c %D");
if (epochToHuman($event{startDate},"%y") ne epochToHuman($event{endDate},"%y")) {
$output .= ", ".epochToHuman($event{startDate},"%y");
$flag = 1;
}
if ($flag || epochToHuman($event{startDate},"%c") ne epochToHuman($event{endDate},"%c")) {
$output .= " - ".epochToHuman($event{endDate},"%c %D");
} elsif (epochToHuman($event{startDate},"%D") ne epochToHuman($event{endDate},"%D")) {
$output .= " - ".epochToHuman($event{endDate},"%D");
}
$flag = 0;
$output .= ", ".epochToHuman($event{endDate},"%y");
$output .= "</b>";
$output .= "<hr size=1>";
} }
$flag = 0; %previous = %event;
$output .= ", ".epochToHuman($event[3],"%y"); $output .= '<span class="eventTitle">'.$event{name}.'</span>';
$output .= "</b>"; if ($event{description} ne "") {
$output .= "<hr size=1>"; $output .= ' - ';
$output .= ''.$event{description};
}
$output .= '<p>';
} }
@previous = ($event[2],$event[3]); $sth->finish;
$output .= '<span class="eventTitle">'.$event[0].'</span>';
if ($event[1] ne "") {
$output .= ' - ';
$output .= ''.$event[1];
}
$output .= '<p>';
} }
$sth->finish;
if ($data{processMacros}) { if ($data{processMacros}) {
$output = WebGUI::Macro::process($output); $output = WebGUI::Macro::process($output);
} }

View file

@ -27,8 +27,10 @@ sub duplicate {
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]); %data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId}; $pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition}); $newWidgetId = create($pageId,$namespace,$data{title},
WebGUI::SQL->write("insert into ExtraColumn values ($newWidgetId, '$data{spacer}', '$data{width}', ".quote($data{class}).")"); $data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into ExtraColumn values ($newWidgetId, '$data{spacer}', '$data{width}', ".
quote($data{class}).")");
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget; use WebGUI::Widget;
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -153,8 +154,11 @@ sub www_deleteQuestion {
if (WebGUI::Privilege::canEditPage()) { if (WebGUI::Privilege::canEditPage()) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>'; $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(7,$namespace).'<p>'; $output .= WebGUI::International::get(7,$namespace).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteQuestionConfirm&wid='.$session{form}{wid}.'&qid='.$session{form}{qid}.'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.
$output .= ' &nbsp; <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>'; WebGUI::URL::page('func=deleteQuestionConfirm&wid='.$session{form}{wid}.
'&qid='.$session{form}{qid}).'">'.WebGUI::International::get(44).'</a>';
$output .= ' &nbsp; <a href="'.WebGUI::URL::page('func=edit&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -187,19 +191,32 @@ sub www_edit {
$output .= WebGUI::Form::hidden("func","editSave"); $output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>'; $output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title})); $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(174),
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$data{processMacros})); WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
%hash = WebGUI::Widget::getPositions(); %hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition}; $array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array)); $output .= tableFormRow(WebGUI::International::get(363),
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},'','',1)); WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},'','',1));
$output .= formSave(); $output .= formSave();
$output .= '</table></form>'; $output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addQuestion&wid='.$session{form}{wid}.'">'.WebGUI::International::get(9,$namespace).'</a><p>'; $output .= '<p><a href="'.WebGUI::URL::page('func=addQuestion&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(9,$namespace).'</a><p>';
$output .= '<table border=1 cellpadding=3 cellspacing=0>'; $output .= '<table border=1 cellpadding=3 cellspacing=0>';
$sth = WebGUI::SQL->read("select questionId,question from FAQ_question where widgetId='$session{form}{wid}' order by sequenceNumber"); $sth = WebGUI::SQL->read("select questionId,question from FAQ_question where widgetId='$session{form}{wid}' order by sequenceNumber");
while (@question = $sth->array) { while (@question = $sth->array) {
$output .= '<tr><td><a href="'.$session{page}{url}.'?func=editQuestion&wid='.$session{form}{wid}.'&qid='.$question[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?func=deleteQuestion&wid='.$session{form}{wid}.'&qid='.$question[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?func=moveQuestionUp&wid='.$session{form}{wid}.'&qid='.$question[0].'"><img src="'.$session{setting}{lib}.'/upArrow.gif" border=0></a><a href="'.$session{page}{url}.'?func=moveQuestionDown&wid='.$session{form}{wid}.'&qid='.$question[0].'"><img src="'.$session{setting}{lib}.'/downArrow.gif" border=0></a></td><td>'.$question[1].'</td><tr>'; $output .= '<tr><td><a href="'.WebGUI::URL::page('func=editQuestion&wid='.$session{form}{wid}.
'&qid='.$question[0]).'"><img src="'.$session{setting}{lib}.
'/edit.gif" border=0></a><a href="'.WebGUI::URL::page('func=deleteQuestion&wid='.
$session{form}{wid}.'&qid='.$question[0]).'"><img src="'.$session{setting}{lib}.
'/delete.gif" border=0></a><a href="'.WebGUI::URL::page('func=moveQuestionUp&wid='.
$session{form}{wid}.'&qid='.$question[0]).'"><img src="'.$session{setting}{lib}.
'/upArrow.gif" border=0></a><a href="'.WebGUI::URL::page('func=moveQuestionDown&wid='.
$session{form}{wid}.'&qid='.$question[0]).'"><img src="'.$session{setting}{lib}.
'/downArrow.gif" border=0></a></td><td>'.$question[1].'</td><tr>';
} }
$sth->finish; $sth->finish;
$output .= '</table>'; $output .= '</table>';

View file

@ -21,6 +21,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget; use WebGUI::Widget;
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -29,9 +30,11 @@ sub duplicate {
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]); %data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId}; $pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition}); $newWidgetId = create($pageId,$namespace,$data{title},
$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId); WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId);
WebGUI::SQL->write("insert into Item values ($newWidgetId, ".quote($data{description}).", ".quote($data{linkURL}).", ".quote($data{attachment}).")"); WebGUI::SQL->write("insert into Item values ($newWidgetId, ".
quote($data{description}).", ".quote($data{linkURL}).", ".quote($data{attachment}).")");
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -118,16 +121,23 @@ sub www_edit {
$output .= WebGUI::Form::hidden("func","editSave"); $output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>'; $output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,30,$data{title})); $output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,30,$data{title}));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$data{processMacros})); $output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
%hash = WebGUI::Widget::getPositions(); %hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition}; $array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array)); $output .= tableFormRow(WebGUI::International::get(363),
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description})); WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::text("linkURL",20,2048,$data{linkURL})); $output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description}));
$output .= tableFormRow(WebGUI::International::get(1,$namespace),
WebGUI::Form::text("linkURL",20,2048,$data{linkURL}));
if ($data{attachment} ne "") { if ($data{attachment} ne "") {
$output .= tableFormRow(WebGUI::International::get(2,$namespace),'<a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'">'.WebGUI::International::get(3,$namespace).'</a>'); $output .= tableFormRow(WebGUI::International::get(2,$namespace),'<a href="'.
WebGUI::URL::page('func=deleteAttachment&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(3,$namespace).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(2,$namespace),WebGUI::Form::file("attachment")); $output .= tableFormRow(WebGUI::International::get(2,$namespace),
WebGUI::Form::file("attachment"));
} }
$output .= formSave(); $output .= formSave();
$output .= '</table></form>'; $output .= '</table></form>';

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget; use WebGUI::Widget;
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -158,8 +159,11 @@ sub www_deleteLink {
if (WebGUI::Privilege::canEditPage()) { if (WebGUI::Privilege::canEditPage()) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>'; $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(9,$namespace).'<p>'; $output .= WebGUI::International::get(9,$namespace).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid}.'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.
$output .= ' &nbsp; <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>'; WebGUI::URL::page('func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid})
.'">'.WebGUI::International::get(44).'</a>';
$output .= ' &nbsp; <a href="'.WebGUI::URL::page('func=edit&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -203,11 +207,20 @@ sub www_edit {
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("bullet",20,255,$data{bullet})); $output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("bullet",20,255,$data{bullet}));
$output .= formSave(); $output .= formSave();
$output .= '</table></form>'; $output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addLink&wid='.$session{form}{wid}.'">'.WebGUI::International::get(13,$namespace).'</a><p>'; $output .= '<p><a href="'.WebGUI::URL::page('func=addLink&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(13,$namespace).'</a><p>';
$output .= '<table border=1 cellpadding=3 cellspacing=0>'; $output .= '<table border=1 cellpadding=3 cellspacing=0>';
$sth = WebGUI::SQL->read("select linkId, name from LinkList_link where widgetId='$session{form}{wid}' order by sequenceNumber"); $sth = WebGUI::SQL->read("select linkId, name from LinkList_link where widgetId='$session{form}{wid}' order by sequenceNumber");
while (@link = $sth->array) { while (@link = $sth->array) {
$output .= '<tr><td><a href="'.$session{page}{url}.'?func=editLink&wid='.$session{form}{wid}.'&lid='.$link[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?func=deleteLink&wid='.$session{form}{wid}.'&lid='.$link[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?func=moveLinkUp&wid='.$session{form}{wid}.'&lid='.$link[0].'"><img src="'.$session{setting}{lib}.'/upArrow.gif" border=0></a><a href="'.$session{page}{url}.'?func=moveLinkDown&wid='.$session{form}{wid}.'&lid='.$link[0].'"><img src="'.$session{setting}{lib}.'/downArrow.gif" border=0></a></td><td>'.$link[1].'</td></tr>'; $output .= '<tr><td><a href="'.WebGUI::URL::page('func=editLink&wid='.$session{form}{wid}.
'&lid='.$link[0]).'"><img src="'.$session{setting}{lib}.
'/edit.gif" border=0></a><a href="'.WebGUI::URL::page('func=deleteLink&wid='.
$session{form}{wid}.'&lid='.$link[0]).'"><img src="'.$session{setting}{lib}.
'/delete.gif" border=0></a><a href="'.WebGUI::URL::page('func=moveLinkUp&wid='.
$session{form}{wid}.'&lid='.$link[0]).'"><img src="'.$session{setting}{lib}.
'/upArrow.gif" border=0></a><a href="'.WebGUI::URL::page('func=moveLinkDown&wid='.
$session{form}{wid}.'&lid='.$link[0]).'"><img src="'.$session{setting}{lib}.
'/downArrow.gif" border=0></a></td><td>'.$link[1].'</td></tr>';
} }
$sth->finish; $sth->finish;
$output .= '</table>'; $output .= '</table>';

View file

@ -22,6 +22,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
use WebGUI::Widget; use WebGUI::Widget;
@ -31,7 +32,8 @@ sub duplicate {
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]); %data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId}; $pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition}); $newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},
$data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into MessageBoard values ($newWidgetId, $data{groupToPost}, '$data{messagesPerPage}', '$data{editTimeout}')"); WebGUI::SQL->write("insert into MessageBoard values ($newWidgetId, $data{groupToPost}, '$data{messagesPerPage}', '$data{editTimeout}')");
WebGUI::Discussion::duplicate($_[0],$newWidgetId); WebGUI::Discussion::duplicate($_[0],$newWidgetId);
} }
@ -65,9 +67,12 @@ sub www_add {
%hash = WebGUI::Widget::getPositions(); %hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363), $output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash)); WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1)); $output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",'',50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace), $output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::groupList("groupToPost",2)); WebGUI::Form::groupList("groupToPost",2));
$output .= tableFormRow(WebGUI::International::get(21,$namespace),
WebGUI::Form::groupList("groupToModerate",4));
$output .= tableFormRow(WebGUI::International::get(4,$namespace), $output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::text("messagesPerPage",20,2,30)); WebGUI::Form::text("messagesPerPage",20,2,30));
$output .= tableFormRow(WebGUI::International::get(5,$namespace), $output .= tableFormRow(WebGUI::International::get(5,$namespace),
@ -86,7 +91,7 @@ sub www_addSave {
my ($widgetId); my ($widgetId);
if (WebGUI::Privilege::canEditPage()) { 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}); $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 MessageBoard values ($widgetId, $session{form}{groupToPost}, '$session{form}{messagesPerPage}', '$session{form}{editTimeout}')"); WebGUI::SQL->write("insert into MessageBoard values ($widgetId, $session{form}{groupToPost}, '$session{form}{messagesPerPage}', '$session{form}{editTimeout}', $session{form}{groupToModerate})");
return ""; return "";
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -103,6 +108,36 @@ sub www_copy {
} }
} }
#-------------------------------------------------------------------
sub www_deleteMessage {
my (%board, %message);
tie %board, 'Tie::CPHash';
tie %message, 'Tie::CPHash';
%board = getProperties($namespace,$session{form}{wid});
%message = WebGUI::Discussion::getMessage($session{form}{mid});
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{userId} eq $session{user}{userId} ||
WebGUI::Privilege::isInGroup($board{groupToModerate})) {
return WebGUI::Discussion::deleteMessage();
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_deleteMessageConfirm {
my (%board,%message);
tie %board, 'Tie::CPHash';
tie %message, 'Tie::CPHash';
%board = getProperties($namespace,$session{form}{wid});
%message = WebGUI::Discussion::getMessage($session{form}{mid});
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{userId} eq $session{user}{userId} ||
WebGUI::Privilege::isInGroup($board{groupToModerate})) {
return WebGUI::Discussion::deleteMessageConfirm();
} else {
return WebGUI::Privilege::insufficient();
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_edit { sub www_edit {
my ($output, %board, %hash, @array); my ($output, %board, %hash, @array);
@ -116,17 +151,26 @@ sub www_edit {
$output .= WebGUI::Form::hidden("wid",$session{form}{wid}); $output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("func","editSave"); $output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>'; $output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$board{title})); $output .= tableFormRow(WebGUI::International::get(99),
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle","1",$board{displayTitle})); WebGUI::Form::text("title",20,128,$board{title}));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$board{processMacros})); $output .= tableFormRow(WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle","1",$board{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros","1",$board{processMacros}));
%hash = WebGUI::Widget::getPositions(); %hash = WebGUI::Widget::getPositions();
$array[0] = $board{templatePosition}; $array[0] = $board{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array)); $output .= tableFormRow(WebGUI::International::get(363),
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$board{description},50,5,1)); WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$board{description},50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace), $output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::selectList("groupToPost",$board{groupToPost})); WebGUI::Form::groupList("groupToPost",$board{groupToPost}));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage})); $output .= tableFormRow(WebGUI::International::get(21,$namespace),
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("editTimeout",20,2,$board{editTimeout})); WebGUI::Form::groupList("groupToModerate",$board{groupToModerate}));
$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(); $output .= formSave();
$output .= '</table></form>'; $output .= '</table></form>';
return $output; return $output;
@ -140,7 +184,7 @@ sub www_edit {
sub www_editSave { sub www_editSave {
if (WebGUI::Privilege::canEditPage()) { if (WebGUI::Privilege::canEditPage()) {
update(); update();
WebGUI::SQL->write("update MessageBoard set groupToPost=$session{form}{groupToPost}, messagesPerPage=$session{form}{messagesPerPage}, editTimeout=$session{form}{editTimeout} where widgetId=$session{form}{wid}"); WebGUI::SQL->write("update MessageBoard set groupToPost=$session{form}{groupToPost}, messagesPerPage=$session{form}{messagesPerPage}, editTimeout=$session{form}{editTimeout}, groupToModerate=$session{form}{groupToModerate} where widgetId=$session{form}{wid}");
return ""; return "";
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -149,10 +193,13 @@ sub www_editSave {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editMessage { sub www_editMessage {
my (%board); my (%board,%message);
tie %board, 'Tie::CPHash'; tie %board, 'Tie::CPHash';
tie %message, 'Tie::CPHash';
%board = getProperties($namespace,$session{form}{wid}); %board = getProperties($namespace,$session{form}{wid});
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { %message = WebGUI::Discussion::getMessage($session{form}{mid});
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{userId} eq $session{user}{userId} ||
WebGUI::Privilege::isInGroup($board{groupToModerate})) {
return WebGUI::Discussion::editMessage(); return WebGUI::Discussion::editMessage();
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -161,10 +208,13 @@ sub www_editMessage {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editMessageSave { sub www_editMessageSave {
my (%board); my (%board,%message);
tie %board, 'Tie::CPHash'; tie %board, 'Tie::CPHash';
tie %message, 'Tie::CPHash';
%board = getProperties($namespace,$session{form}{wid}); %board = getProperties($namespace,$session{form}{wid});
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { %message = WebGUI::Discussion::getMessage($session{form}{mid});
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{userId} eq $session{user}{userId} ||
WebGUI::Privilege::isInGroup($board{groupToModerate})) {
WebGUI::Discussion::editMessageSave(); WebGUI::Discussion::editMessageSave();
return www_showMessage(); return www_showMessage();
} else { } else {
@ -228,43 +278,61 @@ sub www_showMessage {
tie %board, 'Tie::CPHash'; tie %board, 'Tie::CPHash';
%message = WebGUI::Discussion::getMessage($session{form}{mid}); %message = WebGUI::Discussion::getMessage($session{form}{mid});
%board = getProperties($namespace,$session{form}{wid}); %board = getProperties($namespace,$session{form}{wid});
$html .= '<h1>'.$message{subject}.'</h1>'; if ($message{messageId}) {
$html .= '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">'; $html .= '<h1>'.$message{subject}.'</h1>';
$html .= '<b>'.WebGUI::International::get(7,$namespace).'</b> <a href="'.$session{page}{url}.'?op=viewProfile&uid='.$message{userId}.'">'.$message{username}.'</a><br>'; $html .= '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
$html .= "<b>".WebGUI::International::get(8,$namespace)."</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>"; $html .= '<b>'.WebGUI::International::get(7,$namespace).'</b> <a href="'.
$html .= "<b>".WebGUI::International::get(9,$namespace)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>"; WebGUI::URL::page('op=viewProfile&uid='.$message{userId}).'">'.$message{username}.'</a><br>';
$html .= '</td>'; $html .= "<b>".WebGUI::International::get(8,$namespace)."</b> ".
$html .= '<td rowspan=2 valign="top" class="tableMenu" nowrap>'; epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>";
$html .= '<a href="'.$session{page}{url}.'?func=postReply&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(13,$namespace).'</a><br>'; $html .= "<b>".WebGUI::International::get(9,$namespace)."</b> ".
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{'userId'} eq $session{user}{userId}) { $message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
$html .= '<a href="'.$session{page}{url}.'?func=editMessage&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(12,$namespace).'</a><br>'; $html .= '</td>';
$html .= '<td rowspan=2 valign="top" class="tableMenu" nowrap>';
$html .= '<a href="'.WebGUI::URL::page('func=postReply&mid='.$session{form}{mid}.
'&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(13,$namespace).'</a><br>';
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} &&
$message{userId} eq $session{user}{userId} ||
WebGUI::Privilege::isInGroup($board{groupToModerate})) {
$html .= '<a href="'.WebGUI::URL::page('func=editMessage&mid='.$session{form}{mid}.
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(12,$namespace).'</a><br>';
$html .= '<a href="'.WebGUI::URL::page('func=deleteMessage&mid='.$session{form}{mid}.
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(22,$namespace).'</a><br>';
}
$html .= '<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(11,$namespace).'</a><br>';
@data = WebGUI::SQL->quickArray("select max(messageId) from discussion where widgetId=$message{widgetId} and pid=0 and messageId<$message{rid}");
if ($data[0] ne "") {
$html .= '<a href="'.WebGUI::URL::page('func=showMessage&mid='.$data[0].'&wid='.
$session{form}{wid}).'">&laquo; '.WebGUI::International::get(10,$namespace).'</a><br>';
}
@data = WebGUI::SQL->quickArray("select min(messageId) from discussion where widgetId=$message{widgetId} and pid=0 and messageId>$message{rid}");
if ($data[0] ne "") {
$html .= '<a href="'.WebGUI::URL::page('func=showMessage&mid='.$data[0].'&wid='.
$session{form}{wid}).'">'.WebGUI::International::get(14,$namespace).' &raquo;</a><br>';
}
$html .= '</tr><tr><td class="tableData">';
$html .= $message{message};
$html .= '</td></tr></table>';
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).
'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace).
'</td><td class="tableHeader">'.WebGUI::International::get(16,$namespace).'</td></tr>';
@data = WebGUI::SQL->quickArray("select messageId,subject,username,dateOfPost,userId from discussion where messageId=$message{rid}");
$html .= '<tr';
if ($session{form}{mid} eq $message{rid}) {
$html .= ' class="highlight"';
}
$html .= '><td class="tableData"><a href="'.WebGUI::URL::page('func=showMessage&mid='.$data[0].'&wid='.
$message{widgetId}).'">'.substr($data[1],0,30).'</a></td><td class="tableData"><a href="'.
WebGUI::URL::page('op=viewProfile&uid='.$data[4]).'">'.$data[2].
'</a></td><td class="tableData">'.
epochToHuman($data[3],"%M/%D %H:%n%p").'</td></tr>';
$html .= WebGUI::Discussion::traverseReplyTree($message{rid},1);
$html .= "</table>";
} else {
$html = WebGUI::International::get(402);
} }
$html .= '<a href="'.$session{page}{url}.'">'.WebGUI::International::get(11,$namespace).'</a><br>';
@data = WebGUI::SQL->quickArray("select max(messageId) from discussion where widgetId=$message{widgetId} and pid=0 and messageId<$message{rid}");
if ($data[0] ne "") {
$html .= '<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'">&laquo; '.WebGUI::International::get(10,$namespace).'</a><br>';
# } else {
# $html .= '&laquo; '.WebGUI::International::get(10,$namespace).'</a><br>';
}
@data = WebGUI::SQL->quickArray("select min(messageId) from discussion where widgetId=$message{widgetId} and pid=0 and messageId>$message{rid}");
if ($data[0] ne "") {
$html .= '<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(14,$namespace).' &raquo;</a><br>';
# } else {
# $html .= WebGUI::International::get(14,$namespace).' &raquo;<br>';
}
$html .= '</tr><tr><td class="tableData">';
$html .= $message{message};
$html .= '</td></tr></table>';
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(16,$namespace).'</td></tr>';
@data = WebGUI::SQL->quickArray("select messageId,subject,username,dateOfPost,userId from discussion where messageId=$message{rid}");
$html .= '<tr';
if ($session{form}{mid} eq $message{rid}) {
$html .= ' class="highlight"';
}
$html .= '><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$message{widgetId}.'">'.substr($data[1],0,30).'</a></td><td class="tableData"><a href="'.$session{page}{url}.'?op=viewProfile&uid='.$data[4].'">'.$data[2].'</a></td><td class="tableData">'.epochToHuman($data[3],"%M/%D %H:%n%p").'</td></tr>';
$html .= WebGUI::Discussion::traverseReplyTree($message{rid},1);
$html .= "</table>";
return $html; return $html;
} }
@ -288,7 +356,10 @@ sub www_view {
if ($board{processMacros}) { if ($board{processMacros}) {
$html = WebGUI::Macro::process($html); $html = WebGUI::Macro::process($html);
} }
$html .= '<table width="100%" cellpadding=3 cellspacing=0 border=0><tr><td align="right" valign="bottom" class="tableMenu"><a href="'.$session{page}{url}.'?func=postNewMessage&wid='.$_[0].'">'.WebGUI::International::get(17,$namespace).'</a></td></tr></table>'; $html .= '<table width="100%" cellpadding=3 cellspacing=0 border=0><tr>'.
'<td align="right" valign="bottom" class="tableMenu"><a href="'.
WebGUI::URL::page('func=postNewMessage&wid='.$_[0]).'">'.
WebGUI::International::get(17,$namespace).'</a></td></tr></table>';
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">'; $html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(18,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(19,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(20,$namespace).'</td></tr>'; $html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(18,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(19,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(20,$namespace).'</td></tr>';
#$sth = WebGUI::SQL->read("select messageId,subject,count(*)-1,username,dateOfPost,max(dateOfPost),max(messageId) from discussion where widgetId=$_[0] group by rid order by messageId desc"); #$sth = WebGUI::SQL->read("select messageId,subject,count(*)-1,username,dateOfPost,max(dateOfPost),max(messageId) from discussion where widgetId=$_[0] group by rid order by messageId desc");
@ -297,24 +368,38 @@ sub www_view {
if ($i >= ($itemsPerPage*$pn) && $i < ($itemsPerPage*($pn+1))) { if ($i >= ($itemsPerPage*$pn) && $i < ($itemsPerPage*($pn+1))) {
@last = WebGUI::SQL->quickArray("select messageId,dateOfPost,username,subject,userId from discussion where widgetId=$_[0] and rid=$data[0] order by dateOfPost desc"); @last = WebGUI::SQL->quickArray("select messageId,dateOfPost,username,subject,userId from discussion where widgetId=$_[0] and rid=$data[0] order by dateOfPost desc");
($replies) = WebGUI::SQL->quickArray("select count(*)-1 from discussion where rid=$data[0]"); ($replies) = WebGUI::SQL->quickArray("select count(*)-1 from discussion where rid=$data[0]");
$html .= '<tr><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$_[0].'">'.substr($data[1],0,30).'</a></td><td class="tableData"><a href="'.$session{page}{url}.'?op=viewProfile&uid='.$data[4].'">'.$data[2].'</a></td><td class="tableData">'.epochToHuman($data[3],"%M/%D %H:%n%p").'</td><td class="tableData">'.$replies.'</td><td class="tableData"><span style="font-size: 8pt;"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$last[0].'&wid='.$_[0].'">'.substr($last[3],0,30).'</a> @ '.epochToHuman($last[1],"%M/%D %H:%n%p").' by <a href="'.$session{page}{url}.'?op=viewProfile&uid='.$last[4].'">'.$last[2].'</a></span></td></tr>'; $html .= '<tr><td class="tableData"><a href="'.WebGUI::URL::page('func=showMessage&mid='.
$data[0].'&wid='.$_[0]).'">'.substr($data[1],0,30).
'</a></td><td class="tableData"><a href="'.
WebGUI::URL::page('op=viewProfile&uid='.$data[4]).'">'.$data[2].
'</a></td><td class="tableData">'.epochToHuman($data[3],"%M/%D %H:%n%p").
'</td><td class="tableData">'.$replies.
'</td><td class="tableData"><span style="font-size: 8pt;"><a href="'.
WebGUI::URL::page('func=showMessage&mid='.$last[0].'&wid='.$_[0]).'">'.
substr($last[3],0,30).'</a> @ '.epochToHuman($last[1],"%M/%D %H:%n%p").
' by <a href="'.WebGUI::URL::page('op=viewProfile&uid='.$last[4]).'">'.$last[2].
'</a></span></td></tr>';
} }
$i++; $i++;
} }
$html .= '</table>'; $html .= '</table>';
$html .= '<div class="pagination">'; if ($i > $itemsPerPage) {
if ($pn > 0) { $html .= '<div class="pagination">';
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'">&laquo;'.WebGUI::International::get(91).'</a>'; if ($pn > 0) {
} else { $html .= '<a href="'.WebGUI::URL::page('?pn='.($pn-1)).'">&laquo;'.
$html .= '&laquo;'.WebGUI::International::get(91); WebGUI::International::get(91).'</a>';
} } else {
$html .= ' &middot; '; $html .= '&laquo;'.WebGUI::International::get(91);
if (($pn+1) < round(($i/$itemsPerPage))) { }
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'">'.WebGUI::International::get(92).'&raquo;</a>'; $html .= ' &middot; ';
} else { if (($pn+1) < round(($i/$itemsPerPage))) {
$html .= WebGUI::International::get(92).'&raquo;'; $html .= '<a href="'.WebGUI::URL::page('?pn='.($pn+1)).'">'.
} WebGUI::International::get(92).'&raquo;</a>';
$html .= '</div>'; } else {
$html .= WebGUI::International::get(92).'&raquo;';
}
$html .= '</div>';
}
return $html; return $html;
} }

View file

@ -19,6 +19,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
use WebGUI::Widget; use WebGUI::Widget;
@ -185,7 +186,8 @@ sub www_edit {
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>', $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')); 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 .= formSave();
$output .= tableFormRow("",'<a href="'.$session{page}{url}.'?func=resetVotes&wid='.$session{form}{wid}.'">'.WebGUI::International::get(10,$namespace).'</a>'); $output .= tableFormRow("",'<a href="'.WebGUI::URL::page('func=resetVotes&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(10,$namespace).'</a>');
$output .= '</table></form>'; $output .= '</table></form>';
return $output; return $output;
} else { } else {

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
use WebGUI::Widget; use WebGUI::Widget;
@ -238,12 +239,10 @@ sub www_view {
$i++; $i++;
} }
$sth->finish; $sth->finish;
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row); ($dataRows, $prevNextBar) = paginate($data{paginateAfter},WebGUI::URL::page(),\@row);
$output .= $dataRows; $output .= $dataRows;
$output .= $template[2]; $output .= $template[2];
if ($#row > $data{paginateAfter}) { $output .= $prevNextBar;
$output .= $prevNextBar;
}
} else { } else {
$output .= WebGUI::International::get(11,$namespace).'<p>'; $output .= WebGUI::International::get(11,$namespace).'<p>';
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] There was a problem with the query."); WebGUI::ErrorHandler::warn("SQLReport [$_[0]] There was a problem with the query.");

View file

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

View file

@ -24,6 +24,7 @@ use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut; use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
use WebGUI::Widget; use WebGUI::Widget;
@ -121,7 +122,15 @@ sub www_addSubmission {
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(15,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(13,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(14,$namespace).'</td></tr>'; $output .= '<tr><td class="tableHeader">'.WebGUI::International::get(15,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(13,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(14,$namespace).'</td></tr>';
$sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,status from UserSubmission_submission where widgetId='$session{form}{wid}' and userId=$session{user}{userId} order by dateSubmitted desc"); $sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,status from UserSubmission_submission where widgetId='$session{form}{wid}' and userId=$session{user}{userId} order by dateSubmitted desc");
while (@submission = $sth->array) { 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">'.epochToHuman($submission[2],"%M/%D/%y").'</td><td class="tableData">'.$submission[3].'</td></tr>'; $output .= '<tr><td class="tableData"><a href="'.WebGUI::URL::page('func=editSubmission&wid='.
$session{form}{wid}.'&sid='.$submission[1]).'"><img src="'.$session{setting}{lib}.
'/edit.gif" border=0></a><a href="'.WebGUI::URL::page('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="'.
WebGUI::URL::page('wid='.$session{form}{wid}.'&func=viewSubmission&sid='.
$submission[1]).'">'.$submission[0].'</a></td><td class="tableData">'.
epochToHuman($submission[2],"%M/%D/%y").'</td><td class="tableData">'.
$submission[3].'</td></tr>';
} }
$sth->finish; $sth->finish;
$output .= '</table>'; $output .= '</table>';
@ -146,7 +155,9 @@ sub www_addSubmissionSave {
} }
WebGUI::SQL->write("insert into UserSubmission_submission values ($session{form}{wid}, $submissionId, ".quote($title).", ".time().", ".quote($session{user}{username}).", '$session{user}{userId}', ".quote($session{form}{content}).", ".quote($image).", ".quote($attachment).", '$userSubmission{defaultStatus}', '$session{form}{convertCarriageReturns}')"); WebGUI::SQL->write("insert into UserSubmission_submission values ($session{form}{wid}, $submissionId, ".quote($title).", ".time().", ".quote($session{user}{username}).", '$session{user}{userId}', ".quote($session{form}{content}).", ".quote($image).", ".quote($attachment).", '$userSubmission{defaultStatus}', '$session{form}{convertCarriageReturns}')");
if ($userSubmission{defaultStatus} ne "Approved") { if ($userSubmission{defaultStatus} ne "Approved") {
WebGUI::MessageLog::addEntry('',$userSubmission{groupToApprove},$session{page}{url}.'?func=viewSubmission&wid='.$session{form}{wid}.'&sid='.$submissionId,3,$namespace); WebGUI::MessageLog::addEntry('',$userSubmission{groupToApprove},
WebGUI::URL::page('func=viewSubmission&wid='.$session{form}{wid}.
'&sid='.$submissionId),3,$namespace);
} }
return ""; return "";
} else { } else {
@ -161,7 +172,8 @@ sub www_approveSubmission {
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}"); %submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
%userSubmission = getProperties($namespace,$session{form}{wid});; %userSubmission = getProperties($namespace,$session{form}{wid});;
WebGUI::SQL->write("update UserSubmission_submission set status='Approved' where submissionId=$session{form}{sid}"); WebGUI::SQL->write("update UserSubmission_submission set status='Approved' where submissionId=$session{form}{sid}");
WebGUI::MessageLog::addEntry($submission{userId},'',$session{page}{url}.'?func=viewSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid},4,$namespace); WebGUI::MessageLog::addEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='.
$session{form}{wid}.'&sid='.$session{form}{sid}),4,$namespace);
WebGUI::MessageLog::completeEntry($session{form}{mlog}); WebGUI::MessageLog::completeEntry($session{form}{mlog});
return WebGUI::Operation::www_viewMessageLog(); return WebGUI::Operation::www_viewMessageLog();
} else { } else {
@ -210,8 +222,9 @@ sub www_deleteSubmission {
if ($owner == $session{user}{userId}) { if ($owner == $session{user}{userId}) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>'; $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(17,$namespace).'<p>'; $output .= WebGUI::International::get(17,$namespace).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.WebGUI::URL::page('func=deleteSubmissionConfirm&wid='.
$output .= ' &nbsp; <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>'; $session{form}{wid}.'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(44).'</a>';
$output .= ' &nbsp; <a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(45).'</a></div>';
return $output; return $output;
} else { } else {
return WebGUI::Privilege::insufficient(); return WebGUI::Privilege::insufficient();
@ -237,7 +250,8 @@ sub www_denySubmission {
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}"); %submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
%userSubmission = getProperties($namespace,$session{form}{wid}); %userSubmission = getProperties($namespace,$session{form}{wid});
WebGUI::SQL->write("update UserSubmission_submission set status='Denied' where submissionId=$session{form}{sid}"); WebGUI::SQL->write("update UserSubmission_submission set status='Denied' where submissionId=$session{form}{sid}");
WebGUI::MessageLog::addEntry($submission{userId},'',$session{page}{url}.'?func=viewSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid},5,$namespace); WebGUI::MessageLog::addEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='.
$session{form}{wid}.'&sid='.$session{form}{sid}),5,$namespace);
WebGUI::MessageLog::completeEntry($session{form}{mlog}); WebGUI::MessageLog::completeEntry($session{form}{mlog});
return WebGUI::Operation::www_viewMessageLog(); return WebGUI::Operation::www_viewMessageLog();
} else { } else {
@ -308,12 +322,16 @@ sub www_editSubmission {
$output .= tableFormRow(WebGUI::International::get(35,$namespace),WebGUI::Form::text("title",20,128,$submission{title})); $output .= tableFormRow(WebGUI::International::get(35,$namespace),WebGUI::Form::text("title",20,128,$submission{title}));
$output .= tableFormRow(WebGUI::International::get(31,$namespace),WebGUI::Form::textArea("content",$submission{content},50,10)); $output .= tableFormRow(WebGUI::International::get(31,$namespace),WebGUI::Form::textArea("content",$submission{content},50,10));
if ($submission{image} ne "") { if ($submission{image} ne "") {
$output .= tableFormRow(WebGUI::International::get(32,$namespace),'<a href="'.$session{page}{url}.'?func=deleteImage&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(36,$namespace).'</a>'); $output .= tableFormRow(WebGUI::International::get(32,$namespace),'<a href="'.
WebGUI::URL::page('func=deleteImage&wid='.$session{form}{wid}.'&sid='.
$session{form}{sid}).'">'.WebGUI::International::get(36,$namespace).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(32,$namespace),WebGUI::Form::file("image")); $output .= tableFormRow(WebGUI::International::get(32,$namespace),WebGUI::Form::file("image"));
} }
if ($submission{attachment} ne "") { if ($submission{attachment} ne "") {
$output .= tableFormRow(WebGUI::International::get(33,$namespace),'<a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(36,$namespace).'</a>'); $output .= tableFormRow(WebGUI::International::get(33,$namespace),'<a href="'.
WebGUI::URL::page('func=deleteAttachment&wid='.$session{form}{wid}.'&sid='.
$session{form}{sid}).'">'.WebGUI::International::get(36,$namespace).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(33,$namespace),WebGUI::Form::file("attachment")); $output .= tableFormRow(WebGUI::International::get(33,$namespace),WebGUI::Form::file("attachment"));
} }
@ -348,7 +366,9 @@ sub www_editSubmissionSave {
} }
WebGUI::SQL->write("update UserSubmission_submission set dateSubmitted=".time().", convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$userSubmission{defaultStatus}' where submissionId=$session{form}{sid}"); WebGUI::SQL->write("update UserSubmission_submission set dateSubmitted=".time().", convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$userSubmission{defaultStatus}' where submissionId=$session{form}{sid}");
if ($userSubmission{defaultStatus} ne "Approved") { if ($userSubmission{defaultStatus} ne "Approved") {
WebGUI::MessageLog::addEntry('',$userSubmission{groupToApprove},$session{page}{url}.'?func=viewSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid},3,$namespace); WebGUI::MessageLog::addEntry('',$userSubmission{groupToApprove},
WebGUI::URL::page('func=viewSubmission&wid='.$session{form}{wid}.'&sid='.
$session{form}{sid}),3,$namespace);
} }
return www_viewSubmission(); return www_viewSubmission();
} else { } else {
@ -373,12 +393,18 @@ sub www_view {
} }
$sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,username,userId from UserSubmission_submission where widgetId='$_[0]' and status='Approved' order by dateSubmitted desc"); $sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,username,userId from UserSubmission_submission where widgetId='$_[0]' and status='Approved' order by dateSubmitted desc");
while (@submission = $sth->array) { while (@submission = $sth->array) {
$row[$i] = '<tr><td class="tableData"><a href="'.$session{page}{url}.'?wid='.$_[0].'&func=viewSubmission&sid='.$submission[1].'">'.$submission[0].'</a></td><td class="tableData">'.epochToHuman($submission[2],"%M/%D/%y").'</td><td class="tableData"><a href="'.$session{page}{url}.'?op=viewProfile&uid='.$submission[4].'">'.$submission[3].'</a></td></tr>'; $row[$i] = '<tr><td class="tableData"><a href="'.WebGUI::URL::page('wid='.$_[0].
'&func=viewSubmission&sid='.$submission[1]).'">'.$submission[0].
'</a></td><td class="tableData">'.epochToHuman($submission[2],"%M/%D/%y").
'</td><td class="tableData"><a href="'.WebGUI::URL::page('op=viewProfile&uid='.
$submission[4]).'">'.$submission[3].'</a></td></tr>';
$i++; $i++;
} }
$sth->finish; $sth->finish;
$output .= '<table width="100%" cellpadding=3 cellspacing=0 border=0><tr><td align="right" class="tableMenu"><a href="'.$session{page}{url}.'?func=addSubmission&wid='.$_[0].'">'.WebGUI::International::get(20,$namespace).'</a></td></tr></table>'; $output .= '<table width="100%" cellpadding=3 cellspacing=0 border=0><tr>'.
($dataRows, $prevNextBar) = paginate($data{submissionsPerPage},$session{page}{url},\@row); '<td align="right" class="tableMenu"><a href="'.WebGUI::URL::page('func=addSubmission&wid='.
$_[0]).'">'.WebGUI::International::get(20,$namespace).'</a></td></tr></table>';
($dataRows, $prevNextBar) = paginate($data{submissionsPerPage},WebGUI::URL::page(),\@row);
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>'; $output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(13,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(21,$namespace).'</td></tr>'; $output .= '<tr><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(13,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(21,$namespace).'</td></tr>';
$output .= $dataRows; $output .= $dataRows;
@ -397,19 +423,27 @@ sub www_viewSubmission {
$output .= '<table width="100%" cellpadding=2 cellspacing=1 border=0>'; $output .= '<table width="100%" cellpadding=2 cellspacing=1 border=0>';
$output .= '<tr><td class="tableHeader">'; $output .= '<tr><td class="tableHeader">';
#---header #---header
$output .= '<b>'.WebGUI::International::get(22,$namespace).'</b> <a href="'.$session{page}{url}.'?op=viewProfile&uid='.$submission{userId}.'">'.$submission{username}.'</a><br>'; $output .= '<b>'.WebGUI::International::get(22,$namespace).'</b> <a href="'.
WebGUI::URL::page('op=viewProfile&uid='.$submission{userId}).'">'.$submission{username}.'</a><br>';
$output .= '<b>'.WebGUI::International::get(23,$namespace).'</b> '.epochToHuman($submission{dateSubmitted},"%w, %c %D, %y at %H:%n%p"); $output .= '<b>'.WebGUI::International::get(23,$namespace).'</b> '.epochToHuman($submission{dateSubmitted},"%w, %c %D, %y at %H:%n%p");
$output .= '</td><td rowspan="2" class="tableMenu" nowrap valign="top">'; $output .= '</td><td rowspan="2" class="tableMenu" nowrap valign="top">';
#---menu #---menu
$output .= '<a href="'.$session{page}{url}.'">'.WebGUI::International::get(28,$namespace).'</a><br>'; $output .= '<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(28,$namespace).'</a><br>';
if ($submission{userId} == $session{user}{userId}) { 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(37,$namespace).'</a><br>'; $output .= '<a href="'.WebGUI::URL::page('func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.
$output .= '<a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(27,$namespace).'</a><br>'; $session{form}{sid}).'">'.WebGUI::International::get(37,$namespace).'</a><br>';
$output .= '<a href="'.WebGUI::URL::page('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}))) { if ($submission{status} eq "Pending" && (WebGUI::Privilege::isInGroup(3,$session{user}{userId}) || WebGUI::Privilege::isInGroup(4,$session{user}{userId}))) {
$output .= '<a href="'.$session{page}{url}.'?func=approveSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog}.'">'.WebGUI::International::get(24,$namespace).'</a><br>'; $output .= '<a href="'.WebGUI::URL::page('func=approveSubmission&wid='.$session{form}{wid}.
$output .= '<a href="'.$session{page}{url}.'?op=viewMessageLog">'.WebGUI::International::get(25,$namespace).'</a><br>'; '&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog}).'">'.
$output .= '<a href="'.$session{page}{url}.'?func=denySubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog}.'">'.WebGUI::International::get(26,$namespace).'</a><br>'; WebGUI::International::get(24,$namespace).'</a><br>';
$output .= '<a href="'.WebGUI::URL::page('op=viewMessageLog').'">'.
WebGUI::International::get(25,$namespace).'</a><br>';
$output .= '<a href="'.WebGUI::URL::page('func=denySubmission&wid='.$session{form}{wid}.
'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog}).'">'.
WebGUI::International::get(26,$namespace).'</a><br>';
} }
$output .= '</td</tr><tr><td class="tableData">'; $output .= '</td</tr><tr><td class="tableData">';
#---content #---content

View file

@ -12,6 +12,8 @@ use CGI::Carp ();
use DBI (); use DBI ();
use DBD::mysql (); use DBD::mysql ();
use Data::Config (); use Data::Config ();
use Date::Calc ();
use HTML::CalendarMonthSimple ();
use Tie::CPHash (); use Tie::CPHash ();
use Tie::IxHash (); use Tie::IxHash ();
use Net::LDAP (); use Net::LDAP ();

View file

@ -30,7 +30,7 @@ if ($ARGV[0] eq "--help" || $ARGV[0] eq "/?" || $ARGV[0] eq "/help" || $ARGV[0]
exit; exit;
} }
print "\nWebGUI is checking your system environment...\n\n"; print "\nWebGUI is checking your system environment:\n\n";
my $os; my $os;
if ($^O =~ /Win/i) { if ($^O =~ /Win/i) {
@ -39,7 +39,7 @@ if ($^O =~ /Win/i) {
$os = "Linuxish"; $os = "Linuxish";
} }
print "Operating System:\t".$os."\n"; print "Operating System.........................".$os."\n";
if ($ARGV[0] eq "--install-modules" && $< != 0 && $os eq "Linuxish") { if ($ARGV[0] eq "--install-modules" && $< != 0 && $os eq "Linuxish") {
print "You cannot install Perl modules unless you are the root user.\n"; print "You cannot install Perl modules unless you are the root user.\n";
@ -53,7 +53,7 @@ if ($ARGV[0] eq "--install-modules" && $< != 0 && $os eq "Linuxish") {
# Checking Perl # Checking Perl
################################### ###################################
print "Perl Interpreter:\t"; print "Perl Interpreter.........................";
if ($] >= 5.006) { if ($] >= 5.006) {
print "OK\n"; print "OK\n";
} else { } else {
@ -64,7 +64,7 @@ if ($] >= 5.006) {
} }
} }
print "LWP module:\t\t"; print "LWP module...............................";
if (eval { require LWP }) { if (eval { require LWP }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -76,21 +76,21 @@ if (eval { require LWP }) {
} }
} }
print "HTTP::Request module:\t"; print "HTTP::Request module.....................";
if (eval { require HTTP::Request }) { if (eval { require HTTP::Request }) {
print "OK\n"; print "OK\n";
} else { } else {
print "Please install LWP.\n"; print "Please install LWP.\n";
} }
print "HTTP::Headers module:\t"; print "HTTP::Headers module.....................";
if (eval { require HTTP::Headers }) { if (eval { require HTTP::Headers }) {
print "OK\n"; print "OK\n";
} else { } else {
print "Please install LWP.\n"; print "Please install LWP.\n";
} }
print "Digest::MD5 module:\t"; print "Digest::MD5 module.......................";
if (eval { require Digest::MD5 }) { if (eval { require Digest::MD5 }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -102,7 +102,7 @@ if (eval { require Digest::MD5 }) {
} }
} }
print "DBI module:\t\t"; print "DBI module...............................";
if (eval { require DBI }) { if (eval { require DBI }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -114,11 +114,11 @@ if (eval { require DBI }) {
} }
} }
print "Database drivers:\t"; print "Avalable database drivers................";
print join(", ",DBI->available_drivers); print join(", ",DBI->available_drivers);
print "\n"; print "\n";
print "Tie::IxHash module:\t"; print "Tie::IxHash module.......................";
if (eval { require Tie::IxHash }) { if (eval { require Tie::IxHash }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -130,7 +130,7 @@ if (eval { require Tie::IxHash }) {
} }
} }
print "Tie::CPHash module:\t"; print "Tie::CPHash module.......................";
if (eval { require Tie::CPHash }) { if (eval { require Tie::CPHash }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -142,7 +142,7 @@ if (eval { require Tie::CPHash }) {
} }
} }
print "Net::SMTP module:\t"; print "Net::SMTP module.........................";
if (eval { require Net::SMTP }) { if (eval { require Net::SMTP }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -154,7 +154,7 @@ if (eval { require Net::SMTP }) {
} }
} }
print "XML::RSS module:\t"; print "XML::RSS module..........................";
if (eval { require XML::RSS }) { if (eval { require XML::RSS }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -166,7 +166,7 @@ if (eval { require XML::RSS }) {
} }
} }
print "Net::LDAP module:\t"; print "Net::LDAP module.........................";
if (eval { require Net::LDAP }) { if (eval { require Net::LDAP }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -178,15 +178,39 @@ if (eval { require Net::LDAP }) {
} }
} }
print "Date::Calc module........................";
if (eval { require Date::Calc }) {
print "OK\n";
} else {
if ($ARGV[0] eq "--install-modules") {
print "Installing...\n";
CPAN::Shell->install("Date::Calc");
} else {
print "Please install.\n";
}
}
print "HTML::CalendarMonthSimple module.........";
if (eval { require HTML::CalendarMonthSimple }) {
print "OK\n";
} else {
if ($ARGV[0] eq "--install-modules") {
print "Installing...\n";
CPAN::Shell->install("HTML::CalendarMonthSimple");
} else {
print "Please install.\n";
}
}
# this is here to insure they installed correctly. # this is here to insure they installed correctly.
print "WebGUI modules:\t\t"; print "WebGUI modules...........................";
if (eval { require WebGUI } && eval { require WebGUI::SQL }) { if (eval { require WebGUI } && eval { require WebGUI::SQL }) {
print "OK\n"; print "OK\n";
} else { } else {
print "Please install.\n"; print "Please install.\n";
} }
print "Data::Config module:\t"; print "Data::Config module......................";
if (eval { require Data::Config }) { if (eval { require Data::Config }) {
print "OK\n"; print "OK\n";
} else { } else {
@ -197,7 +221,7 @@ if (eval { require Data::Config }) {
# Checking Config File # Checking Config File
################################### ###################################
print "Config file:\t\t"; print "Config file..............................";
my ($config); my ($config);
$config = new Data::Config './etc/WebGUI.conf'; $config = new Data::Config './etc/WebGUI.conf';
unless (defined $config) { unless (defined $config) {
@ -218,13 +242,13 @@ unless (defined $config) {
# Checking database # Checking database
################################### ###################################
print "Database connection:\t"; print "Database connection......................";
my ($dbh, $test); my ($dbh, $test);
unless (eval { $dbh = DBI->connect($config->param('dsn'), $config->param('dbuser'), $config->param('dbpass')) }) { unless (eval { $dbh = DBI->connect($config->param('dsn'), $config->param('dbuser'), $config->param('dbpass')) }) {
print "Can't connect with info provided.\n"; print "Can't connect with info provided.\n";
} else { } else {
print "OK\n"; print "OK\n";
print "Database tables:\t"; print "Database tables..........................";
($test) = WebGUI::SQL->quickArray("select count(*) from page",$dbh); ($test) = WebGUI::SQL->quickArray("select count(*) from page",$dbh);
if ($test < 1) { if ($test < 1) {
print "Looks like you need to create some tables.\n"; print "Looks like you need to create some tables.\n";
@ -238,10 +262,11 @@ unless (eval { $dbh = DBI->connect($config->param('dsn'), $config->param('dbuser
# Checking Version # Checking Version
################################### ###################################
print "Latest version:\t\t"; print "Latest version...........................";
my ($header, $userAgent, $request, $response, $version, $referer); my ($header, $userAgent, $request, $response, $version, $referer);
$userAgent = new LWP::UserAgent; $userAgent = new LWP::UserAgent;
$userAgent->agent("WebGUI-Check/2.0"); $userAgent->agent("WebGUI-Check/2.0");
$userAgent->timeout(30);
$header = new HTTP::Headers; $header = new HTTP::Headers;
$referer = "http://webgui.cli.getversion/".`hostname`; $referer = "http://webgui.cli.getversion/".`hostname`;
chomp $referer; chomp $referer;

BIN
www/extras/asc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

BIN
www/extras/desc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

View file

@ -29,7 +29,6 @@ function centerText(obj) {
function colorText(obj) { function colorText(obj) {
formObj = obj; formObj = obj;
window.alert(window.opener.extrasDir);
window.open(window.opener.extrasDir+"/colorPicker.html","colorPicker","width=438,height=258"); window.open(window.opener.extrasDir+"/colorPicker.html","colorPicker","width=438,height=258");
} }
@ -86,7 +85,7 @@ function url(obj) {
} }
</script> </script>
</head> </head>
<body onLoad="edit.editor.value=window.opener.formObj.value"> <body onLoad="document.edit.editor.value=window.opener.formObj.value">
<form name="edit"> <form name="edit">
<input type="button" onClick="colorText(this.form.editor)" value="color" style="font-size: 8pt;"> <input type="button" onClick="colorText(this.form.editor)" value="color" style="font-size: 8pt;">
<input type="button" onClick="boldText(this.form.editor)" value="bold" style="font-size: 8pt;"> <input type="button" onClick="boldText(this.form.editor)" value="bold" style="font-size: 8pt;">
@ -100,7 +99,7 @@ function url(obj) {
<input type="button" onClick="registered(this.form.editor)" value="(R)" style="font-size: 8pt;"> <input type="button" onClick="registered(this.form.editor)" value="(R)" style="font-size: 8pt;">
<input type="button" onClick="trademark(this.form.editor)" value="TM" style="font-size: 8pt;"> <input type="button" onClick="trademark(this.form.editor)" value="TM" style="font-size: 8pt;">
<br> <br>
<textarea name="editor" rows=10 cols=50></textarea> <textarea name="editor" rows=20 cols=55></textarea>
<br> <br>
<input type="button" onClick="showMe(this.form.editor)" value="show me" style="font-size: 8pt;"> <input type="button" onClick="showMe(this.form.editor)" value="show me" style="font-size: 8pt;">
<input type="button" onClick="window.blur(); window.opener.focus();window.opener.setContent(this.form.editor.value);window.close();" value="done" style="font-size: 8pt;"> <input type="button" onClick="window.blur(); window.opener.focus();window.opener.setContent(this.form.editor.value);window.close();" value="done" style="font-size: 8pt;">