← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9217: Removed the oops page. Impl a solution where the old error page is used, but when running as port...

 

------------------------------------------------------------
revno: 9217
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-12-07 22:28:50 +0100
message:
  Removed the oops page. Impl a solution where the old error page is used, but when running as portal the stacktrace is hidden. One exception is for standard reports, where we need to see the stack trace for debugging purposes.
removed:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/error.html
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/exception.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-portal/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2012-11-30 18:17:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2012-12-07 21:28:50 +0000
@@ -85,7 +85,9 @@
     final String DEFAULT_APPLICATION_TITLE = "District Health Information Software 2";
     
     final int DEFAULT_COMPLETENESS_OFFSET = 15;
-    final String DEFAULT_TIME_FOR_SENDING_MESSAGE = "08:00";
+    final String DEFAULT_TIME_FOR_SENDING_MESSAGE = "08:00";    
+    
+    final String SYSPROP_PORTAL = "runningAsPortal";
     
     final HashSet<String> DEFAULT_SCHEDULED_PERIOD_TYPES = new HashSet<String>() { {
         add( MonthlyPeriodType.NAME ); 

=== removed file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/error.html'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/error.html	2012-03-16 18:28:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/error.html	1970-01-01 00:00:00 +0000
@@ -1,62 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-    <head>
-        <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><title>DHIS 2 - Error Occurred</title>
-        <style type="text/css">
-            body
-            {
-                color: white;
-                background-color: #1d5288;
-                margin: 0px
-            }
-
-            #horizon
-            {
-                color: white;
-                background-color: transparent;
-                text-align: center;
-                position: absolute;
-                top: 30%;
-                left: 0px;
-                width: 100%;
-                height: 1px;
-                overflow: visible;
-                visibility: visible;
-                display: block
-            }
-
-            #content
-            {
-                font-family: sans-serif;
-                background-color: transparent;
-            }
-
-            #logo
-            {
-                margin-bottom: 20px;
-                
-            }
-
-            .bodytext
-            {
-                font-size: 14px
-            }
-
-            .headline
-            {
-                font-weight: bold;
-                font-size: 24px
-            }
-        </style>
-    </head>
-    <body>
-        <div id="horizon">
-            <div id="content">
-                <div class="bodytext">
-                    <span class="headline">Oops, something went wrong</span><br>
-					Do not panic, we have recorded it in the log
-                </div>
-            </div>
-        </div>
-    </body>
-</html>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/exception.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/exception.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/exception.vm	2012-12-07 21:28:50 +0000
@@ -66,9 +66,9 @@
     var stackTraceId = 'stackTrace' + idCount;
     var toggleId = 'toggle' + idCount;
     
-    var stackTraceElement = document.getElementById( stackTraceId ); // div
-    var toggleElement = document.getElementById( toggleId );         // span
-    toggleElement = toggleElement.firstChild;                        // a
+    var stackTraceElement = document.getElementById( stackTraceId );
+    var toggleElement = document.getElementById( toggleId );
+    toggleElement = toggleElement.firstChild;
     
     if ( stackTraceElement.style.display == 'none' )
     {
@@ -87,16 +87,14 @@
 </head>
 <body>
 
-## -------------------------------------------------------------------------- ##
-
 <h2>$i18n.getString( "an_exception_occured" )</h2>
 
 <p>$encoder.htmlEncode( $i18n.getString( "exception_explanation_text" ))</p>
 <p><input type="button" value="$encoder.htmlEncode( $i18n.getString( "go_back" ))" onclick="history.go( -1 )"></p>
 
+#if( $runningAsPortal == "false" )
 #printException( $exception $i18n.getString( "exception" ) )
-
-## -------------------------------------------------------------------------- ##
+#end
 
 </body>
 </html>

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2012-11-30 18:17:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2012-12-07 21:28:50 +0000
@@ -38,6 +38,8 @@
 
 import static org.hisp.dhis.setting.SystemSettingManager.*;
 
+import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
+
 /**
  * @author Lars Helge Overland
  */
@@ -94,6 +96,8 @@
         map.put( KEY_ACCOUNT_RECOVERY, systemSettingManager.getSystemSetting( KEY_ACCOUNT_RECOVERY, false ) );
         map.put( KEY_CONFIGURATION, configurationService.getConfiguration() );
         
+        map.put( SYSPROP_PORTAL, defaultIfEmpty( System.getProperty( SYSPROP_PORTAL ), String.valueOf( false ) ) );
+        
         invocation.getStack().push( map );
         
         return invocation.invoke();

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-11-20 14:43:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-12-07 21:28:50 +0000
@@ -6,7 +6,7 @@
 
 no_page_specified=No page specified
 an_exception_occured=An exception occurred
-exception_explanation_text=Sorry! The system failed to execute the operation. Usually, no data is lost and you can continue working by going back to the previous page. If you wish to report the incident, please save this page by choosing "File -> Save (page as)" in your browser and include the saved page in the report. The problem details are listed below.
+exception_explanation_text=Sorry! The system failed to execute the operation. Usually, no data is lost and you can continue working by going back to the previous page.
 exception=Exception
 caused_by=Caused by
 unknown_source=Unknown source

=== modified file 'dhis-2/dhis-web/dhis-web-portal/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-portal/src/main/resources/META-INF/dhis/beans.xml	2012-10-23 14:04:27 +0000
+++ dhis-2/dhis-web/dhis-web-portal/src/main/resources/META-INF/dhis/beans.xml	2012-12-07 21:28:50 +0000
@@ -4,4 +4,15 @@
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd";>
       
+ <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+    <property name="targetClass" value="java.lang.System"/>
+    <property name="targetMethod" value="setProperty"/>
+    <property name="arguments">
+      <list>
+        <value>runningAsPortal</value>
+        <value>true</value>
+      </list>
+    </property>
+  </bean>
+      
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml'
--- dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml	2012-12-06 21:55:24 +0000
+++ dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml	2012-12-07 21:28:50 +0000
@@ -154,11 +154,5 @@
     <servlet-name>webapi-fred</servlet-name>
     <url-pattern>/api-fred/*</url-pattern>
   </servlet-mapping>
-
-  <!-- Error page -->
-
-  <error-page>
-    <exception-type>java.lang.Throwable</exception-type>
-    <location>/error.html</location>
-  </error-page>
+  
 </web-app>