Massive code cleanup.

This commit is contained in:
JT Smith 2002-05-29 20:23:56 +00:00
parent 5ce80419a7
commit 0cf392469c
13 changed files with 147 additions and 202 deletions

View file

@ -835,7 +835,6 @@ sub readOnly {
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
# eg: select(name, valueListHashref, selectedArrayref, size, multipleSelection, onChange)
=head2 select ( name, options [ label, value, size, multiple, extras, subtext ] ) =head2 select ( name, options [ label, value, size, multiple, extras, subtext ] )

View file

@ -12,6 +12,7 @@ package WebGUI::Macro::AdminBar;
use strict; use strict;
use Tie::IxHash; use Tie::IxHash;
use WebGUI::HTMLForm;
use WebGUI::International; use WebGUI::International;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
@ -21,7 +22,7 @@ use WebGUI::Utility;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my (%hash2, $miscSelect, $adminSelect, $clipboardSelect, %hash, $output, $contentSelect, $key); my (%hash2, $f, $miscSelect, $adminSelect, $clipboardSelect, %hash, $output, $contentSelect, $key);
tie %hash, "Tie::IxHash"; tie %hash, "Tie::IxHash";
tie %hash2, "Tie::IxHash"; tie %hash2, "Tie::IxHash";
#--content adder #--content adder
@ -33,7 +34,9 @@ sub _replacement {
} }
%hash2 = sortHash(%hash2); %hash2 = sortHash(%hash2);
%hash = (%hash, %hash2); %hash = (%hash, %hash2);
$contentSelect = WebGUI::Form::selectList("contentSelect",\%hash,"","","","goContent()"); $f = WebGUI::HTMLForm->new(1);
$f->select("contentSelect",\%hash,'',[],'','','onChange="goContent()"');
$contentSelect = $f->printRowsOnly;
#--clipboard paster #--clipboard paster
%hash2 = (); %hash2 = ();
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3); $hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
@ -45,7 +48,9 @@ sub _replacement {
foreach $key (keys %hash) { foreach $key (keys %hash) {
$hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key}; $hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key};
} }
$clipboardSelect = WebGUI::Form::selectList("clipboardSelect",\%hash2,"","","","goClipboard()"); $f = WebGUI::HTMLForm->new(1);
$f->select("clipboardSelect",\%hash2,'',[],'','','onChange="goClipboard()"');
$clipboardSelect = $f->printRowsOnly;
#--admin functions #--admin functions
%hash = (); %hash = ();
if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) { if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) {
@ -95,7 +100,9 @@ sub _replacement {
WebGUI::URL::page('op=switchOffAdmin')=>WebGUI::International::get(12), WebGUI::URL::page('op=switchOffAdmin')=>WebGUI::International::get(12),
%hash %hash
); );
$adminSelect = WebGUI::Form::selectList("adminSelect",\%hash,"","","","goAdmin()"); $f = WebGUI::HTMLForm->new(1);
$f->select("adminSelect",\%hash,'',[],'','','onChange="goAdmin()"');
$adminSelect = $f->printRowsOnly;
#--output admin bar #--output admin bar
$output = ' $output = '
<div class="adminBar"><table class="adminBar" width="100%" cellpadding="3" cellspacing="0" border="0"><tr> <div class="adminBar"><table class="adminBar" width="100%" cellpadding="3" cellspacing="0" border="0"><tr>

View file

@ -11,7 +11,7 @@ package WebGUI::Macro::L_loginBox;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use WebGUI::Form; use WebGUI::HTMLForm;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro::Backslash_pageUrl; use WebGUI::Macro::Backslash_pageUrl;
use WebGUI::Session; use WebGUI::Session;
@ -24,7 +24,7 @@ sub _createURL {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _replacement { sub _replacement {
my ($temp,$boxSize,@param,$text); my ($temp,$boxSize,@param,$text,$f);
@param = WebGUI::Macro::getParams($_[0]); @param = WebGUI::Macro::getParams($_[0]);
$temp = '<div class="loginBox">'; $temp = '<div class="loginBox">';
if ($session{var}{sessionId}) { if ($session{var}{sessionId}) {
@ -46,17 +46,16 @@ sub _replacement {
} }
if (index(lc($ENV{HTTP_USER_AGENT}),"msie") < 0) { if (index(lc($ENV{HTTP_USER_AGENT}),"msie") < 0) {
$boxSize = int($boxSize=$boxSize*2/3); $boxSize = int($boxSize=$boxSize*2/3);
} }
$temp .= '<form method="post" action="'.WebGUI::URL::page().'"> '; $f = WebGUI::HTMLForm->new(1);
$temp .= WebGUI::Form::hidden("op","login").'<span class="formSubtext">'; $f->hidden("op","login");
$temp .= WebGUI::International::get(50); $f->raw('<span class="formSubtext">'.WebGUI::International::get(50).'<br></span>');
$temp .= '<br></span>'; $f->text("username",'','','','','',$boxSize);
$temp .= WebGUI::Form::text("username",$boxSize,30).'<span class="formSubtext"><br>'; $f->raw('<span class="formSubtext"><br>'.WebGUI::International::get(51).'<br></span>');
$temp .= WebGUI::International::get(51); $f->password("identifier",'','','','','',$boxSize);
$temp .= '<br></span>'; $f->raw('<span class="formSubtext"><br></span>');
$temp .= WebGUI::Form::password("identifier",$boxSize,30).'<span class="formSubtext"><br></span>'; $f->submit(WebGUI::International::get(52));
$temp .= WebGUI::Form::submit(WebGUI::International::get(52)); $temp .= $f->print;
$temp .= '</form>';
$temp .= '<a href="'.WebGUI::URL::page('op=createAccount').'">'.WebGUI::International::get(407).'</a>'; $temp .= '<a href="'.WebGUI::URL::page('op=createAccount').'">'.WebGUI::International::get(407).'</a>';
} }
$temp .= '</div>'; $temp .= '</div>';

View file

@ -11,20 +11,20 @@ package WebGUI::Macro::Question_search;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use WebGUI::Form; use WebGUI::HTMLForm;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL; use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
my ($output, $temp); my ($output, $temp, $f);
$output = $_[0]; $output = $_[0];
$temp = '<form class="searchBox" method="post" action="'.WebGUI::URL::page().'">'; $f = WebGUI::HTMLForm->new(1);
$temp .= WebGUI::Form::hidden("op","search"); $f->hidden("op","search");
$temp .= WebGUI::Form::text("keywords",10,100,$session{form}{keywords}); $f->text("keywords",'',$session{form}{keywords});
$temp .= WebGUI::Form::submit(WebGUI::International::get(364)); $f->submit(WebGUI::International::get(364));
$temp .= '</form>'; $temp = $f->print;
$output =~ s/\^\?\;/$temp/g; $output =~ s/\^\?\;/$temp/g;
return $output; return $output;
} }

View file

@ -17,12 +17,12 @@ use strict;
use URI; use URI;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::ErrorHandler; use WebGUI::ErrorHandler;
use WebGUI::HTMLForm;
use WebGUI::International; use WebGUI::International;
use WebGUI::Mail; use WebGUI::Mail;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
use WebGUI::User; use WebGUI::User;

View file

