使用FreeMarker替换所有JSP,以解决由于JSP编译不兼容导致构建的集成软件包在JRE8及以上版本无法正常运行的BUG

This commit is contained in:
datagear 2019-02-21 22:24:45 +08:00
parent 92d370b9e4
commit d8a7bcd869
94 changed files with 2746 additions and 2757 deletions

View File

@ -113,7 +113,7 @@ public class SchemaServiceImpl extends AbstractMybatisEntityService<String, Sche
{
schema = super.getById(id);
if (this.schemaCache != null)
if (schema != null && this.schemaCache != null)
this.schemaCache.putSchema(schema);
}
@ -134,7 +134,7 @@ public class SchemaServiceImpl extends AbstractMybatisEntityService<String, Sche
{
schema = super.getById(user, id);
if (this.schemaCache != null)
if (schema != null && this.schemaCache != null)
this.schemaCache.putSchema(schema);
}

View File

@ -432,6 +432,9 @@ public class MU
*/
public static int getModelIndex(Model[] models, Object obj)
{
if (models.length == 1)
return 0;
if (obj == null)
throw new IllegalArgumentException("[obj] must not be null");

View File

@ -148,6 +148,11 @@
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
</dependency>
</dependencies>
<build>

View File

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.datagear.persistence.Order;
import org.datagear.persistence.Paging;
@ -461,6 +462,48 @@ public abstract class AbstractController
}
}
/**
* 获取HTTP错误时的{@linkplain OperationMessage}
*
* @param request
* @param response
* @return
*/
protected OperationMessage getOperationMessageForHttpError(HttpServletRequest request, HttpServletResponse response)
{
OperationMessage operationMessage = WebUtils.getOperationMessage(request);
if (operationMessage == null)
{
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
if (statusCode == null)
statusCode = response.getStatus();
String message = (String) request.getAttribute("javax.servlet.error.message");
String statusCodeKey = "error.httpError";
if (statusCode != null)
{
int sc = statusCode.intValue();
statusCodeKey += "." + sc;
}
try
{
message = getMessage(request, statusCodeKey, new Object[0]);
}
catch (Throwable t)
{
}
operationMessage = OperationMessage.valueOfFail(statusCodeKey, message);
}
return operationMessage;
}
/**
* 字符串是否为空
*

View File

@ -24,7 +24,11 @@ import org.datagear.persistence.PersistenceException;
import org.datagear.persistence.UnsupportedDialectException;
import org.datagear.persistence.support.SqlExpressionErrorException;
import org.datagear.persistence.support.VariableExpressionErrorException;
import org.datagear.web.OperationMessage;
import org.datagear.web.convert.IllegalSourceValueException;
import org.datagear.web.freemarker.WriteJsonTemplateDirectiveModel;
import org.datagear.web.util.DeliverContentTypeExceptionHandlerExceptionResolver;
import org.datagear.web.util.WebUtils;
import org.springframework.http.HttpStatus;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
@ -54,7 +58,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(MissingServletRequestParameterException.class),
exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(BindException.class)
@ -64,7 +68,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(BindException.class), exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ -75,7 +79,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(MethodArgumentNotValidException.class), exception,
false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(AuthenticationFailedException.class)
@ -86,7 +90,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(AuthenticationFailedException.class), exception,
true);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(IllegalInputException.class)
@ -96,7 +100,17 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(IllegalInputException.class), exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(IllegalArgumentException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public String handleControllerIllegalArgumentException(HttpServletRequest request, HttpServletResponse response,
IllegalArgumentException exception)
{
setOperationMessageForThrowable(request, buildMessageCode(IllegalArgumentException.class), exception, false);
return getErrorView(request, response);
}
@ExceptionHandler(RecordNotFoundException.class)
@ -106,7 +120,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(RecordNotFoundException.class), exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(RecordNotFoundOrPermissionDeniedException.class)
@ -117,7 +131,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(RecordNotFoundOrPermissionDeniedException.class),
exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(SchemaNotFoundException.class)
@ -127,7 +141,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(SchemaNotFoundException.class), exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(IllegalSourceValueException.class)
@ -138,7 +152,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(IllegalSourceValueException.class), exception, false,
exception.getSourceValue(), exception.getTargetType().getName());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(FileNotFoundException.class)
@ -149,7 +163,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(FileNotFoundException.class), exception, false,
exception.getFileName());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(DuplicateRecordException.class)
@ -160,7 +174,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(DuplicateRecordException.class), exception, false,
exception.getExpectedCount(), exception.getActualCount());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(VariableExpressionErrorException.class)
@ -171,7 +185,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(VariableExpressionErrorException.class),
exception.getCause(), false, exception.getExpression().getContent());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(SqlExpressionErrorException.class)
@ -182,7 +196,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(SqlExpressionErrorException.class),
exception.getCause(), true, exception.getExpression().getContent());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(UnsupportedDialectException.class)
@ -192,7 +206,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(UnsupportedDialectException.class), exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(PersistenceException.class)
@ -206,7 +220,7 @@ public class ControllerAdvice extends AbstractController
else
setOperationMessageForThrowable(request, buildMessageCode(PersistenceException.class), exception, true);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(DatabaseInfoResolverException.class)
@ -217,7 +231,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(DatabaseInfoResolverException.class), exception,
true);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(DatabaseModelResolverException.class)
@ -228,7 +242,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(DatabaseModelResolverException.class), exception,
true);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(TableNotExistsException.class)
@ -239,7 +253,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(TableNotExistsException.class), exception, false,
exception.getTableName());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(ConnectionSourceException.class)
@ -249,7 +263,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(ConnectionSourceException.class), exception, true);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(DriverEntityManagerException.class)
@ -259,7 +273,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(DriverEntityManagerException.class), exception, true);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(DriverNotFoundException.class)
@ -270,7 +284,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(DriverNotFoundException.class), exception, false,
exception.getDriverClassName());
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(DriverClassFormatErrorException.class)
@ -281,7 +295,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(DriverClassFormatErrorException.class), exception,
false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(URLNotAcceptedException.class)
@ -291,7 +305,7 @@ public class ControllerAdvice extends AbstractController
{
setOperationMessageForThrowable(request, buildMessageCode(URLNotAcceptedException.class), exception, false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(UnsupportedGetConnectionException.class)
@ -302,7 +316,7 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(UnsupportedGetConnectionException.class), exception,
false);
return ERROR_PAGE_URL;
return getErrorView(request, response);
}
@ExceptionHandler(EstablishConnectionException.class)
@ -313,9 +327,49 @@ public class ControllerAdvice extends AbstractController
setOperationMessageForThrowable(request, buildMessageCode(EstablishConnectionException.class),
exception.getCause(), true);
return getErrorView(request, response);
}
/**
* 获取错误信息视图
*
* @param request
* @param response
* @return
*/
protected String getErrorView(HttpServletRequest request, HttpServletResponse response)
{
setAttributeIfIsJsonResponse(request, response);
return ERROR_PAGE_URL;
}
/**
* 设置JSON响应的错误页面属性
*
* @param request
* @param response
*/
protected void setAttributeIfIsJsonResponse(HttpServletRequest request, HttpServletResponse response)
{
String expectedContentType = DeliverContentTypeExceptionHandlerExceptionResolver.getHandlerContentType(request);
if (expectedContentType != null && !expectedContentType.isEmpty())
response.setContentType(expectedContentType);
boolean isJsonResponse = WebUtils.isJsonResponse(response);
request.setAttribute("isJsonResponse", isJsonResponse);
if (isJsonResponse)
{
OperationMessage operationMessage = getOperationMessageForHttpError(request, response);
request.setAttribute(WebUtils.KEY_OPERATION_MESSAGE,
WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(operationMessage));
response.setContentType(CONTENT_TYPE_JSON);
}
}
protected String buildMessageCode(Class<? extends Throwable> clazz)
{
return buildMessageCode(clazz.getSimpleName());

View File

@ -13,6 +13,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -53,6 +54,7 @@ import org.datagear.web.format.DateFormatter;
import org.datagear.web.format.SqlDateFormatter;
import org.datagear.web.format.SqlTimeFormatter;
import org.datagear.web.format.SqlTimestampFormatter;
import org.datagear.web.freemarker.WriteJsonTemplateDirectiveModel;
import org.datagear.web.util.FileUtils;
import org.datagear.web.util.ModelUtils;
import org.datagear.web.util.WebUtils;
@ -88,6 +90,12 @@ public class DataController extends AbstractSchemaModelController
public static final String KEY_IS_CLIENT_PAGE_DATA = "isClientPageData";
public static final String KEY_TITLE_DISPLAY_NAME = "titleDisplayName";
public static final String KEY_TITLE_DISPLAY_DESC = "titleDisplayDesc";
public static final String KEY_CONDITION_SOURCE = "conditionSource";
@Autowired
private PersistenceManager persistenceManager;
@ -259,7 +267,12 @@ public class DataController extends AbstractSchemaModelController
QueryResultMetaInfo queryResultMetaInfo = persistenceManager.getQueryResultMetaInfo(cn, model);
springModel.addAttribute("conditionSource", getPropertyPathDisplayNames(request, queryResultMetaInfo));
springModel.addAttribute(KEY_CONDITION_SOURCE, WriteJsonTemplateDirectiveModel
.toWriteJsonTemplateModel(getPropertyPathDisplayNames(request, queryResultMetaInfo)));
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, WebUtils.getLocale(request)));
springModel.addAttribute(KEY_TITLE_DISPLAY_DESC,
ModelUtils.displayDesc(model, WebUtils.getLocale(request)));
}
}.execute();
@ -310,7 +323,9 @@ public class DataController extends AbstractSchemaModelController
org.springframework.ui.Model springModel, Schema schema, Model model) throws Throwable
{
springModel.addAttribute("titleOperationMessageKey", "add");
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, "true");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, WebUtils.getLocale(request)));
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, true);
springModel.addAttribute("submitAction", "saveAdd");
}
}.execute();
@ -439,8 +454,10 @@ public class DataController extends AbstractSchemaModelController
data = resultList.get(0);
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("titleOperationMessageKey", "edit");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, WebUtils.getLocale(request)));
springModel.addAttribute("submitAction", "saveEdit");
}
}.execute();
@ -556,9 +573,11 @@ public class DataController extends AbstractSchemaModelController
data = resultList.get(0);
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("titleOperationMessageKey", "view");
springModel.addAttribute("readonly", "true");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, WebUtils.getLocale(request)));
springModel.addAttribute("readonly", true);
}
}.execute();
@ -695,9 +714,18 @@ public class DataController extends AbstractSchemaModelController
QueryResultMetaInfo queryResultMetaInfo = persistenceManager
.getQueryPropValueSourceQueryResultMetaInfo(cn, model, data, propertyPathInfo);
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("conditionSource", getPropertyPathDisplayNames(request, queryResultMetaInfo));
springModel.addAttribute(KEY_CONDITION_SOURCE, WriteJsonTemplateDirectiveModel
.toWriteJsonTemplateModel(getPropertyPathDisplayNames(request, queryResultMetaInfo)));
boolean isMultipleSelect = false;
if (request.getParameter("multiple") != null)
isMultipleSelect = true;
else
isMultipleSelect = MU.isMultipleProperty(propertyPathInfo.getPropertyTail());
springModel.addAttribute("isMultipleSelect", isMultipleSelect);
}
}.execute();
@ -838,6 +866,8 @@ public class DataController extends AbstractSchemaModelController
{
final Object dataParam = getParamMap(request, "data");
final PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
{
@Override
@ -846,10 +876,12 @@ public class DataController extends AbstractSchemaModelController
{
Object data = modelDataConverter.convert(dataParam, model);
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("titleOperationMessageKey", "add");
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, "true");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, true);
springModel.addAttribute("submitAction", "saveSinglePropValue");
}
}.execute();
@ -867,6 +899,7 @@ public class DataController extends AbstractSchemaModelController
{
final Object dataParam = getParamMap(request, "data");
final Object propertyValueParam = getParamMap(request, "propertyValue");
final PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
final boolean isLoadPageData = isLoadPageDataRequest(request);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
@ -881,13 +914,14 @@ public class DataController extends AbstractSchemaModelController
if (propertyValueParam != null)
{
propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPath, data);
propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj, data);
// 这里不应该使用convertToPropertyValue因为它会添加双向关联导致页面引用混乱再保存时又会导致转换混乱
Object propertyValue = modelDataConverter.convert(propertyValueParam,
propertyPathInfo.getModelTail());
springModel.addAttribute("propertyValue", propertyValue);
springModel.addAttribute("propertyValue",
WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(propertyValue));
}
if (isLoadPageData)
@ -906,13 +940,14 @@ public class DataController extends AbstractSchemaModelController
// 设置最新原始属性值因为受SelectOptions的影响select到页面的data对象超过级联的属性值不会加载
propertyPathInfo.setValueTail(originalPropertyValue);
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA,
(originalPropertyValue == null ? "true" : "false"));
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, (originalPropertyValue == null ? true : false));
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("titleOperationMessageKey", "edit");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
springModel.addAttribute("submitAction", "saveSinglePropValue");
}
}.execute();
@ -976,6 +1011,7 @@ public class DataController extends AbstractSchemaModelController
{
final Object dataParam = getParamMap(request, "data");
final Object propertyValueParam = getParamMap(request, "propertyValue");
final PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
final boolean isLoadPageData = isLoadPageDataRequest(request);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
@ -992,7 +1028,7 @@ public class DataController extends AbstractSchemaModelController
if (isLoadPageData)
{
if (propertyPathInfo == null)
propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPath, data);
propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj, data);
LOBConversionContext.set(buildGetLobConversionSetting());
@ -1009,7 +1045,7 @@ public class DataController extends AbstractSchemaModelController
propertyValue = originalPropertyValue;
if (originalPropertyValue == null)
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, "true");
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, true);
}
else if (propertyValueParam != null)
{
@ -1019,11 +1055,14 @@ public class DataController extends AbstractSchemaModelController
propertyValue = modelDataConverter.convert(propertyValueParam, propertyPathInfo.getModelTail());
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("propertyValue", propertyValue);
springModel.addAttribute("readonly", "true");
springModel.addAttribute("propertyValue",
WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(propertyValue));
springModel.addAttribute("readonly", true);
springModel.addAttribute("titleOperationMessageKey", "view");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
}
}.execute();
@ -1039,6 +1078,7 @@ public class DataController extends AbstractSchemaModelController
throws Throwable
{
final Object dataParam = getParamMap(request, "data");
final PropertyPath propertyPathObj = PropertyPath.valueOf(propertyPath);
final boolean isLoadPageData = isLoadPageDataRequest(request);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
@ -1051,20 +1091,24 @@ public class DataController extends AbstractSchemaModelController
Object data = modelDataConverter.convert(dataParam, model);
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj, data);
if (isLoadPageData)
{
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPath,
data);
QueryResultMetaInfo queryResultMetaInfo = persistenceManager
.getQueryMultiplePropValueQueryResultMetaInfo(cn, model, data, propertyPathInfo, true);
springModel.addAttribute("conditionSource",
getPropertyPathDisplayNames(request, queryResultMetaInfo));
springModel.addAttribute(KEY_CONDITION_SOURCE, WriteJsonTemplateDirectiveModel
.toWriteJsonTemplateModel(getPropertyPathDisplayNames(request, queryResultMetaInfo)));
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("titleOperationMessageKey", "edit");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
springModel.addAttribute("isPrivatePropertyModel",
ModelUtils.isPrivatePropertyModelTail(propertyPathInfo));
}
}.execute();
@ -1118,6 +1162,7 @@ public class DataController extends AbstractSchemaModelController
throws Throwable
{
final Object dataParam = getParamMap(request, "data");
final PropertyPath propertyPathObj = PropertyPath.valueOf(propertyPath);
final boolean isLoadPageData = isLoadPageDataRequest(request);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
@ -1130,21 +1175,25 @@ public class DataController extends AbstractSchemaModelController
Object data = modelDataConverter.convert(dataParam, model);
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj, data);
if (isLoadPageData)
{
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPath,
data);
QueryResultMetaInfo queryResultMetaInfo = persistenceManager
.getQueryMultiplePropValueQueryResultMetaInfo(cn, model, data, propertyPathInfo, true);
springModel.addAttribute("conditionSource",
getPropertyPathDisplayNames(request, queryResultMetaInfo));
springModel.addAttribute(KEY_CONDITION_SOURCE, WriteJsonTemplateDirectiveModel
.toWriteJsonTemplateModel(getPropertyPathDisplayNames(request, queryResultMetaInfo)));
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("readonly", "true");
springModel.addAttribute("readonly", true);
springModel.addAttribute("titleOperationMessageKey", "view");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
springModel.addAttribute("isPrivatePropertyModel",
ModelUtils.isPrivatePropertyModelTail(propertyPathInfo));
}
}.execute();
@ -1160,6 +1209,7 @@ public class DataController extends AbstractSchemaModelController
throws Throwable
{
final Object dataParam = getParamMap(request, "data");
final PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
{
@ -1169,10 +1219,12 @@ public class DataController extends AbstractSchemaModelController
{
Object data = modelDataConverter.convert(dataParam, model);
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("titleOperationMessageKey", "add");
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, "true");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, true);
springModel.addAttribute("submitAction", "saveAddMultiplePropValueElement");
}
}.execute();
@ -1310,6 +1362,7 @@ public class DataController extends AbstractSchemaModelController
throws Throwable
{
final Object dataParam = getParamMap(request, "data");
final PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
final boolean isLoadPageData = isLoadPageDataRequest(request);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
@ -1324,7 +1377,7 @@ public class DataController extends AbstractSchemaModelController
if (isLoadPageData)
{
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPath,
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj,
data);
LOBConversionContext.set(buildGetLobConversionSetting());
@ -1342,9 +1395,11 @@ public class DataController extends AbstractSchemaModelController
propertyPathInfo.setValueTail(originalPropertyValueElement);
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("titleOperationMessageKey", "edit");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
springModel.addAttribute("submitAction", "saveEditMultiplePropValueElement");
}
}.execute();
@ -1579,6 +1634,7 @@ public class DataController extends AbstractSchemaModelController
throws Throwable
{
final Object dataParam = getParamMap(request, "data");
final PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
final boolean isLoadPageData = isLoadPageDataRequest(request);
new VoidExecutor(request, response, springModel, schemaId, tableName, true)
@ -1593,7 +1649,7 @@ public class DataController extends AbstractSchemaModelController
if (isLoadPageData)
{
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPath,
PropertyPathInfo propertyPathInfo = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj,
data);
LOBConversionContext.set(buildGetLobConversionSetting());
@ -1607,10 +1663,12 @@ public class DataController extends AbstractSchemaModelController
propertyPathInfo.setValueTail(resultList.get(0));
}
springModel.addAttribute("data", data);
springModel.addAttribute("data", WriteJsonTemplateDirectiveModel.toWriteJsonTemplateModel(data));
springModel.addAttribute("propertyPath", propertyPath);
springModel.addAttribute("readonly", "true");
springModel.addAttribute("readonly", true);
springModel.addAttribute("titleOperationMessageKey", "view");
springModel.addAttribute(KEY_TITLE_DISPLAY_NAME,
ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)));
}
}.execute();
@ -1922,9 +1980,7 @@ public class DataController extends AbstractSchemaModelController
*/
protected boolean isClientPageDataRequest(HttpServletRequest request)
{
Boolean re = getBooleanParamValue(request, KEY_IS_CLIENT_PAGE_DATA);
return Boolean.TRUE.equals(re);
return WebUtils.getBooleanValue(request, KEY_IS_CLIENT_PAGE_DATA, false);
}
/**
@ -1938,26 +1994,7 @@ public class DataController extends AbstractSchemaModelController
if (isClientPageDataRequest(request))
return false;
Boolean re = getBooleanParamValue(request, PARAM_IS_LOAD_PAGE_DATA);
return !Boolean.FALSE.equals(re);
}
/**
* 获取布尔参数值如果没有参数将返回{@code null}
*
* @param request
* @param paramName
* @return
*/
protected Boolean getBooleanParamValue(HttpServletRequest request, String paramName)
{
String value = request.getParameter(paramName);
if (value == null)
return null;
return ("true".equals(value) || "1".equals(value));
return WebUtils.getBooleanValue(request, PARAM_IS_LOAD_PAGE_DATA, true);
}
/**
@ -1984,6 +2021,11 @@ public class DataController extends AbstractSchemaModelController
// 编辑表格需要表单属性
setFormPageAttributes(request, springModel);
springModel.addAttribute("Types_CLOB", Types.CLOB);
springModel.addAttribute("Types_NCLOB", Types.NCLOB);
springModel.addAttribute("Types_LONGNVARCHAR", Types.LONGNVARCHAR);
springModel.addAttribute("Types_LONGVARCHAR", Types.LONGVARCHAR);
}
/**
@ -2001,6 +2043,36 @@ public class DataController extends AbstractSchemaModelController
springModel.addAttribute("sqlTimestampFormat", this.sqlTimestampFormatter.getParsePatternDesc(locale));
springModel.addAttribute("sqlTimeFormat", this.sqlTimeFormatter.getParsePatternDesc(locale));
springModel.addAttribute("filePropertyLabelValue", this.blobToFilePlaceholderName);
if (!containsAttributes(request, springModel, KEY_IS_CLIENT_PAGE_DATA))
{
boolean isClientPageData = WebUtils.getBooleanValue(request, KEY_IS_CLIENT_PAGE_DATA, false);
springModel.addAttribute(KEY_IS_CLIENT_PAGE_DATA, isClientPageData);
}
if (!containsAttributes(request, springModel, "batchSet"))
{
boolean batchSet = WebUtils.getBooleanValue(request, "batchSet", false);
springModel.addAttribute("batchSet", batchSet);
}
if (!containsAttributes(request, springModel, "ignorePropertyName"))
{
String ignorePropertyName = WebUtils.getStringValue(request, "ignorePropertyName", "");
springModel.addAttribute("ignorePropertyName", ignorePropertyName);
}
}
protected boolean containsAttributes(HttpServletRequest request, org.springframework.ui.Model springModel,
String name)
{
if (request.getAttribute(name) != null)
return true;
if (springModel.containsAttribute(name))
return true;
return false;
}
/**

View File

@ -285,7 +285,7 @@ public class DriverEntityController extends AbstractController
model.addAttribute("driverEntity", driverEntity);
model.addAttribute(KEY_TITLE_MESSAGE_KEY, "driverEntity.viewDriverEntity");
model.addAttribute(KEY_READONLY, "true");
model.addAttribute(KEY_READONLY, true);
return "/driverEntity/driverEntity_form";
}
@ -312,7 +312,7 @@ public class DriverEntityController extends AbstractController
public String select(HttpServletRequest request, org.springframework.ui.Model model)
{
model.addAttribute(KEY_TITLE_MESSAGE_KEY, "driverEntity.selectDriverEntity");
model.addAttribute(KEY_SELECTONLY, "true");
model.addAttribute(KEY_SELECTONLY, true);
return "/driverEntity/driverEntity_grid";
}

View File

@ -5,7 +5,10 @@
package org.datagear.web.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.datagear.web.OperationMessage;
import org.datagear.web.util.WebUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -18,9 +21,18 @@ import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class ErrorController extends AbstractController
{
@RequestMapping("/error")
public String handleError(HttpServletRequest request)
public ErrorController()
{
super();
}
@RequestMapping("/error")
public String handleError(HttpServletRequest request, HttpServletResponse response,
org.springframework.ui.Model springModel)
{
OperationMessage operationMessage = getOperationMessageForHttpError(request, response);
WebUtils.setOperationMessage(request, operationMessage);
return "/error";
}
}

View File

@ -10,8 +10,8 @@ import javax.servlet.http.HttpServletResponse;
import org.datagear.management.domain.GlobalSetting;
import org.datagear.management.domain.SmtpSetting;
import org.datagear.management.domain.User;
import org.datagear.management.domain.SmtpSetting.ConnectionType;
import org.datagear.management.domain.User;
import org.datagear.management.service.GlobalSettingService;
import org.datagear.web.OperationMessage;
import org.datagear.web.convert.ClassDataConverter;
@ -79,6 +79,9 @@ public class GlobalSettingController extends AbstractController
}
model.addAttribute("globalSetting", globalSetting);
model.addAttribute("connectionTypePlain", ConnectionType.PLAIN);
model.addAttribute("connectionTypeSsl", ConnectionType.SSL);
model.addAttribute("connectionTypeTls", ConnectionType.TLS);
return "/global_setting";
}

View File

@ -11,6 +11,9 @@ import java.net.URLEncoder;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.WebAttributes;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -50,6 +53,28 @@ public class LoginController extends AbstractController
@RequestMapping
public String login(HttpServletRequest request)
{
String loginUser = (String) request.getSession()
.getAttribute(org.datagear.web.controller.RegisterController.SESSION_KEY_REGISTER_USER_NAME);
// 参考org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler.saveException()
AuthenticationException authenticationException = (AuthenticationException) request.getSession()
.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
if (authenticationException != null)
{
request.getSession().removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
@SuppressWarnings("deprecation")
Authentication authentication = authenticationException.getAuthentication();
if (authentication != null && authentication.getPrincipal() != null)
loginUser = authentication.getPrincipal().toString();
}
if (loginUser == null)
loginUser = "";
request.setAttribute("loginUser", loginUser);
request.setAttribute("authenticationFailed", (authenticationException != null));
request.setAttribute("disableRegister", this.disableRegister);
return "/login";

View File

@ -9,10 +9,12 @@ import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.datagear.management.util.Version;
import org.datagear.management.util.VersionContent;
import org.datagear.web.util.ChangelogResolver;
import org.datagear.web.util.WebUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
@ -86,10 +88,25 @@ public class MainController extends AbstractController
* @param model
* @return
*/
@RequestMapping("/main")
public String main(HttpServletRequest request, Model model)
@RequestMapping("/")
public String main(HttpServletRequest request, HttpServletResponse response, Model model)
{
return mainForIndexHtml(request, response, model);
}
/**
* 打开主页面
*
* @param request
* @param response
* @param model
* @return
*/
@RequestMapping("/index.html")
public String mainForIndexHtml(HttpServletRequest request, HttpServletResponse response, Model model)
{
request.setAttribute("disableRegister", this.disableRegister);
request.setAttribute("currentUser", WebUtils.getUser(request, response));
return "/main";
}
@ -139,9 +156,11 @@ public class MainController extends AbstractController
return "/changelog";
}
@RequestMapping(value = "/changeThemeData", produces = CONTENT_TYPE_JSON)
public String changeThemeData(HttpServletRequest request)
@RequestMapping(value = "/changeThemeData")
public String changeThemeData(HttpServletRequest request, HttpServletResponse response)
{
response.setContentType(CONTENT_TYPE_JSON);
return "/change_theme_data";
}
}

