mourningdove/htdocs/customize/options.bml

110 lines
3.7 KiB
Text
Raw Normal View History

2026-05-24 01:03:05 +00:00
<?_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(qw( stc/customize.css 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{'.title'};
# 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 );
}
my $group = $GET{group} ? $GET{group} : "presentation";
# 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 $ret;
if (LJ::did_post()) {
my @errors = LJ::Widget->handle_post(\%POST, qw(CustomizeTheme CustomTextModule JournalTitles MoodThemeChooser NavStripChooser S2PropGroup LinksList LayoutChooser));
$ret .= LJ::bad_input(@errors) if @errors;
}
$ret .= "<form action='$LJ::SITEROOT/customize/options' 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" } );
}
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( no_theme_chooser => 1 );
$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( no_theme_chooser => 1 );
$ret .= "</div><!-- end .theme-titles -->";
$ret .= "<br />";
my $customize_theme = LJ::Widget::CustomizeTheme->new;
$headextra .= $customize_theme->wrapped_js( page_js_obj => "Customize" );
$ret .= "<div class='customize-wrapper one-percent'>";
$ret .= $customize_theme->render(
group => $group,
headextra => \$headextra,
post => \%POST,
);
$ret .= "</div><!-- end .customize-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,
no_theme_chooser => 1,
);
$ret .= "</div><!-- end .layout-selector-wrapper' -->";
$ret .= "<h2 class='widget-header'><?_ml .advanced _ml?></h2>";
$ret .= "<a href='advanced/'><?_ml .advanced _ml?></a>";
return $ret;
}
_code?>
<=body
title=><?_code return $title; _code?>
head<=
<?_code return $headextra; _code?>
<=head
page?>