WebGUI 2.1.0 release
This commit is contained in:
parent
08a5f757da
commit
1cf655659f
66 changed files with 3136 additions and 1001 deletions
|
|
@ -13,36 +13,47 @@ package WebGUI::DateTime;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Time::Local;
|
||||
use WebGUI::International;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&epochToHuman &epochToSet &humanToEpoch &setToEpoch);
|
||||
our %month = (
|
||||
1=> "January",
|
||||
2=> "February",
|
||||
3=> "March",
|
||||
4=> "April",
|
||||
5=> "May",
|
||||
6=> "June",
|
||||
7=> "July",
|
||||
8=> "August",
|
||||
9=> "September",
|
||||
10=> "October",
|
||||
11=> "November",
|
||||
12=> "December"
|
||||
);
|
||||
our %weekday = (
|
||||
1=> "Sunday",
|
||||
2=> "Monday",
|
||||
3=> "Tuesday",
|
||||
4=> "Wednesday",
|
||||
5=> "Thursday",
|
||||
6=> "Friday",
|
||||
7=> "Saturday"
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getMonth {
|
||||
my %month = (
|
||||
1=> WebGUI::International::get(15),
|
||||
2=> WebGUI::International::get(16),
|
||||
3=> WebGUI::International::get(17),
|
||||
4=> WebGUI::International::get(18),
|
||||
5=> WebGUI::International::get(19),
|
||||
6=> WebGUI::International::get(20),
|
||||
7=> WebGUI::International::get(21),
|
||||
8=> WebGUI::International::get(22),
|
||||
9=> WebGUI::International::get(23),
|
||||
10=> WebGUI::International::get(24),
|
||||
11=> WebGUI::International::get(25),
|
||||
12=> WebGUI::International::get(26)
|
||||
);
|
||||
return %month;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getWeekday {
|
||||
my %weekday = (
|
||||
1=> WebGUI::International::get(27),
|
||||
2=> WebGUI::International::get(28),
|
||||
3=> WebGUI::International::get(29),
|
||||
4=> WebGUI::International::get(30),
|
||||
5=> WebGUI::International::get(31),
|
||||
6=> WebGUI::International::get(32),
|
||||
7=> WebGUI::International::get(33)
|
||||
);
|
||||
return %weekday;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub epochToHuman {
|
||||
my ($hour12, $value, $output, @date);
|
||||
my ($hour12, $value, $output, @date, %weekday, %month);
|
||||
@date = localtime($_[0]);
|
||||
$date[4]++; # offset the months starting from 0
|
||||
$date[5] += 1900; # original value is Year-1900
|
||||
|
|
@ -58,12 +69,18 @@ sub epochToHuman {
|
|||
$value = sprintf("%02d",$date[4]);
|
||||
$output =~ s/\%m/$value/g;
|
||||
$output =~ s/\%M/$date[4]/g;
|
||||
$output =~ s/\%c/$month{$date[4]}/g;
|
||||
if ($output =~ /\%c/) {
|
||||
%month = _getMonth();
|
||||
$output =~ s/\%c/$month{$date[4]}/g;
|
||||
}
|
||||
#---day stuff
|
||||
$value = sprintf("%02d",$date[3]);
|
||||
$output =~ s/\%d/$value/g;
|
||||
$output =~ s/\%D/$date[3]/g;
|
||||
$output =~ s/\%w/$weekday{$date[6]}/g;
|
||||
if ($output =~ /\%w/) {
|
||||
%weekday = _getWeekday();
|
||||
$output =~ s/\%w/$weekday{$date[6]}/g;
|
||||
}
|
||||
#---hour stuff
|
||||
$hour12 = $date[2]+1;
|
||||
if ($hour12 > 12) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Form;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict qw(vars subs);
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -116,19 +117,22 @@ sub submit {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub text {
|
||||
my ($output, $assistance, $name, $size, $maxLength, $value);
|
||||
($name, $size, $maxLength, $value, $assistance) = @_;
|
||||
my ($output, $assistance, $name, $size, $maxLength, $value, $events);
|
||||
($name, $size, $maxLength, $value, $assistance, $events) = @_;
|
||||
if ($size eq "") {
|
||||
$size = 15;
|
||||
}
|
||||
if ($maxLength ne "") {
|
||||
$maxLength = ' maxlength="'.$maxLength.'"';
|
||||
}
|
||||
if ($events ne "") {
|
||||
$events = ' '.$events;
|
||||
}
|
||||
if ($assistance == 1) {
|
||||
$assistance = '<input type="button" style="font-size: 8pt;" onClick="window.dateField = this.form.'.$name.';calendar = window.open(\''.$session{setting}{lib}.'/calendar.html\',\'cal\',\'WIDTH=200,HEIGHT=250\');return false" value="set date">';
|
||||
$assistance = '<input type="button" style="font-size: 8pt;" onClick="window.dateField = this.form.'.$name.';calendar = window.open(\''.$session{setting}{lib}.'/calendar.html\',\'cal\',\'WIDTH=200,HEIGHT=250\');return false" value="'.WebGUI::International::get(34).'">';
|
||||
}
|
||||
$value = _fixQuotes($value);
|
||||
$output = '<input type="text" name="'.$name.'" value="'.$value.'" size="'.$size.'" '.$maxLength.'>'.$assistance;
|
||||
$output = '<input type="text" name="'.$name.'" value="'.$value.'" size="'.$size.'" '.$maxLength.$events.'>'.$assistance;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +147,8 @@ sub textArea {
|
|||
$rows = 5;
|
||||
}
|
||||
if ($htmlEdit > 0) {
|
||||
$output = '<input type="button" onClick="colorText(this.form.'.$name.')" value="color" style="font-size: 8pt;"><input type="button" onClick="boldText(this.form.'.$name.')" value="bold" style="font-size: 8pt;"><input type="button" onClick="italicText(this.form.'.$name.')" value="italics" style="font-size: 8pt;"><input type="button" onClick="centerText(this.form.'.$name.')" value="center" style="font-size: 8pt;"><input type="button" onClick="list(this.form.'.$name.')" value="list" style="font-size: 8pt;"><input type="button" onClick="url(this.form.'.$name.')" value="link" style="font-size: 8pt;"><input type="button" onClick="email(this.form.'.$name.')" value="email" style="font-size: 8pt;"><input type="button" onClick="imageAdd(this.form.'.$name.')" value="image" style="font-size: 8pt;"><input type="button" onClick="showMe(this.form.'.$name.')" value="show me" style="font-size: 8pt;"><input type="button" onClick="copyright(this.form.'.$name.')" value="(C)" style="font-size: 8pt;"><input type="button" onClick="registered(this.form.'.$name.')" value="(R)" style="font-size: 8pt;"><input type="button" onClick="trademark(this.form.'.$name.')" value="TM" style="font-size: 8pt;"><br>';
|
||||
$output .= '<script language="JavaScript"> var formObj; var extrasDir="'.$session{setting}{lib}.'"; function openEditWindow(obj) { formObj = obj; /* if (navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE")+5,1)>=5) window.open("'.$session{setting}{lib}.'/ieEdit.html","editWindow","width=500,height=400"); else */ window.open("'.$session{setting}{lib}.'/nonIeEdit.html","editWindow","width=450,height=240"); } function setContent(content) { formObj.value = content; } </script>';
|
||||
$output .= '<input type="button" onClick="openEditWindow(this.form.'.$name.')" value="'.WebGUI::International::get(171).'" style="font-size: 8pt;"><br>';
|
||||
}
|
||||
if ($wrap eq "") {
|
||||
$wrap = "virtual";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::T;
|
||||
package WebGUI::International;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -11,26 +11,28 @@ package WebGUI::Macro::T;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
my %international;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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>';
|
||||
}
|
||||
sub get {
|
||||
my ($output, $language);
|
||||
if ($session{user}{language} ne "") {
|
||||
$language = $session{user}{language};
|
||||
} elsif ($_[1] ne "") {
|
||||
$language = $_[1];
|
||||
} else {
|
||||
$language = "English";
|
||||
}
|
||||
if (defined $international{$language}{$_[0]}) { # a little caching never hurts =)
|
||||
$output = $international{$language}{$_[0]};
|
||||
} else {
|
||||
($output) = WebGUI::SQL->quickArray("select message from international where internationalId=$_[0] and language='$language'",$session{dbh});
|
||||
if ($output eq "" && $language ne "English") {
|
||||
$output = get($_[0],"English");
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^T/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -16,9 +16,14 @@ use WebGUI::Session;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my (@files, $file, $cmd, $output);
|
||||
my (@files, $file, $cmd, $output, $macroDir);
|
||||
$output = $_[0];
|
||||
opendir (DIR,$session{config}{webguiRoot}."/lib/WebGUI/Macro") or WebGUI::ErrorHandler::fatalError("Can't open macro directory!");
|
||||
if ($^O =~ /Win/i) {
|
||||
$macroDir = "\\lib\\WebGUI\\Macro";
|
||||
} else {
|
||||
$macroDir = "/lib/WebGUI/Macro";
|
||||
}
|
||||
opendir (DIR,$session{config}{webguiRoot}.$macroDir) or WebGUI::ErrorHandler::fatalError("Can't open macro directory!");
|
||||
@files = readdir(DIR);
|
||||
foreach $file (@files) {
|
||||
if ($file ne "." && $file ne ".." && $file =~ /\.pm/) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::P;
|
||||
package WebGUI::Macro::A_anyMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -11,26 +11,29 @@ package WebGUI::Macro::P;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth);
|
||||
my ($output, $temp, $pageTitle, $depth, @data);
|
||||
$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;
|
||||
#---any page sub menu vertical---
|
||||
if ($output =~ /\^A(.*)\^\/A/) {
|
||||
($pageTitle,$depth) = split(/,/,$1);
|
||||
if ($depth eq "") {
|
||||
$depth = 1;
|
||||
}
|
||||
@data = WebGUI::SQL->quickArray("select pageId,title,urlizedTitle from page where urlizedTitle='$pageTitle'",$session{dbh});
|
||||
$temp = $pageTitle.'|'.$depth.'<span class="verticalMenu">';
|
||||
if (defined $data[0] && WebGUI::Privilege::canViewPage($data[0])) {
|
||||
$temp .= '<a href="'.$session{env}{SCRIPT_URL}.'/'.$data[2].'">'.$data[1].'</a><br>';
|
||||
$temp .= traversePageTree($data[0],1,$depth);
|
||||
}
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^P/$temp/g;
|
||||
$output =~ s/\^A(.*)\^\/A/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::At;
|
||||
package WebGUI::Macro::At_username;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::Backslash;
|
||||
package WebGUI::Macro::Backslash_pageUrl;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::C;
|
||||
package WebGUI::Macro::C_crumbTrail;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::Carat;
|
||||
package WebGUI::Macro::Carat_carat;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::D;
|
||||
package WebGUI::Macro::D_date;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
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;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::H;
|
||||
package WebGUI::Macro::H_homeLink;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -11,6 +11,7 @@ package WebGUI::Macro::H;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -22,7 +23,7 @@ sub process {
|
|||
$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>';
|
||||
$temp = '<a href="'.$session{env}{SCRIPT_NAME}.'/home">'.WebGUI::International::get(47).'</a>';
|
||||
$output =~ s/\^H/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::Hash;
|
||||
package WebGUI::Macro::Hash_userId;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::L;
|
||||
package WebGUI::Macro::L_loginBox;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -12,6 +12,8 @@ package WebGUI::Macro::L;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro::Backslash_pageUrl;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -22,13 +24,20 @@ sub process {
|
|||
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.';
|
||||
$temp .= WebGUI::International::get(48);
|
||||
$temp .= ' '.$session{user}{username}.'. ';
|
||||
$temp .= WebGUI::International::get(49);
|
||||
$temp = WebGUI::Macro::Backslash::process($temp);
|
||||
} 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::hidden("op","login").'<span class="formSubtext">';
|
||||
$temp .= WebGUI::International::get(50);
|
||||
$temp .= '<br></span>';
|
||||
$temp .= WebGUI::Form::text("username",12,30).'<span class="formSubtext"><br>';
|
||||
$temp .= WebGUI::International::get(51);
|
||||
$temp .= '<br></span>';
|
||||
$temp .= WebGUI::Form::password("identifier",12,30).'<span class="formSubtext"><br></span>';
|
||||
$temp .= WebGUI::Form::submit("login");
|
||||
$temp .= WebGUI::Form::submit(WebGUI::International::get(52));
|
||||
$temp .= '</form>';
|
||||
}
|
||||
$temp .= '</div>';
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::j;
|
||||
package WebGUI::Macro::M_currentMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -18,12 +18,17 @@ use WebGUI::Session;
|
|||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---2 level current level menu (vertical)---
|
||||
if ($output =~ /\^j/) {
|
||||
#---current menu vertical---
|
||||
if ($output =~ /\^M(.*)\^\/M/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree($session{page}{pageId},0,2);
|
||||
$temp .= traversePageTree($session{page}{pageId},0,$1);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^j/$temp/g;
|
||||
$output =~ s/\^M(.*)\^\/M/$temp/g;
|
||||
} elsif ($output =~ /\^M/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree($session{page}{pageId},0,1);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^M/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::h;
|
||||
package WebGUI::Macro::P_previousMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -12,17 +12,23 @@ package WebGUI::Macro::h;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---3 level menu (vertical)---
|
||||
if ($output =~ /\^h/) {
|
||||
#---previous menu vertical---
|
||||
if ($output =~ /\^P(.*)\^\/P/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree(1,0,3);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^h/$temp/g;
|
||||
$temp .= traversePageTree($session{page}{parentId},0,$1);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^P(.*)\^\/P/$temp/g;
|
||||
} elsif ($output =~ /\^P/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree($session{page}{parentId},0,1);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^P/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::Splat;
|
||||
package WebGUI::Macro::Splat_random;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -11,14 +11,18 @@ package WebGUI::Macro::Splat;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Utility;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---random number---
|
||||
if ($output =~ /\^\*/) {
|
||||
$temp = rand()*1000000000;
|
||||
if ($output =~ /\^\*(.*)\^\/\*/) {
|
||||
$temp = round(rand()*$1);
|
||||
$output =~ s/\^\*(.*)\^\/\*/$temp/g;
|
||||
} elsif ($output =~ /\^\*/) {
|
||||
$temp = round(rand()*1000000000);
|
||||
$output =~ s/\^\*/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::J;
|
||||
package WebGUI::Macro::T_topMenuVertical;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -12,18 +12,22 @@ package WebGUI::Macro::J;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp, @data, $sth, $first);
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
#---3 level current level menu (vertical)---
|
||||
if ($output =~ /\^J/) {
|
||||
#---top menu vertical---
|
||||
if ($output =~ /\^T(.*)\^\/T/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree($session{page}{pageId},0,3);
|
||||
$temp .= traversePageTree(1,0,$1);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^J/$temp/g;
|
||||
$output =~ s/\^T(.*)\^\/T/$temp/g;
|
||||
} elsif ($output =~ /\^T/) {
|
||||
$temp = '<span class="verticalMenu">';
|
||||
$temp .= traversePageTree(1,0,1);
|
||||
$temp .= '</span>';
|
||||
$output =~ s/\^T/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::a;
|
||||
package WebGUI::Macro::a_account;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -11,6 +11,7 @@ package WebGUI::Macro::a;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -22,7 +23,7 @@ sub process {
|
|||
$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>';
|
||||
$temp = '<a href="'.$session{page}{url}.'?op=displayAccount">'.WebGUI::International::get(46).'</a>';
|
||||
$output =~ s/\^a/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::c;
|
||||
package WebGUI::Macro::c_companyName;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::e;
|
||||
package WebGUI::Macro::e_companyEmail;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
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;
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
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;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::M;
|
||||
package WebGUI::Macro::m_currentMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::p;
|
||||
package WebGUI::Macro::p_previousMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::r;
|
||||
package WebGUI::Macro::r_printable;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -11,6 +11,7 @@ package WebGUI::Macro::r;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -34,7 +35,9 @@ sub process {
|
|||
} else {
|
||||
$temp .= '?makePrintable=1';
|
||||
}
|
||||
$temp = '<a href="'.$temp.'">Make Page Printable</a>';
|
||||
$temp = '<a href="'.$temp.'">';
|
||||
$temp .= WebGUI::International::get(53);
|
||||
$temp .= '</a>';
|
||||
$output =~ s/\^r/$temp/g;
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::t;
|
||||
package WebGUI::Macro::t_topMenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Macro::u;
|
||||
package WebGUI::Macro::u_companyUrl;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
|
|
@ -15,8 +15,10 @@ use Exporter;
|
|||
use Net::LDAP;
|
||||
use strict;
|
||||
use URI;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Mail;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -56,40 +58,43 @@ sub _login {
|
|||
WebGUI::Session::setCookie("wgSession",$cookieInfo);
|
||||
return "";
|
||||
} else {
|
||||
WebGUI::ErrorHandler::warn("Session signature '".$cookieInfo."' does not match account info for user ID ".$_[0]);
|
||||
return "<b>Error:</b> Unable to initialize session vars because your session signature does not match your account information.<p>";
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_createAccount {
|
||||
my ($output);
|
||||
my ($output, %language);
|
||||
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 .= '<h1>'.WebGUI::International::get(54).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","saveAccount");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Username</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
if ($session{setting}{authMethod} eq "LDAP") {
|
||||
$output .= WebGUI::Form::hidden("identifier1","ldap-password");
|
||||
$output .= WebGUI::Form::hidden("identifier2","ldap-password");
|
||||
$output .= '<tr><td class="formDescription">'.$session{setting}{ldapIdName}.'</td><td>'.WebGUI::Form::text("ldapId",20,100).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.$session{setting}{ldapPasswordName}.'</td><td>'.WebGUI::Form::password("ldapPassword",20,100).'</td></tr>';
|
||||
} else {
|
||||
$output .= '<tr><td class="formDescription">Password</td><td>'.WebGUI::Form::password("identifier1",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Password (confirm)</td><td>'.WebGUI::Form::password("identifier2",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier1",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(55).'</td><td>'.WebGUI::Form::password("identifier2",20,30).'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription" valign="top">Email Address</td><td>'.WebGUI::Form::text("email",20,255).'<span class="formSubtext"><br>This is only necessary if you wish to use features that require Email.</span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top"><a href="http://www.icq.com">ICQ</a> UIN</td><td>'.WebGUI::Form::text("icq",20,30).'<span class="formSubtext"><br>This is only necessary if you wish to use features that require ICQ.</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("create").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'<span class="formSubtext"><br>'.WebGUI::International::get(57).'</span></td></tr>';
|
||||
%language = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%language).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">I already have an account.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">'.WebGUI::International::get(58).'</a>';
|
||||
if ($session{setting}{authMethod} eq "WebGUI") {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">I forgot my password.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">'.WebGUI::International::get(59).'</a>';
|
||||
}
|
||||
$output .= '</ul></div>';
|
||||
}
|
||||
|
|
@ -102,10 +107,10 @@ sub www_deactivateAccount {
|
|||
if ($session{user}{userId} == 1) {
|
||||
$output .= www_displayLogin();
|
||||
} else {
|
||||
$output .= '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain you want to deactivate your account. If you proceed your account information will be lost permanently.<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deactivateAccountConfirm">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(60).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deactivateAccountConfirm">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -123,34 +128,37 @@ sub www_deactivateAccountConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_displayAccount {
|
||||
my ($output);
|
||||
my ($output, %hash, @array);
|
||||
if ($session{user}{userId} != 1) {
|
||||
$output .= ' <h1>Update Account Information</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= '<h1>'.WebGUI::International::get(61).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","updateAccount");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">username</td><td>'.WebGUI::Form::text("username",20,30,$session{user}{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30,$session{user}{username}).'</td></tr>';
|
||||
if ($session{user}{authMethod} eq "LDAP") {
|
||||
$output .= WebGUI::Form::hidden("identifier","password");
|
||||
} else {
|
||||
$output .= '<tr><td class="formDescription">password</td><td>'.WebGUI::Form::password("identifier1",20,30,"password").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">password (confirm)</td><td>'.WebGUI::Form::password("identifier2",20,30,"password").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier1",20,30,"password").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(55).'</td><td>'.WebGUI::Form::password("identifier2",20,30,"password").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription" valign="top">email address</td><td>'.WebGUI::Form::text("email",20,255,$session{user}{email}).'<span class="formSubtext"><br>This is only necessary if you wish to use features that require Email.</span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top"><a href="http://www.icq.com">ICQ</a> UIN</td><td>'.WebGUI::Form::text("icq",20,30,$session{user}{icq}).'<span class="formSubtext"><br>This is only necessary if you wish to use features that require ICQ.</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("update").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255,$session{user}{email}).'<span class="formSubtext"><br>'.WebGUI::International::get(57).'</span></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
$array[0] = $session{user}{language};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if (WebGUI::Privilege::isInGroup(3) || WebGUI::Privilege::isInGroup(4)) {
|
||||
if ($session{var}{adminOn}) {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOffAdmin">Turn admin off.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOffAdmin">'.WebGUI::International::get(12).'</a>';
|
||||
} else {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">Turn admin on.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">'.WebGUI::International::get(63).'</a>';
|
||||
}
|
||||
}
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=logout">Logout.</a><li><a href="'.$session{page}{url}.'?op=deactivateAccount">Please deactivate my account permanently.</a></ul></div>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=logout">'.WebGUI::International::get(64).'</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=deactivateAccount">'.WebGUI::International::get(65).'</a></ul></div>';
|
||||
} else {
|
||||
$output .= 'You need to be logged in to view your account information.<p>';
|
||||
$output .= www_displayLogin();
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -162,20 +170,21 @@ sub www_displayLogin {
|
|||
if ($session{var}{sessionId}) {
|
||||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output .= ' <h1>Login</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= '<h1>'.WebGUI::International::get(66).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","login");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">username</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">password</td><td>'.WebGUI::Form::password("identifier",20,30).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("login").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier",20,30).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(52)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form>';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if ($session{setting}{anonymousRegistration} eq "yes") {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">Create a new account.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">'.WebGUI::International::get(67).'</a>';
|
||||
}
|
||||
if ($session{setting}{authMethod} eq "WebGUI") {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">I forgot my password.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=recoverPassword">'.WebGUI::International::get(59).'</a>';
|
||||
}
|
||||
$output .= '</ul></div>';
|
||||
}
|
||||
|
|
@ -194,14 +203,15 @@ sub www_login {
|
|||
$port = $uri->port;
|
||||
}
|
||||
%args = (port => $port);
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error = "Cannot connect to LDAP server.";
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error = WebGUI::International::get(79);
|
||||
$auth = $ldap->bind($connectDN, $session{form}{identifier});
|
||||
$ldap->unbind;
|
||||
if ($auth->code == 48 || $auth->code == 49) {
|
||||
$error = "The account information you supplied is invalid. Either the account does not exist or the username/password combination was incorrect.";
|
||||
$error = WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid login for user account: ".$session{form}{username});
|
||||
} elsif ($auth->code > 0) {
|
||||
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. Please contact your system administrator for assistance. ';
|
||||
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured.';
|
||||
$error .= WebGUI::International::get(69);
|
||||
WebGUI::ErrorHandler::warn("LDAP error: ".$ldapStatusCode{$auth->code});
|
||||
} else {
|
||||
$success = 1;
|
||||
|
|
@ -210,7 +220,7 @@ sub www_login {
|
|||
if (Digest::MD5::md5_base64($session{form}{identifier}) eq $pass && $session{form}{identifier} ne "") {
|
||||
$success = 1;
|
||||
} else {
|
||||
$error = "The account information you supplied is invalid. Either the account does not exist or the username/password combination was incorrect.";
|
||||
$error = WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid login for user account: ".$session{form}{username});
|
||||
}
|
||||
}
|
||||
|
|
@ -218,7 +228,7 @@ sub www_login {
|
|||
_login($uid,$pass);
|
||||
return "";
|
||||
} else {
|
||||
return "<h1>Error</h1>".$error.www_displayLogin();
|
||||
return "<h1>".WebGUI::International::get(70)."</h1>".$error.www_displayLogin();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,18 +245,19 @@ sub www_recoverPassword {
|
|||
if ($session{var}{sessionId}) {
|
||||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output .= ' <h1>Recover Password</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= '<h1>'.WebGUI::International::get(71).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","recoverPasswordFinish");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Email Address</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("recover").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(72)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form>';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if ($session{setting}{anonymousRegistration} eq "yes") {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">Create a new account.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=createAccount">'.WebGUI::International::get(67).'</a>';
|
||||
}
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">Login.</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=displayLogin">'.WebGUI::International::get(73).'</a>';
|
||||
$output .= '</ul></div>';
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -263,15 +274,17 @@ sub www_recoverPasswordFinish {
|
|||
$encryptedPassword = Digest::MD5::md5_base64($password);
|
||||
WebGUI::SQL->write("update users set identifier='$encryptedPassword' where userId='$userId'",$session{dbh});
|
||||
$flag = 1;
|
||||
$message = "Someone (probably you) requested your account information be sent. Your password has been reset. The following represents your new account information:\nUser: ".$username."\nPass: ".$password."\n";
|
||||
WebGUI::Mail::send($session{form}{email},"Account Information",$message);
|
||||
$message = $session{setting}{recoverPasswordEmail};
|
||||
$message .= "\n".WebGUI::International::get(50).": ".$username."\n";
|
||||
$message .= WebGUI::International::get(51).": ".$password."\n";
|
||||
WebGUI::Mail::send($session{form}{email},WebGUI::International::get(74),$message);
|
||||
}
|
||||
$sth->finish();
|
||||
if ($flag) {
|
||||
$output = '<ul><li>Your account information has been sent to your email address.</ul>';
|
||||
$output = '<ul><li>'.WebGUI::International::get(75).'</ul>';
|
||||
$output .= www_displayLogin();
|
||||
} else {
|
||||
$output = '<ul><li>That email address is not in our databases.</ul>';
|
||||
$output = '<ul><li>'.WebGUI::International::get(76).'</ul>';
|
||||
$output .= www_recoverPassword();
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -281,10 +294,14 @@ sub www_recoverPasswordFinish {
|
|||
sub www_saveAccount {
|
||||
my ($uri, $ldap, $port, %args, $search, $connectDN, $auth, $output, $error, $uid, $encryptedPassword);
|
||||
if (_hasBadUsername($session{form}{username})) {
|
||||
$error = 'The account name "'.$session{form}{username}.'" is in use by another member of this site. Please try a different username, perhaps "'.$session{form}{username}.'too" or "'.$session{form}{username}.'01" ';
|
||||
$error = WebGUI::International::get(77);
|
||||
$error .= ' "'.$session{form}{username}.'too", ';
|
||||
$error .= '"'.$session{form}{username}.'2", ';
|
||||
$error .= '"'.$session{form}{username}.'_'.WebGUI::DateTime::epochToHuman(time(),"%y").'"';
|
||||
$error .= '<p>';
|
||||
}
|
||||
if (_hasBadPassword($session{form}{identifier1},$session{form}{identifier2})) {
|
||||
$error .= 'Your passwords did not match. Please try again. ';
|
||||
$error .= WebGUI::International::get(78);
|
||||
}
|
||||
if ($session{setting}{authMethod} eq "LDAP") {
|
||||
$uri = URI->new($session{setting}{ldapURL});
|
||||
|
|
@ -294,18 +311,18 @@ sub www_saveAccount {
|
|||
$port = $uri->port;
|
||||
}
|
||||
%args = (port => $port);
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= "Cannot connect to LDAP server. ";
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= WebGUI::International::get(79);
|
||||
$ldap->bind;
|
||||
$search = $ldap->search (base => $uri->dn, filter => $session{setting}{ldapId}."=".$session{form}{ldapId});
|
||||
$connectDN = "cn=".$search->entry(0)->get_value("cn");
|
||||
$ldap->unbind;
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= "Cannot connect to LDAP server. ";
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= WebGUI::International::get(79);
|
||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{ldapPassword});
|
||||
if ($auth->code == 48 || $auth->code == 49) {
|
||||
$error .= "Either your ".$session{setting}{ldapIdName}." or ".$session{setting}{ldapPasswordName}." were invalid. ";
|
||||
$error .= WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
} elsif ($auth->code > 0) {
|
||||
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. Please contact your system administrator for assistance. ';
|
||||
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69);
|
||||
WebGUI::ErrorHandler::warn("LDAP error: ".$ldapStatusCode{$auth->code});
|
||||
}
|
||||
$ldap->unbind;
|
||||
|
|
@ -313,13 +330,13 @@ sub www_saveAccount {
|
|||
if ($error eq "") {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
$uid = getNextId("userId");
|
||||
WebGUI::SQL->write("insert into users values ($uid, ".quote($session{form}{username}).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{form}{icq}).", ".quote($session{setting}{authMethod}).", ".quote($session{setting}{ldapURL}).", ".quote($connectDN).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into users (userId,username,identifier,email,authMethod,ldapURL,connectDN,language) values ($uid, ".quote($session{form}{username}).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{setting}{authMethod}).", ".quote($session{setting}{ldapURL}).", ".quote($connectDN).", ".quote($session{form}{language}).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into groupings values (2,$uid)",$session{dbh});
|
||||
_login($uid,$encryptedPassword);
|
||||
$output .= 'Account created successfully!<p>';
|
||||
$output .= WebGUI::International::get(80).'<p>';
|
||||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output = "<h1>Error</h1>".$error.www_createAccount();
|
||||
$output = "<h1>".WebGUI::International::get(70)."</h1>".$error.www_createAccount();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -329,21 +346,25 @@ sub www_updateAccount {
|
|||
my ($output, $error, $encryptedPassword, $passwordStatement);
|
||||
if ($session{var}{sessionId}) {
|
||||
if (_hasBadUsername($session{form}{username})) {
|
||||
$error = '<b>Error:</b> The account name <b>'.$session{form}{username}.'</b> is in use by another member of this site. Please try a different username, perhaps "'.$session{form}{username}.'too" or "'.$session{form}{username}.'01"<p>';
|
||||
$error = WebGUI::International::get(77);
|
||||
$error .= ' "'.$session{form}{username}.'too", ';
|
||||
$error .= '"'.$session{form}{username}.'2", ';
|
||||
$error .= '"'.$session{form}{username}.'_'.WebGUI::DateTime::epochToHuman(time(),"%y").'"';
|
||||
$error .= '<p>';
|
||||
}
|
||||
if ($session{form}{identifier1} ne "password" && _hasBadPassword($session{form}{identifier1},$session{form}{identifier2})) {
|
||||
$error .= '<b>Error:</b> Your passwords did not match. Please try again.<p>';
|
||||
$error .= WebGUI::International::get(78).'<p>';
|
||||
} else {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
$passwordStatement = ', identifier='.quote($encryptedPassword);
|
||||
}
|
||||
if ($error eq "") {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", icq=".quote($session{form}{icq})." where userId=".$session{user}{userId},$session{dbh});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", language=".quote($session{form}{language})." where userId=".$session{user}{userId},$session{dbh});
|
||||
if ($passwordStatement ne "") {
|
||||
_login($session{user}{userId},$encryptedPassword);
|
||||
}
|
||||
$output .= 'Account updated successfully!<p>';
|
||||
$output .= WebGUI::International::get(81).'<p>';
|
||||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output = $error;
|
||||
|
|
@ -356,3 +377,4 @@ sub www_updateAccount {
|
|||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use Exporter;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -26,12 +27,14 @@ our @EXPORT = qw(&www_addGroup &www_addGroupSave &www_deleteGroup &www_deleteGro
|
|||
sub www_addGroup {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=17"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Group</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=17"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(83).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","addGroupSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Group Name</td><td>'.WebGUI::Form::text("groupName",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Description</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(84).'</td><td>'.WebGUI::Form::text("groupName",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -58,10 +61,11 @@ sub www_deleteGroup {
|
|||
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>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=15"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(86).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteGroupConfirm&gid='.$session{form}{gid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -87,14 +91,16 @@ sub www_editGroup {
|
|||
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}.'"> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=13"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(87).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editGroupSave");
|
||||
$output .= WebGUI::Form::hidden("gid",$session{form}{gid});
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Group Name</td><td>'.WebGUI::Form::text("groupName",20,30,$group{groupName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Description</td><td>'.WebGUI::Form::textArea("description",$group{description}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Users In Group</td><td valign="top">';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(84).'</td><td>'.WebGUI::Form::text("groupName",20,30,$group{groupName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$group{description}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(88).'</td><td valign="top">';
|
||||
$sth = WebGUI::SQL->read("select users.username from users,groupings where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId order by users.username",$session{dbh});
|
||||
while (($user) = $sth->array) {
|
||||
$output .= $user."<br>";
|
||||
|
|
@ -124,8 +130,9 @@ sub www_listGroups {
|
|||
my ($output, $pn, $sth, @data, @row, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=10"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Groups</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addGroup">Add a new group.</a></div>';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=10"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(89).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addGroup">'.WebGUI::International::get(90).'</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
|
|
@ -145,15 +152,15 @@ sub www_listGroups {
|
|||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listGroups">«Previous Page</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listGroups">«'.WebGUI::International::get(91).'</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
$output .= '«'.WebGUI::International::get(91);
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listGroups">Next Page»</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listGroups">'.WebGUI::International::get(92).'»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
$output .= WebGUI::International::get(92).'»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Operation::Help;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -25,29 +26,29 @@ 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>';
|
||||
$output = '<h1>'.WebGUI::International::get(93).': '.$help{action}.' '.$help{object}.'</h1>';
|
||||
$help{body} =~ s/\n/\<br\>/g;
|
||||
$output .= $help{body};
|
||||
$output .= '<p><b>See Also:';
|
||||
$output .= '<p><b>'.WebGUI::International::get(94).':';
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object from help where object='$help{object}' and action<>'$help{action}' order by action",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'">'.$data[1].' '.$data[2].'</a> ·';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'">'.$data[1].' '.$data[2].'</a>,';
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object from help where helpId in ($help{seeAlso}) order by action",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'">'.$data[1].' '.$data[2].'</a> ·';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'">'.$data[1].' '.$data[2].'</a>,';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelpIndex">Help Index</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelpIndex">'.WebGUI::International::get(95).'</a>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpIndex {
|
||||
my ($sth, @data, $output, $previous);
|
||||
$output = '<h1>Help Index</h1>';
|
||||
$output .= '<table width="100%"><tr><td valign="top"><b>Sorted By Action</b><p>';
|
||||
$output = '<h1>'.WebGUI::International::get(95).'</h1>';
|
||||
$output .= '<table width="100%"><tr><td valign="top"><b>'.WebGUI::International::get(96).'</b><p>';
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object from help order by action,object",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if ($data[1] ne $previous) {
|
||||
|
|
@ -57,7 +58,7 @@ sub www_viewHelpIndex {
|
|||
$output .= '<li><a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'">'.$data[2].'</a><br>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</td><td valign="top"><b>Sorted By Object</b><p>';
|
||||
$output .= '</td><td valign="top"><b>'.WebGUI::International::get(97).'</b><p>';
|
||||
$sth = WebGUI::SQL->read("select helpId, object, action from help order by object,action",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
if ($data[1] ne $previous) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Operation::Page;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -58,12 +59,14 @@ sub _reorderPages {
|
|||
sub www_addPage {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Page</h1><form method="post" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(98).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("op","addPageSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$session{form}{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Meta Tags</td><td>'.WebGUI::Form::textArea("metaTags",$session{form}{metaTags}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("create").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$session{form}{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(100).'</td><td>'.WebGUI::Form::textArea("metaTags",$session{form}{metaTags}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -107,10 +110,11 @@ sub www_deletePage {
|
|||
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>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=3"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(101).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deletePageConfirm">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -137,39 +141,41 @@ sub www_editPage {
|
|||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%yesNo = ("0"=>"No", "1"=>"Yes");
|
||||
$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 = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=2"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(102).'</h1>';
|
||||
$output .= '<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>';
|
||||
$output .= '<tr><td colspan=2><b>'.WebGUI::International::get(103).'</b></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$session{page}{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(104).'</td><td>'.WebGUI::Form::text("urlizedTitle",20,30,$session{page}{urlizedTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(100).'</td><td>'.WebGUI::Form::textArea("metaTags",$session{page}{metaTags}).'</td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(105).'</b></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
$array[0] = $session{page}{styleId};
|
||||
$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>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(105).'</td><td>'.WebGUI::Form::selectList("styleId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(6).'</a></span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription"></td><td>'.WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">'.WebGUI::International::get(106).'</span></td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(107).'</b></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select users.userId,users.username from users,groupings where groupings.groupId=4 and groupings.userId=users.userId order by users.username",$session{dbh});
|
||||
$array[0] = $session{page}{ownerId};
|
||||
$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>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(108).'</td><td>'.WebGUI::Form::selectList("ownerId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(7).'</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>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(109).'</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>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(110).'</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).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listGroups">Manage Groups</a></span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(111).'</td><td>'.WebGUI::Form::selectList("groupId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(5).'</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>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(112).'</td><td>'.WebGUI::Form::selectList("groupView",\%yesNo,\@array).'</td></tr>';
|
||||
$array[0] = $session{page}{groupEdit};
|
||||
$output .= '<tr><td class="formDescription">Group can edit?</td><td>'.WebGUI::Form::selectList("groupEdit",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(113).'</td><td>'.WebGUI::Form::selectList("groupEdit",\%yesNo,\@array).'</td></tr>';
|
||||
$array[0] = $session{page}{worldView};
|
||||
$output .= '<tr><td class="formDescription">Anybody can view?</td><td>'.WebGUI::Form::selectList("worldView",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(114).'</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 .= '<tr><td class="formDescription">'.WebGUI::International::get(115).'</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">'.WebGUI::International::get(116).'</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,51 +13,37 @@ package WebGUI::Operation::Settings;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_editSettings &www_editSettingsSave);
|
||||
our @EXPORT = qw(&www_editAuthenticationSettings &www_editAuthenticationSettingsSave &www_editCompanyInformation &www_editCompanyInformationSave &www_editFileSettings &www_editFileSettingsSave &www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings &www_editMiscSettingsSave &www_manageSettings &www_viewStatistics);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSettings {
|
||||
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');
|
||||
sub www_editAuthenticationSettings {
|
||||
my ($output, %authMethod, @array, %yesNo);
|
||||
%authMethod = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
%yesNo = ('yes'=>WebGUI::International::get(138), 'no'=>WebGUI::International::get(139));
|
||||
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");
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=12"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(117).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editAuthenticationSettingsSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td colspan=2><b>Files</b></td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Path to WebGUI Extras</td><td>'.WebGUI::Form::text("lib",30,255,$session{setting}{lib}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Maximum Attachment Size</td><td>'.WebGUI::Form::text("maxAttachmentSize",30,11,$session{setting}{maxAttachmentSize}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Web Attachment Path</td><td>'.WebGUI::Form::text("attachmentDirectoryWeb",30,255,$session{setting}{attachmentDirectoryWeb}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Server Attachment Path</td><td>'.WebGUI::Form::text("attachmentDirectoryLocal",30,255,$session{setting}{attachmentDirectoryLocal}).'</td></tr>';
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>Company Information</b></td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Company Name</td><td>'.WebGUI::Form::text("companyName",30,255,$session{setting}{companyName}).'</td></tr>';
|
||||
$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>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">LDAP Identity (default)</td><td>'.WebGUI::Form::text("ldapId",30,100,$session{setting}{ldapId}).'</td></tr>';
|
||||
$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>';
|
||||
$array[0] = $session{setting}{anonymousRegistration};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(118).'</td><td>'.WebGUI::Form::selectList("anonymousRegistration",\%yesNo, \@array).'</td></tr>';
|
||||
$array[0] = $session{setting}{authMethod};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(119).'</td><td>'.WebGUI::Form::selectList("authMethod",\%authMethod, \@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(120).'</td><td>'.WebGUI::Form::text("ldapURL",30,2048,$session{setting}{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(121).'</td><td>'.WebGUI::Form::text("ldapId",30,100,$session{setting}{ldapId}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(122).'</td><td>'.WebGUI::Form::text("ldapIdName",30,100,$session{setting}{ldapIdName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(123).'</td><td>'.WebGUI::Form::text("ldapPasswordName",30,100,$session{setting}{ldapPasswordName}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<hr size=1>Build Version: '.$WebGUI::VERSION;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
|
|
@ -65,23 +51,145 @@ sub www_editSettings {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSettingsSave {
|
||||
sub www_editAuthenticationSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{lib})." where name='lib'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout})." where name='sessionTimeout'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryLocal})." where name='attachmentDirectoryLocal'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{smtpServer})." where name='smtpServer'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyName})." where name='companyName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyEmail})." where name='companyEmail'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyURL})." where name='companyURL'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{authMethod})." where name='authMethod'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapURL})." where name='ldapURL'",$session{dbh});
|
||||
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});
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCompanyInformation {
|
||||
my ($output);
|
||||
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>';
|
||||
$output .= '<h1>'.WebGUI::International::get(124).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editCompanyInformationSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(125).'</td><td>'.WebGUI::Form::text("companyName",30,255,$session{setting}{companyName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(126).'</td><td>'.WebGUI::Form::text("companyEmail",30,255,$session{setting}{companyEmail}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(127).'</td><td>'.WebGUI::Form::text("companyURL",30,2048,$session{setting}{companyURL}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCompanyInformationSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyName})." where name='companyName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyEmail})." where name='companyEmail'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyURL})." where name='companyURL'",$session{dbh});
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editFileSettings {
|
||||
my ($output);
|
||||
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>';
|
||||
$output .= '<h1>'.WebGUI::International::get(128).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editFileSettingsSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(129).'</td><td>'.WebGUI::Form::text("lib",30,255,$session{setting}{lib}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(130).'</td><td>'.WebGUI::Form::text("maxAttachmentSize",30,11,$session{setting}{maxAttachmentSize}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(131).'</td><td>'.WebGUI::Form::text("attachmentDirectoryWeb",30,255,$session{setting}{attachmentDirectoryWeb}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(132).'</td><td>'.WebGUI::Form::text("attachmentDirectoryLocal",30,255,$session{setting}{attachmentDirectoryLocal}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editFileSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{lib})." where name='lib'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryLocal})." wherename='attachmentDirectoryLocal'",$session{dbh});
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMailSettings {
|
||||
my ($output);
|
||||
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>';
|
||||
$output .= '<h1>'.WebGUI::International::get(133).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editMailSettingsSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(134).'</td><td>'.WebGUI::Form::textArea("recoverPasswordEmail",$session{setting}{recoverPasswordEmail}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(135).'</td><td>'.WebGUI::Form::text("smtpServer",30,255,$session{setting}{smtpServer}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMailSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{recoverPasswordEmail})." where name='recoverPasswordEmail'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{smtpServer})." where name='smtpServer'",$session{dbh});
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMiscSettings {
|
||||
my ($output, @array, %notFoundPage);
|
||||
%notFoundPage = (1=>WebGUI::International::get(136), 4=>WebGUI::International::get(137));
|
||||
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>';
|
||||
$output .= '<h1>'.WebGUI::International::get(140).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editMiscSettingsSave");
|
||||
$output .= '<table>';
|
||||
$array[0] = $session{setting}{notFoundPage};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(141).'</td><td>'.WebGUI::Form::selectList("notFoundPage",\%notFoundPage,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(142).'</td><td>'.WebGUI::Form::text("sessionTimeout",30,11,$session{setting}{sessionTimeout}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editMiscSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout})." where name='sessionTimeout'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{notFoundPage})." where name='notFoundPage'",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -89,4 +197,52 @@ sub www_editSettingsSave {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_manageSettings {
|
||||
my ($output);
|
||||
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>';
|
||||
$output .= '<h1>'.WebGUI::International::get(143).'</h1>';
|
||||
$output .= '<ul>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=editAuthenticationSettings">'.WebGUI::International::get(117).'</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=editCompanyInformation">'.WebGUI::International::get(124).'</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=editFileSettings">'.WebGUI::International::get(128).'</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=editMailSettings">'.WebGUI::International::get(133).'</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=editMiscSettings">'.WebGUI::International::get(140).'</a>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=viewStatistics">'.WebGUI::International::get(144).'</a>';
|
||||
$output .= '</ul>';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewStatistics {
|
||||
my ($output, $data);
|
||||
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>';
|
||||
$output .= '<h1>'.WebGUI::International::get(144).'</h1>';
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(145).'</td><td class="tableData">'.$WebGUI::VERSION.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from session",$session{dbh});
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(146).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*)+1 from page where parentId>25",$session{dbh});
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(147).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where pageId>25 or pageId=0",$session{dbh});
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(148).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from users where userId>25",$session{dbh});
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(149).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from groups where groupId>25",$session{dbh});
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
$output .= '</table>';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use Exporter;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -26,14 +27,16 @@ our @EXPORT = qw(&www_addStyle &www_addStyleSave &www_deleteStyle &www_deleteSty
|
|||
sub www_addStyle {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=16"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Style</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=16"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(150).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","addStyleSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Style Name</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Header</td><td>'.WebGUI::Form::textArea("header",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Footer</td><td>'.WebGUI::Form::textArea("footer",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Style Sheet</td><td>'.WebGUI::Form::textArea("styleSheet",'<style> </style>',50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(151).'</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(152).'</td><td>'.WebGUI::Form::textArea("header",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(153).'</td><td>'.WebGUI::Form::textArea("footer",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(154).'</td><td>'.WebGUI::Form::textArea("styleSheet","<style>\n\n</style>",50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -60,10 +63,10 @@ sub www_deleteStyle {
|
|||
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>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=4"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(155).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteStyleConfirm&sid='.$session{form}{sid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -89,15 +92,17 @@ sub www_editStyle {
|
|||
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}.'"> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=11"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(156).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editStyleSave");
|
||||
$output .= WebGUI::Form::hidden("sid",$session{form}{sid});
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Style Name</td><td>'.WebGUI::Form::text("name",20,30,$style{name}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Header</td><td>'.WebGUI::Form::textArea("header",$style{header},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Footer</td><td>'.WebGUI::Form::textArea("footer",$style{footer},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Style Sheet</td><td>'.WebGUI::Form::textArea("styleSheet",$style{styleSheet},50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(151).'</td><td>'.WebGUI::Form::text("name",20,30,$style{name}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(152).'</td><td>'.WebGUI::Form::textArea("header",$style{header},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(153).'</td><td>'.WebGUI::Form::textArea("footer",$style{footer},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(154).'</td><td>'.WebGUI::Form::textArea("styleSheet",$style{styleSheet},50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -121,8 +126,9 @@ sub www_listStyles {
|
|||
my ($output, $pn, $sth, @data, @row, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=9"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Styles</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addStyle">Add a new style.</a></div>';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=9"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(157).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addStyle">'.WebGUI::International::get(158).'</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Operation::Submission;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -46,7 +47,7 @@ sub www_denySubmission {
|
|||
sub www_viewPendingSubmissions {
|
||||
my (@submission, $output, $sth, @row, $i, $pn);
|
||||
if (WebGUI::Privilege::isInGroup(4,$session{user}{userId}) || WebGUI::Privilege::isInGroup(3,$session{user}{userId})) {
|
||||
$output = '<h1>Pending Sumissions</h1>';
|
||||
$output = '<h1>'.WebGUI::International::get(159).'</h1>';
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,username,userId,widgetId from submission where status='Pending' order by dateSubmitted",$session{dbh});
|
||||
while (@submission = $sth->array) {
|
||||
$row[$i] = '<tr><td class="tableData"><a href="'.$session{page}{url}.'?wid='.$submission[5].'&func=viewSubmission&sid='.$submission[1].'">'.$submission[0].'</a></td><td class="tableData">'.epochToHuman($submission[2],"%m/%d/%Y").'</td><td class="tableData">'.$submission[3].'</td></tr>';
|
||||
|
|
@ -54,7 +55,7 @@ sub www_viewPendingSubmissions {
|
|||
}
|
||||
$sth->finish;
|
||||
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
|
||||
$output .= '<tr><td class="tableHeader">Title</td><td class="tableHeader">Date Submitted</td><td class="tableHeader">Submitted By</td></tr>';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(160).'</td><td class="tableHeader">'.WebGUI::International::get(161).'</td></tr>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
|
|
@ -66,15 +67,15 @@ sub www_viewPendingSubmissions {
|
|||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=viewPendingSubmissions">«Previous Page</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=viewPendingSubmissions">«'.WebGUI::International::get(91).'</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
$output .= '«'.WebGUI::International::get(91);
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($pn < round($#row/50)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=viewPendingSubmissions">Next Page»</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=viewPendingSubmissions">'.WebGUI::International::get(92).'»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
$output .= WebGUI::International::get(92).'»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ sub _recursePageTree {
|
|||
sub www_purgeTrash {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=46"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you wish to purge all the pages and widgets in the trash?<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=purgeTrashConfirm">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=46"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(162).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=purgeTrashConfirm">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ use Exporter;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Operation::Help;
|
||||
use WebGUI::Operation::Page;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -29,21 +28,25 @@ our @EXPORT = qw(&www_addUser &www_addUserSave &www_deleteUser &www_deleteUserCo
|
|||
sub www_addUser {
|
||||
my ($output, %hash, @array);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=5"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add User</h1> <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=5"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(163).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","addUserSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Username</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Password</td><td>'.WebGUI::Form::password("identifier",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier",20,30).'</td></tr>';
|
||||
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
$array[0] = $session{setting}{authMethod};
|
||||
$output .= '<tr><td class="formDescription">Authentication Method</td><td>'.WebGUI::Form::selectList("authMethod",\%hash, \@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">LDAP URL</td><td>'.WebGUI::Form::text("ldapURL",20,2048,$session{setting}{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Connect DN</td><td>'.WebGUI::Form::text("connectDN",20,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Email address</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top"><a href="http://www.icq.com">ICQ</a> UIN</td><td>'.WebGUI::Form::text("icq",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(164).'</td><td>'.WebGUI::Form::selectList("authMethod",\%hash, \@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(165).'</td><td>'.WebGUI::Form::text("ldapURL",20,2048,$session{setting}{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(166).'</td><td>'.WebGUI::Form::text("connectDN",20,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'</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">Groups</td><td>'.WebGUI::Form::selectList("groups",\%hash,'',5,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$array[0] = 2;
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(89).'</td><td>'.WebGUI::Form::selectList("groups",\%hash,\@array,5,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%hash).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -58,7 +61,7 @@ sub www_addUserSave {
|
|||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
|
||||
$uid = getNextId("userId");
|
||||
WebGUI::SQL->write("insert into users values ($uid, ".quote($session{form}{username}).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{form}{icq}).", ".quote($session{form}{authMethod}).", ".quote($session{form}{ldapURL}).", ".quote($session{form}{connectDN}).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into users values ($uid, ".quote($session{form}{username}).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{form}{authMethod}).", ".quote($session{form}{ldapURL}).", ".quote($session{form}{connectDN}).", ".quote($session{form}{language}).", '')",$session{dbh});
|
||||
@groups = $session{cgi}->param('groups');
|
||||
foreach $gid (@groups) {
|
||||
WebGUI::SQL->write("insert into groupings values ($gid, $uid)",$session{dbh});
|
||||
|
|
@ -76,10 +79,11 @@ sub www_deleteUser {
|
|||
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>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=7"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(167).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteUserConfirm&uid='.$session{form}{uid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -105,23 +109,28 @@ sub www_editUser {
|
|||
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}.'"> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=6"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(168).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","editUserSave");
|
||||
$output .= WebGUI::Form::hidden("uid",$session{form}{uid});
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Username</td><td>'.WebGUI::Form::text("username",20,30,$user{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Password</td><td>'.WebGUI::Form::password("identifier",20,30,"password").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30,$user{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier",20,30,"password").'</td></tr>';
|
||||
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
$array[0] = $user{authMethod};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Authentication Method</td><td>'.WebGUI::Form::selectList("authMethod",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">LDAP URL</td><td>'.WebGUI::Form::text("ldapURL",20,2048,$user{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Connect DN</td><td>'.WebGUI::Form::text("connectDN",20,255,$user{connectDN}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">Email Address</td><td>'.WebGUI::Form::text("email",20,255,$user{email}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top"><a href="http://www.icq.com">ICQ</a> UIN</td><td>'.WebGUI::Form::text("icq",20,30,$user{icq}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(164).'</td><td>'.WebGUI::Form::selectList("authMethod",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(165).'</td><td>'.WebGUI::Form::text("ldapURL",20,2048,$user{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(166).'</td><td>'.WebGUI::Form::text("connectDN",20,255,$user{connectDN}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255,$user{email}).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
@array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">Groups</td><td>'.WebGUI::Form::selectList("groups",\%hash,\@array,5,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(89).'</td><td>'.WebGUI::Form::selectList("groups",\%hash,\@array,5,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
@array = [];
|
||||
$array[0] = $user{language};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -139,7 +148,7 @@ sub www_editUserSave {
|
|||
$passwordStatement = ', identifier='.quote($encryptedPassword);
|
||||
}
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", authMethod=".quote($session{form}{authMethod}).", ldapURL=".quote($session{form}{ldapURL}).", connectDN=".quote($session{form}{connectDN}).", email=".quote($session{form}{email}).", icq=".quote($session{form}{icq})." where userId=".$session{form}{uid},$session{dbh});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", authMethod=".quote($session{form}{authMethod}).", ldapURL=".quote($session{form}{ldapURL}).", connectDN=".quote($session{form}{connectDN}).", email=".quote($session{form}{email}).", language=".quote($session{form}{language})." where userId=".$session{form}{uid},$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh});
|
||||
@groups = $session{cgi}->param('groups');
|
||||
foreach $gid (@groups) {
|
||||
|
|
@ -153,15 +162,25 @@ sub www_editUserSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listUsers {
|
||||
my ($output, $sth, @data, @row, $pn, $i, $itemsPerPage);
|
||||
my ($output, $sth, @data, @row, $pn, $i, $itemsPerPage, $search);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=8"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Users</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addUser">Add a new user.</a></div>';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=8"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(149).'</h1>';
|
||||
$output .= '<table class="tableData" align="center" width="75%"><tr><td>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=addUser">'.WebGUI::International::get(169).'</a>';
|
||||
$output .= '</td><form method="post" action="'.$session{page}{url}.'"><td align="right">';
|
||||
$output .= WebGUI::Form::hidden("op","listUsers");
|
||||
$output .= WebGUI::Form::text("keyword",20,50);
|
||||
$output .= WebGUI::Form::submit(WebGUI::International::get(170));
|
||||
$output .= '</td></form></tr></table><p>';
|
||||
if ($session{form}{keyword} ne "") {
|
||||
$search = " and (username like '%".$session{form}{keyword}."%' or email like '%".$session{form}{keyword}."%') ";
|
||||
}
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from users where username<>'Reserved' order by username",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from users where username<>'Reserved' $search order by username",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] = '<tr class="tableData"><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
#$row[$i] .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
$row[$i] .= '<td>'.$data[1].'</td>';
|
||||
$row[$i] .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
|
||||
|
|
@ -178,15 +197,15 @@ sub www_listUsers {
|
|||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listUsers">«Previous Page</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listUsers">«'.WebGUI::International::get(91).'</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
$output .= '«'.WebGUI::International::get(91);
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listUsers">Next Page»</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listUsers">'.WebGUI::International::get(92).'»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
$output .= WebGUI::International::get(92).'»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
|
|
@ -197,3 +216,4 @@ sub www_listUsers {
|
|||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Privilege;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -19,7 +20,9 @@ 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>';
|
||||
$output = '<h1>'.WebGUI::International::get(35).'</h1>';
|
||||
$output .= WebGUI::International::get(36);
|
||||
$output .= '<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>)';
|
||||
|
|
@ -68,7 +71,12 @@ sub canViewPage {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub insufficient {
|
||||
return '<h1>Permission Denied!</h1>You do not have sufficient privileges to perform this operation. Please <a href="'.$session{page}{url}.'?op=displayLogin">log in with an account</a> that has sufficient privileges before attempting this operation.<p>';
|
||||
my ($output);
|
||||
$output = '<h1>'.WebGUI::International::get(37).'</h1>';
|
||||
$output .= WebGUI::International::get(37);
|
||||
$output .= '<p>';
|
||||
$output = WebGUI::Macro::process($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -85,9 +93,22 @@ sub isInGroup {
|
|||
return $result;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub noAccess {
|
||||
my ($output);
|
||||
$output = '<h1>'.WebGUI::International::get(37).'</h1>';
|
||||
$output .= WebGUI::International::get(39);
|
||||
$output .= '<p>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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>';
|
||||
my ($output);
|
||||
$output = '<h1>'.WebGUI::International::get(40).'</h1>';
|
||||
$output .= WebGUI::International::get(41);
|
||||
$output .= '<p>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ use WebGUI::ErrorHandler;
|
|||
|
||||
# Note: This class is really not necessary, I just decided to wrapper DBI in case
|
||||
# I wanted to change to some other DB connector in the future. Also, it shorthands
|
||||
# a few tasks.
|
||||
# a few tasks. And to be honest, having it separated has come in handy a few times,
|
||||
# like when I started coding for databases beyond MySQL.
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub array {
|
||||
|
|
@ -44,7 +45,11 @@ sub buildHash {
|
|||
tie %hash, "Tie::IxHash";
|
||||
$sth = WebGUI::SQL->read($_[1],$_[2]);
|
||||
while (@data = $sth->array) {
|
||||
$hash{$data[0]} = $data[1];
|
||||
if ($data[1] eq "") {
|
||||
$hash{$data[0]} = $data[0];
|
||||
} else {
|
||||
$hash{$data[0]} = $data[1];
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
return %hash;
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ sub getStyle {
|
|||
<head>
|
||||
<title>'.$session{page}{title}.'</title>
|
||||
'.$style{styleSheet}.'
|
||||
'.$session{page}{metaTags}.'
|
||||
<script language="JavaScript" src="'.$session{setting}{lib}.'/WebGUI.js"></script>
|
||||
</head>
|
||||
'.$session{page}{metaTags}
|
||||
# .'<script language="JavaScript" src="'.$session{setting}{lib}.'/WebGUI.js"></script>'
|
||||
.'</head>
|
||||
'.$style{header};
|
||||
$footer = $style{footer}.'
|
||||
</html>';
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use CGI::Carp qw(fatalsToBrowser);
|
|||
use DBI;
|
||||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -66,10 +67,16 @@ sub www_cut {
|
|||
sub www_delete {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=14"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you wish to delete this content?<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteConfirm&wid='.$session{form}{wid}.'">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=14"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(43);
|
||||
$output .= '<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteConfirm&wid='.$session{form}{wid}.'">';
|
||||
$output .= WebGUI::International::get(44);
|
||||
$output .= '</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::International::get(45);
|
||||
$output .= '</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Widget::Article;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -28,7 +29,7 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Article";
|
||||
return WebGUI::International::get(172);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -36,23 +37,23 @@ sub www_add {
|
|||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=23"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>Add '.widgetName().'</h1>';
|
||||
$output .= '<h1>'.WebGUI::International::get(173).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","Article");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Article').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process macros?</td><td>'.WebGUI::Form::checkbox("processMacros",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Start Date</td><td>'.WebGUI::Form::text("startDate",20,30,epochToSet(time()),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">End Date</td><td>'.WebGUI::Form::text("endDate",20,30,'01/01/2037',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Body</td><td>'.WebGUI::Form::textArea("body",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Image</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Link Title</td><td>'.WebGUI::Form::text("linkTitle",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Link URL</td><td>'.WebGUI::Form::text("linkURL",20,2048).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1).' <span style="font-size: 8pt;">(check if you\'re not adding <br> manually)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'Article').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::text("startDate",20,30,epochToSet(time()),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(177).'</td><td>'.WebGUI::Form::text("endDate",20,30,'01/01/2037',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(178).'</td><td>'.WebGUI::Form::textArea("body",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(179).'</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(180).'</td><td>'.WebGUI::Form::text("linkTitle",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(181).'</td><td>'.WebGUI::Form::text("linkURL",20,2048).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(182).'</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(183).'</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1).' <span style="font-size: 8pt;">'.WebGUI::International::get(184).'</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -63,7 +64,7 @@ sub www_add {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addSave {
|
||||
my ($widgetId, $displayTitle, $image, $attachment);
|
||||
my ($widgetId, $image, $attachment);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create();
|
||||
$image = saveAttachment("image",$widgetId);
|
||||
|
|
@ -102,31 +103,31 @@ sub www_edit {
|
|||
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>';
|
||||
$output .= '<h1>Edit '.widgetName().'</h1>';
|
||||
$output .= '<h1>'.WebGUI::International::get(185).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$article{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$article{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process macros?</td><td>'.WebGUI::Form::checkbox("processMacros","1",$article{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Start Date</td><td>'.WebGUI::Form::text("startDate",20,30,epochToSet($article{startDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">End Date</td><td>'.WebGUI::Form::text("endDate",20,30,epochToSet($article{endDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Body</td><td>'.WebGUI::Form::textArea("body",$article{body},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$article{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$article{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros","1",$article{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::text("startDate",20,30,epochToSet($article{startDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(177).'</td><td>'.WebGUI::Form::text("endDate",20,30,epochToSet($article{endDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(178).'</td><td>'.WebGUI::Form::textArea("body",$article{body},50,10,1).'</td></tr>';
|
||||
if ($article{image} ne "") {
|
||||
$output .= '<tr><td class="formDescription">Image</td><td><a href="'.$session{page}{url}.'?func=deleteImage&wid='.$session{form}{wid}.'">Delete Image</a></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(179).'</td><td><a href="'.$session{page}{url}.'?func=deleteImage&wid='.$session{form}{wid}.'">'.WebGUI::International::get(186).'</a></td></tr>';
|
||||
} else {
|
||||
$output .= '<tr><td class="formDescription">Image</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(179).'</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription">Link Title</td><td>'.WebGUI::Form::text("linkTitle",20,30,$article{linkTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Link URL</td><td>'.WebGUI::Form::text("linkURL",20,2048,$article{linkURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(180).'</td><td>'.WebGUI::Form::text("linkTitle",20,30,$article{linkTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(181).'</td><td>'.WebGUI::Form::text("linkURL",20,2048,$article{linkURL}).'</td></tr>';
|
||||
if ($article{attachment} ne "") {
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td><a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'">Delete Attachment</a></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(182).'</td><td><a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'">'.WebGUI::International::get(186).'</a></td></tr>';
|
||||
} else {
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(182).'</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$article{convertCarriageReturns}).' <span style="font-size: 8pt;">(check if you\'re not adding <br> manually)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(183).'</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$article{convertCarriageReturns}).' <span style="font-size: 8pt;">'.WebGUI::International::get(184).'</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -136,7 +137,7 @@ sub www_edit {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
my ($widgetId, $displayTitle, $image, $attachment);
|
||||
my ($image, $attachment);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
update();
|
||||
$image = saveAttachment("image",$session{form}{wid});
|
||||
|
|
@ -187,7 +188,5 @@ sub www_view {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Widget::EventsCalendar;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -28,22 +29,24 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Events Calendar";
|
||||
return WebGUI::International::get(187);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=38"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Events Calendar</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=38"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(188).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","EventsCalendar");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Events Calendar').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the 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></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'Events Calendar').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -67,19 +70,23 @@ sub www_addSave {
|
|||
sub www_addEvent {
|
||||
my ($output, $today, %recursEvery);
|
||||
tie %recursEvery, 'Tie::IxHash';
|
||||
%recursEvery = ('never'=>'Happens Only Once','day'=>'Day','week'=>'Week');
|
||||
%recursEvery = ('never'=>WebGUI::International::get(189),
|
||||
'day'=>WebGUI::International::get(190),
|
||||
'week'=>WebGUI::International::get(191)
|
||||
);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
($today) = epochToSet(time());
|
||||
$output = '<h1>Add Event</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(192).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","addEventSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Name</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Start Date</td><td>'.WebGUI::Form::text("startDate",20,30,$today,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">End Date</td><td>'.WebGUI::Form::text("endDate",20,30,$today,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Recurs every</td><td>'.WebGUI::Form::selectList("recursEvery",\%recursEvery).' until '.WebGUI::Form::text("until",20,30,$today,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::text("startDate",20,30,$today,1,'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(177).'</td><td>'.WebGUI::Form::text("endDate",20,30,$today,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(193).'</td><td>'.WebGUI::Form::selectList("recursEvery",\%recursEvery).' '.WebGUI::International::get(194).' '.WebGUI::Form::text("until",20,30,$today,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -130,12 +137,12 @@ sub www_addEventSave {
|
|||
sub www_deleteEvent {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you want to delete this event';
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(195);
|
||||
if ($session{form}{rid} > 0) {
|
||||
$output .= ' <b>and</b> all of its recurring events';
|
||||
$output .= ' '.WebGUI::International::get(196);
|
||||
}
|
||||
$output .= '?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteEventConfirm&wid='.$session{form}{wid}.'&eid='.$session{form}{eid}.'&rid='.$session{form}{rid}.'">Yes, I\'m sure.</a> <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">No, I made a mistake.</a></div>';
|
||||
$output .= '?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteEventConfirm&wid='.$session{form}{wid}.'&eid='.$session{form}{eid}.'&rid='.$session{form}{rid}.'">'.WebGUI::International::get(44).'</a> <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -163,15 +170,17 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=39"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(197).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">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></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addEvent&wid='.$session{form}{wid}.'">Add New Event</a><p>';
|
||||
$output .= '<table border=1 cellpadding=3 cellspacing=0>';
|
||||
|
|
@ -203,17 +212,18 @@ sub www_editEvent {
|
|||
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}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(198).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("eid",$session{form}{eid});
|
||||
$output .= WebGUI::Form::hidden("func","editEventSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Name</td><td>'.WebGUI::Form::text("name",20,30,$event{name}).'</td></tr>'
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("name",20,30,$event{name}).'</td></tr>'
|
||||
;
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$event{description},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Start Date</td><td>'.WebGUI::Form::text("startDate",20,30,epochToSet($event{startDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">End Date</td><td>'.WebGUI::Form::text("endDate",20,30,epochToSet($event{endDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$event{description},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::text("startDate",20,30,epochToSet($event{startDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(177).'</td><td>'.WebGUI::Form::text("endDate",20,30,epochToSet($event{endDate}),1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::ExtraColumn;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -26,22 +27,24 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Extra Column";
|
||||
return WebGUI::International::get(199);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=25"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Column</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=25"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(200).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","ExtraColumn");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= WebGUI::Form::hidden("title","column");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Spacer</td><td>'.WebGUI::Form::text("spacer",20,3,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Width</td><td>'.WebGUI::Form::text("width",20,3,200).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">StyleSheet Class</td><td>'.WebGUI::Form::text("class",20,50,"content").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(201).'</td><td>'.WebGUI::Form::text("spacer",20,3,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(202).'</td><td>'.WebGUI::Form::text("width",20,3,200).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(203).'</td><td>'.WebGUI::Form::text("class",20,50,"content").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -68,15 +71,17 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=26"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(204).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= WebGUI::Form::hidden("title","column");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Spacer</td><td>'.WebGUI::Form::text("spacer",20,3,$data{spacer}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Width</td><td>'.WebGUI::Form::text("width",20,3,$data{width}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">StyleSheet Class</td><td>'.WebGUI::Form::text("class",20,30,$data{class}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(201).'</td><td>'.WebGUI::Form::text("spacer",20,3,$data{spacer}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(202).'</td><td>'.WebGUI::Form::text("width",20,3,$data{width}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(203).'</td><td>'.WebGUI::Form::text("class",20,30,$data{class}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(204)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::FAQ;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -38,22 +39,24 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "F.A.Q.";
|
||||
return WebGUI::International::get(205);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add F.A.Q.</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=40"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = '<h1>'.WebGUI::International::get(206).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","FAQ");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'F.A.Q.').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process Macros?</td><td>'.WebGUI::Form::checkbox("processMacros",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'F.A.Q.').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -77,13 +80,14 @@ sub www_addSave {
|
|||
sub www_addQuestion {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Question</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(207).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","addQuestionSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Question</td><td>'.WebGUI::Form::textArea("question",'',50,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Answer</td><td>'.WebGUI::Form::textArea("answer").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(208).'</td><td>'.WebGUI::Form::textArea("question",'',50,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(209).'</td><td>'.WebGUI::Form::textArea("answer").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -109,8 +113,10 @@ sub www_addQuestionSave {
|
|||
sub www_deleteQuestion {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you want to delete this question?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteQuestionConfirm&wid='.$session{form}{wid}.'&qid='.$session{form}{qid}.'">Yes, I\'m sure.</a> <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">No, I made a mistake.</a></div>';
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(210).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteQuestionConfirm&wid='.$session{form}{wid}.'&qid='.$session{form}{qid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -135,17 +141,19 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=41"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = '<h1>'.WebGUI::International::get(211).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">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></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(174).'</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("processMacros","1",$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addQuestion&wid='.$session{form}{wid}.'">Add New Question</a><p>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addQuestion&wid='.$session{form}{wid}.'">'.WebGUI::International::get(212).'</a><p>';
|
||||
$output .= '<table border=1 cellpadding=3 cellspacing=0>';
|
||||
$sth = WebGUI::SQL->read("select questionId,question from faqQuestion where widgetId='$session{form}{wid}' order by sequenceNumber",$session{dbh});
|
||||
while (@question = $sth->array) {
|
||||
|
|
@ -175,14 +183,15 @@ sub www_editQuestion {
|
|||
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}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(213).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("qid",$session{form}{qid});
|
||||
$output .= WebGUI::Form::hidden("func","editQuestionSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Question</td><td>'.WebGUI::Form::textArea("question",$question{question},50,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Answer</td><td>'.WebGUI::Form::textArea("answer",$question{answer}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(208).'</td><td>'.WebGUI::Form::textArea("question",$question{question},50,3).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(209).'</td><td>'.WebGUI::Form::textArea("answer",$question{answer}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::LinkList;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -38,22 +39,24 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Link List";
|
||||
return WebGUI::International::get(214);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=34"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Link List</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=34"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(219).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","LinkList");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Link List').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,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></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'Link List').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description").'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -77,14 +80,15 @@ sub www_addSave {
|
|||
sub www_addLink {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Add Link</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(215).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","addLinkSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Name</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">URL</td><td>'.WebGUI::Form::text("url",20,1024).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'',50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(216).'</td><td>'.WebGUI::Form::text("url",20,1024).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'',50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -110,8 +114,10 @@ sub www_addLinkSave {
|
|||
sub www_deleteLink {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you want to delete this link?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid}.'">Yes, I\'m sure.</a> <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">No, I made a mistake.</a></div>';
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(217).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?func=edit&wid='.$session{form}{wid}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -136,17 +142,19 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=35"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(218).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">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></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addLink&wid='.$session{form}{wid}.'">Add New Link</a><p>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addLink&wid='.$session{form}{wid}.'">'.WebGUI::International::get(221).'</a><p>';
|
||||
$output .= '<table border=1 cellpadding=3 cellspacing=0>';
|
||||
$sth = WebGUI::SQL->read("select linkId, name from link where widgetId='$session{form}{wid}' order by sequenceNumber",$session{dbh});
|
||||
while (@link = $sth->array) {
|
||||
|
|
@ -176,15 +184,16 @@ sub www_editLink {
|
|||
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}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(220).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("lid",$session{form}{lid});
|
||||
$output .= WebGUI::Form::hidden("func","editLinkSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Name</td><td>'.WebGUI::Form::text("name",20,30,$link{name}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">URL</td><td>'.WebGUI::Form::text("url",20,2048,$link{url}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$link{description},50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("name",20,30,$link{name}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(216).'</td><td>'.WebGUI::Form::text("url",20,2048,$link{url}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$link{description},50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ package WebGUI::Widget::MessageBoard;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -23,7 +25,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});
|
||||
%board = WebGUI::SQL->quickHash("select * from widget, MessageBoard where widget.widgetId=MessageBoard.widgetId and widget.widgetId=$_[0]",$session{dbh});
|
||||
return %board;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +57,7 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Message Board";
|
||||
return WebGUI::International::get(223);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -63,18 +65,21 @@ sub www_add {
|
|||
my ($output, %hash);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=32"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Message Board</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=32"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(222).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","MessageBoard");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Message Board').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'Message Board').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</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,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 .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(224).'</td><td>'.WebGUI::Form::selectList("groupToPost",\%hash,'',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(225).'</td><td>'.WebGUI::Form::text("messagesPerPage",20,2,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(226).'</td><td>'.WebGUI::Form::text("editTimeout",20,3,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -102,19 +107,22 @@ sub www_edit {
|
|||
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 = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=33"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(227).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$board{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$board{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$board{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$board{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$board{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros","1",$board{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$board{description}).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$array[0] = $board{groupToPost};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Who can post?</td><td>'.WebGUI::Form::selectList("groupToPost",\%hash,\@array,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Messages Per Page</td><td>'.WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Edit Timeout</td><td>'.WebGUI::Form::text("editTimeout",20,2,$board{editTimeout}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(224).'</td><td>'.WebGUI::Form::selectList("groupToPost",\%hash,\@array,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(225).'</td><td>'.WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(226).'</td><td>'.WebGUI::Form::text("editTimeout",20,2,$board{editTimeout}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -146,14 +154,14 @@ sub www_editMessage {
|
|||
if ($board{displayTitle}) {
|
||||
$html .= $board{title};
|
||||
}
|
||||
$html .= '<td align="right" valign="bottom" class="boardMenu">Editing Message...</td></tr></table>';
|
||||
$html .= '<td align="right" valign="bottom" class="boardMenu">'.WebGUI::International::get(228).'</td></tr></table>';
|
||||
$html .= '<form action="'.$session{page}{url}.'" method="post"><table>';
|
||||
$html .= WebGUI::Form::hidden("func","editMessageSave");
|
||||
$html .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$html .= WebGUI::Form::hidden("mid",$session{form}{mid});
|
||||
$html .= '<tr><td class="formDescription">Subject</td><td>'.WebGUI::Form::text("subject",30,255,$message{subject}).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">Message</td><td>'.WebGUI::Form::textArea("message",$message{message},50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit("Save This Edit").'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).'</td><td>'.WebGUI::Form::text("subject",30,255,$message{subject}).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",$message{message},50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$html .= '</table></form>';
|
||||
$html .= www_showMessage();
|
||||
} else {
|
||||
|
|
@ -169,10 +177,10 @@ sub www_editMessageSave {
|
|||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
$session{form}{subject} = 'no subject';
|
||||
$session{form}{subject} = WebGUI::International::get(232);
|
||||
}
|
||||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' (eom)';
|
||||
$session{form}{subject} .= ' '.WebGUI::International::get(233);
|
||||
}
|
||||
WebGUI::SQL->write("update message set subject=".quote($session{form}{subject}).", message=".quote("\n --- (Edited at ".localtime(time).") --- \n\n".$session{form}{message})." where messageId=$session{form}{mid}",$session{dbh});
|
||||
return www_showMessage();
|
||||
|
|
@ -191,13 +199,13 @@ sub www_postNewMessage {
|
|||
if ($board{displayTitle}) {
|
||||
$html .= $board{title};
|
||||
}
|
||||
$html .= '<td align="right" valign="bottom" class="boardMenu">Posting New Message...</td></tr></table>';
|
||||
$html .= '<td align="right" valign="bottom" class="boardMenu">'.WebGUI::International::get(231).'</td></tr></table>';
|
||||
$html .= '<form action="'.$session{page}{url}.'" method="post"><table>';
|
||||
$html .= WebGUI::Form::hidden("func","postNewMessageSave");
|
||||
$html .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$html .= '<tr><td class="formDescription">Subject</td><td>'.WebGUI::Form::text("subject",30,255).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">Message</td><td>'.WebGUI::Form::textArea("message",'',50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit("Post This Message").'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).'</td><td>'.WebGUI::Form::text("subject",30,255).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",'',50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$html .= '</table></form>';
|
||||
} else {
|
||||
$html = WebGUI::Privilege::insufficient();
|
||||
|
|
@ -212,10 +220,10 @@ sub www_postNewMessageSave {
|
|||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
$session{form}{subject} = 'no subject';
|
||||
$session{form}{subject} = WebGUI::International::get(232);
|
||||
}
|
||||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' (eom)';
|
||||
$session{form}{subject} .= ' '.WebGUI::International::get(233);
|
||||
}
|
||||
$mid = getNextId("messageId");
|
||||
WebGUI::SQL->write("insert into message values ($mid, $mid, $session{form}{wid}, 0, $session{user}{userId}, ".quote($session{user}{username}).", ".quote($session{form}{subject}).", ".quote($session{form}{message}).", ".time().")",$session{dbh});
|
||||
|
|
@ -237,14 +245,14 @@ sub www_postReply {
|
|||
if ($board{displayTitle}) {
|
||||
$html .= $board{title};
|
||||
}
|
||||
$html .= '<td align="right" valign="bottom" class="boardMenu">Posting Reply...</td></tr></table>';
|
||||
$html .= '<td align="right" valign="bottom" class="boardMenu">'.WebGUI::International::get(234).'</td></tr></table>';
|
||||
$html .= '<form action="'.$session{page}{url}.'" method="post"><table>';
|
||||
$html .= WebGUI::Form::hidden("func","postReplySave");
|
||||
$html .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$html .= WebGUI::Form::hidden("mid",$session{form}{mid});
|
||||
$html .= '<tr><td class="formDescription">Subject</td><td>'.WebGUI::Form::text("subject",30,255,$subject).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">Message</td><td>'.WebGUI::Form::textArea("message",'',50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit("Post This Reply").'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription">'.WebGUI::International::get(229).'</td><td>'.WebGUI::Form::text("subject",30,255,$subject).'</td></tr>';
|
||||
$html .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(230).'</td><td>'.WebGUI::Form::textArea("message",'',50,6,1).'</td></tr>';
|
||||
$html .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$html .= '</table></form>';
|
||||
$html .= www_showMessage();
|
||||
} else {
|
||||
|
|
@ -260,10 +268,10 @@ sub www_postReplySave {
|
|||
%board = _getBoardProperties($session{form}{wid});
|
||||
if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) {
|
||||
if ($session{form}{subject} eq "") {
|
||||
$session{form}{subject} = 'no subject';
|
||||
$session{form}{subject} = WebGUI::International::get(232);
|
||||
}
|
||||
if ($session{form}{message} eq "") {
|
||||
$session{form}{subject} .= ' (eom)';
|
||||
$session{form}{subject} .= ' '.WebGUI::International::get(233);
|
||||
}
|
||||
$mid = getNextId("messageId");
|
||||
($rid) = WebGUI::SQL->quickArray("select rid from message where messageId=$session{form}{mid}",$session{dbh});
|
||||
|
|
@ -287,14 +295,14 @@ sub www_showMessage {
|
|||
}
|
||||
$html .= '</td><td align="right" valign="bottom" class="boardMenu">';
|
||||
if ((time()-$message{dateOfPost}) < 3600*$board{editTimeout} && $message{'userId'} eq $session{user}{userId}) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=editMessage&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">Edit Message</a> · ';
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=editMessage&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(235).'</a> · ';
|
||||
}
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=postReply&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">Post Reply</a></td></tr></table>';
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=postReply&mid='.$session{form}{mid}.'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(236).'</a></td></tr></table>';
|
||||
$html .= '<table width="100%"><tr><td class="tableHeader">';
|
||||
$html .= "<b>Subject:</b> ".$message{subject}."<br>";
|
||||
$html .= "<b>Author:</b> ".$message{username}."<br>";
|
||||
$html .= "<b>Date:</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>";
|
||||
$html .= "<b>Message ID:</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
|
||||
$html .= "<b>".WebGUI::International::get(237)."</b> ".$message{subject}."<br>";
|
||||
$html .= "<b>".WebGUI::International::get(238)."</b> ".$message{username}."<br>";
|
||||
$html .= "<b>".WebGUI::International::get(239)."</b> ".epochToHuman($message{dateOfPost},"%w, %c %D, %y at %H:%n%p")."<br>";
|
||||
$html .= "<b>".WebGUI::International::get(240)."</b> ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{messageId}."<br>";
|
||||
$html .= '</td>';
|
||||
$html .= '</tr><tr><td colspan=2 class="boardMessage">';
|
||||
$message{message} =~ s/\n/\<br\>/g;
|
||||
|
|
@ -302,19 +310,19 @@ sub www_showMessage {
|
|||
$html .= '</td></tr></table><p><div align="center" class="boardMenu">';
|
||||
@data = WebGUI::SQL->quickArray("select max(messageId) from message where widgetId=$message{widgetId} and pid=0 and messageId<$message{rid}",$session{dbh});
|
||||
if ($data[0] ne "") {
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'">« Previous Thread</a>';
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'">« '.WebGUI::International::get(241).'</a>';
|
||||
} else {
|
||||
$html .= '« Previous Thread</a>';
|
||||
$html .= '« '.WebGUI::International::get(241).'</a>';
|
||||
}
|
||||
$html .= ' · <a href="'.$session{page}{url}.'">Back To Message List</a> · ';
|
||||
$html .= ' · <a href="'.$session{page}{url}.'">'.WebGUI::International::get(242).'</a> · ';
|
||||
@data = WebGUI::SQL->quickArray("select min(messageId) from message where widgetId=$message{widgetId} and pid=0 and messageId>$message{rid}",$session{dbh});
|
||||
if ($data[0] ne "") {
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'">Next Thread »</a>';
|
||||
$html .= '<a href="'.$session{page}{url}.'?func=showMessage&mid='.$data[0].'&wid='.$session{form}{wid}.'">'.WebGUI::International::get(243).' »</a>';
|
||||
} else {
|
||||
$html .= 'Next Thread »';
|
||||
$html .= WebGUI::International::get(243).' »';
|
||||
}
|
||||
$html .= '</div><table border=0 cellpadding=2 cellspacing=1 width="100%">';
|
||||
$html .= '<tr><td class="tableHeader">Subject</td><td class="tableHeader">Author</td><td class="tableHeader">Date</td></tr>';
|
||||
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td><td class="tableHeader">'.WebGUI::International::get(244).'</td><td class="tableHeader">'.WebGUI::International::get(245).'</td></tr>';
|
||||
@data = WebGUI::SQL->quickArray("select messageId,subject,username,dateOfPost from message where messageId=$message{rid}",$session{dbh});
|
||||
$html .= '<tr';
|
||||
if ($session{form}{mid} eq $message{rid}) {
|
||||
|
|
@ -340,13 +348,16 @@ sub www_view {
|
|||
if ($board{description} ne "") {
|
||||
$html = $board{description}.'<p>';
|
||||
}
|
||||
if ($board{processMacros}) {
|
||||
$html = WebGUI::Macro::process($html);
|
||||
}
|
||||
$html .= '<table width="100%"><tr><td class="boardTitle">';
|
||||
if ($board{displayTitle}) {
|
||||
$html .= $board{title};
|
||||
}
|
||||
$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 .= '</td><td align="right" valign="bottom" class="boardMenu"><a href="'.$session{page}{url}.'?func=postNewMessage&wid='.$_[0].'">'.WebGUI::International::get(246).'</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>';
|
||||
$html .= '<tr><td class="tableHeader">'.WebGUI::International::get(229).'</td><td class="tableHeader">'.WebGUI::International::get(244).'</td><td class="tableHeader">'.WebGUI::International::get(247).'</td><td class="tableHeader">'.WebGUI::International::get(248).'</td><td class="tableHeader">'.WebGUI::International::get(249).'</td></tr>';
|
||||
#$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) {
|
||||
|
|
@ -360,15 +371,15 @@ sub www_view {
|
|||
$html .= '</table>';
|
||||
$html .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'">«Previous Page</a>';
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'">«'.WebGUI::International::get(91).'</a>';
|
||||
} else {
|
||||
$html .= '«Previous Page';
|
||||
$html .= '«'.WebGUI::International::get(91);
|
||||
}
|
||||
$html .= ' · ';
|
||||
if (($pn+1) < round(($i/$itemsPerPage))) {
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'">Next Page»</a>';
|
||||
$html .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'">'.WebGUI::International::get(92).'»</a>';
|
||||
} else {
|
||||
$html .= 'Next Page»';
|
||||
$html .= WebGUI::International::get(92).'»';
|
||||
}
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::Poll;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -86,7 +87,7 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Poll";
|
||||
return WebGUI::International::get(250);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -94,20 +95,23 @@ sub www_add {
|
|||
my ($output, %hash);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=28"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Poll</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=28"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(251).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","Poll");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Poll').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Active</td><td>'.WebGUI::Form::checkbox("active",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'Poll').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(252).'</td><td>'.WebGUI::Form::checkbox("active",1,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">Who can vote?</td><td>'.WebGUI::Form::selectList("voteGroup",\%hash,).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Graph Width</td><td>'.WebGUI::Form::text("graphWidth",20,3,150).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Question</td><td>'.WebGUI::Form::text("question",50,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Answers<span><br>(Enter one answer per line. No more than 20.)</span></td><td>'.WebGUI::Form::textArea("answers",'',50,8,0,'on').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(253).'</td><td>'.WebGUI::Form::selectList("voteGroup",\%hash,).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(254).'</td><td>'.WebGUI::Form::text("graphWidth",20,3,150).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(255).'</td><td>'.WebGUI::Form::text("question",50,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(256).'<span><br>'.WebGUI::International::get(257).'</span></td><td>'.WebGUI::Form::textArea("answers",'',50,8,0,'on').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -136,21 +140,24 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=29"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(258).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Active</td><td>'.WebGUI::Form::checkbox("active",1,$data{active}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(252).'</td><td>'.WebGUI::Form::checkbox("active",1,$data{active}).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$array[0] = $data{voteGroup};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Who can vote?</td><td>'.WebGUI::Form::selectList("voteGroup",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Graph Width</td><td>'.WebGUI::Form::text("graphWidth",20,3,$data{graphWidth}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Question</td><td>'.WebGUI::Form::text("question",50,255,$data{question}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Answers<span><br>(Enter one answer per line. No more than 20.)</span></td><td>'.WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(253).'</td><td>'.WebGUI::Form::selectList("voteGroup",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(254).'</td><td>'.WebGUI::Form::text("graphWidth",20,3,$data{graphWidth}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(255).'</td><td>'.WebGUI::Form::text("question",50,255,$data{question}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(256).'<span><br>'.WebGUI::International::get(257).'</span></td><td>'.WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::SQLReport;
|
|||
|
||||
use strict;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -27,7 +28,7 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "SQL Report";
|
||||
return WebGUI::International::get(259);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -35,22 +36,22 @@ sub www_add {
|
|||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=20"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>Add '.widgetName().'</h1>';
|
||||
$output .= '<h1>'.WebGUI::International::get(260).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","SQLReport");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'SQL Report').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Process macros?</td><td>'.WebGUI::Form::checkbox("processMacros",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'','','',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Template</td><td>'.WebGUI::Form::textArea("template",'','','',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Query</td><td>'.WebGUI::Form::textArea("dbQuery",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">DSN</td><td>'.WebGUI::Form::text("DSN",20,255,$session{config}{dsn}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database User</td><td>'.WebGUI::Form::text("username",20,255,$session{config}{dbuser}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database Password</td><td>'.WebGUI::Form::password("identifier",20,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Convert carriage returns?</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'SQL Report').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'','','',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(261).'</td><td>'.WebGUI::Form::textArea("template",'','','',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(262).'</td><td>'.WebGUI::Form::textArea("dbQuery",'').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(263).'</td><td>'.WebGUI::Form::text("DSN",20,255,$session{config}{dsn}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(264).'</td><td>'.WebGUI::Form::text("username",20,255,$session{config}{dbuser}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(265).'</td><td>'.WebGUI::Form::password("identifier",20,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(183).'</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -78,22 +79,22 @@ sub www_edit {
|
|||
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 = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=22"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>Edit '.widgetName().'</h1>';
|
||||
$output .= '<h1>'.WebGUI::International::get(266).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">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},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Template</td><td>'.WebGUI::Form::textArea("template",$data{template},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros","1",$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(261).'</td><td>'.WebGUI::Form::textArea("template",$data{template},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Query</td><td>'.WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">DSN</td><td>'.WebGUI::Form::text("DSN",20,255,$data{DSN}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database User</td><td>'.WebGUI::Form::text("username",20,255,$data{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database Password</td><td>'.WebGUI::Form::password("identifier",20,255,$data{identifier}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Convert carriage returns?</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(262).'</td><td>'.WebGUI::Form::text("DSN",20,255,$data{DSN}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(263).'</td><td>'.WebGUI::Form::text("username",20,255,$data{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(264).'</td><td>'.WebGUI::Form::password("identifier",20,255,$data{identifier}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(183).'</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -131,14 +132,14 @@ sub www_view {
|
|||
if ($data{DSN} =~ /\DBI\:\w+\:\w+/) {
|
||||
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
|
||||
} else {
|
||||
$output .= '<b>Error</b>: The DSN specified is of an improper format.<p>';
|
||||
$output .= WebGUI::International::get(267).'<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] The DSN specified is of an improper format.");
|
||||
}
|
||||
if (defined $dbh) {
|
||||
if ($data{dbQuery} =~ /select/i) {
|
||||
$sth = WebGUI::SQL->read($data{dbQuery},$dbh);
|
||||
} else {
|
||||
$output .= '<b>Error</b>: The SQL query is improperly formatted.<p>';
|
||||
$output .= WebGUI::International::get(268).'<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] The SQL query is improperly formatted.");
|
||||
}
|
||||
if (defined $sth) {
|
||||
|
|
@ -152,12 +153,12 @@ sub www_view {
|
|||
}
|
||||
$sth->finish;
|
||||
} else {
|
||||
$output .= '<b>Error</b>: There was a problem with the query.<p>';
|
||||
$output .= WebGUI::International::get(269).'<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] There was a problem with the query.");
|
||||
}
|
||||
$dbh->disconnect();
|
||||
} else {
|
||||
$output .= '<b>Error</b>: Could not connect to remote database.<p>';
|
||||
$output .= WebGUI::International::get(270).'<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$widgetId] Could not connect to remote database.");
|
||||
}
|
||||
$output .= $template[2];
|
||||
|
|
|
|||
|
|
@ -1,168 +0,0 @@
|
|||
package WebGUI::Widget::SearchMnoGo;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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 DBI;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
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+/) {
|
||||
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
|
||||
} else {
|
||||
$output .= '<b>Error</b>: The DSN specified is of an improper format.<p>';
|
||||
WebGUI::ErrorHandler::warn("Search (MnoGo) The DSN specified is of an improper format.");
|
||||
}
|
||||
if (defined $dbh) {
|
||||
foreach $word (@keyword) {
|
||||
$sth = WebGUI::SQL->read("select url_id from dict where soundex(word)=soundex(lcase('$word'))",$dbh);
|
||||
if (defined $sth) {
|
||||
while (($urlId) = $sth->array) {
|
||||
$result{$urlId}++;
|
||||
}
|
||||
$sth->finish;
|
||||
} else {
|
||||
$output .= '<b>Error</b>: There was a problem with the query.<p>';
|
||||
WebGUI::ErrorHandler::warn("Search (MnoGo) There was a problem with the query.");
|
||||
}
|
||||
}
|
||||
foreach $key (sort {$result{$b} <=> $result{$a}} keys %result) {
|
||||
if ($i < 50) {
|
||||
%match = WebGUI::SQL->quickHash("select url,title,txt from url where rec_id=$key",$dbh);
|
||||
$output .= '<a href="'.$match{url}.'">'.$match{title}.'</a> ('.$result{$key}.')<br>'.$match{txt}.'<br><a href="'.$match{url}.'">'.$match{url}.'</a><p>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$dbh->disconnect();
|
||||
} else {
|
||||
$output .= '<b>Error</b>: Could not connect to remote database.<p>';
|
||||
WebGUI::ErrorHandler::warn("Search (MnoGo) Could not connect to remote database.");
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
WebGUI::SQL->write("delete from SearchMnoGo where widgetId=$_[0]",$_[1]);
|
||||
purgeWidget($_[0],$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Search (MnoGo)";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=42"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Search (MnoGo)</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","SearchMnoGo");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Search (MnoGo)').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'',50,5,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">DSN</td><td>'.WebGUI::Form::text("DSN",20,255,$session{config}{dsn}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database User</td><td>'.WebGUI::Form::text("username",20,255,$session{config}{dbuser}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database Password</td><td>'.WebGUI::Form::password("identifier",20,255).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addSave {
|
||||
my ($widgetId);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create();
|
||||
WebGUI::SQL->write("insert into SearchMnoGo values ($widgetId, ".quote($session{form}{DSN}).", ".quote($session{form}{username}).", ".quote($session{form}{identifier}).")",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">DSN</td><td>'.WebGUI::Form::text("DSN",20,255,$data{DSN}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database Username</td><td>'.WebGUI::Form::text("username",20,255,$data{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Database Password</td><td>'.WebGUI::Form::password("identifier",20,255,$data{identifier}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
update();
|
||||
WebGUI::SQL->write("update SearchMnoGo set DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier})." where widgetId=$session{form}{wid}",$session{dbh});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
}
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::text("query",20,255,$session{form}{query});
|
||||
$output .= WebGUI::Form::submit("search");
|
||||
$output .= '</form>';
|
||||
$output .= _mnogoSearch(%data);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
|
@ -12,6 +12,7 @@ package WebGUI::Widget::SiteMap;
|
|||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Widget::SyndicatedContent;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -28,22 +29,25 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "Syndicated Content";
|
||||
return WebGUI::International::get(271);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=36"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add Syndicated Content</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=36"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(272).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","SyndicatedContent");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'Syndicated Content').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'','','',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">URL to RSS File</td><td>'.WebGUI::Form::text("rssUrl",20,2048).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'Syndicated Content').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'','','',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(273).'</td><td>'.WebGUI::Form::text("rssUrl",20,2048).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -70,18 +74,21 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=37"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(274).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">URL to RSS File</td><td>'.WebGUI::Form::text("rssUrl",20,2048,$data{rssUrl}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros","1",$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description},50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(273).'</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>'.WebGUI::DateTime::epochToHuman($data{lastFetched},"%m/%d/%y %h:%n%p").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Current Content</td><td>'.$data{content}.'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(275).'</td><td>'.WebGUI::DateTime::epochToHuman($data{lastFetched},"%m/%d/%y %h:%n%p").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(276).'</td><td>'.$data{content}.'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -115,6 +122,9 @@ sub www_view {
|
|||
}
|
||||
$output .= $data{content};
|
||||
}
|
||||
if ($data{processMacros}) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ package WebGUI::Widget::UserSubmission;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
|
@ -28,7 +30,7 @@ sub purge {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return "User Submission System";
|
||||
return WebGUI::International::get(277);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -36,19 +38,22 @@ sub www_add {
|
|||
my ($output, %hash);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=44"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Add User Submission System</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=44"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(278).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("widget","UserSubmission");
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,'User Submission System').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",'',50,5,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,'User Submission System').'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle",1,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros",1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'',50,5,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">Who can contribute?</td><td>'.WebGUI::Form::selectList("groupToContribute",\%hash,'',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Submissions Per Page</td><td>'.WebGUI::Form::text("submissionsPerPage",20,2,50).'</td></tr>';
|
||||
%hash = ("Approved"=>"Approved","Denied"=>"Denied","Pending"=>"Pending");
|
||||
$output .= '<tr><td class="formDescription" valign="top">Default Status</td><td>'.WebGUI::Form::selectList("defaultStatus",\%hash,'',1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(279).'</td><td>'.WebGUI::Form::selectList("groupToContribute",\%hash,'',1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(280).'</td><td>'.WebGUI::Form::text("submissionsPerPage",20,2,50).'</td></tr>';
|
||||
%hash = ("Approved"=>WebGUI::International::get(281),"Denied"=>WebGUI::International::get(282),"Pending"=>WebGUI::International::get(283));
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(284).'</td><td>'.WebGUI::Form::selectList("defaultStatus",\%hash,'',1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -74,19 +79,20 @@ sub www_addSubmission {
|
|||
my ($output, $groupToContribute, @submission, $sth);
|
||||
($groupToContribute) = WebGUI::SQL->quickArray("select groupToContribute from UserSubmission where widgetId=$session{form}{wid}",$session{dbh});
|
||||
if (WebGUI::Privilege::isInGroup($groupToContribute,$session{user}{userId})) {
|
||||
$output = '<h1>Add Submission</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(285).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","addSubmissionSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Content</td><td>'.WebGUI::Form::textArea("content",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Image</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,1).' <span style="font-size: 8pt;">(uncheck if you\'re writing an HTML submission)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(178).'</td><td>'.WebGUI::Form::textArea("content",'',50,10,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(179).'</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(182).'</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(183).'</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,1).' <span style="font-size: 8pt;">'.WebGUI::International::get(286).'</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
|
||||
$output .= '<tr><td class="tableHeader">Edit/Delete</td><td class="tableHeader">Title</td><td class="tableHeader">Date Submitted</td><td class="tableHeader">Status</td></tr>';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(289).'</td><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(287).'</td><td class="tableHeader">'.WebGUI::International::get(288).'</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,status from submission where widgetId='$session{form}{wid}' and userId=$session{user}{userId} order by dateSubmitted desc",$session{dbh});
|
||||
while (@submission = $sth->array) {
|
||||
$output .= '<tr><td class="tableData"><a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$submission[1].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?wid='.$session{form}{wid}.'&sid='.$submission[1].'&func=deleteSubmission"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a></td><td class="tableData"><a href="'.$session{page}{url}.'?wid='.$session{form}{wid}.'&func=viewSubmission&sid='.$submission[1].'">'.$submission[0].'</a></td><td class="tableData">'.epochToHuman($submission[2],"%M/%D/%y").'</td><td class="tableData">'.$submission[3].'</td></tr>';
|
||||
|
|
@ -110,7 +116,7 @@ sub www_addSubmissionSave {
|
|||
if ($session{form}{title} ne "") {
|
||||
$title = $session{form}{title};
|
||||
} else {
|
||||
$title = "Untitled";
|
||||
$title = WebGUI::International::get(290);
|
||||
}
|
||||
WebGUI::SQL->write("insert into submission values ($session{form}{wid}, $submissionId, ".quote($title).", ".time().", ".quote($session{user}{username}).", '$session{user}{userId}', ".quote($session{form}{content}).", ".quote($image).", ".quote($attachment).", '$status', '$session{form}{convertCarriageReturns}')",$session{dbh});
|
||||
return "";
|
||||
|
|
@ -148,8 +154,10 @@ sub www_deleteSubmission {
|
|||
my ($output, $owner);
|
||||
($owner) = WebGUI::SQL->quickArray("select userId from submission where submissionId=$session{form}{sid}",$session{dbh});
|
||||
if ($owner == $session{user}{userId}) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you want to delete this submission?<p><div align="center"><a href="'.$session{page}{url}.'?func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">Yes, I\'m sure.</a> <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(291).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -174,21 +182,24 @@ sub www_edit {
|
|||
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}.'">';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=45"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= '<h1>'.WebGUI::International::get(292).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Display the title?</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Description</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$data{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(175).'</td><td>'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(176).'</td><td>'.WebGUI::Form::checkbox("processMacros","1",$data{processMacros}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$data{description}).'</td></tr>';
|
||||
$array[0] = $data{groupToContribute};
|
||||
%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 contribute?</td><td>'.WebGUI::Form::selectList("groupToContribute",\%hash,\@array,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Submissions Per Page</td><td>'.WebGUI::Form::text("submissionsPerPage",20,2,$data{submissionsPerPage}).'</td></tr>';
|
||||
%hash = ("Approved"=>"Approved","Denied"=>"Denied","Pending"=>"Pending");
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(279).'</td><td>'.WebGUI::Form::selectList("groupToContribute",\%hash,\@array,1).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(280).'</td><td>'.WebGUI::Form::text("submissionsPerPage",20,2,$data{submissionsPerPage}).'</td></tr>';
|
||||
%hash = ("Approved"=>WebGUI::International::get(281),"Denied"=>WebGUI::International::get(282),"Pending"=>WebGUI::International::get(283));
|
||||
$array[0] = $data{defaultStatus};
|
||||
$output .= '<tr><td class="formDescription" valign="top">Default Status</td><td>'.WebGUI::Form::selectList("defaultStatus",\%hash,\@array,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(284).'</td><td>'.WebGUI::Form::selectList("defaultStatus",\%hash,\@array,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -214,25 +225,26 @@ sub www_editSubmission {
|
|||
($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});
|
||||
$output = '<h1>Edit Submission</h1><form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output = '<h1>'.WebGUI::International::get(293).'</h1>';
|
||||
$output .= '<form method="post" enctype="multipart/form-data" action="'.$session{page}{url}.'">';
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("sid",$session{form}{sid});
|
||||
$output .= WebGUI::Form::hidden("func","editSubmissionSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">Title</td><td>'.WebGUI::Form::text("title",20,30,$submission{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">Content</td><td>'.WebGUI::Form::textArea("content",$submission{content},50,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,30,$submission{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(178).'</td><td>'.WebGUI::Form::textArea("content",$submission{content},50,10).'</td></tr>';
|
||||
if ($submission{image} ne "") {
|
||||
$output .= '<tr><td class="formDescription">Image</td><td><a href="'.$session{page}{url}.'?func=deleteImage&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">Delete Image</a></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(179).'</td><td><a href="'.$session{page}{url}.'?func=deleteImage&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(186).'</a></td></tr>';
|
||||
} else {
|
||||
$output .= '<tr><td class="formDescription">Image</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(179).'</td><td>'.WebGUI::Form::file("image").'</td></tr>';
|
||||
}
|
||||
if ($submission{attachment} ne "") {
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td><a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">Delete Attachment</a></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(182).'</td><td><a href="'.$session{page}{url}.'?func=deleteAttachment&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(186).'</a></td></tr>';
|
||||
} else {
|
||||
$output .= '<tr><td class="formDescription">Attachment</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(182).'</td><td>'.WebGUI::Form::file("attachment").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription">Convert Carriage Returns</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$submission{convertCarriageReturns}).' <span style="font-size: 8pt;">(uncheck if you\'re writing an HTML submission)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(183).'</td><td>'.WebGUI::Form::checkbox("convertCarriageReturns",1,$submission{convertCarriageReturns}).' <span style="font-size: 8pt;">(uncheck if you\'re writing an HTML submission)</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -258,9 +270,9 @@ sub www_editSubmissionSave {
|
|||
if ($session{form}{title} ne "") {
|
||||
$title = $session{form}{title};
|
||||
} else {
|
||||
$title = "Untitled";
|
||||
$title = WebGUI::International::get(290);
|
||||
}
|
||||
WebGUI::SQL->write("update submission set convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$status' where submissionId=$session{form}{sid}",$session{dbh});
|
||||
WebGUI::SQL->write("update submission set dateSubmitted=".time().", convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$status' where submissionId=$session{form}{sid}",$session{dbh});
|
||||
return www_viewSubmission();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -280,15 +292,18 @@ sub www_view {
|
|||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
}
|
||||
if ($data{processMacros}) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select title,submissionId,dateSubmitted,username,userId from submission where widgetId='$widgetId' and status='Approved' order by dateSubmitted desc",$session{dbh});
|
||||
while (@submission = $sth->array) {
|
||||
$row[$i] = '<tr><td class="tableData"><a href="'.$session{page}{url}.'?wid='.$widgetId.'&func=viewSubmission&sid='.$submission[1].'">'.$submission[0].'</a></td><td class="tableData">'.epochToHuman($submission[2],"%M/%D/%y").'</td><td class="tableData">'.$submission[3].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '<table width="100%"><tr><td align="right"><a href="'.$session{page}{url}.'?func=addSubmission&wid='.$widgetId.'">Post New Submission</a></td></tr></table>';
|
||||
$output .= '<table width="100%"><tr><td align="right"><a href="'.$session{page}{url}.'?func=addSubmission&wid='.$widgetId.'">'.WebGUI::International::get(294).'</a></td></tr></table>';
|
||||
$output .= '<table width="100%" cellspacing=1 cellpadding=2 border=0>';
|
||||
$output .= '<tr><td class="tableHeader">Title</td><td class="tableHeader">Date Submitted</td><td class="tableHeader">Submitted By</td></tr>';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(99).'</td><td class="tableHeader">'.WebGUI::International::get(287).'</td><td class="tableHeader">'.WebGUI::International::get(295).'</td></tr>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
|
|
@ -300,15 +315,15 @@ sub www_view {
|
|||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&wid='.$widgetId.'">«Previous Page</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&wid='.$widgetId.'">«'.WebGUI::International::get(91).'</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
$output .= '«'.WebGUI::International::get(91);
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($pn < round($#row/$data{submissionsPerPage})) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&wid='.$widgetId.'">Next Page»</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&wid='.$widgetId.'">'.WebGUI::International::get(91).'»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
$output .= WebGUI::International::get(92).'»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
|
@ -321,16 +336,16 @@ sub www_viewSubmission {
|
|||
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>';
|
||||
$output .= '<b>Date Submitted:</b> '.$submission{dateSubmitted}.'<p>';
|
||||
$output .= '<b>'.WebGUI::International::get(297).'</b> '.$submission{username}.'<br>';
|
||||
$output .= '<b>'.WebGUI::International::get(298).'</b> '.epochToHuman($submission{dateSubmitted},"%w, %c %D, %y at %H:%n%p").'<p>';
|
||||
if ($submission{image} ne "") {
|
||||
$output .= '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/'.$session{form}{wid}.'/'.$session{form}{sid}.'/'.$submission{image}.'" hspace=3 align="right">';
|
||||
}
|
||||
if ($submission{status} eq "Pending" && (WebGUI::Privilege::isInGroup(3,$session{user}{userId}) || WebGUI::Privilege::isInGroup(4,$session{user}{userId}))) {
|
||||
$output .= '<div align="center">';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=approveSubmission&sid='.$session{form}{sid}.'">Approve</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewPendingSubmissions">Leave Pending</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=denySubmission&sid='.$session{form}{sid}.'">Deny</a> ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=approveSubmission&sid='.$session{form}{sid}.'">'.WebGUI::International::get(299).'</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewPendingSubmissions">'.WebGUI::International::get(300).'</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=denySubmission&sid='.$session{form}{sid}.'">'.WebGUI::International::get(301).'</a> ';
|
||||
$output .= '</div>';
|
||||
}
|
||||
if ($submission{convertCarriageReturns}) {
|
||||
|
|
@ -342,18 +357,15 @@ sub www_viewSubmission {
|
|||
}
|
||||
$output .= '<div align="center">';
|
||||
if ($submission{userId} == $session{user}{userId}) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">Delete</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">Edit</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(186).'</a> · ';
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(302).'</a> · ';
|
||||
}
|
||||
$output .= '<a href="'.$session{page}{url}.'">Return To Submissions List</a>';
|
||||
$output .= '<a href="'.$session{page}{url}.'">'.WebGUI::International::get(303).'</a>';
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue