144 lines
5 KiB
Text
144 lines
5 KiB
Text
<?_c
|
|
# This code was forked from the LiveJournal project owned and operated
|
|
# by Live Journal, Inc. The code has been modified and expanded by
|
|
# Dreamwidth Studios, LLC. These files were originally licensed under
|
|
# the terms of the license supplied by Live Journal, Inc, which can
|
|
# currently be found at:
|
|
#
|
|
# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
|
|
#
|
|
# In accordance with the original license, this code and all its
|
|
# modifications are provided under the GNU General Public License.
|
|
# A copy of that license can be found in the LICENSE file included as
|
|
# part of this distribution.
|
|
_c?>
|
|
<?page
|
|
body<=
|
|
<?_code
|
|
{
|
|
use strict;
|
|
use vars qw(%GET %POST $title $headextra @errors @warnings);
|
|
LJ::need_res( { priority => $LJ::OLD_RES_PRIORITY }, "stc/customize.css" );
|
|
LJ::need_res( "js/customize.js", "stc/select-list.css" );
|
|
|
|
my $remote = LJ::get_remote();
|
|
return "<?needlogin?>" unless $remote;
|
|
|
|
my $authas = $GET{authas} || $remote->user;
|
|
my $u = LJ::get_authas_user($authas);
|
|
return LJ::bad_input($ML{'error.invalidauth'})
|
|
unless $u;
|
|
|
|
$title = $u->is_community ?
|
|
$ML{'.title.comm'} :
|
|
$ML{'.title2'};
|
|
|
|
# extra arguments for get requests
|
|
my $getextra = $authas ne $remote->user ? "?authas=$authas" : "";
|
|
|
|
# if using s1, switch them to s2
|
|
unless ($u->prop('stylesys') == 2) {
|
|
$u->set_prop( stylesys => 2 );
|
|
}
|
|
|
|
# make sure there's a style set and load it
|
|
my $style = LJ::Customize->verify_and_load_style($u);
|
|
|
|
# lazy migration of style name
|
|
LJ::Customize->migrate_current_style($u);
|
|
|
|
my $cat = defined $GET{cat} ? $GET{cat} : "";
|
|
my $layoutid = defined $GET{layoutid} ? $GET{layoutid} : 0;
|
|
my $designer = defined $GET{designer} ? $GET{designer} : "";
|
|
my $search = defined $GET{search} ? $GET{search} : "";
|
|
my $page = defined $GET{page} ? $GET{page} : 1;
|
|
my $show = defined $GET{show} ? $GET{show} : 12;
|
|
|
|
my $ret;
|
|
|
|
if (LJ::did_post()) {
|
|
if ($POST{nextpage}) {
|
|
return "<?h1 $ML{'Error'} h1?><?p $ML{'error.invalidform'} p?>"
|
|
unless LJ::check_form_auth();
|
|
|
|
return BML::redirect("$LJ::SITEROOT/customize/options$getextra");
|
|
}
|
|
my @errors = LJ::Widget->handle_post(\%POST, qw(JournalTitles ThemeChooser ThemeNav LayoutChooser));
|
|
$ret .= LJ::bad_input(@errors) if @errors;
|
|
}
|
|
|
|
$ret .= "<form action='$LJ::SITEROOT/customize/' method='get' class='theme-switcher'>";
|
|
$ret .= LJ::make_authas_select($remote, { authas => $GET{authas} });
|
|
$ret .= "</form>";
|
|
|
|
if ($GET{authas}) {
|
|
$ret .= LJ::html_hidden(
|
|
{ name => "authas", value => $GET{authas}, id => "_widget_authas" } );
|
|
}
|
|
|
|
# if they're working as a community, reproduce the community management linkbar:
|
|
if ( $u && $u->is_community ) {
|
|
my $linkbar;
|
|
$linkbar = $u->maintainer_linkbar( "customize" );
|
|
$ret .= "<p class='intro'>" . $linkbar . "</p>";
|
|
}
|
|
|
|
# would you like to set the site skin instead?
|
|
$ret .= "<p>";
|
|
if ( $u && $u->is_community ) {
|
|
$ret .= LJ::Lang::ml( '.setstyle.comm' ) . " ";
|
|
} else {
|
|
$ret .= LJ::Lang::ml( '.setstyle.user' ) . " ";
|
|
}
|
|
$ret .= LJ::Lang::ml( '.setsiteskin', { aopts => "href='$LJ::SITEROOT/manage/settings/?cat=display#skin'" } );
|
|
$ret .= "</p>";
|
|
|
|
my $current_theme = LJ::Widget::CurrentTheme->new;
|
|
$headextra .= $current_theme->wrapped_js( page_js_obj => "Customize" );
|
|
$ret .= "<div class='theme-current pkg'>";
|
|
$ret .= $current_theme->render( show => $show );
|
|
$ret .= "</div><!-- end .theme-current -->";
|
|
|
|
my $journal_titles = LJ::Widget::JournalTitles->new;
|
|
$headextra .= $journal_titles->wrapped_js;
|
|
$ret .= "<div class='theme-titles pkg'>";
|
|
$ret .= $journal_titles->render;
|
|
$ret .= "</div><!-- end .theme-titles -->";
|
|
$ret .= "<br />";
|
|
|
|
my $theme_nav = LJ::Widget::ThemeNav->new;
|
|
$headextra .= $theme_nav->wrapped_js( page_js_obj => "Customize" );
|
|
$ret .= "<div class='theme-selector-wrapper pkg'>";
|
|
$ret .= $theme_nav->render(
|
|
cat => $cat,
|
|
layoutid => $layoutid,
|
|
designer => $designer,
|
|
search => $search,
|
|
page => $page,
|
|
show => $show,
|
|
headextra => \$headextra,
|
|
);
|
|
$ret .= "</div><!-- end .theme-selector-wrapper -->";
|
|
|
|
my $layout_chooser = LJ::Widget::LayoutChooser->new;
|
|
$headextra .= $layout_chooser->wrapped_js( page_js_obj => "Customize" );
|
|
$ret .= "<a name='layout'></a>";
|
|
$ret .= "<div class='layout-selector-wrapper pkg'>";
|
|
$ret .= $layout_chooser->render( headextra => \$headextra );
|
|
$ret .= "</div><!-- end .layout-selector-wrapper' -->";
|
|
|
|
$ret .= "<form method='POST'><div class='theme-customize'>";
|
|
$ret .= LJ::form_auth();
|
|
$ret .= LJ::html_submit( 'nextpage', $ML{'.btn.nextpage'}, { raw => qq{ class="submit" } } );
|
|
$ret .= "</div>";
|
|
$ret .= "</form>";
|
|
|
|
return $ret;
|
|
}
|
|
_code?>
|
|
<=body
|
|
title=><?_code return $title; _code?>
|
|
head<=
|
|
<?_code return $headextra; _code?>
|
|
<=head
|
|
page?>
|