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

@ -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>

View file

@ -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>';

View file

@ -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;
}