[Rt-commit] rt branch, 5.0/lifecycle-ui, updated. rt-5.0.0alpha1-114-g2f31c22083

? sunnavy sunnavy at bestpractical.com
Thu Apr 23 16:33:31 EDT 2020


The branch, 5.0/lifecycle-ui has been updated
       via  2f31c2208383ac95c9c43fb0602a13bda5e7b82d (commit)
      from  ccbbb16f1e2340867ae9ceb7f86f0063e1ac8180 (commit)

Summary of changes:
 lib/RT/Interface/Web.pm                   | 5 +++++
 lib/RT/Interface/Web/MenuBuilder.pm       | 4 +++-
 share/html/Admin/Lifecycles/Advanced.html | 4 ++++
 share/html/Admin/Lifecycles/Modify.html   | 7 +++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 2f31c2208383ac95c9c43fb0602a13bda5e7b82d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 23 08:26:34 2020 +0800

    Redirect to Advanced page on lifecycle modify page for IE
    
    The fancy Modify page doesn't work on IE mainly because of javascript's
    modern syntax/methods(ES6+).

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index a002213040..b23a1f6ba6 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1885,6 +1885,11 @@ sub RequestENV {
     return $name ? $env->{$name} : $env;
 }
 
+sub ClientIsIE {
+    # IE 11.0 dropped "MSIE", so we can't use that alone
+    return RequestENV('HTTP_USER_AGENT') =~ m{MSIE|Trident/} ? 1 : 0;
+}
+
 package HTML::Mason::Commands;
 
 use vars qw/$r $m %session/;
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 7530a95937..f91162c434 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -1287,7 +1287,9 @@ sub _BuildAdminMenu {
                 RT::Interface::Web::EscapeURI(\$Name_uri);
                 RT::Interface::Web::EscapeURI(\$Type_uri);
 
-                $page->child( basics => title => loc('Modify'),  path => "/Admin/Lifecycles/Modify.html?Type=" . $Type_uri . "&Name=" . $Name_uri );
+                unless ( RT::Interface::Web->ClientIsIE ) {
+                    $page->child( basics => title => loc('Modify'),  path => "/Admin/Lifecycles/Modify.html?Type=" . $Type_uri . "&Name=" . $Name_uri );
+                }
                 $page->child( actions => title => loc('Actions'), path => "/Admin/Lifecycles/Actions.html?Type=" . $Type_uri . "&Name=" . $Name_uri );
                 $page->child( rights => title => loc('Rights'), path => "/Admin/Lifecycles/Rights.html?Type=" . $Type_uri . "&Name=" . $Name_uri );
                 $page->child( mappings => title => loc('Mappings'),  path => "/Admin/Lifecycles/Mappings.html?Type=" . $Type_uri . "&Name=" . $Name_uri );
diff --git a/share/html/Admin/Lifecycles/Advanced.html b/share/html/Admin/Lifecycles/Advanced.html
index d7e360723a..a5051c5033 100644
--- a/share/html/Admin/Lifecycles/Advanced.html
+++ b/share/html/Admin/Lifecycles/Advanced.html
@@ -87,6 +87,10 @@ $title = loc("Modify lifecycle [_1]", $LifecycleObj->Name);
 
 $Config ||= JSON::to_json(RT->Config->Get('Lifecycles')->{$LifecycleObj->Name}, { canonical => 1, pretty => 1 });
 
+if ( $ARGS{RedirectedFromModify} && RT::Interface::Web->ClientIsIE() ) {
+    push @results, loc("Modify page does not support IE, please use a modern browser or current Advanced page instead");
+}
+
 if ( $Validate || $Update ) {
     my $lifecycle = JSON::from_json($Config);
     my ( $valid, @warnings )
diff --git a/share/html/Admin/Lifecycles/Modify.html b/share/html/Admin/Lifecycles/Modify.html
index 33eaa04be9..9b2015d3dd 100644
--- a/share/html/Admin/Lifecycles/Modify.html
+++ b/share/html/Admin/Lifecycles/Modify.html
@@ -68,6 +68,13 @@
   </div>
 </form>
 <%INIT>
+
+if ( RT::Interface::Web->ClientIsIE() ) {
+    RT::Interface::Web::Redirect( RT->Config->Get('WebURL')
+            . "Admin/Lifecycles/Advanced.html?"
+            . $m->comp( '/Elements/QueryString', %ARGS, RedirectedFromModify => 1 ) );
+}
+
 my ($title, @results);
 my $LifecycleObj = RT::Lifecycle->new();
 $LifecycleObj->Load(Name => $Name, Type => $Type);

-----------------------------------------------------------------------


More information about the rt-commit mailing list