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

View file

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

View file

@ -10,13 +10,14 @@ package WebGUI::DateTime;
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use Date::Calc;
use Exporter;
use strict;
use Time::Local;
use WebGUI::International;
our @ISA = qw(Exporter);
our @EXPORT = qw(&epochToHuman &epochToSet &humanToEpoch &setToEpoch);
our @EXPORT = qw(&addToTime &addToDate &epochToHuman &epochToSet &humanToEpoch &setToEpoch &monthStartEnd);
#-------------------------------------------------------------------
sub _getMonth {
@ -51,6 +52,24 @@ sub _getWeekday {
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 {
my ($hour12, $value, $output, @date, %weekday, %month);
@ -150,6 +169,16 @@ sub humanToEpoch {
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 {
my @date = localtime(time());

View file

@ -15,15 +15,30 @@ use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Shortcut;
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 {
my (@row, $sth, %data, $newMessageId);
my ($sth, %data, $newMessageId);
$sth = WebGUI::SQL->read("select * from discussion where pid=$_[0] order by messageId");
while (%data = $sth->hash) {
$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]);
}
$sth->finish;
@ -43,19 +58,45 @@ sub duplicate {
$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 {
my ($html, %message);
tie %message, 'Tie::CPHash';
%message = getMessage($session{form}{mid});
$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("wid",$session{form}{wid});
$html .= WebGUI::Form::hidden("sid",$session{form}{sid});
$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" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",$message{message},50,6,1).'</td></tr>';
$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" 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 .= '</table></form>';
$html .= showMessage();
@ -70,7 +111,10 @@ sub editMessageSave {
if ($session{form}{message} eq "") {
$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();
}
@ -78,7 +122,7 @@ sub editMessageSave {
sub getMessage {
my (%message);
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;
return %message;
}
@ -87,7 +131,7 @@ sub getMessage {
sub postNewMessage {
my ($html);
$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("wid",$session{form}{wid});
$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 = "Re: ".$subject;
$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("wid",$session{form}{wid});
$html .= WebGUI::Form::hidden("sid",$session{form}{sid});
@ -156,14 +200,18 @@ sub showMessage {
my ($html, %message);
tie %message, 'Tie::CPHash';
%message = getMessage($session{form}{mid});
$html = '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
$html .= '<b>'.WebGUI::International::get(237).'</b>'.$message{subject}.'<br>';
$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(239)."</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>";
$html .= "<b>".WebGUI::International::get(240)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
$html .= '</td></tr><tr><td class="tableData">';
$html .= $message{message};
$html .= '</td></tr></table>';
if ($message{messageId}) {
$html = '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
$html .= '<b>'.WebGUI::International::get(237).'</b>'.$message{subject}.'<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(239)."</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>";
$html .= "<b>".WebGUI::International::get(240)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
$html .= '</td></tr><tr><td class="tableData">';
$html .= $message{message};
$html .= '</td></tr></table>';
} else {
$html = WebGUI::International::get(402);
}
return $html;
}
@ -172,10 +220,14 @@ sub showReplyTree {
my (@data, $html, %message);
tie %message, 'Tie::CPHash';
%message = getMessage($session{form}{mid});
$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(244).'</td><td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>';
$html .= traverseReplyTree($message{rid},0);
$html .= "</table>";
if ($message{messageId}) {
$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(244).
'</td><td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>';
$html .= traverseReplyTree($message{rid},0);
$html .= "</table>";
}
return $html;
}
@ -191,7 +243,7 @@ sub traverseReplyTree {
if ($session{form}{mid} eq $data[0]) {
$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);
}
$sth->finish;

View file

@ -159,13 +159,27 @@ sub textArea {
$rows = 5;
}
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 .= '<input type="button" onClick="openEditWindow(this.form.'.$name.')" value="'.WebGUI::International::get(171).'" style="font-size: 8pt;"><br>';
$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=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 "") {
$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;
}

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ use WebGUI::Session;
sub _replacement {
my (@param, $temp);
@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 "") {
$temp .= $param[0];
} else {

View file

@ -15,6 +15,7 @@ use WebGUI::Form;
use WebGUI::International;
use WebGUI::Macro::Backslash_pageUrl;
use WebGUI::Session;
use WebGUI::URL;
#-------------------------------------------------------------------
sub _replacement {
@ -22,11 +23,11 @@ sub _replacement {
$temp = '<div class="loginBox">';
if ($session{var}{sessionId}) {
$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::Macro::Backslash_pageUrl::process($temp);
} 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::International::get(50);
$temp .= '<br></span>';
@ -36,7 +37,7 @@ sub _replacement {
$temp .= WebGUI::Form::password("identifier",12,30).'<span class="formSubtext"><br></span>';
$temp .= WebGUI::Form::submit(WebGUI::International::get(52));
$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>';
return $temp;

View file

@ -14,12 +14,13 @@ use strict;
use WebGUI::Form;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::URL;
#-------------------------------------------------------------------
sub process {
my ($output, $temp);
$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::text("keywords",10,100,$session{form}{keywords});
$temp .= WebGUI::Form::submit(WebGUI::International::get(364));

View file

@ -15,6 +15,7 @@ use Tie::CPHash;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&traversePageTree);
@ -40,7 +41,7 @@ sub traversePageTree {
while (@data = $sth->array) {
if (WebGUI::Privilege::canViewPage($data[2])) {
$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);
}
}

View file

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

View file

@ -14,12 +14,13 @@ use strict;
use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::URL;
#-------------------------------------------------------------------
sub _replacement {
my (@param, $temp);
@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 "") {
$temp .= $param[0];
} else {

View file

@ -11,13 +11,21 @@ package WebGUI::Macro::m_currentMenuHorizontal;
#-------------------------------------------------------------------
use strict;
use WebGUI::Macro;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
#-------------------------------------------------------------------
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">';
$first = 1;
$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) {
$first = 0;
} 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;
@ -41,6 +49,7 @@ sub _replacement {
sub process {
my ($output, $temp, @data, $sth, $first);
$output = $_[0];
$output =~ s/\^m\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^m\;/_replacement()/ge;
return $output;
}

View file

@ -15,10 +15,17 @@ use WebGUI::Macro;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
#-------------------------------------------------------------------
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">';
$first = 1;
$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) {
$first = 0;
} 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;
@ -41,6 +48,7 @@ sub _replacement {
sub process {
my ($output, $temp, @data, $sth, $first);
$output = $_[0];
$output =~ s/\^p\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^p\;/_replacement()/ge;
return $output;
}

View file

@ -14,13 +14,14 @@ use strict;
use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::URL;
use WebGUI::Utility;
#-------------------------------------------------------------------
sub _replacement {
my ($temp, @param);
@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.'">';
if ($param[0] ne "") {
$temp .= $param[0];

View file

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

View file

@ -11,13 +11,20 @@ package WebGUI::Macro::t_topMenuHorizontal;
#-------------------------------------------------------------------
use strict;
use WebGUI::Macro;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
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">';
$first = 1;
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber");
@ -26,10 +33,10 @@ sub _replacement {
if ($first) {
$first = 0;
} 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;
@ -41,6 +48,7 @@ sub _replacement {
sub process {
my ($output, $temp, @data, $sth, $first);
$output = $_[0];
$output =~ s/\^t\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^t\;/_replacement()/ge;
return $output;
}

View file

@ -24,6 +24,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -36,17 +37,20 @@ sub _accountOptions {
$output = '<div class="accountOptions"><ul>';
if (WebGUI::Privilege::isInGroup(3) || WebGUI::Privilege::isInGroup(4) || WebGUI::Privilege::isInGroup(5) || WebGUI::Privilege::isInGroup(6)) {
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 {
$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="'.$session{page}{url}.'?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="'.$session{page}{url}.'?op=viewMessageLog">'.WebGUI::International::get(354).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=logout">'.WebGUI::International::get(64).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=deactivateAccount">'.WebGUI::International::get(65).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=displayAccount').'">'.WebGUI::International::get(342).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editProfile').'">'.WebGUI::International::get(341).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=viewProfile&uid='.$session{user}{userId}).'">'.
WebGUI::International::get(343).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=viewMessageLog').'">'.WebGUI::International::get(354).'</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>';
return $output;
}
@ -117,9 +121,11 @@ sub www_createAccount {
$output .= '</table>';
$output .= '</form> ';
$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") {
$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>';
}
@ -196,8 +202,9 @@ sub www_deactivateAccount {
} else {
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(60).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deactivateAccountConfirm">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deactivateAccountConfirm').'">'.
WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(45).'</a></div>';
}
return $output;
}
@ -265,10 +272,12 @@ sub www_displayLogin {
$output .= '</form>';
$output .= '<div class="accountOptions"><ul>';
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") {
$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>';
}
@ -397,15 +406,18 @@ sub www_recoverPassword {
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","recoverPasswordFinish");
$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 .= '</table>';
$output .= '</form>';
$output .= '<div class="accountOptions"><ul>';
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>';
}
return $output;
@ -484,7 +496,7 @@ sub www_viewMessageLog {
while (@data = $sth->array) {
$row[$i] = '<tr><td class="tableData">';
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] .= $data[1];
@ -495,7 +507,7 @@ sub www_viewMessageLog {
$i++;
}
$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 .= '<tr><td class="tableHeader">'.WebGUI::International::get(351).'</td><td class="tableHeader">'.WebGUI::International::get(352).'</td></tr>';
if ($dataRows eq "") {

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -67,8 +68,11 @@ sub www_deleteGroup {
$output .= helpLink(15);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$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 .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.
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;
} else {
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>';
$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) {
$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 .= '<td class="tableData"><a href="'.$session{page}{url}.'/op=editUser&uid='.$hash{userId}.'">'.$hash{username}.'</a></td>';
$output .= '<tr><td><a href="'.
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>';
}
$sth->finish;
@ -140,17 +150,22 @@ sub www_listGroups {
if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(10);
$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">';
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName");
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[2].'</td></tr>';
$i++;
}
$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 .= $dataRows;
$output .= '</table>';

View file

@ -16,6 +16,7 @@ use Tie::CPHash;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex);
@ -31,16 +32,19 @@ sub www_viewHelp {
$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");
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 = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})");
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}'");
$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;
$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;
}
@ -55,7 +59,8 @@ sub www_viewHelpIndex {
$output .= '<p><b>'.$data[1].'</b><br>';
$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;
$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>';
$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;
$output .= '</td></tr></table>';

View file

@ -21,6 +21,7 @@ use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::Template;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -72,9 +73,10 @@ sub www_deleteImage {
$output .= helpLink(23);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(392).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.
'?op=deleteImageConfirm&iid='.$session{form}{iid}.'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listImages">'.
$output .= '<div align="center"><a href="'.
WebGUI::URL::page('op=deleteImageConfirm&iid='.$session{form}{iid})
.'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page('op=listImages').'">'.
WebGUI::International::get(45).'</a></div>';
return $output;
} else {
@ -122,7 +124,7 @@ sub www_editImage {
WebGUI::Form::text("name",20,128,$data{name}));
if ($data{filename} ne "") {
$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>');
} else {
$output .= tableFormRow(WebGUI::International::get(384),
@ -168,7 +170,7 @@ sub www_listImages {
$output = helpLink(26);
$output .= '<h1>'.WebGUI::International::get(393).'</h1>';
$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 .= WebGUI::Form::hidden("op","listImages");
$output .= WebGUI::Form::text("keyword",20,50);
@ -182,12 +184,12 @@ sub www_listImages {
while (%data = $sth->hash) {
$row[$i] = '<tr class="tableData"><td>';
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>';
$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>';
} 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>';
}
$row[$i] .= '</td>';
@ -198,7 +200,7 @@ sub www_listImages {
$i++;
}
$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 .= $dataRows;
$output .= '</table>';
@ -216,7 +218,7 @@ sub www_viewImage {
if (WebGUI::Privilege::isInGroup(4)) {
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
$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 .= tableFormRow(WebGUI::International::get(389),$data{imageId});
$output .= tableFormRow(WebGUI::International::get(383),$data{name});

View file

@ -16,6 +16,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy);
@ -61,7 +62,8 @@ sub www_selectPackageToDeploy {
$output .= '<ul>';
$sth = WebGUI::SQL->read("select * from page where parentId=5");
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;
}
$sth->finish;

View file

@ -19,6 +19,7 @@ use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::Template;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -90,7 +91,7 @@ sub www_addPageSave {
if ($session{form}{title} eq "") {
$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'")) {
$urlizedTitle .= 2;
}
@ -124,8 +125,10 @@ sub www_deletePage {
$output .= helpLink(3);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(101).'<p>';
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deletePageConfirm">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deletePageConfirm').
'">'.WebGUI::International::get(44).'</a>';
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.WebGUI::URL::page().'">'.
WebGUI::International::get(45).'</a></div>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
@ -158,30 +161,44 @@ sub www_editPage {
$output .= WebGUI::Form::hidden("op","editPageSave");
$output .= '<table>';
$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(104),WebGUI::Form::text("urlizedTitle",20,128,$session{page}{urlizedTitle}));
$output .= tableFormRow(WebGUI::International::get(99),
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());
$array[0] = $session{page}{template};
$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(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>';
%hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name");
$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 .= '<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");
$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};
$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};
$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");
$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};
$output .= tableFormRow(WebGUI::International::get(112),WebGUI::Form::selectList("groupView",\%yesNo,\@array));
$array[0] = $session{page}{groupEdit};
@ -206,7 +223,7 @@ sub www_editPageSave {
if ($session{form}{title} eq "") {
$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}")) {
$urlizedTitle .= 2;
}

View file

@ -18,6 +18,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -68,7 +69,7 @@ sub www_search {
}
}
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 .= $dataRows;
$output .= '</ol>'.$prevNextBar;

View file

@ -18,6 +18,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
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);
@ -169,8 +170,9 @@ sub www_editMailSettingsSave {
#-------------------------------------------------------------------
sub www_editMiscSettings {
my ($output, @array, %notFoundPage);
my ($output, @array, %notFoundPage, %yesNo);
%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)) {
$output .= helpLink(24);
$output .= '<h1>'.WebGUI::International::get(140).'</h1>';
@ -178,8 +180,15 @@ sub www_editMiscSettings {
$output .= WebGUI::Form::hidden("op","editMiscSettingsSave");
$output .= '<table>';
$array[0] = $session{setting}{notFoundPage};
$output .= tableFormRow(WebGUI::International::get(141),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(141),
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 .= '</table>';
$output .= '</form> ';
@ -192,8 +201,14 @@ sub www_editMiscSettings {
#-------------------------------------------------------------------
sub www_editMiscSettingsSave {
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}{notFoundPage})." where name='notFoundPage'");
WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout}).
" 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();
} else {
return WebGUI::Privilege::adminOnly();
@ -250,12 +265,18 @@ sub www_manageSettings {
$output .= helpLink(12);
$output .= '<h1>'.WebGUI::International::get(143).'</h1>';
$output .= '<ul>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editAuthenticationSettings">'.WebGUI::International::get(117).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editCompanyInformation">'.WebGUI::International::get(124).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editFileSettings">'.WebGUI::International::get(128).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editMailSettings">'.WebGUI::International::get(133).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editMiscSettings">'.WebGUI::International::get(140).'</a>';
$output .= '<li><a href="'.$session{page}{url}.'?op=editProfileSettings">'.WebGUI::International::get(308).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editAuthenticationSettings').
'">'.WebGUI::International::get(117).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editCompanyInformation').
'">'.WebGUI::International::get(124).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editFileSettings').
'">'.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>';
} else {
$output = WebGUI::Privilege::adminOnly();

View file

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

View file

@ -19,6 +19,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -79,8 +80,11 @@ sub www_deleteStyle {
$output .= helpLink(4);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$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 .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.
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;
} else {
return WebGUI::Privilege::adminOnly();
@ -142,15 +146,22 @@ sub www_listStyles {
if (WebGUI::Privilege::isInGroup(5)) {
$output = helpLink(9);
$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");
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>';
$i++;
}
$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 .= $dataRows;
$output .= '</table>';

View file

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

View file

@ -21,6 +21,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
@ -122,8 +123,11 @@ sub www_deleteUser {
$output .= helpLink(7);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$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 .= '&nbsp;&nbsp;&nbsp;&nbsp;<a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.
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;
} else {
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>';
$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) {
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='.
$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'.
$output .= '<tr><td><a href="'.WebGUI::URL::page('op=deleteGrouping&uid='.
$session{form}{uid}.'&gid='.$hash{groupId}).'"><img src="'.
$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
$session{page}{url}.'?op=editGrouping&uid='.$session{form}{uid}.
'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}.
WebGUI::URL::page('op=editGrouping&uid='.$session{form}{uid}.
'&gid='.$hash{groupId}).'"><img src="'.$session{setting}{lib}.
'/edit.gif" border=0></a></td>';
$output .= '<td class="tableData">'.$hash{groupName}.'</td>';
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
@ -312,7 +316,7 @@ sub www_listUsers {
$output = helpLink(8);
$output .= '<h1>'.WebGUI::International::get(149).'</h1>';
$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 .= WebGUI::Form::hidden("op","listUsers");
$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");
while (@data = $sth->array) {
$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="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.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=deleteUser&uid='.$data[0]).
'"><img src="'.$session{setting}{lib}.'/delete.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><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><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
$i++;
}
$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 .= $dataRows;
$output .= '</table>';

View file

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

View file

@ -146,7 +146,7 @@ sub open {
sub refreshPageInfo {
my (%PAGE);
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;
}

View file

@ -15,6 +15,7 @@ use strict;
use WebGUI::Attachment;
use WebGUI::International;
use WebGUI::Session;
use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&attachmentBox &formHeader &formSave &tableFormRow &helpLink);
@ -44,7 +45,7 @@ sub attachmentBox {
#-------------------------------------------------------------------
sub formHeader {
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;
}
@ -59,7 +60,7 @@ sub formSave {
sub helpLink {
my ($output, $namespace);
$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>';
return $output;
}

View file

@ -28,7 +28,7 @@ sub getStyle {
} else {
tie %style, 'Tie::CPHash';
%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>
<head>
<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::Session;
use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&sortHashDescending &sortHash &paginate &appendToUrl &randint &round &urlize);
#-------------------------------------------------------------------
sub appendToUrl {
my ($url);
$url = $_[0];
if ($url =~ /\?/) {
$url .= '&'.$_[1];
} else {
$url .= '?'.$_[1];
}
return $url;
}
our @EXPORT = qw(&sortByColumn &sortHashDescending &sortHash
&paginate &randint &round);
#-------------------------------------------------------------------
sub paginate {
@ -46,19 +36,23 @@ sub paginate {
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
$dataRows .= $row[$i];
}
$prevNextBar = '<div class="pagination">';
if ($pn > 0) {
$prevNextBar .= '<a href="'.appendToUrl($url,('pn='.($pn-1))).'">&laquo;'.WebGUI::International::get(91).'</a>';
} else {
$prevNextBar .= '&laquo;'.WebGUI::International::get(91);
if ($#row+1 > $itemsPerPage) {
$prevNextBar = '<div class="pagination">';
if ($pn > 0) {
$prevNextBar .= '<a href="'.WebGUI::URL::append($url,('pn='.($pn-1))).'">&laquo;'.
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);
}
@ -76,6 +70,27 @@ sub round {
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 {
my (%hash, %reversedHash, %newHash, $key);
@ -106,14 +121,6 @@ sub sortHashDescending {
return %reversedHash;
}
#-------------------------------------------------------------------
sub urlize {
my ($title);
$title = lc($_[0]);
$title =~ s/ /_/g;
$title =~ s/[^a-z0-9\-\.\_]//g;
return $title;
}
1;

View file

@ -20,6 +20,7 @@ use WebGUI::International;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Template;
use WebGUI::URL;
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);
@ -87,14 +88,16 @@ sub www_cut {
sub www_delete {
my ($output);
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 .= WebGUI::International::get(43);
$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 .= '</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 .= '</a></div>';
return $output;

View file

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

View file

@ -13,6 +13,7 @@ our $namespace = "EventsCalendar";
#-------------------------------------------------------------------
use strict;
use HTML::CalendarMonthSimple;
use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::International;
@ -21,8 +22,47 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
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 {
my ($sth, %data, $newWidgetId, $pageId, @row, $newEventId, $previousRecurringEventId);
@ -200,7 +240,12 @@ sub www_deleteEvent {
if ($session{form}{rid} > 0) {
$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;
} else {
return WebGUI::Privilege::insufficient();
@ -255,11 +300,16 @@ sub www_edit {
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter}));
$output .= formSave();
$output .= '</table></form>';
$output .= '<p><a href="'.$session{page}{url}.'?func=addEvent&wid='.$session{form}{wid}.'">Add New Event</a><p>';
$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>';
$sth = WebGUI::SQL->read("select eventId, name, recurringEventId from EventsCalendar_event where widgetId='$session{form}{wid}' order by startDate");
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;
$output .= '</table>';
@ -322,8 +372,11 @@ sub www_editEventSave {
#-------------------------------------------------------------------
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 %event, 'Tie::CPHash';
tie %previous, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
if ($data{displayTitle}) {
@ -332,34 +385,53 @@ sub www_view {
if ($data{description} ne "") {
$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");
while (@event = $sth->array) {
unless ($event[2] == $previous[0] && $event[3] == $previous[1]) {
$output .= "<b>".epochToHuman($event[2],"%c")." ".epochToHuman($event[2],"%D");
if (epochToHuman($event[2],"%y") ne epochToHuman($event[3],"%y")) {
$output .= ", ".epochToHuman($event[2],"%y");
$flag = 1;
($minDate) = WebGUI::SQL->quickArray("select min(startDate) from EventsCalendar_event where widgetId=$_[0]");
($maxDate) = WebGUI::SQL->quickArray("select max(endDate) from EventsCalendar_event where widgetId=$_[0]");
if ($data{calendarLayout} eq "calendar") {
$nextDate = $minDate;
while ($nextDate < $maxDate) {
$row[$i] = _calendarLayout($_[0],$nextDate);
if ($session{form}{pn} eq "" && $nextDate <= time()) {
$defaultPn = $i;
}
if ($flag || epochToHuman($event[2],"%c") ne epochToHuman($event[3],"%c")) {
$output .= " - ".epochToHuman($event[3],"%c");
$output .= " ".epochToHuman($event[3],"%D");
} elsif (epochToHuman($event[2],"%D") ne epochToHuman($event[3],"%D")) {
$output .= " - ".epochToHuman($event[3],"%D");
$i++;
$nextDate = addToDate($nextDate,0,1,0);
}
if ($session{form}{pn} eq "") {
$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;
$output .= ", ".epochToHuman($event[3],"%y");
$output .= "</b>";
$output .= "<hr size=1>";
%previous = %event;
$output .= '<span class="eventTitle">'.$event{name}.'</span>';
if ($event{description} ne "") {
$output .= ' - ';
$output .= ''.$event{description};
}
$output .= '<p>';
}
@previous = ($event[2],$event[3]);
$output .= '<span class="eventTitle">'.$event[0].'</span>';
if ($event[1] ne "") {
$output .= ' - ';
$output .= ''.$event[1];
}
$output .= '<p>';
$sth->finish;
}
$sth->finish;
if ($data{processMacros}) {
$output = WebGUI::Macro::process($output);
}

View file

@ -27,8 +27,10 @@ sub duplicate {
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into ExtraColumn values ($newWidgetId, '$data{spacer}', '$data{width}', ".quote($data{class}).")");
$newWidgetId = create($pageId,$namespace,$data{title},
$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::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget;
#-------------------------------------------------------------------
@ -153,8 +154,11 @@ sub www_deleteQuestion {
if (WebGUI::Privilege::canEditPage()) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
$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 .= ' &nbsp; <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.
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;
} else {
return WebGUI::Privilege::insufficient();
@ -187,19 +191,32 @@ sub www_edit {
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
$output .= tableFormRow(WebGUI::International::get(174),
WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
$output .= tableFormRow(WebGUI::International::get(175),
WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
%hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},'','',1));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},'','',1));
$output .= formSave();
$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>';
$sth = WebGUI::SQL->read("select questionId,question from FAQ_question where widgetId='$session{form}{wid}' order by sequenceNumber");
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;
$output .= '</table>';

View file

@ -21,6 +21,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget;
#-------------------------------------------------------------------
@ -29,9 +30,11 @@ sub duplicate {
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
$newWidgetId = create($pageId,$namespace,$data{title},
$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
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 .= '<table>';
$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();
$array[0] = $data{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description}));
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::text("linkURL",20,2048,$data{linkURL}));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$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 "") {
$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 {
$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 .= '</table></form>';

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Widget;
#-------------------------------------------------------------------
@ -158,8 +159,11 @@ sub www_deleteLink {
if (WebGUI::Privilege::canEditPage()) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
$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 .= ' &nbsp; <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.
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;
} else {
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 .= formSave();
$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>';
$sth = WebGUI::SQL->read("select linkId, name from LinkList_link where widgetId='$session{form}{wid}' order by sequenceNumber");
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;
$output .= '</table>';

View file

@ -22,6 +22,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Widget;
@ -31,7 +32,8 @@ sub duplicate {
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
$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::Discussion::duplicate($_[0],$newWidgetId);
}
@ -65,9 +67,12 @@ sub www_add {
%hash = WebGUI::Widget::getPositions();
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",'',50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::groupList("groupToPost",2));
$output .= tableFormRow(WebGUI::International::get(21,$namespace),
WebGUI::Form::groupList("groupToModerate",4));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::text("messagesPerPage",20,2,30));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
@ -86,7 +91,7 @@ sub www_addSave {
my ($widgetId);
if (WebGUI::Privilege::canEditPage()) {
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
WebGUI::SQL->write("insert into 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 "";
} else {
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 {
my ($output, %board, %hash, @array);
@ -116,17 +151,26 @@ sub www_edit {
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$board{title}));
$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}));
$output .= tableFormRow(WebGUI::International::get(99),
WebGUI::Form::text("title",20,128,$board{title}));
$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();
$array[0] = $board{templatePosition};
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$board{description},50,5,1));
$output .= tableFormRow(WebGUI::International::get(363),
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$board{description},50,5,1));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::selectList("groupToPost",$board{groupToPost}));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage}));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("editTimeout",20,2,$board{editTimeout}));
WebGUI::Form::groupList("groupToPost",$board{groupToPost}));
$output .= tableFormRow(WebGUI::International::get(21,$namespace),
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 .= '</table></form>';
return $output;
@ -140,7 +184,7 @@ sub www_edit {
sub www_editSave {
if (WebGUI::Privilege::canEditPage()) {
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 "";
} else {
return WebGUI::Privilege::insufficient();
@ -149,10 +193,13 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_editMessage {
my (%board);
my (%board,%message);
tie %board, 'Tie::CPHash';
tie %message, 'Tie::CPHash';
%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();
} else {
return WebGUI::Privilege::insufficient();
@ -161,10 +208,13 @@ sub www_editMessage {
#-------------------------------------------------------------------
sub www_editMessageSave {
my (%board);
my (%board,%message);
tie %board, 'Tie::CPHash';
tie %message, 'Tie::CPHash';
%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();
return www_showMessage();
} else {
@ -228,43 +278,61 @@ sub www_showMessage {
tie %board, 'Tie::CPHash';
%message = WebGUI::Discussion::getMessage($session{form}{mid});
%board = getProperties($namespace,$session{form}{wid});
$html .= '<h1>'.$message{subject}.'</h1>';
$html .= '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
$html .= '<b>'.WebGUI::International::get(7,$namespace).'</b> <a href="'.$session{page}{url}.'?op=viewProfile&uid='.$message{userId}.'">'.$message{username}.'</a><br>';
$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(9,$namespace)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
$html .= '</td>';
$html .= '<td rowspan=2 valign="top" class="tableMenu" nowrap>';
$html .= '<a href="'.$session{page}{url}.'?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}) {
$html .= '<a href="'.$session{page}{url}.'?func=editMessage&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(12,$namespace).'</a><br>';
if ($message{messageId}) {
$html .= '<h1>'.$message{subject}.'</h1>';
$html .= '<table width="100%" cellpadding=3 cellspacing=1 border=0><tr><td class="tableHeader">';
$html .= '<b>'.WebGUI::International::get(7,$namespace).'</b> <a href="'.
WebGUI::URL::page('op=viewProfile&uid='.$message{userId}).'">'.$message{username}.'</a><br>';
$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(9,$namespace)."</b> ".
$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<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;
}
@ -288,7 +356,10 @@ sub www_view {
if ($board{processMacros}) {
$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 .= '<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");
@ -297,24 +368,38 @@ sub www_view {
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");
($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++;
}
$html .= '</table>';
$html .= '<div class="pagination">';
if ($pn > 0) {
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'">&laquo;'.WebGUI::International::get(91).'</a>';
} else {
$html .= '&laquo;'.WebGUI::International::get(91);
}
$html .= ' &middot; ';
if (($pn+1) < round(($i/$itemsPerPage))) {
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'">'.WebGUI::International::get(92).'&raquo;</a>';
} else {
$html .= WebGUI::International::get(92).'&raquo;';
}
$html .= '</div>';
if ($i > $itemsPerPage) {
$html .= '<div class="pagination">';
if ($pn > 0) {
$html .= '<a href="'.WebGUI::URL::page('?pn='.($pn-1)).'">&laquo;'.
WebGUI::International::get(91).'</a>';
} else {
$html .= '&laquo;'.WebGUI::International::get(91);
}
$html .= ' &middot; ';
if (($pn+1) < round(($i/$itemsPerPage))) {
$html .= '<a href="'.WebGUI::URL::page('?pn='.($pn+1)).'">'.
WebGUI::International::get(92).'&raquo;</a>';
} else {
$html .= WebGUI::International::get(92).'&raquo;';
}
$html .= '</div>';
}
return $html;
}

View file

@ -19,6 +19,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
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>',
WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on'));
$output .= formSave();
$output .= tableFormRow("",'<a href="'.$session{page}{url}.'?func=resetVotes&wid='.$session{form}{wid}.'">'.WebGUI::International::get(10,$namespace).'</a>');
$output .= tableFormRow("",'<a href="'.WebGUI::URL::page('func=resetVotes&wid='.$session{form}{wid})
.'">'.WebGUI::International::get(10,$namespace).'</a>');
$output .= '</table></form>';
return $output;
} else {

View file

@ -20,6 +20,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Widget;
@ -238,12 +239,10 @@ sub www_view {
$i++;
}
$sth->finish;
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row);
($dataRows, $prevNextBar) = paginate($data{paginateAfter},WebGUI::URL::page(),\@row);
$output .= $dataRows;
$output .= $template[2];
if ($#row > $data{paginateAfter}) {
$output .= $prevNextBar;
}
$output .= $prevNextBar;
} else {
$output .= WebGUI::International::get(11,$namespace).'<p>';
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::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
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");
while (@data = $sth->array) {
if (WebGUI::Privilege::canViewPage($data[2])) {
$output .= $depth.$_[4].' <a href="'.$session{config}{scripturl}.
'/'.$data[0].'">'.$data[1].'</a>';
$output .= $depth.$_[4].' <a href="'.WebGUI::URL::gateway($data[0])
.'">'.$data[1].'</a>';
$output .= $lineSpacing;
$output .= _traversePageTree($data[2],$_[1]+1,$_[2],$_[3],$_[4],$_[5]);
}

View file

@ -24,6 +24,7 @@ use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
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>';
$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) {
$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;
$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}')");
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 "";
} else {
@ -161,7 +172,8 @@ sub www_approveSubmission {
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
%userSubmission = getProperties($namespace,$session{form}{wid});;
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});
return WebGUI::Operation::www_viewMessageLog();
} else {
@ -210,8 +222,9 @@ sub www_deleteSubmission {
if ($owner == $session{user}{userId}) {
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
$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 .= ' &nbsp; <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('func=deleteSubmissionConfirm&wid='.
$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;
} else {
return WebGUI::Privilege::insufficient();
@ -237,7 +250,8 @@ sub www_denySubmission {
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
%userSubmission = getProperties($namespace,$session{form}{wid});
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});
return WebGUI::Operation::www_viewMessageLog();
} 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(31,$namespace),WebGUI::Form::textArea("content",$submission{content},50,10));
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 {
$output .= tableFormRow(WebGUI::International::get(32,$namespace),WebGUI::Form::file("image"));
}
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 {
$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}");
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();
} 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");
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++;
}
$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>';
($dataRows, $prevNextBar) = paginate($data{submissionsPerPage},$session{page}{url},\@row);
$output .= '<table width="100%" cellpadding=3 cellspacing=0 border=0><tr>'.
'<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 .= '<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;
@ -397,19 +423,27 @@ sub www_viewSubmission {
$output .= '<table width="100%" cellpadding=2 cellspacing=1 border=0>';
$output .= '<tr><td class="tableHeader">';
#---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 .= '</td><td rowspan="2" class="tableMenu" nowrap valign="top">';
#---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}) {
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(37,$namespace).'</a><br>';
$output .= '<a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(27,$namespace).'</a><br>';
$output .= '<a href="'.WebGUI::URL::page('func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.
$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}))) {
$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="'.$session{page}{url}.'?op=viewMessageLog">'.WebGUI::International::get(25,$namespace).'</a><br>';
$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>';
$output .= '<a href="'.WebGUI::URL::page('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('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">';
#---content