From 50b3aafb7c05f0eb7c51296fb56e737ec4595218 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 7 Dec 2003 22:16:57 +0000 Subject: [PATCH] templatized the login box macro --- docs/changelog/6.x.x.txt | 2 + docs/previousVersion.sql | 2 +- docs/upgrades/upgrade_5.5.3-6.0.0.sql | 2 + lib/WebGUI/Macro/L_loginBox.pm | 78 ++++++++++++++------------- 4 files changed, 45 insertions(+), 39 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index ccb05da4b..28f3fe050 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -13,5 +13,7 @@ wobject. - Migrated Link Lists to USS submissions and removed the Link List wobject. - Re-enabled the Date macro by default. + - Templatized the Login Box macro. + - Added the new WebGUI 6 design. diff --git a/docs/previousVersion.sql b/docs/previousVersion.sql index 8d3f7ee95..1f3623649 100644 --- a/docs/previousVersion.sql +++ b/docs/previousVersion.sql @@ -17036,5 +17036,5 @@ update style set styleId=10 where styleId=-10; delete from style where styleId<0; update incrementer set nextValue=nextValue+1 where incrementerId='styleId'; update page set styleId=1000 where styleId=-8; -INSERT INTO style VALUES (1000,'WebGUI 6','\r\n ','\r\n^AdminBar;\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
^L(20,Hi ^a(^@;);. Click %here% if you wanna log out!);
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n^Spacer(56,1);^Spacer(26,1);
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,59);^D(\"%c %D, %y\");
^PageTitle;
^Spacer(53,59);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,1);\r\n
\r\n^FlexMenu;\r\n


\r\n^AdminToggle;\r\n

\r\n\r\n
^-;^Spacer(53,1);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n'); +INSERT INTO style VALUES (1000,'WebGUI 6','\r\n ','\r\n^AdminBar;\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
^L(17,"",2); ^AdminToggle;
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n^Spacer(56,1);^Spacer(26,1);
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,59);^D(\"%c %D, %y\");
^PageTitle;
^Spacer(53,59);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,1);\r\n
\r\n^FlexMenu;\r\n


\r\n\r\n
^-;^Spacer(53,1);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n'); diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.sql b/docs/upgrades/upgrade_5.5.3-6.0.0.sql index fc5f50148..d41683331 100644 --- a/docs/upgrades/upgrade_5.5.3-6.0.0.sql +++ b/docs/upgrades/upgrade_5.5.3-6.0.0.sql @@ -170,4 +170,6 @@ insert into international (internationalId,languageId,namespace,message,lastUpda delete from international where languageId=1 and namespace='USS' and internationalId=71; insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (71,1,'USS','User Submission Systems (USS) are a great way to add a sense of community to any site as well as get free content from your users. The User Submission System name is misleading to some people, because they immediately think of users as visitors. However, users are also staff, or business partners, or even yourself. With the USS you can select who can add new content, and even who can moderate that content.\r\n

\r\nUser Submission systems are so versatile that they allow you to create all kinds of applications, just by editing a few templates. Example applications are Photo Galleries, FAQs, Link Lists, Guest Books, Classifieds, and more.\r\n\r\n\r\n

\r\nSubmission Template
\r\nChoose a layout for the individual submissions.\r\n

\r\n\r\nSubmission Form Template
\r\nChoose a layout of the form users see when submitting content.\r\n

\r\n\r\n\r\nSubmissions Per Page
\r\nHow many submissions should be listed per page in the submissions index?\r\n

\r\n\r\n\r\nFilter Content
\r\nSelect the level of content filtering you wish to perform on all submitted content.\r\n

\r\n\r\nSort By
\r\nThe field to sort the submission list by.\r\n

\r\n\r\nSort Order
\r\nThe direction to sort the submission list by.\r\n

\r\n\r\n\r\n\r\n\r\nWho can approve?
\r\nWhat group is allowed to approve and deny content?\r\n

\r\n\r\nWho can contribute?
\r\nWhat group is allowed to contribute content?\r\n

\r\n\r\n\r\nDefault Status
\r\nShould submissions be set to Approved, Pending, or Denied by default?\r\n

\r\nNote: If you set the default status to Pending, then be prepared to monitor your message log for new submissions.\r\n

\r\n\r\nKarma Per Submission
\r\nHow much karma should be given to a user when they contribute to this user submission system?\r\n

\r\n\r\n\r\nAllow discussion?
\r\nChecking this box will enable responses to your article much like Articles on Slashdot.org.\r\n

\r\n\r\n\r\n', 1070199700,NULL); +INSERT INTO template VALUES (1,'Default Login Box','

\n\n \n
\n \n

\n \n
\n \n \n \n

\n
\n\n \n \">.\n \n \n \n \n
\n
\n','Macro/L_loginBox'); +INSERT INTO template VALUES (2,'Horizontal Login Box','
\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n\n \n \">.\n
\n \n \n
\n
\n
\n','Macro/L_loginBox'); diff --git a/lib/WebGUI/Macro/L_loginBox.pm b/lib/WebGUI/Macro/L_loginBox.pm index 41a402fa7..f77c25656 100644 --- a/lib/WebGUI/Macro/L_loginBox.pm +++ b/lib/WebGUI/Macro/L_loginBox.pm @@ -11,10 +11,11 @@ package WebGUI::Macro::L_loginBox; #------------------------------------------------------------------- use strict; -use WebGUI::HTMLForm; +use WebGUI::Form; use WebGUI::International; use WebGUI::Macro; use WebGUI::Session; +use WebGUI::Template; use WebGUI::URL; #------------------------------------------------------------------- @@ -24,44 +25,45 @@ sub _createURL { #------------------------------------------------------------------- sub process { - my ($temp,$boxSize,@param,$text,$f); - my $debug; - @param = WebGUI::Macro::getParams($_[0]); - $temp = '
'; - if ($session{user}{userId} != 1) { - $text = $param[1]; - if (not defined $text){ - $temp .= WebGUI::International::get(48); - $temp .= ' '.$session{user}{username}.'. '; - $temp .= WebGUI::International::get(49); - } else { - $text =~ s/%(.*?)%/_createURL($1)/ge; - $temp .= $text; - } - } else { - $boxSize = $param[0]; - if (not defined $boxSize) { - $boxSize = 12; - } - if (index(lc($ENV{HTTP_USER_AGENT}),"msie") < 0) { - $boxSize = int($boxSize=$boxSize*2/3); - } - $f = WebGUI::HTMLForm->new(1); - $f->hidden("op","login"); - $f->raw(''.WebGUI::International::get(50).'
'); - $f->text("username",'','','','','',$boxSize); - $f->raw('
'.WebGUI::International::get(51).'
'); - $f->password("identifier",'','','','','',$boxSize); - $f->raw('
'); - $f->submit(WebGUI::International::get(52)); - $temp .= $f->print; - if ($session{setting}{anonymousRegistration}) { - $temp .= ''.WebGUI::International::get(407).''; - } + my @param = WebGUI::Macro::getParams($_[0]); + my $templateId = $param[2] || 1; + my %var; + $var{'user.isVisitor'} = ($session{user}{userId} == 1); + $var{'customText'} = $param[1]; + $var{'customText'} =~ s/%(.*?)%/_createURL($1)/ge; + $var{'hello.label'} = WebGUI::International::get(48); + $var{'logout.url'} = WebGUI::URL::page("op=logout"); + $var{'account.display.url'} = WebGUI::URL::page('op=displayAccount'); + $var{'logout.label'} = WebGUI::International::get(49); + my $boxSize = $param[0]; + $boxSize = 12 if (not defined $boxSize); + if (index(lc($ENV{HTTP_USER_AGENT}),"msie") < 0) { + $boxSize = int($boxSize=$boxSize*2/3); } - $temp .= '
'; - return $temp; + $var{'form.header'} = WebGUI::Form::formHeader() + .WebGUI::Form::hidden({ + name=>"op", + value=>"login" + }); + $var{'username.label'} = WebGUI::International::get(50); + $var{'username.form'} = WebGUI::Form::text({ + name=>"username", + size=>$boxSize, + extras=>'class="loginBoxField"' + }); + $var{'password.label'} = WebGUI::International::get(51); + $var{'password.form'} = WebGUI::Form::password({ + name=>"identifier", + size=>$boxSize, + extras=>'class="loginBoxField"' + }); + $var{'form.login'} = WebGUI::Form::submit({ + value=>WebGUI::International::get(52), + extras=>'class="loginBoxButton"' + }); + $var{'account.create.url'} = WebGUI::URL::page('op=createAccount'); + $var{'account.create.label'} = WebGUI::International::get(407); + return WebGUI::Template::process(WebGUI::Template::get($templateId,"Macro/L_loginBox"),\%var); } 1;