WebGUI 3.4.0 release

This commit is contained in:
JT Smith 2002-03-07 01:40:00 +00:00
parent 80f7752f32
commit a93b42789a
23 changed files with 3262 additions and 568 deletions

View file

@ -14,7 +14,7 @@ package WebGUI::Attachment;
=cut
use File::Copy cp;
use File::Copy qw(cp);
use File::Path;
use FileHandle;
use Image::Magick;
@ -284,7 +284,7 @@ sub getURL {
sub new {
my ($class, $filename, $node, $nodeSub) = @_;
my $node = WebGUI::Node->new($node, $nodeSub);
$node = WebGUI::Node->new($node, $nodeSub);
bless {_node => $node, _filename => $filename}, $class;
}

View file

@ -0,0 +1,33 @@
package WebGUI::Macro::FormParam;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black Software.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::Macro;
use WebGUI::Session;
#-------------------------------------------------------------------
sub _replacement {
my (@param);
@param = WebGUI::Macro::getParams($1);
return $session{form}{$param[0]};
}
#-------------------------------------------------------------------
sub process {
my ($output, $temp, @param);
$output = $_[0];
$output =~ s/\^FormParam\((.*?)\)\;/_replacement($1)/ge;
return $output;
}
1;

View file

@ -18,6 +18,7 @@ use WebGUI::Operation::Help;
use WebGUI::Operation::Image;
use WebGUI::Operation::Package;
use WebGUI::Operation::Page;
use WebGUI::Operation::Root;
use WebGUI::Operation::Search;
use WebGUI::Operation::Settings;
use WebGUI::Operation::Statistics;

View file

@ -103,22 +103,28 @@ sub www_createAccount {
$output .= WebGUI::Form::hidden("op","createAccountSave");
$output .= '<table>';
unless ($session{setting}{authMethod} eq "LDAP" && $session{setting}{usernameBinding} eq "yes") {
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,35));
}
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>';
$output .= tableFormRow($session{setting}{ldapIdName},WebGUI::Form::text("ldapId",20,100));
$output .= tableFormRow($session{setting}{ldapPasswordName},
WebGUI::Form::password("ldapPassword",20,100));
} else {
$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 .= tableFormRow(WebGUI::International::get(51),
WebGUI::Form::password("identifier1",20,35));
$output .= tableFormRow(WebGUI::International::get(55),
WebGUI::Form::password("identifier2",20,35));
}
$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>';
$output .= tableFormRow(WebGUI::International::get(56),
WebGUI::Form::text("email",20,255).'<span class="formSubtext"><br>'.
WebGUI::International::get(57).'</span>');
%language = WebGUI::SQL->buildHash("select distinct(language) from international");
$array[0] = "English";
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%language,\@array).'</td></tr>';
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(304),
WebGUI::Form::selectList("language",\%language,\@array));
$output .= formSave();
$output .= '</table>';
$output .= '</form> ';
$output .= '<div class="accountOptions"><ul>';
@ -231,22 +237,28 @@ sub www_displayAccount {
$output .= '<table>';
if ($session{user}{authMethod} eq "LDAP" && $session{setting}{usernameBinding} eq "yes") {
$output .= WebGUI::Form::hidden("username",$session{user}{username});
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.$session{user}{username}.'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(50),$session{user}{username});
} else {
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30,$session{user}{username}).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(50),
WebGUI::Form::text("username",20,35,$session{user}{username}));
}
if ($session{user}{authMethod} eq "LDAP") {
$output .= WebGUI::Form::hidden("identifier1","password");
$output .= WebGUI::Form::hidden("identifier2","password");
} else {
$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 .= tableFormRow(WebGUI::International::get(51),
WebGUI::Form::password("identifier1",20,35,"password"));
$output .= tableFormRow(WebGUI::International::get(55),
WebGUI::Form::password("identifier2",20,35,"password"));
}
$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>';
$output .= tableFormRow(WebGUI::International::get(56),
WebGUI::Form::text("email",20,255,$session{user}{email}).
'<span class="formSubtext"><br>'.WebGUI::International::get(57).'</span>');
%hash = WebGUI::SQL->buildHash("select distinct(language) from international");
$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 .= tableFormRow(WebGUI::International::get(304),
WebGUI::Form::selectList("language",\%hash,\@array));
$output .= formSave();
$output .= '</table>';
$output .= '</form> ';
$output .= _accountOptions();
@ -266,8 +278,10 @@ sub www_displayLogin {
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","login");
$output .= '<table>';
$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 .= tableFormRow(WebGUI::International::get(50),
WebGUI::Form::text("username",20,35));
$output .= tableFormRow(WebGUI::International::get(51),
WebGUI::Form::password("identifier",20,35));
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(52)).'</td></tr>';
$output .= '</table>';
$output .= '</form>';
@ -296,41 +310,65 @@ sub www_editProfile {
$output .= WebGUI::Form::hidden("uid",$session{user}{userId});
$output .= '<table>';
if ($session{setting}{profileName}) {
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(314).'</td><td>'.WebGUI::Form::text("firstName",20,50,$session{user}{firstName}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(315).'</td><td>'.WebGUI::Form::text("middleName",20,50,$session{user}{middleName}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(316).'</td><td>'.WebGUI::Form::text("lastName",20,50,$session{user}{lastName}).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(314),
WebGUI::Form::text("firstName",20,50,$session{user}{firstName}));
$output .= tableFormRow(WebGUI::International::get(315),
WebGUI::Form::text("middleName",20,50,$session{user}{middleName}));
$output .= tableFormRow(WebGUI::International::get(316),
WebGUI::Form::text("lastName",20,50,$session{user}{lastName}));
}
if ($session{setting}{profileExtraContact}) {
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(317).'</td><td>'.WebGUI::Form::text("icq",20,30,$session{user}{icq}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(318).'</td><td>'.WebGUI::Form::text("aim",20,30,$session{user}{aim}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(319).'</td><td>'.WebGUI::Form::text("msnIM",20,30,$session{user}{msnIM}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(320).'</td><td>'.WebGUI::Form::text("yahooIM",20,30,$session{user}{yahooIM}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(321).'</td><td>'.WebGUI::Form::text("cellPhone",20,30,$session{user}{cellPhone}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(322).'</td><td>'.WebGUI::Form::text("pager",20,30,$session{user}{pager}).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(317),
WebGUI::Form::text("icq",20,30,$session{user}{icq}));
$output .= tableFormRow(WebGUI::International::get(318),
WebGUI::Form::text("aim",20,30,$session{user}{aim}));
$output .= tableFormRow(WebGUI::International::get(319),
WebGUI::Form::text("msnIM",20,30,$session{user}{msnIM}));
$output .= tableFormRow(WebGUI::International::get(320),
WebGUI::Form::text("yahooIM",20,30,$session{user}{yahooIM}));
$output .= tableFormRow(WebGUI::International::get(321),
WebGUI::Form::text("cellPhone",20,30,$session{user}{cellPhone}));
$output .= tableFormRow(WebGUI::International::get(322),
WebGUI::Form::text("pager",20,30,$session{user}{pager}));
}
if ($session{setting}{profileHome}) {
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(323).'</td><td>'.WebGUI::Form::text("homeAddress",20,128,$session{user}{homeAddress}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(324).'</td><td>'.WebGUI::Form::text("homeCity",20,30,$session{user}{homeCity}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(325).'</td><td>'.WebGUI::Form::text("homeState",20,30,$session{user}{homeState}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(326).'</td><td>'.WebGUI::Form::text("homeZip",20,15,$session{user}{homeZip}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(327).'</td><td>'.WebGUI::Form::text("homeCountry",20,30,$session{user}{homeCountry}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(328).'</td><td>'.WebGUI::Form::text("homePhone",20,30,$session{user}{homePhone}).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(323),
WebGUI::Form::text("homeAddress",20,128,$session{user}{homeAddress}));
$output .= tableFormRow(WebGUI::International::get(324),
WebGUI::Form::text("homeCity",20,30,$session{user}{homeCity}));
$output .= tableFormRow(WebGUI::International::get(325),
WebGUI::Form::text("homeState",20,30,$session{user}{homeState}));
$output .= tableFormRow(WebGUI::International::get(326),
WebGUI::Form::text("homeZip",20,15,$session{user}{homeZip}));
$output .= tableFormRow(WebGUI::International::get(327),
WebGUI::Form::text("homeCountry",20,30,$session{user}{homeCountry}));
$output .= tableFormRow(WebGUI::International::get(328),
WebGUI::Form::text("homePhone",20,30,$session{user}{homePhone}));
}
if ($session{setting}{profileWork}) {
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(329).'</td><td>'.WebGUI::Form::text("workAddress",20,128,$session{user}{workAddress}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(330).'</td><td>'.WebGUI::Form::text("workCity",20,30,$session{user}{workCity}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(331).'</td><td>'.WebGUI::Form::text("workState",20,30,$session{user}{workState}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(332).'</td><td>'.WebGUI::Form::text("workZip",20,15,$session{user}{workZip}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(333).'</td><td>'.WebGUI::Form::text("workCountry",20,30,$session{user}{workCountry}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(334).'</td><td>'.WebGUI::Form::text("workPhone",20,30,$session{user}{workPhone}).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(329),
WebGUI::Form::text("workAddress",20,128,$session{user}{workAddress}));
$output .= tableFormRow(WebGUI::International::get(330),
WebGUI::Form::text("workCity",20,30,$session{user}{workCity}));
$output .= tableFormRow(WebGUI::International::get(331),
WebGUI::Form::text("workState",20,30,$session{user}{workState}));
$output .= tableFormRow(WebGUI::International::get(332),
WebGUI::Form::text("workZip",20,15,$session{user}{workZip}));
$output .= tableFormRow(WebGUI::International::get(333),
WebGUI::Form::text("workCountry",20,30,$session{user}{workCountry}));
$output .= tableFormRow(WebGUI::International::get(334),
WebGUI::Form::text("workPhone",20,30,$session{user}{workPhone}));
}
if ($session{setting}{profileMisc}) {
$array[0] = $session{user}{gender};
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(335).'</td><td>'.WebGUI::Form::selectList("gender",\%gender,\@array).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(336).'</td><td>'.WebGUI::Form::text("birthdate",20,30,$session{user}{birthdate}).'</td></tr>';
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(337).'</td><td>'.WebGUI::Form::text("homepage",20,2048,$session{user}{homepage}).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(335),
WebGUI::Form::selectList("gender",\%gender,\@array));
$output .= tableFormRow(WebGUI::International::get(336),
WebGUI::Form::text("birthdate",20,30,$session{user}{birthdate}));
$output .= tableFormRow(WebGUI::International::get(337),
WebGUI::Form::text("homepage",20,2048,$session{user}{homepage}));
}
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
$output .= formSave();
$output .= '</table>';
$output .= '</form>';
$output .= _accountOptions();
@ -407,8 +445,7 @@ sub www_recoverPassword {
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","recoverPasswordFinish");
$output .= '<table>';
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(56).
'</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
$output .= tableFormRow(WebGUI::International::get(56),WebGUI::Form::text("email",20,255));
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(72)).'</td></tr>';
$output .= '</table>';
$output .= '</form>';

View file

@ -67,6 +67,7 @@ sub www_addPage {
$output .= '<h1>'.WebGUI::International::get(98).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","addPageSave");
$output .= WebGUI::Form::hidden("root","1");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$session{form}{title}));
%hash = sortHash(WebGUI::Template::getList());
@ -85,17 +86,22 @@ sub www_addPage {
#-------------------------------------------------------------------
sub www_addPageSave {
my ($urlizedTitle, $test, $nextSeq);
my ($urlizedTitle, $test, $nextSeq, $parentId);
if (WebGUI::Privilege::canEditPage()) {
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from page where parentId=$session{page}{pageId}");
if ($session{form}{title} eq "") {
$session{form}{title} = "no title";
}
if ($session{form}{root}) {
$parentId = 0;
} else {
$parentId = $session{page}{pageId};
}
$urlizedTitle = WebGUI::URL::urlize($session{form}{title});
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle'")) {
$urlizedTitle .= 2;
}
WebGUI::SQL->write("insert into page values (".getNextId("pageId").", $session{page}{pageId}, ".quote($session{form}{title}).", $session{page}{styleId}, $session{user}{userId}, $session{page}{ownerView}, $session{page}{ownerEdit}, $session{page}{groupId}, $session{page}{groupView}, $session{page}{groupEdit}, $session{page}{worldView}, $session{page}{worldEdit}, '$nextSeq', ".quote($session{form}{metaTags}).", '$urlizedTitle', '$session{form}{defaultMetaTags}', '$session{form}{template}')");
WebGUI::SQL->write("insert into page values (".getNextId("pageId").", $parentId, ".quote($session{form}{title}).", $session{page}{styleId}, $session{user}{userId}, $session{page}{ownerView}, $session{page}{ownerEdit}, $session{page}{groupId}, $session{page}{groupView}, $session{page}{groupEdit}, $session{page}{worldView}, $session{page}{worldEdit}, '$nextSeq', ".quote($session{form}{metaTags}).", '$urlizedTitle', '$session{form}{defaultMetaTags}', '$session{form}{template}')");
return "";
} else {
return WebGUI::Privilege::insufficient();

View file

@ -0,0 +1,67 @@
package WebGUI::Operation::Root;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black Software.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use Exporter;
use strict;
use Tie::CPHash;
use WebGUI::Form;
use WebGUI::International;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter);
our @EXPORT = qw(&www_listRoots);
#-------------------------------------------------------------------
sub www_listRoots {
my ($output, $p, $sth, %data, @row, $i);
if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(28);
$output .= '<h1>'.WebGUI::International::get(408).'</h1>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=addPage&root=1').
'">'.WebGUI::International::get(409).'</a></div>';
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$sth = WebGUI::SQL->read("select * from page where title<>'Reserved' and parentId=0 order by title");
while (%data = $sth->hash) {
$row[$i] = '<tr><td valign="top" class="tableData">'.
'<a href="'.WebGUI::URL::gateway($data{urlizedTitle}.'?op=deletePage').'">'.
'<img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>'.
'<a href="'.WebGUI::URL::gateway($data{urlizedTitle}.'?op=cutPage').'">'.
'<img src="'.$session{setting}{lib}.'/cut.gif" border=0></a>'.
'<a href="'.WebGUI::URL::gateway($data{urlizedTitle}.'?op=editPage').'">'.
'<img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>'.
'<a href="'.WebGUI::URL::gateway($data{urlizedTitle}).'">'.
'<img src="'.$session{setting}{lib}.'/view.gif" border=0></a>'.
'</td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data{title}.'</td>';
$row[$i] .= '<td valign="top" class="tableData">'.$data{urlizedTitle}.'</td></tr>';
$i++;
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listRoots'),\@row);
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
$output .= $p->getPage($session{form}{pn});
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
return $output;
} else {
return WebGUI::Privilege::adminOnly();
}
}
1;

View file

@ -43,7 +43,7 @@ sub www_viewStatistics {
$output .= '<h1>'.WebGUI::International::get(144).'</h1>';
$output .= '<table>';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(145).'</td><td class="tableData">'.$WebGUI::VERSION.' ('.WebGUI::International::get(349).': '.$version.')</td></tr>';
($data) = WebGUI::SQL->quickArray("select count(*) from session");
($data) = WebGUI::SQL->quickArray("select count(*) from userSession");
$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");
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(147).'</td><td class="tableData">'.$data.'</td></tr>';

View file

@ -41,8 +41,8 @@ sub www_addUser {
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","addUserSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,30,$session{form}{username}));
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,30,$session{form}{username}));
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,35,$session{form}{username}));
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,35,$session{form}{username}));
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
$array[0] = $session{setting}{authMethod};
$output .= tableFormRow(WebGUI::International::get(164),WebGUI::Form::selectList("authMethod",\%hash, \@array));
@ -203,8 +203,8 @@ sub www_editUser {
$output .= WebGUI::Form::hidden("uid",$session{form}{uid});
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(378),$session{form}{uid});
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,30,$user{username}));
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,30,"password"));
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,35,$user{username}));
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,35,"password"));
%data = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
$array[0] = $user{authMethod};
$output .= tableFormRow(WebGUI::International::get(164),WebGUI::Form::selectList("authMethod",\%data,\@array));

View file

@ -384,9 +384,10 @@ sub rows {
=cut
sub unconditionalRead {
my ($sth);
$sth = $_[2]->prepare($_[1]);
$sth->execute;
my ($sth,$dbh);
$dbh = $_[2] || $WebGUI::Session::session{dbh};
$sth = $dbh->prepare($_[1]) or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr);
$sth->execute or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr);
bless ({_sth => $sth}, $_[0]);
}

View file

@ -34,7 +34,7 @@ sub isIn {
}
foreach $e (@a, @b) { $union{$e}++ && $isect{$e}++ }
@isect = keys %isect;
if (defined @isect) {
if (@isect) {
undef @isect;
return 1;
} else {

View file

@ -398,7 +398,7 @@ sub www_view {
$row[$i] = _calendarLayout($_[0],$nextDate);
($first,$last) = WebGUI::DateTime::monthStartEnd($nextDate);
if ($session{form}{pn} eq "" && $first <= time() && $last >= time()) {
$session{form}{pn} = $i;
$session{form}{pn} = $i+1;
}
$i++;
$nextDate = addToDate($nextDate,0,1,0);

View file

@ -82,7 +82,7 @@ sub www_addSave {
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
$attachment = WebGUI::Attachment->new("",$widgetId);
$attachment->save("attachment");
WebGUI::SQL->write("insert into Item values ($widgetId, ".quote($session{form}{description}).", ".quote($session{form}{linkURL}).", ".quote($attachment).")");
WebGUI::SQL->write("insert into Item values ($widgetId, ".quote($session{form}{description}).", ".quote($session{form}{linkURL}).", ".quote($attachment->getFilename).")");
return "";
} else {
return WebGUI::Privilege::insufficient();

View file

@ -35,7 +35,9 @@ sub duplicate {
$data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into SQLReport values($newWidgetId, ".quote($data{template}).", ".
quote($data{dbQuery}).", ".quote($data{DSN}).", ".quote($data{username}).", ".
quote($data{identifier}).", '$data{convertCarriageReturns}', '$data{paginateAfter}')");
quote($data{identifier}).", ".quote($data{convertCarriageReturns}).", ".
quote($data{paginateAfter}).", ".quote($data{preprocessMacros}).", ".
quote($data{debugMode}).")");
}
#-------------------------------------------------------------------
@ -70,10 +72,14 @@ sub www_add {
WebGUI::Form::selectList("templatePosition",\%hash));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",'','','',1));
$output .= tableFormRow(WebGUI::International::get(15,$namespace),
WebGUI::Form::checkbox("preprocessMacros",1));
$output .= tableFormRow(WebGUI::International::get(16,$namespace),
WebGUI::Form::checkbox("debugMode",1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::textArea("dbQuery",''));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::textArea("template",'','','',1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::textArea("dbQuery",''));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("DSN",20,255,$session{config}{dsn}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
@ -102,10 +108,16 @@ sub www_addSave {
$session{form}{description},$session{form}{processMacros},
$session{form}{templatePosition});
WebGUI::SQL->write("insert into SQLReport values($widgetId, ".
quote($session{form}{template}).", ".quote($session{form}{dbQuery}).", ".
quote($session{form}{DSN}).", ".quote($session{form}{username}).", ".
quote($session{form}{identifier}).
", '$session{form}{convertCarriageReturns}', '$session{form}{paginateAfter}')");
quote($session{form}{template}).", ".
quote($session{form}{dbQuery}).", ".
quote($session{form}{DSN}).", ".
quote($session{form}{username}).", ".
quote($session{form}{identifier}).", ".
quote($session{form}{convertCarriageReturns}).", ".
quote($session{form}{paginateAfter}).", ".
quote($session{form}{preprocessMacros}).", ".
quote($session{form}{debugMode}).
")");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -147,10 +159,14 @@ sub www_edit {
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
$output .= tableFormRow(WebGUI::International::get(85),
WebGUI::Form::textArea("description",$data{description},50,10,1));
$output .= tableFormRow(WebGUI::International::get(15,$namespace),
WebGUI::Form::checkbox("preprocessMacros",1,$data{preprocessMacros}));
$output .= tableFormRow(WebGUI::International::get(16,$namespace),
WebGUI::Form::checkbox("debugMode",1,$data{debugMode}));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10));
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
WebGUI::Form::textArea("template",$data{template},50,10,1));
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10));
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
WebGUI::Form::text("DSN",20,255,$data{DSN}));
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
@ -176,10 +192,14 @@ sub www_editSave {
update();
WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).
", dbQuery=".quote($session{form}{dbQuery}).
", convertCarriageReturns='$session{form}{convertCarriageReturns}', DSN=".
quote($session{form}{DSN}).", username=".quote($session{form}{username}).
", convertCarriageReturns=".quote($session{form}{convertCarriageReturns}).
", DSN=".quote($session{form}{DSN}).
", username=".quote($session{form}{username}).
", identifier=".quote($session{form}{identifier}).
", paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
", paginateAfter=".quote($session{form}{paginateAfter}).
", preprocessMacros=".quote($session{form}{preprocessMacros}).
", debugMode=".quote($session{form}{debugMode}).
" where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -192,27 +212,34 @@ sub www_view {
@template, $temp, $col);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
if (%data) {
if ($data{preprocessMacros}) {
$data{dbQuery} = WebGUI::Macro::process($data{dbQuery});
}
if ($data{displayTitle} == 1) {
$output = "<h1>".$data{title}."</h1>";
}
$output .= WebGUI::International::get(17,$namespace)." ".$data{dbQuery}."<p>" if ($data{debugMode});
if ($data{description} ne "") {
$output .= $data{description}.'<p>';
}
if ($data{DSN} =~ /\DBI\:\w+\:\w+/) {
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
} else {
$output .= WebGUI::International::get(9,$namespace).'<p>';
$output .= WebGUI::International::get(9,$namespace).'<p>' if ($data{debugMode});
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The DSN specified is of an improper format.");
}
if (defined $dbh) {
if ($data{dbQuery} =~ /select/i) {
$sth = WebGUI::SQL->unconditionalRead($data{dbQuery},$dbh);
} else {
$output .= WebGUI::International::get(10,$namespace).'<p>';
$output .= WebGUI::International::get(10,$namespace).'<p>' if ($data{debugMode});
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The SQL query is improperly formatted.");
}
if ($sth->rows > 0) {
unless ($sth->array) {
$output .= WebGUI::International::get(11,$namespace).'<p>' if ($data{debugMode});
WebGUI::ErrorHandler::warn("There was a problem with the query.");
} else {
if ($data{template} ne "") {
@template = split(/\^\-\;/,$data{template});
} else {
@ -239,18 +266,20 @@ sub www_view {
$row[$i] = $temp;
$i++;
}
if ($sth->rows < 1) {
$output .= $template[2];
$output .= WebGUI::International::get(18,$namespace).'<p>';
} else {
$p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$data{paginateAfter});
$output .= $p->getPage($session{form}{pn});
$output .= $template[2];
$output .= $p->getBar($session{form}{pn});
}
$sth->finish;
$p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$data{paginateAfter});
$output .= $p->getPage($session{form}{pn});
$output .= $template[2];
$output .= $p->getBar($session{form}{pn});
} else {
$output .= WebGUI::International::get(11,$namespace).'<p>';
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] There was a problem with the query.");
}
$dbh->disconnect();
} else {
$output .= WebGUI::International::get(12,$namespace).'<p>';
$output .= WebGUI::International::get(12,$namespace).'<p>' if ($data{debugMode});
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] Could not connect to remote database.");
}
}