View File

@ -130,6 +130,8 @@ public class ResetPasswordController extends AbstractController
session.setAttribute(KEY_STEP, resetPasswordStep);
}
request.setAttribute("step", resetPasswordStep);
return "/reset_password";
}

View File

@ -176,7 +176,7 @@ public class SchemaController extends AbstractSchemaModelController
model.addAttribute("schema", schema);
model.addAttribute(KEY_TITLE_MESSAGE_KEY, "schema.viewSchema");
model.addAttribute(KEY_READONLY, "true");
model.addAttribute(KEY_READONLY, true);
return "/schema/schema_form";
}

View File

@ -111,7 +111,7 @@ public class SchemaUrlBuilderController extends AbstractController implements Se
@RequestParam(value = "scriptCode", required = false) String scriptCode) throws IOException
{
request.setAttribute("scriptCode", scriptCode);
request.setAttribute("preview", "1");
request.setAttribute("preview", true);
return "/schema/schema_build_url";
}

View File

@ -168,7 +168,7 @@ public class UserController extends AbstractController
model.addAttribute("user", user);
model.addAttribute(KEY_TITLE_MESSAGE_KEY, "user.viewUser");
model.addAttribute(KEY_READONLY, "true");
model.addAttribute(KEY_READONLY, true);
return "/user/user_form";
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2018 datagear.org. All Rights Reserved.
*/
package org.datagear.web.freemarker;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.datagear.web.util.WebUtils;
import org.springframework.web.servlet.view.freemarker.FreeMarkerView;
/**
* 自定义{@linkplain FreeMarkerView}实现一些本系统需要的特性
*
* @author datagear@163.com
*
*/
public class CustomFreeMarkerView extends FreeMarkerView
{
/** 变量是否是ajax请求 */
public static final String VAR_IS_AJAX_REQUEST = "isAjaxRequest";
/** 变量:应用根路径 */
public static final String VAR_CONTEXT_PATH = "contextPath";
/** 变量页面ID关键字 */
public static final String VAR_PAGE_ID = WebUtils.KEY_PAGE_ID;
/** 变量父页面ID关键字 */
public static final String VAR_PARENT_PAGE_ID = WebUtils.KEY_PARENT_PAGE_ID;
public CustomFreeMarkerView()
{
super();
}
@Override
protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) throws Exception
{
super.exposeHelpers(model, request);
model.put(VAR_CONTEXT_PATH, request.getContextPath());
model.put(VAR_IS_AJAX_REQUEST, WebUtils.isAjaxRequest(request));
model.put(VAR_PAGE_ID, WebUtils.generatePageId());
model.put(VAR_PARENT_PAGE_ID, WebUtils.getParentPageId(request));
}
}

View File

@ -0,0 +1,173 @@
/*
* Copyright (c) 2018 datagear.org. All Rights Reserved.
*/
package org.datagear.web.freemarker;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializeWriter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import freemarker.core.Environment;
import freemarker.ext.util.WrapperTemplateModel;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.utility.DeepUnwrap;
/**
* 将参数输出为JSON的{@linkplain WriteJsonTemplateDirectiveModel}
*
* @author datagear@163.com
*
*/
public class WriteJsonTemplateDirectiveModel implements TemplateDirectiveModel
{
private SerializeConfig serializeConfig;
private SerializerFeature[] serializerFeatures;
public WriteJsonTemplateDirectiveModel()
{
super();
}
public WriteJsonTemplateDirectiveModel(SerializeConfig serializeConfig, SerializerFeature[] serializerFeatures)
{
super();
this.serializeConfig = serializeConfig;
this.serializerFeatures = serializerFeatures;
}
public SerializeConfig getSerializeConfig()
{
return serializeConfig;
}
public void setSerializeConfig(SerializeConfig serializeConfig)
{
this.serializeConfig = serializeConfig;
}
public SerializerFeature[] getSerializerFeatures()
{
return serializerFeatures;
}
public void setSerializerFeatures(SerializerFeature[] serializerFeatures)
{
this.serializerFeatures = serializerFeatures;
}
@SuppressWarnings("rawtypes")
@Override
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
throws TemplateException, IOException
{
if (params.size() != 1)
throw new TemplateModelException("The directive only allow one parameter.");
SerializeWriter serializeWriter = new SerializeWriter(env.getOut(), this.serializerFeatures);
JSONSerializer serializer = new JSONSerializer(serializeWriter, this.serializeConfig);
@SuppressWarnings("unchecked")
Collection<TemplateModel> args = ((Map<String, TemplateModel>) params).values();
for (TemplateModel arg : args)
{
Object obj = unwrap(arg);
try
{
serializer.write(obj);
}
catch (Throwable t)
{
if (t instanceof IOException)
throw (IOException) t;
else
throw new TemplateException(t, env);
}
finally
{
serializer.close();
}
}
}
/**
* 获取{@linkplain TemplateModel}的原始对象
* <p>
* 由于freemarker的{@linkplain DeepUnwrap}处理存在循环引用的对象时会出现死循环因而不能采用
* 这里折中一下要求此指令的参数对象必须是{@linkplain WrapperTemplateModel}
* </p>
*
* @param model
* @return
* @throws TemplateModelException
*/
protected Object unwrap(TemplateModel model) throws TemplateModelException
{
if (model == null)
return null;
if (model instanceof WrapperTemplateModel)
{
return ((WrapperTemplateModel) model).getWrappedObject();
}
throw new TemplateModelException("Cannot unwrap model of type " + model.getClass().getName());
}
/**
* 将对象包装为{@linkplain WrapperTemplateModel}这样就可以使用此类对应的指令并且能够处理循环引用对象
*
* @param obj
* @return
*/
public static TemplateModel toWriteJsonTemplateModel(Object obj)
{
if (obj == null)
return null;
return new SimpleWrapperTemplateModel(obj);
}
protected static class SimpleWrapperTemplateModel implements WrapperTemplateModel
{
private Object object;
public SimpleWrapperTemplateModel()
{
super();
}
public SimpleWrapperTemplateModel(Object object)
{
super();
this.object = object;
}
public Object getObject()
{
return object;
}
public void setObject(Object object)
{
this.object = object;
}
@Override
public Object getWrappedObject()
{
return object;
}
}
}

View File

@ -281,6 +281,20 @@ public class WebUtils
return (__contentType.indexOf("json") >= 0);
}
/**
* 判断请求是否是ajax请求
*
* @param request
* @return
*/
public static boolean isAjaxRequest(HttpServletRequest request)
{
// 是否ajax请求jquery库ajax可以使用此方案判断
boolean ajaxRequest = (request.getHeader("x-requested-with") != null);
return ajaxRequest;
}
/**
* 获取页面ID
* <p>
@ -415,4 +429,60 @@ public class WebUtils
String pageId = getPageId(request);
return pageId + "-" + elementId;
}
/**
* 从请求获取布尔值
*
* @param request
* @param name
* @param defaultValue
* @return
*/
public static boolean getBooleanValue(HttpServletRequest request, String name, boolean defaultValue)
{
Object value = request.getAttribute(name);
if (value != null)
{
if (value instanceof Boolean)
return (Boolean) value;
return ("true".equals(value.toString()) || "1".equals(value.toString()));
}
String paramValue = request.getParameter(name);
if (paramValue != null)
return ("true".equals(paramValue) || "1".equals(paramValue));
return defaultValue;
}
/**
* 从请求获取字符串值
*
* @param request
* @param name
* @param defaultValue
* @return
*/
public static String getStringValue(HttpServletRequest request, String name, String defaultValue)
{
Object value = request.getAttribute(name);
if (value != null)
{
if (value instanceof String)
return (String) value;
return value.toString();
}
String paramValue = request.getParameter(name);
if (paramValue != null)
return paramValue;
return defaultValue;
}
}

View File

@ -45,10 +45,44 @@
</property>
</bean>
<!--
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp"/>
<property name="suffix" value=".jsp"/>
</bean>
-->
<bean id="writeJsonTemplateDirectiveModel" class="org.datagear.web.freemarker.WriteJsonTemplateDirectiveModel">
<property name="serializeConfig" ref="serializeConfig" />
<property name="serializerFeatures" ref="serializerFeatures" />
</bean>
<bean id="freeMarkerConfigurer" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPaths" value="/WEB-INF/view/" />
<property name="defaultEncoding" value="UTF-8" />
<property name="freemarkerSettings">
<props>
<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
<prop key="date_format">yyyy-MM-dd</prop>
<prop key="number_format">#.##</prop>
</props>
</property>
<property name="freemarkerVariables">
<map>
<entry key="writeJson" value-ref="writeJsonTemplateDirectiveModel" />
</map>
</property>
</bean>
<bean id="freeMarkerViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="viewClass" value="org.datagear.web.freemarker.CustomFreeMarkerView" />
<property name="contentType" value="text/html;charset=UTF-8"></property>
<property name="exposeRequestAttributes" value="true" />
<property name="allowRequestOverride" value="true" />
<property name="cache" value="true" />
<property name="prefix" value="" />
<property name="suffix" value=".ftl" />
</bean>
<bean id="exceptionResolver" class="org.datagear.web.util.DeliverContentTypeExceptionHandlerExceptionResolver" />

View File

@ -83,6 +83,7 @@ error.MethodArgumentNotValidException=\u8F93\u5165\u975E\u6CD5
error.MissingServletRequestParameterException=\u8F93\u5165\u975E\u6CD5
error.BindException=\u8F93\u5165\u975E\u6CD5
error.IllegalInputException=\u8F93\u5165\u975E\u6CD5
error.IllegalArgumentException=\u8F93\u5165\u975E\u6CD5
error.RecordNotFoundException=\u8BB0\u5F55\u672A\u627E\u5230\uFF0C\u6216\u8BB8\u5DF2\u88AB\u5220\u9664
error.RecordNotFoundOrPermissionDeniedException=\u8BB0\u5F55\u6216\u8BB8\u5DF2\u88AB\u5220\u9664\uFF0C\u6216\u8005\u60A8\u6CA1\u6709\u64CD\u4F5C\u6743\u9650
error.SchemaNotFoundException=\u672A\u627E\u5230\u6B64\u6570\u636E\u5E93
@ -129,6 +130,7 @@ driverEntity.editDriverEntity=\u7F16\u8F91\u6570\u636E\u5E93\u9A71\u52A8\u7A0B\u
driverEntity.viewDriverEntity=\u67E5\u770B\u6570\u636E\u5E93\u9A71\u52A8\u7A0B\u5E8F
driverEntity.manageDriverEntity=\u7BA1\u7406\u6570\u636E\u5E93\u9A71\u52A8\u7A0B\u5E8F
driverEntity.selectDriverEntity=\u9009\u62E9\u6570\u636E\u5E93\u9A71\u52A8\u7A0B\u5E8F
driverEntity.id=ID
driverEntity.driverClassName=\u9A71\u52A8\u7A0B\u5E8F\u7C7B\u540D
driverEntity.displayName=\u9A71\u52A8\u7A0B\u5E8F\u6807\u9898
driverEntity.displayDesc=\u9A71\u52A8\u7A0B\u5E8F\u63CF\u8FF0
@ -298,6 +300,7 @@ user.viewUser=\u67E5\u770B\u7528\u6237
user.manageUser=\u7BA1\u7406\u7528\u6237
user.selectUser=\u9009\u62E9\u7528\u6237
user.personalSet=\u4E2A\u4EBA\u8BBE\u7F6E
user.user.id=ID
user.name=\u7528\u6237\u540D
user.password=\u5BC6\u7801
user.realName=\u59D3\u540D

View File

@ -34,3 +34,4 @@
--v1.1.1
-----------------------------------------
修复修复集成软件包在JRE8及以上版本无法正常运行的BUG

View File

@ -1,57 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='about.about' /></title>
</head>
<body>
<div id="${pageId}" class="page page-about">
<form id="${pageId}-form">
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='about.app.name' /></label>
</div>
<div class="form-item-value">
<fmt:message key='app.name' />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='about.app.version' /></label>
</div>
<div class="form-item-value">
<c:out value='${version}' />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='about.app.website' /></label>
</div>
<div class="form-item-value">
<a href="http://www.datagear.tech" target="_blank" class="link">http://www.datagear.tech</a>
</div>
</div>
</div>
</form>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,24 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_jstl.jsp" %>
[
{
"selector" : "#css_jquery_ui",
"attr" : "href",
"value" : "<%=request.getContextPath()%>/static/theme/<spring:theme code='theme' />/jquery-ui-1.12.1/jquery-ui.css"
},
{
"selector" : "#css_jquery_ui_theme",
"attr" : "href",
"value" : "<%=request.getContextPath()%>/static/theme/<spring:theme code='theme' />/jquery-ui-1.12.1/jquery-ui.theme.css"
},
{
"selector" : "#css_common",
"attr" : "href",
"value" : "<%=request.getContextPath()%>/static/theme/<spring:theme code='theme' />/common.css"
}
]

View File

@ -1,73 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='changelog.changelog' /></title>
</head>
<body>
<div id="${pageId}">
<%if(!ajaxRequest){%>
<div class="main-page-head">
<%@ include file="include/html_logo.jsp" %>
</div>
<%}%>
<div class="page page-changelog">
<form id="${pageId}-form">
<div class="form-content">
<c:forEach var='versionChangelog' items='${versionChangelogs}'>
<div class="form-item form-item-version">
<div class="form-item-label">
<label><fmt:message key='changelog.version' /></label>
</div>
<div class="form-item-value">
<c:out value='${versionChangelog.version}' />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label></label>
</div>
<div class="form-item-value">
<ul class="changelog-content">
<c:forEach var='item' items='${versionChangelog.contents}'>
<li class="changelog-item"><c:out value='${item}' /></li>
</c:forEach>
</ul>
</div>
</div>
</c:forEach>
</div>
<div class="form-foot">
<c:if test='${allListed == null || allListed == false}'>
<a href="<c:url value='/changelogs' />" class="link" target="_blank"><fmt:message key='changelog.viewAll' /></a>
</c:if>
</div>
</form>
</div>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
if($.isInDialog(po.form()))
{
var windowHeight = $(window).height();
var maxHeight = windowHeight - windowHeight/4;
po.element(".form-content").css("max-height", maxHeight+"px").css("overflow", "auto");
}
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,167 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.datagear.web.vo.PropertyPathDisplayName"%>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/jsp_method_write_json.jsp" %>
<%@ include file="include/data_jsp_define.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//是否只读操作允许为null
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, "readonly")));
//可用的查询条件列表不允许为null
List<PropertyPathDisplayName> conditionSource = (List<PropertyPathDisplayName>)request.getAttribute("conditionSource");
%>
<html style="height:100%;">
<head>
<%@ include file="../include/html_head.jsp" %>
<title>
<%@ include file="../include/html_title_app_name.jsp" %>
<fmt:message key='query' />
<fmt:message key='titleSeparator' />
<%=WebUtils.escapeHtml(ModelUtils.displayName(model, WebUtils.getLocale(request)))%>
<%
String diplayDesc = ModelUtils.displayDesc(model, WebUtils.getLocale(request));
if(diplayDesc != null && !diplayDesc.isEmpty()){
%>
<fmt:message key='bracketLeft' />
<%=WebUtils.escapeHtml(diplayDesc)%>
<fmt:message key='bracketRight' />
<%}%>
<fmt:message key='bracketLeft' />
<%=WebUtils.escapeHtml(schema.getTitle())%>
<fmt:message key='bracketRight' />
</title>
</head>
<body style="height:100%;">
<%if(!ajaxRequest){%>
<div style="height:99%;">
<%}%>
<div id="${pageId}" class="page-grid page-grid-query">
<div class="head">
<div class="search">
<%@ include file="include/data_page_obj_searchform_html.jsp" %>
</div>
<div class="operation">
<%if(readonly){%>
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<%}else{%>
<input name="addButton" type="button" value="<fmt:message key='add' />" />
<input name="editButton" type="button" value="<fmt:message key='edit' />" />
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<input name="deleteButton" type="button" value="<fmt:message key='delete' />" />
<%}%>
</div>
</div>
<div class="content">
<table id="${pageId}-table" width="100%" class="hover stripe">
</table>
</div>
<div class="foot foot-edit-grid">
<%if(!readonly){%>
<%@ include file="include/data_page_obj_edit_grid_html.jsp" %>
<%}%>
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<%if(!ajaxRequest){%>
</div>
<%}%>
<%@ include file="include/data_page_obj.jsp" %>
<%@ include file="include/data_page_obj_searchform_js.jsp" %>
<%@ include file="../include/page_obj_pagination.jsp" %>
<%@ include file="include/data_page_obj_grid.jsp" %>
<%if(!readonly){%>
<%@ include file="include/data_page_obj_edit_grid_js.jsp" %>
<%}%>
<script type="text/javascript">
(function(po)
{
po.conditionSource = <%writeJson(application, out, conditionSource);%>;
$.initButtons(po.element(".operation"));
po.onModel(function(model)
{
<%if(!readonly){%>
po.element("input[name=addButton]").click(function()
{
po.open(po.url("", "add", "batchSet=true"), { pinTitleButton : true });
});
po.element("input[name=editButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"data" : row};
po.open(po.url("edit"),
{
data : data,
pinTitleButton : true
});
});
});
<%}%>
po.element("input[name=viewButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"data" : row};
po.open(po.url("view"),
{
data : data
});
});
});
<%if(!readonly){%>
po.element("input[name=deleteButton]").click(function()
{
po.executeOnSelects(function(rows)
{
po.confirm("<fmt:message key='data.confirmDelete'><fmt:param>"+rows.length+"</fmt:param></fmt:message>",
{
"confirm" : function()
{
var data = {"data" : rows};
po.ajaxSubmitForHandleDuplication("delete", data, "<fmt:message key='delete.continueIgnoreDuplicationTemplate' />",
{
"success" : function()
{
po.refresh();
}
});
}
});
});
});
<%}%>
po.conditionAutocompleteSource = $.buildSearchConditionAutocompleteSource(po.conditionSource);
po.initConditionPanel();
po.initPagination();
po.initModelDataTableAjax(po.url("queryData"), model);
po.bindResizeDataTable();
<%if(!readonly){%>
po.initEditGrid(model);
<%}%>
});
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,20 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ page import="java.util.List"%>
<%@ page import="org.datagear.model.Model"%>
<%@ page import="org.datagear.model.Property"%>
<%@ page import="org.datagear.model.support.DynamicBean"%>
<%@ page import="org.datagear.model.support.MU"%>
<%@ page import="org.datagear.model.support.PropertyPath"%>
<%@ page import="org.datagear.model.support.PropertyPathInfo"%>
<%@ page import="org.datagear.management.domain.Schema"%>
<%@ page import="org.datagear.persistence.PagingData"%>
<%@ page import="org.datagear.web.util.ModelUtils" %>
<%
Schema schema = (Schema)request.getAttribute("schema");
Model model = (Model)request.getAttribute("model");
%>

View File

@ -1,36 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.datagear.web.util.WebUtils"%>
<%--
编辑表格功能HTML片段。
--%>
<div class="edit-grid">
<div class="edit-grid-switch-wrapper">
<label for="${pageId}-editGridSwitch"><fmt:message key='editGrid' /></label>
<input id="${pageId}-editGridSwitch" type="checkbox" value="1" />
</div>
<div class="edit-grid-operation">
<button type="button" class="edit-grid-button button-restore highlight" style="display: none;"><fmt:message key='restore' /></button>
<button type="button" class="edit-grid-button button-restore-all highlight" style="display: none;"><fmt:message key='restoreAll' /></button>
<button type="button" class="edit-grid-button button-save recommended" style="display: none;"><fmt:message key='save' /></button>
</div>
</div>
<%
String editGridFormPageId_html = WebUtils.generatePageId();
request.setAttribute("editGridFormPageId", editGridFormPageId_html);
%>
<div id="<%=editGridFormPageId_html%>" class="page-edit-grid-form">
<div class="form-panel ui-widget ui-widget-content ui-corner-all ui-widget-shadow" tabindex="1">
<div class="form-panel-title form-panel-dragger ui-corner-all ui-widget-header">
<span class="close-icon ui-icon ui-icon-close"></span>
</div>
<form id="<%=editGridFormPageId_html%>-form" method="POST" action="#">
</form>
<div class="form-panel-foot form-panel-dragger ui-widget-header">
</div>
</div>
</div>

View File

@ -1,104 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page import="org.springframework.web.context.WebApplicationContext"%>
<%@ page import="org.datagear.web.OperationMessage"%>
<%@ page import="org.datagear.web.util.DeliverContentTypeExceptionHandlerExceptionResolver"%>
<%@ page import="org.springframework.http.HttpStatus" %>
<%@ page import="java.io.Serializable"%>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_method_write_json.jsp" %>
<%
String expectedContentType = DeliverContentTypeExceptionHandlerExceptionResolver.getHandlerContentType(request);
if(expectedContentType != null && !expectedContentType.isEmpty())
response.setContentType(expectedContentType);
OperationMessage operationMessage = WebUtils.getOperationMessage(request);
if(operationMessage == null)
{
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(application);
Integer statusCode = (Integer)request.getAttribute("javax.servlet.error.status_code");
if(statusCode == null)
statusCode = response.getStatus();
String message = (String)request.getAttribute("javax.servlet.error.message");
Throwable throwable = (Throwable)request.getAttribute("javax.servlet.error.exception");
String statusCodeKey = "error.httpError";
if(statusCode != null)
{
int sc = statusCode.intValue();
statusCodeKey += "." + sc;
}
try
{
message = webApplicationContext.getMessage(statusCodeKey, new Object[0], WebUtils.getLocale(request));
}
catch(Throwable t){}
operationMessage = OperationMessage.valueOfFail(statusCodeKey, message);
WebUtils.setOperationMessage(request, operationMessage);
}
boolean jsonResponse = WebUtils.isJsonResponse(response);
if(jsonResponse)
{
writeJson(application, out, operationMessage);
}
else
{
%>
<%@ include file="include/html_doctype.jsp" %>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='error.errorOccure' /></title>
</head>
<body>
<%if(ajaxRequest){%>
<div class="operation-message <%=operationMessage.getType()%>">
<div class="message">
<%=operationMessage.getMessage()%>
</div>
<%if(operationMessage.hasDetail()){%>
<div class="message-detail">
<pre><%=operationMessage.getDetail()%></pre>
</div>
<%}%>
</div>
<%}else{%>
<div>
<div class="main-page-head">
<%@ include file="include/html_logo.jsp" %>
<div class="toolbar">
<a class="link" href="<c:url value="/" />"><fmt:message key='backToMainPage' /></a>
</div>
</div>
<div class="page-error">
<div class="operation-message <%=operationMessage.getType()%>">
<div class="message">
<%=operationMessage.getMessage()%>
</div>
<%if(operationMessage.hasDetail()){%>
<div class="message-detail">
<pre><%=operationMessage.getDetail()%></pre>
</div>
<%}%>
</div>
</div>
</div>
<%}%>
</body>
</html>
<%}%>

View File

@ -1,189 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.management.domain.SmtpSetting.ConnectionType" %>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/jsp_method_get_string_value.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='globalSetting.smtpSetting' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-globalSetting">
<form id="${pageId}-form" action="<%=request.getContextPath()%>/globalSetting/save" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='globalSetting.smtpSetting.host' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.host" value="<c:out value='${globalSetting.smtpSetting.host}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='globalSetting.smtpSetting.port' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.port" value="<c:out value='${globalSetting.smtpSetting.port}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='globalSetting.smtpSetting.username' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.username" value="<c:out value='${globalSetting.smtpSetting.username}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='globalSetting.smtpSetting.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="smtpSetting.password" value="<c:out value='${globalSetting.smtpSetting.password}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='globalSetting.smtpSetting.connectionType' /></label>
</div>
<div class="form-item-value">
<select name="smtpSetting.connectionType">
<option value="<%=ConnectionType.PLAIN%>"><fmt:message key='globalSetting.smtpSetting.connectionType.PLAIN' /></option>
<option value="<%=ConnectionType.SSL%>"><fmt:message key='globalSetting.smtpSetting.connectionType.SSL' /></option>
<option value="<%=ConnectionType.TLS%>"><fmt:message key='globalSetting.smtpSetting.connectionType.TLS' /></option>
</select>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='globalSetting.smtpSetting.systemEmail' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.systemEmail" value="<c:out value='${globalSetting.smtpSetting.systemEmail}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item" style="height:3em;">
<div class="form-item-label">
<label>&nbsp;</label>
</div>
<div class="form-item-value">
<button type="button" id="testSmtpButton"><fmt:message key='globalSetting.testSmtp' /></button>
&nbsp;&nbsp;
<span id="testSmtpPanel" style="display: none;">
<fmt:message key='globalSetting.testSmtp.recevierEmail' />&nbsp;
<input type="text" name="testSmtpRecevierEmail" value="" class="ui-widget ui-widget-content" />
<button type="button" id="testSmtpSendButton" style="vertical-align:baseline;"><fmt:message key='globalSetting.testSmtp.send' /></button>
</span>
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" value="<fmt:message key='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
</div>
</form>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element());
po.testSmtpRecevierEmailInput = function(){ return this.element("input[name='testSmtpRecevierEmail']"); };
po.smtpSettingConnectionTypeSelect = function(){ return this.element("select[name='smtpSetting.connectionType']"); };
po.testSmtpUrl = "<%=request.getContextPath()%>/globalSetting/testSmtp";
po.smtpSettingConnectionTypeSelect().val("<c:out value='${globalSetting.smtpSetting.connectionType}' />");
po.smtpSettingConnectionTypeSelect().selectmenu(
{
"classes" : { "ui-selectmenu-button" : "global-setting-select" }
});
po.element("#testSmtpButton").click(function()
{
po.element("#testSmtpPanel").toggle();
});
po.element("#testSmtpSendButton").click(function()
{
var _this= $(this);
var form = po.form();
var initAction = form.attr("action");
form.attr("action", po.testSmtpUrl);
po.testSmtpRecevierEmailInput().rules("add",
{
"required" : true,
"email" : true,
messages : {"required" : "<fmt:message key='validation.required' />", "email" : "<fmt:message key='validation.email' />"}
});
form.submit();
form.attr("action", initAction);
po.testSmtpRecevierEmailInput().rules("remove");
});
po.form().validate(
{
rules :
{
"smtpSetting.host" : "required",
"smtpSetting.port" : {"required" : true, "integer" : true},
"smtpSetting.systemEmail" : {"required" : true, "email" : true}
},
messages :
{
"smtpSetting.host" : "<fmt:message key='validation.required' />",
"smtpSetting.port" : {"required" : "<fmt:message key='validation.required' />", "integer" : "<fmt:message key='validation.integer' />"},
"smtpSetting.systemEmail" : {"required" : "<fmt:message key='validation.required' />", "email" : "<fmt:message key='validation.email' />"}
},
submitHandler : function(form)
{
var $form = $(form);
var isTestSmtp = (po.testSmtpUrl == $form.attr("action"));
if(isTestSmtp)
po.element("#testSmtpSendButton").button("disable");
$(form).ajaxSubmit(
{
success : function(response)
{
var close = (po.pageParamCall("afterSave") != false);
if(close)
po.close();
},
complete : function()
{
if(isTestSmtp)
po.element("#testSmtpSendButton").button("enable");
}
});
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,13 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%--
依赖:
jsp_ajax_request.jsp
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%if(!ajaxRequest){%>
<!DOCTYPE html>
<%}%>

View File

@ -1,49 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%--
依赖:
jsp_ajax_request.jsp
jsp_jstl.jsp
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="数据齿轮, Data Gear, 数据, data, 数据库, database, 数据管理 , data management, 数据库管理, database management, 浏览器/服务器, B/S" />
<meta name="keywords" content="数据齿轮, Data Gear, 数据, data, 数据库, database, 数据管理 , data management, 数据库管理, database management, 浏览器/服务器, B/S" />
<%if(!ajaxRequest){%>
<script type="text/javascript">
var contextPath="<%=request.getContextPath()%>";
</script>
<link id="css_jquery_ui" href="<%=request.getContextPath()%>/static/theme/<spring:theme code='theme' />/jquery-ui-1.12.1/jquery-ui.css" type="text/css" rel="stylesheet" />
<link id="css_jquery_ui_theme" href="<%=request.getContextPath()%>/static/theme/<spring:theme code='theme' />/jquery-ui-1.12.1/jquery-ui.theme.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/static/theme/jquery.layout-1.4.0/jquery.layout.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/static/theme/jstree-3.3.7/style.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/static/theme/DataTables-1.10.18/datatables.min.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/static/theme/jQuery-File-Upload-9.21.0/jquery.fileupload.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/static/theme/datagear-pagination.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/static/theme/common.css" type="text/css" rel="stylesheet" />
<link id="css_common" href="<%=request.getContextPath()%>/static/theme/<spring:theme code='theme' />/common.css" type="text/css" rel="stylesheet" />
<script src="<c:url value="/static/script/jquery/jquery-1.12.4.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery-ui-1.12.1/jquery-ui.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery.layout-1.4.0/jquery.layout.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jstree-3.3.7/jstree.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/DataTables-1.10.18/datatables.min.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery.form-3.51.0/jquery.form.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jQuery-File-Upload-9.21.0/jquery.iframe-transport.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jQuery-File-Upload-9.21.0/jquery.fileupload.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery.cookie-1.4.1/jquery.cookie.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery-validation-1.17.0/jquery.validate.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery-validation-1.17.0/additional-methods.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/textarea-helper-0.3.1/textarea-helper.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/jquery.actual-1.0.19/jquery.actual.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-pagination.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-model.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-modelcache.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-util.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-jquery-override.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-modelform.js" />" type="text/javascript"></script>
<script src="<c:url value="/static/script/datagear-schema-url-builder.js" />" type="text/javascript"></script>
<%}%>

View File

@ -1,13 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%--
依赖:
jsp_jstl.jsp
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<div class="logo">
<div class="logo-content"><fmt:message key='app.name' /></div>
</div>

View File

@ -1,12 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%--
依赖:
jsp_ajax_request.jsp
jsp_jstl.jsp
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%if(!ajaxRequest){%><fmt:message key='app.name' /> - <%}%>

View File

@ -1,11 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%
//是否ajax请求jquery库ajax可以使用此方案判断
boolean ajaxRequest=(request.getHeader("x-requested-with") != null);
request.setAttribute("ajaxRequest", ajaxRequest);
%>

View File

@ -1,7 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ page import="org.datagear.web.util.WebUtils" %>

View File

@ -1,11 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<fmt:setBundle basename='locales.datagear' />

View File

@ -1,24 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%!
protected String getStringValue(HttpServletRequest request, String name)
{
Object attrValue = request.getAttribute(name);
if(attrValue != null && attrValue instanceof String)
return (String)attrValue;
return request.getParameter(name);
}
protected String getStringValue(HttpServletRequest request, String name, String defaultValue)
{
String value = getStringValue(request, name);
return (value == null ? "" : value);
}
%>

View File

@ -1,35 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@page import="com.alibaba.fastjson.serializer.SerializeConfig"%>
<%@page import="com.alibaba.fastjson.serializer.JSONSerializer"%>
<%@page import="com.alibaba.fastjson.serializer.SerializeWriter"%>
<%@ page import="com.alibaba.fastjson.serializer.SerializerFeature" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page import="org.springframework.web.context.WebApplicationContext"%>
<%@ page import="java.io.Writer"%>
<%@ page import="java.io.IOException"%>
<%!
protected void writeJson(ServletContext servletContext, Writer out, Object object) throws IOException
{
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
SerializeConfig fastJsonConfig = (SerializeConfig)webApplicationContext.getBean("serializeConfig");
SerializerFeature[] serializerFeatures = (SerializerFeature[])webApplicationContext.getBean("serializerFeatures");
SerializeWriter serializeWriter = new SerializeWriter(out, serializerFeatures);
JSONSerializer serializer = new JSONSerializer(serializeWriter, fastJsonConfig);
try
{
serializer.write(object);
}
finally
{
serializer.close();
}
}
%>

View File

@ -1,11 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ page import="org.datagear.web.util.WebUtils" %>
<%
//设置页面客户端对象定义ID
WebUtils.setPageId(request);
%>

View File

@ -1,11 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page import="org.springframework.web.context.WebApplicationContext"%>
<%
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(application);
%>

View File

@ -1,23 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.util.WebUtils" %>
<%--
表单页面JS片段。
依赖:
page_js_obj.jsp
--%>
<script type="text/javascript">
(function(po)
{
po.form = function()
{
return this.element("#${pageId}-form");
};
})
(${pageId});
</script>

View File

@ -1,133 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.springframework.security.core.Authentication" %>
<%@ page import="org.springframework.security.core.AuthenticationException" %>
<%@ page import="org.springframework.security.web.WebAttributes" %>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_method_get_string_value.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<%
String loginUser = (String)session.getAttribute(org.datagear.web.controller.RegisterController.SESSION_KEY_REGISTER_USER_NAME);
//参考org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler.saveException()
AuthenticationException authenticationException = (AuthenticationException)request.getSession().getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
if(authenticationException != null)
{
request.getSession().removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
Authentication authentication = authenticationException.getAuthentication();
if(authentication != null && authentication.getPrincipal() != null)
loginUser = authentication.getPrincipal().toString();
}
if(loginUser == null)
loginUser = "";
%>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='login.login' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head">
<%@ include file="include/html_logo.jsp" %>
<div class="toolbar">
<c:if test='${!disableRegister}'>
<a class="link" href="<c:url value="/register" />"><fmt:message key='register.register' /></a>
</c:if>
<a class="link" href="<c:url value="/" />"><fmt:message key='backToMainPage' /></a>
</div>
</div>
<div class="page-form page-form-login">
<form id="${pageId}-form" action="<c:url value="/login/doLogin" />" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='login.username' /></label>
</div>
<div class="form-item-value">
<input type="text" name="name" value="<%=loginUser%>" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='login.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" class="recommended" value="<fmt:message key='login.login' />" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
</div>
<div class="form-foot small-text" style="text-align:right;">
<label for="auto-login-checkbox"><fmt:message key='login.autoLogin' /></label>
<input type="checkbox" id="auto-login-checkbox" name="autoLogin" value="1" />
<a class="link" href="<c:url value='/resetPassword' />"><fmt:message key='login.fogetPassword' /></a>
</div>
</form>
</div>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
//需要先渲染按钮,不然对话框尺寸不合适,出现滚动条
$.initButtons(po.element());
$("input[name=autoLogin]", po.element()).checkboxradio({icon:true});
var dialog=po.element(".page-form").dialog({
appendTo: po.element(),
title: "<fmt:message key='login.login' />",
position: {my : "center top", at : "center top+75"},
resizable: false,
draggable: true,
width: "41%",
beforeClose: function(){ return false; }
});
po.form().validate(
{
rules :
{
name : "required",
password : "required"
},
messages :
{
name : "<fmt:message key='validation.required' />",
password : "<fmt:message key='validation.required' />"
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
$(".ui-dialog .ui-dialog-titlebar-close", dialog.widget).hide();
<%if(authenticationException != null){%>
$(document).ready(function()
{
$.tipError("<fmt:message key='login.userNameOrPasswordError' />");
});
<%}%>
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,38 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<%
String loginUrl = request.getContextPath() + "/login";
%>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<meta http-equiv="refresh" content="3;url=<%=loginUrl%>">
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='register.registerSuccess' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head">
<%@ include file="include/html_logo.jsp" %>
<div class="toolbar">
<a class="link" href="<c:url value="/" />"><fmt:message key='backToMainPage' /></a>
</div>
</div>
<div class="page-register-success">
<div class="register-success-content">
<fmt:message key='register.registerSuccessContent'>
<fmt:param value='<%=loginUrl%>' />
</fmt:message>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,252 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.ResetPasswordController" %>
<%@ page import="org.datagear.web.controller.ResetPasswordController.ResetPasswordStep" %>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/jsp_method_get_string_value.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<%!
protected String getStepClass(ResetPasswordStep currentStep, int step)
{
if(currentStep.isAfter(step))
return " ui-state-default";
else if(currentStep.isStep(step))
return " ui-state-active";
else
return " ui-state-disabled";
}
%>
<%
ResetPasswordStep step = (ResetPasswordStep)session.getAttribute(ResetPasswordController.KEY_STEP);
String formAction = request.getContextPath() + "/resetPassword/" + step.getAction();
String loginUrl = request.getContextPath() + "/login";
%>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<%if(step.isFinalStep() && !step.isSkipCheckUserAdmin()){%>
<meta http-equiv="refresh" content="4;url=<%=loginUrl%>">
<%}%>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='resetPassword.resetPassword' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head main-page-head-reset-passord">
<%@ include file="include/html_logo.jsp" %>
<div class="toolbar">
<a class="link" href="javascript:void(0);" id="viewResetPasswordAdminReqHistoryLink"><fmt:message key='resetPassword.viewResetPasswordAdminReqHistory' /></a>
<a class="link" href="<c:url value="/login" />"><fmt:message key='resetPassword.backToLoginPage' /></a>
<a class="link" href="<c:url value="/" />"><fmt:message key='backToMainPage' /></a>
</div>
</div>
<div class="page-form page-form-reset-password">
<div class="head">
<fmt:message key='resetPassword.resetPassword' />
</div>
<div class="content">
<div class="steps">
<div class="step ui-widget ui-widget-content ui-corner-all <%=getStepClass(step, 1)%>"><fmt:message key='resetPassword.step.fillInUserInfo' /></div>
<div class="step ui-widget ui-widget-content ui-corner-all <%=getStepClass(step, 2)%>"><fmt:message key='resetPassword.step.checkUser' /></div>
<div class="step ui-widget ui-widget-content ui-corner-all <%=getStepClass(step, 3)%>"><fmt:message key='resetPassword.step.setNewPassword' /></div>
<div class="step ui-widget ui-widget-content ui-corner-all <%=getStepClass(step, 4)%>"><fmt:message key='resetPassword.step.finish' /></div>
</div>
<form id="${pageId}-form" action="<%=formAction%>">
<div class="ui-widget ui-widget-content ui-corner-all form-content">
<%if(step.isStep(1)){%>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.username' /></label>
</div>
<div class="form-item-value">
<input type="text" name="username" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<%}else if(step.isStep(2)){%>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.username' /></label>
</div>
<div class="form-item-value">
<input type="text" value="<%=step.getUser().getName()%>" class="ui-widget ui-widget-content" readonly="readonly" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.email' /></label>
</div>
<div class="form-item-value">
<input type="text" value="<%=step.getBlurryEmail()%>" class="ui-widget ui-widget-content" readonly="readonly" />
<button id="sendCheckCodeButton" type="button"><fmt:message key='resetPassword.sendCheckCode' /></button>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.checkcode' /></label>
</div>
<div class="form-item-value">
<input type="text" name="checkCode" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<%}else if(step.isStep(3)){%>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.username' /></label>
</div>
<div class="form-item-value">
<input type="text" value="<%=step.getUser().getName()%>" class="ui-widget ui-widget-content" readonly="readonly" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='resetPassword.confirmPassword' /></label>
</div>
<div class="form-item-value">
<input type="password" name="confirmPassword" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<%if(step.isSkipCheckUserAdmin()){%>
<div class="form-item">
<div class="ui-state-highlight ui-corner-all skip-check-user-admin-warn">
<span class="ui-icon ui-icon-info"></span>
<fmt:message key='resetPassword.setNewPassword.skipCheckUserAdminWarn'>
<fmt:param value='<%=step.getSkipPasswordDelayHours()%>' />
</fmt:message>
</div>
</div>
<%}%>
<%}else if(step.isFinalStep()){%>
<div class="step-finish-content">
<span class="ui-icon ui-icon-check"></span>
<%if(step.isSkipCheckUserAdmin()){%>
<fmt:message key='resetPassword.step.finish.content.skipCheckUserAdmin'>
<fmt:param value='<%=step.getSkipPasswordDelayHours()%>' />
<fmt:param value='<%=step.getSkipPasswordEffectiveTime()%>' />
</fmt:message>
<%}else{%>
<fmt:message key='resetPassword.step.finish.content'>
<fmt:param value='<%=loginUrl%>' />
</fmt:message>
<%}%>
</div>
<%}%>
</div>
<div class="form-foot" style="text-align:center;">
<input type="button" id="restartResetPassword" value="<fmt:message key='restart' />" <%if(step.isFirstStep()){%>disabled="disabled"<%}%> />
<input type="submit" value="<fmt:message key='resetPassword.next' />" <%if(step.isFinalStep()){%>disabled="disabled"<%}else{%> class="recommended"<%}%> />
</div>
</form>
</div>
</div>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
//需要先渲染按钮,不然对话框尺寸不合适,出现滚动条
$.initButtons(po.element());
po.element("#viewResetPasswordAdminReqHistoryLink").click(function()
{
var options = {};
$.setGridPageHeightOption(options);
po.open("<c:url value='/resetPasswordRequestHistory' />", options);
});
po.element("#restartResetPassword").click(function()
{
window.location.href="<c:url value='/resetPassword' />";
});
po.element("#sendCheckCodeButton").click(function()
{
var _this= $(this);
_this.button("disable");
$.ajax(
{
url : "<c:url value='/resetPassword/sendCheckCode' />",
error : function(jqXHR)
{
var operationMessage = $.getResponseJson(jqXHR);
if(operationMessage && operationMessage.code
&& (operationMessage.code.indexOf("sendCheckCode.admin.smtpSettingNotSet") > 0
|| operationMessage.code.indexOf("sendCheckCode.admin.MessagingException") > 0))
{
po.checkCodeNotRequired = true;
}
else
po.checkCodeNotRequired = false;
},
complete : function()
{
_this.button("enable");
}
});
});
$.validator.addMethod("checkCodeIfRequired", function(value, element, params)
{
if(po.checkCodeNotRequired)
return true;
else
return (value.length > 0);
},"");
po.form().validate(
{
<%if(step.isStep(1)){%>
rules : { username : "required" },
messages : { username : "<fmt:message key='validation.required' />" },
<%}else if(step.isStep(2)){%>
rules : { checkCode : "checkCodeIfRequired" },
messages : { checkCode : "<fmt:message key='validation.required' />" },
<%}else if(step.isStep(3)){%>
rules : { password : "required", confirmPassword : {"required" : true, "equalTo" : po.element("input[name='password']")} },
messages : { password : "<fmt:message key='validation.required' />", confirmPassword : {"required" : "<fmt:message key='validation.required' />", "equalTo" : "<fmt:message key='resetPassword.validation.confirmPasswordError' />"} },
<%}%>
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
},
submitHandler : function(form)
{
$(form).ajaxSubmit(
{
success : function()
{
window.location.href="<c:url value='/resetPassword?step' />";
}
});
}
});
<%if(step.isStep(3) && step.isSkipCheckUserAdmin() && step.getSkipReason() != null && !step.getSkipReason().isEmpty()){%>
$(document).ready(function()
{
$.tipInfo("<%=step.getSkipReason()%>");
});
<%}%>
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,87 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/jsp_method_get_string_value.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<html style="height:100%;">
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='resetPasswordRequestHistory.resetPasswordRequestHistory' /></title>
</head>
<body style="height:100%;">
<%if(!ajaxRequest){%>
<div style="height:99%;">
<%}%>
<div id="${pageId}" class="page-grid page-grid-reset-password-request-history">
<div class="head">
<div class="search">
<%@ include file="include/page_obj_searchform.html.jsp" %>
</div>
<div class="operation">
</div>
</div>
<div class="content">
<table id="${pageId}-table" width="100%" class="hover stripe">
</table>
</div>
<div class="foot">
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<%if(!ajaxRequest){%>
</div>
<%}%>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_searchform_js.jsp" %>
<%@ include file="include/page_obj_pagination.jsp" %>
<%@ include file="include/page_obj_grid.jsp" %>
<script type="text/javascript">
(function(po)
{
po.url = function(action)
{
return contextPath + "/resetPasswordRequestHistory/" + action;
};
po.buildTableColumValueOption = function(title, data)
{
var option =
{
title : title,
data : data,
render: function(data, type, row, meta)
{
return data;
},
defaultContent: "",
};
return option;
};
var tableColumns = [
po.buildTableColumValueOption("<fmt:message key='resetPasswordRequestHistory.time' />", "resetPasswordRequest.time"),
po.buildTableColumValueOption("<fmt:message key='resetPasswordRequestHistory.principal' />", "resetPasswordRequest.principal"),
po.buildTableColumValueOption("<fmt:message key='resetPasswordRequestHistory.username' />", "resetPasswordRequest.user.name"),
po.buildTableColumValueOption("<fmt:message key='resetPasswordRequestHistory.effectiveTime' />", "effectiveTime"),
];
po.initPagination();
var tableSettings = po.buildDataTableSettingsAjax(tableColumns, po.url("pagingQueryData"));
tableSettings.order=[[1,"desc"]];
po.initDataTable(tableSettings);
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,104 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/jsp_method_get_string_value.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='schemaUrlBuilder.schemaUrlBuilder' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-schemaUrlBuilder">
<form id="${pageId}-form" action="<%=request.getContextPath()%>/schemaUrlBuilder/saveScriptCode" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schemaUrlBuilder.scriptCode' /></label>
</div>
<div class="form-item-value form-item-value-scriptCode">
<textarea name="scriptCode" class="ui-widget ui-widget-content script-code-textarea"><c:out value='${scriptCode}' /></textarea>
<div class="script-code-note">
<span><fmt:message key='schemaUrlBuilder.scriptCodeNote.0' /></span>
<pre>
{
//<fmt:message key='schemaUrlBuilder.scriptCodeNote.required' /><fmt:message key='comma' /><fmt:message key='schemaUrlBuilder.scriptCodeNote.dbType' />
dbType : "...",
//<fmt:message key='schemaUrlBuilder.scriptCodeNote.required' /><fmt:message key='comma' /><fmt:message key='schemaUrlBuilder.scriptCodeNote.template' />
template : "...{host}...{port}...{name}...",
//<fmt:message key='schemaUrlBuilder.scriptCodeNote.optional' /><fmt:message key='comma' /><fmt:message key='schemaUrlBuilder.scriptCodeNote.defaultValue' />
defaultValue : { host : "...", port : "...", name : "" },
//<fmt:message key='schemaUrlBuilder.scriptCodeNote.optional' /><fmt:message key='comma' /><fmt:message key='schemaUrlBuilder.scriptCodeNote.order' />
order : 6
}</pre>
<span><fmt:message key='schemaUrlBuilder.scriptCodeNote.1' /></span>
</div>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label>&nbsp;</label>
</div>
<div class="form-item-value">
<button id="previewScriptCode" type="button" class="preview-script-code-button"><fmt:message key='preview' /></button>
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" value="<fmt:message key='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
</div>
</form>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element());
po.element("#previewScriptCode").click(function()
{
po.open(contextPath+"/schemaUrlBuilder/previewScriptCode",
{
data : { "scriptCode" : po.element("textarea[name='scriptCode']").val() }
});
});
po.form().validate(
{
submitHandler : function(form)
{
$(form).ajaxSubmit(
{
success : function(response)
{
var close = (po.pageParamCall("afterSave") != false);
if(close)
po.close();
}
});
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,176 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.UserController" %>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//标题标签I18N关键字不允许null
String titleMessageKey = getStringValue(request, UserController.KEY_TITLE_MESSAGE_KEY);
//表单提交action允许为null
String formAction = getStringValue(request, UserController.KEY_FORM_ACTION, "#");
//是否只读操作允许为null
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, UserController.KEY_READONLY)));
boolean isAdd = "saveAdd".equals(formAction);
%>
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='<%=titleMessageKey%>' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-user">
<form id="${pageId}-form" action="<%=request.getContextPath()%>/user/<%=formAction%>" method="POST">
<div class="form-head"></div>
<div class="form-content">
<input type="hidden" name="id" value="<c:out value='${user.id}' />" />
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='user.name' /></label>
</div>
<div class="form-item-value">
<input type="text" name="name" value="<c:out value='${user.name}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<%if(!readonly){%>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='user.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='user.confirmPassword' /></label>
</div>
<div class="form-item-value">
<input type="password" name="confirmPassword" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<%}%>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='user.realName' /></label>
</div>
<div class="form-item-value">
<input type="text" name="realName" value="<c:out value='${user.realName}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='user.email' /></label>
</div>
<div class="form-item-value">
<input type="text" name="email" value="<c:out value='${user.email}' />" class="ui-widget ui-widget-content" />
</div>
</div>
<%--禁用新建管理员账号功能
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='user.admin' /></label>
</div>
<div class="form-item-value">
<div class="user-admin-radios">
<label for="${pageId}-userAdminYes"><fmt:message key='yes' /></label>
<input type="radio" id="${pageId}-userAdminYes" name="admin" value="1" <c:if test='${user.admin}'>checked="checked"</c:if> />
<label for="${pageId}-userAdminNo"><fmt:message key='no' /></label>
<input type="radio" id="${pageId}-userAdminNo" name="admin" value="0" <c:if test='${!user.admin}'>checked="checked"</c:if> />
</div>
</div>
</div>
--%>
</div>
<div class="form-foot" style="text-align:center;">
<%if(!readonly){%>
<input type="submit" value="<fmt:message key='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
<%}%>
</div>
</form>
</div>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_form.jsp" %>
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element());
<%--禁用新建管理员账号功能
po.element("input[name='admin']").checkboxradio({icon:false});
po.element(".user-admin-radios").controlgroup();
--%>
po.url = function(action)
{
return contextPath + "/user/" + action;
};
<%if(!readonly){%>
po.form().validate(
{
rules :
{
name : "required",
<%if(isAdd){%>
password : "required",
<%}%>
confirmPassword :
{
<%if(isAdd){%>
"required" : true,
<%}%>
"equalTo" : po.element("input[name='password']")
},
email : "email"
},
messages :
{
name : "<fmt:message key='validation.required' />",
<%if(isAdd){%>
password : "<fmt:message key='validation.required' />",
<%}%>
confirmPassword :
{
<%if(isAdd){%>
"required" : "<fmt:message key='validation.required' />",
<%}%>
"equalTo" : "<fmt:message key='user.validation.confirmPasswordError' />"
},
email : "<fmt:message key='validation.email' />"
},
submitHandler : function(form)
{
$(form).ajaxSubmit(
{
success : function()
{
var close = (po.pageParamCall("afterSave") != false);
if(close)
po.close();
}
});
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
<%}%>
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,200 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.AbstractController" %>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//标题标签I18N关键字不允许null
String titleMessageKey = getStringValue(request, AbstractController.KEY_TITLE_MESSAGE_KEY);
//是否选择操作允许为null
boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, AbstractController.KEY_SELECTONLY)));
%>
<html style="height:100%;">
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='<%=titleMessageKey%>' /></title>
</head>
<body style="height:100%;">
<%if(!ajaxRequest){%>
<div style="height:99%;">
<%}%>
<div id="${pageId}" class="page-grid page-grid-hidden-foot page-grid-user">
<div class="head">
<div class="search">
<%@ include file="../include/page_obj_searchform.html.jsp" %>
</div>
<div class="operation">
<%if(selectonly){%>
<input name="confirmButton" type="button" class="recommended" value="<fmt:message key='confirm' />" />
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<%}else{%>
<input name="addButton" type="button" value="<fmt:message key='add' />" />
<input name="editButton" type="button" value="<fmt:message key='edit' />" />
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<input name="deleteButton" type="button" value="<fmt:message key='delete' />" />
<%}%>
</div>
</div>
<div class="content">
<table id="${pageId}-table" width="100%" class="hover stripe">
</table>
</div>
<div class="foot">
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<%if(!ajaxRequest){%>
</div>
<%}%>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_searchform_js.jsp" %>
<%@ include file="../include/page_obj_grid.jsp" %>
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element(".operation"));
po.url = function(action)
{
return contextPath + "/user/" + action;
};
<%if(!selectonly){%>
po.element("input[name=addButton]").click(function()
{
po.open(po.url("add"),
{
pageParam :
{
afterSave : function()
{
po.refresh();
}
}
});
});
po.element("input[name=editButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"id" : row.id};
po.open(po.url("edit"),
{
data : data,
pageParam :
{
afterSave : function()
{
po.refresh();
}
}
});
});
});
<%}%>
po.element("input[name=viewButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"id" : row.id};
po.open(po.url("view"),
{
data : data
});
});
});
<%if(!selectonly){%>
po.element("input[name=deleteButton]").click(
function()
{
po.executeOnSelects(function(rows)
{
po.confirm("<fmt:message key='user.confirmDelete' />",
{
"confirm" : function()
{
var data = $.getPropertyParamString(rows, "id");
$.post(po.url("delete"), data, function()
{
po.refresh();
});
}
});
});
});
<%}%>
po.element("input[name=confirmButton]").click(function()
{
po.executeOnSelect(function(row)
{
var close = po.pageParamCall("submit", row);
//单选默认关闭
if(close == undefined)
close = true;
if(close)
po.close();
});
});
po.buildTableColumValueOption = function(title, data, hidden)
{
var option =
{
title : title,
data : data,
visible : !hidden,
render: function(data, type, row, meta)
{
return $.escapeHtml(data);
},
defaultContent: "",
};
return option;
};
var columnAdmin = po.buildTableColumValueOption("<fmt:message key='user.admin' />", "admin");
columnAdmin.render = function(data, type, row, meta)
{
if(data == true)
data = "<fmt:message key='yes' />";
else
data = "<fmt:message key='no' />";
return data;
};
var tableColumns = [
po.buildTableColumValueOption("<fmt:message key='user.user.id' />", "id", true),
po.buildTableColumValueOption("<fmt:message key='user.name' />", "name"),
po.buildTableColumValueOption("<fmt:message key='user.realName' />", "realName"),
po.buildTableColumValueOption("<fmt:message key='user.email' />", "email"),
columnAdmin,
po.buildTableColumValueOption("<fmt:message key='user.createTime' />", "createTime")
];
var tableSettings = po.buildDataTableSettingsAjax(tableColumns, po.url("queryData"));
po.initDataTable(tableSettings);
})
(${pageId});
</script>
</body>
</html>

View File

@ -0,0 +1,48 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='about.about' /></title>
</head>
<body>
<div id="${pageId}" class="page page-about">
<form id="${pageId}-form">
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='about.app.name' /></label>
</div>
<div class="form-item-value">
<@spring.message code='app.name' />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='about.app.version' /></label>
</div>
<div class="form-item-value">
<c:out value='${version}' />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='about.app.website' /></label>
</div>
<div class="form-item-value">
<a href="http://www.datagear.tech" target="_blank" class="link">http://www.datagear.tech</a>
</div>
</div>
</div>
</form>
</div>
<#include "include/page_js_obj.ftl" >
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
})
(${pageId});
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<#include "include/import_global.ftl">
[
{
"selector" : "#css_jquery_ui",
"attr" : "href",
"value" : "${contextPath}/static/theme/<@spring.theme code='theme' />/jquery-ui-1.12.1/jquery-ui.css"
},
{
"selector" : "#css_jquery_ui_theme",
"attr" : "href",
"value" : "${contextPath}/static/theme/<@spring.theme code='theme' />/jquery-ui-1.12.1/jquery-ui.theme.css"
},
{
"selector" : "#css_common",
"attr" : "href",
"value" : "${contextPath}/static/theme/<@spring.theme code='theme' />/common.css"
}
]

View File

@ -0,0 +1,64 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='changelog.changelog' /></title>
</head>
<body>
<div id="${pageId}">
<#if !isAjaxRequest>
<div class="main-page-head">
<#include "include/html_logo.ftl">
</div>
</#if>
<div class="page page-changelog">
<form id="${pageId}-form">
<div class="form-content">
<#list versionChangelogs as versionChangelog>
<div class="form-item form-item-version">
<div class="form-item-label">
<label><@spring.message code='changelog.version' /></label>
</div>
<div class="form-item-value">
${versionChangelog.version}
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label></label>
</div>
<div class="form-item-value">
<ul class="changelog-content">
<#list versionChangelog.contents as item>
<li class="changelog-item">${item?html}</li>
</#list>
</ul>
</div>
</div>
</#list>
</div>
<div class="form-foot">
<#if !(allListed??) || allListed == false>
<a href="${contextPath}/changelogs" class="link" target="_blank"><@spring.message code='changelog.viewAll' /></a>
</#if>
</div>
</form>
</div>
</div>
<#include "include/page_js_obj.ftl" >
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
if($.isInDialog(po.form()))
{
var windowHeight = $(window).height();
var maxHeight = windowHeight - windowHeight/4;
po.element(".form-content").css("max-height", maxHeight+"px").css("overflow", "auto");
}
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,41 +1,31 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/jsp_method_write_json.jsp" %>
<%@ include file="include/data_jsp_define.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//初始数据允许null
Object data = request.getAttribute("data");
//初始数据是否是客户端数据默认为false
boolean isClientPageData = ("true".equalsIgnoreCase(getStringValue(request, "isClientPageData")));
//标题操作标签I18N关键字不允许null
String titleOperationMessageKey = getStringValue(request, "titleOperationMessageKey");
//提交活动po.pageParam().submit(...)未定义时不允许为null
String submitAction = getStringValue(request, "submitAction");
//是否只读操作默认为false
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, "readonly")));
//忽略表单渲染和处理的属性名,默认为""
String ignorePropertyName = getStringValue(request, "ignorePropertyName", "");
//是否开启批量执行功能默认为false
boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet")));
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
Schema schema 数据库不允许为null
Model model 模型不允许为null
Object data 初始数据允许null
boolean isClientPageData 初始数据是否是客户端数据默认为false
String titleOperationMessageKey 标题操作标签I18N关键字不允许null
String titleDisplayName 页面展示名称,默认为""
String submitAction 提交活动po.pageParam().submit(...)未定义时不允许为null
boolean readonly 是否只读操作默认为false
String ignorePropertyName 忽略表单渲染和处理的属性名,默认为""
boolean batchSet 是否开启批量执行功能默认为false
-->
<#assign isClientPageData=(isClientPageData!false)>
<#assign titleDisplayName=(titleDisplayName!'')>
<#assign submitAction=(submitAction!'#')>
<#assign readonly=(readonly!false)>
<#assign ignorePropertyName=(ignorePropertyName!'')>
<#assign batchSet=(batchSet!false)>
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<#include "../include/html_head.ftl">
<title>
<%@ include file="../include/html_title_app_name.jsp" %>
<fmt:message key='<%=titleOperationMessageKey%>' />
<fmt:message key='titleSeparator' />
<%=WebUtils.escapeHtml(ModelUtils.displayName(model, WebUtils.getLocale(request)))%>
<#include "../include/html_title_app_name.ftl">
<@spring.message code='${titleOperationMessageKey}' />
<@spring.message code='titleSeparator' />
${titleDisplayName?html}
</title>
</head>
<body>
@ -49,16 +39,16 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
<div class="foot">
</div>
</div>
<%@ include file="include/data_page_obj.jsp" %>
<%@ include file="include/data_page_obj_form.jsp" %>
<#include "include/data_page_obj.ftl">
<#include "include/data_page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
po.data = $.unref(<%writeJson(application, out, data);%>);
po.readonly = <%=readonly%>;
po.submitAction = "<%=submitAction%>";
po.isClientPageData = <%=isClientPageData%>;
po.batchSet = <%=batchSet%>;
po.data = $.unref(<@writeJson var=data />);
po.readonly = ${readonly?c};
po.submitAction = "${submitAction?js_string}";
po.isClientPageData = ${isClientPageData?c};
po.batchSet = ${batchSet?c};
if(!po.isClientPageData && po.data == null)
po.isClientPageData = true;
@ -68,7 +58,7 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
po.form().modelform(
{
model : model,
ignorePropertyNames : "<%=WebUtils.escapeJavaScriptStringValue(ignorePropertyName)%>",
ignorePropertyNames : "${ignorePropertyName?js_string}",
//不能直接使用po.data因为po.data作为原始数据不应该被表单编辑变更
data : $.deepClone(po.data),
readonly : po.readonly,
@ -93,7 +83,7 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
var thisForm = this;
var param = $.extend(formParam, {"data" : formData, "originalData" : po.data});
po.ajaxSubmitForHandleDuplication(po.submitAction, param, "<fmt:message key='save.continueIgnoreDuplicationTemplate' />",
po.ajaxSubmitForHandleDuplication(po.submitAction, param, "<@spring.message code='save.continueIgnoreDuplicationTemplate' />",
{
beforeSend : function()
{
@ -166,8 +156,8 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
{
po.viewMultiplePropertyValue(property, propertyConcreteModel, propertyValue);
},
filePropertyUploadURL : "<c:url value='/data/file/upload' />",
filePropertyDeleteURL : "<c:url value='/data/file/delete' />",
filePropertyUploadURL : "${contextPath}/data/file/upload",
filePropertyDeleteURL : "${contextPath}/data/file/delete",
downloadSinglePropertyValueFile : function(property, propertyConcreteModel)
{
po.downloadSinglePropertyValueFile(property, propertyConcreteModel);
@ -175,10 +165,10 @@ boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet"))
validationRequiredAsAdd : ("saveAdd" == po.submitAction),
batchSet : po.batchSet,
labels : po.formLabels,
dateFormat : "<c:out value='${sqlDateFormat}' />",
timestampFormat : "<c:out value='${sqlTimestampFormat}' />",
timeFormat : "<c:out value='${sqlTimeFormat}' />",
filePropertyLabelValue : "<c:out value='${filePropertyLabelValue}' />"
dateFormat : "${sqlDateFormat}",
timestampFormat : "${sqlTimestampFormat}",
timeFormat : "${sqlTimeFormat}",
filePropertyLabelValue : "${filePropertyLabelValue}"
});
});
})

View File

@ -0,0 +1,157 @@
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
Schema schema 数据库不允许为null
Model model 模型不允许为null
String titleDisplayName 页面展示名称,默认为""
String titleDisplayDesc 页面展示描述,默认为""
boolean readonly 是否只读操作默认为false
List PropertyPathDisplayName conditionSource 可用的查询条件列表不允许为null
-->
<#assign titleDisplayName=(titleDisplayName!'')>
<#assign titleDisplayDesc=(titleDisplayDesc!'')>
<#assign readonly=(readonly!false)>
<html style="height:100%;">
<head>
<#include "../include/html_head.ftl">
<title>
<#include "../include/html_title_app_name.ftl">
<@spring.message code='query' />
<@spring.message code='titleSeparator' />
${titleDisplayName?html}
<#if titleDisplayDesc != ''>
<@spring.message code='bracketLeft' />
${titleDisplayDesc?html}
<@spring.message code='bracketRight' />
</#if>
<@spring.message code='bracketLeft' />
${schema.title?html}
<@spring.message code='bracketRight' />
</title>
</head>
<body style="height:100%;">
<#if !isAjaxRequest>
<div style="height:99%;">
</#if>
<div id="${pageId}" class="page-grid page-grid-query">
<div class="head">
<div class="search">
<#include "include/data_page_obj_searchform_html.ftl">
</div>
<div class="operation">
<#if readonly>
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<#else>
<input name="addButton" type="button" value="<@spring.message code='add' />" />
<input name="editButton" type="button" value="<@spring.message code='edit' />" />
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<input name="deleteButton" type="button" value="<@spring.message code='delete' />" />
</#if>
</div>
</div>
<div class="content">
<table id="${pageId}-table" width="100%" class="hover stripe">
</table>
</div>
<div class="foot foot-edit-grid">
<#if !readonly>
<#include "include/data_page_obj_edit_grid_html.ftl">
</#if>
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<#if !isAjaxRequest>
</div>
</#if>
<#include "include/data_page_obj.ftl">
<#include "include/data_page_obj_searchform_js.ftl">
<#include "../include/page_obj_pagination.ftl">
<#include "include/data_page_obj_grid.ftl">
<#if !readonly>
<#include "include/data_page_obj_edit_grid_js.ftl">
</#if>
<script type="text/javascript">
(function(po)
{
po.conditionSource = $.unref(<@writeJson var=conditionSource />);
$.initButtons(po.element(".operation"));
po.onModel(function(model)
{
<#if !readonly>
po.element("input[name=addButton]").click(function()
{
po.open(po.url("", "add", "batchSet=true"), { pinTitleButton : true });
});
po.element("input[name=editButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"data" : row};
po.open(po.url("edit"),
{
data : data,
pinTitleButton : true
});
});
});
</#if>
po.element("input[name=viewButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"data" : row};
po.open(po.url("view"),
{
data : data
});
});
});
<#if !readonly>
po.element("input[name=deleteButton]").click(function()
{
po.executeOnSelects(function(rows)
{
<#assign messageArgs=['"+rows.length+"'] />
po.confirm("<@spring.messageArgs code='data.confirmDelete' args=messageArgs />",
{
"confirm" : function()
{
var data = {"data" : rows};
po.ajaxSubmitForHandleDuplication("delete", data, "<@spring.message code='delete.continueIgnoreDuplicationTemplate' />",
{
"success" : function()
{
po.refresh();
}
});
}
});
});
});
</#if>
po.conditionAutocompleteSource = $.buildSearchConditionAutocompleteSource(po.conditionSource);
po.initConditionPanel();
po.initPagination();
po.initModelDataTableAjax(po.url("queryData"), model);
po.bindResizeDataTable();
<#if !readonly>
po.initEditGrid(model);
</#if>
});
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,45 +1,31 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/jsp_method_write_json.jsp" %>
<%@ include file="include/data_jsp_define.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//初始数据允许null
Object data = request.getAttribute("data");
//属性名称不允许null
String propertyPath = getStringValue(request, "propertyPath");
//初始属性值可用于设置初始表单数据允许为null
Object propertyValue = request.getAttribute("propertyValue");
//初始属性值数据是否是客户端数据默认为false
boolean isClientPageData = ("true".equalsIgnoreCase(getStringValue(request, "isClientPageData")));
//标题操作标签I18N关键字不允许null
String titleOperationMessageKey = getStringValue(request, "titleOperationMessageKey");
//提交活动po.pageParam().submit(...)未定义时不允许为null
String submitAction = getStringValue(request, "submitAction");
//是否只读操作默认为false
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, "readonly")));
//是否开启批量执行功能默认为false
boolean batchSet = ("true".equalsIgnoreCase(getStringValue(request, "batchSet")));
PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
Schema schema 数据库不允许为null
Model model 模型不允许为null
Object data 初始数据允许null
String propertyPath 属性名称不允许null
Object propertyValue 初始属性值可用于设置初始表单数据允许为null
boolean isClientPageData 初始数据是否是客户端数据默认为false
String titleOperationMessageKey 标题操作标签I18N关键字不允许null
String titleDisplayName 页面展示名称,默认为""
String submitAction 提交活动po.pageParam().submit(...)未定义时不允许为null
boolean readonly 是否只读操作默认为false
boolean batchSet 是否开启批量执行功能默认为false
-->
<#assign isClientPageData=(isClientPageData!false)>
<#assign titleDisplayName=(titleDisplayName!'')>
<#assign submitAction=(submitAction!'#')>
<#assign readonly=(readonly!false)>
<#assign batchSet=(batchSet!false)>
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<#include "../include/html_head.ftl">
<title>
<%@ include file="../include/html_title_app_name.jsp" %>
<fmt:message key='<%=titleOperationMessageKey%>' />
<fmt:message key='titleSeparator' />
<%=WebUtils.escapeHtml(ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)))%>
<#include "../include/html_title_app_name.ftl">
<@spring.message code='${titleOperationMessageKey}' />
<@spring.message code='titleSeparator' />
${titleDisplayName?html}
</title>
</head>
<body>
@ -53,18 +39,18 @@ PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
<div class="foot">
</div>
</div>
<%@ include file="include/data_page_obj.jsp" %>
<%@ include file="include/data_page_obj_form.jsp" %>
<#include "include/data_page_obj.ftl">
<#include "include/data_page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
po.data = ($.unref(<%writeJson(application, out, data);%>) || {});
po.propertyPath = "<%=WebUtils.escapeJavaScriptStringValue(propertyPath)%>";
po.propertyValue = ($.unref(<%writeJson(application, out, propertyValue);%>) || $.model.propertyPathValue(po.data, po.propertyPath));
po.readonly = <%=readonly%>;
po.submitAction = "<%=submitAction%>";
po.isClientPageData = <%=isClientPageData%>;
po.batchSet = <%=batchSet%>;
po.data = ($.unref(<@writeJson var=data />) || {});
po.propertyPath = "${propertyPath?js_string}";
po.propertyValue = ($.unref(<@writeJson var=propertyValue />) || $.model.propertyPathValue(po.data, po.propertyPath));
po.readonly = ${readonly?c};
po.submitAction = "${submitAction?js_string}";
po.isClientPageData = ${isClientPageData?c};
po.batchSet = ${batchSet?c};
if(!po.isClientPageData && po.propertyValue == null)
po.isClientPageData = true;
@ -126,7 +112,7 @@ PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
var thisForm = this;
var param = $.extend(formParam, { "data" : po.data, "propertyPath" : po.propertyPath, "propertyValue" : propertyValue });
po.ajaxSubmitForHandleDuplication(po.submitAction, param, "<fmt:message key='save.continueIgnoreDuplicationTemplate' />",
po.ajaxSubmitForHandleDuplication(po.submitAction, param, "<@spring.message code='save.continueIgnoreDuplicationTemplate' />",
{
beforeSend : function()
{
@ -202,8 +188,8 @@ PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
{
po.viewMultiplePropertyValue(property, propertyConcreteModel, propertyValue);
},
filePropertyUploadURL : "<c:url value='/data/file/upload' />",
filePropertyDeleteURL : "<c:url value='/data/file/delete' />",
filePropertyUploadURL : "${contextPath}/data/file/upload",
filePropertyDeleteURL : "${contextPath}/data/file/delete",
downloadSinglePropertyValueFile : function(property, propertyConcreteModel)
{
po.downloadSinglePropertyValueFile(property, propertyConcreteModel);
@ -211,10 +197,10 @@ PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
validationRequiredAsAdd : ("saveAdd" == po.submitAction),
batchSet : po.batchSet,
labels : po.formLabels,
dateFormat : "<c:out value='${sqlDateFormat}' />",
timestampFormat : "<c:out value='${sqlTimestampFormat}' />",
timeFormat : "<c:out value='${sqlTimeFormat}' />",
filePropertyLabelValue : "<c:out value='${filePropertyLabelValue}' />"
dateFormat : "${sqlDateFormat}",
timestampFormat : "${sqlTimestampFormat}",
timeFormat : "${sqlTimeFormat}",
filePropertyLabelValue : "${filePropertyLabelValue}"
});
});
})

View File

@ -1,73 +1,56 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.datagear.web.vo.PropertyPathDisplayName"%>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/jsp_method_write_json.jsp" %>
<%@ include file="include/data_jsp_define.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//初始数据允许null
Object data = request.getAttribute("data");
//属性名称不允许null
String propertyPath = getStringValue(request, "propertyPath");
//初始属性值可用于设置初始表单数据允许为null
Object propertyValue = request.getAttribute("propertyValue");
//所有表格数据是否都是客户端数据默认为false
boolean isClientPageData = ("true".equalsIgnoreCase(getStringValue(request, "isClientPageData")));
//标题操作标签I18N关键字不允许null
String titleOperationMessageKey = getStringValue(request, "titleOperationMessageKey");
//是否只读操作默认为false
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, "readonly")));
//可用的查询条件列表isClientPageData为false时不允许为null
List<PropertyPathDisplayName> conditionSource = (List<PropertyPathDisplayName>)request.getAttribute("conditionSource");
PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
PropertyPathInfo propertyPathInfoObj = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj, data);
boolean isPrivatePropertyModel = ModelUtils.isPrivatePropertyModelTail(propertyPathInfoObj);
boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
Schema schema 数据库不允许为null
Model model 模型不允许为null
Object data 初始数据允许null
String propertyPath 属性名称不允许null
Object propertyValue 初始属性值可用于设置初始表格数据允许为null
boolean isClientPageData 初始数据是否是客户端数据默认为false
String titleOperationMessageKey 标题操作标签I18N关键字不允许null
String titleDisplayName 页面展示名称,默认为""
boolean readonly 是否只读操作默认为false
boolean isPrivatePropertyModel 是否是私有属性不允许为null
List PropertyPathDisplayName conditionSource 可用的查询条件列表isClientPageData为false时不允许为null
-->
<#assign isClientPageData=(isClientPageData!false)>
<#assign titleDisplayName=(titleDisplayName!'')>
<#assign readonly=(readonly!false)>
<#assign isAllowEditGrid=(isPrivatePropertyModel && !readonly)>
<html style="height:100%;">
<head>
<%@ include file="../include/html_head.jsp" %>
<#include "../include/html_head.ftl">
<title>
<%@ include file="../include/html_title_app_name.jsp" %>
<fmt:message key='<%=titleOperationMessageKey%>' />
<fmt:message key='titleSeparator' />
<%=WebUtils.escapeHtml(ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)))%>
<#include "../include/html_title_app_name.ftl">
<@spring.message code='${titleOperationMessageKey}' />
<@spring.message code='titleSeparator' />
${titleDisplayName?html}
</title>
</head>
<body style="height:100%;">
<%if(!ajaxRequest){%>
<#if !isAjaxRequest>
<div style="height:99%;">
<%}%>
</#if>
<div id="${pageId}" class="page-grid page-grid-empv">
<div class="head">
<div class="search">
<%if(!isClientPageData){%>
<%@ include file="include/data_page_obj_searchform_html.jsp" %>
<%}%>
<#if !isClientPageData>
<#include "include/data_page_obj_searchform_html.ftl">
</#if>
</div>
<div class="operation">
<%if(readonly){%>
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<%}else{%>
<%if(isPrivatePropertyModel){%>
<input name="addButton" type="button" value="<fmt:message key='add' />" />
<input name="editButton" type="button" value="<fmt:message key='edit' />" />
<%}else{%>
<input name="selectButton" type="button" class="recommended" value="<fmt:message key='select' />" />
<%}%>
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<input name="deleteButton" type="button" value="<fmt:message key='delete' />" />
<%}%>
<#if readonly>
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<#else>
<#if isPrivatePropertyModel>
<input name="addButton" type="button" value="<@spring.message code='add' />" />
<input name="editButton" type="button" value="<@spring.message code='edit' />" />
<#else>
<input name="selectButton" type="button" class="recommended" value="<@spring.message code='select' />" />
</#if>
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<input name="deleteButton" type="button" value="<@spring.message code='delete' />" />
</#if>
</div>
</div>
<div class="content">
@ -75,38 +58,38 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
</table>
</div>
<div class="foot foot-edit-grid">
<%if(isAllowEditGrid){%>
<%@ include file="include/data_page_obj_edit_grid_html.jsp" %>
<%}%>
<#if isAllowEditGrid>
<#include "include/data_page_obj_edit_grid_html.ftl">
</#if>
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<%if(!ajaxRequest){%>
<#if !isAjaxRequest>
</div>
<%}%>
<%@ include file="include/data_page_obj.jsp" %>
<%if(!isClientPageData){%>
<%@ include file="include/data_page_obj_searchform_js.jsp" %>
<%@ include file="../include/page_obj_pagination.jsp" %>
<%}%>
<%@ include file="include/data_page_obj_grid.jsp" %>
<%if(isAllowEditGrid){%>
<%@ include file="include/data_page_obj_edit_grid_js.jsp" %>
<%}%>
</#if>
<#include "include/data_page_obj.ftl">
<#if !isClientPageData>
<#include "include/data_page_obj_searchform_js.ftl">
<#include "../include/page_obj_pagination.ftl">
</#if>
<#include "include/data_page_obj_grid.ftl">
<#if isAllowEditGrid>
<#include "include/data_page_obj_edit_grid_js.ftl">
</#if>
<script type="text/javascript">
(function(po)
{
po.data = ($.unref(<%writeJson(application, out, data);%>) || {});
po.propertyPath = "<%=WebUtils.escapeJavaScriptStringValue(propertyPath)%>";
po.propertyValue = ($.unref(<%writeJson(application, out, propertyValue);%>) || $.model.propertyPathValue(po.data, po.propertyPath));
po.readonly = <%=readonly%>;
po.isClientPageData = <%=isClientPageData%>;
po.data = ($.unref(<@writeJson var=data />) || {});
po.propertyPath = "${propertyPath?js_string}";
po.propertyValue = ($.unref(<@writeJson var=propertyValue />) || $.model.propertyPathValue(po.data, po.propertyPath));
po.readonly = ${readonly?c};
po.isClientPageData = ${isClientPageData?c};
<%if(!isClientPageData){%>
po.conditionSource = <%writeJson(application, out, conditionSource);%>;
<%}%>
<#if !isClientPageData>
po.conditionSource = $.unref(<@writeJson var=conditionSource />);
</#if>
$.initButtons(po.element(".operation"));
@ -143,7 +126,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
po.pageParamCall("submit", gridPropertyValue);
};
<%if(isAllowEditGrid){%>
<#if isAllowEditGrid>
po.editGridFormPage.dpvgSuperBuildPropertyActionOptions = po.editGridFormPage.buildPropertyActionOptions;
po.editGridFormPage.buildPropertyActionOptions = function(property, propertyModel, propertyValue, extraRequestParams, extraPageParams)
{
@ -203,7 +186,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
return options;
};
<%}%>
</#if>
po.onModel(function(model)
{
@ -262,7 +245,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
});
});
<%if(!readonly){%>
<#if !readonly>
po.addMultiplePropValueElement = function()
{
var url = undefined;
@ -284,7 +267,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
po.addRowData(propValueElement);
po.storeGridPropertyValue();
$.tipSuccess("<fmt:message key='haveAdd' />");
$.tipSuccess("<@spring.message code='haveAdd' />");
}
});
}
@ -304,12 +287,12 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
po.open(url, options);
};
<%if(isPrivatePropertyModel){%>
<#if isPrivatePropertyModel>
po.element("input[name=addButton]").click(function()
{
po.addMultiplePropValueElement();
});
<%}else{%>
<#else>
po.element("input[name=selectButton]").click(function()
{
var options = po.buildActionOptions(property, propertyModel, null,
@ -321,7 +304,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
po.addRowData(rows);
po.storeGridPropertyValue();
$.tipSuccess("<fmt:message key='haveAdd' />");
$.tipSuccess("<@spring.message code='haveAdd' />");
}
else
{
@ -339,7 +322,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
options.pinTitleButton = true;
po.open(po.url("selectPropValue")+"?multiple", options);
});
<%}%>
</#if>
po.element("input[name=editButton]").click(function()
{
@ -391,7 +374,8 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
{
po.executeOnSelects(function(rows, indexes)
{
po.confirm("<fmt:message key='data.confirmDelete'><fmt:param>"+rows.length+"</fmt:param></fmt:message>",
<#assign messageArgs=['"+rows.length+"'] />
po.confirm("<@spring.messageArgs code='data.confirmDelete' args=messageArgs />",
{
"confirm" : function()
{
@ -404,7 +388,7 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
{
var options = po.buildActionOptions(property, propertyModel, {"propValueElements" : rows}, null);
po.ajaxSubmitForHandleDuplication("deleteMultiplePropValueElements", options.data, "<fmt:message key='delete.continueIgnoreDuplicationTemplate' />",
po.ajaxSubmitForHandleDuplication("deleteMultiplePropValueElements", options.data, "<@spring.message code='delete.continueIgnoreDuplicationTemplate' />",
{
"success" : function()
{
@ -416,22 +400,22 @@ boolean isAllowEditGrid = (isPrivatePropertyModel && !readonly);
});
});
});
<%}%>
</#if>
<%if(isClientPageData){%>
<#if isClientPageData>
po.initModelDataTableLocal(propertyModel, $.model.propertyPathValue(po.data, po.propertyPath), po.mappedByWith);
<%}else{%>
<#else>
po.conditionAutocompleteSource = $.buildSearchConditionAutocompleteSource(po.conditionSource);
po.initConditionPanel();
po.initPagination();
po.initModelDataTableAjax(po.url("queryMultiplePropValueData"), propertyModel, po.mappedByWith);
<%}%>
</#if>
po.bindResizeDataTable();
<%if(isAllowEditGrid){%>
<#if isAllowEditGrid>
po.initEditGrid(propertyModel, po.mappedByWith);
<%}%>
</#if>
});
})
(${pageId});

View File

@ -1,58 +1,39 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.datagear.web.vo.PropertyPathDisplayName"%>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/jsp_method_write_json.jsp" %>
<%@ include file="include/data_jsp_define.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//初始数据允许null
Object data = request.getAttribute("data");
//属性名称不允许null
String propertyPath = request.getParameter("propertyPath");
PropertyPath propertyPathObj = ModelUtils.toPropertyPath(propertyPath);
PropertyPathInfo propertyPathInfoObj = ModelUtils.toPropertyPathInfoConcrete(model, propertyPathObj, data);
//可用的查询条件列表不允许为null
List<PropertyPathDisplayName> conditionSource = (List<PropertyPathDisplayName>)request.getAttribute("conditionSource");
boolean isMultipleSelect = false;
if(request.getParameter("multiple") != null)
isMultipleSelect = true;
else
isMultipleSelect = MU.isMultipleProperty(propertyPathInfoObj.getPropertyTail());
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
Schema schema 数据库不允许为null
Model model 模型不允许为null
Object data 初始数据允许null
String propertyPath 属性名称不允许null
String titleDisplayName 页面展示名称,默认为""
List PropertyPathDisplayName conditionSource 可用的查询条件列表不允许为null
boolean isMultipleSelect 是否多选默认为false
-->
<#assign titleDisplayName=(titleDisplayName!'')>
<#assign isMultipleSelect=(isMultipleSelect!false)>
<html style="height:100%;">
<head>
<%@ include file="../include/html_head.jsp" %>
<#include "../include/html_head.ftl">
<title>
<%@ include file="../include/html_title_app_name.jsp" %>
<fmt:message key='select' /><fmt:message key='titleSeparator' />
<%=WebUtils.escapeHtml(ModelUtils.displayName(model, propertyPathObj, WebUtils.getLocale(request)))%>
<#include "../include/html_title_app_name.ftl">
<@spring.message code='select' /><@spring.message code='titleSeparator' />
${titleDisplayName?html}
</title>
</head>
<body style="height:100%;">
<%if(!ajaxRequest){%>
<#if !isAjaxRequest>
<div style="height:99%;">
<%}%>
</#if>
<div id="${pageId}" class="page-grid page-grid-spv">
<div class="head">
<div class="search">
<%@ include file="include/data_page_obj_searchform_html.jsp" %>
<#include "include/data_page_obj_searchform_html.ftl">
</div>
<div class="operation">
<input name="confirmButton" type="button" class="recommended" value="<fmt:message key='confirm' />" />
<input name="addButton" type="button" value="<fmt:message key='add' />" />
<input name="editButton" type="button" value="<fmt:message key='edit' />" />
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<input name="confirmButton" type="button" class="recommended" value="<@spring.message code='confirm' />" />
<input name="addButton" type="button" value="<@spring.message code='add' />" />
<input name="editButton" type="button" value="<@spring.message code='edit' />" />
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
</div>
</div>
<div class="content">
@ -65,20 +46,20 @@ else
</div>
</div>
</div>
<%if(!ajaxRequest){%>
<#if !isAjaxRequest>
</div>
<%}%>
<%@ include file="include/data_page_obj.jsp" %>
<%@ include file="include/data_page_obj_searchform_js.jsp" %>
<%@ include file="../include/page_obj_pagination.jsp" %>
<%@ include file="include/data_page_obj_grid.jsp" %>
</#if>
<#include "include/data_page_obj.ftl">
<#include "include/data_page_obj_searchform_js.ftl">
<#include "../include/page_obj_pagination.ftl">
<#include "include/data_page_obj_grid.ftl">
<script type="text/javascript">
(function(po)
{
po.data = $.unref(<%writeJson(application, out, data);%>);
po.propertyPath = "<%=WebUtils.escapeJavaScriptStringValue(propertyPath)%>";
po.isMultipleSelect = <%=isMultipleSelect%>;
po.conditionSource = <%writeJson(application, out, conditionSource);%>;
po.data = ($.unref(<@writeJson var=data />) || {});
po.propertyPath = "${propertyPath?js_string}";
po.isMultipleSelect = ${isMultipleSelect?c};
po.conditionSource = $.unref(<@writeJson var=conditionSource />);
$.initButtons(po.element(".operation"));

View File

@ -1,11 +1,4 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.DataController" %>
<%@ include file="../../include/page_js_obj.jsp" %>
<#include "../../include/page_js_obj.ftl">
<script type="text/javascript">
(function(po)
{
@ -100,7 +93,7 @@
var url;
if(ignoreDuplication)
url = po.url("", action, "<%=DataController.PARAM_IGNORE_DUPLICATION%>=true");
url = po.url("", action, "ignoreDuplication=true");
else
url = po.url(action);

View File

@ -0,0 +1,26 @@
<#--
编辑表格功能HTML片段。
-->
<#assign editGridFormPageId=(pageId +'_'+'egf')>
<div class="edit-grid">
<div class="edit-grid-switch-wrapper">
<label for="${pageId}-editGridSwitch"><@spring.message code='editGrid' /></label>
<input id="${pageId}-editGridSwitch" type="checkbox" value="1" />
</div>
<div class="edit-grid-operation">
<button type="button" class="edit-grid-button button-restore highlight" style="display: none;"><@spring.message code='restore' /></button>
<button type="button" class="edit-grid-button button-restore-all highlight" style="display: none;"><@spring.message code='restoreAll' /></button>
<button type="button" class="edit-grid-button button-save recommended" style="display: none;"><@spring.message code='save' /></button>
</div>
</div>
<div id="${editGridFormPageId}" class="page-edit-grid-form">
<div class="form-panel ui-widget ui-widget-content ui-corner-all ui-widget-shadow" tabindex="1">
<div class="form-panel-title form-panel-dragger ui-corner-all ui-widget-header">
<span class="close-icon ui-icon ui-icon-close"></span>
</div>
<form id="${editGridFormPageId}-form" method="POST" action="#">
</form>
<div class="form-panel-foot form-panel-dragger ui-widget-header">
</div>
</div>
</div>

View File

@ -1,38 +1,27 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page import="java.sql.NClob"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.util.WebUtils"%>
<%@ page import="org.datagear.web.convert.AbstractDataConverter" %>
<%--
<#--
编辑表格功能JS片段。
依赖:
page_js_obj.jsp
page_obj_grid.jsp
data_page_obj_edit_grid_html.jsp
page_js_obj.ftl
page_obj_grid.ftl
data_page_obj_edit_grid_html.ftl
变量:
--%>
<%
//在表格页面中内嵌一个用于编辑表格的表单页面,并使用它来构建单元格编辑面板,重用代码
String gridPageId = WebUtils.getPageId(request);
String editGridFormPageId = (String)request.getAttribute("editGridFormPageId");
WebUtils.setPageId(request, editGridFormPageId);
%>
<%@ include file="../include/data_page_obj.jsp" %>
<%@ include file="../include/data_page_obj_form.jsp" %>
-->
<#--在表格页面中内嵌一个用于编辑表格的表单页面,并使用它来构建单元格编辑面板,重用代码-->
<#assign gridPageId=pageId>
<#assign pageId=editGridFormPageId>
<#include "../include/data_page_obj.ftl">
<#include "../include/data_page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
//XXX 这里必须添加handle设置不然元素的按键、鼠标事件都会无效
po.element().draggable({ handle : po.element(".form-panel-dragger") });
po.element().hide();
po.formLabels.submit = "<fmt:message key='confirm' />";
po.formLabels.submit = "<@spring.message code='confirm' />";
//由后面设置
po.gridPage = undefined;
@ -161,16 +150,14 @@ WebUtils.setPageId(request, editGridFormPageId);
return actionParam;
}
})
(<%=editGridFormPageId%>);
(${pageId});
</script>
<%
WebUtils.setPageId(request, gridPageId);
%>
<#assign pageId=gridPageId>
<script type="text/javascript">
(function(po)
{
//内嵌的表单页面对象
po.editGridFormPage = <%=editGridFormPageId%>;
po.editGridFormPage = ${editGridFormPageId};
po.editGridFormPage.gridPage = po;
//编辑表格对应的模型会在initEditGrid函数中初始化
po.editGridModel = undefined;
@ -378,9 +365,9 @@ WebUtils.setPageId(request, gridPageId);
po.element(".ui-button", $headOperation).addClass("not-edit-grid-button");
var $buttonWrapper = $("<div class='edit-grid-button-wrapper' style='display:inline-block;' />").appendTo($headOperation);
$("<button name='editGridAddButton' class='edit-grid-button highlight'><fmt:message key='add' /></button>&nbsp;"
+"<button name='editGridEditButton' class='edit-grid-button highlight'><fmt:message key='edit' /></button>&nbsp;"
+"<button name='editGridDeleteButton' class='edit-grid-button highlight'><fmt:message key='delete' /></button>").appendTo($buttonWrapper);
$("<button name='editGridAddButton' class='edit-grid-button highlight'><@spring.message code='add' /></button>&nbsp;"
+"<button name='editGridEditButton' class='edit-grid-button highlight'><@spring.message code='edit' /></button>&nbsp;"
+"<button name='editGridDeleteButton' class='edit-grid-button highlight'><@spring.message code='delete' /></button>").appendTo($buttonWrapper);
$.initButtons($buttonWrapper);
@ -838,18 +825,18 @@ WebUtils.setPageId(request, gridPageId);
{
po.editGridFormPage.viewMultiplePropertyValue(property, propertyModel, propertyValue);
},
filePropertyUploadURL : "<c:url value='/data/file/upload' />",
filePropertyDeleteURL : "<c:url value='/data/file/delete' />",
filePropertyUploadURL : "${contextPath}/data/file/upload",
filePropertyDeleteURL : "${contextPath}/data/file/delete",
downloadSinglePropertyValueFile : function(property, propertyModel)
{
po.editGridFormPage.downloadSinglePropertyValueFile(property, propertyModel);
},
validationRequiredAsAdd : false,
labels : po.editGridFormPage.formLabels,
dateFormat : "<c:out value='${sqlDateFormat}' />",
timestampFormat : "<c:out value='${sqlTimestampFormat}' />",
timeFormat : "<c:out value='${sqlTimeFormat}' />",
filePropertyLabelValue : "<c:out value='${filePropertyLabelValue}' />"
dateFormat : "${sqlDateFormat}",
timestampFormat : "${sqlTimestampFormat}",
timeFormat : "${sqlTimeFormat}",
filePropertyLabelValue : "${filePropertyLabelValue}"
});
$formPage.position({ my : "left top", at : "left bottom", of : $editFormCell, within : $table});
@ -1091,7 +1078,8 @@ WebUtils.setPageId(request, gridPageId);
if(count >= confirmCount)
{
po.confirm("<fmt:message key='data.confirmRestoreEditCell'><fmt:param>"+count+"</fmt:param></fmt:message>",
<#assign messageArgs=['"+count+"'] />
po.confirm("<@spring.messageArgs code='data.confirmRestoreEditCell' args=messageArgs />",
{
"confirm" : function()
{
@ -1146,8 +1134,9 @@ WebUtils.setPageId(request, gridPageId);
if(count >= confirmCount)
{
var message = (isServerSide ? "<fmt:message key='data.confirmSaveEditCellServerSide'><fmt:param>"+count+"</fmt:param></fmt:message>"
: "<fmt:message key='data.confirmSaveEditCellClient'><fmt:param>"+count+"</fmt:param></fmt:message>");
<#assign messageArgs=['"+count+"'] />
var message = (isServerSide ? "<@spring.messageArgs code='data.confirmSaveEditCellServerSide' args=messageArgs />"
: "<@spring.messageArgs code='data.confirmSaveEditCellClient' args=messageArgs />");
po.confirm(message,
{
@ -1203,7 +1192,7 @@ WebUtils.setPageId(request, gridPageId);
//jquery会将null参数转化为空字符串某些情况时不合逻辑这里使用后台null转换占位值
if(updatePropertyValue == null)
updatePropertyValue = "<%=AbstractDataConverter.NULL_VALUE_PLACE_HOLDER%>";
updatePropertyValue = "___DATA_GEAR_ZY_NULL_VALUE_PLACE_HOLDER___";
updatePropertyIndexes.push(updatePropertyIndex);
updatePropertyNames.push(updatePropertyName);

View File

@ -1,46 +1,38 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%--
<#--
数据表单操作页面公用代码
依赖:
data_page_obj.jsp
jsp_method_get_string_value.jsp
data_page_obj.ftl
依赖变量:
//初始数据由主页面定义允许为null
po.data = undefined;
//初始表单数据是否是客户端数据
po.isClientPageData = undefined;
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.datagear.web.util.WebUtils"%>
<%@ include file="../../include/page_obj_form.jsp" %>
-->
<#include "../../include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
po.formLabels =
{
add : "<fmt:message key='add' />",
edit : "<fmt:message key='edit' />",
del : "<fmt:message key='delete' />",
view : "<fmt:message key='view' />",
select : "<fmt:message key='select' />",
add : "<@spring.message code='add' />",
edit : "<@spring.message code='edit' />",
del : "<@spring.message code='delete' />",
view : "<@spring.message code='view' />",
select : "<@spring.message code='select' />",
//如果页面参数里定义了提交回调函数则submit标签改为“确定”
submit : (po.pageParam("submit") ? "<fmt:message key='confirm' />" : "<fmt:message key='save' />"),
reset : "<fmt:message key='reset' />",
submit : (po.pageParam("submit") ? "<@spring.message code='confirm' />" : "<@spring.message code='save' />"),
reset : "<@spring.message code='reset' />",
batchSet :
{
batchSetSwitchTitle : "<fmt:message key='batchSet.batchSetSwitchTitle' />",
batchCount : "<fmt:message key='batchSet.batchCount' />",
batchHandleErrorMode : "<fmt:message key='batchSet.batchHandleErrorMode' />",
batchHandleErrorModeEnum : ["<fmt:message key='batchSet.batchHandleErrorMode.ignore' />", "<fmt:message key='batchSet.batchHandleErrorMode.abort' />", "<fmt:message key='batchSet.batchHandleErrorMode.rollback' />"]
batchSetSwitchTitle : "<@spring.message code='batchSet.batchSetSwitchTitle' />",
batchCount : "<@spring.message code='batchSet.batchCount' />",
batchHandleErrorMode : "<@spring.message code='batchSet.batchHandleErrorMode' />",
batchHandleErrorModeEnum : ["<@spring.message code='batchSet.batchHandleErrorMode.ignore' />", "<@spring.message code='batchSet.batchHandleErrorMode.abort' />", "<@spring.message code='batchSet.batchHandleErrorMode.rollback' />"]
},
validation :
{
required : "<fmt:message key='validation.required' />"
required : "<@spring.message code='validation.required' />"
}
};

View File

@ -1,15 +1,8 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.Types"%>
<%@ include file="../../include/page_obj_grid.jsp" %>
<#include "../../include/page_obj_grid.ftl">
<script type="text/javascript">
(function(po)
{
po.queryLeftClobLengthOnReading = <%=request.getAttribute("queryLeftClobLengthOnReading")%>;
po.queryLeftClobLengthOnReading = ${queryLeftClobLengthOnReading};
//单元基本属性值是否已完全获取如果不是单元基本属性也将返回true为了提高表格数据读取效率后台对CLOB类的属性值仅会读取前段
po.isSinglePrimitivePropertyValueFullyFetched = function(model, property, propertyValue)
@ -25,8 +18,8 @@
var propertyModelIndex = $.model.getPropertyModelIndexByValue(property, propertyValue);
var jdbcType = $.model.featureJdbcTypeValue(property, propertyModelIndex);
if(<%=Types.CLOB%> == jdbcType || <%=Types.NCLOB%> == jdbcType
|| <%=Types.LONGNVARCHAR%> == jdbcType || <%=Types.LONGVARCHAR%> == jdbcType)
if(${Types_CLOB} == jdbcType || ${Types_NCLOB} == jdbcType
|| ${Types_LONGNVARCHAR} == jdbcType || ${Types_LONGVARCHAR} == jdbcType)
re = (propertyValue.length < po.queryLeftClobLengthOnReading);
return re;

View File

@ -1,33 +1,27 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
<#--
查询表单HTML片段。
--%>
-->
<form id="${pageId}-searchForm" class="search-form" action="#" tabindex="0">
<div class="ui-widget ui-widget-content keyword-widget">
<span class="ui-icon like-switch-icon ui-icon-radio-off" title="<fmt:message key='data.likeTitle' />"></span><div class="keyword-input-parent"><input name="keyword" type="text" class="ui-widget ui-widget-content keyword-input" tabindex="2" /></div>
<span class="ui-icon like-switch-icon ui-icon-radio-off" title="<@spring.message code='data.likeTitle' />"></span><div class="keyword-input-parent"><input name="keyword" type="text" class="ui-widget ui-widget-content keyword-input" tabindex="2" /></div>
<input type="hidden" name="notLike" value="" />
</div>
<div class="search-condition-icon-parent" title="<fmt:message key='data.conditionPanelWithShortcut' />">
<div class="search-condition-icon-parent" title="<@spring.message code='data.conditionPanelWithShortcut' />">
<span class="ui-icon ui-icon-caret-1-s search-condition-icon"></span>
<span class="ui-icon ui-icon-bullet search-condition-icon-tip"></span>
</div>
<button type="submit" class="ui-button ui-corner-all ui-widget" tabindex="3"><fmt:message key='query' /></button>
<button type="submit" class="ui-button ui-corner-all ui-widget" tabindex="3"><@spring.message code='query' /></button>
<div class="condition-panel-parent">
<div class="ui-widget ui-widget-content ui-widget-shadow condition-panel" tabindex="0">
<div class="ui-corner-all ui-widget-header ui-helper-clearfix ui-draggable-handle condition-panel-title-bar">
<span class="ui-icon ui-icon-arrowthickstop-1-n condition-panel-resetpos-icon" title="<fmt:message key='restoration' />"></span>
<span class="ui-icon ui-icon-arrowthickstop-1-n condition-panel-resetpos-icon" title="<@spring.message code='restoration' />"></span>
</div>
<div class="condition-parent">
<textarea name="condition" tabindex="5" class="ui-widget ui-widget-content"></textarea>
</div>
<div class="condition-action">
<span class="ui-icon ui-icon-trash condition-panel-clear-icon" title="<fmt:message key='data.clearWithShortcut' />"></span>
<span class="ui-icon ui-icon-search condition-panel-submit-icon" title="<fmt:message key='data.queryWithShortcut' />"></span>
<span class="ui-icon ui-icon-trash condition-panel-clear-icon" title="<@spring.message code='data.clearWithShortcut' />"></span>
<span class="ui-icon ui-icon-search condition-panel-submit-icon" title="<@spring.message code='data.queryWithShortcut' />"></span>
</div>
</div>
</div>

View File

@ -1,22 +1,16 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
<#--
查询表单JS片段。
依赖:
data_page_obj.jsp
data_page_obj_searchform_html.jsp
data_page_obj.ftl
data_page_obj_searchform_html.ftl
变量:
//查询回调函数不允许为null格式为function(searchParam){}
po.search = undefined;
//查询条件autocomplete初始数据不允许为null
po.conditionAutocompleteSource = undefined;
--%>
-->
<script type="text/javascript">
(function(po)
{
@ -133,12 +127,12 @@ po.conditionAutocompleteSource = undefined;
if(notLike)
{
po.likeSwitchIcon().removeClass("ui-icon-radio-off").addClass("ui-icon-radio-on").attr("title", "<fmt:message key='data.notLikeTitle' />");
po.likeSwitchIcon().removeClass("ui-icon-radio-off").addClass("ui-icon-radio-on").attr("title", "<@spring.message code='data.notLikeTitle' />");
po.notLikeInput().val("1");
}
else
{
po.likeSwitchIcon().removeClass("ui-icon-radio-on").addClass("ui-icon-radio-off").attr("title", "<fmt:message key='data.likeTitle' />");
po.likeSwitchIcon().removeClass("ui-icon-radio-on").addClass("ui-icon-radio-off").attr("title", "<@spring.message code='data.likeTitle' />");
po.notLikeInput().val("");
}
};

View File

@ -1,86 +1,74 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.DriverEntityController" %>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//标题标签I18N关键字不允许null
String titleMessageKey = getStringValue(request, DriverEntityController.KEY_TITLE_MESSAGE_KEY);
//表单提交action允许为null
String formAction = getStringValue(request, DriverEntityController.KEY_FORM_ACTION, "#");
//是否只读操作允许为null
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntityController.KEY_READONLY)));
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
titleMessageKey 标题标签I18N关键字不允许null
formAction 表单提交action允许为null
readonly 是否只读操作允许为null
-->
<#assign formAction=(formAction!'#')>
<#assign readonly=(readonly!false)>
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='<%=titleMessageKey%>' /></title>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-driverEntity">
<form id="${pageId}-form" action="<%=request.getContextPath()%>/driverEntity/<%=formAction%>" method="POST">
<form id="${pageId}-form" action="${contextPath}/driverEntity/${formAction}" method="POST">
<div class="form-head"></div>
<div class="form-content">
<input type="hidden" name="id" value="<c:out value='${driverEntity.id}' />" />
<input type="hidden" name="id" value="${(driverEntity.id)!''?html}" />
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='driverEntity.displayName' /></label>
<label><@spring.message code='driverEntity.displayName' /></label>
</div>
<div class="form-item-value">
<input type="text" name="displayName" value="<c:out value='${driverEntity.displayName}' />" class="ui-widget ui-widget-content" />
<input type="text" name="displayName" value="${(driverEntity.displayName)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='driverEntity.driverClassName' /></label>
<label><@spring.message code='driverEntity.driverClassName' /></label>
</div>
<div class="form-item-value">
<input type="text" name="driverClassName" value="<c:out value='${driverEntity.driverClassName}' />" class="ui-widget ui-widget-content" />
<input type="text" name="driverClassName" value="${(driverEntity.driverClassName)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='driverEntity.displayDesc' /></label>
<label><@spring.message code='driverEntity.displayDesc' /></label>
</div>
<div class="form-item-value">
<textarea name="displayDesc" class="ui-widget ui-widget-content"><c:out value='${driverEntity.displayDescMore}' /></textarea>
<textarea name="displayDesc" class="ui-widget ui-widget-content">${(driverEntity.displayDescMore)!''?html}</textarea>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='driverEntity.driverFiles' /></label>
<label><@spring.message code='driverEntity.driverFiles' /></label>
</div>
<div class="form-item-value">
<div class="ui-widget ui-widget-content input driver-files">
</div>
<%if(!readonly){%>
<#if !readonly>
<div class="driver-upload-parent">
<div class="ui-widget ui-corner-all ui-button fileinput-button"><fmt:message key='upload' /><input type="file"></div>
<div class="ui-widget ui-corner-all ui-button fileinput-button"><@spring.message code='upload' /><input type="file"></div>
<div class="file-info"></div>
</div>
<%}%>
</#if>
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<%if(!readonly){%>
<input type="submit" value="<fmt:message key='save' />" class="recommended" />
<#if !readonly>
<input type="submit" value="<@spring.message code='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
<%}%>
<input type="reset" value="<@spring.message code='reset' />" />
</#if>
</div>
</form>
</div>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_form.jsp" %>
<#include "../include/page_js_obj.ftl" >
<#include "../include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
@ -91,7 +79,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
po.url = function(action)
{
return contextPath + "/driverEntity/" + action;
return "${contextPath}/driverEntity/" + action;
};
po.getDriverEntityId = function()
@ -108,16 +96,16 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
var $fileInfo = $("<div class='ui-widget ui-widget-content ui-corner-all driver-file' />")
.appendTo(po.driverFiles());
<%if(!readonly){%>
<#if !readonly>
$("<input type='hidden' />").attr("name", "driverLibraryName").attr("value", fileInfos[i].name).appendTo($fileInfo);
var $deleteIcon = $("<span class='ui-icon ui-icon-close driver-file-icon' title='<fmt:message key='delete' />' />")
var $deleteIcon = $("<span class='ui-icon ui-icon-close driver-file-icon' title='<@spring.message code='delete' />' />")
.attr("driverFile", fileInfos[i].name).appendTo($fileInfo);
$deleteIcon.click(function()
{
var driverFile = $(this).attr("driverFile");
po.confirm("<fmt:message key='driverEntity.confirmDeleteDriverFile' />",
po.confirm("<@spring.message code='driverEntity.confirmDeleteDriverFile' />",
{
"confirm" : function()
{
@ -129,7 +117,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
}
});
});
<%}%>
</#if>
$("<a class='driver-file-info' href='javascript:void(0);' />").attr("title", fileInfos[i].name).text(fileInfos[i].name)
.appendTo($fileInfo)
@ -159,8 +147,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
}
};
<%if(!readonly){%>
<#if !readonly>
po.element(".fileinput-button").fileupload(
{
url : po.url("uploadDriverFile"),
@ -171,7 +158,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
po.renderDriverFiles(serverFileInfos);
$.tipSuccess("<fmt:message key='uploadSuccess' />");
$.tipSuccess("<@spring.message code='uploadSuccess' />");
}
})
.bind('fileuploadadd', function (e, data)
@ -192,8 +179,8 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
},
messages :
{
displayName : "<fmt:message key='validation.required' />",
driverClassName : "<fmt:message key='validation.required' />"
displayName : "<@spring.message code='validation.required' />",
driverClassName : "<@spring.message code='validation.required' />"
},
submitHandler : function(form)
{
@ -213,11 +200,11 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntity
error.appendTo(element.closest(".form-item-value"));
}
});
<%}%>
</#if>
<%if(!"saveAdd".equals(formAction)){%>
<#if formAction != 'saveAdd'>
po.refreshDriverFiles();
<%}%>
</#if>
})
(${pageId});
</script>

View File

@ -1,48 +1,36 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.DriverEntityController" %>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//标题标签I18N关键字不允许null
String titleMessageKey = getStringValue(request, DriverEntityController.KEY_TITLE_MESSAGE_KEY);
//是否选择操作允许为null
boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEntityController.KEY_SELECTONLY)));
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
titleMessageKey 标题标签I18N关键字不允许null
selectonly 是否选择操作允许为null
-->
<#assign selectonly=(selectonly!false)>
<html style="height:100%;">
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='<%=titleMessageKey%>' /></title>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
</head>
<body style="height:100%;">
<%if(!ajaxRequest){%>
<#if !isAjaxRequest>
<div style="height:99%;">
<%}%>
</#if>
<div id="${pageId}" class="page-grid page-grid-hidden-foot page-grid-driverEntity">
<div class="head">
<div class="search">
<%@ include file="../include/page_obj_searchform.html.jsp" %>
<#include "../include/page_obj_searchform.html.ftl">
</div>
<div class="operation">
<%if(selectonly){%>
<input name="confirmButton" type="button" class="recommended" value="<fmt:message key='confirm' />" />
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<%}else{%>
<input name="importButton" type="button" value="<fmt:message key='import' />" />
<input name="exportButton" type="button" value="<fmt:message key='export' />" />
<input name="addButton" type="button" value="<fmt:message key='add' />" />
<input name="editButton" type="button" value="<fmt:message key='edit' />" />
<input name="viewButton" type="button" value="<fmt:message key='view' />" />
<input name="deleteButton" type="button" value="<fmt:message key='delete' />" />
<%}%>
<#if selectonly>
<input name="confirmButton" type="button" class="recommended" value="<@spring.message code='confirm' />" />
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<#else>
<input name="importButton" type="button" value="<@spring.message code='import' />" />
<input name="exportButton" type="button" value="<@spring.message code='export' />" />
<input name="addButton" type="button" value="<@spring.message code='add' />" />
<input name="editButton" type="button" value="<@spring.message code='edit' />" />
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<input name="deleteButton" type="button" value="<@spring.message code='delete' />" />
</#if>
</div>
</div>
<div class="content">
@ -55,12 +43,12 @@ boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEnti
</div>
</div>
</div>
<%if(!ajaxRequest){%>
<#if !isAjaxRequest>
</div>
<%}%>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_searchform_js.jsp" %>
<%@ include file="../include/page_obj_grid.jsp" %>
</#if>
<#include "../include/page_js_obj.ftl">
<#include "../include/page_obj_searchform_js.ftl">
<#include "../include/page_obj_grid.ftl">
<script type="text/javascript">
(function(po)
{
@ -68,10 +56,10 @@ boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEnti
po.url = function(action)
{
return contextPath + "/driverEntity/" + action;
return "${contextPath}/driverEntity/" + action;
};
<%if(!selectonly){%>
<#if !selectonly>
po.element("input[name=addButton]").click(function()
{
po.open(po.url("add"),
@ -129,7 +117,7 @@ boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEnti
});
});
});
<%}%>
</#if>
po.element("input[name=viewButton]").click(function()
{
@ -144,13 +132,13 @@ boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEnti
});
});
<%if(!selectonly){%>
<#if !selectonly>
po.element("input[name=deleteButton]").click(
function()
{
po.executeOnSelects(function(rows)
{
po.confirm("<fmt:message key='driverEntity.confirmDelete' />",
po.confirm("<@spring.message code='driverEntity.confirmDelete' />",
{
"confirm" : function()
{
@ -164,7 +152,7 @@ boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEnti
});
});
});
<%}%>
</#if>
po.element("input[name=confirmButton]").click(function()
{
@ -199,10 +187,10 @@ boolean selectonly = ("true".equalsIgnoreCase(getStringValue(request, DriverEnti
};
var tableColumns = [
po.buildTableColumValueOption("<fmt:message key='driverEntity.id' />", "id", true),
po.buildTableColumValueOption("<fmt:message key='driverEntity.displayName' />", "displayName"),
po.buildTableColumValueOption("<fmt:message key='driverEntity.driverClassName' />", "driverClassName"),
po.buildTableColumValueOption("<fmt:message key='driverEntity.displayDesc' />", "displayDescMore"),
po.buildTableColumValueOption("<@spring.message code='driverEntity.id' />", "id", true),
po.buildTableColumValueOption("<@spring.message code='driverEntity.displayName' />", "displayName"),
po.buildTableColumValueOption("<@spring.message code='driverEntity.driverClassName' />", "driverClassName"),
po.buildTableColumValueOption("<@spring.message code='driverEntity.displayDesc' />", "displayDescMore"),
po.buildTableColumValueOption("", "displayText", true)
];
var tableSettings = po.buildDataTableSettingsAjax(tableColumns, po.url("queryData"));

View File

@ -1,41 +1,30 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.DriverEntityController" %>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='driverEntity.importDriverEntity' /></title>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='driverEntity.importDriverEntity' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-driverEntityImport">
<form id="${pageId}-form" action="<%=request.getContextPath()%>/driverEntity/saveImport" method="POST">
<form id="${pageId}-form" action="${contextPath}/driverEntity/saveImport" method="POST">
<div class="form-head"></div>
<div class="form-content">
<input type="hidden" name="importId" value="<c:out value='${importId}' />" />
<input type="hidden" name="importId" value="${importId?html}" />
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='driverEntity.import.selectFile' /></label>
<label><@spring.message code='driverEntity.import.selectFile' /></label>
</div>
<div class="form-item-value">
<div class="driver-import-parent">
<div class="fileinput-button"><fmt:message key='select' /><input type="file" accept=".zip" class="ignore"></div>
<div class="fileinput-button"><@spring.message code='select' /><input type="file" accept=".zip" class="ignore"></div>
<div class="file-info"></div>
</div>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='driverEntity.import.review' /></label>
<label><@spring.message code='driverEntity.import.review' /></label>
</div>
<div class="form-item-value">
<input type="hidden" name="inputForValidate" value="" />
@ -44,12 +33,12 @@
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" value="<fmt:message key='import' />" class="recommended" />
<input type="submit" value="<@spring.message code='import' />" class="recommended" />
</div>
</form>
</div>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_form.jsp" %>
<#include "../include/page_js_obj.ftl" >
<#include "../include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
@ -61,7 +50,7 @@
po.url = function(action)
{
return contextPath + "/driverEntity/" + action;
return "${contextPath}/driverEntity/" + action;
};
po.renderDriverEntityInfos = function(driverEntities)
@ -80,7 +69,7 @@
$("<input type='hidden' />").attr("name", "driverEntity.displayName").attr("value", driverEntity.displayName).appendTo($item);
$("<input type='hidden' />").attr("name", "driverEntity.displayDesc").attr("value", driverEntity.displayDesc).appendTo($item);
$("<span class='ui-icon ui-icon-close' title='<fmt:message key='delete' />' />")
$("<span class='ui-icon ui-icon-close' title='<@spring.message code='delete' />' />")
.appendTo($item).click(function()
{
$(this).closest(".driver-entity-item").remove();
@ -129,7 +118,7 @@
},
messages :
{
inputForValidate : "<fmt:message key='driverEntity.import.importDriverEntityRequired' />"
inputForValidate : "<@spring.message code='driverEntity.import.importDriverEntityRequired' />"
},
submitHandler : function(form)
{

View File

@ -0,0 +1,47 @@
<#include "include/import_global.ftl">
<#if isJsonResponse??>
<@writeJson var=operationMessage />
<#else>
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='error.errorOccure' /></title>
</head>
<body>
<#if isAjaxRequest>
<div class="operation-message ${operationMessage.type}">
<div class="message">
${operationMessage.message}
</div>
<#if (operationMessage.detail)??>
<div class="message-detail">
<pre>${operationMessage.detail}</pre>
</div>
</#if>
</div>
<#else>
<div>
<div class="main-page-head">
<#include "include/html_logo.ftl">
<div class="toolbar">
<a class="link" href="${contextPath}/"><@spring.message code='backToMainPage' /></a>
</div>
</div>
<div class="page-error">
<div class="operation-message ${operationMessage.type}">
<div class="message">
${operationMessage.message}
</div>
<#if (operationMessage.detail)??>
<div class="message-detail">
<pre>${operationMessage.detail}</pre>
</div>
</#if>
</div>
</div>
</div>
</#if>
</body>
</html>
</#if>

View File

@ -0,0 +1,178 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='globalSetting.smtpSetting' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-globalSetting">
<form id="${pageId}-form" action="${contextPath}/globalSetting/save" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='globalSetting.smtpSetting.host' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.host" value="${globalSetting.smtpSetting.host?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='globalSetting.smtpSetting.port' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.port" value="${globalSetting.smtpSetting.port?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='globalSetting.smtpSetting.username' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.username" value="${globalSetting.smtpSetting.username?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='globalSetting.smtpSetting.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="smtpSetting.password" value="${globalSetting.smtpSetting.password?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='globalSetting.smtpSetting.connectionType' /></label>
</div>
<div class="form-item-value">
<select name="smtpSetting.connectionType">
<option value="${connectionTypePlain}"><@spring.message code='globalSetting.smtpSetting.connectionType.PLAIN' /></option>
<option value="${connectionTypeSsl}"><@spring.message code='globalSetting.smtpSetting.connectionType.SSL' /></option>
<option value="${connectionTypeTls}"><@spring.message code='globalSetting.smtpSetting.connectionType.TLS' /></option>
</select>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='globalSetting.smtpSetting.systemEmail' /></label>
</div>
<div class="form-item-value">
<input type="text" name="smtpSetting.systemEmail" value="${globalSetting.smtpSetting.systemEmail?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item" style="height:3em;">
<div class="form-item-label">
<label>&nbsp;</label>
</div>
<div class="form-item-value">
<button type="button" id="testSmtpButton"><@spring.message code='globalSetting.testSmtp' /></button>
&nbsp;&nbsp;
<span id="testSmtpPanel" style="display: none;">
<@spring.message code='globalSetting.testSmtp.recevierEmail' />&nbsp;
<input type="text" name="testSmtpRecevierEmail" value="" class="ui-widget ui-widget-content" />
<button type="button" id="testSmtpSendButton" style="vertical-align:baseline;"><@spring.message code='globalSetting.testSmtp.send' /></button>
</span>
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" value="<@spring.message code='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<@spring.message code='reset' />" />
</div>
</form>
</div>
<#include "include/page_js_obj.ftl" >
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element());
po.testSmtpRecevierEmailInput = function(){ return this.element("input[name='testSmtpRecevierEmail']"); };
po.smtpSettingConnectionTypeSelect = function(){ return this.element("select[name='smtpSetting.connectionType']"); };
po.testSmtpUrl = "${contextPath}/globalSetting/testSmtp";
po.smtpSettingConnectionTypeSelect().val("${globalSetting.smtpSetting.connectionType?j_string}");
po.smtpSettingConnectionTypeSelect().selectmenu(
{
"classes" : { "ui-selectmenu-button" : "global-setting-select" }
});
po.element("#testSmtpButton").click(function()
{
po.element("#testSmtpPanel").toggle();
});
po.element("#testSmtpSendButton").click(function()
{
var _this= $(this);
var form = po.form();
var initAction = form.attr("action");
form.attr("action", po.testSmtpUrl);
po.testSmtpRecevierEmailInput().rules("add",
{
"required" : true,
"email" : true,
messages : {"required" : "<@spring.message code='validation.required' />", "email" : "<@spring.message code='validation.email' />"}
});
form.submit();
form.attr("action", initAction);
po.testSmtpRecevierEmailInput().rules("remove");
});
po.form().validate(
{
rules :
{
"smtpSetting.host" : "required",
"smtpSetting.port" : {"required" : true, "integer" : true},
"smtpSetting.systemEmail" : {"required" : true, "email" : true}
},
messages :
{
"smtpSetting.host" : "<@spring.message code='validation.required' />",
"smtpSetting.port" : {"required" : "<@spring.message code='validation.required' />", "integer" : "<@spring.message code='validation.integer' />"},
"smtpSetting.systemEmail" : {"required" : "<@spring.message code='validation.required' />", "email" : "<@spring.message code='validation.email' />"}
},
submitHandler : function(form)
{
var $form = $(form);
var isTestSmtp = (po.testSmtpUrl == $form.attr("action"));
if(isTestSmtp)
po.element("#testSmtpSendButton").button("disable");
$(form).ajaxSubmit(
{
success : function(response)
{
var close = (po.pageParamCall("afterSave") != false);
if(close)
po.close();
},
complete : function()
{
if(isTestSmtp)
po.element("#testSmtpSendButton").button("enable");
}
});
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
})
(${pageId});
</script>
</body>
</html>

View File

@ -0,0 +1 @@
<#if !isAjaxRequest><!DOCTYPE html></#if>

View File

@ -0,0 +1,38 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="数据齿轮DataGear是一款数据库管理系统使用Java语言开发采用浏览器/服务器架构,以数据管理为核心功能,支持多种数据库。它的数据模型并不是原始的数据库表,而是融合了数据库表及表间关系,更偏向于领域模型的数据模型,能够更友好、方便、快速地查询和维护数据" />
<meta name="keywords" content="数据齿轮, Data Gear, 数据, data, 数据库, database, 数据管理 , data management, 数据库管理, database management, 浏览器/服务器, B/S" />
<#if !isAjaxRequest>
<script type="text/javascript">
var contextPath="${contextPath}";
</script>
<link id="css_jquery_ui" href="${contextPath}/static/theme/<@spring.theme code='theme' />/jquery-ui-1.12.1/jquery-ui.css" type="text/css" rel="stylesheet" />
<link id="css_jquery_ui_theme" href="${contextPath}/static/theme/<@spring.theme code='theme' />/jquery-ui-1.12.1/jquery-ui.theme.css" type="text/css" rel="stylesheet" />
<link href="${contextPath}/static/theme/jquery.layout-1.4.0/jquery.layout.css" type="text/css" rel="stylesheet" />
<link href="${contextPath}/static/theme/jstree-3.3.7/style.css" type="text/css" rel="stylesheet" />
<link href="${contextPath}/static/theme/DataTables-1.10.18/datatables.min.css" type="text/css" rel="stylesheet" />
<link href="${contextPath}/static/theme/jQuery-File-Upload-9.21.0/jquery.fileupload.css" type="text/css" rel="stylesheet" />
<link href="${contextPath}/static/theme/datagear-pagination.css" type="text/css" rel="stylesheet" />
<link href="${contextPath}/static/theme/common.css" type="text/css" rel="stylesheet" />
<link id="css_common" href="${contextPath}/static/theme/<@spring.theme code='theme' />/common.css" type="text/css" rel="stylesheet" />
<script src="${contextPath}/static/script/jquery/jquery-1.12.4.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery-ui-1.12.1/jquery-ui.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery.layout-1.4.0/jquery.layout.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jstree-3.3.7/jstree.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/DataTables-1.10.18/datatables.min.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery.form-3.51.0/jquery.form.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jQuery-File-Upload-9.21.0/jquery.iframe-transport.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jQuery-File-Upload-9.21.0/jquery.fileupload.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery.cookie-1.4.1/jquery.cookie.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery-validation-1.17.0/jquery.validate.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery-validation-1.17.0/additional-methods.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/textarea-helper-0.3.1/textarea-helper.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/jquery.actual-1.0.19/jquery.actual.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-pagination.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-model.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-modelcache.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-util.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-jquery-override.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-modelform.js" type="text/javascript"></script>
<script src="${contextPath}/static/script/datagear-schema-url-builder.js" type="text/javascript"></script>
</#if>

View File

@ -0,0 +1,3 @@
<div class="logo">
<div class="logo-content"><@spring.message code="app.name" /></div>
</div>

View File

@ -0,0 +1 @@
<#if !isAjaxRequest><@spring.message code='app.name' /> - </#if>

View File

@ -0,0 +1 @@
<#import "/spring.ftl" as spring />

View File

@ -1,16 +1,9 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.util.WebUtils" %>
<%--页面JS对象块 --%>
<#--页面JS对象块 -->
<script type="text/javascript">
var ${pageId} =
{
//父页面对象ID
parentPageId : "<%=WebUtils.getParentPageId(request)%>",
parentPageId : "${parentPageId}",
//当前页面ID
pageId : "${pageId}",
@ -60,7 +53,7 @@ var ${pageId} =
*/
open : function(url, options)
{
url = $.addParam(url, "<%=WebUtils.KEY_PARENT_PAGE_ID%>", this.pageId);
url = $.addParam(url, "parentPageId", this.pageId);
options = (options || {});
@ -152,7 +145,7 @@ var ${pageId} =
confirm : function(content, options)
{
options = (options || {});
options = $.extend({}, options, {confirmText : "<fmt:message key='confirm' />", cancelText : "<fmt:message key='cancel' />", title : "<fmt:message key='operationConfirm' />"});
options = $.extend({}, options, {confirmText : "<@spring.message code='confirm' />", cancelText : "<@spring.message code='cancel' />", title : "<@spring.message code='operationConfirm' />"});
$.confirm(content, options);
}
};

View File

@ -0,0 +1,16 @@
<#--
表单页面JS片段。
依赖:
page_js_obj.jsp
-->
<script type="text/javascript">
(function(po)
{
po.form = function()
{
return this.element("#${pageId}-form");
};
})
(${pageId});
</script>

View File

@ -1,15 +1,9 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
<#--
表格JS片段。
依赖:
page_js_obj.jsp
--%>
-->
<script type="text/javascript">
(function(po)
{
@ -181,7 +175,7 @@ page_js_obj.jsp
{
var newColumns = [
{
title : "<fmt:message key='select' />", data : po.TABLE_CHECK_COLUMN_PROPERTY_NAME, defaultContent: "", width : "3em",
title : "<@spring.message code='select' />", data : po.TABLE_CHECK_COLUMN_PROPERTY_NAME, defaultContent: "", width : "3em",
orderable : false, render : po.renderCheckColumn, className : "column-check"
}
];
@ -199,8 +193,8 @@ page_js_obj.jsp
"fixedColumns": { leftColumns: 1 },
"language":
{
"emptyTable": "<fmt:message key='dataTables.noData' />",
"zeroRecords" : "<fmt:message key='dataTables.zeroRecords' />"
"emptyTable": "<@spring.message code='dataTables.noData' />",
"zeroRecords" : "<@spring.message code='dataTables.zeroRecords' />"
},
"createdRow": function(row, data, dataIndex)
{
@ -382,7 +376,7 @@ page_js_obj.jsp
var rowsData = po.getRowsData(rows);
if(!rowsData || rowsData.length != 1)
$.tipInfo("<fmt:message key='pleaseSelectOnlyOneRow' />");
$.tipInfo("<@spring.message code='pleaseSelectOnlyOneRow' />");
else
{
callback.call(po, rowsData[0], po.getRowsIndex(rows)[0]);
@ -396,7 +390,7 @@ page_js_obj.jsp
var rowsData = po.getRowsData(rows);
if(!rowsData || rowsData.length < 1)
$.tipInfo("<fmt:message key='pleaseSelectAtLeastOneRow' />");
$.tipInfo("<@spring.message code='pleaseSelectAtLeastOneRow' />");
else
{
callback.call(po, rowsData, po.getRowsIndex(rows));

View File

@ -1,10 +1,4 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
<#--
分页片段。
依赖:
@ -13,7 +7,7 @@ data_page_obj.jsp
变量:
//分页回调函数不允许为null格式为function(pagingParam){}
po.paging = undefined;
--%>
-->
<script type="text/javascript">
(function(po)
{
@ -34,10 +28,10 @@ po.paging = undefined;
{
po.pagination().pagination(
{
pageSizeSetLabel : "<fmt:message key='confirm' />",
toPageLabel : "<fmt:message key='jumpto' />",
pageSizeCookie: "<%=org.datagear.web.util.WebUtils.COOKIE_PAGINATION_SIZE%>",
pageSizeCookiePath: "<%=request.getContextPath()%>/",
pageSizeSetLabel : "<@spring.message code='confirm' />",
toPageLabel : "<@spring.message code='jumpto' />",
pageSizeCookie: "PAGINATION_PAGE_SIZE",
pageSizeCookiePath: "${contextPath}/",
update: function(page, pageSize, total)
{
var pagingParam =

View File

@ -1,17 +1,11 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
<#--
查询表单HTML片段。
--%>
-->
<form id="${pageId}-searchForm" class="search-form" action="#">
<div class="ui-widget ui-widget-content keyword-widget simple">
<div class="keyword-input-parent">
<input name="keyword" type="text" class="ui-widget ui-widget-content keyword-input" />
</div>
</div>
<input name="submit" type="submit" value="<fmt:message key='query' />" />
<input name="submit" type="submit" value="<@spring.message code='query' />" />
</form>

View File

@ -1,20 +1,14 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%--
<#--
查询表单JS片段。
依赖:
page_js_obj.jsp
page_obj_searchform_html.jsp
page_js_obj.ftl
page_obj_searchform_html.ftl
变量:
//查询回调函数不允许为null格式为function(searchParam){}
po.search = undefined;
--%>
-->
<script type="text/javascript">
(function(po)
{

View File

@ -0,0 +1,102 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='login.login' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head">
<#include "include/html_logo.ftl">
<div class="toolbar">
<#if !disableRegister>
<a class="link" href="${contextPath}/register"><@spring.message code='register.register' /></a>
</#if>
<a class="link" href="${contextPath}/"><@spring.message code='backToMainPage' /></a>
</div>
</div>
<div class="page-form page-form-login">
<form id="${pageId}-form" action="${contextPath}/login/doLogin" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='login.username' /></label>
</div>
<div class="form-item-value">
<input type="text" name="name" value="${loginUser}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='login.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" class="recommended" value="<@spring.message code='login.login' />" />
&nbsp;&nbsp;
<input type="reset" value="<@spring.message code='reset' />" />
</div>
<div class="form-foot small-text" style="text-align:right;">
<label for="auto-login-checkbox"><@spring.message code='login.autoLogin' /></label>
<input type="checkbox" id="auto-login-checkbox" name="autoLogin" value="1" />
<a class="link" href="${contextPath}/resetPassword"><@spring.message code='login.fogetPassword' /></a>
</div>
</form>
</div>
</div>
<#include "include/page_js_obj.ftl">
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
//需要先渲染按钮,不然对话框尺寸不合适,出现滚动条
$.initButtons(po.element());
$("input[name=autoLogin]", po.element()).checkboxradio({icon:true});
var dialog=po.element(".page-form").dialog({
appendTo: po.element(),
title: "<@spring.message code='login.login' />",
position: {my : "center top", at : "center top+75"},
resizable: false,
draggable: true,
width: "41%",
beforeClose: function(){ return false; }
});
po.form().validate(
{
rules :
{
name : "required",
password : "required"
},
messages :
{
name : "<@spring.message code='validation.required' />",
password : "<@spring.message code='validation.required' />"
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
$(".ui-dialog .ui-dialog-titlebar-close", dialog.widget).hide();
<#if authenticationFailed>
$(document).ready(function()
{
$.tipError("<@spring.message code='login.userNameOrPasswordError' />");
});
</#if>
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,31 +1,21 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><fmt:message key='app.name' /></title>
<%@ include file="include/page_js_obj.jsp" %>
<#include "include/html_head.ftl">
<title><@spring.message code='app.name' /></title>
<#include "include/page_js_obj.ftl" >
<script type="text/javascript">
(function(po)
{
<%org.datagear.management.domain.User user = WebUtils.getUser(request, response);%>
po.userId = "<%=user.getId()%>";
po.isAnonymous = <%=user.isAnonymous()%>;
po.isAdmin = <%=user.isAdmin()%>;
po.userId = "${currentUser.id?js_string}";
po.isAnonymous = ${currentUser.anonymous?c};
po.isAdmin = ${currentUser.admin?c};
po.workTabTemplate = "<li style='vertical-align:middle;'><a href='"+'#'+"{href}'>"+'#'+"{label}</a>"
+"<div class='tab-operation'>"
+"<span class='ui-icon ui-icon-close' title='<fmt:message key='close' />'>close</span>"
+"<div class='tab-operation-more' title='<fmt:message key='moreOperation' />'></div>"
+"<span class='ui-icon ui-icon-close' title='<@spring.message code='close' />'>close</span>"
+"<div class='tab-operation-more' title='<@spring.message code='moreOperation' />'></div>"
+"</div>"
+"<div class='category-bar category-bar-"+'#'+"{schemaId}'></div>"
+"</li>";
@ -49,7 +39,7 @@
}
else
{
var tooltipId = $.tipInfo("<fmt:message key='loading' />", -1);
var tooltipId = $.tipInfo("<@spring.message code='loading' />", -1);
$.ajax(
{
url : contextPath + $.toPath("data", schemaId, tableName, "query"),
@ -68,10 +58,10 @@
if(!li.attr("id"))
li.attr("id", $.uid("main-tab-"));
var lititle = (po.isTableView(tableInfo) ? "<fmt:message key='main.tableType.view' />" : "<fmt:message key='main.tableType.table' />") + "<fmt:message key='colon' />" +tableName;
var lititle = (po.isTableView(tableInfo) ? "<@spring.message code='main.tableType.view' />" : "<@spring.message code='main.tableType.table' />") + "<@spring.message code='colon' />" +tableName;
if(tableInfo.comment)
lititle += "<fmt:message key='bracketLeft' />" + tableInfo.comment + "<fmt:message key='bracketRight' />";
lititle += "<fmt:message key='bracketLeft' />" + schemaTitle + "<fmt:message key='bracketRight' />";
lititle += "<@spring.message code='bracketLeft' />" + tableInfo.comment + "<@spring.message code='bracketRight' />";
lititle += "<@spring.message code='bracketLeft' />" + schemaTitle + "<@spring.message code='bracketRight' />";
li.attr("schema-id", schemaId);
li.attr("table-name", tableName);
@ -179,11 +169,11 @@
var tempSchema = (schema.createUser && schema.createUser.anonymous);
if(tempSchema)
schema.text += " <span class='ui-icon ui-icon-notice' title='<fmt:message key='main.tempSchema' />'></span>";
schema.text += " <span class='ui-icon ui-icon-notice' title='<@spring.message code='main.tempSchema' />'></span>";
else
{
if(schema.createUser && po.userId != schema.createUser.id && schema.createUser.nameLabel)
schema.text += " <span class='schema-tree-create-user-label small-text ui-state-disabled' title='<fmt:message key='main.schemaCreateUser' />'>" + $.escapeHtml(schema.createUser.nameLabel) + "</span>";
schema.text += " <span class='schema-tree-create-user-label small-text ui-state-disabled' title='<@spring.message code='main.schemaCreateUser' />'>" + $.escapeHtml(schema.createUser.nameLabel) + "</span>";
}
schema.children = true;
@ -221,10 +211,10 @@
var licss = (po.isTableView(table) ? "view-node" : "table-node");
table.li_attr = { "class" : licss };
var atitle = (po.isTableView(table) ? "<fmt:message key='main.tableType.view' />" : "<fmt:message key='main.tableType.table' />")
+"<fmt:message key='colon' />" + table.name;
var atitle = (po.isTableView(table) ? "<@spring.message code='main.tableType.view' />" : "<@spring.message code='main.tableType.table' />")
+"<@spring.message code='colon' />" + table.name;
if(table.comment)
atitle += "<fmt:message key='bracketLeft' />" + table.comment + "<fmt:message key='bracketRight' />";
atitle += "<@spring.message code='bracketLeft' />" + table.comment + "<@spring.message code='bracketRight' />";
table.a_attr = { "title" : atitle};
@ -246,7 +236,7 @@
var nextPageNode =
{
"text" : "<span class='more-table'><fmt:message key='main.moreTable'><fmt:param>"+showCount+"</fmt:param><fmt:param>"+pagingData.total+"</fmt:param></fmt:message></span>",
"text" : "<span class='more-table'><#assign messageArgs=['"+showCount+"','"+pagingData.total+"']><@spring.messageArgs code='main.moreTable' args=messageArgs /></span>",
"children" : false,
"li_attr" : { "class" : "next-page-node" },
"nextPageInfo" :
@ -431,9 +421,9 @@
var $icon = $(".ui-icon", this);
if($icon.hasClass("ui-icon-document"))
$icon.removeClass("ui-icon-document").addClass("ui-icon-folder-collapsed").attr("title", "<fmt:message key='main.searchSchema' />");
$icon.removeClass("ui-icon-document").addClass("ui-icon-folder-collapsed").attr("title", "<@spring.message code='main.searchSchema' />");
else
$icon.removeClass("ui-icon-folder-collapsed").addClass("ui-icon-document").attr("title", "<fmt:message key='main.searchTable' />");
$icon.removeClass("ui-icon-folder-collapsed").addClass("ui-icon-document").attr("title", "<@spring.message code='main.searchTable' />");
});
po.element("#schemaOperationMenu").menu(
@ -563,7 +553,7 @@
{
if(selNodes.length != 1)
{
$.tipInfo("<fmt:message key='pleaseSelectOnlyOneRow' />");
$.tipInfo("<@spring.message code='pleaseSelectOnlyOneRow' />");
return;
}
@ -590,7 +580,7 @@
if(!selNodes.length)
return;
po.confirm("<fmt:message key='main.confirmDeleteSchema' />",
po.confirm("<@spring.message code='main.confirmDeleteSchema' />",
{
"confirm" : function()
{
@ -623,7 +613,7 @@
{
if(selNodes.length != 1)
{
$.tipInfo("<fmt:message key='pleaseSelectOnlyOneRow' />");
$.tipInfo("<@spring.message code='pleaseSelectOnlyOneRow' />");
}
else
{
@ -639,7 +629,7 @@
{
beforeSend : function beforeSend(XHR)
{
tooltipId = $.tipInfo("<fmt:message key='loading' />", -1);
tooltipId = $.tipInfo("<@spring.message code='loading' />", -1);
},
success : function(model)
{
@ -779,7 +769,7 @@
var schemaId = schemaNode.id;
var $moreTableNode = tree.get_node(data.node, true);
$(".more-table", $moreTableNode).html("<fmt:message key='main.loadingTable' />");
$(".more-table", $moreTableNode).html("<@spring.message code='main.loadingTable' />");
var param = po.getSearchSchemaFormDataForTable();
param = $.extend({}, data.node.original.nextPageInfo, param);
@ -802,7 +792,7 @@
error : function(XMLHttpResponse, textStatus, errorThrown)
{
data.node.state.loadingNextPage = false;
$(".more-table", $moreTableNode).html("<fmt:message key='main.moreTable' />");
$(".more-table", $moreTableNode).html("<@spring.message code='main.moreTable' />");
}
});
}
@ -1115,7 +1105,7 @@
});
//系统通知
$.get("<c:url value='/notification/list' />", function(data)
$.get("${contextPath}/notification/list", function(data)
{
if(data && data.length)
{
@ -1132,85 +1122,85 @@
</head>
<body id="${pageId}">
<div class="main-page-head">
<%@ include file="include/html_logo.jsp" %>
<#include "include/html_logo.ftl">
<div class="toolbar">
<ul id="systemSetMenu" class="lightweight-menu">
<li class="system-set-root"><span><span class="ui-icon ui-icon-gear"></span></span>
<ul style="display:none;">
<%if(!user.isAnonymous()){ %>
<%if(user.isAdmin()){ %>
<li class="system-set-driverEntity-manage"><a href="javascript:void(0);"><fmt:message key='main.manageDriverEntity' /></a></li>
<li class="system-set-driverEntity-add"><a href="javascript:void(0);"><fmt:message key='main.addDriverEntity' /></a></li>
<#if !currentUser.anonymous>
<#if currentUser.admin>
<li class="system-set-driverEntity-manage"><a href="javascript:void(0);"><@spring.message code='main.manageDriverEntity' /></a></li>
<li class="system-set-driverEntity-add"><a href="javascript:void(0);"><@spring.message code='main.addDriverEntity' /></a></li>
<li class="ui-widget-header"></li>
<li class="system-set-user-manage"><a href="javascript:void(0);"><fmt:message key='main.manageUser' /></a></li>
<li class="system-set-user-add"><a href="javascript:void(0);"><fmt:message key='main.addUser' /></a></li>
<li class="system-set-user-manage"><a href="javascript:void(0);"><@spring.message code='main.manageUser' /></a></li>
<li class="system-set-user-add"><a href="javascript:void(0);"><@spring.message code='main.addUser' /></a></li>
<li class="ui-widget-header"></li>
<%}%>
<li class="system-set-personal-set"><a href="javascript:void(0);"><fmt:message key='main.personalSet' /></a></li>
<%if(user.isAdmin()){ %>
<li class=""><a href="javascript:void(0);"><fmt:message key='main.globalSetting' /></a>
</#if>
<li class="system-set-personal-set"><a href="javascript:void(0);"><@spring.message code='main.personalSet' /></a></li>
<#if currentUser.admin>
<li class=""><a href="javascript:void(0);"><@spring.message code='main.globalSetting' /></a>
<ul>
<li class="system-set-global-setting"><a href="javascript:void(0);"><fmt:message key='globalSetting.smtpSetting' /></a></li>
<li class="system-set-schema-url-builder"><a href="javascript:void(0);"><fmt:message key='schemaUrlBuilder.schemaUrlBuilder' /></a></li>
<li class="system-set-global-setting"><a href="javascript:void(0);"><@spring.message code='globalSetting.smtpSetting' /></a></li>
<li class="system-set-schema-url-builder"><a href="javascript:void(0);"><@spring.message code='schemaUrlBuilder.schemaUrlBuilder' /></a></li>
</ul>
</li>
<%}%>
</#if>
<li class="ui-widget-header"></li>
<%}%>
<li class=""><a href="javascript:void(0);"><fmt:message key='main.changeTheme' /></a>
</#if>
<li class=""><a href="javascript:void(0);"><@spring.message code='main.changeTheme' /></a>
<ul>
<li class="theme-item" theme="lightness"><a href="javascript:void(0);"><fmt:message key='main.changeTheme.lightness' /><span class="ui-widget ui-widget-content theme-sample theme-sample-lightness"></span></a></li>
<li class="theme-item" theme="dark"><a href="javascript:void(0);"><fmt:message key='main.changeTheme.dark' /><span class="ui-widget ui-widget-content theme-sample theme-sample-dark"></span></a></li>
<li class="theme-item" theme="green"><a href="javascript:void(0);"><fmt:message key='main.changeTheme.green' /><span class="ui-widget ui-widget-content theme-sample theme-sample-green"></span></a></li>
<li class="theme-item" theme="lightness"><a href="javascript:void(0);"><@spring.message code='main.changeTheme.lightness' /><span class="ui-widget ui-widget-content theme-sample theme-sample-lightness"></span></a></li>
<li class="theme-item" theme="dark"><a href="javascript:void(0);"><@spring.message code='main.changeTheme.dark' /><span class="ui-widget ui-widget-content theme-sample theme-sample-dark"></span></a></li>
<li class="theme-item" theme="green"><a href="javascript:void(0);"><@spring.message code='main.changeTheme.green' /><span class="ui-widget ui-widget-content theme-sample theme-sample-green"></span></a></li>
</ul>
</li>
<li><a href="javascript:void(0);"><fmt:message key='help' /></a>
<li><a href="javascript:void(0);"><@spring.message code='help' /></a>
<ul>
<li class="about"><a href="javascript:void(0);"><fmt:message key='main.about' /></a></li>
<li class="documentation"><a href="javascript:void(0);"><fmt:message key='main.documentation' /></a></li>
<li class="changelog"><a href="javascript:void(0);"><fmt:message key='main.changelog' /></a></li>
<li class="about"><a href="javascript:void(0);"><@spring.message code='main.about' /></a></li>
<li class="documentation"><a href="javascript:void(0);"><@spring.message code='main.documentation' /></a></li>
<li class="changelog"><a href="javascript:void(0);"><@spring.message code='main.changelog' /></a></li>
</ul>
</li>
</ul>
</li>
</ul>
<%if(!user.isAnonymous()){ %>
<#if !currentUser.anonymous>
<div class="user-name">
<c:out value='<%=user.getNameLabel()%>' />
${currentUser.nameLabel?html}
</div>
<a class="link" href="<c:url value="/logout" />"><fmt:message key='main.logout' /></a>
<%}else{%>
<a class="link" href="<c:url value="/login" />"><fmt:message key='main.login' /></a>
<c:if test='${!disableRegister}'>
<a class="link" href="<c:url value="/register" />"><fmt:message key='main.register' /></a>
</c:if>
<%}%>
<a class="link" href="${contextPath}/logout"><@spring.message code='main.logout' /></a>
<#else>
<a class="link" href="${contextPath}/login"><@spring.message code='main.login' /></a>
<#if !disableRegister>
<a class="link" href="${contextPath}/register"><@spring.message code='main.register' /></a>
</#if>
</#if>
</div>
</div>
<div class="main-page-content">
<div class="ui-layout-west">
<div class="ui-widget ui-widget-content schema-panel">
<div class="schema-panel-head">
<div class="schema-panel-title"><fmt:message key='main.schema' /></div>
<div class="schema-panel-title"><@spring.message code='main.schema' /></div>
<div class="schema-panel-operation">
<div class="ui-widget ui-widget-content ui-corner-all search">
<form id="schemaSearchForm" action="javascript:void(0);">
<div id="schemaSearchSwitch" class="schema-search-switch"><span class="ui-icon ui-icon-document search-switch-icon" title="<fmt:message key='main.searchTable' />"></span></div>
<div id="schemaSearchSwitch" class="schema-search-switch"><span class="ui-icon ui-icon-document search-switch-icon" title="<@spring.message code='main.searchTable' />"></span></div>
<div class="keyword-input-parent"><input name="keyword" type="text" value="" class="ui-widget ui-widget-content keyword-input" /></div>
<button type="submit" class="ui-button ui-corner-all ui-widget ui-button-icon-only search-button"><span class="ui-icon ui-icon-search"></span><span class="ui-button-icon-space"> </span><fmt:message key='find' /></button>
<button type="submit" class="ui-button ui-corner-all ui-widget ui-button-icon-only search-button"><span class="ui-icon ui-icon-search"></span><span class="ui-button-icon-space"> </span><@spring.message code='find' /></button>
<input name="pageSize" type="hidden" value="100" />
</form>
</div>
<button id="addSchemaButton" class="ui-button ui-corner-all ui-widget ui-button-icon-only add-schema-button" title="<fmt:message key='main.addSchema' />"><span class="ui-button-icon ui-icon ui-icon-plus"></span><span class="ui-button-icon-space"> </span><fmt:message key='add' /></button>
<button id="addSchemaButton" class="ui-button ui-corner-all ui-widget ui-button-icon-only add-schema-button" title="<@spring.message code='main.addSchema' />"><span class="ui-button-icon ui-icon ui-icon-plus"></span><span class="ui-button-icon-space"> </span><@spring.message code='add' /></button>
<ul id="schemaOperationMenu" class="lightweight-menu">
<li class="schema-operation-root"><span><span class="ui-icon ui-icon-triangle-1-s"></span></span>
<ul>
<li class="schema-operation-edit"><div><fmt:message key='edit' /></div></li>
<li class="schema-operation-delete"><div><fmt:message key='delete' /></div></li>
<li class="schema-operation-view"><div><fmt:message key='view' /></div></li>
<li class="schema-operation-refresh" title="<fmt:message key='main.schemaOperationMenuRefreshComment' />"><div><fmt:message key='refresh' /></div></li>
<li class="schema-operation-edit"><div><@spring.message code='edit' /></div></li>
<li class="schema-operation-delete"><div><@spring.message code='delete' /></div></li>
<li class="schema-operation-view"><div><@spring.message code='view' /></div></li>
<li class="schema-operation-refresh" title="<@spring.message code='main.schemaOperationMenuRefreshComment' />"><div><@spring.message code='refresh' /></div></li>
<li class="ui-widget-header"></li>
<li class="schema-operation-reload" title="<fmt:message key='main.schemaOperationMenuReloadComment' />"><div><fmt:message key='reload' /></div></li>
<li class="schema-operation-reload" title="<@spring.message code='main.schemaOperationMenuReloadComment' />"><div><@spring.message code='reload' /></div></li>
</ul>
</li>
</ul>
@ -1227,12 +1217,12 @@
</div>
<div id="tabMoreOperationMenuParent" class="ui-widget ui-front ui-widget-content ui-corner-all ui-widget-shadow tab-more-operation-menu-parent" style="position: absolute; left:0px; top:0px; display: none;">
<ul id="tabMoreOperationMenu" class="tab-more-operation-menu">
<li class="tab-operation-close-left"><div><fmt:message key='main.closeLeft' /></div></li>
<li class="tab-operation-close-right"><div><fmt:message key='main.closeRight' /></div></li>
<li class="tab-operation-close-other"><div><fmt:message key='main.closeOther' /></div></li>
<li class="tab-operation-close-all"><div><fmt:message key='main.closeAll' /></div></li>
<li class="tab-operation-close-left"><div><@spring.message code='main.closeLeft' /></div></li>
<li class="tab-operation-close-right"><div><@spring.message code='main.closeRight' /></div></li>
<li class="tab-operation-close-other"><div><@spring.message code='main.closeOther' /></div></li>
<li class="tab-operation-close-all"><div><@spring.message code='main.closeAll' /></div></li>
<li class="ui-widget-header"></li>
<li class="tab-operation-newwin"><div><fmt:message key='main.openInNewWindow' /></div></li>
<li class="tab-operation-newwin"><div><@spring.message code='main.openInNewWindow' /></div></li>
</ul>
</div>
<div id="tabMoreTabMenuParent" class="ui-widget ui-front ui-widget-content ui-corner-all ui-widget-shadow tab-more-tab-menu-parent" style="position: absolute; left:0px; top:0px; display: none;">

View File

@ -1,35 +1,26 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="include/jsp_import.jsp" %>
<%@ include file="include/jsp_ajax_request.jsp" %>
<%@ include file="include/jsp_jstl.jsp" %>
<%@ include file="include/jsp_page_id.jsp" %>
<%@ include file="include/html_doctype.jsp" %>
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<%@ include file="include/html_head.jsp" %>
<title><%@ include file="include/html_title_app_name.jsp" %><fmt:message key='register.register' /></title>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='register.register' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head">
<%@ include file="include/html_logo.jsp" %>
<#include "include/html_logo.ftl">
<div class="toolbar">
<a class="link" href="<c:url value="/login" />"><fmt:message key='login.login' /></a>
<a class="link" href="<c:url value="/" />"><fmt:message key='backToMainPage' /></a>
<a class="link" href="${contextPath}/login"><@spring.message code='login.login' /></a>
<a class="link" href="${contextPath}/"><@spring.message code='backToMainPage' /></a>
</div>
</div>
<div class="page-form page-form-register">
<form id="${pageId}-form" action="<c:url value="/register/doRegister" />" method="POST">
<form id="${pageId}-form" action="${contextPath}/register/doRegister" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='register.name' /></label>
<label><@spring.message code='register.name' /></label>
</div>
<div class="form-item-value">
<input type="text" name="name" value="" class="ui-widget ui-widget-content" />
@ -37,7 +28,7 @@
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='register.password' /></label>
<label><@spring.message code='register.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
@ -45,7 +36,7 @@
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='register.confirmPassword' /></label>
<label><@spring.message code='register.confirmPassword' /></label>
</div>
<div class="form-item-value">
<input type="password" name="confirmPassword" value="" class="ui-widget ui-widget-content" />
@ -53,7 +44,7 @@
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='register.realName' /></label>
<label><@spring.message code='register.realName' /></label>
</div>
<div class="form-item-value">
<input type="text" name="realName" value="" class="ui-widget ui-widget-content" />
@ -61,7 +52,7 @@
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='register.email' /></label>
<label><@spring.message code='register.email' /></label>
</div>
<div class="form-item-value">
<input type="text" name="email" value="" class="ui-widget ui-widget-content" />
@ -69,15 +60,15 @@
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" class="recommended" value="<fmt:message key='register.register' />" />
<input type="submit" class="recommended" value="<@spring.message code='register.register' />" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
<input type="reset" value="<@spring.message code='reset' />" />
</div>
</form>
</div>
</div>
<%@ include file="include/page_js_obj.jsp" %>
<%@ include file="include/page_obj_form.jsp" %>
<#include "include/page_js_obj.ftl" >
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
@ -88,7 +79,7 @@
var dialog=po.element(".page-form").dialog({
appendTo: po.element(),
title: "<fmt:message key='register.register' />",
title: "<@spring.message code='register.register' />",
position: {my : "center top", at : "center top+75"},
resizable: false,
draggable: true,
@ -107,14 +98,14 @@
},
messages :
{
name : "<fmt:message key='validation.required' />",
password : "<fmt:message key='validation.required' />",
name : "<@spring.message code='validation.required' />",
password : "<@spring.message code='validation.required' />",
confirmPassword :
{
"required" : "<fmt:message key='validation.required' />",
"equalTo" : "<fmt:message key='register.validation.confirmPasswordError' />"
"required" : "<@spring.message code='validation.required' />",
"equalTo" : "<@spring.message code='register.validation.confirmPasswordError' />"
},
email : "<fmt:message key='validation.email' />"
email : "<@spring.message code='validation.email' />"
},
submitHandler : function(form)
{
@ -122,7 +113,7 @@
{
success : function()
{
window.location.href="<c:url value='/register/success' />";
window.location.href="${contextPath}/register/success";
}
});
},

View File

@ -0,0 +1,25 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<meta http-equiv="refresh" content="3;url=${contextPath}/login">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='register.registerSuccess' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head">
<#include "include/html_logo.ftl">
<div class="toolbar">
<a class="link" href="${contextPath}/"><@spring.message code='backToMainPage' /></a>
</div>
</div>
<div class="page-register-success">
<div class="register-success-content">
<#assign messageArgs=['${contextPath}/login'] />
<@spring.messageArgs code='register.registerSuccessContent' args=messageArgs />
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,220 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<#macro stepCss currentStep myStepIndex><#if currentStep.step gt myStepIndex>ui-state-default<#elseif currentStep.step == myStepIndex>ui-state-active<#else>ui-state-disabled</#if></#macro>
<html>
<head>
<#include "include/html_head.ftl">
<#if step.finalStep && !step.skipCheckUserAdmin>
<meta http-equiv="refresh" content="4;url=${contextPath}/login">
</#if>
<title><#include "include/html_title_app_name.ftl"><@spring.message code='resetPassword.resetPassword' /></title>
</head>
<body>
<div id="${pageId}">
<div class="main-page-head main-page-head-reset-passord">
<#include "include/html_logo.ftl">
<div class="toolbar">
<a class="link" href="javascript:void(0);" id="viewResetPasswordAdminReqHistoryLink"><@spring.message code='resetPassword.viewResetPasswordAdminReqHistory' /></a>
<a class="link" href="${contextPath}/login"><@spring.message code='resetPassword.backToLoginPage' /></a>
<a class="link" href="${contextPath}/"><@spring.message code='backToMainPage' /></a>
</div>
</div>
<div class="page-form page-form-reset-password">
<div class="head">
<@spring.message code='resetPassword.resetPassword' />
</div>
<div class="content">
<div class="steps">
<div class="step ui-widget ui-widget-content ui-corner-all <@stepCss currentStep=step myStepIndex=1 />"><@spring.message code='resetPassword.step.fillInUserInfo' /></div>
<div class="step ui-widget ui-widget-content ui-corner-all <@stepCss currentStep=step myStepIndex=2 />"><@spring.message code='resetPassword.step.checkUser' /></div>
<div class="step ui-widget ui-widget-content ui-corner-all <@stepCss currentStep=step myStepIndex=3 />"><@spring.message code='resetPassword.step.setNewPassword' /></div>
<div class="step ui-widget ui-widget-content ui-corner-all <@stepCss currentStep=step myStepIndex=4 />"><@spring.message code='resetPassword.step.finish' /></div>
</div>
<form id="${pageId}-form" action="${contextPath}/resetPassword/${step.action}">
<div class="ui-widget ui-widget-content ui-corner-all form-content">
<#if step.step == 1>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.username' /></label>
</div>
<div class="form-item-value">
<input type="text" name="username" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<#elseif step.step == 2>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.username' /></label>
</div>
<div class="form-item-value">
<input type="text" value="${step.user.name?html}" class="ui-widget ui-widget-content" readonly="readonly" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.email' /></label>
</div>
<div class="form-item-value">
<input type="text" value="${step.blurryEmail?html}" class="ui-widget ui-widget-content" readonly="readonly" />
<button id="sendCheckCodeButton" type="button"><@spring.message code='resetPassword.sendCheckCode' /></button>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.checkcode' /></label>
</div>
<div class="form-item-value">
<input type="text" name="checkCode" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<#elseif step.step == 3>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.username' /></label>
</div>
<div class="form-item-value">
<input type="text" value="${step.user.name?html}" class="ui-widget ui-widget-content" readonly="readonly" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='resetPassword.confirmPassword' /></label>
</div>
<div class="form-item-value">
<input type="password" name="confirmPassword" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<#if step.skipCheckUserAdmin>
<div class="form-item">
<div class="ui-state-highlight ui-corner-all skip-check-user-admin-warn">
<span class="ui-icon ui-icon-info"></span>
<#assign messageArgs=['${step.skipPasswordDelayHours}'] />
<@spring.messageArgs code='resetPassword.setNewPassword.skipCheckUserAdminWarn' args=messageArgs />
</div>
</div>
</#if>
<#elseif step.finalStep>
<div class="step-finish-content">
<span class="ui-icon ui-icon-check"></span>
<#if step.skipCheckUserAdmin>
<#assign messageArgs=['${step.skipPasswordDelayHours}', '${step.skipPasswordEffectiveTime}'] />
<@spring.messageArgs code='resetPassword.step.finish.content.skipCheckUserAdmin' args=messageArgs />
<#else>
<#assign messageArgs=['${contextPath}/login'] />
<@spring.messageArgs code='resetPassword.step.finish.content' args=messageArgs />
</#if>
</div>
</#if>
</div>
<div class="form-foot" style="text-align:center;">
<input type="button" id="restartResetPassword" value="<@spring.message code='restart' />" <#if step.firstStep>disabled="disabled"</#if> />
<input type="submit" value="<@spring.message code='resetPassword.next' />" <#if step.finalStep>disabled="disabled"<#else>class="recommended"</#if> />
</div>
</form>
</div>
</div>
</div>
<#include "include/page_js_obj.ftl">
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
//需要先渲染按钮,不然对话框尺寸不合适,出现滚动条
$.initButtons(po.element());
po.element("#viewResetPasswordAdminReqHistoryLink").click(function()
{
var options = {};
$.setGridPageHeightOption(options);
po.open("${contextPath}/resetPasswordRequestHistory", options);
});
po.element("#restartResetPassword").click(function()
{
window.location.href="${contextPath}/resetPassword";
});
po.element("#sendCheckCodeButton").click(function()
{
var _this= $(this);
_this.button("disable");
$.ajax(
{
url : "${contextPath}/resetPassword/sendCheckCode",
error : function(jqXHR)
{
var operationMessage = $.getResponseJson(jqXHR);
if(operationMessage && operationMessage.code
&& (operationMessage.code.indexOf("sendCheckCode.admin.smtpSettingNotSet") > 0
|| operationMessage.code.indexOf("sendCheckCode.admin.MessagingException") > 0))
{
po.checkCodeNotRequired = true;
}
else
po.checkCodeNotRequired = false;
},
complete : function()
{
_this.button("enable");
}
});
});
$.validator.addMethod("checkCodeIfRequired", function(value, element, params)
{
if(po.checkCodeNotRequired)
return true;
else
return (value.length > 0);
},"");
po.form().validate(
{
<#if step.step == 1>
rules : { username : "required" },
messages : { username : "<@spring.message code='validation.required' />" },
<#elseif step.step == 2>
rules : { checkCode : "checkCodeIfRequired" },
messages : { checkCode : "<@spring.message code='validation.required' />" },
<#elseif step.step == 3>
rules : { password : "required", confirmPassword : {"required" : true, "equalTo" : po.element("input[name='password']")} },
messages : { password : "<@spring.message code='validation.required' />", confirmPassword : {"required" : "<@spring.message code='validation.required' />", "equalTo" : "<@spring.message code='resetPassword.validation.confirmPasswordError' />"} },
</#if>
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
},
submitHandler : function(form)
{
$(form).ajaxSubmit(
{
success : function()
{
window.location.href="${contextPath}/resetPassword?step";
}
});
}
});
<#if step.step == 3 && step.skipCheckUserAdmin && step.skipReason != null && step.skipReason != "">
$(document).ready(function()
{
$.tipInfo("${step.skipReason?js_string}");
});
</#if>
})
(${pageId});
</script>
</body>
</html>

View File

@ -0,0 +1,77 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html style="height:100%;">
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='resetPasswordRequestHistory.resetPasswordRequestHistory' /></title>
</head>
<body style="height:100%;">
<#if !isAjaxRequest>
<div style="height:99%;">
</#if>
<div id="${pageId}" class="page-grid page-grid-reset-password-request-history">
<div class="head">
<div class="search">
<#include "include/page_obj_searchform.html.ftl">
</div>
<div class="operation">
</div>
</div>
<div class="content">
<table id="${pageId}-table" width="100%" class="hover stripe">
</table>
</div>
<div class="foot">
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<#if !isAjaxRequest>
</div>
</#if>
<#include "include/page_js_obj.ftl">
<#include "include/page_obj_searchform_js.ftl">
<#include "include/page_obj_pagination.ftl">
<#include "include/page_obj_grid.ftl">
<script type="text/javascript">
(function(po)
{
po.url = function(action)
{
return "${contextPath}/resetPasswordRequestHistory/" + action;
};
po.buildTableColumValueOption = function(title, data)
{
var option =
{
title : title,
data : data,
render: function(data, type, row, meta)
{
return data;
},
defaultContent: "",
};
return option;
};
var tableColumns = [
po.buildTableColumValueOption("<@spring.message code='resetPasswordRequestHistory.time' />", "resetPasswordRequest.time"),
po.buildTableColumValueOption("<@spring.message code='resetPasswordRequestHistory.principal' />", "resetPasswordRequest.principal"),
po.buildTableColumValueOption("<@spring.message code='resetPasswordRequestHistory.username' />", "resetPasswordRequest.user.name"),
po.buildTableColumValueOption("<@spring.message code='resetPasswordRequestHistory.effectiveTime' />", "effectiveTime"),
];
po.initPagination();
var tableSettings = po.buildDataTableSettingsAjax(tableColumns, po.url("pagingQueryData"));
tableSettings.order=[[1,"desc"]];
po.initDataTable(tableSettings);
})
(${pageId});
</script>
</body>
</html>

View File

@ -1,36 +1,25 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
boolean isPreview = "1".equals(getStringValue(request, "preview"));
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
preview 是否是预览请求允许为null
-->
<#assign preview=(preview!false)>
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='schema.schemaBuildUrl' /></title>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='schema.schemaBuildUrl' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-buildSchemaUrl">
<div id="dbUrlBuilderScriptCode" style="display: none;">
$.schemaUrlBuilder.add(
<%=request.getAttribute("scriptCode")%>
);
$.schemaUrlBuilder.add(${scriptCode!'null'?js_string});
</div>
<form id="${pageId}-form" action="#" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.url.dbType' /></label>
<label><@spring.message code='schema.url.dbType' /></label>
</div>
<div class="form-item-value">
<select name="dbType">
@ -39,7 +28,7 @@ boolean isPreview = "1".equals(getStringValue(request, "preview"));
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.url.host' /></label>
<label><@spring.message code='schema.url.host' /></label>
</div>
<div class="form-item-value">
<input type="text" name="host" value="" class="ui-widget ui-widget-content" />
@ -47,7 +36,7 @@ boolean isPreview = "1".equals(getStringValue(request, "preview"));
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.url.port' /></label>
<label><@spring.message code='schema.url.port' /></label>
</div>
<div class="form-item-value">
<input type="text" name="port" value="" class="ui-widget ui-widget-content" />
@ -55,7 +44,7 @@ boolean isPreview = "1".equals(getStringValue(request, "preview"));
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.url.name' /></label>
<label><@spring.message code='schema.url.name' /></label>
</div>
<div class="form-item-value">
<input type="text" name="name" value="" class="ui-widget ui-widget-content" />
@ -63,21 +52,21 @@ boolean isPreview = "1".equals(getStringValue(request, "preview"));
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" value="<fmt:message key='confirm' />" class="recommended" />
<input type="submit" value="<@spring.message code='confirm' />" class="recommended" />
</div>
</form>
<%if(isPreview){%>
<#if preview>
<div class="url-preview"></div>
<%}%>
</#if>
</div>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_form.jsp" %>
<#include "../include/page_js_obj.ftl" >
<#include "../include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
po.dbTypeSelect = function(){ return po.element("select[name='dbType']"); };
po.initUrl = "<c:out value='${url}' />";
po.initUrl = "${url!''?js_string}";
$("input:submit, input:button, input:reset, button", po.page).button();
@ -89,7 +78,7 @@ boolean isPreview = "1".equals(getStringValue(request, "preview"));
}
catch(e)
{
$.tipError("<fmt:message key='schema.loadUrlBuilderScriptError' /><fmt:message key='colon' />" + e.message);
$.tipError("<@spring.message code='schema.loadUrlBuilderScriptError' /><@spring.message code='colon' />" + e.message);
}
var builderInfos = $.schemaUrlBuilder.list();
@ -147,14 +136,14 @@ boolean isPreview = "1".equals(getStringValue(request, "preview"));
{
var url = po.buildFormUrl();
<%if(isPreview){%>
<#if preview>
po.element(".url-preview").text(url);
<%}else{%>
<#else>
var close = (po.pageParamCall("setSchemaUrl", url) != false);
if(close)
po.close();
<%}%>
</#if>
return false;
},

View File

@ -1,124 +1,112 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.datagear.web.controller.SchemaController" %>
<%@ include file="../include/jsp_import.jsp" %>
<%@ include file="../include/jsp_ajax_request.jsp" %>
<%@ include file="../include/jsp_jstl.jsp" %>
<%@ include file="../include/jsp_page_id.jsp" %>
<%@ include file="../include/jsp_method_get_string_value.jsp" %>
<%@ include file="../include/html_doctype.jsp" %>
<%
//标题标签I18N关键字不允许null
String titleMessageKey = getStringValue(request, SchemaController.KEY_TITLE_MESSAGE_KEY);
//表单提交action允许为null
String formAction = getStringValue(request, SchemaController.KEY_FORM_ACTION, "#");
//是否只读操作允许为null
boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaController.KEY_READONLY)));
%>
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
titleMessageKey 标题标签I18N关键字不允许null
formAction 表单提交action允许为null
readonly 是否只读操作允许为null
-->
<#assign formAction=(formAction!'#')>
<#assign readonly=(readonly!false)>
<html>
<head>
<%@ include file="../include/html_head.jsp" %>
<title><%@ include file="../include/html_title_app_name.jsp" %><fmt:message key='<%=titleMessageKey%>' /></title>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
</head>
<body>
<div id="${pageId}" class="schema-form">
<form id="${pageId}-form" action="<%=request.getContextPath()%>/schema/<%=formAction%>" method="POST">
<form id="${pageId}-form" action="${contextPath}/schema/${formAction}" method="POST">
<div class="form-head"></div>
<div class="form-content">
<input type="hidden" name="id" value="<c:out value='${schema.id}' />">
<input type="hidden" name="id" value="${(schema.id)!''?html}">
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.title' /></label>
<label><@spring.message code='schema.title' /></label>
</div>
<div class="form-item-value">
<input type="text" name="title" value="<c:out value='${schema.title}' />" class="ui-widget ui-widget-content" />
<input type="text" name="title" value="${(schema.title)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.url' /></label>
<label><@spring.message code='schema.url' /></label>
</div>
<div class="form-item-value">
<input type="text" name="url" value="<c:out value='${schema.url}' />" class="ui-widget ui-widget-content" />
<%if(!readonly){%>
<span id="schemaBuildUrlHelp" class="ui-state-default ui-corner-all" style="cursor: pointer;" title="<fmt:message key='schema.urlHelp' />"><span class="ui-icon ui-icon-help"></span></span>&nbsp;
<%}%>
<input type="text" name="url" value="${(schema.url)!''?html}" class="ui-widget ui-widget-content" />
<#if !readonly>
<span id="schemaBuildUrlHelp" class="ui-state-default ui-corner-all" style="cursor: pointer;" title="<@spring.message code='schema.urlHelp' />"><span class="ui-icon ui-icon-help"></span></span>&nbsp;
</#if>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.user' /></label>
<label><@spring.message code='schema.user' /></label>
</div>
<div class="form-item-value">
<input type="text" name="user" value="<c:out value='${schema.user}' />" class="ui-widget ui-widget-content" />
<input type="text" name="user" value="${(schema.user)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<%if(!readonly){%>
<#if !readonly>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.password' /></label>
<label><@spring.message code='schema.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="<c:out value='${schema.password}' />" class="ui-widget ui-widget-content" />
<input type="password" name="password" value="${(schema.password)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<%}%>
</#if>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='schema.shared' /></label>
<label><@spring.message code='schema.shared' /></label>
</div>
<div class="form-item-value">
<div class="schema-shared-radios">
<label for="${pageId}-schemaSharedYes"><fmt:message key='yes' /></label>
<input type="radio" id="${pageId}-schemaSharedYes" name="shared" value="1" <c:if test='${schema.shared}'>checked="checked"</c:if> />
<label for="${pageId}-schemaSharedNo"><fmt:message key='no' /></label>
<input type="radio" id="${pageId}-schemaSharedNo" name="shared" value="0" <c:if test='${!schema.shared}'>checked="checked"</c:if> />
<label for="${pageId}-schemaSharedYes"><@spring.message code='yes' /></label>
<input type="radio" id="${pageId}-schemaSharedYes" name="shared" value="1" <#if (schema.shared)!false>checked="checked"</#if> />
<label for="${pageId}-schemaSharedNo"><@spring.message code='no' /></label>
<input type="radio" id="${pageId}-schemaSharedNo" name="shared" value="0" <#if !((schema.shared)!false)>checked="checked"</#if> />
</div>
</div>
</div>
<%if(!readonly){%>
<#if !readonly>
<div class="form-item">
<div class="form-item-label">
<label><fmt:message key='advancedSetting' /></label>
<label><@spring.message code='advancedSetting' /></label>
</div>
<div class="form-item-value">
<button id="schemaAdvancedSet" type="button" style="font-size: 0.8em;">&nbsp;</button>
</div>
</div>
<%}%>
</#if>
<div class="form-item" id="schemaDriverEntityFormItem">
<div class="form-item-label">
<label><fmt:message key='schema.driverEntity' /></label>
<label><@spring.message code='schema.driverEntity' /></label>
</div>
<div id="driverEntityFormItemValue" class="form-item-value">
<input type="hidden" id="driverEntityId" name="driverEntity.id" value="<c:out value='${schema.driverEntity.id}' />" />
<input type="text" id="driverEntityText" value="<c:out value='${schema.driverEntity.displayText}' />" size="20" readonly="readonly" class="ui-widget ui-widget-content" />
<%if(!readonly){%>
<input type="hidden" id="driverEntityId" name="driverEntity.id" value="${(schema.driverEntity.id)!''?html}" />
<input type="text" id="driverEntityText" value="${(schema.driverEntity.displayText)!''?html}" size="20" readonly="readonly" class="ui-widget ui-widget-content" />
<#if !readonly>
<div id="driverEntityActionGroup">
<button id="driverEntitySelectButton" type="button"><fmt:message key='select' /></button>
<button id="driverEntitySelectButton" type="button"><@spring.message code='select' /></button>
<select id="driverEntityActionSelect">
<option value='del'><fmt:message key='delete' /></option>
<option value='del'><@spring.message code='delete' /></option>
</select>
</div>
<%}%>
</#if>
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<%if(!readonly){%>
<input type="submit" value="<fmt:message key='save' />" class="recommended" />
<#if !readonly>
<input type="submit" value="<@spring.message code='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<fmt:message key='reset' />" />
<%}%>
<input type="reset" value="<@spring.message code='reset' />" />
</#if>
</div>
</form>
</div>
<%@ include file="../include/page_js_obj.jsp" %>
<%@ include file="../include/page_obj_form.jsp" %>
<#include "../include/page_js_obj.ftl" >
<#include "../include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
@ -126,11 +114,11 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaContro
po.schemaDriverEntityFormItem = function(){ return this.element("#schemaDriverEntityFormItem"); };
po.isDriverEntityEmpty = (po.element("input[name='driverEntity.id']").val() == "");
<%if(!readonly){%>
<#if !readonly>
po.element("#schemaBuildUrlHelp").click(function()
{
po.open(contextPath+"/schemaUrlBuilder/buildUrl",
po.open("${contextPath}/schemaUrlBuilder/buildUrl",
{
data : { url : po.element("input[name='url']").val() },
width: "60%",
@ -158,7 +146,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaContro
}
};
$.setGridPageHeightOption(options);
po.open(contextPath+"/driverEntity/select", options);
po.open("${contextPath}/driverEntity/select", options);
});
po.element("#driverEntityActionSelect").selectmenu(
@ -191,8 +179,8 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaContro
},
messages :
{
title : "<fmt:message key='validation.required' />",
url : "<fmt:message key='validation.required' />"
title : "<@spring.message code='validation.required' />",
url : "<@spring.message code='validation.required' />"
},
submitHandler : function(form)
{
@ -212,7 +200,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaContro
error.appendTo(element.closest(".form-item-value"));
}
});
<%}%>
</#if>
po.element("input[name='shared']").checkboxradio({icon:false});
po.element(".schema-shared-radios").controlgroup();
@ -222,7 +210,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaContro
if(po.isDriverEntityEmpty)
po.schemaDriverEntityFormItem().hide();
<%if(!readonly){%>
<#if !readonly>
$("#schemaAdvancedSet", po.page).button(
{
icon: (po.schemaDriverEntityFormItem().is(":hidden") ? "ui-icon-triangle-1-s" : "ui-icon-triangle-1-n"),
@ -243,7 +231,7 @@ boolean readonly = ("true".equalsIgnoreCase(getStringValue(request, SchemaContro
$(this).button("option", "icon", "ui-icon-triangle-1-s");
}
});
<%}%>
</#if>
})
(${pageId});
</script>

View File

@ -0,0 +1,94 @@
<#include "include/import_global.ftl">
<#include "include/html_doctype.ftl">
<html>
<head>
<#include "include/html_head.ftl">
<title><#include "include/html_title_app_name.ftl"><@spring.message code='schemaUrlBuilder.schemaUrlBuilder' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-schemaUrlBuilder">
<form id="${pageId}-form" action="${contextPath}/schemaUrlBuilder/saveScriptCode" method="POST">
<div class="form-head"></div>
<div class="form-content">
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='schemaUrlBuilder.scriptCode' /></label>
</div>
<div class="form-item-value form-item-value-scriptCode">
<textarea name="scriptCode" class="ui-widget ui-widget-content script-code-textarea">${scriptCode?html}</textarea>
<div class="script-code-note">
<span><@spring.message code='schemaUrlBuilder.scriptCodeNote.0' /></span>
<pre>
{
//<@spring.message code='schemaUrlBuilder.scriptCodeNote.required' /><@spring.message code='comma' /><@spring.message code='schemaUrlBuilder.scriptCodeNote.dbType' />
dbType : "...",
//<@spring.message code='schemaUrlBuilder.scriptCodeNote.required' /><@spring.message code='comma' /><@spring.message code='schemaUrlBuilder.scriptCodeNote.template' />
template : "...{host}...{port}...{name}...",
//<@spring.message code='schemaUrlBuilder.scriptCodeNote.optional' /><@spring.message code='comma' /><@spring.message code='schemaUrlBuilder.scriptCodeNote.defaultValue' />
defaultValue : { host : "...", port : "...", name : "" },
//<@spring.message code='schemaUrlBuilder.scriptCodeNote.optional' /><@spring.message code='comma' /><@spring.message code='schemaUrlBuilder.scriptCodeNote.order' />
order : 6
}</pre>
<span><@spring.message code='schemaUrlBuilder.scriptCodeNote.1' /></span>
</div>
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label>&nbsp;</label>
</div>
<div class="form-item-value">
<button id="previewScriptCode" type="button" class="preview-script-code-button"><@spring.message code='preview' /></button>
</div>
</div>
</div>
<div class="form-foot" style="text-align:center;">
<input type="submit" value="<@spring.message code='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<@spring.message code='reset' />" />
</div>
</form>
</div>
<#include "include/page_js_obj.ftl">
<#include "include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element());
po.element("#previewScriptCode").click(function()
{
po.open("${contextPath}/schemaUrlBuilder/previewScriptCode",
{
data : { "scriptCode" : po.element("textarea[name='scriptCode']").val() }
});
});
po.form().validate(
{
submitHandler : function(form)
{
$(form).ajaxSubmit(
{
success : function(response)
{
var close = (po.pageParamCall("afterSave") != false);
if(close)
po.close();
}
});
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
})
(${pageId});
</script>
</body>
</html>

View File

@ -0,0 +1,164 @@
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
titleMessageKey 标题标签I18N关键字不允许null
formAction 表单提交action允许为null
readonly 是否只读操作允许为null
-->
<#assign formAction=(formAction!'#')>
<#assign readonly=(readonly!false)>
<#assign isAdd=(formAction == 'saveAdd')>
<html>
<head>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
</head>
<body>
<div id="${pageId}" class="page-form page-form-user">
<form id="${pageId}-form" action="${contextPath}/user/${formAction}" method="POST">
<div class="form-head"></div>
<div class="form-content">
<input type="hidden" name="id" value="${(user.id)!''?html}" />
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='user.name' /></label>
</div>
<div class="form-item-value">
<input type="text" name="name" value="${(user.name)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<#if !readonly>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='user.password' /></label>
</div>
<div class="form-item-value">
<input type="password" name="password" value="" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='user.confirmPassword' /></label>
</div>
<div class="form-item-value">
<input type="password" name="confirmPassword" value="" class="ui-widget ui-widget-content" />
</div>
</div>
</#if>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='user.realName' /></label>
</div>
<div class="form-item-value">
<input type="text" name="realName" value="${(user.realName)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='user.email' /></label>
</div>
<div class="form-item-value">
<input type="text" name="email" value="${(user.email)!''?html}" class="ui-widget ui-widget-content" />
</div>
</div>
<#--
禁用新建管理员账号功能
<div class="form-item">
<div class="form-item-label">
<label><@spring.message code='user.admin' /></label>
</div>
<div class="form-item-value">
<div class="user-admin-radios">
<label for="${pageId}-userAdminYes"><@spring.message code='yes' /></label>
<input type="radio" id="${pageId}-userAdminYes" name="admin" value="1" <#if (user.admin)!false>checked="checked"</#if> />
<label for="${pageId}-userAdminNo"><@spring.message code='no' /></label>
<input type="radio" id="${pageId}-userAdminNo" name="admin" value="0" <#if !((user.admin)!false)>checked="checked"</#if> />
</div>
</div>
</div>
-->
</div>
<div class="form-foot" style="text-align:center;">
<#if !readonly>
<input type="submit" value="<@spring.message code='save' />" class="recommended" />
&nbsp;&nbsp;
<input type="reset" value="<@spring.message code='reset' />" />
</#if>
</div>
</form>
</div>
<#include "../include/page_js_obj.ftl" >
<#include "../include/page_obj_form.ftl">
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element());
<#--
禁用新建管理员账号功能
po.element("input[name='admin']").checkboxradio({icon:false});
po.element(".user-admin-radios").controlgroup();
-->
po.url = function(action)
{
return "${contextPath}/user/" + action;
};
<#if !readonly>
po.form().validate(
{
rules :
{
name : "required",
<#if isAdd>
password : "required",
</#if>
confirmPassword :
{
<#if isAdd>
"required" : true,
</#if>
"equalTo" : po.element("input[name='password']")
},
email : "email"
},
messages :
{
name : "<@spring.message code='validation.required' />",
<#if isAdd>
password : "<@spring.message code='validation.required' />",
</#if>
confirmPassword :
{
<#if isAdd>
"required" : "<@spring.message code='validation.required' />",
</#if>
"equalTo" : "<@spring.message code='user.validation.confirmPasswordError' />"
},
email : "<@spring.message code='validation.email' />"
},
submitHandler : function(form)
{
$(form).ajaxSubmit(
{
success : function()
{
var close = (po.pageParamCall("afterSave") != false);
if(close)
po.close();
}
});
},
errorPlacement : function(error, element)
{
error.appendTo(element.closest(".form-item-value"));
}
});
</#if>
})
(${pageId});
</script>
</body>
</html>

View File

@ -0,0 +1,188 @@
<#include "../include/import_global.ftl">
<#include "../include/html_doctype.ftl">
<#--
titleMessageKey 标题标签I18N关键字不允许null
selectonly 是否选择操作允许为null
-->
<#assign selectonly=(selectonly!false)>
<html style="height:100%;">
<head>
<#include "../include/html_head.ftl">
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
</head>
<body style="height:100%;">
<#if !isAjaxRequest>
<div style="height:99%;">
</#if>
<div id="${pageId}" class="page-grid page-grid-hidden-foot page-grid-user">
<div class="head">
<div class="search">
<#include "../include/page_obj_searchform.html.ftl">
</div>
<div class="operation">
<#if selectonly>
<input name="confirmButton" type="button" class="recommended" value="<@spring.message code='confirm' />" />
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<#else>
<input name="addButton" type="button" value="<@spring.message code='add' />" />
<input name="editButton" type="button" value="<@spring.message code='edit' />" />
<input name="viewButton" type="button" value="<@spring.message code='view' />" />
<input name="deleteButton" type="button" value="<@spring.message code='delete' />" />
</#if>
</div>
</div>
<div class="content">
<table id="${pageId}-table" width="100%" class="hover stripe">
</table>
</div>
<div class="foot">
<div class="pagination-wrapper">
<div id="${pageId}-pagination" class="pagination"></div>
</div>
</div>
</div>
<#if !isAjaxRequest>
</div>
</#if>
<#include "../include/page_js_obj.ftl">
<#include "../include/page_obj_searchform_js.ftl">
<#include "../include/page_obj_grid.ftl">
<script type="text/javascript">
(function(po)
{
$.initButtons(po.element(".operation"));
po.url = function(action)
{
return "${contextPath}/user/" + action;
};
<#if !selectonly>
po.element("input[name=addButton]").click(function()
{
po.open(po.url("add"),
{
pageParam :
{
afterSave : function()
{
po.refresh();
}
}
});
});
po.element("input[name=editButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"id" : row.id};
po.open(po.url("edit"),
{
data : data,
pageParam :
{
afterSave : function()
{
po.refresh();
}
}
});
});
});
</#if>
po.element("input[name=viewButton]").click(function()
{
po.executeOnSelect(function(row)
{
var data = {"id" : row.id};
po.open(po.url("view"),
{
data : data
});
});
});
<#if !selectonly>
po.element("input[name=deleteButton]").click(
function()
{
po.executeOnSelects(function(rows)
{
po.confirm("<@spring.message code='user.confirmDelete' />",
{
"confirm" : function()
{
var data = $.getPropertyParamString(rows, "id");
$.post(po.url("delete"), data, function()
{
po.refresh();
});
}
});
});
});
</#if>
po.element("input[name=confirmButton]").click(function()
{
po.executeOnSelect(function(row)
{
var close = po.pageParamCall("submit", row);
//单选默认关闭
if(close == undefined)
close = true;
if(close)
po.close();
});
});
po.buildTableColumValueOption = function(title, data, hidden)
{
var option =
{
title : title,
data : data,
visible : !hidden,
render: function(data, type, row, meta)
{
return $.escapeHtml(data);
},
defaultContent: "",
};
return option;
};
var columnAdmin = po.buildTableColumValueOption("<@spring.message code='user.admin' />", "admin");
columnAdmin.render = function(data, type, row, meta)
{
if(data == true)
data = "<@spring.message code='yes' />";
else
data = "<@spring.message code='no' />";
return data;
};
var tableColumns = [
po.buildTableColumValueOption("<@spring.message code='user.user.id' />", "id", true),
po.buildTableColumValueOption("<@spring.message code='user.name' />", "name"),
po.buildTableColumValueOption("<@spring.message code='user.realName' />", "realName"),
po.buildTableColumValueOption("<@spring.message code='user.email' />", "email"),
columnAdmin,
po.buildTableColumValueOption("<@spring.message code='user.createTime' />", "createTime")
];
var tableSettings = po.buildDataTableSettingsAjax(tableColumns, po.url("queryData"));
po.initDataTable(tableSettings);
})
(${pageId});
</script>
</body>
</html>

View File

@ -77,6 +77,7 @@
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/index.html</url-pattern>
<url-pattern>/login/*</url-pattern>
<url-pattern>/register/*</url-pattern>
<url-pattern>/main/*</url-pattern>
@ -97,7 +98,7 @@
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
</body>
</html>

View File

@ -1,9 +0,0 @@
<%--
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
request.getRequestDispatcher("/main").forward(request, response);
%>

View File

@ -702,6 +702,50 @@
}
},
/**
* 获取/设置对象属性值
*/
modelPropertyValue : function(model, property, obj, propertyValue)
{
if(model == null || property == null || obj == null)
throw new Error("[model], [property], [obj] must be defined");
var isGet = (arguments.length == 2);
if(isGet)
return obj[property.name];
else
{
if(propertyValue == null)
obj[property.name] = propertyValue;
else
{
var propertyModel = this.getPropertyModelByValue(property, propertyValue);
var mappedWithPropertyName = this.findMappedByWith(property, propertyModel);
if(mappedWithPropertyName)
{
//反向赋值
if(this.isMultipleProperty(property))
{
var length = (propertyValue.length ? propertyValue.length : 0);
for(var i=0; i<length; i++)
{
var ele = propertyValue[i];
if(ele != null)
ele[mappedWithPropertyName] = obj;
}
}
else
propertyValue[mappedWithPropertyName] = obj;
}
else
obj[property.name] = propertyValue;
}
}
},
/**
* 获取/设置对象属性值
*