header-warnings.jsp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <%--
  2. ~ Password Management Servlets (PWM)
  3. ~ http://code.google.com/p/pwm/
  4. ~
  5. ~ Copyright (c) 2006-2009 Novell, Inc.
  6. ~ Copyright (c) 2009-2015 The PWM Project
  7. ~
  8. ~ This program is free software; you can redistribute it and/or modify
  9. ~ it under the terms of the GNU General Public License as published by
  10. ~ the Free Software Foundation; either version 2 of the License, or
  11. ~ (at your option) any later version.
  12. ~
  13. ~ This program is distributed in the hope that it will be useful,
  14. ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ~ GNU General Public License for more details.
  17. ~
  18. ~ You should have received a copy of the GNU General Public License
  19. ~ along with this program; if not, write to the Free Software
  20. ~ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. --%>
  22. <%@ page import="password.pwm.AppProperty" %>
  23. <%@ page import="password.pwm.Permission" %>
  24. <%@ page import="password.pwm.PwmApplication" %>
  25. <%@ page import="password.pwm.PwmConstants" %>
  26. <%@ page import="password.pwm.http.PwmURL" %>
  27. <%
  28. boolean includeHeader = false;
  29. boolean adminUser = false;
  30. boolean configMode = false;
  31. try {
  32. final PwmRequest pwmRequest = PwmRequest.forRequest(request, response);
  33. final PwmApplication.MODE applicationMode = pwmRequest.getPwmApplication().getApplicationMode();
  34. configMode = applicationMode == PwmApplication.MODE.CONFIGURATION;
  35. adminUser = pwmRequest.getPwmSession().getSessionManager().checkPermission(pwmRequest.getPwmApplication(), Permission.PWMADMIN);
  36. if (Boolean.parseBoolean(pwmRequest.getConfig().readAppProperty(AppProperty.CLIENT_WARNING_HEADER_SHOW))) {
  37. if (!new PwmURL(request).isConfigManagerURL()) {
  38. if (configMode || PwmConstants.TRIAL_MODE) {
  39. includeHeader = true;
  40. } else if (pwmRequest.isAuthenticated()) {
  41. if (adminUser && !pwmRequest.isForcedPageView()) {
  42. includeHeader = true;
  43. }
  44. }
  45. }
  46. }
  47. } catch (Exception e) {
  48. /* noop */
  49. }
  50. %>
  51. <% if (includeHeader) { %>
  52. <pwm:script-ref url="/public/resources/js/configmanager.js"/>
  53. <pwm:script-ref url="/public/resources/js/admin.js"/>
  54. <pwm:script>
  55. <script type="text/javascript">
  56. PWM_GLOBAL['startupFunctions'].push(function(){
  57. PWM_CONFIG.initConfigHeader();
  58. });
  59. </script>
  60. </pwm:script>
  61. <div id="header-warning" style="display: none">
  62. <div class="header-warning-row header-warning-version"><%=PwmConstants.PWM_APP_NAME_VERSION%></div>
  63. <div id="header-warning-message" class="header-warning-row header-warning-message">
  64. <% if (PwmConstants.TRIAL_MODE) { %>
  65. <pwm:display key="Header_TrialMode" bundle="Admin" value1="<%=PwmConstants.PWM_APP_NAME%>"/>
  66. <% } else if (configMode) { %>
  67. <pwm:display key="Header_ConfigModeActive" bundle="Admin" value1="<%=PwmConstants.PWM_APP_NAME%>"/>
  68. <pwm:if test="showIcons"><span id="icon-configModeHelp" class="btn-icon fa fa-question-circle"></span></pwm:if>
  69. <br/><br/>
  70. <% } else if (adminUser) { %>
  71. <pwm:display key="Header_AdminUser" bundle="Admin" value1="<%=PwmConstants.PWM_APP_NAME%>"/>
  72. <% } %>
  73. </div>
  74. <div class="header-warning-row header-warning-buttons">
  75. <a class="header-warning-button" id="header_configManagerButton">
  76. <pwm:if test="showIcons"><span class="btn-icon fa fa-gears"></span></pwm:if>
  77. <pwm:display key="MenuItem_ConfigManager" bundle="Admin"/>
  78. </a>
  79. <a class="header-warning-button" id="header_configEditorButton">
  80. <pwm:if test="showIcons"><span class="btn-icon fa fa-edit"></span></pwm:if>
  81. <pwm:display key="MenuItem_ConfigEditor" bundle="Admin"/>
  82. </a>
  83. <% if (adminUser) { %>
  84. <a class="header-warning-button" href="<pwm:url url="/private/admin"/>">
  85. <pwm:if test="showIcons"><span class="btn-icon fa fa-list-alt"></span></pwm:if>
  86. <pwm:display key="Title_Admin"/>
  87. </a>
  88. <pwm:if test="forcedPageView" negate="true">
  89. <a class="header-warning-button" id="header_openLogViewerButton">
  90. <pwm:if test="showIcons"><span class="btn-icon fa fa-list-alt"></span></pwm:if>
  91. <pwm:display key="MenuItem_ViewLog" bundle="Config"/>
  92. &nbsp;
  93. <pwm:if test="showIcons"><span class="btn-icon fa fa-external-link"></span></pwm:if>
  94. </a>
  95. </pwm:if>
  96. <% } %>
  97. </div>
  98. <div id="panel-header-healthData" class="header-warning-row header-warning-healthData"></div>
  99. <div id="button-closeHeader" title="<pwm:display key="Button_Hide"/>">
  100. <span class="fa fa-chevron-circle-right"></span>
  101. </div>
  102. </div>
  103. <div id="button-openHeader" title="<pwm:display key="Button_Show"/>">
  104. <span class="fa fa-chevron-circle-left"></span>
  105. </div>
  106. <% } %>