WebGUI 3.5.0 release
This commit is contained in:
parent
6633adf10d
commit
0df316d3f0
25 changed files with 599 additions and 158 deletions
|
|
@ -16,6 +16,7 @@ use strict;
|
|||
use Tie::CPHash;
|
||||
use WebGUI::Attachment;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Discussion;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
|
|
@ -25,6 +26,31 @@ use WebGUI::SQL;
|
|||
use WebGUI::URL;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _showReplies {
|
||||
my ($sth, @data, $html, %board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = getProperties($namespace,$session{form}{wid});
|
||||
$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(22,$namespace).'</td><td class="tableHeader">'.WebGUI::International::get(23,$namespace).'</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select messageId,subject,username,dateOfPost,userId from discussion where widgetId=$session{form}{wid} and pid=0 order by messageId desc");
|
||||
while (@data = $sth->array) {
|
||||
$html .= '<tr';
|
||||
if ($data[0] == $session{form}{mid}) {
|
||||
$html .= ' class="highlight"';
|
||||
}
|
||||
$html .= '><td class="tableData"><a href="'.WebGUI::URL::page('func=showMessage&mid='.
|
||||
$data[0].'&wid='.$session{form}{wid}).'">'.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($data[0],1);
|
||||
}
|
||||
$html .= '</table>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
my (%data, $newWidgetId, $pageId, $file);
|
||||
|
|
@ -40,12 +66,14 @@ sub duplicate {
|
|||
WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".
|
||||
quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".
|
||||
quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}', ".
|
||||
quote($data{alignImage}).")");
|
||||
quote($data{alignImage}).", $data{allowDiscussion}, $data{groupToPost}, $data{groupToModerate}, $data{editTimeout})");
|
||||
WebGUI::Discussion::duplicate($_[0],$newWidgetId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
purgeWidget($_[0],$_[1],$namespace);
|
||||
WebGUI::Discussion::purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -85,6 +113,14 @@ sub www_add {
|
|||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("linkURL",20,2048));
|
||||
$output .= tableFormRow(WebGUI::International::get(9,$namespace),WebGUI::Form::file("attachment"));
|
||||
$output .= tableFormRow(WebGUI::International::get(10,$namespace),WebGUI::Form::checkbox("convertCarriageReturns",1).' <span style="font-size: 8pt;">'.WebGUI::International::get(11,$namespace).'</span>');
|
||||
$output .= tableFormRow(WebGUI::International::get(18,$namespace),
|
||||
WebGUI::Form::checkbox("allowDiscussion",1));
|
||||
$output .= tableFormRow(WebGUI::International::get(19,$namespace),
|
||||
WebGUI::Form::groupList("groupToPost",2));
|
||||
$output .= tableFormRow(WebGUI::International::get(20,$namespace),
|
||||
WebGUI::Form::groupList("groupToModerate",4));
|
||||
$output .= tableFormRow(WebGUI::International::get(21,$namespace),
|
||||
WebGUI::Form::text("editTimeout",20,3,1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -115,7 +151,12 @@ sub www_addSave {
|
|||
quote($session{form}{linkURL}).", ".
|
||||
quote($attachment->getFilename).
|
||||
", '$session{form}{convertCarriageReturns}', ".
|
||||
quote($session{form}{alignImage}).")");
|
||||
quote($session{form}{alignImage}).", ".
|
||||
"'$session{form}{allowDiscussion}', ".
|
||||
"'$session{form}{groupToPost}', ".
|
||||
"'$session{form}{groupToModerate}', ".
|
||||
"'$session{form}{editTimeout}' ".
|
||||
")");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -152,6 +193,36 @@ sub www_deleteImage {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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, %data, %hash, @array);
|
||||
|
|
@ -211,6 +282,14 @@ sub www_edit {
|
|||
$output .= tableFormRow(WebGUI::International::get(10,$namespace),
|
||||
WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}).
|
||||
' <span style="font-size: 8pt;">'.WebGUI::International::get(11,$namespace).'</span>');
|
||||
$output .= tableFormRow(WebGUI::International::get(18,$namespace),
|
||||
WebGUI::Form::checkbox("allowDiscussion","1",$data{allowDiscussion}));
|
||||
$output .= tableFormRow(WebGUI::International::get(19,$namespace),
|
||||
WebGUI::Form::groupList("groupToPost",$data{groupToPost}));
|
||||
$output .= tableFormRow(WebGUI::International::get(20,$namespace),
|
||||
WebGUI::Form::groupList("groupToModerate",$data{groupToModerate}));
|
||||
$output .= tableFormRow(WebGUI::International::get(22,$namespace),
|
||||
WebGUI::Form::text("editTimeout",20,2,$data{editTimeout}));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -240,7 +319,10 @@ sub www_editSave {
|
|||
"', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".
|
||||
quote($session{form}{body}).", linkTitle=".
|
||||
quote($session{form}{linkTitle}).", linkURL=".
|
||||
quote($session{form}{linkURL}).$sqlAdd.
|
||||
quote($session{form}{linkURL}).", allowDiscussion='$session{form}{allowDiscussion}',".
|
||||
"groupToModerate='$session{form}{groupToModerate}', groupToPost='$session{form}{groupToPost}'".
|
||||
", editTimeout='$session{form}{editTimeout}'".
|
||||
$sqlAdd.
|
||||
" where widgetId=$session{form}{wid}");
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -248,9 +330,129 @@ sub www_editSave {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessage {
|
||||
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::editMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMessageSave {
|
||||
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})) {
|
||||
WebGUI::Discussion::editMessageSave();
|
||||
return www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessage {
|
||||
my (%board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = getProperties($namespace,$session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessageSave {
|
||||
my (%board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = getProperties($namespace,$session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postNewMessageSave();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReply {
|
||||
my (%board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = getProperties($namespace,$session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
return WebGUI::Discussion::postReply();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReplySave {
|
||||
my (%board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = getProperties($namespace,$session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
WebGUI::Discussion::postReplySave();
|
||||
return www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_showMessage {
|
||||
my (@data, $html, %board, %message, $defaultMid);
|
||||
tie %message, 'Tie::CPHash';
|
||||
tie %board, 'Tie::CPHash';
|
||||
($defaultMid) = WebGUI::SQL->quickArray("select min(messageId) from discussion where widgetId=$session{form}{wid}");
|
||||
$session{form}{mid} = $defaultMid if ($session{form}{mid} eq "");
|
||||
%message = WebGUI::Discussion::getMessage($session{form}{mid});
|
||||
%board = getProperties($namespace,$session{form}{wid});
|
||||
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(22,$namespace).'</b> <a href="'.
|
||||
WebGUI::URL::page('op=viewProfile&uid='.$message{userId}).'">'.$message{username}.'</a><br>';
|
||||
$html .= "<b>".WebGUI::International::get(23,$namespace)."</b> ".
|
||||
epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<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(24,$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(25,$namespace).'</a><br>';
|
||||
$html .= '<a href="'.WebGUI::URL::page('func=deleteMessage&mid='.$session{form}{mid}.
|
||||
'&wid='.$session{form}{wid}).'">'.WebGUI::International::get(26,$namespace).'</a><br>';
|
||||
}
|
||||
$html .= '<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(27,$namespace).'</a><br>';
|
||||
$html .= '</tr><tr><td class="tableData">';
|
||||
$html .= $message{message};
|
||||
$html .= '</td></tr></table>';
|
||||
$html .= _showReplies();
|
||||
} else {
|
||||
$html = WebGUI::International::get(402);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @test, $output, $image);
|
||||
my (%data, @test, $output, $image, $replies);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
if ($data{startDate}<time() && $data{endDate}>time()) {
|
||||
|
|
@ -281,9 +483,20 @@ sub www_view {
|
|||
$output .= attachmentBox($data{attachment},$_[0]);
|
||||
}
|
||||
}
|
||||
if ($data{processMacros} == 1) {
|
||||
if ($data{processMacros}) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
if ($data{allowDiscussion}) {
|
||||
($replies) = WebGUI::SQL->quickArray("select count(*) from discussion where widgetId=$_[0]");
|
||||
$output .= '<p><table width="100%" cellspacing="2" cellpadding="1" border="0">';
|
||||
$output .= '<tr><td align="center" width="50%" class="tableMenu"><a href="'.
|
||||
WebGUI::URL::page('func=showMessage&wid='.$_[0]).'">'.
|
||||
WebGUI::International::get(28,$namespace).' ('.$replies.')</a></td>';
|
||||
$output .= '<td align="center" width="50%" class="tableMenu"><a href="'.
|
||||
WebGUI::URL::page('func=postNewMessage&wid='.$_[0]).'">'.
|
||||
WebGUI::International::get(24,$namespace).'</a></td></tr>';
|
||||
$output .= '</table>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ use WebGUI::Widget;
|
|||
#-------------------------------------------------------------------
|
||||
sub _calendarLayout {
|
||||
my ($thisMonth, $calendar, $message, $start, $end, $sth, %event, $nextDate);
|
||||
tie %event, 'Tie::CPHash';
|
||||
$thisMonth = epochToHuman($_[1],"%M %y");
|
||||
$calendar = new HTML::CalendarMonthSimple('year'=>epochToHuman($_[1],"%y"),'month'=>epochToHuman($_[1],"%M"));
|
||||
$calendar->width("100%");
|
||||
|
|
@ -391,7 +392,10 @@ sub www_view {
|
|||
($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]");
|
||||
($junk, $maxDate) = WebGUI::DateTime::monthStartEnd($maxDate);
|
||||
|
||||
unless ($minDate && $maxDate) {
|
||||
$minDate = time();
|
||||
$maxDate = time()+86400;
|
||||
}
|
||||
if ($data{calendarLayout} eq "calendar") {
|
||||
$nextDate = $minDate;
|
||||
while ($nextDate <= $maxDate) {
|
||||
|
|
|
|||
|
|
@ -113,10 +113,10 @@ sub www_addSave {
|
|||
quote($session{form}{DSN}).", ".
|
||||
quote($session{form}{username}).", ".
|
||||
quote($session{form}{identifier}).", ".
|
||||
quote($session{form}{convertCarriageReturns}).", ".
|
||||
quote($session{form}{paginateAfter}).", ".
|
||||
quote($session{form}{preprocessMacros}).", ".
|
||||
quote($session{form}{debugMode}).
|
||||
"'$session{form}{convertCarriageReturns}', ".
|
||||
"'$session{form}{paginateAfter}', ".
|
||||
"'$session{form}{preprocessMacros}', ".
|
||||
"'$session{form}{debugMode}'".
|
||||
")");
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -192,13 +192,13 @@ sub www_editSave {
|
|||
update();
|
||||
WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).
|
||||
", dbQuery=".quote($session{form}{dbQuery}).
|
||||
", convertCarriageReturns=".quote($session{form}{convertCarriageReturns}).
|
||||
", convertCarriageReturns='$session{form}{convertCarriageReturns}'".
|
||||
", DSN=".quote($session{form}{DSN}).
|
||||
", username=".quote($session{form}{username}).
|
||||
", identifier=".quote($session{form}{identifier}).
|
||||
", paginateAfter=".quote($session{form}{paginateAfter}).
|
||||
", preprocessMacros=".quote($session{form}{preprocessMacros}).
|
||||
", debugMode=".quote($session{form}{debugMode}).
|
||||
", paginateAfter='$session{form}{paginateAfter}'".
|
||||
", preprocessMacros='$session{form}{preprocessMacros}'".
|
||||
", debugMode='$session{form}{debugMode}'".
|
||||
" where widgetId=$session{form}{wid}");
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -209,7 +209,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (@row, $i, $p, $ouch, %data, $output, $sth, $dbh, @result,
|
||||
@template, $temp, $col);
|
||||
@template, $temp, $col, $errorMessage);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
if (%data) {
|
||||
|
|
@ -230,53 +230,57 @@ sub www_view {
|
|||
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The DSN specified is of an improper format.");
|
||||
}
|
||||
if (defined $dbh) {
|
||||
if ($data{dbQuery} =~ /select/i) {
|
||||
if ($data{dbQuery} =~ /select/i || $data{dbQuery} =~ /show/i || $data{dbQuery} =~ /describe/i) {
|
||||
$sth = WebGUI::SQL->unconditionalRead($data{dbQuery},$dbh);
|
||||
} else {
|
||||
$output .= WebGUI::International::get(10,$namespace).'<p>' if ($data{debugMode});
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The SQL query is improperly formatted.");
|
||||
}
|
||||
unless ($sth->array) {
|
||||
$output .= WebGUI::International::get(11,$namespace).'<p>' if ($data{debugMode});
|
||||
WebGUI::ErrorHandler::warn("There was a problem with the query.");
|
||||
} else {
|
||||
if ($data{template} ne "") {
|
||||
@template = split(/\^\-\;/,$data{template});
|
||||
unless ($sth->errorCode < 1) {
|
||||
$errorMessage = $sth->errorMessage;
|
||||
$output .= WebGUI::International::get(11,$namespace).' : '.
|
||||
$errorMessage.'<p>' if ($data{debugMode});
|
||||
WebGUI::ErrorHandler::warn("There was a problem with the query: ".
|
||||
$errorMessage);
|
||||
} else {
|
||||
$i = 0;
|
||||
$template[0] = '<table width="100%"><tr>';
|
||||
$template[1] = '<tr>';
|
||||
foreach $col ($sth->getColumnNames) {
|
||||
$template[0] .= '<td class="tableHeader">'.$col.'</td>';
|
||||
$template[1] .= '<td class="tableData">^'.$i.';</td>';
|
||||
if ($data{template} ne "") {
|
||||
@template = split(/\^\-\;/,$data{template});
|
||||
} else {
|
||||
$i = 0;
|
||||
$template[0] = '<table width="100%"><tr>';
|
||||
$template[1] = '<tr>';
|
||||
foreach $col ($sth->getColumnNames) {
|
||||
$template[0] .= '<td class="tableHeader">'.$col.'</td>';
|
||||
$template[1] .= '<td class="tableData">^'.$i.';</td>';
|
||||
$i++;
|
||||
}
|
||||
$template[0] .= '</tr>';
|
||||
$template[1] .= '</tr>';
|
||||
$template[2] = '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
$output .= $template[0];
|
||||
while (@result = $sth->array) {
|
||||
$temp = $template[1];
|
||||
$temp =~ s/\^(\d*)\;/$result[$1]/g;
|
||||
if ($data{convertCarriageReturns}) {
|
||||
$temp =~ s/\n/\<br\>/g;
|
||||
}
|
||||
$row[$i] = $temp;
|
||||
$i++;
|
||||
}
|
||||
$template[0] .= '</tr>';
|
||||
$template[1] .= '</tr>';
|
||||
$template[2] = '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
$output .= $template[0];
|
||||
while (@result = $sth->array) {
|
||||
$temp = $template[1];
|
||||
$temp =~ s/\^(\d*)\;/$result[$1]/g;
|
||||
if ($data{convertCarriageReturns}) {
|
||||
$temp =~ s/\n/\<br\>/g;
|
||||
if ($sth->rows < 1) {
|
||||
$output .= $template[2];
|
||||
$output .= WebGUI::International::get(18,$namespace).'<p>';
|
||||
} else {
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page(),
|
||||
\@row,$data{paginateAfter});
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= $template[2];
|
||||
$output .= $p->getBar($session{form}{pn});
|
||||
}
|
||||
$row[$i] = $temp;
|
||||
$i++;
|
||||
$sth->finish;
|
||||
}
|
||||
if ($sth->rows < 1) {
|
||||
$output .= $template[2];
|
||||
$output .= WebGUI::International::get(18,$namespace).'<p>';
|
||||
} else {
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$data{paginateAfter});
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= $template[2];
|
||||
$output .= $p->getBar($session{form}{pn});
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
} else {
|
||||
$output .= WebGUI::International::get(10,$namespace).'<p>' if ($data{debugMode});
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The SQL query is improperly formatted.");
|
||||
}
|
||||
$dbh->disconnect();
|
||||
} else {
|
||||
$output .= WebGUI::International::get(12,$namespace).'<p>' if ($data{debugMode});
|
||||
|
|
|
|||
|
|
@ -31,20 +31,23 @@ sub _traversePageTree {
|
|||
} else {
|
||||
$toLevel = 99;
|
||||
}
|
||||
for ($i=1;$i<=$_[1]*$_[3];$i++) {
|
||||
for ($i=1;$i<=($_[1]*$_[3]);$i++) {
|
||||
$depth .= " ";
|
||||
}
|
||||
for ($i=1;$i<=$_[5];$i++) {
|
||||
$lineSpacing .= "<br>";
|
||||
}
|
||||
if ($_[1] < $toLevel) {
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber");
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId, synopsis from page where parentId='$_[0]' order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.$_[4].' <a href="'.WebGUI::URL::gateway($data[0])
|
||||
.'">'.$data[1].'</a>';
|
||||
if ($data[3] ne "" && $_[6]) {
|
||||
$output .= ' - '.$data[3];
|
||||
}
|
||||
$output .= $lineSpacing;
|
||||
$output .= _traversePageTree($data[2],$_[1]+1,$_[2],$_[3],$_[4],$_[5]);
|
||||
$output .= _traversePageTree($data[2],($_[1]+1),$_[2],$_[3],$_[4],$_[5],$_[6]);
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -59,7 +62,7 @@ sub duplicate {
|
|||
%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 SiteMap values ($newWidgetId, '$data{startAtThisLevel}', '$data{depth}', '$data{indent}', ".quote($data{bullet}).", '$data{lineSpacing}')");
|
||||
WebGUI::SQL->write("insert into SiteMap values ($newWidgetId, '$data{startAtThisLevel}', '$data{depth}', '$data{indent}', ".quote($data{bullet}).", '$data{lineSpacing}', '$data{displaySynopsis}')");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -87,13 +90,19 @@ sub www_add {
|
|||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::checkbox("startAtThisLevel",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(9,$namespace),
|
||||
WebGUI::Form::checkbox("displaySynopsis",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::checkbox("startAtThisLevel",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("depth",20,2,0));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("indent",20,2,5));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("bullet",20,30,'·'));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("lineSpacing",20,1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),
|
||||
WebGUI::Form::text("bullet",20,30,'·'));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),
|
||||
WebGUI::Form::text("lineSpacing",20,1,1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -108,7 +117,7 @@ sub www_addSave {
|
|||
my ($widgetId, $displayTitle, $image, $attachment);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
|
||||
WebGUI::SQL->write("insert into SiteMap values ($widgetId, '$session{form}{startAtThisLevel}', '$session{form}{depth}', '$session{form}{indent}', ".quote($session{form}{bullet}).", '$session{form}{lineSpacing}')");
|
||||
WebGUI::SQL->write("insert into SiteMap values ($widgetId, '$session{form}{startAtThisLevel}', '$session{form}{depth}', '$session{form}{indent}', ".quote($session{form}{bullet}).", '$session{form}{lineSpacing}', '$session{form}{displaySynopsis})");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -138,18 +147,30 @@ sub www_edit {
|
|||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
|
||||
$output .= tableFormRow(WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,128,$data{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$array[0] = $data{templatePosition};
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("depth",20,2,$data{depth}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("indent",20,2,$data{indent}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("bullet",20,30,$data{bullet}));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("lineSpacing",20,1,$data{lineSpacing}));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",$data{description},50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(9,$namespace),
|
||||
WebGUI::Form::checkbox("displaySynopsis",1,$data{displaySynopsis}));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
|
||||
WebGUI::Form::text("depth",20,2,$data{depth}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
|
||||
WebGUI::Form::text("indent",20,2,$data{indent}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),
|
||||
WebGUI::Form::text("bullet",20,30,$data{bullet}));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),
|
||||
WebGUI::Form::text("lineSpacing",20,1,$data{lineSpacing}));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -184,7 +205,7 @@ sub www_view {
|
|||
} else {
|
||||
$parent = 1;
|
||||
}
|
||||
$output .= _traversePageTree($parent,0,$data{depth},$data{indent},$data{bullet},$data{lineSpacing});
|
||||
$output .= _traversePageTree($parent,0,$data{depth},$data{indent},$data{bullet},$data{lineSpacing},$data{displaySynopsis});
|
||||
if ($data{processMacros}) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ sub www_addSubmission {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_addSubmissionSave {
|
||||
my ($title, $submissionId, $image, $attachment, %userSubmission);
|
||||
tie %userSubmission, 'Tie::CPHash';
|
||||
%userSubmission = getProperties($namespace,$session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($userSubmission{groupToContribute},$session{user}{userId})) {
|
||||
$submissionId = getNextId("submissionId");
|
||||
|
|
@ -181,7 +182,9 @@ sub www_addSubmissionSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_approveSubmission {
|
||||
my (%userSubmission, %submission);
|
||||
my (%submission, %userSubmission);
|
||||
tie %submission, 'Tie::CPHash';
|
||||
tie %userSubmission, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(4,$session{user}{userId}) || WebGUI::Privilege::isInGroup(3,$session{user}{userId})) {
|
||||
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
|
||||
%userSubmission = getProperties($namespace,$session{form}{wid});;
|
||||
|
|
@ -262,6 +265,8 @@ sub www_deleteSubmissionConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_denySubmission {
|
||||
my (%submission, %userSubmission);
|
||||
tie %submission, 'Tie::CPHash';
|
||||
tie %userSubmission, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(4,$session{user}{userId}) || WebGUI::Privilege::isInGroup(3,$session{user}{userId})) {
|
||||
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
|
||||
%userSubmission = getProperties($namespace,$session{form}{wid});
|
||||
|
|
@ -471,7 +476,7 @@ sub www_viewSubmission {
|
|||
$output .= '</td</tr><tr><td class="tableData">';
|
||||
#---content
|
||||
if ($submission{image} ne "") {
|
||||
$file = WebGUI::Attachment->new($submission{filename},$session{form}{wid},$session{form}{sid});
|
||||
$file = WebGUI::Attachment->new($submission{image},$session{form}{wid},$session{form}{sid});
|
||||
$output .= '<img src="'.$file->getURL.'" hspace=3 align="right">';
|
||||
}
|
||||
if ($submission{convertCarriageReturns}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue