Massive code cleanup.
This commit is contained in:
parent
5ce80419a7
commit
0cf392469c
13 changed files with 147 additions and 202 deletions
|
|
@ -835,7 +835,6 @@ sub readOnly {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# eg: select(name, valueListHashref, selectedArrayref, size, multipleSelection, onChange)
|
||||
|
||||
=head2 select ( name, options [ label, value, size, multiple, extras, subtext ] )
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Macro::AdminBar;
|
|||
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -21,7 +22,7 @@ use WebGUI::Utility;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
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 %hash2, "Tie::IxHash";
|
||||
#--content adder
|
||||
|
|
@ -33,7 +34,9 @@ sub _replacement {
|
|||
}
|
||||
%hash2 = sortHash(%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
|
||||
%hash2 = ();
|
||||
$hash2{WebGUI::URL::page()} = WebGUI::International::get(3);
|
||||
|
|
@ -45,7 +48,9 @@ sub _replacement {
|
|||
foreach $key (keys %hash) {
|
||||
$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
|
||||
%hash = ();
|
||||
if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) {
|
||||
|
|
@ -95,7 +100,9 @@ sub _replacement {
|
|||
WebGUI::URL::page('op=switchOffAdmin')=>WebGUI::International::get(12),
|
||||
%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 = '
|
||||
<div class="adminBar"><table class="adminBar" width="100%" cellpadding="3" cellspacing="0" border="0"><tr>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ package WebGUI::Macro::L_loginBox;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro::Backslash_pageUrl;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -24,7 +24,7 @@ sub _createURL {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp,$boxSize,@param,$text);
|
||||
my ($temp,$boxSize,@param,$text,$f);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<div class="loginBox">';
|
||||
if ($session{var}{sessionId}) {
|
||||
|
|
@ -46,17 +46,16 @@ sub _replacement {
|
|||
}
|
||||
if (index(lc($ENV{HTTP_USER_AGENT}),"msie") < 0) {
|
||||
$boxSize = int($boxSize=$boxSize*2/3);
|
||||
}
|
||||
$temp .= '<form method="post" action="'.WebGUI::URL::page().'"> ';
|
||||
$temp .= WebGUI::Form::hidden("op","login").'<span class="formSubtext">';
|
||||
$temp .= WebGUI::International::get(50);
|
||||
$temp .= '<br></span>';
|
||||
$temp .= WebGUI::Form::text("username",$boxSize,30).'<span class="formSubtext"><br>';
|
||||
$temp .= WebGUI::International::get(51);
|
||||
$temp .= '<br></span>';
|
||||
$temp .= WebGUI::Form::password("identifier",$boxSize,30).'<span class="formSubtext"><br></span>';
|
||||
$temp .= WebGUI::Form::submit(WebGUI::International::get(52));
|
||||
$temp .= '</form>';
|
||||
}
|
||||
$f = WebGUI::HTMLForm->new(1);
|
||||
$f->hidden("op","login");
|
||||
$f->raw('<span class="formSubtext">'.WebGUI::International::get(50).'<br></span>');
|
||||
$f->text("username",'','','','','',$boxSize);
|
||||
$f->raw('<span class="formSubtext"><br>'.WebGUI::International::get(51).'<br></span>');
|
||||
$f->password("identifier",'','','','','',$boxSize);
|
||||
$f->raw('<span class="formSubtext"><br></span>');
|
||||
$f->submit(WebGUI::International::get(52));
|
||||
$temp .= $f->print;
|
||||
$temp .= '<a href="'.WebGUI::URL::page('op=createAccount').'">'.WebGUI::International::get(407).'</a>';
|
||||
}
|
||||
$temp .= '</div>';
|
||||
|
|
|
|||
|
|
@ -11,20 +11,20 @@ package WebGUI::Macro::Question_search;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
my ($output, $temp, $f);
|
||||
$output = $_[0];
|
||||
$temp = '<form class="searchBox" method="post" action="'.WebGUI::URL::page().'">';
|
||||
$temp .= WebGUI::Form::hidden("op","search");
|
||||
$temp .= WebGUI::Form::text("keywords",10,100,$session{form}{keywords});
|
||||
$temp .= WebGUI::Form::submit(WebGUI::International::get(364));
|
||||
$temp .= '</form>';
|
||||
$f = WebGUI::HTMLForm->new(1);
|
||||
$f->hidden("op","search");
|
||||
$f->text("keywords",'',$session{form}{keywords});
|
||||
$f->submit(WebGUI::International::get(364));
|
||||
$temp = $f->print;
|
||||
$output =~ s/\^\?\;/$temp/g;
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ use strict;
|
|||
use URI;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Mail;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::User;
|
||||
|
|
|
|||
|
|
@ -14,51 +14,18 @@ use Exporter;
|
|||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
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_addGroup &www_addGroupSave &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;
|
||||
}
|
||||
our @EXPORT = qw(&www_deleteGroup &www_deleteGroupConfirm &www_editGroup &www_editGroupSave &www_listGroups);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteGroup {
|
||||
|
|
@ -66,7 +33,7 @@ sub www_deleteGroup {
|
|||
if ($session{form}{gid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpLink(15);
|
||||
$output .= helpIcon(15);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(86).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
|
|
@ -95,40 +62,46 @@ sub www_deleteGroupConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroup {
|
||||
my ($output, $sth, %group, %hash);
|
||||
my ($output, $sth, %group, %hash, $f);
|
||||
tie %group, 'Tie::CPHash';
|
||||
tie %hash, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}");
|
||||
$output .= helpLink(17);
|
||||
if ($session{form}{gid} eq "new") {
|
||||
$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 .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editGroupSave");
|
||||
$output .= WebGUI::Form::hidden("gid",$session{form}{gid});
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(379),$session{form}{gid});
|
||||
$output .= tableFormRow(WebGUI::International::get(84),WebGUI::Form::text("groupName",20,30,$group{groupName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$group{description}));
|
||||
$output .= tableFormRow(WebGUI::International::get(367),WebGUI::Form::text("expireAfter",20,30,$group{expireAfter}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<h1>'.WebGUI::International::get(88).'</h1>';
|
||||
$output .= '<table><tr><td class="tableHeader"> </td><td class="tableHeader">'.WebGUI::International::get(50).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||
$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");
|
||||
while (%hash = $sth->hash) {
|
||||
$output .= '<tr><td><a href="'.
|
||||
WebGUI::URL::page('op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
|
||||
.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
|
||||
WebGUI::URL::page('op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
|
||||
.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td class="tableData"><a href="'.
|
||||
WebGUI::URL::page('op=editUser&uid='.$hash{userId})
|
||||
.'">'.$hash{username}.'</a></td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</table>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editGroupSave");
|
||||
$f->hidden("gid",$session{form}{gid});
|
||||
$f->readOnly($session{form}{gid},WebGUI::International::get(379));
|
||||
$f->text("groupName",WebGUI::International::get(84),$group{groupName});
|
||||
$f->textarea("description",WebGUI::International::get(85),$group{description});
|
||||
$f->integer("expireAfter",WebGUI::International::get(367),$group{expireAfter});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
unless ($session{form}{gid} eq "new") {
|
||||
$output .= '<h1>'.WebGUI::International::get(88).'</h1>';
|
||||
$output .= '<table><tr><td class="tableHeader"> </td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(50).'</td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||
$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");
|
||||
while (%hash = $sth->hash) {
|
||||
$output .= '<tr><td>'
|
||||
.deleteIcon('op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
|
||||
.editIcon('op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid})
|
||||
.'</td>';
|
||||
$output .= '<td class="tableData"><a href="'.WebGUI::URL::page('op=editUser&uid='.$hash{userId}).'">'
|
||||
.$hash{username}.'</a></td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%z").'</td></tr>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</table>';
|
||||
}
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
|
|
@ -138,7 +111,13 @@ sub www_editGroup {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editGroupSave {
|
||||
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();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -149,10 +128,9 @@ sub www_editGroupSave {
|
|||
sub www_listGroups {
|
||||
my ($output, $p, $sth, @data, @row, $i);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = helpLink(10);
|
||||
$output = helpIcon(10);
|
||||
$output .= '<h1>'.WebGUI::International::get(89).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=addGroup').
|
||||
'">'.WebGUI::International::get(90).'</a></div>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=editGroup&gid=new').'">'.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");
|
||||
while (@data = $sth->array) {
|
||||
|
|
|
|||
|
|
@ -14,66 +14,25 @@ use Exporter;
|
|||
use strict;
|
||||
use WebGUI::Attachment;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_addImage &www_addImageSave &www_editImage &www_editImageSave &www_viewImage
|
||||
&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();
|
||||
}
|
||||
}
|
||||
our @EXPORT = qw(&www_editImage &www_editImageSave &www_viewImage &www_deleteImage &www_deleteImageConfirm &www_listImages &www_deleteImageFile);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteImage {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$output .= helpLink(23);
|
||||
$output .= helpIcon(23);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(392).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
|
|
@ -112,34 +71,32 @@ sub www_deleteImageFile {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editImage {
|
||||
my ($output, %data, $image);
|
||||
my ($output, %data, $image, $f);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
|
||||
$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>');
|
||||
if ($session{form}{iid} eq "new") {
|
||||
|
||||
} else {
|
||||
$output .= tableFormRow(WebGUI::International::get(384),
|
||||
WebGUI::Form::file("filename"));
|
||||
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
|
||||
}
|
||||
$output .= tableFormRow(WebGUI::International::get(385),
|
||||
WebGUI::Form::textArea("parameters",$data{parameters},50,5));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
$output = helpIcon(20);
|
||||
$output .= '<h1>'.WebGUI::International::get(382).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$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 "") {
|
||||
$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.'">';
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -152,6 +109,10 @@ sub www_editImage {
|
|||
sub www_editImageSave {
|
||||
my ($file, $sqlAdd);
|
||||
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->save("filename");
|
||||
if ($file->getFilename) {
|
||||
|
|
@ -169,18 +130,22 @@ sub www_editImageSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
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';
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$output = helpLink(26);
|
||||
$output = helpIcon(26);
|
||||
$output .= '<h1>'.WebGUI::International::get(393).'</h1>';
|
||||
$output .= '<table class="tableData" align="center" width="75%"><tr><td>';
|
||||
$output .= '<a href="'.WebGUI::URL::page('op=addImage').'">'.WebGUI::International::get(395).'</a>';
|
||||
$output .= '</td>'.formHeader().'<td align="right">';
|
||||
$output .= WebGUI::Form::hidden("op","listImages");
|
||||
$output .= WebGUI::Form::text("keyword",20,50,$session{form}{keyword});
|
||||
$output .= WebGUI::Form::submit(WebGUI::International::get(170));
|
||||
$output .= '</td></form></tr></table><p>';
|
||||
$output .= '<a href="'.WebGUI::URL::page('op=editImage&iid=new').'">'.WebGUI::International::get(395).'</a>';
|
||||
$output .= '</td>';
|
||||
$f = WebGUI::HTMLForm->new(1);
|
||||
$f->raw('<td align="right">');
|
||||
$f->hidden("op","listImages");
|
||||
$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 "") {
|
||||
$search = " where (name 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});
|
||||
$row[$i] = '<tr class="tableData"><td>';
|
||||
if ($session{user}{userId} == $data{userId} || $isAdmin) {
|
||||
$row[$i] .= '<a href="'.WebGUI::URL::page('op=deleteImage&iid='.$data{imageId}).
|
||||
'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>';
|
||||
$row[$i] .= '<a href="'.WebGUI::URL::page('op=editImage&iid='.$data{imageId}).
|
||||
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>';
|
||||
$row[$i] .= deleteIcon('op=deleteImage&iid='.$data{imageId});
|
||||
$row[$i] .= editIcon('op=editImage&iid='.$data{imageId});
|
||||
}
|
||||
$row[$i] .= '<a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId}).
|
||||
'"><img src="'.$session{setting}{lib}.'/view.gif" border=0></a>';
|
||||
$row[$i] .= viewIcon('op=viewImage&iid='.$data{imageId});
|
||||
$row[$i] .= '</td>';
|
||||
$row[$i] .= '<td><a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId}).
|
||||
'"><img src="'.$image->getThumbnail.'" border="0"></a>';
|
||||
$row[$i] .= '<td><a href="'.WebGUI::URL::page('op=viewImage&iid='.$data{imageId})
|
||||
.'"><img src="'.$image->getThumbnail.'" border="0"></a>';
|
||||
$row[$i] .= '<td>'.$data{name}.'</td>';
|
||||
$row[$i] .= '<td>'.$data{username}.'</td>';
|
||||
$row[$i] .= '<td>'.WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y").'</td>';
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ package WebGUI::Operation::Package;
|
|||
|
||||
use Exporter;
|
||||
use strict qw(vars subs);
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ sub www_selectPackageToDeploy {
|
|||
my ($output, %data, $sth, $flag);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
tie %data,'Tie::CPHash';
|
||||
$output = helpLink(30);
|
||||
$output = helpIcon(30);
|
||||
$output .= '<h1>'.WebGUI::International::get(375).'</h1>';
|
||||
$output .= '<ul>';
|
||||
$sth = WebGUI::SQL->read("select * from page where parentId=5");
|
||||
|
|
|
|||
|
|
@ -13,15 +13,13 @@ package WebGUI::Operation::Root;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Icon;
|
||||
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);
|
||||
|
|
@ -30,7 +28,7 @@ our @EXPORT = qw(&www_listRoots);
|
|||
sub www_listRoots {
|
||||
my ($output, $p, $sth, %data, @row, $i);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = helpLink(28);
|
||||
$output = helpIcon(28);
|
||||
$output .= '<h1>'.WebGUI::International::get(408).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=editPage&npp=0').
|
||||
'">'.WebGUI::International::get(409).'</a></div>';
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package WebGUI::Operation::Search;
|
|||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Session;
|
||||
|
|
@ -23,12 +24,12 @@ our @EXPORT = qw(&www_search);
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_search {
|
||||
my ($p, $output, %page, @keyword, $pageId, $term, %result, $sth, @row, $i);
|
||||
$output = '<form method="post" enctype="multipart/form-data" action="'.WebGUI::URL::page().'">';
|
||||
$output .= WebGUI::Form::hidden("op","search");
|
||||
$output .= WebGUI::Form::text("keywords",40,100,$session{form}{keywords});
|
||||
$output .= WebGUI::Form::submit(WebGUI::International::get(364));
|
||||
$output .= '</form>';
|
||||
my ($f, $p, $output, %page, @keyword, $pageId, $term, %result, $sth, @row, $i);
|
||||
$f = WebGUI::HTMLForm->new(1);
|
||||
$f->hidden("op","search");
|
||||
$f->text("keywords",'',$session{form}{keywords});
|
||||
$f->submit(WebGUI::International::get(364));
|
||||
$output = $f->print;
|
||||
if ($session{form}{keywords} ne "") {
|
||||
@keyword = split(" ",$session{form}{keywords});
|
||||
foreach $term (@keyword) {
|
||||
|
|
@ -68,6 +69,7 @@ sub www_search {
|
|||
$output .= WebGUI::International::get(365).'<p><ol>';
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= '</ol>'.$p->getBarTraditional($session{form}{pn});
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output .= WebGUI::International::get(366);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ use HTTP::Headers;
|
|||
use LWP::UserAgent;
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
|
|
@ -118,7 +118,7 @@ sub www_viewStatistics {
|
|||
$response = $userAgent->request($request);
|
||||
$version = $response->content;
|
||||
chomp $version;
|
||||
$output .= helpLink(12);
|
||||
$output .= helpIcon(12);
|
||||
$output .= '<h1>'.WebGUI::International::get(437).'</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>';
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ package WebGUI::Operation::Trash;
|
|||
|
||||
use Exporter;
|
||||
use strict qw(vars subs);
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ sub _recursePageTree {
|
|||
sub www_purgeTrash {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = helpLink(46);
|
||||
$output = helpIcon(46);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(162).'<p>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=purgeTrashConfirm').
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ use strict;
|
|||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::User;
|
||||
|
|
@ -49,7 +49,7 @@ sub www_addUser {
|
|||
my ($output, %hash, $f);
|
||||
tie %hash, 'Tie::IxHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpLink(5);
|
||||
$output .= helpIcon(5);
|
||||
$output .= '<h1>'.WebGUI::International::get(163).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
if ($session{form}{op} eq "addUserSave") {
|
||||
|
|
@ -129,7 +129,7 @@ sub www_deleteUser {
|
|||
if ($session{form}{uid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpLink(7);
|
||||
$output .= helpIcon(7);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(167).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
|
|
@ -196,7 +196,7 @@ sub www_editUser {
|
|||
tie %data, 'Tie::IxHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$u = WebGUI::User->new($session{form}{uid});
|
||||
$output .= helpLink(5);
|
||||
$output .= helpIcon(5);
|
||||
$output .= '<h1>'.WebGUI::International::get(168).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editUserSave");
|
||||
|
|
@ -373,7 +373,7 @@ sub www_listUsers {
|
|||
my ($output, $sth, %data, @row, $p, $i, $search);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = helpLink(8);
|
||||
$output = helpIcon(8);
|
||||
$output .= '<h1>'.WebGUI::International::get(149).'</h1>';
|
||||
$output .= '<table class="tableData" align="center" width="75%"><tr><td>';
|
||||
$output .= '<a href="'.WebGUI::URL::page('op=addUser').'">'.WebGUI::International::get(169).'</a>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue