Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r20581: LJSUP-10452: Support Board needs two min...

Committer: gariev
LJSUP-10452: Support Board needs two minor updates
U   trunk/cgi-bin/LJ/Widget/SubmitRequest.pm
U   trunk/cgi-bin/supportlib.pl
U   trunk/htdocs/support/see_request.bml
U   trunk/htdocs/support/see_request.bml.text
Modified: trunk/cgi-bin/LJ/Widget/SubmitRequest.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/SubmitRequest.pm	2011-11-21 11:35:35 UTC (rev 20580)
+++ trunk/cgi-bin/LJ/Widget/SubmitRequest.pm	2011-11-21 11:52:33 UTC (rev 20581)
@@ -103,6 +103,17 @@
     $ret .= $class->html_textarea(name => 'message', rows => '15', cols => '70', wrap => 'soft', value => $post->{message});
     $ret .= "</div></p>";
 
+    ## is javascript on?
+    $ret .= "\n" . $class->html_hidden({name => 'has_js', id => 'has_js', value => 'N'});
+    $ret .= "\n" . '
+<script>
+    // $() is DOM.getElement() defined in htdocs/js/dom.js
+    if ($) {
+        var has_js = $("has_js"); 
+        if (has_js) { has_js.value = "Y" } 
+    }
+</script>';
+
     if ($LJ::HUMAN_CHECK{support_submit} && LJ::is_enabled("recaptcha") && !$remote) {
         my $c = Captcha::reCAPTCHA->new;
 
@@ -186,10 +197,12 @@
         $req{'language'} = $post->{'language'};
     }
 
-    $req{'body'} = $post->{'message'};
+    $req{'body'}    = $post->{'message'};
     $req{'subject'} = $post->{'subject'};
     $req{'spcatid'} = $post->{'spcatid'};
-    $req{'uniq'} = LJ::UniqCookie->current_uniq;
+    $req{'uniq'}    = LJ::UniqCookie->current_uniq;
+    $req{'ip'}      = LJ::get_remote_ip();
+    $req{'has_js'}  = $post->{'has_js'};
 
     # don't autoreply if they aren't gonna get a link
     $req{'no_autoreply'} = $class->send_email ? 0 : 1;

Modified: trunk/cgi-bin/supportlib.pl
===================================================================
--- trunk/cgi-bin/supportlib.pl	2011-11-21 11:35:35 UTC (rev 20580)
+++ trunk/cgi-bin/supportlib.pl	2011-11-21 11:52:33 UTC (rev 20581)
@@ -599,10 +599,10 @@
         return unless $q && $q ne 'NULL';
         push @data, "($spid, '$_[0]', $q)";
     };
-    if (LJ::is_enabled("support_request_language") && $o->{language} ne "xx") {
-        $add_data->($_, $o->{$_}) foreach qw(uniq useragent language);
-    } else {
-        $add_data->($_, $o->{$_}) foreach qw(uniq useragent);
+    my @props = qw(uniq useragent ip has_js);
+    push @props, "language" if LJ::is_enabled("support_request_language");
+    foreach my $p (@props) {
+        $add_data->($p, $o->{$p});
     }
     $dbh->do("INSERT INTO supportprop (spid, prop, value) VALUES " . join(',', @data));
 

Modified: trunk/htdocs/support/see_request.bml
===================================================================
--- trunk/htdocs/support/see_request.bml	2011-11-21 11:35:35 UTC (rev 20580)
+++ trunk/htdocs/support/see_request.bml	2011-11-21 11:52:33 UTC (rev 20581)
@@ -492,6 +492,19 @@
         $ret .= "</td></tr>\n";
     }
 
+    ## IP address
+    if (LJ::check_priv($remote, 'siteadmin', 'users')) {
+        $ret .= "<tr><td align='right' nowrap='nowrap'><b>$ML{'.ip_address'}:</b></td>";
+        $ret .= "<td>$props->{ip}</td></tr>"
+    }
+
+    ## Has JS?
+    my $has_js =    ($props->{'has_js'} && $props->{'has_js'} eq 'Y') ? 'yes' : 
+                    ($props->{'has_js'} && $props->{'has_js'} eq 'N') ? 'no' : '(unknown)';
+    $ret .= "<tr><td align='right' nowrap='nowrap'><b>$ML{'.has_js'}:</b></td>";
+    $ret .= "<td>$has_js</td></tr>";
+    
+
     $ret .= "<tr><td align='right' nowrap='nowrap'><b>$ML{'.supportcategory'}:</b></td><td>";
     if (LJ::Support::can_read_cat($sp->{_cat}, $remote)) {
         $ret .= "<a href='$LJ::SITEROOT/support/help.bml?cat=$sp->{_cat}->{'catkey'}'>$problemarea</a>";

Modified: trunk/htdocs/support/see_request.bml.text
===================================================================
--- trunk/htdocs/support/see_request.bml.text	2011-11-21 11:35:35 UTC (rev 20580)
+++ trunk/htdocs/support/see_request.bml.text	2011-11-21 11:52:33 UTC (rev 20581)
@@ -83,6 +83,8 @@
 .goback.text|staleness=1
 .goback.text=<?p Go back to <a [[request_link]]>Request #[[spid]]</a> p?>
 
+.has_js=Is JavaScript enabled
+
 .help.link|staleness=1
 .help.link=Back to the <a href="help.bml">list of open requests</a>.<br />
 
@@ -104,6 +106,8 @@
 .internal.comment|staleness=1
 .internal.comment=Internal Comment
 
+.ip_address=IP Address
+
 .language|staleness=1
 .language=language
 

Tags: bml, gariev, livejournal, pl, pm, text
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