@ -14,51 +14,18 @@ use Exporter;
use strict; use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::Form; use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_addGroup &www_addGroupSave &www_deleteGroup &www_deleteGroupConfirm &www_editGroup &www_editGroupSave &www_listGroups); our @EXPORT = qw(&www_deleteGroup &www_deleteGroupConfirm &www_editGroup &www_editGroupSave &www_listGroups);
#-------------------------------------------------------------------
sub www_addGroup {
my ($output);
if (WebGUI::Privilege::isInGroup(3)) {
$output .= helpLink(17);
$output .= '<h1>'.WebGUI::International::get(83).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","addGroupSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(84),WebGUI::Form::text("groupName",20,30));
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",''));
$output .= tableFormRow(WebGUI::International::get(367),WebGUI::Form::text("expireAfter",20,30,314496000));
$output .= formSave();
$output .= '</table>';
$output .= '</form> ';
} else {
$output = WebGUI::Privilege::adminOnly();
}
return $output;
}
#-------------------------------------------------------------------
sub www_addGroupSave {
my ($output);
if ($session{var}{sessionId}) {
WebGUI::SQL->write("insert into groups values (".getNextId("groupId").", ".quote($session{form}{groupName}).", ".quote($session{form}{description}).", '$session{form}{expireAfter}')");
$output = www_listGroups();
} else {
$output = WebGUI::Privilege::adminOnly();
}
return $output;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_deleteGroup { sub www_deleteGroup {
@ -66,7 +33,7 @@ sub www_deleteGroup {
if ($session{form}{gid} < 26) { if ($session{form}{gid} < 26) {
return WebGUI::Privilege::vitalComponent(); return WebGUI::Privilege::vitalComponent();
} elsif (WebGUI::Privilege::isInGroup(3)) { } elsif (WebGUI::Privilege::isInGroup(3)) {
$output .= helpLink(15); $output .= helpIcon(15);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(86).'<p>'; $output .= WebGUI::International::get(86).'<p>';
$output .= '<div align="center"><a href="'. $output .= '<div align="center"><a href="'.
@ -95,40 +62,46 @@ sub www_deleteGroupConfirm {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editGroup { sub www_editGroup {
my ($output, $sth, %group, %hash); my ($output, $sth, %group, %hash, $f);
tie %group, 'Tie::CPHash'; tie %group, 'Tie::CPHash';
tie %hash, 'Tie::CPHash'; tie %hash, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}"); if ($session{form}{gid} eq "new") {
$output .= helpLink(17); $group{expireAfter} = 314496000;
} else {
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}");
}
$output .= helpIcon(17);
$output .= '<h1>'.WebGUI::International::get(87).'</h1>'; $output .= '<h1>'.WebGUI::International::get(87).'</h1>';
$output .= formHeader(); $f = WebGUI::HTMLForm->new;
$output .= WebGUI::Form::hidden("op","editGroupSave"); $f->hidden("op","editGroupSave");
$output .= WebGUI::Form::hidden("gid",$session{form}{gid}); $f->hidden("gid",$session{form}{gid});
$output .= '<table>'; $f->readOnly($session{form}{gid},WebGUI::International::get(379));
$output .= tableFormRow(WebGUI::International::get(379),$session{form}{gid}); $f->text("groupName",WebGUI::International::get(84),$group{groupName});
$output .= tableFormRow(WebGUI::International::get(84),WebGUI::Form::text("groupName",20,30,$group{groupName})); $f->textarea("description",WebGUI::International::get(85),$group{description});
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$group{description})); $f->integer("expireAfter",WebGUI::International::get(367),$group{expireAfter});
$output .= tableFormRow(WebGUI::International::get(367),WebGUI::Form::text("expireAfter",20,30,$group{expireAfter})); $f->submit;
$output .= formSave(); $output .= $f->print;
$output .= '</table>'; unless ($session{form}{gid} eq "new") {
$output .= '</form> '; $output .= '<h1>'.WebGUI::International::get(88).'</h1>';
$output .= '<h1>'.WebGUI::International::get(88).'</h1>'; $output .= '<table><tr><td class="tableHeader">&nbsp;</td>
$output .= '<table><tr><td class="tableHeader">&nbsp;</td><td class="tableHeader">'.WebGUI::International::get(50).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>'; <td class="tableHeader">'.WebGUI::International::get(50).'</td>
$sth = WebGUI::SQL->read("select users.username,users.userId,groupings.expireDate from groupings,users where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId order by users.username"); <td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
while (%hash = $sth->hash) { $sth = WebGUI::SQL->read("select users.username,users.userId,groupings.expireDate
$output .= '<tr><td><a href="'. from groupings,users where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId
WebGUI::URL::page('op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}) order by users.username");
.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'. while (%hash = $sth->hash) {
WebGUI::URL::page('op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}) $output .= '<tr><td>'
.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>'; .deleteIcon('op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
$output .= '<td class="tableData"><a href="'. .editIcon('op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
WebGUI::URL::page('op=editUser&uid='.$hash{userId}) .'</td>';
.'">'.$hash{username}.'</a></td>'; $output .= '<td class="tableData"><a href="'.WebGUI::URL::page('op=editUser&uid='.$hash{userId}).'">'
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>'; .$hash{username}.'</a></td>';
} $output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%z").'</td></tr>';
$sth->finish; }
$output .= '</table>'; $sth->finish;
$output .= '</table>';
}
} else { } else {
$output = WebGUI::Privilege::adminOnly(); $output = WebGUI::Privilege::adminOnly();
} }
@ -138,7 +111,13 @@ sub www_editGroup {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editGroupSave { sub www_editGroupSave {
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).", description=".quote($session{form}{description}).", expireAfter='$session{form}{expireAfter}' where groupId=".$session{form}{gid}); if ($session{form}{gid} eq "new") {
$session{form}{gid} = getNextId("groupId");
WebGUI::SQL->write("insert into groups (groupId) values ($session{form}{gid})");
}
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).",
description=".quote($session{form}{description}).", expireAfter='$session{form}{expireAfter}'
where groupId=".$session{form}{gid});
return www_listGroups(); return www_listGroups();
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();
@ -149,10 +128,9 @@ sub www_editGroupSave {
sub www_listGroups { sub www_listGroups {
my ($output, $p, $sth, @data, @row, $i); my ($output, $p, $sth, @data, @row, $i);
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(10); $output = helpIcon(10);
$output .= '<h1>'.WebGUI::International::get(89).'</h1>'; $output .= '<h1>'.WebGUI::International::get(89).'</h1>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=addGroup'). $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=editGroup&gid=new').'">'.WebGUI::International::get(90).'</a></div>';
'">'.WebGUI::International::get(90).'</a></div>';
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">'; $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"); $sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName");
while (@data = $sth->array) { while (@data = $sth->array) {

View file

@ -14,66 +14,25 @@ use Exporter;
use strict; use strict;
use WebGUI::Attachment; use WebGUI::Attachment;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::Form; use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::Template; use WebGUI::Template;
use WebGUI::URL; use WebGUI::URL;
use WebGUI::Utility; use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_addImage &www_addImageSave &www_editImage &www_editImageSave &www_viewImage our @EXPORT = qw(&www_editImage &www_editImageSave &www_viewImage &www_deleteImage &www_deleteImageConfirm &www_listImages &www_deleteImageFile);
&www_deleteImage &www_deleteImageConfirm &www_listImages &www_deleteImageFile);
#-------------------------------------------------------------------
sub www_addImage {
my ($output);
if (WebGUI::Privilege::isInGroup(4)) {
$output = helpLink(20);
$output .= '<h1>'.WebGUI::International::get(382).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","addImageSave");
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(383),
WebGUI::Form::text("name",20,128,"Name"));
$output .= tableFormRow(WebGUI::International::get(384),
WebGUI::Form::file("filename"));
$output .= tableFormRow(WebGUI::International::get(385),
WebGUI::Form::textArea("parameters",'',50,5));
$output .= formSave();
$output .= '</table></form>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_addImageSave {
my ($imageId, $file);
if (WebGUI::Privilege::isInGroup(4)) {
$imageId = getNextId("imageId");
$file = WebGUI::Attachment->new("newFile","images",$imageId);
$file->save("filename");
WebGUI::SQL->write("insert into images values ($imageId, ".quote($session{form}{name}).
", ".quote($file->getFilename).", ".quote($session{form}{parameters}).
", $session{user}{userId}, ".
quote($session{user}{username}).", ".time().")");
return www_listImages();
} else {
return WebGUI::Privilege::insufficient();
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_deleteImage { sub www_deleteImage {
my ($output); my ($output);
if (WebGUI::Privilege::isInGroup(4)) { if (WebGUI::Privilege::isInGroup(4)) {
$output .= helpLink(23); $output .= helpIcon(23);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(392).'<p>'; $output .= WebGUI::International::get(392).'<p>';
$output .= '<div align="center"><a href="'. $output .= '<div align="center"><a href="'.
@ -112,34 +71,32 @@ sub www_deleteImageFile {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editImage { sub www_editImage {
my ($output, %data, $image); my ($output, %data, $image, $f);
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(4)) { if (WebGUI::Privilege::isInGroup(4)) {
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}"); if ($session{form}{iid} eq "new") {
$image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$output = helpLink(20);
$output .= '<h1>'.WebGUI::International::get(382).'</h1>';
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","editImageSave");
$output .= WebGUI::Form::hidden("iid",$session{form}{iid});
$output .= '<table>';
$output .= tableFormRow(WebGUI::International::get(389),
$data{imageId});
$output .= tableFormRow(WebGUI::International::get(383),
WebGUI::Form::text("name",20,128,$data{name}));
if ($data{filename} ne "") {
$output .= tableFormRow(WebGUI::International::get(384),
'<a href="'.WebGUI::URL::page('op=deleteImageFile&iid='.$data{imageId}).'">'.
WebGUI::International::get(391).'</a>');
} else { } else {
$output .= tableFormRow(WebGUI::International::get(384), %data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
WebGUI::Form::file("filename"));
} }
$output .= tableFormRow(WebGUI::International::get(385), $output = helpIcon(20);
WebGUI::Form::textArea("parameters",$data{parameters},50,5)); $output .= '<h1>'.WebGUI::International::get(382).'</h1>';
$output .= formSave(); $f = WebGUI::HTMLForm->new;
$output .= '</table></form>'; $f->hidden("op","editImageSave");
$f->hidden("iid",$session{form}{iid});
$f->readOnly($session{form}{iid},WebGUI::International::get(389));
$f->text("name",WebGUI::International::get(383),$data{name});
if ($data{filename} ne "") { if ($data{filename} ne "") {
$f->readOnly('<a href="'.WebGUI::URL::page('op=deleteImageFile&iid='.$data{imageId}).'">'.WebGUI::International::get(391).'</a>',
WebGUI::International::get(384));
} else {
$f->file("filename",WebGUI::International::get(384));
}
$f->textarea("parameters",WebGUI::International::get(385),$data{parameters});
$f->submit;
$output .= $f->print;
if ($data{filename} ne "") {
$image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$output .= '<p>'.WebGUI::International::get(390).'<p><img src="'.$image->getURL.'">'; $output .= '<p>'.WebGUI::International::get(390).'<p><img src="'.$image->getURL.'">';
} }
return $output; return $output;
@ -152,6 +109,10 @@ sub www_editImage {
sub www_editImageSave { sub www_editImageSave {
my ($file, $sqlAdd); my ($file, $sqlAdd);
if (WebGUI::Privilege::isInGroup(4)) { if (WebGUI::Privilege::isInGroup(4)) {
if ($session{form}{iid} eq "new") {
$session{form}{iid} = getNextId("imageId");
WebGUI::SQL->write("insert into images (imageId) values ($session{form}{iid})");
}
$file = WebGUI::Attachment->new("","images",$session{form}{iid}); $file = WebGUI::Attachment->new("","images",$session{form}{iid});
$file->save("filename"); $file->save("filename");
if ($file->getFilename) { if ($file->getFilename) {
@ -169,18 +130,22 @@ sub www_editImageSave {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_listImages { sub www_listImages {
my ($output, $sth, %data, @row, $image, $p, $i, $search, $isAdmin); my ($f, $output, $sth, %data, @row, $image, $p, $i, $search, $isAdmin);
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(4)) { if (WebGUI::Privilege::isInGroup(4)) {
$output = helpLink(26); $output = helpIcon(26);
$output .= '<h1>'.WebGUI::International::get(393).'</h1>'; $output .= '<h1>'.WebGUI::International::get(393).'</h1>';
$output .= '<table class="tableData" align="center" width="75%"><tr><td>'; $output .= '<table class="tableData" align="center" width="75%"><tr><td>';
$output .= '<a href="'.WebGUI::URL::page('op=addImage').'">'.WebGUI::International::get(395).'</a>'; $output .= '<a href="'.WebGUI::URL::page('op=editImage&iid=new').'">'.WebGUI::International::get(395).'</a>';
$output .= '</td>'.formHeader().'<td align="right">'; $output .= '</td>';
$output .= WebGUI::Form::hidden("op","listImages"); $f = WebGUI::HTMLForm->new(1);
$output .= WebGUI::Form::text("keyword",20,50,$session{form}{keyword}); $f->raw('<td align="right">');
$output .= WebGUI::Form::submit(WebGUI::International::get(170)); $f->hidden("op","listImages");
$output .= '</td></form></tr></table><p>'; $f->text("keyword",'',$session{form}{keyword});
$f->submit(WebGUI::International::get(170));
$f->raw('</td>');
$output .= $f->print;
$output .= '</tr></table><p>';
if ($session{form}{keyword} ne "") { if ($session{form}{keyword} ne "") {
$search = " where (name like '%".$session{form}{keyword}. $search = " where (name like '%".$session{form}{keyword}.
"%' or username like '%".$session{form}{keyword}. "%' or username like '%".$session{form}{keyword}.
@ -192,16 +157,13 @@ sub www_listImages {
$image = WebGUI::Attachment->new($data{filename},"images",$data{imageId}); $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$row[$i] = '<tr class="tableData"><td>'; $row[$i] = '<tr class="tableData"><td>';
if ($session{user}{userId} == $data{userId} || $isAdmin) { if ($session{user}{userId} == $data{userId} || $isAdmin) {
$row[$i] .= '<a href="'.WebGUI::URL::page('op=deleteImage&iid='.$data{imageId}). $row[$i] .= deleteIcon('op=deleteImage&iid='.$data{imageId});
'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>'; $row[$i] .= editIcon('op=editImage&iid='.$data{imageId});
$row[$i] .= '<a href="'.WebGUI::URL::page('op=editImage&iid='.$data{imageId}).
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>';
} }
$row[$i] .= '<a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId}). $row[$i] .= viewIcon('op=viewImage&iid='.$data{imageId});
'"><img src="'.$session{setting}{lib}.'/view.gif" border=0></a>';
$row[$i] .= '</td>'; $row[$i] .= '</td>';
$row[$i] .= '<td><a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId}). $row[$i] .= '<td><a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId})
'"><img src="'.$image->getThumbnail.'" border="0"></a>'; .'"><img src="'.$image->getThumbnail.'" border="0"></a>';
$row[$i] .= '<td>'.$data{name}.'</td>'; $row[$i] .= '<td>'.$data{name}.'</td>';
$row[$i] .= '<td>'.$data{username}.'</td>'; $row[$i] .= '<td>'.$data{username}.'</td>';
$row[$i] .= '<td>'.WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y").'</td>'; $row[$i] .= '<td>'.WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y").'</td>';

View file

@ -12,9 +12,9 @@ package WebGUI::Operation::Package;
use Exporter; use Exporter;
use strict qw(vars subs); use strict qw(vars subs);
use WebGUI::Icon;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
@ -59,7 +59,7 @@ sub www_selectPackageToDeploy {
my ($output, %data, $sth, $flag); my ($output, %data, $sth, $flag);
if (WebGUI::Privilege::canEditPage()) { if (WebGUI::Privilege::canEditPage()) {
tie %data,'Tie::CPHash'; tie %data,'Tie::CPHash';
$output = helpLink(30); $output = helpIcon(30);
$output .= '<h1>'.WebGUI::International::get(375).'</h1>'; $output .= '<h1>'.WebGUI::International::get(375).'</h1>';
$output .= '<ul>'; $output .= '<ul>';
$sth = WebGUI::SQL->read("select * from page where parentId=5"); $sth = WebGUI::SQL->read("select * from page where parentId=5");

View file

@ -13,15 +13,13 @@ package WebGUI::Operation::Root;
use Exporter; use Exporter;
use strict; use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::Form; use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
use WebGUI::Utility;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_listRoots); our @EXPORT = qw(&www_listRoots);
@ -30,7 +28,7 @@ our @EXPORT = qw(&www_listRoots);
sub www_listRoots { sub www_listRoots {
my ($output, $p, $sth, %data, @row, $i); my ($output, $p, $sth, %data, @row, $i);
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(28); $output = helpIcon(28);
$output .= '<h1>'.WebGUI::International::get(408).'</h1>'; $output .= '<h1>'.WebGUI::International::get(408).'</h1>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=editPage&npp=0'). $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=editPage&npp=0').
'">'.WebGUI::International::get(409).'</a></div>'; '">'.WebGUI::International::get(409).'</a></div>';

View file

@ -12,6 +12,7 @@ package WebGUI::Operation::Search;
use Exporter; use Exporter;
use strict; use strict;
use WebGUI::HTMLForm;
use WebGUI::International; use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Session; use WebGUI::Session;
@ -23,12 +24,12 @@ our @EXPORT = qw(&www_search);
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_search { sub www_search {
my ($p, $output, %page, @keyword, $pageId, $term, %result, $sth, @row, $i); my ($f, $p, $output, %page, @keyword, $pageId, $term, %result, $sth, @row, $i);
$output = '<form method="post" enctype="multipart/form-data" action="'.WebGUI::URL::page().'">'; $f = WebGUI::HTMLForm->new(1);
$output .= WebGUI::Form::hidden("op","search"); $f->hidden("op","search");
$output .= WebGUI::Form::text("keywords",40,100,$session{form}{keywords}); $f->text("keywords",'',$session{form}{keywords});
$output .= WebGUI::Form::submit(WebGUI::International::get(364)); $f->submit(WebGUI::International::get(364));
$output .= '</form>'; $output = $f->print;
if ($session{form}{keywords} ne "") { if ($session{form}{keywords} ne "") {
@keyword = split(" ",$session{form}{keywords}); @keyword = split(" ",$session{form}{keywords});
foreach $term (@keyword) { foreach $term (@keyword) {
@ -68,6 +69,7 @@ sub www_search {
$output .= WebGUI::International::get(365).'<p><ol>'; $output .= WebGUI::International::get(365).'<p><ol>';
$output .= $p->getPage($session{form}{pn}); $output .= $p->getPage($session{form}{pn});
$output .= '</ol>'.$p->getBarTraditional($session{form}{pn}); $output .= '</ol>'.$p->getBarTraditional($session{form}{pn});
$output .= $f->print;
} else { } else {
$output .= WebGUI::International::get(366); $output .= WebGUI::International::get(366);
} }

View file

@ -16,11 +16,11 @@ use HTTP::Headers;
use LWP::UserAgent; use LWP::UserAgent;
use strict; use strict;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
@ -118,7 +118,7 @@ sub www_viewStatistics {
$response = $userAgent->request($request); $response = $userAgent->request($request);
$version = $response->content; $version = $response->content;
chomp $version; chomp $version;
$output .= helpLink(12); $output .= helpIcon(12);
$output .= '<h1>'.WebGUI::International::get(437).'</h1>'; $output .= '<h1>'.WebGUI::International::get(437).'</h1>';
$output .= '<table>'; $output .= '<table>';
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(145).'</td><td class="tableData">'.$WebGUI::VERSION.' ('.WebGUI::International::get(349).': '.$version.')</td></tr>'; $output .= '<tr><td class="tableHeader">'.WebGUI::International::get(145).'</td><td class="tableData">'.$WebGUI::VERSION.' ('.WebGUI::International::get(349).': '.$version.')</td></tr>';

View file

@ -12,9 +12,9 @@ package WebGUI::Operation::Trash;
use Exporter; use Exporter;
use strict qw(vars subs); use strict qw(vars subs);
use WebGUI::Icon;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
@ -49,7 +49,7 @@ sub _recursePageTree {
sub www_purgeTrash { sub www_purgeTrash {
my ($output); my ($output);
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(46); $output = helpIcon(46);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(162).'<p>'; $output .= WebGUI::International::get(162).'<p>';
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=purgeTrashConfirm'). $output .= '<div align="center"><a href="'.WebGUI::URL::page('op=purgeTrashConfirm').

View file

@ -16,11 +16,11 @@ use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::HTMLForm; use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Shortcut;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
use WebGUI::User; use WebGUI::User;
@ -49,7 +49,7 @@ sub www_addUser {
my ($output, %hash, $f); my ($output, %hash, $f);
tie %hash, 'Tie::IxHash'; tie %hash, 'Tie::IxHash';
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output .= helpLink(5); $output .= helpIcon(5);
$output .= '<h1>'.WebGUI::International::get(163).'</h1>'; $output .= '<h1>'.WebGUI::International::get(163).'</h1>';
$f = WebGUI::HTMLForm->new; $f = WebGUI::HTMLForm->new;
if ($session{form}{op} eq "addUserSave") { if ($session{form}{op} eq "addUserSave") {
@ -129,7 +129,7 @@ sub www_deleteUser {
if ($session{form}{uid} < 26) { if ($session{form}{uid} < 26) {
return WebGUI::Privilege::vitalComponent(); return WebGUI::Privilege::vitalComponent();
} elsif (WebGUI::Privilege::isInGroup(3)) { } elsif (WebGUI::Privilege::isInGroup(3)) {
$output .= helpLink(7); $output .= helpIcon(7);
$output .= '<h1>'.WebGUI::International::get(42).'</h1>'; $output .= '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= WebGUI::International::get(167).'<p>'; $output .= WebGUI::International::get(167).'<p>';
$output .= '<div align="center"><a href="'. $output .= '<div align="center"><a href="'.
@ -196,7 +196,7 @@ sub www_editUser {
tie %data, 'Tie::IxHash'; tie %data, 'Tie::IxHash';
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$u = WebGUI::User->new($session{form}{uid}); $u = WebGUI::User->new($session{form}{uid});
$output .= helpLink(5); $output .= helpIcon(5);
$output .= '<h1>'.WebGUI::International::get(168).'</h1>'; $output .= '<h1>'.WebGUI::International::get(168).'</h1>';
$f = WebGUI::HTMLForm->new; $f = WebGUI::HTMLForm->new;
$f->hidden("op","editUserSave"); $f->hidden("op","editUserSave");
@ -373,7 +373,7 @@ sub www_listUsers {
my ($output, $sth, %data, @row, $p, $i, $search); my ($output, $sth, %data, @row, $p, $i, $search);
tie %data, 'Tie::CPHash'; tie %data, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(8); $output = helpIcon(8);
$output .= '<h1>'.WebGUI::International::get(149).'</h1>'; $output .= '<h1>'.WebGUI::International::get(149).'</h1>';
$output .= '<table class="tableData" align="center" width="75%"><tr><td>'; $output .= '<table class="tableData" align="center" width="75%"><tr><td>';
$output .= '<a href="'.WebGUI::URL::page('op=addUser').'">'.WebGUI::International::get(169).'</a>'; $output .= '<a href="'.WebGUI::URL::page('op=addUser').'">'.WebGUI::International::get(169).'</a>';