WebGUI 0.11.0 release
This commit is contained in:
parent
1b82634d23
commit
f0d80bbfb3
19 changed files with 207 additions and 98 deletions
|
|
@ -28,6 +28,30 @@ sub _recurseCrumbTrail {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _traversePageTree {
|
||||
my ($sth, @data, $output, $depth, $i, $toLevel);
|
||||
if ($_[2] > 0) {
|
||||
$toLevel = $_[2];
|
||||
} else {
|
||||
$toLevel = 99;
|
||||
}
|
||||
for ($i=0;$i<=$_[1];$i++) {
|
||||
$depth .= " ";
|
||||
}
|
||||
if ($_[1] < $toLevel) {
|
||||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.'<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[0].'">'.$data[1].'</a><br>';
|
||||
$output .= _traversePageTree($data[2],$_[1]+1,$_[2]);
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
|
|
@ -38,7 +62,7 @@ sub process {
|
|||
}
|
||||
#---page url---
|
||||
if ($output =~ /\^\//) {
|
||||
$output =~ s/\^\//\$session{env}{SCRIPT_NAME}/g;
|
||||
$output =~ s/\^\//$session{env}{SCRIPT_NAME}/g;
|
||||
}
|
||||
#---username---
|
||||
if ($output =~ /\^\@/) {
|
||||
|
|
@ -46,7 +70,7 @@ sub process {
|
|||
}
|
||||
#---uid---
|
||||
if ($output =~ /\^\#/) {
|
||||
$output =~ s/\^\#/$session{page}{userId}/g;
|
||||
$output =~ s/\^\#/$session{user}{userId}/g;
|
||||
}
|
||||
#---random number---
|
||||
if ($output =~ /\^\*/) {
|
||||
|
|
@ -76,6 +100,21 @@ sub process {
|
|||
if ($output =~ /\^e/) {
|
||||
$output =~ s/\^e/$session{setting}{companyEmail}/g;
|
||||
}
|
||||
#---full menu (vertical)---
|
||||
if ($output =~ /\^f/) {
|
||||
$temp = _traversePageTree(1,0);
|
||||
$output =~ s/\^f/$temp/g;
|
||||
}
|
||||
#---2 level menu (vertical)---
|
||||
if ($output =~ /\^F/) {
|
||||
$temp = _traversePageTree(1,0,2);
|
||||
$output =~ s/\^F/$temp/g;
|
||||
}
|
||||
#---3 level menu (vertical)---
|
||||
if ($output =~ /\^h/) {
|
||||
$temp = _traversePageTree(1,0,3);
|
||||
$output =~ s/\^h/$temp/g;
|
||||
}
|
||||
#---home link---
|
||||
if ($output =~ /\^H/) {
|
||||
$temp = '<a href="'.$session{env}{SCRIPT_NAME}.'/home">Home</a>';
|
||||
|
|
|
|||
|
|
@ -153,7 +153,8 @@ sub www_listUsers {
|
|||
$sth = WebGUI::SQL->read("select userId,username,email from user where username<>'Reserved' order by username limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
#$output .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
$output .= '<td>'.$data[1].'</td>';
|
||||
$output .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ sub canViewPage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub insufficient {
|
||||
return '<h1>Permission Denied!</h1>You do not have sufficient privileges to perform this operation. Please log in with an account that has sufficient privileges before attempting this operation.<p>';
|
||||
return '<h1>Permission Denied!</h1>You do not have sufficient privileges to perform this operation. Please <a href="'.$session{page}{url}.'?op=displayLogin">log in with an account</a> that has sufficient privileges before attempting this operation.<p>';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -64,6 +64,9 @@ sub isInGroup {
|
|||
$uid = $session{user}{userId};
|
||||
}
|
||||
($result) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId='$gid' && userId='$uid'",$session{dbh});
|
||||
if ($result < 1 && $gid == 1) { # registered users can
|
||||
isInGroup(2, $uid); # do anything visitors
|
||||
} # can do
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ sub _getSessionVars {
|
|||
if ($_[0] ne "") {
|
||||
%vars = WebGUI::SQL->quickHash("select * from session where sessionId='$_[0]'", $_[1]);
|
||||
if ($vars{sessionId} ne "") {
|
||||
WebGUI::SQL->write("update session set lastPageView=now(), expires=date_add(now(),interval $_[2] second) where sessionId='$_[0]'",$_[1]);
|
||||
WebGUI::SQL->write("update session set lastPageView=now(), lastIP='$ENV{REMOTE_ADDR}', expires=date_add(now(),interval $_[2] second) where sessionId='$_[0]'",$_[1]);
|
||||
}
|
||||
}
|
||||
return %vars;
|
||||
|
|
@ -94,7 +94,7 @@ sub httpRedirect {
|
|||
#-------------------------------------------------------------------
|
||||
sub open {
|
||||
my ($key, %WebGUI, %CONFIG, %VARS, %PAGE, %FORM, $query, %COOKIES, $config, %USER, %SETTINGS, $dbh);
|
||||
%WebGUI = (version=>"0.10.0", date=>"2001-08-17");
|
||||
%WebGUI = (version=>"0.11.0", date=>"2001-08-22");
|
||||
$config = new WebGUI::Config '../etc/WebGUI.conf';
|
||||
foreach ($config->param) {
|
||||
$CONFIG{$_} = $config->param($_);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ sub widgetName {
|
|||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Article</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=23"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Article</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","Article");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
|
|
@ -89,7 +89,7 @@ sub www_edit {
|
|||
my ($output, %article);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%article = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, date_format(Article.startDate,'%m/%d/%Y') as start, date_format(Article.endDate,'%m/%d/%Y') as end, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment, widget.processMacros from widget left join Article on (widget.widgetId=Article.widgetId) where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<h1>Edit Article</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=24"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Article</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
|
|
|
|||
|
|
@ -201,8 +201,9 @@ sub www_view {
|
|||
$output .= '<span class="eventTitle">'.$event[0].'</span>';
|
||||
if ($event[1] ne "") {
|
||||
$output .= ' - ';
|
||||
$output .= ''.$event[1].'<p>';
|
||||
$output .= ''.$event[1];
|
||||
}
|
||||
$output .= '<p>';
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ sub widgetName {
|
|||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Column</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=25"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Column</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","ExtraColumn");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= WebGUI::Form::hidden("title","column");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Spacer</td><td>'.WebGUI::Form::text("spacer",20,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Width</td><td>'.WebGUI::Form::text("width",20,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">StyleSheet Class</td><td>'.WebGUI::Form::text("class",20,50).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Spacer</td><td>'.WebGUI::Form::text("spacer",20,3,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Width</td><td>'.WebGUI::Form::text("width",20,3,200).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">StyleSheet Class</td><td>'.WebGUI::Form::text("class",20,50,"content").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -60,7 +60,7 @@ sub www_edit {
|
|||
my ($output, %data);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from ExtraColumn where widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<h1>Edit Column</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=26"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Column</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= WebGUI::Form::hidden("title","column");
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ sub www_view {
|
|||
$sth = WebGUI::SQL->read("select questionId,question,answer from faqQuestion where widgetId='$widgetId' order by sequenceNumber",$session{dbh});
|
||||
while (@question = $sth->array) {
|
||||
$output .= '<li><a href="#'.$question[0].'">'.$question[1].'</a>';
|
||||
$qNa .= '<span class="faqQuestion"><a name="'.$question[0].'">'.$question[1].'</a></span><br>'.$question[2].'<p>';
|
||||
$qNa .= '<a name="'.$question[0].'"><span class="faqQuestion">'.$question[1].'</span></a><br>'.$question[2].'<p>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</ul>'.$qNa;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ sub www_postReply {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_postReplySave {
|
||||
my ($rid, %board);
|
||||
my ($rid, %board, $mid);
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
|
|
@ -248,8 +248,9 @@ sub www_postReplySave {
|
|||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' (eom)';
|
||||
}
|
||||
$mid = getNextId("messageId");
|
||||
($rid) = WebGUI::SQL->quickArray("select rid from message where messageId=$session{form}{mid}",$session{dbh});
|
||||
WebGUI::SQL->write("insert into message set userId=$session{user}{userId}, username=".quote($session{user}{username}).", subject=".quote($session{form}{subject}).", message=".quote($session{form}{message}).", rid=$rid, widgetId=$session{form}{wid}, pid=$session{form}{mid}, dateOfPost=now()", $session{dbh});
|
||||
WebGUI::SQL->write("insert into message set messageId=$mid, userId=$session{user}{userId}, username=".quote($session{user}{username}).", subject=".quote($session{form}{subject}).", message=".quote($session{form}{message}).", rid=$rid, widgetId=$session{form}{wid}, pid=$session{form}{mid}, dateOfPost=now()", $session{dbh});
|
||||
return www_showMessage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ sub _viewPoll {
|
|||
if ($poll{displayTitle} == 1) {
|
||||
$output = "<h2>".$poll{title}."</h2>";
|
||||
}
|
||||
if ($poll{description} ne "") {
|
||||
$output .= $poll{description}.'<p>';
|
||||
}
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden('wid',$widgetId);
|
||||
$output .= WebGUI::Form::hidden('func','vote');
|
||||
|
|
@ -51,6 +54,9 @@ sub _viewResults {
|
|||
if ($poll{displayTitle} == 1) {
|
||||
$output = "<h2>".$poll{title}."</h2>";
|
||||
}
|
||||
if ($poll{description} ne "") {
|
||||
$output .= $poll{description}.'<p>';
|
||||
}
|
||||
$output .= '<span class="pollQuestion">'.$poll{question}.'</span>';
|
||||
($totalResponses) = WebGUI::SQL->quickArray("select count(*) from pollAnswer where widgetId=$widgetId",$session{dbh});
|
||||
if ($totalResponses < 1) {
|
||||
|
|
@ -77,16 +83,17 @@ sub www_add {
|
|||
my ($output, %hash);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Poll</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=28"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Poll</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","Poll");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Active</td><td>'.WebGUI::Form::checkbox("active",1,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">Who can vote?</td><td>'.WebGUI::Form::selectList("voteGroup",\%hash,).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Graph Width</td><td>'.WebGUI::Form::text("graphWidth",20,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Graph Width</td><td>'.WebGUI::Form::text("graphWidth",20,3,150).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Question</td><td>'.WebGUI::Form::text("question",50,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Answers<span><br>(Enter one answer per line. No more than 20.)</span></td><td>'.WebGUI::Form::textArea("answers",'',50,8,0,'on').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
|
|
@ -117,12 +124,13 @@ sub www_edit {
|
|||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<h1>Edit Poll</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=29"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Poll</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Active</td><td>'.WebGUI::Form::checkbox("active",1,$data{active}).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$array[0] = $data{voteGroup};
|
||||
|
|
@ -158,7 +166,10 @@ sub www_view {
|
|||
if ($data{active} eq "0") {
|
||||
$output = _viewResults($_[0]);
|
||||
} elsif (WebGUI::Privilege::isInGroup($data{voteGroup},$session{user}{userId})) {
|
||||
($hasVoted) = WebGUI::SQL->quickArray("select count(*) from pollAnswer where userId=$session{user}{userId} and widgetId=$_[0]",$session{dbh});
|
||||
($hasVoted) = WebGUI::SQL->quickArray("select count(*) from pollAnswer where (userId=$session{user}{userId} or (userId=1 and ipAddress<>'$session{env}{REMOTE_ADDR}')) and widgetId=$_[0]",$session{dbh});
|
||||
unless (WebGUI::Privilege::isInGroup($data{voteGroup},$session{user}{userId})) {
|
||||
$hasVoted = 1;
|
||||
}
|
||||
if ($hasVoted) {
|
||||
$output = _viewResults($_[0]);
|
||||
} else {
|
||||
|
|
@ -172,7 +183,11 @@ sub www_view {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_vote {
|
||||
WebGUI::SQL->write("insert into pollAnswer set widgetId=$session{form}{wid}, userId=$session{user}{userId}, answer='$session{form}{answer}'",$session{dbh});
|
||||
my ($voteGroup);
|
||||
($voteGroup) = WebGUI::SQL->quickArray("select voteGroup from Poll where widgetId='$session{form}{wid}'",$session{dbh});
|
||||
if (WebGUI::Privilege::isInGroup($voteGroup,$session{user}{userId})) {
|
||||
WebGUI::SQL->write("insert into pollAnswer set widgetId=$session{form}{wid}, userId=$session{user}{userId}, answer='$session{form}{answer}', ipAddress='$session{env}{REMOTE_ADDR}'",$session{dbh});
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ sub www_addSave {
|
|||
sub www_edit {
|
||||
my ($output, %data);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$session{form}{wid} and widget.widgetId=SQLReport.widgetId",$session{dbh});
|
||||
$output = '<h1>Edit SQL Report</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
|
|
@ -103,7 +103,7 @@ sub www_editSave {
|
|||
sub www_view {
|
||||
my (%data, $output, $widgetId, $sth, $dbh, @result, @template, $temp);
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$widgetId",$session{dbh});
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$widgetId and widget.widgetId=SQLReport.widgetId",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h2>".$data{title}."</h2>";
|
||||
|
|
|
|||
|
|
@ -24,19 +24,27 @@ sub _mnogoSearch {
|
|||
%data = @_;
|
||||
@keyword = split(/ /,$session{form}{query});
|
||||
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
|
||||
foreach $word (@keyword) {
|
||||
$sth = WebGUI::SQL->read("select url_id from dict where soundex(word)=soundex(lcase('$word'))",$dbh);
|
||||
while (($urlId) = $sth->array) {
|
||||
$result{$urlId}++;
|
||||
if (defined $dbh) {
|
||||
foreach $word (@keyword) {
|
||||
$sth = WebGUI::SQL->read("select url_id from dict where soundex(word)=soundex(lcase('$word'))",$dbh);
|
||||
if (defined $sth) {
|
||||
while (($urlId) = $sth->array) {
|
||||
$result{$urlId}++;
|
||||
}
|
||||
$sth->finish;
|
||||
} else {
|
||||
$output .= '<b>Error</b>: There was a problem with the query.';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
foreach $key (sort {$result{$b} <=> $result{$a}} keys %result) {
|
||||
if ($i < 50) {
|
||||
%match = WebGUI::SQL->quickHash("select url,title,txt from url where rec_id=$key",$dbh);
|
||||
$output .= '<a href="'.$match{url}.'">'.$match{title}.'</a> ('.$result{$key}.')<br>'.$match{txt}.'<br><a href="'.$match{url}.'">'.$match{url}.'</a><p>';
|
||||
}
|
||||
$i++;
|
||||
foreach $key (sort {$result{$b} <=> $result{$a}} keys %result) {
|
||||
if ($i < 50) {
|
||||
%match = WebGUI::SQL->quickHash("select url,title,txt from url where rec_id=$key",$dbh);
|
||||
$output .= '<a href="'.$match{url}.'">'.$match{title}.'</a> ('.$result{$key}.')<br>'.$match{txt}.'<br><a href="'.$match{url}.'">'.$match{url}.'</a><p>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$output .= '<b>Error</b>: Could not connect to remote database.';
|
||||
}
|
||||
$dbh->disconnect();
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ sub widgetName {
|
|||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Site Map</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=30"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Site Map</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","SiteMap");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Disply title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Starting from this level?</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Show only one level?</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,1).'</td></tr>';
|
||||
|
|
@ -78,12 +78,12 @@ sub www_edit {
|
|||
my ($output, %data);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SiteMap where widget.widgetId=SiteMap.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<h1>Edit Site Map</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=31"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Site Map</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Disply title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Starting from this level?</td><td>'.WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Show only one level?uuuu</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,$data{showOnlyThisLevel}).'</td></tr>';
|
||||
|
|
@ -129,6 +129,7 @@ sub www_view {
|
|||
}
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue