Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 300139 Details for
Bug 426386
3.8.5: Check for javascript ability of client for all pages supporting ajax optimizations
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to add javascript enabled check to Bugzilla code (v2)
javascript_check_v2.patch (text/plain), 9.17 KB, created by
David Lawrence
on 2008-04-02 21:36:08 UTC
(
hide
)
Description:
Patch to add javascript enabled check to Bugzilla code (v2)
Filename:
MIME Type:
Creator:
David Lawrence
Created:
2008-04-02 21:36:08 UTC
Size:
9.17 KB
patch
obsolete
>Index: Bugzilla/Auth.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Auth.pm,v >retrieving revision 1.1.1.1 >diff -u -r1.1.1.1 Auth.pm >--- Bugzilla/Auth.pm 19 Nov 2007 22:11:21 -0000 1.1.1.1 >+++ Bugzilla/Auth.pm 2 Apr 2008 21:29:18 -0000 >@@ -162,6 +162,10 @@ > } > # Otherwise, we just return the "default" user. > $user = Bugzilla->user; >+ >+ # REDHAT EXTENSION START 426386 >+ # Set javascript flag to enable UI enhancements >+ $user->set_javascript($result->{javascript}) if exists $result->{javascript}; > } > # The username/password may be wrong > # Don't let the user know whether the username exists or whether >Index: Bugzilla/User.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/User.pm,v >retrieving revision 1.7 >diff -u -r1.7 User.pm >--- Bugzilla/User.pm 25 Mar 2008 21:06:14 -0000 1.7 >+++ Bugzilla/User.pm 2 Apr 2008 21:29:18 -0000 >@@ -73,6 +73,9 @@ > 'showmybugslink' => 0, > 'disabledtext' => '', > 'disable_mail' => 0, >+ # REDHAT EXTENSION START 426386 >+ 'javascript' => 0, >+ # REDHAT EXTENSION END 426386 > }; > > use constant DB_TABLE => 'profiles'; >@@ -88,6 +91,9 @@ > 'profiles.mybugslink AS showmybugslink', > 'profiles.disabledtext', > 'profiles.disable_mail', >+ # REDHAT EXTENSION START 426386 >+ 'profiles.javascript', >+ # REDHAT EXTENSION END 426386 > ); > use constant NAME_FIELD => 'login_name'; > use constant ID_FIELD => 'userid'; >@@ -95,14 +101,17 @@ > > use constant REQUIRED_CREATE_FIELDS => qw(login_name cryptpassword); > >+# REDHAT EXTENSION 426386 Add javascript validator > use constant VALIDATORS => { > cryptpassword => \&_check_password, > disable_mail => \&_check_disable_mail, > disabledtext => \&_check_disabledtext, > login_name => \&check_login_name_for_creation, > realname => \&_check_realname, >+ javascript => \&_check_javascript, > }; > >+# REDHAT EXTENSION 426386 Add javascript to update columns > sub UPDATE_COLUMNS { > my $self = shift; > my @cols = qw( >@@ -110,6 +119,7 @@ > disabledtext > login_name > realname >+ javascript > ); > push(@cols, 'cryptpassword') if exists $self->{cryptpassword}; > return @cols; >@@ -161,6 +171,10 @@ > sub _check_disable_mail { return $_[1] ? 1 : 0; } > sub _check_disabledtext { return trim($_[1]) || ''; } > >+# REDHAT EXTENSION START 426386 >+sub _check_javascript { return $_[1] ? 1 : 0; } >+# REDHAT EXTENSION END 426386 >+ > # This is public since createaccount.cgi needs to use it before issuing > # a token for account creation. > sub check_login_name_for_creation { >@@ -216,6 +230,9 @@ > > sub set_password { $_[0]->set('cryptpassword', $_[1]); } > >+# REDHAT EXTENSION START 426386 >+sub set_javascript { $_[0]->set('javascript', $_[1]) } >+# REDHAT EXTENSION END 426386 > > ################################################################################ > # Methods >@@ -231,6 +248,10 @@ > sub email_disabled { $_[0]->{disable_mail}; } > sub email_enabled { !($_[0]->{disable_mail}); } > >+# REDHAT EXTENSION START 426386 >+sub javascript { $_[0]->{javascript}; } >+# REDHAT EXTENSION END 426386 >+ > sub set_authorizer { > my ($self, $authorizer) = @_; > $self->{authorizer} = $authorizer; >Index: Bugzilla/Auth/Verify.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Auth/Verify.pm,v >retrieving revision 1.1.1.1 >diff -u -r1.1.1.1 Verify.pm >--- Bugzilla/Auth/Verify.pm 19 Nov 2007 22:11:21 -0000 1.1.1.1 >+++ Bugzilla/Auth/Verify.pm 2 Apr 2008 21:29:18 -0000 >@@ -124,6 +124,11 @@ > trick_taint($real_name); > $user->set_name($real_name); > } >+ # REDHAT EXTENSION START 426386 >+ if (exists $params->{javascript} && $user->javascript ne $params->{javascript}) { >+ $user->set_javascript($params->{javascript}); >+ } >+ # REDHAT EXTENSION END 426386 > $user->update(); > > return { user => $user }; >Index: Bugzilla/Auth/Login/Cookie.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Auth/Login/Cookie.pm,v >retrieving revision 1.1.1.1 >diff -u -r1.1.1.1 Cookie.pm >--- Bugzilla/Auth/Login/Cookie.pm 19 Nov 2007 22:11:21 -0000 1.1.1.1 >+++ Bugzilla/Auth/Login/Cookie.pm 2 Apr 2008 21:29:18 -0000 >@@ -53,6 +53,17 @@ > $user_id = $cookie->value if $cookie; > } > >+ # REDHAT EXTENSION START 426386 >+ # Check for javascript cookie to enable some UI enhancements >+ my $javascript = $cgi->cookie("Bugzilla_javascript"); >+ unless ($javascript) { >+ my $cookie = first {$_->name eq 'Bugzilla_javascript'} >+ @{$cgi->{'Bugzilla_cookie_list'}}; >+ $javascript = $cookie->value if $cookie; >+ } >+ $javascript = $javascript ? 1 : 0; >+ # REDHAT EXTENSION END 426386 >+ > if ($login_cookie && $user_id) { > # Anything goes for these params - they're just strings which > # we're going to verify against the db >@@ -82,15 +93,26 @@ > # time on the login cookie > $dbh->do("UPDATE logincookies SET lastused = NOW() > WHERE cookie = ?", undef, $login_cookie); >- return { user_id => $user_id }; >+ >+ # REDHAT EXTENSION START 426386 >+ # Remove this cookie for the next javascript check >+ $cgi->remove_cookie('Bugzilla_javascript'); >+ # REDHAT EXTENSION END 426386 >+ >+ return { user_id => $user_id, javascript => $javascript }; > } > } > >+ # REDHAT EXTENSION START 426386 >+ # Remove this cookie for the next javascript check >+ $cgi->remove_cookie('Bugzilla_javascript'); >+ # REDHAT EXTENSION END 426386 >+ > # Either the he cookie is invalid, or we got no cookie. We don't want > # to ever return AUTH_LOGINFAILED, because we don't want Bugzilla to > # actually throw an error when it gets a bad cookie. It should just > # look like there was no cookie to begin with. >- return { failure => AUTH_NODATA }; >+ return { failure => AUTH_NODATA, javascript => $javascript }; > } > > 1; >Index: Bugzilla/DB/Schema.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/DB/Schema.pm,v >retrieving revision 1.14 >diff -u -r1.14 Schema.pm >--- Bugzilla/DB/Schema.pm 26 Mar 2008 18:53:00 -0000 1.14 >+++ Bugzilla/DB/Schema.pm 2 Apr 2008 21:29:18 -0000 >@@ -868,6 +868,9 @@ > mybugslink => {TYPE => 'BOOLEAN', NOTNULL => 1, > DEFAULT => 'TRUE'}, > extern_id => {TYPE => 'varchar(64)'}, >+ # REDHAT EXTENSION START 426386 >+ javascript => {TYPE => 'BOOLEAN', DEFAULT => 0 }, >+ # REDHAT EXTENSION END 426386 > ], > INDEXES => [ > profiles_login_name_idx => {FIELDS => ['login_name'], >Index: Bugzilla/Install/DB.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Install/DB.pm,v >retrieving revision 1.10 >diff -u -r1.10 DB.pm >--- Bugzilla/Install/DB.pm 26 Mar 2008 18:53:00 -0000 1.10 >+++ Bugzilla/Install/DB.pm 2 Apr 2008 21:29:18 -0000 >@@ -524,6 +524,10 @@ > > $dbh->bz_drop_index('longdescs', 'longdescs_thetext_idx'); > _populate_bugs_fulltext(); >+ >+ # 2008-04-01 dkl@redhat.com - Bug 426382 >+ $dbh->bz_add_column('profiles', 'javascript', >+ { TYPE => 'BOOLEAN', DEFAULT => 0 }); > > ################################################################ > # New --TABLE-- changes should go *** A B O V E *** this point # >Index: template/en/default/global/header.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/global/header.html.tmpl,v >retrieving revision 1.5 >diff -u -r1.5 header.html.tmpl >--- template/en/default/global/header.html.tmpl 21 Feb 2008 17:03:57 -0000 1.5 >+++ template/en/default/global/header.html.tmpl 2 Apr 2008 21:29:18 -0000 >@@ -75,6 +75,11 @@ > </script> > [% END %] > >+ [%# REDHAT EXTENSION START 426382 >+ # Add setcookie() to track javascript capability %] >+ <script src="js/cookies.js" type="text/javascript" language="JavaScript"></script> >+ [%# REDHAT EXTENSION END 426382 %] >+ > [% IF javascript_urls %] > [% FOREACH javascript_url = javascript_urls %] > <script src="[% javascript_url FILTER html %]" type="text/javascript"></script> >@@ -227,7 +232,8 @@ > # but set the onload attribute in the DEFAULT directive above. > #%] > >- <body onload="[% onload %]" >+ [%# REDHAT EXTENSION 426382 Add setcookie() to track javascript capability %] >+ <body onload="setcookie('Bugzilla_javascript',1,1,'[% Param('cookiepath') %]','[% Param('cookiedomain') %]',1); [% onload %]" > class="[% urlbase.replace('^https?://','').replace('/$','').replace('[-~@:/.]+','-') %] > [% FOREACH class = bodyclasses %] > [% ' ' %][% class FILTER css_class_quote %] >@@ -276,3 +282,8 @@ > [% IF message %] > <div id="message">[% message %]</div> > [% END %] >+ >+[%# REDHAT EXTENSION 426382 Debugging purposes only, will remove when checked in %] >+[% IF user.javascript %] >+<div id="message">JAVASCRIPT ENABLED</div> >+[% END %]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
nelhawar
: review+
kbaker
: review+
Actions:
View
|
Diff
Attachments on
bug 426386
:
299968
|
300139
|
302670
|
302676