WebGUI 1.3.0 release
This commit is contained in:
parent
cde54a3aef
commit
5687f5ee66
58 changed files with 1231 additions and 335 deletions
|
|
@ -42,6 +42,8 @@ sub fatalError {
|
|||
print $log "\t".join(",",caller(2))."\n";
|
||||
print "</td><td valign=top>"."<b>Level 3</b><br>".join("<br>",caller(3));
|
||||
print $log "\t".join(",",caller(3))."\n";
|
||||
print "</td><td valign=top>"."<b>Level 4</b><br>".join("<br>",caller(4));
|
||||
print $log "\t".join(",",caller(4))."\n";
|
||||
print "</td></tr></table>";
|
||||
print "<h3>Form Variables</h3>";
|
||||
print $log "\t";
|
||||
|
|
|
|||
|
|
@ -10,270 +10,33 @@ package WebGUI::Macro;
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use strict qw(vars subs);
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _recurseCrumbTrail {
|
||||
my ($sth, %data, $output);
|
||||
%data = WebGUI::SQL->quickHash("select pageId,parentId,title,urlizedTitle from page where pageId=$_[0]",$session{dbh});
|
||||
if ($data{pageId} > 1) {
|
||||
$output .= _recurseCrumbTrail($data{parentId});
|
||||
}
|
||||
if ($data{title} ne "") {
|
||||
$output .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data{urlizedTitle}.'">'.$data{title}.'</a> > ';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _traversePageTree {
|
||||
my ($sth, @data, $output, $depth, $i, $toLevel);
|
||||
if ($_[2] > 0) {
|
||||
$toLevel = $_[2];
|
||||
} else {
|
||||
$toLevel = 99;
|
||||
}
|
||||
for ($i=1;$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);
|
||||
my (@files, $file, $cmd, $output);
|
||||
$output = $_[0];
|
||||
#---carrot ^---
|
||||
if ($output =~ /\^\^/) {
|
||||
$output =~ s/\^\^/\^/g;
|
||||
opendir (DIR,"../lib/WebGUI/Macro") or WebGUI::ErrorHandler::fatalError("Can't open macro directory!");
|
||||
@files = readdir(DIR);
|
||||
foreach $file (@files) {
|
||||
if ($file ne "." && $file ne ".." && $file =~ /\.pm/) {
|
||||
$file =~ s/\.pm//;
|
||||
$cmd = "require WebGUI::Macro::".$file;
|
||||
eval($cmd);
|
||||
$cmd = "WebGUI::Macro::".$file."::process";
|
||||
$output = &$cmd($output);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
#---script url---
|
||||
# slash hash to go last because it is also used as the end character.
|
||||
if ($output =~ /\^\//) {
|
||||
$output =~ s/\^\//$session{env}{SCRIPT_NAME}/g;
|
||||
}
|
||||
#---page url---
|
||||
if ($output =~ /\^\\/) {
|
||||
$output =~ s/\^\\/$session{page}{url}/g;
|
||||
}
|
||||
#---username---
|
||||
if ($output =~ /\^\@/) {
|
||||
$output =~ s/\^\@/$session{user}{username}/g;
|
||||
}
|
||||
#---uid---
|
||||
if ($output =~ /\^\#/) {
|
||||
$output =~ s/\^\#/$session{user}{userId}/g;
|
||||
}
|
||||
#---random number---
|
||||
if ($output =~ /\^\*/) {
|
||||
$temp = rand()*1000000000;
|
||||
$output =~ s/\^\*/$temp/g;
|
||||
}
|
||||
#---account link---
|
||||
if ($output =~ /\^a/) {
|
||||
$temp = '<a href="'.$session{page}{url}.'?op=displayAccount">My Account</a>';
|
||||
$output =~ s/\^a/$temp/g;
|
||||
}
|
||||
#---company name---
|
||||
if ($output =~ /\^c/) {
|
||||
$output =~ s/\^c/$session{setting}{companyName}/g;
|
||||
}
|
||||
#---crumb trail---
|
||||
if ($output =~ /\^C/) {
|
||||
$temp = '<span class="crumbTrail">'._recurseCrumbTrail($session{page}{parentId}).'<a href="'.$session{page}{url}.'">'.$session{page}{title}.'</a></span>';
|
||||
$output =~ s/\^C/$temp/g;
|
||||
}
|
||||
#---date---
|
||||
if ($output =~ /\^D/) {
|
||||
$temp = localtime(time);
|
||||
$output =~ s/\^D/$temp/g;
|
||||
}
|
||||
#---company email---
|
||||
if ($output =~ /\^e/) {
|
||||
$output =~ s/\^e/$session{setting}{companyEmail}/g;
|
||||
}
|
||||
#---full menu (vertical)---
|
||||
if ($output =~ /\^f/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= _traversePageTree(1,0);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^f/$temp/g;
|
||||
}
|
||||
#---2 level menu (vertical)---
|
||||
if ($output =~ /\^F/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= _traversePageTree(1,0,2);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^F/$temp/g;
|
||||
}
|
||||
#---3 level menu (vertical)---
|
||||
if ($output =~ /\^h/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= _traversePageTree(1,0,3);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^h/$temp/g;
|
||||
}
|
||||
#---home link---
|
||||
if ($output =~ /\^H/) {
|
||||
$temp = '<a href="'.$session{env}{SCRIPT_NAME}.'/home">Home</a>';
|
||||
$output =~ s/\^H/$temp/g;
|
||||
}
|
||||
#---2 level current level menu (vertical)---
|
||||
if ($output =~ /\^j/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= _traversePageTree($session{page}{pageId},0,2);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^j/$temp/g;
|
||||
}
|
||||
#---3 level current level menu (vertical)---
|
||||
if ($output =~ /\^J/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= _traversePageTree($session{page}{pageId},0,3);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^J/$temp/g;
|
||||
}
|
||||
#---login box---
|
||||
if ($output =~ /\^L/) {
|
||||
$temp = '<div class="loginBox">';
|
||||
if ($session{var}{sessionId}) {
|
||||
$temp .= 'Hello '.$session{user}{username}.'. Click <a href="'.$session{page}{url}.'?op=logout">here</a> to log out.';
|
||||
} else {
|
||||
$temp .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$temp .= WebGUI::Form::hidden("op","login").'<span class="formSubtext">Username:<br></span>';
|
||||
$temp .= WebGUI::Form::text("username",12,30).'<span class="formSubtext"><br>Password:<br></span>';
|
||||
$temp .= WebGUI::Form::password("identifier",12,30).'<span class="formSubtext"><br></span>';
|
||||
$temp .= WebGUI::Form::submit("login");
|
||||
$temp .= '</form>';
|
||||
}
|
||||
$temp .= '</div>';
|
||||
$output =~ s/\^L/$temp/g;
|
||||
}
|
||||
#---current menu vertical---
|
||||
if ($output =~ /\^M/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a><br>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^M/$temp/g;
|
||||
}
|
||||
#---current menu horizontal ---
|
||||
if ($output =~ /\^m/) {
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^m/$temp/g;
|
||||
}
|
||||
#---previous menu vertical---
|
||||
if ($output =~ /\^P/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a><br>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^P/$temp/g;
|
||||
}
|
||||
#---previous menu horizontal ---
|
||||
if ($output =~ /\^p/) {
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^p/$temp/g;
|
||||
}
|
||||
#---remove style for printing link---
|
||||
if ($output =~ /\^r/) {
|
||||
$temp = $session{env}{REQUEST_URI};
|
||||
if ($temp =~ /\?/) {
|
||||
$temp .= '&makePrintable=1';
|
||||
} else {
|
||||
$temp .= '?makePrintable=1';
|
||||
}
|
||||
$temp = '<a href="'.$temp.'">Make Page Printable</a>';
|
||||
$output =~ s/\^r/$temp/g;
|
||||
}
|
||||
#---top menu vertical---
|
||||
if ($output =~ /\^T/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a><br>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^T/$temp/g;
|
||||
}
|
||||
#---top menu horizontal---
|
||||
if ($output =~ /\^t/) {
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^t/$temp/g;
|
||||
}
|
||||
#---company URL---
|
||||
if ($output =~ /\^u/) {
|
||||
$output =~ s/\^u/$session{setting}{companyURL}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
29
lib/WebGUI/Macro/At.pm
Normal file
29
lib/WebGUI/Macro/At.pm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package WebGUI::Macro::At;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
#---username---
|
||||
if ($output =~ /\^\@/) {
|
||||
$output =~ s/\^\@/$session{user}{username}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
29
lib/WebGUI/Macro/Backslash.pm
Normal file
29
lib/WebGUI/Macro/Backslash.pm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package WebGUI::Macro::Backslash;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
#---page url---
|
||||
if ($output =~ /\^\\/) {
|
||||
$output =~ s/\^\\/$session{page}{url}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
47
lib/WebGUI/Macro/C.pm
Normal file
47
lib/WebGUI/Macro/C.pm
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package WebGUI::Macro::C;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _recurseCrumbTrail {
|
||||
my ($sth, %data, $output);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select pageId,parentId,title,urlizedTitle from page where pageId=$_[0]",$session
|
||||
{dbh});
|
||||
if ($data{pageId} > 1) {
|
||||
$output .= _recurseCrumbTrail($data{parentId});
|
||||
}
|
||||
if ($data{title} ne "") {
|
||||
$output .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data{urlizedTitle}.'">'.$data{title}.'</a> > '
|
||||
;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---crumb trail---
|
||||
if ($output =~ /\^C/) {
|
||||
$temp = '<span class="crumbTrail">'._recurseCrumbTrail($session{page}{parentId}).'<a href="'.$session{page}{url}.'">'.$session{page}{title}.'</a></span>';
|
||||
$output =~ s/\^C/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
27
lib/WebGUI/Macro/Carat.pm
Normal file
27
lib/WebGUI/Macro/Carat.pm
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package WebGUI::Macro::Carat;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
#---carrot ^---
|
||||
if ($output =~ /\^\^/) {
|
||||
$output =~ s/\^\^/\^/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
32
lib/WebGUI/Macro/D.pm
Normal file
32
lib/WebGUI/Macro/D.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package WebGUI::Macro::D;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---date---
|
||||
if ($output =~ /\^D(.*)\^\/D/) {
|
||||
$temp = epochToHuman(time(),$1);
|
||||
$output =~ s/\^D(.*)\^\/D/$temp/g;
|
||||
} elsif ($output =~ /\^D/) {
|
||||
$temp = localtime(time);
|
||||
$output =~ s/\^D/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
31
lib/WebGUI/Macro/F.pm
Normal file
31
lib/WebGUI/Macro/F.pm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package WebGUI::Macro::F;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---2 level menu (vertical)---
|
||||
if ($output =~ /\^F/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree(1,0,2);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^F/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
32
lib/WebGUI/Macro/H.pm
Normal file
32
lib/WebGUI/Macro/H.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package WebGUI::Macro::H;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---home link---
|
||||
if ($output =~ /\^H(.*)\^\/H/) {
|
||||
$temp = '<a href="'.$session{env}{SCRIPT_NAME}.'/home">'.$1.'</a>';
|
||||
$output =~ s/\^H(.*)\^\/H/$temp/g;
|
||||
} elsif ($output =~ /\^H/) {
|
||||
$temp = '<a href="'.$session{env}{SCRIPT_NAME}.'/home">Home</a>';
|
||||
$output =~ s/\^H/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
29
lib/WebGUI/Macro/Hash.pm
Normal file
29
lib/WebGUI/Macro/Hash.pm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package WebGUI::Macro::Hash;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
#---uid---
|
||||
$output = $_[0];
|
||||
if ($output =~ /\^\#/) {
|
||||
$output =~ s/\^\#/$session{user}{userId}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
32
lib/WebGUI/Macro/J.pm
Normal file
32
lib/WebGUI/Macro/J.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package WebGUI::Macro::J;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
$output = $_[0];
|
||||
#---3 level current level menu (vertical)---
|
||||
if ($output =~ /\^J/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree($session{page}{pageId},0,3);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^J/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
41
lib/WebGUI/Macro/L.pm
Normal file
41
lib/WebGUI/Macro/L.pm
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package WebGUI::Macro::L;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---login box---
|
||||
if ($output =~ /\^L/) {
|
||||
$temp = '<div class="loginBox">';
|
||||
if ($session{var}{sessionId}) {
|
||||
$temp .= 'Hello '.$session{user}{username}.'. Click <a href="'.$session{page}{url}.'?op=logout">here</a> to log out.';
|
||||
} else {
|
||||
$temp .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$temp .= WebGUI::Form::hidden("op","login").'<span class="formSubtext">Username:<br></span>';
|
||||
$temp .= WebGUI::Form::text("username",12,30).'<span class="formSubtext"><br>Password:<br></span>';
|
||||
$temp .= WebGUI::Form::password("identifier",12,30).'<span class="formSubtext"><br></span>';
|
||||
$temp .= WebGUI::Form::submit("login");
|
||||
$temp .= '</form>';
|
||||
}
|
||||
$temp .= '</div>';
|
||||
$output =~ s/\^L/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
45
lib/WebGUI/Macro/M.pm
Normal file
45
lib/WebGUI/Macro/M.pm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package WebGUI::Macro::M;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
$output = $_[0];
|
||||
#---current menu horizontal ---
|
||||
if ($output =~ /\^m/) {
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^m/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
39
lib/WebGUI/Macro/P.pm
Normal file
39
lib/WebGUI/Macro/P.pm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package WebGUI::Macro::P;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth);
|
||||
$output = $_[0];
|
||||
#---previous menu vertical---
|
||||
if ($output =~ /\^P/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a><br>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^P/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
52
lib/WebGUI/Macro/Shared.pm
Normal file
52
lib/WebGUI/Macro/Shared.pm
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package WebGUI::Macro::Shared;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use Exporter;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&traversePageTree);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return $_[0];
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub traversePageTree {
|
||||
my ($sth, @data, $output, $depth, $i, $toLevel);
|
||||
if ($_[2] > 0) {
|
||||
$toLevel = $_[2];
|
||||
} else {
|
||||
$toLevel = 99;
|
||||
}
|
||||
for ($i=1;$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;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
29
lib/WebGUI/Macro/Splat.pm
Normal file
29
lib/WebGUI/Macro/Splat.pm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package WebGUI::Macro::Splat;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---random number---
|
||||
if ($output =~ /\^\*/) {
|
||||
$temp = rand()*1000000000;
|
||||
$output =~ s/\^\*/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
39
lib/WebGUI/Macro/T.pm
Normal file
39
lib/WebGUI/Macro/T.pm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package WebGUI::Macro::T;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth);
|
||||
$output = $_[0];
|
||||
#---top menu vertical---
|
||||
if ($output =~ /\^T/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a><br>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^T/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
32
lib/WebGUI/Macro/a.pm
Normal file
32
lib/WebGUI/Macro/a.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package WebGUI::Macro::a;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---account link---
|
||||
if ($output =~ /\^a(.*)\^\/a/) {
|
||||
$temp = '<a href="'.$session{page}{url}.'?op=displayAccount">'.$1.'</a>';
|
||||
$output =~ s/\^a(.*)\^\/a/$temp/g;
|
||||
} elsif ($output =~ /\^a/) {
|
||||
$temp = '<a href="'.$session{page}{url}.'?op=displayAccount">My Account</a>';
|
||||
$output =~ s/\^a/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
28
lib/WebGUI/Macro/c.pm
Normal file
28
lib/WebGUI/Macro/c.pm
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package WebGUI::Macro::c;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
#---company name---
|
||||
if ($output =~ /\^c/) {
|
||||
$output =~ s/\^c/$session{setting}{companyName}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
28
lib/WebGUI/Macro/e.pm
Normal file
28
lib/WebGUI/Macro/e.pm
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package WebGUI::Macro::e;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
#---company email---
|
||||
if ($output =~ /\^e/) {
|
||||
$output =~ s/\^e/$session{setting}{companyEmail}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
31
lib/WebGUI/Macro/f.pm
Normal file
31
lib/WebGUI/Macro/f.pm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package WebGUI::Macro::f;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---full menu (vertical)---
|
||||
if ($output =~ /\^f/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree(1,0);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^f/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
31
lib/WebGUI/Macro/h.pm
Normal file
31
lib/WebGUI/Macro/h.pm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package WebGUI::Macro::h;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---3 level menu (vertical)---
|
||||
if ($output =~ /\^h/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree(1,0,3);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^h/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
32
lib/WebGUI/Macro/j.pm
Normal file
32
lib/WebGUI/Macro/j.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package WebGUI::Macro::j;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---2 level current level menu (vertical)---
|
||||
if ($output =~ /\^j/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree($session{page}{pageId},0,2);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^j/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
39
lib/WebGUI/Macro/m.pm
Normal file
39
lib/WebGUI/Macro/m.pm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package WebGUI::Macro::m;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
$output = $_[0];
|
||||
#---current menu vertical---
|
||||
if ($output =~ /\^M/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a><br>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^M/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
45
lib/WebGUI/Macro/p.pm
Normal file
45
lib/WebGUI/Macro/p.pm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package WebGUI::Macro::p;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
$output = $_[0];
|
||||
#---previous menu horizontal ---
|
||||
if ($output =~ /\^p/) {
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{parentId} order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^p/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
44
lib/WebGUI/Macro/r.pm
Normal file
44
lib/WebGUI/Macro/r.pm
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package WebGUI::Macro::r;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---remove style for printing link---
|
||||
if ($output =~ /\^r(.*)\^\/r/) {
|
||||
$temp = $session{env}{REQUEST_URI};
|
||||
if ($temp =~ /\?/) {
|
||||
$temp .= '&makePrintable=1';
|
||||
} else {
|
||||
$temp .= '?makePrintable=1';
|
||||
}
|
||||
$temp = '<a href="'.$temp.'">'.$1.'</a>';
|
||||
$output =~ s/\^r(.*)\^\/r/$temp/g;
|
||||
} elsif ($output =~ /\^r/) {
|
||||
$temp = $session{env}{REQUEST_URI};
|
||||
if ($temp =~ /\?/) {
|
||||
$temp .= '&makePrintable=1';
|
||||
} else {
|
||||
$temp .= '?makePrintable=1';
|
||||
}
|
||||
$temp = '<a href="'.$temp.'">Make Page Printable</a>';
|
||||
$output =~ s/\^r/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
45
lib/WebGUI/Macro/t.pm
Normal file
45
lib/WebGUI/Macro/t.pm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package WebGUI::Macro::t;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
$output = $_[0];
|
||||
#---top menu horizontal---
|
||||
if ($output =~ /\^t/) {
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1 order by sequenceNumber",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^t/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
28
lib/WebGUI/Macro/u.pm
Normal file
28
lib/WebGUI/Macro/u.pm
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package WebGUI::Macro::u;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
$output = $_[0];
|
||||
#---company URL---
|
||||
if ($output =~ /\^u/) {
|
||||
$output =~ s/\^u/$session{setting}{companyURL}/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -63,6 +63,8 @@ sub www_createAccount {
|
|||
my ($output);
|
||||
if ($session{user}{userId} != 1) {
|
||||
$output .= www_displayAccount();
|
||||
} elsif ($session{setting}{anonymousRegistration} eq "no") {
|
||||
$output .= www_displayLogin();
|
||||
} else {
|
||||
$output .= ' <h1>Create Account</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","saveAccount");
|
||||
|
|
@ -161,7 +163,12 @@ sub www_displayLogin {
|
|||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("login").'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form>';
|
||||
$output .= '<div class="accountOptions"><ul><li><a href="'.$session{page}{url}.'?op=createAccount">Create a new account.</a><li><a href="'.$session{page}{url}.'?op=recoverPassword">I forgot my password.</a></ul></div>';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if ($session{setting}{anonymousRegistration} eq "yes") {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">Create a new account.</a>';
|
||||
}
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">I forgot my password.</a>';
|
||||
$output .= '</ul></div>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -224,7 +231,12 @@ sub www_recoverPassword {
|
|||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("recover").'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form>';
|
||||
$output .= '<div class="accountOptions"><ul><li><a href="'.$session{page}{url}.'?op=createAccount">Create a new account.</a><li><a href="'.$session{page}{url}.'?op=displayLogin">Login.</a></ul></div>';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if ($session{setting}{anonymousRegistration} eq "yes") {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">Create a new account.</a>';
|
||||
}
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">Login.</a>';
|
||||
$output .= '</ul></div>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Operation::Group;
|
|||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -34,7 +35,7 @@ sub www_addGroup {
|
|||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -46,7 +47,7 @@ sub www_addGroupSave {
|
|||
WebGUI::SQL->write("insert into groups values (".getNextId("groupId").", ".quote($session{form}{groupName}).", ".quote($session{form}{description}).")",$session{dbh});
|
||||
$output = www_listGroups();
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -54,31 +55,36 @@ sub www_addGroupSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteGroup {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3) && $session{form}{gid} > 25) {
|
||||
if ($session{form}{gid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=15"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain you wish to delete this group? Beware that deleting a group is permanent and will remove all privileges associated with this group.<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteGroupConfirm&gid='.$session{form}{gid}.'">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listGroups">No, I made a mistake. </a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteGroupConfirm {
|
||||
if (WebGUI::Privilege::isInGroup(3) && $session{form}{gid} > 25) {
|
||||
if ($session{form}{gid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from groups where groupId=$session{form}{gid}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where groupId=$session{form}{gid}",$session{dbh});
|
||||
return www_listGroups();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroup {
|
||||
my ($output, $sth, %group, $user);
|
||||
tie %group, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}",$session{dbh});
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=13"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Group</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
|
|
@ -98,7 +104,7 @@ sub www_editGroup {
|
|||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -109,7 +115,7 @@ sub www_editGroupSave {
|
|||
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).", description=".quote($session{form}{description})." where groupId=".$session{form}{gid},$session{dbh});
|
||||
return www_listGroups();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +158,7 @@ sub www_listGroups {
|
|||
$output .= '</div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Operation::Help;
|
|||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -22,6 +23,7 @@ our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex);
|
|||
#-------------------------------------------------------------------
|
||||
sub www_viewHelp {
|
||||
my ($output, %help, @data, $sth);
|
||||
tie %help, 'Tie::CPHash';
|
||||
%help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid}",$session{dbh});
|
||||
$output = '<h1>Help: '.$help{action}.' '.$help{object}.'</h1>';
|
||||
$help{body} =~ s/\n/\<br\>/g;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,9 @@ sub www_addPageSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_cutPage {
|
||||
if (WebGUI::Privilege::canEditPage() && $session{page}{pageId}!=1) {
|
||||
if ($session{page}{pageId} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("update page set parentId=2 where pageId=".$session{page}{pageId},$session{dbh});
|
||||
_reorderPages($session{page}{parentId});
|
||||
WebGUI::Session::refreshPageInfo($session{page}{parentId});
|
||||
|
|
@ -102,7 +104,9 @@ sub www_cutPage {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deletePage {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage() && $session{page}{pageId}!=1) {
|
||||
if ($session{page}{pageId} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::canEditPage()) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=3"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you wish to delete this page, its content, and all items under it?<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deletePageConfirm">Yes, I\'m sure.</a>';
|
||||
|
|
@ -115,7 +119,9 @@ sub www_deletePage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deletePageConfirm {
|
||||
if (WebGUI::Privilege::canEditPage() && $session{page}{pageId}!=1) {
|
||||
if ($session{page}{pageId} < 25) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("update page set parentId=3 where pageId=".$session{page}{pageId},$session{dbh});
|
||||
_reorderPages($session{page}{parentId});
|
||||
WebGUI::Session::refreshPageInfo($session{page}{parentId});
|
||||
|
|
@ -134,22 +140,26 @@ sub www_editPage {
|
|||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=2"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Page</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("op","editPageSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td colspan=2><b>Page Specifics</b></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$session{page}{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Page URL</td><td>'.WebGUI::Form::text("urlizedTitle",20,30,$session{page}{urlizedTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Meta Tags</td><td>'.WebGUI::Form::textArea("metaTags",$session{page}{metaTags}).'</td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>Style</b></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
$array[0] = $session{page}{styleId};
|
||||
$output .= '<tr><td class="formDescription">Style</td><td>'.WebGUI::Form::selectList("styleId",\%hash,\@array).' '.WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">Check to give this style to all sub-pages.</span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Page URL</td><td>'.WebGUI::Form::text("urlizedTitle",20,30,$session{page}{urlizedTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Style</td><td>'.WebGUI::Form::selectList("styleId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listStyles">Manage Styles</a></span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription"></td><td>'.WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">Check to give this style to all sub-pages.</span></td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>Privileges</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",$session{dbh});
|
||||
$array[0] = $session{page}{ownerId};
|
||||
$output .= '<tr><td class="formDescription">Owner</td><td>'.WebGUI::Form::selectList("ownerId",\%hash,\@array).' '.WebGUI::Form::checkbox("recursePrivs","yes").' <span class="formSubtext">Check to give these privileges to all sub-pages.</span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Owner</td><td>'.WebGUI::Form::selectList("ownerId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listUsers">Manage Users</a></span></td></tr>';
|
||||
$array[0] = $session{page}{ownerView};
|
||||
$output .= '<tr><td class="formDescription">Owner can view?</td><td>'.WebGUI::Form::selectList("ownerView",\%yesNo,\@array).'</td></tr>';
|
||||
$array[0] = $session{page}{ownerEdit};
|
||||
$output .= '<tr><td class="formDescription">Owner can edit?</td><td>'.WebGUI::Form::selectList("ownerEdit",\%yesNo,\@array).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$array[0] = $session{page}{groupId};
|
||||
$output .= '<tr><td class="formDescription">Group</td><td>'.WebGUI::Form::selectList("groupId",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Group</td><td>'.WebGUI::Form::selectList("groupId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listGroups">Manage Groups</a></span></td></tr>';
|
||||
$array[0] = $session{page}{groupView};
|
||||
$output .= '<tr><td class="formDescription">Group can view?</td><td>'.WebGUI::Form::selectList("groupView",\%yesNo,\@array).'</td></tr>';
|
||||
$array[0] = $session{page}{groupEdit};
|
||||
|
|
@ -158,6 +168,7 @@ sub www_editPage {
|
|||
$output .= '<tr><td class="formDescription">Anybody can view?</td><td>'.WebGUI::Form::selectList("worldView",\%yesNo,\@array).'</td></tr>';
|
||||
$array[0] = $session{page}{worldEdit};
|
||||
$output .= '<tr><td class="formDescription">Anybody can Edit?</td><td>'.WebGUI::Form::selectList("worldEdit",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription"></td><td>'.WebGUI::Form::checkbox("recursePrivs","yes").' <span class="formSubtext">Check to give these privileges to all sub-pages.</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ our @EXPORT = qw(&www_editSettings &www_editSettingsSave);
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSettings {
|
||||
my ($output, %authMethod, @array);
|
||||
my ($output, %authMethod, @array, %yesNo, %notFoundPage);
|
||||
%authMethod = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
%yesNo = ('yes'=>'Yes', 'no'=>'No');
|
||||
%notFoundPage = (1=>'Home Page', 4=>'Page Not Found Page');
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=12"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Settings</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editSettingsSave");
|
||||
|
|
@ -39,6 +41,8 @@ sub www_editSettings {
|
|||
$output .= '<tr><td class="formDescription" valign="top">Company Email Address</td><td>'.WebGUI::Form::text("companyEmail",30,255,$session{setting}{companyEmail}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Company URL</td><td>'.WebGUI::Form::text("companyURL",30,2048,$session{setting}{companyURL}).'</td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>Authentication</b></td></tr>';
|
||||
$array[0] = $session{setting}{anonymousRegistration};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Anonymous Registration</td><td>'.WebGUI::Form::selectList("anonymousRegistration",\%yesNo, \@array).'</td></tr>';
|
||||
$array[0] = $session{setting}{authMethod};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Authentication Method (default)</td><td>'.WebGUI::Form::selectList("authMethod",\%authMethod, \@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">LDAP URL (default)</td><td>'.WebGUI::Form::text("ldapURL",30,2048,$session{setting}{ldapURL}).'</td></tr>';
|
||||
|
|
@ -46,6 +50,8 @@ sub www_editSettings {
|
|||
$output .= '<tr><td class="formDescription" valign="top">LDAP Identity Name</td><td>'.WebGUI::Form::text("ldapIdName",30,100,$session{setting}{ldapIdName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">LDAP Password Name</td><td>'.WebGUI::Form::text("ldapPasswordName",30,100,$session{setting}{ldapPasswordName}).'</td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>Miscellaneous</b></td></tr>';
|
||||
$array[0] = $session{setting}{notFoundPage};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Not Found Page</td><td>'.WebGUI::Form::selectList("notFoundPage",\%notFoundPage,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Session Timeout</td><td>'.WebGUI::Form::text("sessionTimeout",30,11,$session{setting}{sessionTimeout}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">SMTP Server</td><td>'.WebGUI::Form::text("smtpServer",30,255,$session{setting}{smtpServer}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
|
|
@ -53,7 +59,7 @@ sub www_editSettings {
|
|||
$output .= '</form> ';
|
||||
$output .= '<hr size=1>Build Version: '.$WebGUI::VERSION;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -75,9 +81,11 @@ sub www_editSettingsSave {
|
|||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapId})." where name='ldapId'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapIdName})." where name='ldapIdName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapPasswordName})." where name='ldapPasswordName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{anonymousRegistration})." where name='anonymousRegistration'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{notFoundPage})." where name='notFoundPage'",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Operation::Style;
|
|||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -36,7 +37,7 @@ sub www_addStyle {
|
|||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -48,7 +49,7 @@ sub www_addStyleSave {
|
|||
WebGUI::SQL->write("insert into style values (".getNextId("styleId").", ".quote($session{form}{name}).", ".quote($session{form}{header}).", ".quote($session{form}{footer}).", ".quote($session{form}{styleSheet}).")",$session{dbh});
|
||||
$output = www_listStyles();
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -56,31 +57,36 @@ sub www_addStyleSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteStyle {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3) && $session{form}{sid} > 25) {
|
||||
if ($session{form}{sid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=4"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain you wish to delete this style and migrate all pages using this style to the "Fail Safe" style?<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteStyleConfirm&sid='.$session{form}{sid}.'">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listStyles">No, I made a mistake.</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteStyleConfirm {
|
||||
if (WebGUI::Privilege::isInGroup(3) && $session{form}{sid} > 25) {
|
||||
if ($session{form}{sid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from style where styleId=".$session{form}{sid},$session{dbh});
|
||||
WebGUI::SQL->write("update page set styleId=2 where styleId=".$session{form}{sid},$session{dbh});
|
||||
return www_listStyles();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editStyle {
|
||||
my ($output, %style);
|
||||
tie %style, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}",$session{dbh});
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=11"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Style</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
|
|
@ -95,7 +101,7 @@ sub www_editStyle {
|
|||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -106,7 +112,7 @@ sub www_editStyleSave {
|
|||
WebGUI::SQL->write("update style set name=".quote($session{form}{name}).", header=".quote($session{form}{header}).", footer=".quote($session{form}{footer}).", styleSheet=".quote($session{form}{styleSheet})." where styleId=".$session{form}{sid},$session{dbh});
|
||||
return www_listStyles();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +154,7 @@ sub www_listStyles {
|
|||
$output .= '</div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ sub www_purgeTrash {
|
|||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ sub www_purgeTrashConfirm {
|
|||
_purgeWidgets(3);
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Operation::User;
|
|||
use Digest::MD5 qw(md5_base64);
|
||||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Operation::Help;
|
||||
use WebGUI::Operation::Page;
|
||||
|
|
@ -46,7 +47,7 @@ sub www_addUser {
|
|||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -64,7 +65,7 @@ sub www_addUserSave {
|
|||
}
|
||||
$output = www_listUsers();
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -72,31 +73,36 @@ sub www_addUserSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteUser {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3) && $session{form}{uid} > 25) {
|
||||
if ($session{form}{uid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=7"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain you want to delete this user? Be warned that all this user\'s information will be lost permanently if you choose to proceed.<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteUserConfirm&uid='.$session{form}{uid}.'">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listUsers">No, I made a mistake.</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteUserConfirm {
|
||||
if (WebGUI::Privilege::isInGroup(3) && $session{form}{uid} > 25) {
|
||||
if ($session{form}{uid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from users where userId=$session{form}{uid}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh});
|
||||
return www_listUsers();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUser {
|
||||
my ($output, %user, %hash, @array);
|
||||
tie %hash, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId=$session{form}{uid}",$session{dbh});
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=6"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit User</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
|
|
@ -119,7 +125,7 @@ sub www_editUser {
|
|||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -141,7 +147,7 @@ sub www_editUserSave {
|
|||
}
|
||||
return www_listUsers();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +191,7 @@ sub www_listUsers {
|
|||
$output .= '</div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,24 @@ package WebGUI::Privilege;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub adminOnly {
|
||||
my ($output, $sth, @data);
|
||||
$output = '<h1>Administrative Function</h1>You must be an administrator to perform this function. Please contact one of your administrators. The following is a list of the administrators for this system:<ul>';
|
||||
$sth = WebGUI::SQL->read("select users.username, users.email from users,groupings where users.userId=groupings.userId and groupings.groupId=3 order by users.username",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<li>'.$data[0].' (<a href="mailto:'.$data[1].'">'.$data[1].'</a>)';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</ul><p>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canEditPage {
|
||||
if ($session{page}{worldEdit}) {
|
||||
|
|
@ -33,17 +47,18 @@ sub canEditPage {
|
|||
#-------------------------------------------------------------------
|
||||
sub canViewPage {
|
||||
my (%page);
|
||||
tie %page, 'Tie::CPHash';
|
||||
if ($_[0] eq "") {
|
||||
%page = %{$session{page}};
|
||||
} else {
|
||||
%page = WebGUI::SQL->quickHash("select * from page where pageId=$_[0]",$session{dbh});
|
||||
}
|
||||
if ($page{worldView}) {
|
||||
if ($page{worldView}) {
|
||||
return 1;
|
||||
} elsif ($session{user}{userId} eq $page{ownerId} && $page{ownerView}) {
|
||||
return 1;
|
||||
} elsif (isInGroup(3)) {
|
||||
return 1;
|
||||
} elsif (isInGroup(3)) { # admin check
|
||||
return 1;
|
||||
} elsif (isInGroup($page{groupId}) && $page{groupView}) {
|
||||
return 1;
|
||||
} else {
|
||||
|
|
@ -70,6 +85,11 @@ sub isInGroup {
|
|||
return $result;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub vitalComponent {
|
||||
return '<h1>Vital Component</h1>You\'re attempting to remove a vital component of the WebGUI system. If you were allowed to continue WebGUI may cease to function.<p>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,19 +11,22 @@ package WebGUI::Session;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use CGI;
|
||||
use Data::Config;
|
||||
use DBI;
|
||||
use Exporter;
|
||||
use strict;
|
||||
use Data::Config;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(%session);
|
||||
our %session = ();
|
||||
tie %session, 'Tie::CPHash';
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getPageInfo {
|
||||
my (%page, $pageId, $pageName);
|
||||
tie %page, 'Tie::CPHash';
|
||||
($pageId) = $_[0];
|
||||
if ($pageId eq "") {
|
||||
$pageName = lc($ENV{PATH_INFO});
|
||||
|
|
@ -31,7 +34,7 @@ sub _getPageInfo {
|
|||
if ($pageName ne "") {
|
||||
($pageId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='".$pageName."'",$_[1]);
|
||||
if ($pageId eq "") {
|
||||
$pageId = 1;
|
||||
$pageId = $_[2];
|
||||
}
|
||||
} else {
|
||||
$pageId = 1;
|
||||
|
|
@ -45,6 +48,7 @@ sub _getPageInfo {
|
|||
#-------------------------------------------------------------------
|
||||
sub _getSessionVars {
|
||||
my (%vars, $uid, $encryptedPassword);
|
||||
tie %vars, 'Tie::CPHash';
|
||||
if ($_[0] ne "") {
|
||||
%vars = WebGUI::SQL->quickHash("select * from session where sessionId='$_[0]'", $_[1]);
|
||||
if ($vars{sessionId} ne "") {
|
||||
|
|
@ -57,6 +61,7 @@ sub _getSessionVars {
|
|||
#-------------------------------------------------------------------
|
||||
sub _getUserInfo {
|
||||
my (%user, $uid, $encryptedPassword);
|
||||
tie %user, 'Tie::CPHash';
|
||||
if ($_[0] ne "") {
|
||||
($uid, $encryptedPassword) = split(/\|/,$_[0]);
|
||||
} else {
|
||||
|
|
@ -94,11 +99,14 @@ sub httpRedirect {
|
|||
#-------------------------------------------------------------------
|
||||
sub open {
|
||||
my ($key, %CONFIG, %VARS, %PAGE, %FORM, $query, %COOKIES, $config, %USER, %SETTINGS, $dbh);
|
||||
tie %USER, 'Tie::CPHash';
|
||||
tie %VARS, 'Tie::CPHash';
|
||||
tie %PAGE, 'Tie::CPHash';
|
||||
$config = new Data::Config '../etc/WebGUI.conf';
|
||||
foreach ($config->param) {
|
||||
$CONFIG{$_} = $config->param($_);
|
||||
}
|
||||
$dbh = DBI->connect($CONFIG{dsn}, $CONFIG{dbuser}, $CONFIG{dbpass}, { RaiseError => 1, AutoCommit => 1 });
|
||||
$dbh = DBI->connect($CONFIG{dsn}, $CONFIG{dbuser}, $CONFIG{dbpass}, { RaiseError => 0, AutoCommit => 1 });
|
||||
$query = CGI->new();
|
||||
foreach ($query->param) {
|
||||
$FORM{$_} = $query->param($_);
|
||||
|
|
@ -110,7 +118,7 @@ sub open {
|
|||
%VARS = _getSessionVars($COOKIES{wgSession},$dbh,$SETTINGS{sessionTimeout});
|
||||
%USER = _getUserInfo($VARS{sessionId},$dbh);
|
||||
$CGI::POST_MAX=1024 * $SETTINGS{maxAttachmentSize};
|
||||
%PAGE = _getPageInfo("",$dbh);
|
||||
%PAGE = _getPageInfo("",$dbh,$SETTINGS{notFoundPage});
|
||||
%session = (
|
||||
env => \%ENV, # environment variables from the web server
|
||||
config=> \%CONFIG, # variables loaded from the config file
|
||||
|
|
@ -129,13 +137,15 @@ sub open {
|
|||
#-------------------------------------------------------------------
|
||||
sub refreshPageInfo {
|
||||
my (%PAGE);
|
||||
%PAGE = _getPageInfo($_[0],$session{dbh});
|
||||
tie %PAGE, 'Tie::CPHash';
|
||||
%PAGE = _getPageInfo($_[0],$session{dbh},$session{setting}{notFoundPage});
|
||||
$session{page} = \%PAGE;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub refreshSessionVars {
|
||||
my (%VARS);
|
||||
tie %VARS, 'Tie::CPHash';
|
||||
%VARS = _getSessionVars($_[0],$session{dbh},$session{setting}{sessionTimeout});
|
||||
$session{var} = \%VARS;
|
||||
refreshUserInfo($session{var}{sessionId});
|
||||
|
|
@ -144,6 +154,7 @@ sub refreshSessionVars {
|
|||
#-------------------------------------------------------------------
|
||||
sub refreshUserInfo {
|
||||
my (%USER);
|
||||
tie %USER, 'Tie::CPHash';
|
||||
%USER = _getUserInfo($_[0],$session{dbh});
|
||||
$session{user} = \%USER;
|
||||
}
|
||||
|
|
@ -157,9 +168,10 @@ sub setCookie {
|
|||
sub start {
|
||||
my (%user, $uid, $encryptedPassword);
|
||||
($uid, $encryptedPassword) = split(/\|/,$_[0]);
|
||||
tie %user, 'Tie::CPHash';
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId='$uid'", $session{dbh});
|
||||
if (crypt($user{identifier},"yJ") eq $encryptedPassword) {
|
||||
WebGUI::SQL->write("insert into session values ('$_[0]', ".(time()+$session{setting}{sessionTimeout}).", ".time().", 0, '$ENV{REMOTE_ADDR}')",$session{dbh});
|
||||
WebGUI::SQL->write("insert into session values ('$_[0]', ".(time()+$session{setting}{sessionTimeout}).", ".time().", 0, '$ENV{REMOTE_ADDR}', $uid)",$session{dbh});
|
||||
refreshSessionVars($_[0]);
|
||||
return 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Style;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -22,6 +23,7 @@ sub getStyle {
|
|||
$header = '<html><!-- WebGUI '.$session{wg}{version}.' --><title>'.$session{page}{title}.'</title><body>';
|
||||
$footer = '</body></html>';
|
||||
} else {
|
||||
tie %style, 'Tie::CPHash';
|
||||
%style = WebGUI::SQL->quickHash("select header,footer,styleSheet from style where styleId=$session{page}{styleId}",$session{dbh});
|
||||
$header = '<!-- WebGUI '.$WebGUI::VERSION.' -->
|
||||
<html>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ sub getNextId {
|
|||
#-------------------------------------------------------------------
|
||||
# This is here simply to make typing shorter, cuz I'm lazy.
|
||||
sub quote {
|
||||
return $session{dbh}->quote($_[0]);
|
||||
my $value = $_[0]; #had to add this here cuz Tie::CPHash variables cause problems otherwise.
|
||||
return $session{dbh}->quote($value);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::Article;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
|
|
@ -95,6 +96,7 @@ sub www_deleteImage {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %article);
|
||||
tie %article, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%article = WebGUI::SQL->quickHash("select * from widget,Article where widget.widgetId=Article.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=24"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Article</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -151,6 +153,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @test, $output, $widgetId);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, widget.processMacros, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment, Article.convertCarriageReturns from widget,Article where widget.widgetId='$widgetId' and widget.WidgetId=Article.widgetId and Article.startDate<".time()." and Article.endDate>".time()."",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::EventsCalendar;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
|
|
@ -122,6 +123,7 @@ sub www_deleteEventConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data, @event, $sth);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=39"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Events Calendar</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -161,6 +163,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editEvent {
|
||||
my ($output, %event);
|
||||
tie %event, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%event = WebGUI::SQL->quickHash("select * from event where eventId='$session{form}{eid}'",$session{dbh});
|
||||
$output = '<h1>Edit Event</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -196,6 +199,7 @@ sub www_editEventSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @event, $output, $widgetId, $sth);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::ExtraColumn;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -64,6 +65,7 @@ sub www_addSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from ExtraColumn where widgetId=$session{form}{wid}",$session{dbh});
|
||||
$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}.'">';
|
||||
|
|
@ -96,6 +98,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @test, $output, $widgetId);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from ExtraColumn where widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::FAQ;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -131,6 +132,7 @@ sub www_deleteQuestionConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data, @question, $sth);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<h1>Edit Link List</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -170,6 +172,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editQuestion {
|
||||
my ($output, %question);
|
||||
tie %question, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%question = WebGUI::SQL->quickHash("select * from faqQuestion where questionId='$session{form}{qid}'",$session{dbh});
|
||||
$output = '<h1>Edit Question</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -233,6 +236,7 @@ sub www_moveQuestionUp {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @question, $output, $widgetId, $sth, $qNa);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::LinkList;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -132,6 +133,7 @@ sub www_deleteLinkConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data, @link, $sth);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=35"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Link List</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -171,6 +173,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editLink {
|
||||
my ($output, %link);
|
||||
tie %link, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%link = WebGUI::SQL->quickHash("select name, url, description from link where linkId='$session{form}{lid}'",$session{dbh});
|
||||
$output = '<h1>Edit Link</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -235,6 +238,7 @@ sub www_moveLinkUp {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @link, $output, $widgetId, $sth);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::MessageBoard;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -21,6 +22,7 @@ use WebGUI::Widget;
|
|||
#-------------------------------------------------------------------
|
||||
sub _getBoardProperties {
|
||||
my (%board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, widget.description, MessageBoard.groupToPost, MessageBoard.messagesPerPage, MessageBoard.editTimeout from widget, MessageBoard where widget.widgetId=MessageBoard.widgetId and widget.widgetId=$_[0]",$session{dbh});
|
||||
return %board;
|
||||
}
|
||||
|
|
@ -70,7 +72,7 @@ sub www_add {
|
|||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'').'</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 post?</td><td>'.WebGUI::Form::selectList("groupToPost",\%hash,'',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Messages Per Page</td><td>'.WebGUI::Form::text("messagesPerPage",20,2,50).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Messages Per Page</td><td>'.WebGUI::Form::text("messagesPerPage",20,2,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Edit Timeout</td><td>'.WebGUI::Form::text("editTimeout",20,3,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
|
|
@ -98,6 +100,7 @@ sub www_edit {
|
|||
my ($output, %board, %hash, @array);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=33"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Message Board</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
|
|
@ -134,6 +137,8 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editMessage {
|
||||
my ($html, %board, %message);
|
||||
tie %message, 'Tie::CPHash';
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
%message = WebGUI::SQL->quickHash("select * from message where messageId=$session{form}{mid}",$session{dbh});
|
||||
|
|
@ -160,6 +165,7 @@ sub www_editMessage {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editMessageSave {
|
||||
my (%board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
|
|
@ -178,6 +184,7 @@ sub www_editMessageSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessage {
|
||||
my ($html, %board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
$html .= '<table width="100%"><tr><td class="boardTitle">';
|
||||
|
|
@ -201,6 +208,7 @@ sub www_postNewMessage {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_postNewMessageSave {
|
||||
my ($mid, %board);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
|
|
@ -220,6 +228,7 @@ sub www_postNewMessageSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_postReply {
|
||||
my ($html, %board, $subject);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
($subject) = WebGUI::SQL->quickArray("select subject from message where messageId=$session{form}{mid}", $session{dbh});
|
||||
|
|
@ -247,6 +256,7 @@ sub www_postReply {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_postReplySave {
|
||||
my ($rid, %board, $mid);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
|
|
@ -267,6 +277,8 @@ sub www_postReplySave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_showMessage {
|
||||
my (@data, $html, %board, %message);
|
||||
tie %message, 'Tie::CPHash';
|
||||
tie %board, 'Tie::CPHash';
|
||||
%message = WebGUI::SQL->quickHash("select * from message where messageId=$session{form}{mid}",$session{dbh});
|
||||
%board = _getBoardProperties($session{form}{wid});
|
||||
$html .= '<table width="100%"><tr><td class="boardTitle">';
|
||||
|
|
@ -316,11 +328,17 @@ sub www_showMessage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my ($sth, @data, $html, %board, $itemsPerPage, $i, @row, $pn);
|
||||
my ($sth, @data, $html, %board, $itemsPerPage, $i, $pn, $lastId, @last, $replies);
|
||||
tie %board, 'Tie::CPHash';
|
||||
%board = _getBoardProperties($_[0]);
|
||||
$itemsPerPage = $board{messagesPerPage};
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
if ($board{description} ne "") {
|
||||
$html .= $board{description}.'<p>';
|
||||
$html = $board{description}.'<p>';
|
||||
}
|
||||
$html .= '<table width="100%"><tr><td class="boardTitle">';
|
||||
if ($board{displayTitle}) {
|
||||
|
|
@ -329,19 +347,16 @@ sub www_view {
|
|||
$html .= '</td><td align="right" valign="bottom" class="boardMenu"><a href="'.$session{page}{url}.'?func=postNewMessage&wid='.$_[0].'">Post New Message</a></td></tr></table>';
|
||||
$html .= '<table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||
$html .= '<tr><td class="tableHeader">Subject</td><td class="tableHeader">Author</td><td class="tableHeader">Thread Started</td><td class="tableHeader">Replies</td><td class="tableHeader">Last Reply</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select messageId,subject,count(messageId)-1,username,dateOfPost,max(dateOfPost),max(messageId) from message where widgetId=$_[0] group by rid order by messageId desc", $session{dbh});
|
||||
#$sth = WebGUI::SQL->read("select messageId,subject,count(*)-1,username,dateOfPost,max(dateOfPost),max(messageId) from message where widgetId=$_[0] group by rid order by messageId desc", $session{dbh});
|
||||
$sth = WebGUI::SQL->read("select messageId,subject,username,dateOfPost from message where widgetId=$_[0] and pid=0 order by messageId desc", $session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<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">'.$data[3].'</td><td class="tableData">'.epochToHuman($data[4],"%M/%D %H:%n%p").'</td><td class="tableData">'.$data[2].'</td><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[6].'&wid='.$_[0].'">'.epochToHuman($data[5],"%M/%D %H:%n%p").'</a></td></tr>';
|
||||
if ($i >= ($itemsPerPage*$pn) && $i < ($itemsPerPage*($pn+1))) {
|
||||
@last = WebGUI::SQL->quickArray("select messageId,dateOfPost,username,subject from message where widgetId=$_[0] and rid=$data[0] order by dateOfPost desc",$session{dbh});
|
||||
($replies) = WebGUI::SQL->quickArray("select count(*)-1 from message where rid=$data[0]",$session{dbh});
|
||||
$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">'.$data[2].'</td><td class="tableData">'.epochToHuman($data[3],"%M/%D %H:%n%p").'</td><td class="tableData">'.$replies.'</td><td class="tableData"><a href="'.$session{page}{url}.'?func=showMessage&mid='.$last[0].'&wid='.$_[0].'">'.substr($last[3],0,30).'</a><span style="font-size: 8pt;"> @ '.epochToHuman($last[1],"%M/%D %H:%n%p").' by '.$last[2].'</span></td></tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$html .= $row[$i];
|
||||
}
|
||||
$html .= '</table>';
|
||||
$html .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
|
|
@ -350,7 +365,7 @@ sub www_view {
|
|||
$html .= '«Previous Page';
|
||||
}
|
||||
$html .= ' · ';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
if (($pn+1) < round(($i/$itemsPerPage))) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'">Next Page»</a>';
|
||||
} else {
|
||||
$html .= 'Next Page»';
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::Poll;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -20,6 +21,7 @@ use WebGUI::Widget;
|
|||
#-------------------------------------------------------------------
|
||||
sub _viewPoll {
|
||||
my (%poll, $i, $output, $widgetId);
|
||||
tie %poll, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%poll = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %poll) {
|
||||
|
|
@ -48,6 +50,7 @@ sub _viewPoll {
|
|||
#-------------------------------------------------------------------
|
||||
sub _viewResults {
|
||||
my (%poll, @data, $i, $output, $widgetId, $totalResponses);
|
||||
tie %poll, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%poll = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$widgetId'",$session{dbh});
|
||||
if (defined %poll) {
|
||||
|
|
@ -130,6 +133,7 @@ sub www_addSave {
|
|||
sub www_edit {
|
||||
my ($output, %data, %hash, @array);
|
||||
tie %hash, "Tie::IxHash";
|
||||
tie %data, 'Tie::CPHash';
|
||||
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 = '<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}.'">';
|
||||
|
|
@ -170,6 +174,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my ($hasVoted, %data, $output);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$_[0]'",$session{dbh});
|
||||
if ($data{active} eq "0") {
|
||||
$output = _viewResults($_[0]);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ sub www_addSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%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}.'">';
|
||||
|
|
@ -111,6 +112,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, $output, $widgetId, $sth, $dbh, @result, @template, $temp);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$widgetId and widget.widgetId=SQLReport.widgetId",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::SearchMnoGo;
|
|||
|
||||
use DBI;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -21,6 +22,7 @@ use WebGUI::Widget;
|
|||
#-------------------------------------------------------------------
|
||||
sub _mnogoSearch {
|
||||
my ($i, %match, $key, $sth, $dbh, $urlId, %data, $output, @keyword, $word, %result);
|
||||
tie %match, 'Tie::CPHash';
|
||||
%data = @_;
|
||||
@keyword = split(/ /,$session{form}{query});
|
||||
if ($data{DSN} =~ /\DBI\:\w+\:\w+/) {
|
||||
|
|
@ -106,6 +108,7 @@ sub www_addSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SearchMnoGo where widget.widgetId=SearchMnoGo.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=43"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Search (MnoGo)</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -140,6 +143,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @test, $output, $widgetId);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SearchMnoGo where widget.widgetId='$widgetId' and widget.WidgetId=SearchMnoGo.widgetId",$session{dbh});
|
||||
if (%data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ package WebGUI::Widget::SiteMap;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -55,6 +57,7 @@ sub www_add {
|
|||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Site Map').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process Macros?</td><td>'.WebGUI::Form::checkbox("processMacros",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>';
|
||||
|
|
@ -82,6 +85,7 @@ sub www_addSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
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 = '<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}.'">';
|
||||
|
|
@ -90,6 +94,7 @@ sub www_edit {
|
|||
$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 title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process Macros?</td><td>'.WebGUI::Form::checkbox("processMacros",1,$data{processMacros}).'</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?</td><td>'.WebGUI::Form::checkbox("showOnlyThisLevel",1,$data{showOnlyThisLevel}).'</td></tr>';
|
||||
|
|
@ -115,6 +120,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, $output, $sth, @root, $parent);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SiteMap where widget.widgetId=SiteMap.widgetId and widget.widgetId='$_[0]'",$session{dbh});
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} eq 1) {
|
||||
|
|
@ -136,6 +142,9 @@ sub www_view {
|
|||
}
|
||||
}
|
||||
$sth->finish;
|
||||
if ($data{processMacros}) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::SyndicatedContent;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -65,6 +66,7 @@ sub www_addSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SyndicatedContent where widget.widgetId=$session{form}{wid}",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=37"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit Syndicated Content</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -77,7 +79,7 @@ sub www_edit {
|
|||
$output .= '<tr><td class="formDescription">URL to RSS File</td><td>'.WebGUI::Form::text("rssUrl",20,2048,$data{rssUrl}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td><br></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Last Fetched</td><td>'.$data{lastFetched}.'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Last Fetched</td><td>'.WebGUI::DateTime($data{lastFetched},"%m/%d/%y %h:%n%p").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Current Content</td><td>'.$data{content}.'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -100,6 +102,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, $output, $widgetId);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,SyndicatedContent where widget.widgetId=$widgetId",$session{dbh});
|
||||
if (defined %data) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Widget::UserSubmission;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -170,6 +171,7 @@ sub www_deleteSubmissionConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data, @array, $sth, %hash);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,UserSubmission where widget.widgetId=$session{form}{wid} and widget.widgetId=UserSubmission.widgetId",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=45"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Edit User Submission System</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
|
|
@ -208,6 +210,7 @@ sub www_editSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editSubmission {
|
||||
my ($output, %submission, $owner);
|
||||
tie %submission, 'Tie::CPHash';
|
||||
($owner) = WebGUI::SQL->quickArray("select userId from submission where submissionId=$session{form}{sid}",$session{dbh});
|
||||
if ($owner == $session{user}{userId}) {
|
||||
%submission = WebGUI::SQL->quickHash("select * from submission where submissionId='$session{form}{sid}'",$session{dbh});
|
||||
|
|
@ -267,6 +270,7 @@ sub www_editSubmissionSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @submission, $output, $widgetId, $sth, @row, $i, $pn);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$widgetId = shift;
|
||||
%data = WebGUI::SQL->quickHash("select * from widget,UserSubmission where widget.widgetId=$widgetId and widget.widgetId=UserSubmission.widgetId",$session{dbh});
|
||||
if (%data) {
|
||||
|
|
@ -314,6 +318,7 @@ sub www_view {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_viewSubmission {
|
||||
my ($output, %submission);
|
||||
tie %submission, 'Tie::CPHash';
|
||||
%submission = WebGUI::SQL->quickHash("select * from submission where submissionId=$session{form}{sid}",$session{dbh});
|
||||
$output = "<h1>".$submission{title}."</h1>";
|
||||
$output .= '<b>Submitted By:</b> '.$submission{username}.'<br>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue