Changeset 7395


Ignore:
Timestamp:
Jun 12, 2017, 10:44:36 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2091: Add a configuration setting for application title

A new configuration setting in base.config:

  • app.title
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/base.config

    r6600 r7395  
    206206# General section
    207207# ===============
     208
     209# Title that is displayed in the browser tab. Use $VERSION to include
     210# the current BASE version and $SERVER to include the server name.
     211app.title = BASE $VERSION @ $SERVER
    208212
    209213# The path to the directory where uploaded files are stored
  • trunk/doc/src/docbook/appendix/base.config.xml

    r6468 r7395  
    700700  <simplesect id="appendix.base.config.other">
    701701    <title>Other settings</title>
    702    
     702
    703703    <variablelist>
     704    <varlistentry>
     705      <term><property>app.title</property></term>
     706      <listitem>
     707        <para>
     708        The title that is displayed in the browser tab. Use <code>$VERSION</code>
     709        to include the current BASE version and <code>$SERVER</code> to include the
     710        server name.
     711          </para>
     712      </listitem>
     713    </varlistentry>
     714
    704715    <varlistentry>
    705716      <term><property>userfiles</property></term>
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Head.java

    r7217 r7395  
    338338      appendStyles(sb, fontStyles, !"display".equals(longTexts), skinContext);
    339339      appendScripts(sb, skinContext);
    340      
    341       String title = page.getTitle();
    342       if (title == null)
    343       {
    344         title = page.getBaseVersion() + " @ " + page.getServerName();
    345       }
    346       sb.append("\t<title>").append(title).append("</title>\n");
     340
     341      sb.append("\t<title>").append(page.getTitle()).append("</title>\n");
    347342    }
    348343
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Page.java

    r7217 r7395  
    2727
    2828import net.sf.basedb.core.Application;
     29import net.sf.basedb.core.Config;
    2930import net.sf.basedb.core.SessionControl;
    3031import net.sf.basedb.core.Version;
     
    212213  private static String BASE_VERSION = null;
    213214 
     215  /**
     216    The default page title.
     217    @since 3.12
     218  */
     219  private static String DEFAULT_PAGE_TITLE = null;
     220 
    214221  private static String MAX_URL_LENGTH = null;
    215222
     
    245252    MAX_URL_LENGTH = maxUrlLength > 0 ? String.valueOf(maxUrlLength) : null;
    246253    ROOT = ((HttpServletRequest)pageContext.getRequest()).getContextPath()+"/";
    247     BASE_VERSION = "BASE " + Version.getMajor() + "." +
    248       Version.getMinor() + "." + Version.getMaintenance() + Version.getSuffix();
     254    BASE_VERSION = Version.getMajor() + "." + Version.getMinor() + "." + Version.getMaintenance() + Version.getSuffix();
    249255    SERVER_NAME = Application.getHostName();
     256    DEFAULT_PAGE_TITLE = Config.getString("app.title", "BASE $VERSION @ $SERVER")
     257      .replace("$VERSION", BASE_VERSION)
     258      .replace("$SERVER", SERVER_NAME);
    250259    initialized = true;
    251260  }
     
    269278  public String getTitle()
    270279  {
    271     return title;
     280    return title == null ? DEFAULT_PAGE_TITLE : title;
    272281  }
    273282 
Note: See TracChangeset for help on using the changeset viewer.