Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r23352: LJSUP-13980 (remove settings for friends...

Committer: ailyin
LJSUP-13980 (remove settings for friends page)
U   trunk/cgi-bin/LJ/Widget/JournalTitles.pm
A   trunk/templates/Widgets/journal_titles.tmpl
Modified: trunk/cgi-bin/LJ/Widget/JournalTitles.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/JournalTitles.pm	2012-11-23 12:16:03 UTC (rev 23351)
+++ trunk/cgi-bin/LJ/Widget/JournalTitles.pm	2012-11-23 14:05:47 UTC (rev 23352)
@@ -15,48 +15,33 @@
     my $u = $class->get_effective_remote();
     die "Invalid user." unless LJ::isu($u);
 
-    my $no_theme_chooser = defined $opts{no_theme_chooser} ? $opts{no_theme_chooser} : 0;
+    my $no_theme_chooser = $opts{'no_theme_chooser'} || 0;
 
-    my $ret;
-    $ret .= "<h2 class='widget-header'>";
-    $ret .= $no_theme_chooser ? $class->ml('widget.journaltitles.title_nonum') : $class->ml('widget.journaltitles.title');
-    $ret .= "</h2>";
-    $ret .= "<div class='theme-titles-content'>";
-    $ret .= "<p class='detail'>" . $class->ml('widget.journaltitles.desc') . " " . LJ::help_icon('journal_titles') . "</p>";
+    my $template = LJ::HTML::Template->new(
+        { 'use_expr' => 1 },
+        'filename' => $ENV{'LJHOME'} . '/templates/Widgets/journal_titles.tmpl',
+    );
 
-    foreach my $id (qw( journaltitle journalsubtitle friendspagetitle )) {
-        $ret .= $class->start_form( id => "${id}_form" );
+    my @titles_out;
+    foreach my $title ( qw( journaltitle journalsubtitle friendspagetitle ) ) {
+        next if $title eq 'friendspagetitle' &&
+            ! LJ::is_enabled('friendsfeed_optout');
 
-        $ret .= "<p>";
-        $ret .= "<label>" . $class->ml("widget.journaltitles.$id") . "</label> ";
-        $ret .= "<span id='${id}_view'>";
-        $ret .= "<strong>" . LJ::ehtml($u->prop($id)) . "</strong> ";
-        $ret .= "<a href='' class='theme-title-control' id='${id}_edit'>" . $class->ml('widget.journaltitles.edit') . "</a>";
-        $ret .= "</span>";
-
-        $ret .= "<span id='${id}_modify'>";
-        $ret .= $class->html_text(
-            name => 'title_value',
-            id => $id,
-            value => $u->prop($id),
-            size => '30',
-            maxlength => LJ::std_max_length(),
-            raw => "class='text'",
-        ) . " ";
-        $ret .= $class->html_hidden( which_title => $id );
-        $ret .= $class->html_submit(
-            save => $class->ml('widget.journaltitles.btn'),
-            { raw => "id='save_btn_$id'" },
-        ) . " ";
-        $ret .= "<a href='' class='theme-title-control' id='${id}_cancel'>" . $class->ml('widget.journaltitles.cancel') . "</a>";
-        $ret .= "</span></p>";
-
-        $ret .= $class->end_form;
+        push @titles_out, {
+            'id' => $title,
+            'name' => LJ::Lang::ml("widget.journaltitles.$title"),
+            'value' => $u->prop($title),
+        };
     }
 
-    $ret .= "</div>";
+    $template->param(
+        'helpicon'         => LJ::help_icon('journal_titles') || '',
+        'form_auth'        => LJ::form_auth() || '',
+        'no_theme_chooser' => $no_theme_chooser,
+        'titles'           => \@titles_out,
+    );
 
-    return $ret;
+    return $template->output;
 }
 
 sub handle_post {

Added: trunk/templates/Widgets/journal_titles.tmpl
===================================================================
--- trunk/templates/Widgets/journal_titles.tmpl	                        (rev 0)
+++ trunk/templates/Widgets/journal_titles.tmpl	2012-11-23 14:05:47 UTC (rev 23352)
@@ -0,0 +1,35 @@
+<h2 class='widget-header'>
+    <TMPL_IF no_theme_chooser>
+        <TMPL_VAR expr="ml('widget.journaltitles.title_nonum')">
+    <TMPL_ELSE>
+        <TMPL_VAR expr="ml('widget.journaltitles.title')">
+    </TMPL_IF>
+</h2>
+
+<div class='theme-titles-content'>
+
+    <p class='detail'>
+        <TMPL_VAR expr="ml('widget.journaltitles.desc')">
+        <TMPL_VAR helpicon>
+    </p>
+
+    <TMPL_LOOP titles>
+        <form method='POST' id="<TMPL_VAR id>_form">
+            <TMPL_VAR form_auth>
+            <p>
+                <label><TMPL_VAR name></label>
+                <span id='<TMPL_VAR id>_view'>
+                    <strong><TMPL_VAR value ESCAPE=HTML></strong>
+                    <a href='' class='theme-title-control' id='<TMPL_VAR id>_edit'><TMPL_VAR expr="ml('widget.journaltitles.edit')"></a>
+                </span>
+                <span id='<TMPL_VAR id>_modify'>
+                    <input type="text" maxlength="100" value="<TMPL_VAR value ESCAPE=HTML>" name="Widget[JournalTitles]_title_value" id="<TMPL_VAR id>" size="30" class='text' />
+                    <input type='hidden' name="Widget[JournalTitles]_which_title" value="<TMPL_VAR id>" />
+                    <input type='submit' name="Widget[JournalTitles]_save" value="<TMPL_VAR expr="ml('widget.journaltitles.btn')">" id='save_btn_<TMPL_VAR id>' />
+                    <a href='' class='theme-title-control' id='<TMPL_VAR id>_cancel'><TMPL_VAR expr="ml('widget.journaltitles.cancel')"></a>
+                </span>
+            </p>
+        </form>
+    </TMPL_LOOP>
+
+</div>

Tags: ailyin, andy, livejournal, pm, tmpl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments