Skip to content

Commit dc26274

Browse files
Jens Elknervladak
authored andcommitted
make index_body.html an include like {header,footer}_include
fixes #533
1 parent 27fc859 commit dc26274

File tree

6 files changed

+39
-38
lines changed

6 files changed

+39
-38
lines changed

README.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
33
#
44

55

@@ -421,14 +421,16 @@ web.xml of source.war file and change them (see note1) appropriately.
421421
* DATA_ROOT: absolute path of the directory where OpenGrok data
422422
files are stored
423423

424-
- Header file 'header_include' can be created under DATA_ROOT.
425-
The contents of this file file will be appended to the header of each
424+
- File 'header_include' can be created under DATA_ROOT.
425+
The contents of this file will be appended to the header of each
426426
web page after the OpenGrok logo element.
427-
- Footer file 'footer_include' can be created under DATA_ROOT.
428-
The contents of this file file will be appended to the footer of each
427+
- File 'footer_include' can be created under DATA_ROOT.
428+
The contents of this file will be appended to the footer of each
429429
web page after the information about last index update.
430-
- The body of the home page can be changed by updating index_body.html
431-
under the webapp directory.
430+
- The file 'body_include' can be created under DATA_ROOT.
431+
The contents of this file will be inserted above the footer of the web
432+
application's "Home" page.
433+
432434

433435
5.4.3 - Path Descriptions (optional)
434436
------------------------------------

build.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
965965
<fileset dir="${web.src.dir}">
966966
<include name="**/*.jsp"/>
967967
<include name="**/*.jspf"/>
968-
<include name="**/index_body.html"/>
969968
</fileset>
970969
</copy>
971970
<jasper validateXml="false"

doc/EXAMPLE.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ SRC_ROOT=/opengrok/source
3434
DATA_ROOT=/opengrok/data
3535
EXUB_CTAGS=/absolute/path/to/Exubrant/Ctags
3636

37-
The last thing we need to do is to configure the web application. To do so,
37+
The last thing we need to do is to configure the web application. To do so,
3838
please execute the following commands:
3939
$ mkdir /opengrok/web/source
4040
$ cd /opengrok/web/source
4141
$ unzip /path/to/opengrok-release/source.war
4242

4343
edit WEB-INF/web.xml and specify SRC_ROOT and DATA_ROOT.
4444

45-
You may also want to modify the file index_body.html before you re-create
46-
the war-file with the following commands:
45+
re-create the war-file with the following commands:
4746

4847
$ cd /opengrok/web/source
4948
$ zip -r /opengrok/web/source.war

src/org/opensolaris/opengrok/configuration/Configuration.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* CDDL HEADER END
1818
*/
1919

20-
/*
21-
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
20+
/*
21+
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opensolaris.opengrok.configuration;
2424

@@ -826,6 +826,7 @@ private static String getFileContent(File file) {
826826
*
827827
* @return an empty string if it could not be read successfully, the
828828
* contents of the file otherwise.
829+
* @see #FOOTER_INCLUDE_FILE
829830
*/
830831
public String getFooterIncludeFileContent() {
831832
if (footer == null) {
@@ -847,6 +848,7 @@ public String getFooterIncludeFileContent() {
847848
*
848849
* @return an empty string if it could not be read successfully, the
849850
* contents of the file otherwise.
851+
* @see #HEADER_INCLUDE_FILE
850852
*/
851853
public String getHeaderIncludeFileContent() {
852854
if (header == null) {
@@ -855,6 +857,27 @@ public String getHeaderIncludeFileContent() {
855857
return header;
856858
}
857859

860+
/**
861+
* The name of the file relative to the <var>DATA_ROOT</var>, which should
862+
* be included into the body of web app's "Home" page.
863+
*/
864+
public static final String BODY_INCLUDE_FILE = "body_include";
865+
866+
private transient String body = null;
867+
868+
/**
869+
* Get the contents of the body include file.
870+
* @return an empty string if it could not be read successfully, the
871+
* contents of the file otherwise.
872+
* @see Configuration#BODY_INCLUDE_FILE
873+
*/
874+
public String getBodyIncludeFileContent() {
875+
if (body == null) {
876+
body = getFileContent(new File(getDataRoot(), BODY_INCLUDE_FILE));
877+
}
878+
return body;
879+
}
880+
858881
/**
859882
* Get the eftar file, which contains definition tags.
860883
*

web/index.jsp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ include file="menu.jspf"
4747
4848
%></div>
4949
</div>
50-
<div id="results"><%@
51-
52-
include file="index_body.html"
53-
54-
%>
50+
<div id="results">
51+
<%= cfg.getEnv().getConfiguration().getBodyIncludeFileContent() %>
52+
</div>
5553
<%@
5654
5755
include file="repos.jspf"

web/index_body.html

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)