Importing SVN archives - B6M1
This commit is contained in:
commit
fc4c6bd340
1695 changed files with 98617 additions and 0 deletions
legacyworlds-web/legacyworlds-web-admin
.classpath.projectpom.xml
.settings
.jsdtscopeorg.eclipse.jdt.core.prefsorg.eclipse.wst.common.componentorg.eclipse.wst.common.project.facet.core.xmlorg.eclipse.wst.jsdt.ui.superType.containerorg.eclipse.wst.jsdt.ui.superType.nameorg.eclipse.wst.ws.service.policy.prefsorg.maven.ide.eclipse.prefs
WebContent
META-INF
WEB-INF
admin-servlet.xml
fm
ROOT.ftl
web.xmlcontainers
layout
types
addAdmin.ftladmins.ftlbanReject.ftlbanRequest.ftlbans.ftlbansSummary.ftlbugsList.ftlbugsReport.ftlbugsSummary.ftlbugsTabs.ftlbugsView.ftlchangePassword.ftlconstants.ftllanguage.ftllanguages.ftllogEntry.ftllogin.ftllogs.ftlmain.ftlmaintenance.ftlmessage.ftlmessageBox.ftlmessageTabs.ftlmessageWriter.ftlnames.ftlnamesSummary.ftloffline.ftlpreferences.ftlresetAdmin.ftlspam.ftlticker.ftluser.ftluserSessions.ftlusers.ftlviewAdmin.ftl
version.ftlcss
src/main
java/com/deepclone/lw/web/admin
BanhammerPages.javaBugTrackerPages.javaConstantsPages.javaErrorHandlerBean.javaI18NPages.javaLogPages.javaLoginPage.javaMaintenancePages.javaMessageBoxView.javaMessagesPages.javaNamesPages.javaPasswordPages.javaPreferencesPages.javaSessionPages.javaSpamPages.javaSuperUserPages.javaTickerPages.javaUsersPages.java
i18ne
resources
25
legacyworlds-web/legacyworlds-web-admin/.classpath
Normal file
25
legacyworlds-web/legacyworlds-web-admin/.classpath
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry exported="true" kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="jst.web"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-openjdk">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="jst.java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
37
legacyworlds-web/legacyworlds-web-admin/.project
Normal file
37
legacyworlds-web/legacyworlds-web-admin/.project
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>legacyworlds-web-admin</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
11
legacyworlds-web/legacyworlds-web-admin/.settings/.jsdtscope
Normal file
11
legacyworlds-web/legacyworlds-web-admin/.settings/.jsdtscope
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
|
@ -0,0 +1,8 @@
|
|||
#Thu Apr 15 19:33:04 CEST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="legacyworlds-web-admin">
|
||||
<wb-resource deploy-path="/" source-path="/WebContent"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
|
||||
<property name="context-root" value="legacyworlds-web-admin"/>
|
||||
<property name="java-output-path" value="/legacyworlds-web-admin/target/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<runtime name="Apache Tomcat v6.0"/>
|
||||
<installed facet="jst.java" version="6.0"/>
|
||||
<installed facet="jst.web" version="2.4"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
|||
Window
|
|
@ -0,0 +1,3 @@
|
|||
#Mon Apr 19 12:39:12 CEST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.wst.ws.service.policy.projectEnabled=false
|
|
@ -0,0 +1,9 @@
|
|||
#Thu Apr 15 19:11:01 CEST 2010
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
|
@ -0,0 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<context:annotation-config />
|
||||
<context:component-scan base-package="com.deepclone.lw.web.admin" />
|
||||
|
||||
<!-- FreeMarker templating library -->
|
||||
<bean id="freemarkerConfig"
|
||||
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
|
||||
<property name="templateLoaderPath" value="/WEB-INF/fm/" />
|
||||
<property name="freemarkerVariables">
|
||||
<map>
|
||||
<entry key="xml_escape" value-ref="fmXmlEscape" />
|
||||
</map>
|
||||
</property>
|
||||
<property name="freemarkerSettings">
|
||||
<props>
|
||||
<prop key="default_encoding">UTF-8</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape" />
|
||||
|
||||
<!-- Session service connector -->
|
||||
<bean id="sessionSrv" class="org.springframework.remoting.rmi.RmiProxyFactoryBean"
|
||||
scope="prototype">
|
||||
<property name="serviceInterface" value="com.deepclone.lw.session.SessionAccessor" />
|
||||
<property name="serviceUrl" value="rmi://localhost:9137/sessionSrv" />
|
||||
</bean>
|
||||
|
||||
<!-- General web beans -->
|
||||
<bean id="sessionClient" class="com.deepclone.lw.web.beans.session.SessionClientBean"
|
||||
scope="singleton" />
|
||||
<bean id="xhtmlOnIE"
|
||||
class="com.deepclone.lw.web.beans.intercept.IEContentTypeBean"
|
||||
scope="singleton" />
|
||||
<bean id="sessionInterceptor"
|
||||
class="com.deepclone.lw.web.beans.intercept.SessionInterceptorBean"
|
||||
scope="singleton" />
|
||||
<bean id="messageFormatter"
|
||||
class="com.deepclone.lw.web.beans.msgs.MessageFormatterBean"
|
||||
scope="singleton" />
|
||||
|
||||
<!-- Interceptors -->
|
||||
<bean id="annotationMapper"
|
||||
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
|
||||
<property name="interceptors">
|
||||
<list>
|
||||
<ref bean="sessionInterceptor" />
|
||||
<ref bean="xhtmlOnIE" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Error handler -->
|
||||
<bean id="errorHandler" class="com.deepclone.lw.web.admin.ErrorHandlerBean" />
|
||||
|
||||
<!-- View resolver -->
|
||||
<bean id="viewResolver"
|
||||
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
|
||||
<property name="cache" value="true" />
|
||||
<property name="prefix" value="" />
|
||||
<property name="suffix" value=".ftl" />
|
||||
<property name="contentType" value="application/xhtml+xml;charset=UTF-8" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,11 @@
|
|||
<#setting url_escaping_charset='UTF-8'>
|
||||
<#setting number_format='computer'>
|
||||
<#include "/version.ftl">
|
||||
<#include "/layout/columns.ftl">
|
||||
<#include "/layout/datatable.ftl">
|
||||
<#include "/layout/fields.ftl">
|
||||
<#include "/layout/form.ftl">
|
||||
<#include "/layout/lists.ftl">
|
||||
<#include "/layout/tabs.ftl">
|
||||
<#include "containers/${container}.ftl" />
|
||||
<#include "types/${type}.ftl" />
|
|
@ -0,0 +1,20 @@
|
|||
<#macro page title>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>LW Beta 6 <@version/> Administration - ${title?xhtml}</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>Legacy Worlds administration interface</h1>
|
||||
<h3><@full_version /></h3>
|
||||
<h2>${title?xhtml}</h2>
|
||||
</div>
|
||||
<div class="page-contents page-full">
|
||||
<#nested>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</#macro>
|
|
@ -0,0 +1,72 @@
|
|||
<#macro page title>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>LW Beta 6 <@version/> Administration - ${title?xhtml}</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>Legacy Worlds administration interface</h1>
|
||||
<h3><@full_version /></h3>
|
||||
<h2>${title?xhtml}</h2>
|
||||
</div>
|
||||
|
||||
<div class="page-full">
|
||||
<div class="side-bar">
|
||||
<div class="admin">${data.admin.name?xhtml}</div>
|
||||
<#if !data.admin.passwordChange>
|
||||
<a href="main">Overview</a>
|
||||
<p> </p>
|
||||
|
||||
<#local admin = data.admin>
|
||||
<a href="messages">Messages</a>
|
||||
<#if admin.canSpam>
|
||||
<a href="send-spam">Send spam</a>
|
||||
</#if>
|
||||
<#if admin.userAdmin>
|
||||
<a href="users">Users</a>
|
||||
</#if>
|
||||
<#if admin.banhammerUser>
|
||||
<a href="bans">Banhammer</a>
|
||||
</#if>
|
||||
<#if admin.nameAdmin>
|
||||
<a href="names">Names</a>
|
||||
</#if>
|
||||
<#if admin.bugTrackerAdmin>
|
||||
<a href="btracker">Bug tracker</a>
|
||||
</#if>
|
||||
<#if admin.translator>
|
||||
<a href="i18n">Translations</a>
|
||||
</#if>
|
||||
<#if admin.prefAdmin>
|
||||
<a href="prefs">Default preferences</a>
|
||||
</#if>
|
||||
<#if admin.constantsAdmin>
|
||||
<a href="constants">Constants</a>
|
||||
</#if>
|
||||
<#if admin.tickAdmin>
|
||||
<a href="ticker">Ticker</a>
|
||||
</#if>
|
||||
<#if admin.maintenanceAdmin>
|
||||
<a href="maintenance">Maintenance mode</a>
|
||||
</#if>
|
||||
<#if admin.canViewLogs>
|
||||
<a href="logs">Logs</a>
|
||||
</#if>
|
||||
|
||||
<#if admin.superuser>
|
||||
<a href="admins">Administrators</a>
|
||||
</#if>
|
||||
<p> </p>
|
||||
</#if>
|
||||
<a href="logout.action">Log out</a>
|
||||
</div>
|
||||
<div class="page-contents">
|
||||
<#nested>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</#macro>
|
|
@ -0,0 +1,18 @@
|
|||
<#macro left_column width=0>
|
||||
<#if width gt 0>
|
||||
<div class="left-column" style="width: ${width}px">
|
||||
<#else>
|
||||
<div class="column left-column">
|
||||
</#if>
|
||||
<#nested>
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro right_column width=0>
|
||||
<#if width gt 0>
|
||||
<div style="width: ${width}px; padding: 0 0 0 ${width}px">
|
||||
<#else>
|
||||
<div class="column right-column">
|
||||
</#if>
|
||||
<#nested>
|
||||
</div>
|
||||
</#macro>
|
|
@ -0,0 +1,20 @@
|
|||
<#macro dt_main title="">
|
||||
<table class="data-table">
|
||||
<#if title != "">
|
||||
<tr><th colspan="2" class="title">${title}</th></tr>
|
||||
</#if>
|
||||
<#nested>
|
||||
</table>
|
||||
</#macro>
|
||||
<#macro dt_entry title abbr="" width=0>
|
||||
<tr>
|
||||
<th<#if width gt 0> style="width: ${width}px"</#if>><#if title == ""> <#else><#if abbr != ""><abbr title="${title?xhtml}">${abbr?xhtml}</abbr><#else>${title?xhtml}</#if>:</#if></th>
|
||||
<td><#nested></td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro dt_blank>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
</#macro>
|
||||
<#macro dt_status>
|
||||
<tr><td colspan="2" class="status"><#nested></td></tr>
|
||||
</#macro>
|
|
@ -0,0 +1,20 @@
|
|||
<#macro ff_text name value id="" maxLength=0 size=0>
|
||||
<input class="input" id="ff-${id?xhtml}" type="text" value="${value?xhtml}" name="${name?xhtml}" <#if maxLength gt 0>maxlength="${maxLength?string}"</#if> <#if size gt 0>size="${size?string}"</#if> />
|
||||
</#macro>
|
||||
<#macro ff_pwd id name>
|
||||
<input class="input" id="ff-${id?xhtml}" type="password" name="${name?xhtml}" />
|
||||
</#macro>
|
||||
<#macro ff_select id name style="">
|
||||
<select class="input" name="${name?xhtml}" id="ff-${id?xhtml}" <#if style != "">style="${style}"</#if>>
|
||||
<#nested>
|
||||
</select>
|
||||
</#macro>
|
||||
<#macro ff_checkbox id name value checked=false>
|
||||
<input class="input" type="checkbox" name="${name?xhtml}" id="ff-${id?xhtml}" value="${value?xhtml}" <#if checked>checked="checked"</#if> />
|
||||
</#macro>
|
||||
<#macro form_option text="" selected=false value="">
|
||||
<option<#if value?string != ""> value="${value?xhtml}"</#if><#if selected> selected="selected"</#if>><#if text == ""><#nested><#else>${text?xhtml}</#if></option>
|
||||
</#macro>
|
||||
<#macro ff_submit label extraClass="" name="" style="">
|
||||
<input class="input<#if extraClass?has_content> ${extraClass}</#if>" <#if name?has_content>name="${name?xhtml}"</#if> type="submit" value="${label?xhtml}" <#if style != "">style="${style}"</#if> />
|
||||
</#macro>
|
|
@ -0,0 +1,98 @@
|
|||
<#macro form action hash="">
|
||||
<div class="form-container">
|
||||
<form action="${action?url}.action<#if hash != "">#${hash?url}</#if>" method="post">
|
||||
<table>
|
||||
<#nested>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro form_field_line label id>
|
||||
<tr class="form-field">
|
||||
<th><label for="ff-${id?xhtml}">${label?xhtml}:</label></th>
|
||||
<td><#nested></td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro form_text label name value id="" maxLength=0 multiline=false>
|
||||
<#if id = "">
|
||||
<#local id = name>
|
||||
</#if>
|
||||
<@form_field_line label=label id=id>
|
||||
<#if multiline>
|
||||
<textarea class="input" rows="${maxLength}" cols="60" id="ff-${id}" name="${name}" style="height:auto">${value?xhtml}</textarea>
|
||||
<#else>
|
||||
<@ff_text id=id name=name maxLength=maxLenth value=value />
|
||||
</#if>
|
||||
</@form_field_line>
|
||||
</#macro>
|
||||
<#macro form_checkbox label name value id="" checked=false>
|
||||
<#if id = "">
|
||||
<#local id = name>
|
||||
</#if>
|
||||
<@form_field_line label=label id=id>
|
||||
<@ff_checkbox id=id name=name value=value checked=checked />
|
||||
</@form_field_line>
|
||||
</#macro>
|
||||
<#macro form_pwd label name id="">
|
||||
<#if id = "">
|
||||
<#local id = name>
|
||||
</#if>
|
||||
<@form_field_line label=label id=id>
|
||||
<@ff_pwd id=id name=name />
|
||||
</@form_field_line>
|
||||
</#macro>
|
||||
<#macro form_select label name id="">
|
||||
<#if id = "">
|
||||
<#local id = name>
|
||||
</#if>
|
||||
<@form_field_line label=label id=id>
|
||||
<@ff_select id=id name=name>
|
||||
<#nested>
|
||||
</@ff_select>
|
||||
</@form_field_line>
|
||||
</#macro>
|
||||
<#macro form_part title>
|
||||
<tr class="form-part">
|
||||
<th colspan="2">${title}</th>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro form_extra>
|
||||
<tr class="form-extra">
|
||||
<td colspan="2"><#nested></td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro form_error>
|
||||
<tr class="form-error">
|
||||
<td colspan="2"><#nested></td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro standalone_error>
|
||||
<div class="form-container">
|
||||
<table>
|
||||
<tr class="form-error">
|
||||
<td colspan="2"><#nested></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro form_submit label extraClass="">
|
||||
<tr class="form-submit">
|
||||
<th> </th>
|
||||
<td><@ff_submit label=label extraClass=extraClass /></td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro form_extended_submit label extraClass="">
|
||||
<tr class="form-submit">
|
||||
<th> </th>
|
||||
<td><@ff_submit label=label extraClass=extraClass /><#nested /></td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro lineform action name="" hash="">
|
||||
<div class="form-container">
|
||||
<form action="${action?url}.action<#if hash != "">#${hash?url}</#if>" method="post">
|
||||
<table>
|
||||
<tr><td><#nested></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</#macro>
|
|
@ -0,0 +1,25 @@
|
|||
<#macro listview>
|
||||
<table class="list-view">
|
||||
<#nested>
|
||||
</table>
|
||||
</#macro>
|
||||
<#macro lv_line headers=false class="">
|
||||
<tr<#if class != ""> class="${class}<#if headers>headers</#if>"<#elseif headers> class="headers"</#if>>
|
||||
<#nested>
|
||||
</tr>
|
||||
</#macro>
|
||||
<#macro lv_column width=0 centered=false>
|
||||
<#if width?is_string>
|
||||
<th style="text-align: <#if centered>center<#else>left</#if>">
|
||||
<#nested>
|
||||
</th>
|
||||
<#elseif width gt 0>
|
||||
<th style="width: ${width}px; text-align: <#if centered>center<#else>left</#if>">
|
||||
<#nested>
|
||||
</th>
|
||||
<#else>
|
||||
<td style="text-align: <#if centered>center<#else>left</#if>">
|
||||
<#nested>
|
||||
</td>
|
||||
</#if>
|
||||
</#macro>
|
|
@ -0,0 +1,13 @@
|
|||
<#macro tabs>
|
||||
<div class="tabs">
|
||||
<#nested>
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro tab id title>
|
||||
<div class="tab" id="${id?xhtml}">
|
||||
<h3>${title?xhtml}</h3>
|
||||
<div class="tab-contents">
|
||||
<#nested>
|
||||
</div>
|
||||
</div>
|
||||
</#macro>
|
|
@ -0,0 +1,68 @@
|
|||
<#macro render_privs>
|
||||
<#if data.privileges?has_content>
|
||||
<#local source = data.privileges>
|
||||
<#local useSource = true>
|
||||
<#else>
|
||||
<#local source = data.admin.allPrivileges>
|
||||
<#local useSource = false>
|
||||
</#if>
|
||||
<tr class="form-field">
|
||||
<th>Privileges:</th>
|
||||
<td>
|
||||
<#list source as privilege>
|
||||
<#if useSource>
|
||||
<#local value = privilege.present>
|
||||
<#else>
|
||||
<#local value = false>
|
||||
</#if>
|
||||
<input class="input" type="checkbox" name="privileges" value="${privilege.privilege}" id="priv-${privilege.privilege}" <#if value>checked="checked"</#if> />
|
||||
<label for="priv-${privilege.privilege}"><abbr title="${privilege.privilege.description?xhtml}">${privilege.privilege}</abbr></label>
|
||||
</#list>
|
||||
</td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<@page title="Add administrator">
|
||||
<@form action="add-admin">
|
||||
|
||||
<#switch data.addressError!>
|
||||
<#case 'EMPTY'>
|
||||
<@form_error>Please specify the user's address.</@form_error>
|
||||
<#break>
|
||||
<#case 'INVALID'>
|
||||
<@form_error>Invalid address.</@form_error>
|
||||
<#break>
|
||||
<#case 'NOT_FOUND'>
|
||||
<@form_error>User not found.</@form_error>
|
||||
<#break>
|
||||
<#case 'STATUS'>
|
||||
<@form_error>Invalid user status (banned or unconfirmed).</@form_error>
|
||||
<#break>
|
||||
<#case 'ALREADY_ADMIN'>
|
||||
<@form_error>This user is already an administrator.</@form_error>
|
||||
<#break>
|
||||
</#switch>
|
||||
<@form_text label="E-mail address" name="address" value=data.address! />
|
||||
|
||||
<#switch data.nameError!>
|
||||
<#case 'EMPTY'>
|
||||
<@form_error>Please specify a name.</@form_error>
|
||||
<#break>
|
||||
<#case 'INVALID'>
|
||||
<@form_error>Invalid name.</@form_error>
|
||||
<#break>
|
||||
<#case 'UNAVAILABLE'>
|
||||
<@form_error>This name is already in use.</@form_error>
|
||||
<#break>
|
||||
</#switch>
|
||||
<@form_text label="Administrator name" name="name" value=data.name! />
|
||||
|
||||
<#-- Privs -->
|
||||
<#if data.privError!false>
|
||||
<@form_error>Please select the new administrator's privileges.</@form_error>
|
||||
</#if>
|
||||
<@render_privs />
|
||||
|
||||
<@form_submit label="Add administrator" />
|
||||
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,43 @@
|
|||
<#macro render_admin admin>
|
||||
<#if admin.id = data.admin.id>
|
||||
<#local begin = "<strong>">
|
||||
<#local end = "</strong>">
|
||||
<#elseif admin.privileges?size = 0>
|
||||
<#local begin = "<em>">
|
||||
<#local end = "</em>">
|
||||
</#if>
|
||||
|
||||
<@lv_line>
|
||||
<@lv_column><a href="admin-${admin.id}">${begin!}${admin.name?xhtml}${end!}</a></@lv_column>
|
||||
<@lv_column>
|
||||
<#if admin.address?has_content>
|
||||
${begin!}${admin.address?xhtml}${end!}
|
||||
<#else>
|
||||
${begin!}N/A${end!}
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column>
|
||||
<#if admin.privileges?size gt 0>
|
||||
<#list admin.privileges as priv>
|
||||
<abbr title="${priv.description?xhtml}">${priv}</abbr>
|
||||
</#list>
|
||||
<#else>
|
||||
(inactive)
|
||||
</#if>
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
</#macro>
|
||||
<@page title="Administrators">
|
||||
<@listview>
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=300>Name</@lv_column>
|
||||
<@lv_column width=300>Address</@lv_column>
|
||||
<@lv_column width="x">Privileges</@lv_column>
|
||||
</@lv_line>
|
||||
<#list data.administrators as admin>
|
||||
<@render_admin admin=admin />
|
||||
</#list>
|
||||
</@listview>
|
||||
<p><a href="add-admin">Add administrator</a></p>
|
||||
</@page>
|
|
@ -0,0 +1,9 @@
|
|||
<@page title="Reject ban request">
|
||||
<@form action="reject-ban-${data.id}">
|
||||
<#if data.error!false>
|
||||
<@form_error>You must give a reason</@form_error>
|
||||
</#if>
|
||||
<@form_text label="Rejection reason" name="reason" value="" multiline=true maxLength = 10 />
|
||||
<@form_submit label="Reject ban request" />
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,20 @@
|
|||
<@page title="Request ban">
|
||||
<@form action="request-ban">
|
||||
<#switch data.error!"">
|
||||
<#case "NOT_FOUND"><@form_error>User not found</@form_error><#break>
|
||||
<#case "BANNED"><@form_error>User is already banned or has a pending ban request.</@form_error><#break>
|
||||
<#case "NO_REASON"><@form_error>You have no reason!...</@form_error><#break>
|
||||
</#switch>
|
||||
<#if data.empire!false>
|
||||
<#assign eValue = data.user!"" >
|
||||
<#assign mValue = "" >
|
||||
<#else>
|
||||
<#assign mValue = data.user!"" >
|
||||
<#assign eValue = "" >
|
||||
</#if>
|
||||
<@form_text label="Empire name" value="" name="eName" value=eValue />
|
||||
<@form_text label="(or) User address" value="" name="eMail" value=mValue />
|
||||
<@form_text label="Reason" name="reason" value="" multiline=true maxLength=10 value=data.reason!"" />
|
||||
<@form_submit label="Request ban" />
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,75 @@
|
|||
<#if data.type = 'PENDING'>
|
||||
<#assign title = "Pending ban requests">
|
||||
<#elseif data.type = 'ARCHIVED'>
|
||||
<#assign title = "Expired/rejected ban requests">
|
||||
<#else>
|
||||
<#assign title = "Confirmed ban requests">
|
||||
</#if>
|
||||
<@page title=title>
|
||||
<#if data.bans?size = 0>
|
||||
<p>No ban requests in this category.</p>
|
||||
<#else>
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width="x">User address</@lv_column>
|
||||
<@lv_column width="x">Requested by</@lv_column>
|
||||
<@lv_column width="x">Requested on</@lv_column>
|
||||
<@lv_column width="x">Reason</@lv_column>
|
||||
<#if data.type = 'ARCHIVED'>
|
||||
<@lv_column width="x">Cancelled on</@lv_column>
|
||||
<@lv_column width="x">Rejected by</@lv_column>
|
||||
<@lv_column width="x">Rejection reason</@lv_column>
|
||||
<#elseif data.type = 'VALIDATED'>
|
||||
<@lv_column width="x">Validated on</@lv_column>
|
||||
<@lv_column width="x">Validated by</@lv_column>
|
||||
<@lv_column> </@lv_column>
|
||||
<#else>
|
||||
<@lv_column> </@lv_column>
|
||||
</#if>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.bans as ban>
|
||||
<@lv_line>
|
||||
<@lv_column>${ban.accountMail?xhtml}</@lv_column>
|
||||
<@lv_column>${ban.requestedByName?xhtml}</@lv_column>
|
||||
<@lv_column>${ban.timestamp?string("yyyy-MM-dd HH:mm:ss")}</@lv_column>
|
||||
<@lv_column>${ban.reason?xhtml}</@lv_column>
|
||||
<#if data.type = 'ARCHIVED'>
|
||||
<@lv_column>${ban.update?string("yyyy-MM-dd HH:mm:ss")}</@lv_column>
|
||||
<@lv_column>
|
||||
<#if ban.rejectedByName?has_content>
|
||||
${ban.rejectedByName?xhtml}
|
||||
<#else>
|
||||
<em>(expired)</em>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column>
|
||||
<#if ban.rejectedByName?has_content>
|
||||
${ban.rejectionReason?xhtml}
|
||||
<#else>
|
||||
<em>(expired)</em>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<#elseif data.type = 'VALIDATED'>
|
||||
<@lv_column>${ban.update?string("yyyy-MM-dd HH:mm:ss")}</@lv_column>
|
||||
<@lv_column>
|
||||
${ban.validatedByName?xhtml}
|
||||
</@lv_column>
|
||||
<@lv_column>
|
||||
<a href="lift-ban-${ban.id}.action"><#if ban.redeemable>Redeem<#else>Lift ban</#if></a>
|
||||
</@lv_column>
|
||||
<#else>
|
||||
<@lv_column>
|
||||
<#if ban.requestedById != data.admin.id>
|
||||
<a href="confirm-ban-${ban.id}.action">Confirm ban</a> -
|
||||
</#if>
|
||||
<a href="reject-ban-${ban.id}">Reject ban</a>
|
||||
</@lv_column>
|
||||
</#if>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
|
||||
</@listview>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,37 @@
|
|||
<@page title="Banhammer">
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=300> </@lv_column>
|
||||
<@lv_column width=100 centered=true>Entries</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.entries as entry>
|
||||
<@lv_line>
|
||||
<@lv_column>
|
||||
<#if entry.count gt 0>
|
||||
<a href="bans-${entry.type?lower_case}">
|
||||
</#if>
|
||||
<#switch entry.type>
|
||||
<#case "PENDING">
|
||||
Pending requests
|
||||
<#break>
|
||||
<#case "ARCHIVED">
|
||||
Expired and rejected requests
|
||||
<#break>
|
||||
<#case "VALIDATED">
|
||||
Confirmed bans
|
||||
<#break>
|
||||
</#switch>
|
||||
<#if entry.count gt 0>
|
||||
</a>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>${entry.count}</@lv_column>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
|
||||
<p><a href="request-ban">Request ban</a></p>
|
||||
|
||||
</@listview>
|
||||
</@page>
|
|
@ -0,0 +1,151 @@
|
|||
<#include "bugsTabs.ftl">
|
||||
<#macro render_navigation current count total qString>
|
||||
<table style="width:100%;margin: 2px 0">
|
||||
<tr>
|
||||
<td style="width: 30px;text-align: right">
|
||||
<#if current gt 0>
|
||||
<a href="bugs?${qString}&first=${current - count}">
|
||||
</#if>
|
||||
<<
|
||||
<#if current gt 0>
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<#if total gt 1>
|
||||
${total?string(',##0')} entries found.
|
||||
<#elseif total = 1>
|
||||
1 entry found.
|
||||
<#else>
|
||||
No entries found.
|
||||
</#if>
|
||||
</td>
|
||||
<td style="width: 30px;text-align: left">
|
||||
<#if current lt total - count>
|
||||
<a href="bugs?${qString}&first=${current + count}">
|
||||
</#if>
|
||||
>>
|
||||
<#if current lt total - count>
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</#macro>
|
||||
<#macro render>
|
||||
<#if data.ownOnly>
|
||||
<#local ownOnly = "1">
|
||||
<#else>
|
||||
<#local ownOnly = "0">
|
||||
</#if>
|
||||
<#local qString = "status=${data.status!'x'}&own=${ownOnly}" >
|
||||
<@page title="Bug tracker">
|
||||
<#-- Tabs -->
|
||||
<@bugTabs selected="bugsList" qString="${qString}&first=${data.first}" />
|
||||
|
||||
<#-- Selection -->
|
||||
<div class="form-container">
|
||||
<form action="bugs" method="get">
|
||||
<table>
|
||||
<tr><td>
|
||||
List
|
||||
<@ff_select id="sel-own" name="own">
|
||||
<@form_option value="0">all</@form_option>
|
||||
<@form_option value="1" selected=(data.ownOnly)>my own</@form_option>
|
||||
</@ff_select>
|
||||
reports with the following status:
|
||||
<@ff_select id="sel-stat" name="status">
|
||||
<@form_option value="x">(indifferent)</@form_option>
|
||||
<@form_option value="PENDING" selected=((data.status!"") = 'PENDING')>pending validation</@form_option>
|
||||
<@form_option value="OPEN" selected=((data.status!"") = 'OPEN')>being handled</@form_option>
|
||||
<@form_option value="RESOLVED" selected=((data.status!"") = 'RESOLVED')>fixed</@form_option>
|
||||
<@form_option value="WONT_FIX" selected=((data.status!"") = 'WONT_FIX')>won't fix</@form_option>
|
||||
<@form_option value="NOT_A_BUG" selected=((data.status!"") = 'NOT_A_BUG')>not a bug</@form_option>
|
||||
</@ff_select>
|
||||
<@ff_submit label="Search" />
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<#-- Navigation -->
|
||||
<@render_navigation current=data.first count=data.count total=data.entries qString=qString />
|
||||
|
||||
<#-- List of bugs -->
|
||||
<#if data.reports?size gt 0>
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column centered=true width=60>#</@lv_column>
|
||||
<@lv_column width=300>Title</@lv_column>
|
||||
<#if !( data.status?has_content )>
|
||||
<@lv_column width=130 centered=true>Status</@lv_column>
|
||||
</#if>
|
||||
<@lv_column width=150 centered=true>Initial post</@lv_column>
|
||||
<@lv_column width=150 centered=true>Last update</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.reports as report>
|
||||
|
||||
<#if !data.ownOnly && report.initialSubmitter.userId?has_content && report.initialSubmitter.admin && report.initialSubmitter.userId = data.admin.id>
|
||||
<#local eClass="own-fleet">
|
||||
<#else>
|
||||
<#local eClass="">
|
||||
</#if>
|
||||
|
||||
<@lv_line class=eClass>
|
||||
<@lv_column centered=true>${report.reportId?string(",##0")}</@lv_column>
|
||||
<@lv_column><a href="bug-${report.reportId}?${qString}&first=${data.first}">${report.title?xhtml}</a></@lv_column>
|
||||
<#if !( data.status?has_content )>
|
||||
<@lv_column centered=true><@bugStatus status=report.status /></@lv_column>
|
||||
</#if>
|
||||
<@lv_column centered=true>
|
||||
${report.posted?string("yyyy-MM-dd HH:mm:ss")}
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>
|
||||
<#if report.updated>
|
||||
<strong>
|
||||
</#if>
|
||||
${report.lastUpdate?string("yyyy-MM-dd HH:mm:ss")}
|
||||
<#if report.updated>
|
||||
</strong>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
<@lv_line class=eClass>
|
||||
<#if data.status?has_content>
|
||||
<td colspan="2">
|
||||
<#else>
|
||||
<td colspan="3">
|
||||
</#if>
|
||||
</td>
|
||||
<@lv_column centered=true>
|
||||
by
|
||||
<#if report.initialSubmitter.admin>
|
||||
<span style="font-weight:bold">
|
||||
</#if>
|
||||
${report.initialSubmitter.name}
|
||||
<#if report.initialSubmitter.admin>
|
||||
</span>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>
|
||||
by
|
||||
<#if report.latestSubmitter.admin>
|
||||
<span style="font-weight:bold">
|
||||
</#if>
|
||||
${report.latestSubmitter.name}
|
||||
<#if report.latestSubmitter.admin>
|
||||
</span>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
</#list>
|
||||
|
||||
</@listview>
|
||||
</#if>
|
||||
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,42 @@
|
|||
<#include "bugsTabs.ftl">
|
||||
<#macro render>
|
||||
<#if data.query.ownOnly>
|
||||
<#local ownOnly = "1">
|
||||
<#else>
|
||||
<#local ownOnly = "0">
|
||||
</#if>
|
||||
<#local qString = "status=${data.query.status!'x'}&own=${ownOnly}" >
|
||||
<@page title="Bug tracker - Report bug">
|
||||
<@bugTabs selected="bugsReport" qString="${qString}&first=${data.query.first}" />
|
||||
|
||||
<@form action="report-bug">
|
||||
<tr style="display:none"><td colspan="2">
|
||||
<input type="hidden" name="status" value="${(data.query.status!'x')?xhtml}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
</td></tr>
|
||||
|
||||
<#switch data.titleError!"">
|
||||
<#case "EMPTY"><@form_error>Please specify the report's title</@form_error><#break>
|
||||
<#case "INVALID"><@form_error>Title should be at least 10 characters long</@form_error><#break>
|
||||
</#switch>
|
||||
<@form_text label="Title" name="title" value=data.title!"" maxLength=127 />
|
||||
|
||||
<#switch data.descriptionError!"">
|
||||
<#case "EMPTY"><@form_error>Please specify the bug's description</@form_error><#break>
|
||||
<#case "INVALID"><@form_error>Title should be at least 30 characters long</@form_error><#break>
|
||||
</#switch>
|
||||
<@form_text label="Description" name="description" value=data.description!"" multiline=true maxLength=10 />
|
||||
|
||||
<@form_select name="public" label="Visible by players">
|
||||
<@form_option value="0">No</@form_option>
|
||||
<@form_option value="1" selected=data.publicReport!false>Yes</@form_option>
|
||||
</@form_select>
|
||||
|
||||
<@form_submit label="Post bug report" />
|
||||
|
||||
</@form>
|
||||
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,53 @@
|
|||
<#include "bugsTabs.ftl">
|
||||
<#macro summary_entry label amount qString>
|
||||
|
||||
<@lv_line>
|
||||
<@lv_column>
|
||||
<#if amount gt 0>
|
||||
<a href="bugs?${qString}">
|
||||
</#if>
|
||||
${label}
|
||||
<#if amount gt 0>
|
||||
</a>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>
|
||||
${amount?string(",##0")}
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
</#macro>
|
||||
<#macro render>
|
||||
<#local qString = "status=x&own=0" >
|
||||
<@page title="Bug tracker - Summary">
|
||||
<#-- Tabs -->
|
||||
<@bugTabs selected="bugsSummary" qString=qString />
|
||||
|
||||
<#-- Summary -->
|
||||
<@listview>
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=300> </@lv_column>
|
||||
<@lv_column width=100> </@lv_column>
|
||||
</@lv_line>
|
||||
<@summary_entry label="Pending validation" amount=data.pending qString="status=PENDING&own=0" />
|
||||
<@summary_entry label="Open bugs" amount=data.open qString="status=OPEN&own=0" />
|
||||
<@summary_entry label="Bugs you reported" amount=data.own qString="status=x&own=1" />
|
||||
<@summary_entry label="Total bugs" amount=data.total qString="status=x&own=0" />
|
||||
<#if data.updated gt 0>
|
||||
<@lv_line>
|
||||
<@lv_column> </@lv_column>
|
||||
<@lv_column> </@lv_column>
|
||||
</@lv_line>
|
||||
<@lv_line>
|
||||
<@lv_column>
|
||||
Updated bug reports
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>
|
||||
${data.updated?string(",##0")}
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
</#if>
|
||||
</@listview>
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,19 @@
|
|||
<#macro bugTab href title selected>
|
||||
<a class="tab-button<#if selected> selected-tab</#if>" href="${href}">${title}</a>
|
||||
</#macro>
|
||||
<#macro bugTabs selected qString>
|
||||
<div class="tab-buttons">
|
||||
<@bugTab href="btracker" title="Summary" selected=( selected = 'bugsSummary' ) />
|
||||
<@bugTab href="bugs?${qString}" title="List bugs" selected=( selected = 'bugsList' ) />
|
||||
<@bugTab href="report-bug?${qString}" title="Report bug" selected=( selected = 'bugsReport' ) />
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro bugStatus status>
|
||||
<#switch status>
|
||||
<#case "PENDING">pending validation<#break>
|
||||
<#case "OPEN">being handled<#break>
|
||||
<#case "RESOLVED">fixed<#break>
|
||||
<#case "WONT_FIX">won't fix<#break>
|
||||
<#case "NOT_A_BUG">not a bug<#break>
|
||||
</#switch>
|
||||
</#macro>
|
|
@ -0,0 +1,220 @@
|
|||
<#include "bugsTabs.ftl" />
|
||||
<#macro render_submitter s>
|
||||
<#if s.admin>
|
||||
<strong>
|
||||
<#if s.userId?has_content && s.userId = data.admin.id>
|
||||
<em>
|
||||
</#if>
|
||||
</#if>
|
||||
${s.name?xhtml}
|
||||
<#if s.admin>
|
||||
<#if s.userId?has_content && s.userId = data.admin.id>
|
||||
</em>
|
||||
</#if>
|
||||
</strong>
|
||||
</#if>
|
||||
</#macro>
|
||||
<#macro render_event e>
|
||||
<div style="text-align:center; padding:10px 10px">
|
||||
${e.timestamp?string("yyyy-MM-dd HH:mm:ss")} - <@render_submitter s=e.submitter />
|
||||
<#nested>
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro render_report_event e>
|
||||
<@render_event e=e>
|
||||
posted bug report #<strong>${e.id?string(",##0")}</strong>
|
||||
</@render_event>
|
||||
<h3 style="margin:0;text-align:center;padding:0 0 10px 0">${e.title}</h3>
|
||||
<div style="margin: 0 40px 20px 40px">
|
||||
${e.contents}
|
||||
</div>
|
||||
<#if e.visible!false>
|
||||
<div style="text-align:center; padding:10px 10px">
|
||||
This report includes an XML snapshot of the empire's status
|
||||
(<a href="bug-${e.id}-xmlsnapshot">download</a>).
|
||||
</div>
|
||||
</#if>
|
||||
</#macro>
|
||||
<#macro render_status_event e>
|
||||
<@render_event e=e>
|
||||
set the report's status to <strong><@bugStatus status=e.status /></strong>
|
||||
</@render_event>
|
||||
</#macro>
|
||||
<#macro render_visibility_event e>
|
||||
<@render_event e=e>
|
||||
set the report's visibility to <strong><#if e.visible>public<#else>private</#if></strong>
|
||||
</@render_event>
|
||||
</#macro>
|
||||
<#macro render_merge_event e>
|
||||
<@render_event e=e>
|
||||
merged current bug report with bug report #<strong>${e.mergedId?string(",##0")}</strong>
|
||||
</@render_event>
|
||||
</#macro>
|
||||
<#macro render_comment_event e>
|
||||
<@render_event e=e>
|
||||
posted a comment
|
||||
</@render_event>
|
||||
<div style="margin: 0 40px 20px 40px">
|
||||
${e.contents}
|
||||
</div>
|
||||
<#if !e.visible>
|
||||
<@lineform action="bug-${data.report.reportId}-comment-moderation">
|
||||
<input type="hidden" name="status" value="${data.query.status!"x"}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
<input type="hidden" name="comment" value="${e.id}" />
|
||||
This comment is currently hidden.
|
||||
<@ff_select name="cAction" id="cAction-${e.id}">
|
||||
<@form_option value="1">Validate it</@form_option>
|
||||
<@form_option value="0">Delete it</@form_option>
|
||||
</@ff_select>
|
||||
<@ff_submit label="Go" />
|
||||
</@lineform>
|
||||
</#if>
|
||||
</#macro>
|
||||
<#macro render>
|
||||
<#if data.query.ownOnly>
|
||||
<#assign ownOnly = "1">
|
||||
<#else>
|
||||
<#assign ownOnly = "0">
|
||||
</#if>
|
||||
<#local qString = "status=${data.query.status!'x'}&own=${ownOnly}" >
|
||||
<@page title="Bug #${data.report.reportId?string(',##0')} - ${data.report.title}">
|
||||
<#-- Tabs -->
|
||||
<@bugTabs selected="" qString="${qString}&first=${data.query.first}" />
|
||||
|
||||
<#-- Bug info -->
|
||||
<@dt_main>
|
||||
<@dt_entry title="Status"><@bugStatus status=data.report.status /></@dt_entry>
|
||||
<@dt_entry title="Public"><#if data.report.visible>yes<#else>no</#if></@dt_entry>
|
||||
<@dt_entry title="Initially reported">
|
||||
${data.report.posted?string("yyyy-MM-dd HH:mm:ss")}
|
||||
by <@render_submitter s=data.report.initialSubmitter />
|
||||
</@dt_entry>
|
||||
<@dt_entry title="Latest update">
|
||||
${data.report.lastUpdate?string("yyyy-MM-dd HH:mm:ss")}
|
||||
by <@render_submitter s=data.report.latestSubmitter />
|
||||
</@dt_entry>
|
||||
</@dt_main>
|
||||
|
||||
<#-- List events -->
|
||||
<#list data.events as event>
|
||||
<hr/>
|
||||
<#switch event.type>
|
||||
<#case 'INIT'>
|
||||
<@render_report_event e=event />
|
||||
<#break>
|
||||
<#case 'STATUS'>
|
||||
<@render_status_event e=event />
|
||||
<#break>
|
||||
<#case 'COMMENT'>
|
||||
<@render_comment_event e=event />
|
||||
<#break>
|
||||
<#case 'VISIBILITY'>
|
||||
<@render_visibility_event e=event />
|
||||
<#break>
|
||||
<#case 'MERGE'>
|
||||
<@render_merge_event e=event />
|
||||
<#break>
|
||||
</#switch>
|
||||
</#list>
|
||||
|
||||
<#-- Controls -->
|
||||
<hr id="br-controls"/>
|
||||
<#if data.report.status = 'PENDING'>
|
||||
<@form action="bug-${data.report.reportId}-validation" hash="br-controls">
|
||||
<tr style="display:none">
|
||||
<td colspan="2">
|
||||
<input type="hidden" name="status" value="${data.query.status!"x"}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
</td>
|
||||
</tr>
|
||||
<@form_extra>This report is currently pending validation.</@form_extra>
|
||||
<@form_select label="Set status to" name="nStatus">
|
||||
<@form_option value="OPEN"><@bugStatus status="OPEN" /></@form_option>
|
||||
<@form_option value="RESOLVED"><@bugStatus status="RESOLVED" /></@form_option>
|
||||
<@form_option value="WONT_FIX"><@bugStatus status="WONT_FIX" /></@form_option>
|
||||
<@form_option value="NOT_A_BUG"><@bugStatus status="NOT_A_BUG" /></@form_option>
|
||||
</@form_select>
|
||||
<@form_select label="Visibility" name="visibility">
|
||||
<@form_option value="1">public</@form_option>
|
||||
<@form_option value="0">hidden</@form_option>
|
||||
</@form_select>
|
||||
<@form_select label="Grant game credits" name="credits">
|
||||
<@form_option value="0">no</@form_option>
|
||||
<@form_option value="1" selected=true>low priority bug - small amount</@form_option>
|
||||
<@form_option value="2">normal bug - medium amount</@form_option>
|
||||
<@form_option value="3">critical bug - large amount</@form_option>
|
||||
</@form_select>
|
||||
<@form_select label="Empire status snapshot" name="snapshot">
|
||||
<@form_option value="1">keep</@form_option>
|
||||
<@form_option value="0">delete</@form_option>
|
||||
</@form_select>
|
||||
<@form_submit label="Go" />
|
||||
</@form>
|
||||
<#else>
|
||||
<@lineform action="bug-${data.report.reportId}-status" hash="br-controls">
|
||||
<input type="hidden" name="status" value="${data.query.status!"x"}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
Change status to
|
||||
<@ff_select name="nStatus" id="nStatus">
|
||||
<@form_option value="OPEN" selected=( data.report.status = 'OPEN' )><@bugStatus status="OPEN" /></@form_option>
|
||||
<@form_option value="RESOLVED" selected=( data.report.status = 'RESOLVED' )><@bugStatus status="RESOLVED" /></@form_option>
|
||||
<@form_option value="WONT_FIX" selected=( data.report.status = 'WONT_FIX' )><@bugStatus status="WONT_FIX" /></@form_option>
|
||||
<@form_option value="NOT_A_BUG" selected=( data.report.status = 'NOT_A_BUG' )><@bugStatus status="NOT_A_BUG" /></@form_option>
|
||||
</@ff_select>
|
||||
<@ff_submit label="Go" />
|
||||
</@lineform>
|
||||
<#if data.report.status = 'OPEN'>
|
||||
<@lineform action="bug-${data.report.reportId}-visibility" hash="br-controls">
|
||||
<input type="hidden" name="status" value="${data.query.status!"x"}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
Change visibility to
|
||||
<#if data.report.visible>
|
||||
hidden
|
||||
<#else>
|
||||
public
|
||||
</#if>
|
||||
<@ff_submit label="Go" />
|
||||
</@lineform>
|
||||
<#switch data.mergeError!>
|
||||
<#case "NOT_FOUND"><@standalone_error>Bug report not found</@standalone_error><#break>
|
||||
<#case "MERGED"><@standalone_error>Bug reports already merged</@standalone_error><#break>
|
||||
<#case "STATUS"><@standalone_error>Both bug reports must be open</@standalone_error><#break>
|
||||
</#switch>
|
||||
<@lineform action="bug-${data.report.reportId}-merge" hash="br-controls">
|
||||
<input type="hidden" name="status" value="${data.query.status!"x"}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
Merge into bug report #<@ff_text name="mergeId" id="merge-into" value=data.mergeId!"" />
|
||||
<@ff_submit label="Go" />
|
||||
</@lineform>
|
||||
<hr id="post-comment" />
|
||||
<@form action="bug-${data.report.reportId}-comment" hash="post-comment">
|
||||
<tr style="display:none">
|
||||
<td colspan="2">
|
||||
<input type="hidden" name="status" value="${data.query.status!"x"}" />
|
||||
<input type="hidden" name="own" value="${ownOnly}" />
|
||||
<input type="hidden" name="first" value="${data.query.first}" />
|
||||
</td>
|
||||
</tr>
|
||||
<#switch data.commentError!"">
|
||||
<#case "EMPTY"><@form_error>You should type a comment before posting a comment.</@form_error><#break>
|
||||
<#case "INVALID"><@form_error>Comments must be at least 30 characters long.</@form_error><#break>
|
||||
</#switch>
|
||||
<@form_text label="New comment" name="comment" multiline=true maxLength=6 value=data.comment!"" />
|
||||
<@form_select label="Visibility" name="visibility">
|
||||
<@form_option value="1">public</@form_option>
|
||||
<@form_option value="0" selected=(! data.publicComment!true )>hidden</@form_option>
|
||||
</@form_select>
|
||||
<@form_submit label="Post comment" />
|
||||
</@form>
|
||||
</#if>
|
||||
</#if>
|
||||
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,31 @@
|
|||
<@page title="Change password">
|
||||
<@form action="change-password">
|
||||
<#if data.admin.passwordChange!false>
|
||||
<@form_extra>Your administration password is currently the same as your player account's password. You <strong>must</strong> change it before you can proceed.</@form_extra>
|
||||
</#if>
|
||||
|
||||
<#if data.authError!false>
|
||||
<@form_error>Incorrect password</@form_error>
|
||||
</#if>
|
||||
<@form_pwd name="current" label="Current password" />
|
||||
|
||||
<#switch data.passwordError!>
|
||||
<#case 'EMPTY'>
|
||||
<@form_error>No password specified</@form_error>
|
||||
<#break>
|
||||
<#case 'TOO_WEAK'>
|
||||
<@form_error>Password too weak</@form_error>
|
||||
<#break>
|
||||
<#case 'MISMATCH'>
|
||||
<@form_error>Password and password confirmation did not match</@form_error>
|
||||
<#break>
|
||||
<#case 'PROHIBITED'>
|
||||
<@form_error>You are not allowed to use your player account's password.</@form_error>
|
||||
<#break>
|
||||
</#switch>
|
||||
<@form_pwd name="password" label="New password" />
|
||||
<@form_pwd name="passwordConfirm" label="New password (confirmation)" />
|
||||
|
||||
<@form_submit label="Change password" />
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,29 @@
|
|||
<#macro render_constant constant wrong>
|
||||
<h2 id="${constant.name?replace("." , "-")}">${constant.name?xhtml}</h2>
|
||||
<p>${constant.description?xhtml}</p>
|
||||
<#if wrong>
|
||||
<@standalone_error>Invalid constant value</@standalone_error>
|
||||
<#local cValue = data.value>
|
||||
<#else>
|
||||
<#local cValue = constant.value>
|
||||
</#if>
|
||||
<@lineform action="set-constant" hash=constant.name?replace("." , "-")>
|
||||
Value:
|
||||
<@ff_text name="value" id=constant.name?replace("." , "-") value=cValue?string("#.###") maxLength=10 size=10 />
|
||||
<#if constant.minValue?has_content || constant.maxValue?has_content>
|
||||
(<#if constant.minValue?has_content>min.: ${constant.minValue?string("#.###")}<#if constant.maxValue?has_content> ; </#if></#if><#if constant.maxValue?has_content>max.: ${constant.maxValue?string("#.###")}</#if>)
|
||||
</#if>
|
||||
<@ff_submit label="Change" />
|
||||
<input type="hidden" name="name" value="${constant.name?xhtml}" />
|
||||
</@lineform>
|
||||
<p> </p>
|
||||
</#macro>
|
||||
<@page title="Constants">
|
||||
<#list data.categories as category>
|
||||
<h1>${category.name?xhtml}</h1>
|
||||
<#list category.definitions as constant>
|
||||
<@render_constant constant=constant wrong=(((data.name!"") == constant.name) && data.error!false) />
|
||||
</#list>
|
||||
<p> </p>
|
||||
</#list>
|
||||
</@page>
|
|
@ -0,0 +1,37 @@
|
|||
<#macro render_string str>
|
||||
<tr id="str-${str.id}">
|
||||
<th style="text-align:right;vertical-align:top">${str.id}</th>
|
||||
<td>
|
||||
<#if (data.edited!"") == str.id>
|
||||
<div class="form-error">Empty strings are not allowed</div>
|
||||
</#if>
|
||||
<form action="i18n-${data.language.id}-set-string.action#str-${str.id}" method="post">
|
||||
<div>
|
||||
<input type="hidden" name="string" value="${str.id}" />
|
||||
<textarea class="input" rows="10" columns="80" name="value" style="height:auto;width:600px">${str.text?xhtml}</textarea>
|
||||
<br/>
|
||||
<input type="submit" value="Modify string" />
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</#macro>
|
||||
<@page title="Language '${data.language.name}'">
|
||||
|
||||
<h1>Change language name</h1>
|
||||
<@form action="i18n-${data.language.id}-edit">
|
||||
<#if data.nameError!false>
|
||||
<@form_error>Invalid name</@form_error>
|
||||
</#if>
|
||||
<@form_text name="name" label="New name" value=data.language.name! />
|
||||
<@form_submit label="Change name" />
|
||||
</@form>
|
||||
|
||||
<h1>Translations</h1>
|
||||
<table>
|
||||
<#list data.strings as str>
|
||||
<@render_string str=str />
|
||||
</#list>
|
||||
</table>
|
||||
|
||||
</@page>
|
|
@ -0,0 +1,24 @@
|
|||
<#macro render_language lang>
|
||||
<@lv_line>
|
||||
<@lv_column centered=true><a href="i18n-${lang.id}">${lang.id}</a></@lv_column>
|
||||
<@lv_column>${lang.name?xhtml}</@lv_column>
|
||||
<@lv_column centered=true>${lang.completion}%</@lv_column>
|
||||
<@lv_column centered=true><a href="i18n-export-${lang.id}">(XML export)</a></@lv_column>
|
||||
</@lv_line>
|
||||
</#macro>
|
||||
<@page title="Languages">
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=100 centered=true>ID</@lv_column>
|
||||
<@lv_column width="x">Name</@lv_column>
|
||||
<@lv_column width=200 centered=true>Completion %</@lv_column>
|
||||
<@lv_column width=150> </@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.languages as lang>
|
||||
<@render_language lang=lang />
|
||||
</#list>
|
||||
|
||||
</@listview>
|
||||
</@page>
|
|
@ -0,0 +1,41 @@
|
|||
<@page title="Log entry #${data.entry.id?string(',##0')}">
|
||||
<h1>Basics</h1>
|
||||
<@dt_main>
|
||||
<@dt_entry title="Date">${data.entry.timestamp?string("yyyy-MM-dd")}</@dt_entry>
|
||||
<@dt_entry title="Time">${data.entry.timestamp?string("HH:mm:ss")}</@dt_entry>
|
||||
<@dt_entry title="Log level">${data.entry.level}</@dt_entry>
|
||||
<@dt_entry title="Component">${data.entry.about?xhtml}</@dt_entry>
|
||||
<@dt_entry title="Message">${data.entry.entry?xhtml}</@dt_entry>
|
||||
</@dt_main>
|
||||
<p> </p>
|
||||
|
||||
<#if data.exceptions?size gt 0>
|
||||
<h1>Exception log</h1>
|
||||
<table>
|
||||
<#list data.exceptions as exc>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<strong>${exc.className?xhtml}</strong>
|
||||
<#if exc.message?has_content>: ${exc.message?xhtml}</#if>
|
||||
</td>
|
||||
</tr>
|
||||
<#list exc.trace as stEntry>
|
||||
<tr>
|
||||
<td style="width: 150px"> </td>
|
||||
<td>
|
||||
In
|
||||
<#if stEntry.location?has_content>
|
||||
<strong>${stEntry.location?xhtml}</strong>
|
||||
<#else>
|
||||
???
|
||||
</#if>
|
||||
<#if stEntry.fileName?has_content>
|
||||
(in file <em>${stEntry.fileName?xhtml}</em><#if stEntry.line?has_content> at line ${stEntry.line?string(",##0")}</#if>)
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#list>
|
||||
</table>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,10 @@
|
|||
<@page title="Log in">
|
||||
<@form action="login">
|
||||
<#if data.failed!false>
|
||||
<@form_error>Invalid address or password</@form_error>
|
||||
</#if>
|
||||
<@form_text name="mail" label="E-mail address" value=data.mail! />
|
||||
<@form_pwd name="password" label="Password" />
|
||||
<@form_submit label="Log in" />
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,103 @@
|
|||
<@page title="Logs viewer">
|
||||
<h1>Log entries</h1>
|
||||
<table style="width:95%; margin: 10px 0 10px 2%">
|
||||
<tr>
|
||||
<td style="width: 50px;text-align:right">
|
||||
<#if data.params.first = 0>
|
||||
<<
|
||||
<#else>
|
||||
<#if data.params.first gt 30>
|
||||
<a href="logs?logType=${data.params.type?url}&logLevel=${data.params.level?url}&component=${(data.params.component!"")?url}&excOnly=<#if data.params.excOnly!false>1<#else>0</#if>&first=${data.params.first - 30 }">
|
||||
<#else>
|
||||
<a href="logs?logType=${data.params.type?url}&logLevel=${data.params.level?url}&component=${(data.params.component!"")?url}&excOnly=<#if data.params.excOnly!false>1<#else>0</#if>&first=0">
|
||||
</#if>
|
||||
<<</a>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="text-align:center">
|
||||
<#if data.count = 0>
|
||||
No entries found.
|
||||
<#else>
|
||||
${data.count?string(",##0")} entries
|
||||
</#if>
|
||||
</td>
|
||||
<td style="width: 50px;text-align:left">
|
||||
<#if (data.params.first + 30) gt data.count>
|
||||
>>
|
||||
<#else>
|
||||
<a href="logs?logType=${data.params.type?url}&logLevel=${data.params.level?url}&component=${(data.params.component!"")?url}&excOnly=<#if data.params.excOnly!false>1<#else>0</#if>&first=${data.params.first + 30 }">
|
||||
>></a>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<#if data.count gt 0>
|
||||
<table class="list-view" style="width:95%; margin: 0 0 20px 2%" >
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=60 centered=true>Date</@lv_column>
|
||||
<@lv_column width=60 centered=true>Time</@lv_column>
|
||||
<@lv_column width=60 centered=true>Log level</@lv_column>
|
||||
<@lv_column width=200 centered=true>
|
||||
<#if data.params.type = "SYSTEM">
|
||||
Component
|
||||
<#else>
|
||||
User
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column width="x">Message</@lv_column>
|
||||
<@lv_column width=50> </@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.entries as entry>
|
||||
<@lv_line class="log-entry-${entry.level?lower_case}">
|
||||
<@lv_column centered=true>${entry.timestamp?string("yyyy-MM-dd")}</@lv_column>
|
||||
<@lv_column centered=true>${entry.timestamp?string("HH:mm:ss")}</@lv_column>
|
||||
<@lv_column centered=true>${entry.level}</@lv_column>
|
||||
<@lv_column centered=true>${entry.about?xhtml}</@lv_column>
|
||||
<@lv_column>${entry.entry?xhtml}</@lv_column>
|
||||
<@lv_column>
|
||||
<#if entry.exception?has_content>
|
||||
<a href="view-log-entry-${entry.id}">Details</a>
|
||||
<#else>
|
||||
|
||||
</#if>
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
|
||||
</table>
|
||||
</#if>
|
||||
|
||||
<h1>Search parameters</h1>
|
||||
<div class="form-container">
|
||||
<form action="logs" method="get">
|
||||
<table>
|
||||
|
||||
<@form_select name="logType" label="Log type">
|
||||
<@form_option value="SYSTEM" selected=((data.params.type!"") = "SYSTEM")>system log</@form_option>
|
||||
<@form_option value="ADMIN" selected=((data.params.type!"") = "ADMIN")>administrative actions</@form_option>
|
||||
<@form_option value="PLAYER" selected=((data.params.type!"") = "PLAYER")>player actions</@form_option>
|
||||
</@form_select>
|
||||
|
||||
<@form_select name="logLevel" label="Minimal log level">
|
||||
<@form_option value="TRACE" selected=((data.params.level!"") = "TRACE")>TRACE</@form_option>
|
||||
<@form_option value="DEBUG" selected=((data.params.level!"") = "DEBUG")>DEBUG</@form_option>
|
||||
<@form_option value="INFO" selected=((data.params.level!"") = "INFO")>INFO</@form_option>
|
||||
<@form_option value="WARNING" selected=((data.params.level!"") = "WARNING")>WARNING</@form_option>
|
||||
<@form_option value="ERROR" selected=((data.params.level!"") = "ERROR")>ERROR</@form_option>
|
||||
</@form_select>
|
||||
|
||||
<@form_text label="Component / user" name="component" value=data.params.component! />
|
||||
|
||||
<@form_select name="excOnly" label="Only entries with exceptions">
|
||||
<@form_option value="0" selected=!( data.params.excOnly!false)>no</@form_option>
|
||||
<@form_option value="1" selected=data.params.excOnly!false>yes</@form_option>
|
||||
</@form_select>
|
||||
|
||||
<@form_submit label="Search"/>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</@page>
|
|
@ -0,0 +1,42 @@
|
|||
<@page title="Overview">
|
||||
<h1>Your administrative account</h1>
|
||||
<p>
|
||||
<strong>E-mail address:</strong> ${data.admin.address?xhtml}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Privileges:</strong>
|
||||
<#list data.admin.privileges as priv>
|
||||
<abbr title="${priv.description?xhtml}">${priv}</abbr>
|
||||
</#list>
|
||||
</p>
|
||||
<p>
|
||||
<a href="change-password">Change password</a>
|
||||
</p>
|
||||
<p> </p>
|
||||
|
||||
<h1>Overview</h1>
|
||||
<p>
|
||||
<strong>Unread messages:</strong> ${data.overview.newMessages}
|
||||
</p>
|
||||
<#if data.overview.pendingNames?has_content>
|
||||
<p>
|
||||
<strong>Unvalidated map names:</strong> ${data.overview.pendingNames}
|
||||
</p>
|
||||
</#if>
|
||||
<#if data.overview.pendingBans?has_content>
|
||||
<p>
|
||||
<strong>Unvalidated ban requests:</strong> ${data.overview.pendingBans}
|
||||
</p>
|
||||
</#if>
|
||||
<#if data.overview.pendingBugs?has_content>
|
||||
<p>
|
||||
<strong>Bug reports pending validation:</strong> ${data.overview.pendingBugs}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Open bug reports:</strong> ${data.overview.openBugs}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Updated bug reports:</strong> ${data.overview.updatedBugs}
|
||||
</p>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,40 @@
|
|||
<@page title="Maintenance mode">
|
||||
|
||||
<#if data.reason?has_content>
|
||||
|
||||
<p>Maintenance mode is <strong>enabled</strong>.</p>
|
||||
<@dt_main>
|
||||
<@dt_entry title="Started">${data.started?string("yyyy-MM-dd HH:mm:ss")}</@dt_entry>
|
||||
<@dt_entry title="Scheduled to end">${data.until?string("yyyy-MM-dd HH:mm:ss")}</@dt_entry>
|
||||
<@dt_entry title="Reason">${data.reason?xhtml}</@dt_entry>
|
||||
</@dt_main>
|
||||
|
||||
|
||||
<@form action="maintenance-extend">
|
||||
<@form_text label="Duration (minutes)" name="duration" value="" />
|
||||
<@form_submit label="Extend maintenance mode"/>
|
||||
</@form>
|
||||
<@form action="maintenance-end">
|
||||
<@form_submit label="Disable maintenance mode"/>
|
||||
</@form>
|
||||
|
||||
<#else>
|
||||
|
||||
<p>Maintenance mode is currently disabled.</p>
|
||||
|
||||
<@form action="maintenance-start">
|
||||
<#switch data.reasonError!"">
|
||||
<#case 'EMPTY'><@form_error>You must specify a reason.</@form_error><#break>
|
||||
<#case 'INVALID'><@form_error>Reason too short (must be at least 10 characters long).</@form_error><#break>
|
||||
</#switch>
|
||||
<@form_text label="Reason for maintenance activation" name="reason" value=data.newReason!"" />
|
||||
<#if ( data.newReason!"" ) != "" && ! data.reasonError?has_content>
|
||||
<@form_error>Invalid duration</@form_error>
|
||||
</#if>
|
||||
<@form_text label="Duration (minutes)" name="duration" value=data.newDuration!"" />
|
||||
<@form_submit label="Enable maintenance mode"/>
|
||||
</@form>
|
||||
|
||||
</#if>
|
||||
|
||||
</@page>
|
|
@ -0,0 +1,96 @@
|
|||
<#macro render_navigation message inbox>
|
||||
<#if inbox>
|
||||
<#local link="inbox-message-">
|
||||
<#else>
|
||||
<#local link="outbox-message-">
|
||||
</#if>
|
||||
<table style="width:100%;margin: 2px 0">
|
||||
<tr>
|
||||
<td style="width: 30px;text-align: right">
|
||||
<#if message.previous?has_content>
|
||||
<a href="${link}${message.previous}">
|
||||
</#if>
|
||||
<<
|
||||
<#if message.previous?has_content>
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<#if inbox>
|
||||
<a href="inbox-from-${message.id}">Received messages</a>
|
||||
<#else>
|
||||
<a href="outbox-from-${message.id}">Sent messages</a>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="width: 30px;text-align: left">
|
||||
<#if message.next?has_content>
|
||||
<a href="${link}${message.next}">
|
||||
</#if>
|
||||
>>
|
||||
<#if message.next?has_content>
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</#macro>
|
||||
<#macro render>
|
||||
<#if data.inbox>
|
||||
<#local title="Received messages">
|
||||
<#local timeTtl="Received">
|
||||
<#else>
|
||||
<#local title="Sent messages">
|
||||
<#local timeTtl="Sent">
|
||||
</#if>
|
||||
<@page title=title>
|
||||
<@render_navigation message=data.message inbox=data.inbox />
|
||||
|
||||
<@dt_main>
|
||||
<@dt_entry width=100 title="From">
|
||||
${data.message.sender!}
|
||||
<#if data.inbox>
|
||||
(${data.message.type?lower_case})
|
||||
</#if>
|
||||
</@dt_entry>
|
||||
<@dt_entry width=100 title="To">
|
||||
${data.message.receiver!}
|
||||
<#if !data.inbox>
|
||||
(${data.message.type?lower_case})
|
||||
</#if>
|
||||
</@dt_entry>
|
||||
<@dt_entry width=100 title=timeTtl>
|
||||
${data.message.time?string("yyyy-MM-dd HH:mm:ss")}
|
||||
</@dt_entry>
|
||||
<#if data.message.unread>
|
||||
<@dt_entry width=100 title="">New!</@dt_entry>
|
||||
</#if>
|
||||
</@dt_main>
|
||||
|
||||
<@listview><@lv_line headers=true><th colspan="2" style="font-size:1px"> </th></@lv_line></@listview>
|
||||
|
||||
<h3 style="margin:0;text-align:center;padding:0 0 10px 0">${data.message.title}</h3>
|
||||
<div style="margin: 0 40px 20px 40px">
|
||||
${data.message.contents}
|
||||
</div>
|
||||
|
||||
<@listview><@lv_line headers=true><th colspan="2" style="font-size:1px"> </th></@lv_line></@listview>
|
||||
<@lineform action="message">
|
||||
<input type="hidden" name="inbox" value="<#if data.inbox>1<#else>0</#if>" />
|
||||
<input type="hidden" name="id" value="${data.message.id}" />
|
||||
<#if data.message.previous?has_content>
|
||||
<#local afterDelete = data.message.previous>
|
||||
<#elseif data.message.next?has_content>
|
||||
<#local afterDelete = data.message.next>
|
||||
<#else>
|
||||
<#local afterDelete = "x">
|
||||
</#if>
|
||||
<input type="hidden" name="next" value="${afterDelete}" />
|
||||
<@ff_submit label="Delete message" name="delete" />
|
||||
<#if data.inbox && data.message.type != 'INTERNAL'>
|
||||
<@ff_submit label="Compose reply" name="reply" />
|
||||
</#if>
|
||||
</@lineform>
|
||||
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,112 @@
|
|||
<#include "messageTabs.ftl" />
|
||||
<#macro render_navigation current total inbox>
|
||||
<#if inbox>
|
||||
<#local link="inbox-">
|
||||
<#else>
|
||||
<#local link="outbox-">
|
||||
</#if>
|
||||
<table style="width:100%;margin: 2px 0">
|
||||
<tr>
|
||||
<td style="width: 30px;text-align: right">
|
||||
<#if current gt 0>
|
||||
<a href="${link}${current - 1}">
|
||||
</#if>
|
||||
<<
|
||||
<#if current gt 0>
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<#if total gt 0>
|
||||
Page ${current + 1} / ${total}
|
||||
<#elseif inbox>
|
||||
No messages received.
|
||||
<#else>
|
||||
No messages sent.
|
||||
</#if>
|
||||
</td>
|
||||
<td style="width: 30px;text-align: left">
|
||||
<#if current lt total - 1>
|
||||
<a href="${link}${current + 1}">
|
||||
</#if>
|
||||
>>
|
||||
<#if current lt total - 1>
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</#macro>
|
||||
<#macro render>
|
||||
<#if data.inbox>
|
||||
<#local title="Received messages">
|
||||
<#local tab="inbox">
|
||||
<#else>
|
||||
<#local title="Sent messages">
|
||||
<#local tab="outbox">
|
||||
</#if>
|
||||
<@page title=title>
|
||||
<@messageTabs selected=tab />
|
||||
<@render_navigation current=data.cPage total=data.pages inbox=data.inbox />
|
||||
<#if data.messages?size gt 0>
|
||||
<form action="messages.action" method="post">
|
||||
<input type="hidden" name="inbox" value="<#if data.inbox>1<#else>0</#if>" />
|
||||
<input type="hidden" name="page" value="${data.cPage}" />
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=16 centered=true> </@lv_column>
|
||||
<@lv_column width="x">Subject</@lv_column>
|
||||
<@lv_column width=150 centered=true><#if data.inbox>From<#else>To</#if></@lv_column>
|
||||
<@lv_column width=150 centered=true><#if data.inbox>Received<#else>Sent</#if></@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.messages as message>
|
||||
<#if ! message.read>
|
||||
<#local mType = "unread-msg">
|
||||
<#else>
|
||||
<#local mType = "">
|
||||
</#if>
|
||||
|
||||
<@lv_line class=mType>
|
||||
<@lv_column centered=true>
|
||||
<input type="checkbox" name="selection" value="${message.id}" class="input" />
|
||||
</@lv_column>
|
||||
<@lv_column><a href="<#if data.inbox>inbox<#else>outbox</#if>-message-${message.id}"><#if message.type = 'EMPIRE'><em>${message.title}</em><#else>${message.title}</#if></a></@lv_column>
|
||||
<@lv_column centered=true>${message.sender!}</@lv_column>
|
||||
<@lv_column centered=true>${message.time?string("yyyy-MM-dd HH:mm:ss")}</@lv_column>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
</@listview>
|
||||
|
||||
<#if data.inbox>
|
||||
<div class="form-container">
|
||||
With
|
||||
<@ff_select name="target" id="target">
|
||||
<@form_option value="0">selected</@form_option>
|
||||
<@form_option value="1">all</@form_option>
|
||||
</@ff_select>
|
||||
messages:
|
||||
<@ff_select name="action" id="action">
|
||||
<@form_option value="r">mark as read</@form_option>
|
||||
<@form_option value="u">mark as unread</@form_option>
|
||||
<@form_option value="d">delete</@form_option>
|
||||
</@ff_select>
|
||||
<@ff_submit label="Go" />
|
||||
</div>
|
||||
<#else>
|
||||
<div class="form-container">
|
||||
<input type="hidden" name="action" value="d" />
|
||||
Delete
|
||||
<@ff_select name="target" id="target">
|
||||
<@form_option value="0">selected</@form_option>
|
||||
<@form_option value="1">all</@form_option>
|
||||
</@ff_select>
|
||||
messages <@ff_submit label="Go" />
|
||||
</div>
|
||||
</#if>
|
||||
</form>
|
||||
</#if>
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,10 @@
|
|||
<#macro messageTab href title selected>
|
||||
<a class="tab-button<#if selected> selected-tab</#if>" href="${href}">${title}</a>
|
||||
</#macro>
|
||||
<#macro messageTabs selected>
|
||||
<div class="tab-buttons">
|
||||
<@messageTab href="messages" title="Received" selected=( selected = 'inbox' ) />
|
||||
<@messageTab href="outbox" title="Sent" selected=( selected = 'outbox' ) />
|
||||
<@messageTab href="compose-message" title="Compose" selected=( selected = 'compose' ) />
|
||||
</div>
|
||||
</#macro>
|
|
@ -0,0 +1,79 @@
|
|||
<#include "messageTabs.ftl" />
|
||||
<#macro render>
|
||||
<#if data.replyTo?has_content>
|
||||
<#local title="Reply to message">
|
||||
<#else>
|
||||
<#local title="Compose new message">
|
||||
</#if>
|
||||
<@page title=title>
|
||||
<@messageTabs selected="compose" />
|
||||
|
||||
<div class="form-container">
|
||||
<form action="send-message.action" method="post">
|
||||
<#if data.replyTo?has_content>
|
||||
<input name="rtInbox" type="hidden" value="<#if data.inbox>1<#else>0</#if>" />
|
||||
<input name="rtId" type="hidden" value="${data.replyTo.id}" />
|
||||
</#if>
|
||||
|
||||
<table>
|
||||
<#if data.timingError>
|
||||
<@form_error>Not so fast! Wait a few seconds before trying again.</@form_error>
|
||||
</#if>
|
||||
|
||||
<#-- Message recipient -->
|
||||
<#if data.targetError>
|
||||
<@form_error>Message recipient not found.</@form_error>
|
||||
</#if>
|
||||
<@form_select label="Recipient type" name="toType">
|
||||
<@form_option value="ADMINISTRATOR" selected=( data.messageType = 'ADMINISTRATOR' )>Administrator</@form_option>
|
||||
<@form_option value="EMPIRE" selected=( data.messageType = 'EMPIRE' )>Empire</@form_option>
|
||||
</@form_select>
|
||||
<@form_text label="Recipient name" name="toName" maxLength=48 value=data.target />
|
||||
|
||||
<#-- Subject -->
|
||||
<#if data.titleError>
|
||||
<@form_error>Subject is too short (min.: 2 characters)</@form_error>
|
||||
</#if>
|
||||
<@form_text label="Subject" name="title" maxLength=64 value=data.title />
|
||||
|
||||
<#-- Body -->
|
||||
<#if data.contentsError>
|
||||
<@form_error>Contents are too short (min.: 2 characters)</@form_error>
|
||||
</#if>
|
||||
<@form_text label="Contents" name="contents" value=data.contents multiline=true maxLength=10 />
|
||||
|
||||
<@form_extended_submit label="Send message">
|
||||
<@ff_submit label="Cancel" name="cancel" />
|
||||
</@form_extended_submit>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<#-- Original message -->
|
||||
<#if data.replyTo?has_content>
|
||||
<@listview><@lv_line headers=true><th colspan="2" style="font-size:1px"> </th></@lv_line></@listview>
|
||||
<@dt_main>
|
||||
<@dt_entry width=100 title="">Original message:</@dt_entry>
|
||||
<@dt_entry width=100 title="From">
|
||||
${data.replyTo.sender!}
|
||||
</@dt_entry>
|
||||
<@dt_entry width=100 title="To">
|
||||
${data.replyTo.receiver!}
|
||||
</@dt_entry>
|
||||
<@dt_entry width=100 title="Received">
|
||||
${data.replyTo.time?string("yyyy-MM-dd HH:mm:ss")}
|
||||
</@dt_entry>
|
||||
</@dt_main>
|
||||
|
||||
<@listview><@lv_line headers=true><th colspan="2" style="font-size:1px"> </th></@lv_line></@listview>
|
||||
|
||||
<h3 style="margin:0;text-align:center;padding:0 0 10px 0">${data.replyTo.title}</h3>
|
||||
<div style="margin: 0 40px 20px 40px">
|
||||
${data.replyTo.contents}
|
||||
</div>
|
||||
</#if>
|
||||
|
||||
</@page>
|
||||
</#macro>
|
||||
<@render />
|
|
@ -0,0 +1,72 @@
|
|||
<#macro render_name_entry name>
|
||||
<@lv_line>
|
||||
<@lv_column centered=true><input type="checkbox" name="ids" value="${name.id}" id="ns-${name.id}" /></@lv_column>
|
||||
<#if data.type = "EMPIRE" && (name.extra!"x") == "">
|
||||
<@lv_column><label for="ns-${name.id}"><em title="name currently in use">${name.name?xhtml}</em></label></@lv_column>
|
||||
<#else>
|
||||
<@lv_column><label for="ns-${name.id}">${name.name?xhtml}</label></@lv_column>
|
||||
</#if>
|
||||
<#if data.type = "ALLIANCE">
|
||||
<@lv_column><label for="ns-${name.id}">${name.extra?xhtml}</label></@lv_column>
|
||||
<#elseif data.type = "MAP_CHANGED">
|
||||
<@lv_column centered=true><#if name.type = "MAP_PENDING">No<#else>Yes</#if></@lv_column>
|
||||
</#if>
|
||||
</@lv_line>
|
||||
</#macro>
|
||||
<#macro render_actions>
|
||||
<#if data.type = "MAP_PENDING">
|
||||
<@ff_select name="action" id="action">
|
||||
<@form_option value="VALIDATE">Validate</@form_option>
|
||||
<@form_option value="REJECT">Reject and send warning</@form_option>
|
||||
<@form_option value="REJECT_BAN">Reject, send warning and ban name</@form_option>
|
||||
</@ff_select>
|
||||
<#elseif data.type = "MAP_VALIDATED">
|
||||
<@ff_select name="action" id="action">
|
||||
<@form_option value="REJECT">Reject and send warning</@form_option>
|
||||
<@form_option value="REJECT_BAN">Reject, send warning and ban name</@form_option>
|
||||
<@form_option value="RESET">Allow early renaming</@form_option>
|
||||
</@ff_select>
|
||||
<#elseif data.type = "MAP_CHANGED">
|
||||
<@ff_select name="action" id="action">
|
||||
<@form_option value="VALIDATE">Validate</@form_option>
|
||||
<@form_option value="REJECT">Reject and send warning</@form_option>
|
||||
<@form_option value="REJECT_BAN">Reject, send warning and ban name</@form_option>
|
||||
<@form_option value="RESET">Allow early renaming</@form_option>
|
||||
</@ff_select>
|
||||
<#elseif data.type = "EMPIRE">
|
||||
<@ff_select name="action" id="action">
|
||||
<@form_option value="REJECT">Forcibly rename to "RudeGuyXXX"</@form_option>
|
||||
<@form_option value="REJECT_BAN">Forcibly rename and ban old name</@form_option>
|
||||
</@ff_select>
|
||||
<#else>
|
||||
<input type="hidden" name="action" value="REJECT" />
|
||||
Disband selected alliance(s)
|
||||
</#if>
|
||||
</#macro>
|
||||
<@page title=data.type.description>
|
||||
<#if data.names?size = 0>
|
||||
<h1>No names to display</h1>
|
||||
<p>There are no such names at the moment.</p>
|
||||
<#else>
|
||||
<form action="names-${data.type.id}.action" method="post">
|
||||
<@listview>
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=24> </@lv_column>
|
||||
<#if data.type = "ALLIANCE">
|
||||
<@lv_column width=100>Tag</@lv_column>
|
||||
<@lv_column width=300>Name</@lv_column>
|
||||
<#elseif data.type = "MAP_CHANGED">
|
||||
<@lv_column width=300>Name</@lv_column>
|
||||
<@lv_column width=150 centered=true>Validated</@lv_column>
|
||||
<#else>
|
||||
<@lv_column width=300>Name</@lv_column>
|
||||
</#if>
|
||||
</@lv_line>
|
||||
<#list data.names as name>
|
||||
<@render_name_entry name=name />
|
||||
</#list>
|
||||
</@listview>
|
||||
<p><@render_actions /> <input type="submit" value="Go" /></p>
|
||||
</form>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,20 @@
|
|||
<@page title="Names">
|
||||
<@listview>
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=250>Status</@lv_column>
|
||||
<@lv_column width=100 centered=true>Names</@lv_column>
|
||||
</@lv_line>
|
||||
<#list data.entries as entry>
|
||||
<@lv_line>
|
||||
<@lv_column>
|
||||
<#if entry.count gt 0>
|
||||
<a href="names-${entry.type.id}">${entry.type.description?xhtml}</a>
|
||||
<#else>
|
||||
${entry.type.description?xhtml}
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>${entry.count?string(",##0")}</@lv_column>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
</@listview>
|
||||
</@page>
|
|
@ -0,0 +1,5 @@
|
|||
<@page title="Server off-line">
|
||||
<p>
|
||||
The Legacy Worlds game server is currently off-line. Manual repairs need to be undertaken.
|
||||
</p>
|
||||
</@page>
|
|
@ -0,0 +1,53 @@
|
|||
<#macro render_preference pref>
|
||||
<div class="form-container">
|
||||
<form action="prefs.action#ff-pref-${pref.id}" method="post">
|
||||
<table>
|
||||
<tr class="form-field">
|
||||
<th style="width: 180px">Preference name:</th>
|
||||
<td>
|
||||
<strong>${pref.name?xhtml}</strong>
|
||||
<input type="hidden" name="pref" value="${pref.id?xhtml}" />
|
||||
</td>
|
||||
</tr>
|
||||
<#switch pref.type>
|
||||
<#case 'BOOLEAN'>
|
||||
<@form_select label="Default value" name="value" id="pref-${pref.id}">
|
||||
<@form_option value="0" text="No" selected=( pref.value != "1" )/>
|
||||
<@form_option value="1" text="Yes" selected=( pref.value == "1" )/>
|
||||
</@form_select>
|
||||
<#break>
|
||||
<#case 'INTEGER'>
|
||||
<#case 'STRING'>
|
||||
<@form_text label="Default value" name="value" id="pref-${pref.id}" value=pref.value />
|
||||
<#break>
|
||||
<#case 'CHOICE'>
|
||||
<@form_select label="Default value" name="value" id="pref-${pref.id}">
|
||||
<#list pref.choices as choice>
|
||||
<@form_option value=choice.value text=choice.display selected=( pref.value == choice.value )/>
|
||||
</#list>
|
||||
</@form_select>
|
||||
<#break>
|
||||
</#switch>
|
||||
<#if pref.description?has_content>
|
||||
<tr class="form-field">
|
||||
<th>Description:</th>
|
||||
<td>${pref.description?xhtml}</td>
|
||||
</tr>
|
||||
</#if>
|
||||
<@form_submit label="Update default value" />
|
||||
</table>
|
||||
</form>
|
||||
<p> </p>
|
||||
</div>
|
||||
</#macro>
|
||||
<#macro render_prefs_category category>
|
||||
<h1>${category.name?xhtml}</h1>
|
||||
<#list category.preferences as p>
|
||||
<@render_preference pref=p />
|
||||
</#list>
|
||||
</#macro>
|
||||
<@page title="Default preferences">
|
||||
<#list data.preferences as c>
|
||||
<@render_prefs_category category=c />
|
||||
</#list>
|
||||
</@page>
|
|
@ -0,0 +1,18 @@
|
|||
<@page title="Administrator ${data.view.name} - reset password">
|
||||
<@dt_main>
|
||||
<@dt_entry title="Name">${data.view.name?xhtml}</@dt_entry>
|
||||
<@dt_entry title="Address">
|
||||
<#if data.view.address?has_content>
|
||||
${data.view.address?xhtml}
|
||||
<#else>
|
||||
<em>(account deleted)</em>
|
||||
</#if>
|
||||
</@dt_entry>
|
||||
</@dt_main>
|
||||
|
||||
<@form action="do-reset-admin-${data.view.id}">
|
||||
<@form_extended_submit label="Reset password">
|
||||
<@ff_submit label="Cancel" name="cancel" />
|
||||
</@form_extended_submit>
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,27 @@
|
|||
<@page title="Spaminator! (TM)">
|
||||
<#if data.preview?has_content>
|
||||
<h1>Message preview</h1>
|
||||
<div>${data.preview}</div>
|
||||
<p> </p>
|
||||
</#if>
|
||||
|
||||
<h1>Compose spam</h1>
|
||||
<p>This message is going to be sent to every player in the game, so please don't be a complete idiot while typing it.</p>
|
||||
<@form action="send-spam">
|
||||
|
||||
<#if data.titleError!false>
|
||||
<@form_error>Spam title missing, too short or too long</@form_error>
|
||||
</#if>
|
||||
<@form_text name="title" label="Title" value=data.title!"" maxLength=64/>
|
||||
|
||||
<#if data.bodyError!false>
|
||||
<@form_error>Spam body missing or too short</@form_error>
|
||||
</#if>
|
||||
<@form_text name="body" label="Body" value=data.body!"" multiline=true maxLength=10 />
|
||||
|
||||
<@form_extended_submit label="Spam, spam, spam!">
|
||||
<@ff_submit label="Preview" name="preview" />
|
||||
</@form_extended_submit>
|
||||
|
||||
</@form>
|
||||
</@page>
|
|
@ -0,0 +1,51 @@
|
|||
<#macro render_task task>
|
||||
<@lv_line>
|
||||
<@lv_column> </@lv_column>
|
||||
<@lv_column>${task.name?xhtml}</@lv_column>
|
||||
<@lv_column>${task.status.description?xhtml}<#if task.status = 'AUTO'>
|
||||
<br/>${task.start?string("yyyy-MM-dd HH:mm:ss")}
|
||||
</#if></@lv_column>
|
||||
<@lv_column>
|
||||
<form action="set-ticker-task-${task.id}.action" method="post">
|
||||
<#if task.status != 'RUNNING'>
|
||||
<a href="start-ticker-task-${task.id}.action">Start</a> -
|
||||
</#if>
|
||||
<#if task.status != 'STOPPED'>
|
||||
<a href="stop-ticker-task-${task.id}.action">Stop</a>
|
||||
</#if>
|
||||
<br/>
|
||||
Schedule automatic start in
|
||||
<@ff_text name="delay" value="1" id="delay" maxLength=5 />
|
||||
<@ff_select name="multiplier" id="multiplier">
|
||||
<@form_option value="86400">day(s)</@form_option>
|
||||
<@form_option value="3600">hour(s)</@form_option>
|
||||
<@form_option value="60">minute(s)</@form_option>
|
||||
<@form_option value="1">second(s)</@form_option>
|
||||
</@ff_select>
|
||||
<@ff_submit label="Go" />
|
||||
</form>
|
||||
</@lv_column>
|
||||
</@lv_line>
|
||||
</#macro>
|
||||
<@page title="Ticker status">
|
||||
<h1>Ticker tasks</h1>
|
||||
<@listview>
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=40> </@lv_column>
|
||||
<@lv_column width=180>Task name</@lv_column>
|
||||
<@lv_column width=200>Status</@lv_column>
|
||||
<@lv_column width="x"> </@lv_column>
|
||||
</@lv_line>
|
||||
<#list data.tasks as task>
|
||||
<@render_task task=task />
|
||||
</#list>
|
||||
</@listview>
|
||||
<p> </p>
|
||||
|
||||
<h1>Ticker main thread</h1>
|
||||
<#if data.paused>
|
||||
<p>The main ticker thread is currently paused. <a href="toggle-ticker.action">Start it</a></p>
|
||||
<#else>
|
||||
<p>The main ticker thread is currently running. <a href="toggle-ticker.action">Pause it</a></p>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,58 @@
|
|||
<#assign accnt = data.account>
|
||||
<@page title="User #${accnt.id?string(',##0')} - ${accnt.address}">
|
||||
<@dt_main>
|
||||
|
||||
<@dt_entry title="User ID">${accnt.id?string(',##0')}</@dt_entry>
|
||||
<@dt_entry title="E-mail address">${accnt.address?xhtml}</@dt_entry>
|
||||
<@dt_entry title="Language code">${accnt.language}</@dt_entry>
|
||||
|
||||
<@dt_blank />
|
||||
|
||||
<@dt_entry title="Current status"><a href="users-by-status?status=${accnt.status?url}">${accnt.status.description?xhtml}</a></@dt_entry>
|
||||
<#if accnt.statusStart?has_content>
|
||||
<@dt_entry title="Since / Starting from">${accnt.statusStart?string("yyyy-MM-dd HH:mm:ss")}</@dt_entry>
|
||||
</#if>
|
||||
<#if accnt.inactivityReason?has_content>
|
||||
<@dt_entry title="Reason">${accnt.inactivityReason?xhtml}</@dt_entry>
|
||||
</#if>
|
||||
<#if accnt.ban?has_content>
|
||||
<#assign be = accnt.ban>
|
||||
<@dt_entry title="Requested by"><a href="msg-admin-${be.requestedById}">${be.requestedByName?xhtml}</a></@dt_entry>
|
||||
<@dt_entry title="Confirmed by"><a href="msg-admin-${be.confirmedById}">${be.confirmedByName?xhtml}</a></@dt_entry>
|
||||
</#if>
|
||||
<@dt_entry title="Warnings received">${accnt.warnings}</@dt_entry>
|
||||
<#if accnt.warnings gt 0>
|
||||
<@dt_entry title="Last warning">${accnt.lastWarning?string("yyyy-MM-dd HH:mm:ss")}</@dt_entry>
|
||||
</#if>
|
||||
|
||||
<@dt_blank />
|
||||
|
||||
<#if accnt.online>
|
||||
<@dt_entry title="">CURRENTLY ONLINE</@dt_entry>
|
||||
</#if>
|
||||
<@dt_entry title=""><a href="user-${accnt.id}-sessions">View sessions</a></@dt_entry>
|
||||
|
||||
<@dt_blank />
|
||||
|
||||
<@dt_entry title="Vacation credits">${accnt.vacationCredits?string(",##0")}</@dt_entry>
|
||||
<@dt_entry title="Game credits">${accnt.gameCredits?string(",##0")}</@dt_entry>
|
||||
<@dt_entry title="">
|
||||
<form action="user-${accnt.id}.action" method="post">
|
||||
Grant this user <@ff_text name="credits" id="credits" value=1 /> credit(s)
|
||||
<@ff_submit label="Go" />
|
||||
</form>
|
||||
</@dt_entry>
|
||||
|
||||
<@dt_blank />
|
||||
|
||||
<#if accnt.currentEmpire?has_content>
|
||||
<@dt_entry title="Currently playing as"><a href="msg-empire-${accnt.empireId}">${accnt.currentEmpire?xhtml}</a></@dt_entry>
|
||||
</#if>
|
||||
<#if accnt.empireNames?size gt 0>
|
||||
<@dt_entry title="All empire names">
|
||||
<#list accnt.empireNames as name>${name?xhtml}<br/></#list>
|
||||
</@dt_entry>
|
||||
</#if>
|
||||
|
||||
</@dt_main>
|
||||
</@page>
|
|
@ -0,0 +1,57 @@
|
|||
<@page title="User #${data.account.id?string(',##0')} - Sessions">
|
||||
<h1>Account</h1>
|
||||
<@dt_main>
|
||||
<@dt_entry title="E-mail address">${data.account.address?xhtml}</@dt_entry>
|
||||
<@dt_entry title="Language code">${data.account.language}</@dt_entry>
|
||||
<@dt_entry title="Current status">${data.account.status.description?xhtml}</@dt_entry>
|
||||
<#if data.account.currentEmpire?has_content>
|
||||
<@dt_entry title="Currently playing as">${data.account.currentEmpire?xhtml}</@dt_entry>
|
||||
</#if>
|
||||
<@dt_entry title=""><a href="user-${data.account.id}">Back to account page</a></@dt_entry>
|
||||
</@dt_main>
|
||||
|
||||
<h1>Sessions</h1>
|
||||
<#if data.account.sessions?size = 0>
|
||||
<p>No sessions for this account.</p>
|
||||
<#else>
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=60 centered=true>ID#</@lv_column>
|
||||
<@lv_column width=60 centered=true>C.T.</@lv_column>
|
||||
<@lv_column width=120 centered=true>IP address</@lv_column>
|
||||
<@lv_column width=60 centered=true>Start date</@lv_column>
|
||||
<@lv_column width=60 centered=true>- time</@lv_column>
|
||||
<@lv_column width=60 centered=true>End date</@lv_column>
|
||||
<@lv_column width=60 centered=true>- time</@lv_column>
|
||||
<@lv_column width="x">Termination reason</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.account.sessions as session>
|
||||
<@lv_line>
|
||||
<@lv_column centered=true>${session.id?string(",##0")}</@lv_column>
|
||||
<@lv_column centered=true>
|
||||
<#if session.exclusive>
|
||||
${session.clientName?xhtml}
|
||||
<#else>
|
||||
<em>${session.clientName?xhtml}</em>
|
||||
</#if>
|
||||
</@lv_column>
|
||||
<@lv_column centered=true>${session.fromAddress?xhtml}</@lv_column>
|
||||
<@lv_column centered=true>${session.started?string('yyyy-MM-dd')}</@lv_column>
|
||||
<@lv_column centered=true>${session.started?string('HH:mm:ss')}</@lv_column>
|
||||
|
||||
<#if session.ended?has_content>
|
||||
<@lv_column centered=true>${session.ended?string('yyyy-MM-dd')}</@lv_column>
|
||||
<@lv_column centered=true>${session.ended?string('HH:mm:ss')}</@lv_column>
|
||||
<@lv_column>${session.endType.description?xhtml}</@lv_column>
|
||||
<#else>
|
||||
<td colspan="3" style="text-align:center"><em>Still connected</em></td>
|
||||
</#if>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
|
||||
</@listview>
|
||||
</#if>
|
||||
|
||||
</@page>
|
|
@ -0,0 +1,49 @@
|
|||
<#if data.status?has_content>
|
||||
<#assign pTitle= "Users with status '${data.status.description}'">
|
||||
</#if>
|
||||
<@page title=pTitle!"Users">
|
||||
<form action="users-by-status" method="get">
|
||||
<p>
|
||||
Display
|
||||
<@ff_select name="online" id="online">
|
||||
<@form_option value="0">all</@form_option>
|
||||
<@form_option value="1" selected=data.online!false>online</@form_option>
|
||||
</@ff_select>
|
||||
users that have the following status:
|
||||
<@ff_select name="status" id="status">
|
||||
<@form_option value="x" selected=!(data.status?has_content)>(all users)</@form_option>
|
||||
<#list data.allStatuses as st>
|
||||
<@form_option value=st selected=((data.status!"") = st)>${st.description}</@form_option>
|
||||
</#list>
|
||||
</@ff_select>
|
||||
<@ff_submit label="Filter" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<#if data.entries?size gt 0>
|
||||
<p>${data.entries?size} account(s) found.</p>
|
||||
<@listview>
|
||||
|
||||
<@lv_line headers=true>
|
||||
<@lv_column width=40> </@lv_column>
|
||||
<@lv_column width=250>E-mail address</@lv_column>
|
||||
<@lv_column width=250>Current empire</@lv_column>
|
||||
<@lv_column width=100 centered=true>Status</@lv_column>
|
||||
<@lv_column width=100 centered=true>Language</@lv_column>
|
||||
</@lv_line>
|
||||
|
||||
<#list data.entries as entry>
|
||||
<@lv_line>
|
||||
<@lv_column> </@lv_column>
|
||||
<@lv_column><a href="user-${entry.id}">${entry.address?xhtml}</a></@lv_column>
|
||||
<@lv_column><#if entry.currentEmpire?has_content>${entry.currentEmpire?xhtml}<#else><em>N/A</em></#if></@lv_column>
|
||||
<@lv_column centered=true>${entry.status.description?xhtml}</@lv_column>
|
||||
<@lv_column centered=true>${entry.language}</@lv_column>
|
||||
</@lv_line>
|
||||
</#list>
|
||||
|
||||
</@listview>
|
||||
<#else>
|
||||
<p>No accounts found</p>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,41 @@
|
|||
<@page title="Administrator ${data.view.name}">
|
||||
<h1>General information</h1>
|
||||
<@dt_main>
|
||||
<@dt_entry title="Name">${data.view.name?xhtml}</@dt_entry>
|
||||
<@dt_entry title="Address">
|
||||
<#if data.view.address?has_content>
|
||||
${data.view.address?xhtml}
|
||||
<#else>
|
||||
<em>(account deleted)</em>
|
||||
</#if>
|
||||
</@dt_entry>
|
||||
|
||||
<@dt_entry title="Password modified">
|
||||
<#if data.view.passwordChange>
|
||||
no
|
||||
<#else>
|
||||
yes
|
||||
</#if>
|
||||
</@dt_entry>
|
||||
<#if data.view.id != data.admin.id && data.view.address?has_content && !data.view.passwordChange>
|
||||
<@dt_entry title=""><a href="reset-admin-${data.view.id}.action">Reset administration password</a></@dt_entry>
|
||||
</#if>
|
||||
</@dt_main>
|
||||
|
||||
<#if data.view.id != data.admin.id && data.view.address?has_content>
|
||||
<p> </p>
|
||||
<h1>Privileges</h1>
|
||||
<@form action="admin-privileges-${data.view.id}">
|
||||
<tr class="form-field">
|
||||
<th>Privileges:</th>
|
||||
<td>
|
||||
<#list data.view.allPrivileges as privilege>
|
||||
<input class="input" type="checkbox" name="privileges" value="${privilege.privilege}" id="priv-${privilege.privilege}" <#if privilege.present>checked="checked"</#if> />
|
||||
<label for="priv-${privilege.privilege}"><abbr title="${privilege.privilege.description?xhtml}">${privilege.privilege}</abbr></label>
|
||||
</#list>
|
||||
</td>
|
||||
</tr>
|
||||
<@form_submit label="Update privileges" />
|
||||
</@form>
|
||||
</#if>
|
||||
</@page>
|
|
@ -0,0 +1,2 @@
|
|||
<#macro version>Milestone 1</#macro>
|
||||
<#macro full_version>Beta 6 milestone 1 (5.99.1)</#macro>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
|
||||
<display-name>legacyworlds-web-admin</display-name>
|
||||
|
||||
<filter>
|
||||
<filter-name>charsetFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>UTF-8</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forceEncoding</param-name>
|
||||
<param-value>1</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>charsetFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>admin</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>pass-through</servlet-name>
|
||||
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>pass-through</servlet-name>
|
||||
<url-pattern>*.js</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>pass-through</servlet-name>
|
||||
<url-pattern>*.css</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>pass-through</servlet-name>
|
||||
<url-pattern>*.jpg</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>pass-through</servlet-name>
|
||||
<url-pattern>*.png</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>admin</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
171
legacyworlds-web/legacyworlds-web-admin/WebContent/css/main.css
Normal file
171
legacyworlds-web/legacyworlds-web-admin/WebContent/css/main.css
Normal file
|
@ -0,0 +1,171 @@
|
|||
* {
|
||||
color: black;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 10pt;
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #ffefef;
|
||||
}
|
||||
|
||||
/* Page header */
|
||||
div.page-header {
|
||||
width: 80%;
|
||||
margin: 5px auto 20px auto;
|
||||
background-color: #ff7f7f;
|
||||
border-color: #ff0000;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.page-header * {
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
.page-header h2 {
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
.page-header h3 {
|
||||
font-size: 9pt;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Page body */
|
||||
div.page-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.page-full.page-contents {
|
||||
padding: 0px 20px;
|
||||
}
|
||||
|
||||
.page-full .page-contents {
|
||||
padding: 0px 20px 0px 250px;
|
||||
}
|
||||
|
||||
/* Side bar */
|
||||
.side-bar {
|
||||
float: left;
|
||||
margin: 0px 5px;
|
||||
padding: 5px;
|
||||
width: 225px;
|
||||
background-color: #ffafaf;
|
||||
border-color: #ff7f7f;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.side-bar .admin {
|
||||
font-size: 11pt;
|
||||
font-weight: bold;
|
||||
padding: 0 0 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.side-bar a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
padding: 3px 0;
|
||||
}
|
||||
|
||||
.side-bar a:hover {
|
||||
background-color: #ff0000;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Text */
|
||||
h1 {
|
||||
font-size: 14pt;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 13pt;
|
||||
margin: 0 0 10px 10px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 12pt;
|
||||
margin: 0 0 10px 20px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 11pt;
|
||||
margin: 0 0 10px 40px;
|
||||
}
|
||||
|
||||
.page-contents p {
|
||||
margin: 5px 10px 5px 30px;
|
||||
text-align: justify;
|
||||
text-indent: 20px;
|
||||
}
|
||||
|
||||
.page-contents ul,.page-contents ol {
|
||||
margin: 0px 0px 0px 20px;
|
||||
padding: 0px 0px 0px 10px;
|
||||
}
|
||||
|
||||
.page-contents li {
|
||||
margin: 0px 0px 0px 20px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
.form-container table {
|
||||
margin: 0 0 0 80px;
|
||||
}
|
||||
|
||||
.form-error {
|
||||
background-color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-error,.form-error * {
|
||||
color: yellow;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/* List views */
|
||||
.list-view th,.list-view td {
|
||||
padding: 0 15px 0 0;
|
||||
}
|
||||
|
||||
/* Log entries */
|
||||
tr.log-entry-error,tr.log-entry-error * {
|
||||
background-color: #ff0000;
|
||||
color: #ffff00;
|
||||
}
|
||||
|
||||
tr.log-entry-warning,tr.log-entry-warning * {
|
||||
background-color: #ffff00;
|
||||
color: #0000ff;
|
||||
}
|
||||
|
||||
tr.log-entry-info,tr.log-entry-info * {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
tr.log-entry-debug,tr.log-entry-debug * {
|
||||
background-color: #afffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
tr.log-entry-trace,tr.log-entry-trace * {
|
||||
background-color: #afffaf;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.unread-msg * {
|
||||
font-weight: bold;
|
||||
}
|
95
legacyworlds-web/legacyworlds-web-admin/pom.xml
Normal file
95
legacyworlds-web/legacyworlds-web-admin/pom.xml
Normal file
|
@ -0,0 +1,95 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>legacyworlds-web</artifactId>
|
||||
<groupId>com.deepclone.lw</groupId>
|
||||
<version>5.99.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.deepclone.lw</groupId>
|
||||
<artifactId>legacyworlds-web-admin</artifactId>
|
||||
<version>5.99.1</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Legacy Worlds administration site</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.deepclone.lw</groupId>
|
||||
<artifactId>legacyworlds-web-beans</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>${org.freemarker.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>${com.thoughtworks.xstream.version}</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>tomcat-maven-plugin</artifactId>
|
||||
<version>1.0-beta-1</version>
|
||||
<configuration>
|
||||
<url>http://localhost:8080/manager</url>
|
||||
<path>/lwadmin</path>
|
||||
<update>true</update>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>deploy-admin-site</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>deploy</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
<configuration>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>legacyworlds-web/legacyworlds-web-admin/WebContent</directory>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-admin-war</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>war</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,172 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.AdminResponse;
|
||||
import com.deepclone.lw.cmd.admin.adata.Privileges;
|
||||
import com.deepclone.lw.cmd.admin.bans.BanType;
|
||||
import com.deepclone.lw.cmd.admin.bans.BansSummaryResponse;
|
||||
import com.deepclone.lw.cmd.admin.bans.ListBansResponse;
|
||||
import com.deepclone.lw.cmd.admin.bans.RejectBanResponse;
|
||||
import com.deepclone.lw.cmd.admin.bans.RequestBanResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class BanhammerPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/bans" )
|
||||
public String bansSummary( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BansSummaryResponse response = this.getSession( AdminSession.class , request ).getBansSummary( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "bansSummary" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/bans-{type}" )
|
||||
public String listBans( HttpServletRequest request , Model model , @PathVariable( "type" ) String sType )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BanType type;
|
||||
try {
|
||||
type = BanType.valueOf( sType.toUpperCase( ) );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
return this.redirect( "bans" );
|
||||
}
|
||||
|
||||
ListBansResponse response = this.getSession( AdminSession.class , request ).getBans( type );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "bans" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/request-ban" )
|
||||
public String requestBan( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminResponse response = this.getSession( AdminSession.class , request ).noOp( Privileges.BANH );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "banRequest" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/request-ban.action" , method = RequestMethod.POST )
|
||||
public String requestBan( HttpServletRequest request , Model model , @RequestParam( "eName" ) String eName ,
|
||||
@RequestParam( "eMail" ) String eMail , @RequestParam( "reason" ) String reason )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
boolean empire = "".equals( eMail );
|
||||
String user = empire ? eName : eMail;
|
||||
|
||||
RequestBanResponse response = this.getSession( AdminSession.class , request ).requestBan( user , empire ,
|
||||
reason );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getError( ) == null ) {
|
||||
return this.redirect( "bans" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "banRequest" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "reject-ban-{id}" )
|
||||
public String rejectBan( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bans-pending" );
|
||||
}
|
||||
|
||||
AdminResponse response = this.getSession( AdminSession.class , request ).noOp( Privileges.BANH );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
|
||||
return this.renderMap( model , "internal" , "en" , "banReject" , "admin" , response.getAdmin( ) , "id" , id );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "reject-ban-{id}.action" , method = RequestMethod.POST )
|
||||
public String rejectBan( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "reason" ) String reason )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bans-pending" );
|
||||
}
|
||||
|
||||
RejectBanResponse response = this.getSession( AdminSession.class , request ).rejectBan( id , reason );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( !response.isError( ) ) {
|
||||
return this.redirect( "bans-pending" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "banReject" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "confirm-ban-{id}.action" )
|
||||
public String confirmBan( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bans-pending" );
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).confirmBan( id );
|
||||
return this.redirect( "bans-pending" );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "lift-ban-{id}.action" )
|
||||
public String liftBan( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bans-validated" );
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).liftBan( id );
|
||||
return this.redirect( "bans-validated" );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,373 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.adata.Administrator;
|
||||
import com.deepclone.lw.cmd.admin.adata.Privileges;
|
||||
import com.deepclone.lw.cmd.admin.bt.*;
|
||||
import com.deepclone.lw.cmd.bt.data.BugEvent;
|
||||
import com.deepclone.lw.cmd.bt.data.BugStatus;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.msgs.MessageFormatter;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.BugTrackerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class BugTrackerPages
|
||||
extends BugTrackerBase
|
||||
{
|
||||
private static final int perPage = 20;
|
||||
|
||||
private MessageFormatter formatter;
|
||||
|
||||
|
||||
@Autowired( required = true )
|
||||
public void setFormatter( MessageFormatter formatter )
|
||||
{
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/btracker" )
|
||||
public String getSummary( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugsSummaryResponse summary = this.getSession( AdminSession.class , request ).getBugsSummary( );
|
||||
if ( !summary.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "bugsSummary" , summary );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/bugs" )
|
||||
public String listBugs( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ListBugsResponse response = aSession.listBugs( query.status , query.ownOnly , query.first , perPage );
|
||||
return this.render( model , "internal" , "en" , "bugsList" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/report-bug" )
|
||||
public String showReportForm( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
Administrator admin = aSession.noOp( Privileges.BUGT ).getAdmin( );
|
||||
return this.renderMap( model , "internal" , "en" , "bugsReport" , "admin" , admin , "query" , query );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/report-bug.action" , method = RequestMethod.POST )
|
||||
public String postReport( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @RequestParam( "title" ) String title ,
|
||||
@RequestParam( "description" ) String description ,
|
||||
@RequestParam( value = "public" , required = false , defaultValue = "0" ) String publicReport )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ReportBugResponse response = aSession.reportBug( title , description , "1".equals( publicReport ) );
|
||||
|
||||
if ( response.getTitle( ) == null ) {
|
||||
// Successful post
|
||||
String rTo = "bug-" + response.getBugId( ) + this.makeGetParams( query );
|
||||
return this.redirect( rTo );
|
||||
}
|
||||
|
||||
response = new ReportBugResponse( response , query );
|
||||
return this.render( model , "internal" , "en" , "bugsReport" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}" )
|
||||
public String viewBug( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugs" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
ViewBugResponse response = this.getSession( AdminSession.class , request ).getBugReport( bugId );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getReport( ) == null ) {
|
||||
return this.redirect( "bugs" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
response = new ViewBugResponse( response , query );
|
||||
return this.displayReport( model , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}-comment.action" , method = RequestMethod.POST )
|
||||
public String commentBug( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "comment" ) String comment , @RequestParam( "visibility" ) String visibility )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
PostCommentResponse response = this.getSession( AdminSession.class , request ).postBugComment( bugId , comment ,
|
||||
"1".equals( visibility ) );
|
||||
if ( response.isPosted( ) ) {
|
||||
String rTo = "bug-" + bugId + this.makeGetParams( query );
|
||||
return this.redirect( rTo );
|
||||
} else if ( response.getReport( ) == null ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
response = new PostCommentResponse( response , query );
|
||||
return this.displayReport( model , response );
|
||||
}
|
||||
|
||||
|
||||
private String displayReport( Model model , ViewBugResponse response )
|
||||
{
|
||||
for ( BugEvent event : response.getEvents( ) ) {
|
||||
if ( event.getTitle( ) != null ) {
|
||||
event.setTitle( this.formatter.cleanMessage( event.getTitle( ) ) );
|
||||
}
|
||||
if ( event.getContents( ) != null ) {
|
||||
event.setContents( this.formatter.formatMessage( event.getContents( ) , false ) );
|
||||
}
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "bugsView" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}-comment-moderation.action" , method = RequestMethod.POST )
|
||||
public String moderateComment( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "comment" ) String sComment , @RequestParam( "cAction" ) String validate )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
long commentId;
|
||||
try {
|
||||
commentId = Long.parseLong( sComment );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).moderateBugComment( commentId , "1".equals( validate ) );
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}-validation.action" , method = RequestMethod.POST )
|
||||
public String moderateReport( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "nStatus" ) String sNewStatus , @RequestParam( "visibility" ) String visibility ,
|
||||
@RequestParam( "credits" ) String sCredits , @RequestParam( "snapshot" ) String keepSnapshot )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
BugStatus newStatus;
|
||||
try {
|
||||
newStatus = BugStatus.valueOf( sNewStatus );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
newStatus = BugStatus.PENDING;
|
||||
}
|
||||
|
||||
boolean visible = "1".equals( visibility );
|
||||
boolean snapshot = "1".equals( keepSnapshot );
|
||||
int grantCredits;
|
||||
try {
|
||||
grantCredits = Integer.parseInt( sCredits );
|
||||
} catch ( NumberFormatException e ) {
|
||||
grantCredits = -1;
|
||||
}
|
||||
if ( grantCredits < 0 || grantCredits > 3 || newStatus == BugStatus.PENDING ) {
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).validateReport( bugId , newStatus , visible , grantCredits ,
|
||||
snapshot );
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}-status.action" , method = RequestMethod.POST )
|
||||
public String setReportStatus( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "nStatus" ) String sNewStatus )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
BugStatus newStatus;
|
||||
try {
|
||||
newStatus = BugStatus.valueOf( sNewStatus );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
newStatus = BugStatus.PENDING;
|
||||
}
|
||||
|
||||
if ( newStatus != BugStatus.PENDING ) {
|
||||
this.getSession( AdminSession.class , request ).setReportStatus( bugId , newStatus );
|
||||
}
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}-visibility.action" , method = RequestMethod.POST )
|
||||
public String toggleReportVisibility( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).toggleReportVisibility( bugId );
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/bug-{id}-merge.action" , method = RequestMethod.POST )
|
||||
public String mergeReports( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "status" , required = false ) String sStatus ,
|
||||
@RequestParam( value = "own" , required = false ) String sOwn ,
|
||||
@RequestParam( value = "first" , required = false ) String sFirst , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "mergeId" ) String sMerge )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
BugQuery query = this.getBugQuery( sStatus , sOwn , sFirst );
|
||||
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
long mergeId;
|
||||
try {
|
||||
mergeId = Long.parseLong( sMerge );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "bug-" + bugId + this.makeGetParams( query ) );
|
||||
}
|
||||
|
||||
MergeReportsResponse response = this.getSession( AdminSession.class , request ).mergeReports( bugId , mergeId );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getReport( ) == null ) {
|
||||
if ( response.getMergeError( ) == null ) {
|
||||
return this.redirect( "bug-" + mergeId + this.makeGetParams( query ) );
|
||||
} else {
|
||||
return this.redirect( "bugtrack" + this.makeGetParams( query ) );
|
||||
}
|
||||
}
|
||||
|
||||
response = new MergeReportsResponse( response , query );
|
||||
return this.displayReport( model , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/bug-{id}-xmlsnapshot" )
|
||||
public ResponseEntity< String > downloadSnapshot( HttpServletRequest request , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
long bugId;
|
||||
try {
|
||||
bugId = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return new ResponseEntity< String >( "GTFO" , HttpStatus.NOT_FOUND );
|
||||
}
|
||||
|
||||
GetSnapshotResponse response = this.getSession( AdminSession.class , request ).getSnapshot( bugId );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return new ResponseEntity< String >( "GTFO" , HttpStatus.FORBIDDEN );
|
||||
} else if ( response.getSnapshot( ) == null ) {
|
||||
return new ResponseEntity< String >( "GTFO" , HttpStatus.NOT_FOUND );
|
||||
}
|
||||
|
||||
HttpHeaders rHeaders = new HttpHeaders( );
|
||||
rHeaders.setContentType( MediaType.APPLICATION_OCTET_STREAM );
|
||||
return new ResponseEntity< String >( response.getSnapshot( ) , rHeaders , HttpStatus.OK );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.constants.GetConstantsResponse;
|
||||
import com.deepclone.lw.cmd.admin.constants.SetConstantResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class ConstantsPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/constants" )
|
||||
public String getConstants( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession session = this.getSession( AdminSession.class , request );
|
||||
GetConstantsResponse response = session.getConstants( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "constants" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/set-constant.action" , method = RequestMethod.POST )
|
||||
public String setConstant( HttpServletRequest request , Model model , @RequestParam( "name" ) String name ,
|
||||
@RequestParam( "value" ) String sValue )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
double value;
|
||||
try {
|
||||
value = Double.parseDouble( sValue );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "constants" );
|
||||
}
|
||||
|
||||
AdminSession session = this.getSession( AdminSession.class , request );
|
||||
SetConstantResponse response = session.setConstant( name , value );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( !response.isError( ) ) {
|
||||
return this.redirect( "constants" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "constants" , response );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.deepclone.lw.session.SessionCommandException;
|
||||
import com.deepclone.lw.session.SessionIdentifierException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
|
||||
|
||||
|
||||
public class ErrorHandlerBean
|
||||
implements HandlerExceptionResolver
|
||||
{
|
||||
|
||||
@Override
|
||||
public ModelAndView resolveException( HttpServletRequest request , HttpServletResponse response , Object handler ,
|
||||
Exception ex )
|
||||
{
|
||||
if ( ex instanceof SessionServerException ) {
|
||||
return this.offline( request );
|
||||
} else if ( ex instanceof SessionIdentifierException || ex instanceof SessionCommandException ) {
|
||||
return new ModelAndView( "redirect:admin-session" );
|
||||
}
|
||||
|
||||
// Other exceptions are not handled
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private ModelAndView offline( HttpServletRequest request )
|
||||
{
|
||||
ModelAndView mav = new ModelAndView( "ROOT" );
|
||||
mav.addObject( "container" , "external" );
|
||||
mav.addObject( "language" , "en" );
|
||||
mav.addObject( "type" , "offline" );
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.i18n.ChangeLanguageResponse;
|
||||
import com.deepclone.lw.cmd.admin.i18n.GetLanguageResponse;
|
||||
import com.deepclone.lw.cmd.admin.i18n.I18NString;
|
||||
import com.deepclone.lw.cmd.admin.i18n.SetStringResponse;
|
||||
import com.deepclone.lw.cmd.admin.i18n.ViewLanguagesResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.admin.i18ne.LanguageExport;
|
||||
import com.deepclone.lw.web.admin.i18ne.StringExport;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class I18NPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/i18n" )
|
||||
public String listLanguages( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
ViewLanguagesResponse response = this.getSession( AdminSession.class , request ).listLanguages( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "languages" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/i18n-{language}" )
|
||||
public String viewLanguage( HttpServletRequest request , Model model , @PathVariable( "language" ) String language )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
GetLanguageResponse response = this.getSession( AdminSession.class , request ).getLanguage( language );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getLanguage( ) == null ) {
|
||||
return this.redirect( "i18n" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "language" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/i18n-export-{language}" )
|
||||
public ResponseEntity< String > exportLanguage( HttpServletRequest request ,
|
||||
@PathVariable( "language" ) String language )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
HttpHeaders rHeaders = new HttpHeaders( );
|
||||
GetLanguageResponse response = this.getSession( AdminSession.class , request ).getLanguage( language );
|
||||
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return new ResponseEntity< String >( "GTFO" , HttpStatus.FORBIDDEN );
|
||||
} else if ( response.getLanguage( ) == null ) {
|
||||
return new ResponseEntity< String >( "GTFO" , HttpStatus.NOT_FOUND );
|
||||
}
|
||||
|
||||
LanguageExport lExport = new LanguageExport( );
|
||||
lExport.id = response.getLanguage( ).getId( );
|
||||
lExport.name = response.getLanguage( ).getName( );
|
||||
for ( I18NString str : response.getStrings( ) ) {
|
||||
StringExport sExport = new StringExport( );
|
||||
sExport.id = str.getId( );
|
||||
sExport.value = str.getText( );
|
||||
lExport.strings.add( sExport );
|
||||
}
|
||||
|
||||
XStream xStream = new XStream( );
|
||||
xStream.autodetectAnnotations( true );
|
||||
rHeaders.setContentType( MediaType.APPLICATION_OCTET_STREAM );
|
||||
return new ResponseEntity< String >( xStream.toXML( lExport ) , rHeaders , HttpStatus.OK );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/i18n-{language}-edit.action" , method = RequestMethod.POST )
|
||||
public String changeLanguage( HttpServletRequest request , Model model ,
|
||||
@PathVariable( "language" ) String language , @RequestParam( "name" ) String name )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
ChangeLanguageResponse response;
|
||||
response = this.getSession( AdminSession.class , request ).setLanguageName( language , name );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getLanguage( ) == null ) {
|
||||
return this.redirect( "i18n" );
|
||||
} else if ( !response.isNameError( ) ) {
|
||||
return this.redirect( "i18n-" + response.getLanguage( ).getId( ) );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "language" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/i18n-{language}-set-string.action" , method = RequestMethod.POST )
|
||||
public String setString( HttpServletRequest request , Model model , @PathVariable( "language" ) String language ,
|
||||
@RequestParam( "string" ) String string , @RequestParam( "value" ) String value )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
SetStringResponse response;
|
||||
response = this.getSession( AdminSession.class , request ).setTranslation( language , string , value );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getLanguage( ) == null ) {
|
||||
return this.redirect( "i18n" );
|
||||
} else if ( response.getEdited( ) == null ) {
|
||||
return this.redirect( "i18n-" + response.getLanguage( ).getId( ) );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "language" , response );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.logs.GetEntryResponse;
|
||||
import com.deepclone.lw.cmd.admin.logs.LogLevel;
|
||||
import com.deepclone.lw.cmd.admin.logs.LogType;
|
||||
import com.deepclone.lw.cmd.admin.logs.ViewLogResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class LogPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
private final int pageSize = 30;
|
||||
|
||||
|
||||
@RequestMapping( value = "/logs" , method = RequestMethod.GET )
|
||||
public String viewLogs( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int first = this.getFirstIndex( request );
|
||||
LogType logType = this.getLogType( request );
|
||||
LogLevel logLevel = this.getLogLevel( request );
|
||||
String component = request.getParameter( "component" );
|
||||
if ( component == null ) {
|
||||
component = "";
|
||||
} else {
|
||||
component = component.trim( ).toLowerCase( );
|
||||
}
|
||||
boolean excOnly = "1".equals( request.getParameter( "excOnly" ) );
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ViewLogResponse response = aSession.viewLog( logType , first , pageSize , logLevel , component , excOnly );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
|
||||
Map< String , Object > params = new HashMap< String , Object >( );
|
||||
params.put( "type" , logType );
|
||||
params.put( "level" , logLevel );
|
||||
params.put( "component" , component );
|
||||
params.put( "excOnly" , (Boolean) excOnly );
|
||||
params.put( "first" , first );
|
||||
|
||||
Map< String , Object > data = new HashMap< String , Object >( );
|
||||
data.put( "admin" , response.getAdmin( ) );
|
||||
data.put( "entries" , response.getEntries( ) );
|
||||
data.put( "count" , response.getCount( ) );
|
||||
data.put( "params" , params );
|
||||
|
||||
return this.render( model , "internal" , "en" , "logs" , data );
|
||||
}
|
||||
|
||||
|
||||
private int getFirstIndex( HttpServletRequest request )
|
||||
{
|
||||
String sIndex = request.getParameter( "first" );
|
||||
if ( sIndex == null ) {
|
||||
return 0;
|
||||
}
|
||||
int f;
|
||||
try {
|
||||
f = Integer.parseInt( sIndex );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return 0;
|
||||
}
|
||||
return ( f > 0 ) ? f : 0;
|
||||
}
|
||||
|
||||
|
||||
private LogType getLogType( HttpServletRequest request )
|
||||
{
|
||||
LogType logType;
|
||||
String sLogType = request.getParameter( "logType" );
|
||||
if ( sLogType == null ) {
|
||||
logType = LogType.SYSTEM;
|
||||
} else {
|
||||
try {
|
||||
logType = LogType.valueOf( sLogType );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
logType = LogType.SYSTEM;
|
||||
}
|
||||
}
|
||||
return logType;
|
||||
}
|
||||
|
||||
|
||||
private LogLevel getLogLevel( HttpServletRequest request )
|
||||
{
|
||||
LogLevel logLevel;
|
||||
String sLogLevel = request.getParameter( "logLevel" );
|
||||
if ( sLogLevel == null ) {
|
||||
logLevel = LogLevel.INFO;
|
||||
} else {
|
||||
try {
|
||||
logLevel = LogLevel.valueOf( sLogLevel );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
logLevel = LogLevel.INFO;
|
||||
}
|
||||
}
|
||||
return logLevel;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/view-log-entry-{id}" )
|
||||
public String viewLogEntry( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
long id;
|
||||
try {
|
||||
id = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "logs" );
|
||||
}
|
||||
|
||||
GetEntryResponse response = this.getSession( AdminSession.class , request ).getLogEntry( id );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getEntry( ) == null ) {
|
||||
return this.redirect( "logs" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "logEntry" , response );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = false , redirectTo = "admin-session" )
|
||||
public class LoginPage
|
||||
extends PageControllerBase
|
||||
{
|
||||
@RequestMapping( value = "/" )
|
||||
public String root( HttpServletRequest request , Model model )
|
||||
{
|
||||
return this.redirect( "login" );
|
||||
}
|
||||
|
||||
@RequestMapping( value = "/login" )
|
||||
public String login( HttpServletRequest request , Model model )
|
||||
{
|
||||
return this.renderMap( model , "external" , "en" , "login" , "failed" , (Boolean) false );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/login.action" , method = RequestMethod.POST )
|
||||
public String login( HttpServletRequest request , Model model , @RequestParam( "mail" ) String mail ,
|
||||
@RequestParam( "password" ) String password )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession aSession = this.initSession( AdminSession.class , request );
|
||||
boolean authenticated = aSession.authenticate( mail , password );
|
||||
if ( !authenticated ) {
|
||||
this.clearSession( request );
|
||||
return this.renderMap( model , "external" , "en" , "login" , "failed" , (Boolean) true );
|
||||
}
|
||||
return this.redirect( "admin-session" );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.mntm.*;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class MaintenancePages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/maintenance" )
|
||||
public String getMaintenanceStatus( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
MaintenanceStatusResponse response = this.getSession( AdminSession.class , request ).getMaintenanceStatus( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "maintenance" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/maintenance-start.action" , method = RequestMethod.POST )
|
||||
public String enableMaintenance( HttpServletRequest request , Model model ,
|
||||
@RequestParam( "reason" ) String reason , @RequestParam( "duration" ) String sDuration )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int duration;
|
||||
try {
|
||||
duration = Integer.parseInt( sDuration );
|
||||
} catch ( NumberFormatException e ) {
|
||||
duration = -1;
|
||||
}
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
MaintenanceChangeResponse response = aSession.enableMaintenance( reason , duration );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getNewReason( ) == null ) {
|
||||
return this.redirect( "maintenance" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "maintenance" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/maintenance-extend.action" , method = RequestMethod.POST )
|
||||
public String extendMaintenance( HttpServletRequest request , Model model ,
|
||||
@RequestParam( "duration" ) String sDuration )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int duration;
|
||||
try {
|
||||
duration = Integer.parseInt( sDuration );
|
||||
} catch ( NumberFormatException e ) {
|
||||
duration = -1;
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).extendMaintenance( duration );
|
||||
return this.redirect( "maintenance" );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/maintenance-end.action" , method = RequestMethod.POST )
|
||||
public String endMaintenance( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
this.getSession( AdminSession.class , request ).endMaintenance( );
|
||||
return this.redirect( "maintenance" );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.AdminResponse;
|
||||
import com.deepclone.lw.cmd.admin.adata.Administrator;
|
||||
import com.deepclone.lw.cmd.msgdata.MessageListEntry;
|
||||
|
||||
|
||||
|
||||
public class MessageBoxView
|
||||
extends AdminResponse
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final boolean inbox;
|
||||
private int pages;
|
||||
private int cPage;
|
||||
private final List< MessageListEntry > messages = new LinkedList< MessageListEntry >( );
|
||||
|
||||
|
||||
public MessageBoxView( Administrator admin , boolean inbox )
|
||||
{
|
||||
super( admin );
|
||||
this.inbox = inbox;
|
||||
}
|
||||
|
||||
|
||||
public int getPages( )
|
||||
{
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
public void setPages( int pages )
|
||||
{
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
|
||||
public int getcPage( )
|
||||
{
|
||||
return cPage;
|
||||
}
|
||||
|
||||
|
||||
public void setcPage( int cPage )
|
||||
{
|
||||
this.cPage = cPage;
|
||||
}
|
||||
|
||||
|
||||
public boolean isInbox( )
|
||||
{
|
||||
return inbox;
|
||||
}
|
||||
|
||||
|
||||
public List< MessageListEntry > getMessages( )
|
||||
{
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
||||
public void addMessage( MessageListEntry entry )
|
||||
{
|
||||
this.messages.add( entry );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,453 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.msg.*;
|
||||
import com.deepclone.lw.cmd.msgdata.*;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.msgs.MessageFormatter;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class MessagesPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
private final static int perPage = 30;
|
||||
|
||||
private MessageFormatter formatter;
|
||||
|
||||
|
||||
@Autowired( required = true )
|
||||
public void setFormatter( MessageFormatter formatter )
|
||||
{
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/messages" )
|
||||
public String viewInbox( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
MessageBoxView view = this.viewMessageBox( true , this.getSession( AdminSession.class , request ) , 0 );
|
||||
return this.render( model , "internal" , "en" , "messageBox" , view );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/inbox-{page}" )
|
||||
public String viewInbox( HttpServletRequest request , Model model , @PathVariable( "page" ) String sPage )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int page;
|
||||
try {
|
||||
page = Integer.parseInt( sPage );
|
||||
} catch ( NumberFormatException e ) {
|
||||
page = 0;
|
||||
}
|
||||
|
||||
MessageBoxView view = this.viewMessageBox( true , this.getSession( AdminSession.class , request ) , page );
|
||||
return this.render( model , "internal" , "en" , "messageBox" , view );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/inbox-from-{id}" )
|
||||
public String viewInboxFrom( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
long id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
MessageBoxView view = this.viewMessageBoxFrom( true , this.getSession( AdminSession.class , request ) , id );
|
||||
return this.render( model , "internal" , "en" , "messageBox" , view );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/outbox" )
|
||||
public String viewOutbox( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
MessageBoxView view = this.viewMessageBox( false , this.getSession( AdminSession.class , request ) , 0 );
|
||||
return this.render( model , "internal" , "en" , "messageBox" , view );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/outbox-{page}" )
|
||||
public String viewOutbox( HttpServletRequest request , Model model , @PathVariable( "page" ) String sPage )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int page;
|
||||
try {
|
||||
page = Integer.parseInt( sPage );
|
||||
} catch ( NumberFormatException e ) {
|
||||
page = 0;
|
||||
}
|
||||
|
||||
MessageBoxView view = this.viewMessageBox( false , this.getSession( AdminSession.class , request ) , page );
|
||||
return this.render( model , "internal" , "en" , "messageBox" , view );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/outbox-from-{id}" )
|
||||
public String viewOutboxFrom( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
long id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
MessageBoxView view = this.viewMessageBoxFrom( false , this.getSession( AdminSession.class , request ) , id );
|
||||
return this.render( model , "internal" , "en" , "messageBox" , view );
|
||||
}
|
||||
|
||||
|
||||
private MessageBoxView viewMessageBox( boolean inbox , AdminSession aSession , int page )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
GetMessagesResponse mResponse = aSession.getMessages( inbox );
|
||||
MessageBoxView view = new MessageBoxView( mResponse.getAdmin( ) , inbox );
|
||||
List< MessageListEntry > messages = mResponse.getMessages( );
|
||||
|
||||
// Handle paging
|
||||
messages = this.setPage( view , messages , page );
|
||||
this.prepareMessages( view , messages );
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
private MessageBoxView viewMessageBoxFrom( boolean inbox , AdminSession pSession , long fromId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
GetMessagesResponse mResponse = pSession.getMessages( inbox );
|
||||
MessageBoxView view = new MessageBoxView( mResponse.getAdmin( ) , inbox );
|
||||
List< MessageListEntry > messages = mResponse.getMessages( );
|
||||
int page = 0;
|
||||
int nSeen = -1;
|
||||
for ( MessageListEntry e : messages ) {
|
||||
nSeen++;
|
||||
if ( e.getId( ) != fromId ) {
|
||||
continue;
|
||||
}
|
||||
page = ( nSeen - nSeen % MessagesPages.perPage ) / MessagesPages.perPage;
|
||||
break;
|
||||
}
|
||||
|
||||
// Handle paging
|
||||
messages = this.setPage( view , messages , page );
|
||||
this.prepareMessages( view , messages );
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
private void prepareMessages( MessageBoxView view , List< MessageListEntry > messages )
|
||||
{
|
||||
for ( MessageListEntry message : messages ) {
|
||||
message.setTitle( this.formatter.cleanMessage( message.getTitle( ) ) );
|
||||
view.addMessage( message );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List< MessageListEntry > setPage( MessageBoxView view , List< MessageListEntry > messages , int page )
|
||||
{
|
||||
int nMessages = messages.size( );
|
||||
int mod = nMessages % MessagesPages.perPage;
|
||||
int nPages = ( nMessages - mod ) / MessagesPages.perPage + ( mod > 0 ? 1 : 0 );
|
||||
if ( page < 0 ) {
|
||||
page = 0;
|
||||
} else if ( page >= nPages ) {
|
||||
page = nPages - 1;
|
||||
}
|
||||
if ( !messages.isEmpty( ) ) {
|
||||
messages = messages.subList( page * MessagesPages.perPage , Math.min( ( page + 1 ) * MessagesPages.perPage ,
|
||||
nMessages ) );
|
||||
}
|
||||
|
||||
view.setPages( nPages );
|
||||
view.setcPage( page );
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/inbox-message-{id}" )
|
||||
public String viewInboxMessage( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
return this.viewMessage( request , model , sId , true );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/outbox-message-{id}" )
|
||||
public String viewOutboxMessage( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
return this.viewMessage( request , model , sId , false );
|
||||
}
|
||||
|
||||
|
||||
private String viewMessage( HttpServletRequest request , Model model , String sId , boolean inbox )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
long id;
|
||||
try {
|
||||
id = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ReadMessageResponse response = aSession.readMessage( inbox , id );
|
||||
Message message = response.getMessage( );
|
||||
if ( message == null ) {
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
|
||||
boolean internal = ( message.getType( ) == MessageType.INTERNAL );
|
||||
message.setTitle( this.formatter.cleanMessage( message.getTitle( ) ) );
|
||||
message.setContents( this.formatter.formatMessage( message.getContents( ) , internal ) );
|
||||
|
||||
return this.render( model , "internal" , "en" , "message" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/messages.action" , method = RequestMethod.POST )
|
||||
public String mbAction( HttpServletRequest request , Model model , @RequestParam( "inbox" ) String sInbox ,
|
||||
@RequestParam( "page" ) String sPage , @RequestParam( "target" ) String sTarget ,
|
||||
@RequestParam( "action" ) String action ,
|
||||
@RequestParam( value = "selection" , required = false ) String[] sSelection )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
boolean inbox = "1".equals( sInbox );
|
||||
if ( !inbox ) {
|
||||
action = "d";
|
||||
}
|
||||
|
||||
boolean useSelected = "0".equals( sTarget );
|
||||
long selection[];
|
||||
if ( useSelected ) {
|
||||
List< Long > rSel = new LinkedList< Long >( );
|
||||
if ( sSelection != null ) {
|
||||
for ( String sItem : sSelection ) {
|
||||
Long value;
|
||||
try {
|
||||
value = Long.parseLong( sItem );
|
||||
} catch ( NumberFormatException e ) {
|
||||
continue;
|
||||
}
|
||||
rSel.add( value );
|
||||
}
|
||||
|
||||
selection = new long[ rSel.size( ) ];
|
||||
int i = 0;
|
||||
for ( Long value : rSel ) {
|
||||
selection[ i++ ] = value;
|
||||
}
|
||||
} else {
|
||||
selection = new long[ 0 ];
|
||||
}
|
||||
} else {
|
||||
selection = null;
|
||||
}
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
if ( selection == null || selection.length > 0 ) {
|
||||
if ( "d".equals( action ) ) {
|
||||
aSession.deleteMessages( inbox , selection );
|
||||
} else if ( "r".equals( action ) ) {
|
||||
aSession.markRead( selection );
|
||||
} else if ( "u".equals( action ) ) {
|
||||
aSession.markUnread( selection );
|
||||
}
|
||||
}
|
||||
|
||||
int page;
|
||||
try {
|
||||
page = Integer.parseInt( sPage );
|
||||
} catch ( NumberFormatException e ) {
|
||||
page = 0;
|
||||
}
|
||||
return this.redirect( ( inbox ? "inbox" : "outbox" ) + "-" + page );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/message.action" , method = RequestMethod.POST )
|
||||
public String msgAction( HttpServletRequest request , Model model , @RequestParam( "inbox" ) String sInbox ,
|
||||
@RequestParam( "id" ) String sId , @RequestParam( "next" ) String sNext ,
|
||||
@RequestParam( value = "delete" , required = false ) String delete ,
|
||||
@RequestParam( value = "reply" , required = false ) String reply )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
boolean inbox = "1".equals( sInbox );
|
||||
|
||||
long id;
|
||||
try {
|
||||
id = Long.parseLong( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
if ( delete != null ) {
|
||||
aSession.deleteMessages( inbox , new long[] {
|
||||
id
|
||||
} );
|
||||
|
||||
try {
|
||||
id = Long.parseLong( sNext );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
return this.redirect( ( inbox ? "inbox" : "outbox" ) + "-message-" + id );
|
||||
} else if ( reply != null ) {
|
||||
ComposeMessageResponse response;
|
||||
response = aSession.replyTo( inbox , id );
|
||||
return this.showWriter( model , response );
|
||||
}
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/compose-message" )
|
||||
public String composeNew( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
return this.render( model , "internal" , "en" , "messageWriter" , aSession.initNewMessage( ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/msg-empire-{id}" )
|
||||
public String messageEmpire( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
return this.newMessageTo( request , model , MessageType.EMPIRE , sId );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/msg-admin-{id}" )
|
||||
public String messageAdmin( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
return this.newMessageTo( request , model , MessageType.ADMINISTRATOR , sId );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/send-message.action" , method = RequestMethod.POST )
|
||||
public String sendMessage( HttpServletRequest request , Model model , @RequestParam( "toType" ) String sToType ,
|
||||
@RequestParam( "toName" ) String toName , @RequestParam( "title" ) String title ,
|
||||
@RequestParam( "contents" ) String contents ,
|
||||
@RequestParam( value = "rtInbox" , required = false ) String sRtInbox ,
|
||||
@RequestParam( value = "rtId" , required = false ) String sRtId ,
|
||||
@RequestParam( value = "cancel" , required = false ) String sCancel )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
// Handle cancellation
|
||||
if ( sCancel != null ) {
|
||||
return this.cancelSendRedirect( sRtInbox , sRtId );
|
||||
}
|
||||
|
||||
// Get message type
|
||||
MessageType type;
|
||||
try {
|
||||
type = MessageType.valueOf( sToType );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
type = MessageType.INTERNAL;
|
||||
}
|
||||
if ( type == MessageType.INTERNAL ) {
|
||||
type = MessageType.EMPIRE;
|
||||
}
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ComposeMessageResponse response;
|
||||
if ( sRtInbox == null || sRtId == null ) {
|
||||
response = aSession.sendMessage( type , toName , title , contents );
|
||||
} else {
|
||||
boolean inbox = "1".equals( sRtInbox );
|
||||
long rtId;
|
||||
try {
|
||||
rtId = Long.parseLong( sRtId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
|
||||
response = aSession.sendReply( inbox , rtId , type , toName , title , contents );
|
||||
}
|
||||
|
||||
if ( !response.isError( ) ) {
|
||||
return this.cancelSendRedirect( sRtInbox , sRtId );
|
||||
}
|
||||
return this.showWriter( model , response );
|
||||
}
|
||||
|
||||
|
||||
private String newMessageTo( HttpServletRequest request , Model model , MessageType type , String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "compose-message" );
|
||||
}
|
||||
|
||||
ComposeMessageResponse response;
|
||||
response = this.getSession( AdminSession.class , request ).messageTo( type , id );
|
||||
return this.showWriter( model , response );
|
||||
}
|
||||
|
||||
|
||||
private String showWriter( Model model , ComposeMessageResponse response )
|
||||
{
|
||||
if ( response.getReplyTo( ) != null ) {
|
||||
Message message = response.getReplyTo( );
|
||||
message.setTitle( this.formatter.cleanMessage( message.getTitle( ) ) );
|
||||
message.setContents( this.formatter.formatMessage( message.getContents( ) , false ) );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "messageWriter" , response );
|
||||
}
|
||||
|
||||
|
||||
private String cancelSendRedirect( String sRtInbox , String sRtId )
|
||||
{
|
||||
if ( sRtInbox == null || sRtId == null ) {
|
||||
return this.redirect( "messages" );
|
||||
}
|
||||
|
||||
boolean inbox = "1".equals( sRtInbox );
|
||||
long rtId;
|
||||
try {
|
||||
rtId = Long.parseLong( sRtId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( inbox ? "messages" : "outbox" );
|
||||
}
|
||||
|
||||
return this.redirect( ( inbox ? "inbox" : "outbox" ) + "-message-" + rtId );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.naming.*;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class NamesPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/names" )
|
||||
public String listNameTypes( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
NamesSummaryResponse response = this.getSession( AdminSession.class , request ).getNameSummary( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "namesSummary" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/names-{type}" )
|
||||
public String listNames( HttpServletRequest request , Model model , @PathVariable( "type" ) String sType )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
NameType type;
|
||||
try {
|
||||
type = NameType.valueOf( sType.toUpperCase( ).replace( "-" , "_" ) );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
return this.redirect( "names" );
|
||||
}
|
||||
|
||||
GetNamesResponse response = this.getSession( AdminSession.class , request ).getNames( type );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "names" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/names-{type}.action" , method = RequestMethod.POST )
|
||||
public String namesAction( HttpServletRequest request , Model model , @PathVariable( "type" ) String sType ,
|
||||
@RequestParam( "action" ) String sAction , @RequestParam( value = "ids" , required = false ) String[] sIds )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
// Parse type
|
||||
NameType type;
|
||||
try {
|
||||
type = NameType.valueOf( sType.toUpperCase( ).replace( "-" , "_" ) );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
return this.redirect( "names" );
|
||||
}
|
||||
|
||||
// Parse action
|
||||
NameAction action;
|
||||
try {
|
||||
action = NameAction.valueOf( sAction );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
return this.redirect( "names-" + type.toString( ).toLowerCase( ).replace( "_" , "-" ) );
|
||||
}
|
||||
|
||||
// Parse identifiers
|
||||
List< Integer > lIds = new LinkedList< Integer >( );
|
||||
if ( sIds != null ) {
|
||||
for ( String s : sIds ) {
|
||||
try {
|
||||
lIds.add( Integer.parseInt( s ) );
|
||||
} catch ( NumberFormatException e ) {
|
||||
// EMPTY
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( lIds.isEmpty( ) ) {
|
||||
return this.redirect( "names-" + type.toString( ).toLowerCase( ).replace( "_" , "-" ) );
|
||||
}
|
||||
int[] ids = new int[ lIds.size( ) ];
|
||||
int i = 0;
|
||||
for ( Integer v : lIds ) {
|
||||
ids[ i++ ] = v.intValue( );
|
||||
}
|
||||
|
||||
this.getSession( AdminSession.class , request ).namesAction( type , action , ids );
|
||||
return this.redirect( "names-" + type.toString( ).toLowerCase( ).replace( "_" , "-" ) );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.SetPasswordResponse;
|
||||
import com.deepclone.lw.cmd.admin.SetPasswordResponse.PasswordChangeStatus;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , redirectTo = "login" )
|
||||
public class PasswordPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/change-password" )
|
||||
public String changePassword( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
return this.render( model , "internal" , "en" , "changePassword" , aSession.noOp( ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/change-password.action" , method = RequestMethod.POST )
|
||||
public String changePassword( HttpServletRequest request , Model model , @RequestParam( "current" ) String current ,
|
||||
@RequestParam( "password" ) String pass1 , @RequestParam( "passwordConfirm" ) String pass2 )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
SetPasswordResponse response = aSession.changePassword( current , pass1 , pass2 );
|
||||
if ( !response.isAuthError( ) && response.getPasswordError( ) == PasswordChangeStatus.OK ) {
|
||||
return this.redirect( "admin-session" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "changePassword" , response );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.prefs.PrefDefaultsResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class PreferencesPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/prefs" )
|
||||
public String listPrefDefaults( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
PrefDefaultsResponse response = this.getSession( AdminSession.class , request ).getPrefDefaults( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "preferences" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/prefs.action" , method = RequestMethod.POST )
|
||||
public String setPrefDefault( HttpServletRequest request , Model model , @RequestParam( "pref" ) String pref ,
|
||||
@RequestParam( "value" ) String value )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
this.getSession( AdminSession.class , request ).setPrefDefault( pref , value );
|
||||
return this.redirect( "prefs" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.ClientSessionReference;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , redirectTo = "login" )
|
||||
public class SessionPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
@RequestMapping( "/admin-session" )
|
||||
public String login( HttpServletRequest request , Model model )
|
||||
{
|
||||
ClientSessionReference cReference = (ClientSessionReference) request.getSession( ).getAttribute( "sReference" );
|
||||
String type = cReference.getReference( ).extra;
|
||||
if ( "pass".equals( type ) ) {
|
||||
return this.redirect( "change-password" );
|
||||
}
|
||||
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/main" )
|
||||
public String main( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession session = this.getSession( AdminSession.class , request );
|
||||
return this.render( model , "internal" , "en" , "main" , session.getOverview( ) );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/logout.action" )
|
||||
public String validation( HttpServletRequest request , Model model )
|
||||
throws SessionServerException , SessionException
|
||||
{
|
||||
this.getSession( AdminSession.class , request ).terminate( );
|
||||
return this.redirect( "login" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.AdminResponse;
|
||||
import com.deepclone.lw.cmd.admin.adata.Privileges;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.msgs.MessageFormatter;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , redirectTo = "admin-session" , subType = "main" )
|
||||
public class SpamPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
private MessageFormatter formatter;
|
||||
|
||||
|
||||
@Autowired( required = true )
|
||||
public void setFormatter( MessageFormatter formatter )
|
||||
{
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/send-spam" )
|
||||
public String sendSpam( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminResponse response = this.getSession( AdminSession.class , request ).noOp( Privileges.SPAM );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "spam" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/send-spam.action" , method = RequestMethod.POST )
|
||||
public String sendSpam( HttpServletRequest request , Model model , @RequestParam( "title" ) String title ,
|
||||
@RequestParam( "body" ) String body , @RequestParam( value = "preview" , required = false ) String preview )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
boolean tError , bError;
|
||||
title = title.trim( );
|
||||
body = body.trim( );
|
||||
tError = ( title.length( ) < 5 || title.length( ) > 64 );
|
||||
bError = ( body.length( ) < 10 );
|
||||
|
||||
AdminResponse response;
|
||||
if ( ( tError || bError || preview != null ) ) {
|
||||
response = this.getSession( AdminSession.class , request ).noOp( Privileges.SPAM );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
} else {
|
||||
this.getSession( AdminSession.class , request ).sendSpam( title , body );
|
||||
return this.redirect( "send-spam" );
|
||||
}
|
||||
|
||||
Map< String , Object > data = new HashMap< String , Object >( );
|
||||
data.put( "admin" , response.getAdmin( ) );
|
||||
data.put( "title" , title );
|
||||
data.put( "body" , body );
|
||||
data.put( "preview" , this.formatter.formatMessage( body , false ) );
|
||||
data.put( "titleError" , (Boolean) tError );
|
||||
data.put( "bodyError" , (Boolean) bError );
|
||||
|
||||
return this.render( model , "internal" , "en" , "spam" , data );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.AdminResponse;
|
||||
import com.deepclone.lw.cmd.admin.adata.Privileges;
|
||||
import com.deepclone.lw.cmd.admin.su.AddAdministratorResponse;
|
||||
import com.deepclone.lw.cmd.admin.su.ListAdministratorsResponse;
|
||||
import com.deepclone.lw.cmd.admin.su.ViewAdministratorResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class SuperUserPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/admins" )
|
||||
public String listAdministrators( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
ListAdministratorsResponse response = this.getSession( AdminSession.class , request ).listAdmins( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "admins" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/add-admin" )
|
||||
public String addAdministrator( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminResponse response = this.getSession( AdminSession.class , request ).noOp( Privileges.SUPER );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "addAdmin" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/add-admin.action" , method = RequestMethod.POST )
|
||||
public String addAdministrator( HttpServletRequest request , Model model ,
|
||||
@RequestParam( "address" ) String address , @RequestParam( "name" ) String name ,
|
||||
@RequestParam( value = "privileges" , required = false ) String[] sPrivs )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
List< Privileges > privs = this.getPrivileges( sPrivs );
|
||||
AddAdministratorResponse response;
|
||||
response = this.getSession( AdminSession.class , request ).addAdmin( address , name , privs );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( !response.isError( ) ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "addAdmin" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/admin-{id}" )
|
||||
public String viewAdministrator( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
|
||||
ViewAdministratorResponse response = this.getSession( AdminSession.class , request ).viewAdministrator( id );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getView( ) == null ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "viewAdmin" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/reset-admin-{id}.action" )
|
||||
public String resetAdministrator( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
|
||||
ViewAdministratorResponse response = this.getSession( AdminSession.class , request ).viewAdministrator( id );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getView( ) == null || response.getView( ).getPrivileges( ).isEmpty( ) ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "resetAdmin" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/do-reset-admin-{id}.action" , method = RequestMethod.POST )
|
||||
public String confirmResetAdministrator( HttpServletRequest request , Model model ,
|
||||
@PathVariable( "id" ) String sId , @RequestParam( value = "cancel" , required = false ) String sCancel )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
|
||||
if ( sCancel != null ) {
|
||||
return this.redirect( "admin-" + id );
|
||||
}
|
||||
|
||||
ViewAdministratorResponse response = this.getSession( AdminSession.class , request ).resetAdministrator( id );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getView( ) == null ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
return this.redirect( "admin-" + id );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/admin-privileges-{id}.action" , method = RequestMethod.POST )
|
||||
public String setPrivileges( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( value = "privileges" , required = false ) String[] sPrivs )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
|
||||
List< Privileges > privs = this.getPrivileges( sPrivs );
|
||||
ViewAdministratorResponse response;
|
||||
response = this.getSession( AdminSession.class , request ).setAdminPrivileges( id , privs );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getView( ) == null ) {
|
||||
return this.redirect( "admins" );
|
||||
}
|
||||
return this.redirect( "admin-" + id );
|
||||
}
|
||||
|
||||
|
||||
private List< Privileges > getPrivileges( String[] sPrivs )
|
||||
{
|
||||
List< Privileges > privs = new LinkedList< Privileges >( );
|
||||
if ( sPrivs != null ) {
|
||||
for ( String sPriv : sPrivs ) {
|
||||
try {
|
||||
privs.add( Privileges.valueOf( sPriv ) );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
// EMPTY
|
||||
}
|
||||
}
|
||||
}
|
||||
return privs;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.tick.TickerStatusResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class TickerPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/ticker" )
|
||||
public String viewStatus( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
TickerStatusResponse response = this.getSession( AdminSession.class , request ).getTickerStatus( );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "ticker" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/toggle-ticker.action" )
|
||||
public String toggleTicker( HttpServletRequest request , Model model )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
this.getSession( AdminSession.class , request ).toggleTicker( );
|
||||
return this.redirect( "ticker" );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/start-ticker-task-{id}.action" )
|
||||
public String startTask( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
return this.setTickerTaskStatus( request , sId , true );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/stop-ticker-task-{id}.action" )
|
||||
public String stopTask( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
return this.setTickerTaskStatus( request , sId , false );
|
||||
}
|
||||
|
||||
|
||||
private String setTickerTaskStatus( HttpServletRequest request , String sId , boolean run )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "ticker" );
|
||||
}
|
||||
this.getSession( AdminSession.class , request ).setTickerTaskStatus( id , run );
|
||||
return this.redirect( "ticker" );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/set-ticker-task-{id}.action" , method = RequestMethod.POST )
|
||||
public String setTaskDelay( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "delay" ) String sDelay , @RequestParam( "multiplier" ) String sMultiplier )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
long delay , multiplier;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
delay = Long.parseLong( sDelay );
|
||||
multiplier = Long.parseLong( sMultiplier );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "ticker" );
|
||||
}
|
||||
delay *= multiplier;
|
||||
if ( delay <= 0 ) {
|
||||
return this.redirect( "ticker" );
|
||||
}
|
||||
this.getSession( AdminSession.class , request ).setTickerTaskStatus( id , delay );
|
||||
return this.redirect( "ticker" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.deepclone.lw.web.admin;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.deepclone.lw.cmd.admin.users.AccountStatus;
|
||||
import com.deepclone.lw.cmd.admin.users.ListAccountsResponse;
|
||||
import com.deepclone.lw.cmd.admin.users.ListSessionsResponse;
|
||||
import com.deepclone.lw.cmd.admin.users.ViewAccountResponse;
|
||||
import com.deepclone.lw.session.SessionException;
|
||||
import com.deepclone.lw.web.beans.intercept.SessionRequirement;
|
||||
import com.deepclone.lw.web.beans.session.SessionMaintenanceException;
|
||||
import com.deepclone.lw.web.beans.session.SessionServerException;
|
||||
import com.deepclone.lw.web.beans.view.PageControllerBase;
|
||||
import com.deepclone.lw.web.csess.AdminSession;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" )
|
||||
public class UsersPages
|
||||
extends PageControllerBase
|
||||
{
|
||||
|
||||
@RequestMapping( "/users" )
|
||||
public String listUsers( HttpServletRequest request , Model model ,
|
||||
@RequestParam( value = "online" , required = false ) String sOnline )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ListAccountsResponse list;
|
||||
if ( "1".equals( sOnline ) ) {
|
||||
list = aSession.listOnlineUsers( );
|
||||
} else {
|
||||
list = aSession.listUsers( );
|
||||
}
|
||||
if ( !list.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
|
||||
return this.render( model , "internal" , "en" , "users" , list );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/users-by-status" )
|
||||
public String listUsers( HttpServletRequest request , Model model , @RequestParam( "status" ) String sStatus ,
|
||||
@RequestParam( value = "online" , required = false ) String sOnline )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
AccountStatus status;
|
||||
try {
|
||||
status = AccountStatus.valueOf( sStatus );
|
||||
} catch ( IllegalArgumentException e ) {
|
||||
return this.redirect( "users" + ( "1".equals( sOnline ) ? "?online=1" : "" ) );
|
||||
}
|
||||
|
||||
AdminSession aSession = this.getSession( AdminSession.class , request );
|
||||
ListAccountsResponse list;
|
||||
if ( "1".equals( sOnline ) ) {
|
||||
list = aSession.listOnlineUsers( status );
|
||||
} else {
|
||||
list = aSession.listUsers( status );
|
||||
}
|
||||
if ( !list.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "users" , list );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/user-{id}" )
|
||||
public String viewUser( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "users" );
|
||||
}
|
||||
|
||||
ViewAccountResponse response = this.getSession( AdminSession.class , request ).viewUser( id );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getAccount( ) == null ) {
|
||||
return this.redirect( "users" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "user" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/user-{id}-sessions" )
|
||||
public String viewUserSessions( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "users" );
|
||||
}
|
||||
|
||||
ListSessionsResponse response = this.getSession( AdminSession.class , request ).viewUserSessions( id );
|
||||
if ( !response.isPrivilegeOk( ) ) {
|
||||
return this.redirect( "main" );
|
||||
} else if ( response.getAccount( ) == null ) {
|
||||
return this.redirect( "users" );
|
||||
}
|
||||
return this.render( model , "internal" , "en" , "userSessions" , response );
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( value = "/user-{id}.action" , method = RequestMethod.POST )
|
||||
public String grantCredits( HttpServletRequest request , Model model , @PathVariable( "id" ) String sId ,
|
||||
@RequestParam( "credits" ) String sCredits )
|
||||
throws SessionException , SessionServerException , SessionMaintenanceException
|
||||
{
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt( sId );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return this.redirect( "users" );
|
||||
}
|
||||
|
||||
int credits;
|
||||
try {
|
||||
credits = Integer.parseInt( sCredits );
|
||||
} catch ( NumberFormatException e ) {
|
||||
credits = 0;
|
||||
}
|
||||
if ( credits > 0 ) {
|
||||
this.getSession( AdminSession.class , request ).giveCredits( id , credits );
|
||||
}
|
||||
return this.redirect( "user-" + id );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.deepclone.lw.web.admin.i18ne;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings( "serial" )
|
||||
@XStreamAlias( "language" )
|
||||
public class LanguageExport
|
||||
implements Serializable
|
||||
{
|
||||
@XStreamAsAttribute
|
||||
public String id;
|
||||
|
||||
@XStreamAsAttribute
|
||||
public String name;
|
||||
|
||||
@XStreamImplicit
|
||||
public List< StringExport > strings = new LinkedList< StringExport >( );
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.deepclone.lw.web.admin.i18ne;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings( "serial" )
|
||||
@XStreamAlias( "inline-string" )
|
||||
public class StringExport
|
||||
implements Serializable
|
||||
{
|
||||
@XStreamAsAttribute
|
||||
public String id;
|
||||
|
||||
public String value;
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
log4j.rootLogger=warn, stdout
|
Reference in a new issue