Committer: ssafronova
LJSUP-6706: Sign up server side - LJSUP-6808: assemble step 2 page+ LJSUP-6813: make school widget initial screen - intermediate
U trunk/bin/upgrading/en_LJ.dat A trunk/cgi-bin/LJ/Widget/SignUp/ A trunk/cgi-bin/LJ/Widget/SignUp/School.pm A trunk/htdocs/createaccount/ A trunk/htdocs/createaccount/step2.bml A trunk/htdocs/createaccount/step2.bml.text A trunk/templates/Widgets/ A trunk/templates/Widgets/signup/ A trunk/templates/Widgets/signup/school.tmpl
Modified: trunk/bin/upgrading/en_LJ.dat =================================================================== --- trunk/bin/upgrading/en_LJ.dat 2010-10-13 02:06:38 UTC (rev 9615) +++ trunk/bin/upgrading/en_LJ.dat 2010-10-13 09:21:58 UTC (rev 9616) @@ -9018,6 +9018,20 @@ widget.shoppingcartstatus.viewgiftscerts|staleness=1 widget.shoppingcartstatus.viewgiftscerts=view gift certificates +widget.signup.school.add=Add + +widget.signup.school.city=City + +widget.signup.school.country=Country + +widget.signup.school.later=later (text absent) + +widget.signup.school.school=School + +widget.signup.school.select=Select + +widget.signup.school.state=State + widget.sup1millionpromo.headline|staleness=1 widget.sup1millionpromo.headline=We are a million! Added: trunk/cgi-bin/LJ/Widget/SignUp/School.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/SignUp/School.pm (rev 0) +++ trunk/cgi-bin/LJ/Widget/SignUp/School.pm 2010-10-13 09:21:58 UTC (rev 9616) @@ -0,0 +1,80 @@ +package LJ::Widget::SignUp::School; + +use strict; +use base qw(LJ::Widget::Template); +use Carp qw(croak); + +sub ajax { 1 } +#sub need_res { qw( stc/widgets/examplepostwidget.css ) } + +sub prepare_template_params { + my $class = shift; + my $template_obj = shift; + my $opts = shift; + + my $cts = LJ::Schools::get_countries(); + + $template_obj->param(step => 1); + $template_obj->param(countries => [ sort { $a->{name} cmp $b->{name} } values %$cts ]); + + return; +} + +=comment +extract from /tools/endpoints/widget.bml: + + eval { + %res = LJ::Widget->handle_post(\%POST, $widget_class); + }; + + $ret{res} = \%res; + + $ret{errors} = $@ ? [$@] : \@errors; + $ret{_widget_post} = 1; + + # generate new auth token for future requests if succesfully checked auth token + $ret{auth_token} = LJ::Auth->ajax_auth_token($remote, "/_widget") if $LJ::WIDGET_NO_AUTH_CHECK; + +... + + $ret{_widget_body} = eval { $widget_class->render_body(%POST); }; + + +=cut + +sub handle_post { + my $class = shift; + my $post = shift; + my %opts = @_; + + if ($post->{text}) { + warn "You entered: $post->{text}\n"; + } + + return; +} + +sub js { + q [ + initWidget: function () { + var self = this; + + DOM.addEventListener($("school_form"), "submit", function (evt) { self.warnWord(evt, $("school_form")) }); + }, + warnWord: function (evt, form) { + var given_text = form["text"].value + ""; + + this.doPostAndUpdateContent({ + text: given_text, + submitted: 1 + }); + + Event.stop(evt); + }, + onRefresh: function (data) { + this.initWidget(); + } + ]; +} + +1; Added: trunk/htdocs/createaccount/step2.bml =================================================================== --- trunk/htdocs/createaccount/step2.bml (rev 0) +++ trunk/htdocs/createaccount/step2.bml 2010-10-13 09:21:58 UTC (rev 9616) @@ -0,0 +1,76 @@ +<?page +title=><?_ml .title _ml?> +body<= +<?_code +{ + use strict; + use vars qw($headextra); + + return 'This feature is disabled' unless LJ::is_enabled('new_sign_up'); + + my $remote = LJ::get_remote(); + unless ($remote) { + return "<?needlogin?>"; + } + + my $widget; + my $body = ''; + + if ($remote->is_validated) { + if ($GET{validate_now}) { ### TODO: change condition + $body .= '<div>' . $ML{'.validated'} . '</div>'; + } + } else { + $body .= '<div>' . BML::ml('.non-validated', { resend_url => "$LJ::SITEROOT/" }) . '</div>'; ### TODO: change URL + } + + $body .= '<b>' . $ML{'.welcome.title'} . '</b><br>'; + $body .= '<div>' . $ML{'.welcome.body'} . '</div>'; + + my $class = $remote->is_validated ? "class='enabled'" : "class='disabled'"; ### TODO: change HTML + + $body .= "<b $class>" . $ML{'.friends.title'} . '</b><br>'; + $body .= "<div $class>" . $ML{'.need.validate'} . '</div>' unless $remote->is_validated; + $body .= "<div $class>" . $ML{'.find.friends.title'} . '</div>'; + $body .= "<div $class>" . $ML{'.school.title'} . '</div>'; + $widget = LJ::Widget::SignUp::School->new; + $headextra .= $widget->wrapped_js; + $body .= $widget->render(); + + $body .= '<b>' . $ML{'.profile.title'} . '</b><br>'; + $body .= '<div>' . $ML{'.interests.title'} . '</div>'; + $body .= '<div>' . $ML{'.userpic.title'} . '</div>'; + + $body .= '<b>' . $ML{'.style.title'} . '</b><br>'; + $body .= '<div>' . $ML{'.titles.title'} . '</div>'; + $body .= '<div>' . $ML{'.design.title'} . '</div>'; + + $body .= "<b $class>" . $ML{'.write.title'} . '</b><br>'; + $body .= "<div $class>" . $ML{'.need.validate'} . '</div>' unless $remote->is_validated; + $body .= "<div $class>" . $ML{'.update.title'} . '</div>'; + $body .= "<div $class>" . $ML{'.qotd.title'} . '</div>'; + + # right column + $body .= '<div>'; + $body .= '<div>' . $ML{'.right.title'} . '</div>'; + $body .= '<div>' . $ML{'.whats.journal.title'} . '</div>'; + $body .= '<div>' . $ML{'.whats.journal.body'} . '</div>'; + $body .= '<div>' . $ML{'.whats.profile.title'} . '</div>'; + $body .= '<div>' . $ML{'.whats.profile.body'} . '</div>'; + $body .= '<div>' . $ML{'.whats.friends.title'} . '</div>'; + $body .= '<div>' . $ML{'.whats.friends.body'} . '</div>'; + $body .= '<div>' . $ML{'.whats.community.title'} . '</div>'; + $body .= '<div>' . $ML{'.whats.community.body'} . '</div>'; + + return $body; + + my $widget = LJ::Widget::Template->new; + $headextra .= $widget->wrapped_js; + return $widget->render(); +} +_code?> +<=body +head<= +<?_code return $headextra; _code?> +<=head +page?> Added: trunk/htdocs/createaccount/step2.bml.text =================================================================== --- trunk/htdocs/createaccount/step2.bml.text (rev 0) +++ trunk/htdocs/createaccount/step2.bml.text 2010-10-13 09:21:58 UTC (rev 9616) @@ -0,0 +1,66 @@ +;; -*- coding: utf-8 -*- + +.design.title=<b>Customize the look of your journal:</b> Choose from hundreds of unique design themes and layouts + +.find.friends.title=<b>Find people you already know:</b> Check your email address books to find out which of your friends are already on LiveJournal + +.friends.title=Find your friends + +.interests.title=Fill your interests and bio to allow other users to find you + +.need.validate=You have to validate your e-mail address before you can use the Find Your Friends feature -- be sure to check your e-mail inbox! + +.non-validated=<b>Check</b><br>In few minutes + +.profile.title=Create your profile! + +.qotd.title=<b>Need an idea of what to write about?</b> Our daily Writer's Block prompt is just the ticket! + +.right.title=Livejournal 101 + +.school.title=<b>Add your School:</b> Find current and former classmates! Check for your school in our database + +.style.title=Your journal style! + +.title=Quick Start Setup + +.titles.title=Fill your journal titles + +.update.title=Know what want to say? + +.userpic.title=Upload your first userpic + +.validated=Thank you! Your e-mail address is now validated. + +.welcome.body<< +We're so glad you decided to join us. LiveJournal is a great place to explore and share your creative talents +(like cooking, photography, design, fanfic) or talk about your day. You can also meet friends from all over +the world who share your hobbies, interests, politics, and more! Here are some suggestions to help you get started: +. + +.welcome.title=Welcome to LiveJournal! + +.whats.community.body=This is a forum built around a hobby, interest, or viewpoint on pretty much any topic conceivable. + +.whats.community.title=What’s a Community? + +.whats.friends.body=This is a feed of entries from all of your LiveJournal Friends and Communities. + +.whats.friends.title=What’s a Friends Page? + +.whats.journal.body<< +This is a place to write and/or post photos/images/ videos in whatever manner you choose. You can make your whole journal +Private, Public, or Friends only. You can also make entries Private, Friends-only, or Public. Lastly, you can create custom +Friend groups to share entries with a particular group of your friends. +. + +.whats.journal.title=What's a Journal? + +.whats.profile.body<< +This is a place to describe yourself a little or a lot. List your interests, add schools you've attended (or currently attend), +upload upserpics, and check your current Friends and Communities +. + +.whats.profile.title=What's a Profile? + +.write.title=Write you first entry Added: trunk/templates/Widgets/signup/school.tmpl =================================================================== --- trunk/templates/Widgets/signup/school.tmpl (rev 0) +++ trunk/templates/Widgets/signup/school.tmpl 2010-10-13 09:21:58 UTC (rev 9616) @@ -0,0 +1,36 @@ +<TMPL_IF expr="step == 1"> + <form method='POST' id='school_form'> + <TMPL_VAR form_auth> + <TMPL_VAR expr="ml('widget.signup.school.country')"> + <select name='country'> + <TMPL_LOOP countries> + <option value='<TMPL_VAR code>'><TMPL_VAR name></option> + </TMPL_LOOP> + </select> + <br> + <TMPL_VAR expr="ml('widget.signup.school.state')"> + <select name='state'> + <option value=' '><TMPL_VAR expr="ml('widget.signup.school.select')"></option> + </select> + <br> + <TMPL_VAR expr="ml('widget.signup.school.city')"> + <select name='city'> + <option value=' '><TMPL_VAR expr="ml('widget.signup.school.select')"></option> + </select> + <br> + <TMPL_VAR expr="ml('widget.signup.school.school')"> + <select name='school'> + <option value=' '><TMPL_VAR expr="ml('widget.signup.school.select')"></option> + </select> + <br> + <input type='text' name='from'> + - + <input type='text' name='to'> + <TMPL_VAR expr="ml('widget.signup.school.later')"> + <input type='submit' value='<TMPL_VAR expr="ml('widget.signup.school.add')">'> + </form> +<TMPL_ELSE> + <form method='POST' id='school_form'> + <TMPL_VAR form_auth> + </form> +</TMPL_IF>