APPS ExtraAttr UPDATE

APPS ExtraAttr UPDATE
上级 fba86d25
......@@ -13,6 +13,10 @@ public class ExtraAttr {
String type;
String value;
public ExtraAttr() {
super();
}
public ExtraAttr(String attr, String value) {
super();
this.attr = attr;
......
......@@ -40,6 +40,13 @@ public class ExtraAttrs {
this.extraAttrs.add(new ExtraAttr(attr,value));
}
public void put(String attr,String type,String value) {
if(extraAttrs==null){
extraAttrs=new ArrayList<ExtraAttr>();
}
this.extraAttrs.add(new ExtraAttr(attr,type,value));
}
public String get(String attr) {
String value=null;
if(extraAttrs!=null&& extraAttrs.size()!=0){
......
......@@ -99,8 +99,6 @@ public class Apps extends JpaBaseDomain implements Serializable{
*/
private int isExtendAttr;
private String extendAttr;
private String attribute;
private String attributeValue;
/**
* Signature
......@@ -492,54 +490,6 @@ public class Apps extends JpaBaseDomain implements Serializable{
this.extendAttr = extendAttr;
}
/**
* @return the attribute
*/
public String getAttribute() {
return attribute;
}
/**
* @param attribute the attribute to set
*/
public void setAttribute(String attribute) {
this.attribute = attribute;
}
/**
* @return the attributeValue
*/
public String getAttributeValue() {
return attributeValue;
}
/**
* @param attributeValue the attributeValue to set
*/
public void setAttributeValue(String attributeValue) {
this.attributeValue = attributeValue;
}
public int getVisible() {
return visible;
}
......@@ -665,8 +615,7 @@ public class Apps extends JpaBaseDomain implements Serializable{
+ ", credential=" + credential + ", sharedUsername="
+ sharedUsername + ", sharedPassword=" + sharedPassword
+ ", systemUserAttr=" + systemUserAttr + ", isExtendAttr="
+ isExtendAttr + ", extendAttr=" + extendAttr + ", attribute="
+ attribute + ", attributeValue=" + attributeValue
+ isExtendAttr + ", extendAttr=" + extendAttr
+ ", isSignature=" + isSignature
+ "]";
}
......
......@@ -3,6 +3,7 @@
*/
package org.maxkey.dao.persistence;
import org.apache.ibatis.annotations.Update;
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
import org.maxkey.domain.apps.Apps;
......@@ -15,4 +16,7 @@ public interface AppsMapper extends IJpaBaseMapper<Apps> {
public int insertApp(Apps app);
public int updateApp(Apps app);
@Update("UPDATE APPS SET ISEXTENDATTR=#{isExtendAttr}, EXTENDATTR=#{extendAttr} WHERE id = #{id}")
public int updateExtendAttr(Apps app);
}
......@@ -28,4 +28,8 @@ public class AppsService extends JpaBaseService<Apps>{
return ((AppsMapper)super.getMapper()).updateApp(app)>0;
};
public boolean updateExtendAttr(Apps app) {
return ((AppsMapper)super.getMapper()).updateExtendAttr(app)>0;
}
}
......@@ -4,6 +4,8 @@ package org.maxkey.web.apps.contorller;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.constants.OPERATEMESSAGE;
import org.maxkey.crypto.ReciprocalUtils;
import org.maxkey.domain.ExtraAttr;
import org.maxkey.domain.ExtraAttrs;
import org.maxkey.domain.apps.Apps;
import org.maxkey.web.WebContext;
import org.maxkey.web.message.Message;
......@@ -68,6 +70,35 @@ public class ApplicationsController extends BaseAppContorller {
}
@RequestMapping(value = { "/forwardAppsExtendAttr/{id}" })
public ModelAndView forwardExtendAttr(@PathVariable("id") String id) {
ModelAndView modelAndView=new ModelAndView("apps/appsExtendAttr");
modelAndView.addObject("model",appsService.get(id));
return modelAndView;
}
@ResponseBody
@RequestMapping(value = { "/updateExtendAttr" })
public Message updateExtendAttr(@ModelAttribute("application") Apps application,@ModelAttribute("extraAttrs") ExtraAttr extraAttr) {
if(extraAttr.getAttr()!=null){
String []attributes=extraAttr.getAttr().split(",");
String []attributeType=extraAttr.getType().split(",");
String []attributeValue=extraAttr.getValue().split(",");
ExtraAttrs extraAttrs=new ExtraAttrs();
for(int i=0;i<attributes.length;i++){
extraAttrs.put(attributes[i],attributeType[i], attributeValue[i]);
}
application.setExtendAttr(extraAttrs.toJsonString());
}
if (appsService.updateExtendAttr(application)) {
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
} else {
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_ERROR),MessageType.error);
}
}
/**
* query
* @param application
......
......@@ -9,7 +9,6 @@ import org.maxkey.constants.PROTOCOLS;
import org.maxkey.crypto.ReciprocalUtils;
import org.maxkey.crypto.password.PasswordReciprocal;
import org.maxkey.dao.service.AppsService;
import org.maxkey.domain.ExtraAttrs;
import org.maxkey.domain.apps.Apps;
import org.maxkey.util.StringUtils;
import org.slf4j.Logger;
......@@ -49,12 +48,7 @@ public class BaseAppContorller {
* string field encoding
*/
encoding(application);
/*
* convertExtendAttr
*
*/
convertExtendAttr(application);
/*
* upload iconFile MultipartFile to icon Bytes
*/
......@@ -113,17 +107,4 @@ public class BaseAppContorller {
application.setSecret(decodeSecret);
}
}
protected void convertExtendAttr(Apps application) {
if(application.getAttribute()!=null){
String []attributes=application.getAttribute().split(",");
String []attributeValue=application.getAttributeValue().split(",");
ExtraAttrs extraAttrs=new ExtraAttrs();
for(int i=0;i<attributes.length;i++){
extraAttrs.put(attributes[i], attributeValue[i]);
}
application.setExtendAttr(extraAttrs.toJsonString());
}
}
}
......@@ -271,7 +271,8 @@ apps.adapter=\u9002\u914D\u5668
apps.extendAttr=\u6269\u5C55\u5C5E\u6027
apps.isExtendAttr=\u914D\u7F6E\u6269\u5C55\u5C5E\u6027
apps.extendAttr.parameter=\u53C2\u6570
apps.extendAttr.parameter.value=\u53C2\u6570\u503C
apps.extendAttr.parameter.type=\u7C7B\u578B
apps.extendAttr.parameter.value=\u503C
apps.principal=\u51ED\u8BC1
apps.credentials=\u79D8\u94A5
......@@ -381,6 +382,7 @@ account.relatedPassword=\u8D26\u53F7\u5BC6\u7801
button.text.action=\u8BBF\u95EE
button.text.visit=\u8BBF\u95EE
button.text.save=\u4FDD\u5B58
button.text.close=\u5173\u95ED
button.text.add=\u65B0\u589E
button.text.edit=\u7F16\u8F91
button.text.delete=\u5220\u9664
......
......@@ -269,6 +269,7 @@ apps.adapter=adapter
apps.extendAttr=extendAttr
apps.isExtendAttr=isExtendAttr
apps.extendAttr.parameter=parameter
apps.extendAttr.parameter.type=type
apps.extendAttr.parameter.value=value
apps.principal=principal
apps.credentials=credentials
......@@ -279,8 +280,7 @@ apps.formbased.redirectUri=redirectUri
apps.formbased.usernameMapping=usernameMapping
apps.formbased.passwordMapping=passwordMapping
apps.formbased.authorizeView=authorizeView
apps.formbased.parameter=parameter
apps.formbased.parameter.value=value
#cas
apps.cas.info=CAS Info
apps.cas.service=service
......@@ -382,6 +382,7 @@ button.text.add=Add
button.text.edit=Edit
button.text.delete=Delete
button.text.save=Save
button.text.close=Close
button.text.select=Select
button.text.search=Search
button.text.expandsearch=Expand
......
......@@ -83,8 +83,19 @@
<option value="3" <#if 3==model.visible!>selected</#if> ><@locale code="apps.visible.intranet"/></option>
</select>
</td>
<th><@locale code="common.text.description"/>:</th>
<th><@locale code="apps.extendAttr"/></th>
<td>
<input class="button btn btn-success mr-3 window" style="float: left;" id="addExtendAttrBtn" type="button"
value="<@locale code="button.text.select"/>"
wurl="<@base/>/apps/forwardAppsExtendAttr/${model.id!}"
wwidth="900"
wheight="650"
target="window">
</td>
</tr>
<tr>
<th><@locale code="common.text.description"/>:</th>
<td colspan =3>
<input type="text" class="form-control" id="description" name="description" title="" value="${model.description!}"/>
</td>
</tr>
......
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "../layout/header.ftl"/>
<#include "../layout/common.cssjs.ftl"/>
<style>
<!--
-->
</style>
<script type="text/javascript">
<!--
$(function(){
var attrIndex = 0;
function addExtendAttr(attribute,attributeType,attributeValue){
var html = '<tr id="extendTr_' + attrIndex + '">';
//Index
html += '<th nowrap ><@locale code="apps.extendAttr.parameter"/>:';
html += '<input class="button delExtendTr" type="button" name="delExtendTr" attrTrId="extendTr_'+attrIndex+'" value="<@locale code="button.text.delete" />"/>';
html += '</th>';
//attribute
html += '<td>';
html += '<input type="text" class="form-control" id="attribute_' + attrIndex + '" name="attr" class="int" title="" value="'+attribute+'"/>';
html += '</span></td>';
//attributeType
html += '<th nowrap ><@locale code="apps.extendAttr.parameter.type"/>:</th> <td><span class="intspan">';
html += '<input type="text" class="form-control" id="attributeType_' + attrIndex + '" name="type" class="int" title="" value="'+attributeType+'"/>';
html += '</span></td>';
//attributeValue
html += '<th nowrap ><@locale code="apps.extendAttr.parameter.value"/>:</th> <td><span class="intspan">';
html += '<input type="text" class="form-control" id="attributeValue_' + attrIndex + '" name="value" class="int" title="" value="'+attributeValue+'"/>';
html += '</span></td>';
html += '</tr>';
$('#extendAttrBody').append(html);
attrIndex++;
}
<#if 1==model.isExtendAttr>
var extendAttrJson = eval("("+'${model.extendAttr}'+")");
for(extendAttrIndex in extendAttrJson){
addExtendAttr(extendAttrJson[extendAttrIndex].attr,extendAttrJson[extendAttrIndex].type,extendAttrJson[extendAttrIndex].value);
};
</#if>
$("#addExtendAttr").on('click',function(){
addExtendAttr("","","");
});
$("#extendAttrBody").delegate(".delExtendTr",'click',function(){
$("#"+$(this).attr("attrTrId")).remove();
});
});
</script>
</head>
<body>
<form id="actionForm" method="post" type="label" autoclose="true"
action="<@base/>/apps/updateExtendAttr">
<!-- content -->
<!--table-->
<table class="table table-bordered" >
<tbody>
<tr>
<th style="width:15%;"><@locale code="apps.id"/></th>
<td style="width:35%;">
<div style="width:100%;font-weight: bold;">${model.id!}</div>
<input type="hidden" id="id" name="id" title="" value="${model.id!}"/>
</td>
<th><@locale code="apps.name"/></th>
<td colspan="3">
<div style="width:100%;font-weight: bold;">${model.name!}</div>
</td>
</tr>
<tr>
<th><@locale code="apps.extendAttr"/></th>
<td colspan="3">
<input type="checkbox" id="isExtendAttr" name="isExtendAttr" value="1" <#if 1==model.isExtendAttr>checked</#if> />
<@locale code="apps.isExtendAttr"/>
</td>
<td colspan="2">
<input class="button btn btn-primary mr-3" type="button" value='<@locale code="button.text.add"/>' id="addExtendAttr"/>
<input class="button btn btn-primary mr-3" id="submitBtn" type="submit" value="<@locale code="button.text.save" />"/>
<input class="button btn btn-secondary mr-3" id="closeBtn" type="button" value="<@locale code="button.text.close" />"/>
</td>
</tr>
</tbody>
<tbody >
<tr>
<td colspan =6>
<table class="table table-bordered" >
<tbody id="extendAttrBody">
</tbody>
</table>
</tr>
</tbody>
</table>
</form>
</body>
</html>
\ No newline at end of file
......@@ -60,8 +60,6 @@ $(function(){
$("#systemconfigure").hide();
}
});
$("#protocol_text").html("<%=PROTOCOLS.DESKTOP%>");
$("#protocol").val("<%=PROTOCOLS.DESKTOP%>");
});
//-->
</script>
......
......@@ -13,40 +13,7 @@
<script type="text/javascript">
<!--
$(function(){
$("#isExtendAttr").on('click',function(){
if(this.checked){
$("#showExtendAttr").show();
} else {
$("#showExtendAttr").hide();
$('#extendAttrBody').empty();
}
});
var attrIndex = 0;
function addExtendAttr(attribute,attributeValue){
var html = '<tr id="extendTr_' + attrIndex + '"><th><@locale code="common.text.parameter"/>:';
html += '<input class="button delExtendTr" type="button" name="delExtendTr" attrTrId="extendTr_'+attrIndex+'" value="<@locale code="button.text.delete" />"/>';
html += '</th><td>';
html += '<input type="text" id="attribute_' + attrIndex + '" name="attribute" class="int" title="" value="'+attribute+'"/>';
html += '</span></td><th><@locale code="common.text.parameter.value"/>:</th> <td><span class="intspan">';
html += '<input type="text" id="attributeValue_' + attrIndex + '" name="attributeValue" class="int" title="" value="'+attributeValue+'"/>';
html += '</span>';
html += '</td></tr>';
$('#extendAttrBody').append(html);
attrIndex++;
}
$("#addExtendAttr").on('click',function(){
addExtendAttr("","");
});
$("#extendAttrBody").delegate(".delExtendTr",'click',function(){
$("#"+$(this).attr("attrTrId")).remove();
});
$(".credential").on("click",function(){
if($(this).val()=="3"){
$("#sharedconfigure").hide();
......@@ -71,24 +38,24 @@ $(function(){
enctype="multipart/form-data">
<!-- content -->
<!--table-->
<table class="datatable" >
<table class="table table-bordered" >
<tbody>
<tr>
<td ><#include "../appAddCommon.ftl"/></td>
</tr>
<tr>
<td>
<table class="datatable" >
<table class="table table-bordered" >
<tbody>
<tr>
<th ><@locale code="apps.principal"/></th>
<td >
<input type="text" id="principal" name="principal" title="" value=""/>
<input class="form-control" type="text" id="principal" name="principal" title="" value=""/>
<b class="orange">*</b><label for="principal"></label>
</td>
<th ><@locale code="apps.credentials"/></th>
<td >
<input type="text" id="credentials" name="credentials" title="" value=""/>
<input class="form-control" type="text" id="credentials" name="credentials" title="" value=""/>
<b class="orange">*</b><label for="credentials"></label>
</td>
</tr>
......@@ -105,7 +72,7 @@ $(function(){
</td>
<th style="width:15%;"><@locale code="apps.isAdapter"/></th>
<td style="width:35%;">
<select id="isAdapter" name="isAdapter" >
<select class="form-control" id="isAdapter" name="isAdapter" >
<option value="0" selected><@locale code="apps.isAdapter.no"/></option>
<option value="1"><@locale code="apps.isAdapter.yes"/></option>
</select>
......@@ -114,13 +81,13 @@ $(function(){
<tr>
<th><@locale code="apps.adapter"/></th>
<td colspan =3>
<input type="text" id="adapter" name="adapter" title="" value=""/>
<input class="form-control" type="text" id="adapter" name="adapter" title="" value=""/>
</td>
</tr>
<tr id="systemconfigure" style="display:none">
<th><@locale code="apps.systemUserAttr"/></th>
<td colspan="3">
<select id="systemUserAttr" name="systemUserAttr">
<select class="form-control" id="systemUserAttr" name="systemUserAttr">
<option value="uid">
<@locale code="userinfo.uid"/></option>
<option value="employeeNumber">
......@@ -138,27 +105,15 @@ $(function(){
<tr id="sharedconfigure" style="display:none">
<th><@locale code="apps.formbased.sharedUsername"/></th>
<td>
<input type="text" id="sharedUsername" name="sharedUsername" value="" />
<input class="form-control" type="text" id="sharedUsername" name="sharedUsername" value="" />
<b class="orange">*</b><label for="sharedUsername"></label>
</td>
<th><@locale code="apps.formbased.sharedPassword"/></th>
<td>
<input type="text" id="sharedPassword" name="sharedPassword" value="" />
<input class="form-control" type="text" id="sharedPassword" name="sharedPassword" value="" />
<b class="orange">*</b><label for="sharedPassword"></label>
</td>
</tr>
<tr>
<th><@locale code="apps.formbased.extendAttr"/></th>
<td colspan="3">
<input type="checkbox" id="isExtendAttr" name="isExtendAttr" value="1"/>
<@locale code="apps.formbased.isExtendAttr"/>
<span id="showExtendAttr" style="display:none">
<input class="button" type="button" value='<@locale code="button.text.add.parameter"/>' id="addExtendAttr"/>
</span>
</td>
</tr>
</tbody>
<tbody id="extendAttrBody">
</tbody>
<tr>
<td colspan =4>
......
......@@ -19,46 +19,6 @@ $(function(){
});
});
$("#isExtendAttr").on('click',function(){
if(this.checked){
$("#showExtendAttr").show();
} else {
$("#showExtendAttr").hide();
$('#extendAttrBody').empty();
}
});
var attrIndex = 0;
function addExtendAttr(attribute,attributeValue){
var html = '<tr id="extendTr_' + attrIndex + '"><th><@locale code="apps.extendAttr.parameter"/>:';
html += '<input class="button delExtendTr" class="form-control" type="button" name="delExtendTr" attrTrId="extendTr_'+attrIndex+'" value="<@locale code="button.text.delete" />"/>';
html += '</th><td>';
html += '<input type="text" id="attribute_' + attrIndex + '" class="form-control" name="attribute" class="int" title="" value="'+attribute+'"/>';
html += '</span></td><th><@locale code="apps.extendAttr.parameter.value"/>:</th> <td><span class="intspan">';
html += '<input type="text" id="attributeValue_' + attrIndex + '" class="form-control" name="attributeValue" class="int" title="" value="'+attributeValue+'"/>';
html += '</span>';
html += '</td></tr>';
$('#extendAttrBody').append(html);
attrIndex++;
}
<#if 1==model.isExtendAttr >
var extendAttrJson = eval("("+'${model.extendAttr}'+")");
for(extendAttrIndex in extendAttrJson){
addExtendAttr(extendAttrJson[extendAttrIndex].attr,extendAttrJson[extendAttrIndex].value);
};
</#if>
$("#addExtendAttr").on('click',function(){
addExtendAttr("","");
});
$("#extendAttrBody").delegate(".delExtendTr",'click',function(){
$("#"+$(this).attr("attrTrId")).remove();
});
$("input[name='credential']").on("click",function(){
if($(this).val()=="3"){
$("#sharedconfigure").hide();
......@@ -157,18 +117,7 @@ $(function(){
</td>
</tr>
<tr>
<th><@locale code="apps.extendAttr"/></th>
<td colspan="3">
<input type="checkbox" id="isExtendAttr" name="isExtendAttr" value="1" <#if 1==model.isExtendAttr >checked</#if> />
<@locale code="apps.isExtendAttr"/>
<span id="showExtendAttr" <#if 0==model.isExtendAttr >style="display:none"</#if>>
<input class="button" type="button" value='<@locale code="button.text.add"/>' id="addExtendAttr"/>
</span>
</td>
</tr>
</tbody>
<tbody id="extendAttrBody">
</tbody>
</table>
</td>
......
......@@ -19,49 +19,6 @@ $(function(){
});
});
$("#isExtendAttr").on('click',function(){
if(this.checked){
$("#showExtendAttr").show();
} else {
$("#showExtendAttr").hide();
$('#extendAttrBody').empty();
}
});
var attrIndex = 0;
function addExtendAttr(attribute,attributeValue){
var html = '<tr id="extendTr_' + attrIndex + '">';
html += '<th><@locale code="apps.formbased.parameter"/>:';
html += '<input class="button delExtendTr" type="button" name="delExtendTr" attrTrId="extendTr_'+attrIndex+'" value="<@locale code="button.text.delete" />"/>';
html += '</th>';
html += '<td>';
html += '<input type="text" class="form-control" id="attribute_' + attrIndex + '" name="attribute" class="int" title="" value="'+attribute+'"/>';
html += '</span></td>';
html += '<th><@locale code="apps.formbased.parameter.value"/>:</th> <td><span class="intspan">';
html += '<input type="text" class="form-control" id="attributeValue_' + attrIndex + '" name="attributeValue" class="int" title="" value="'+attributeValue+'"/>';
html += '</span></td>';
html += '</tr>';
$('#extendAttrBody').append(html);
attrIndex++;
}
<#if 1==model.isExtendAttr>
var extendAttrJson = eval("("+'${model.extendAttr}'+")");
for(extendAttrIndex in extendAttrJson){
addExtendAttr(extendAttrJson[extendAttrIndex].attr,extendAttrJson[extendAttrIndex].value);
};
</#if>
$("#addExtendAttr").on('click',function(){
addExtendAttr("","");
});
$("#extendAttrBody").delegate(".delExtendTr",'click',function(){
$("#"+$(this).attr("attrTrId")).remove();
});
$("input[name='credential']").on("click",function(){
if($(this).val()=="3"){
$("#sharedconfigure").hide();
......@@ -177,19 +134,6 @@ $(function(){
</td>
</tr>
<tr>
<th><@locale code="apps.extendAttr"/></th>
<td colspan="3">
<input type="checkbox" id="isExtendAttr" name="isExtendAttr" value="1" <#if 1==model.isExtendAttr>checked</#if> />
<@locale code="apps.isExtendAttr"/>
<span id="showExtendAttr" <#if 0==model.isExtendAttr>style="display:none"</#if>>
<input class="button" type="button" value='<@locale code="button.text.add"/>' id="addExtendAttr"/>
</span>
</td>
</tr>
</tbody>
<tbody id="extendAttrBody">
</tbody>
<tbody >
<tr>
<td colspan =4>
......
......@@ -128,9 +128,14 @@ $(function(){
<b class="orange">*</b><label for="fileType"></label>
</td>
<th><@locale code="apps.saml.certMetaFile" /></th>
<td>
<input class="form-control" id="certMetaFile" type="file" name="certMetaFile" />
<b class="orange">*</b><label for="certMetaFile"></label>
<td nowrap >
<div style="float: left;">
<img id="certMetaFileImg" height="40" width="80" alt="upload certificate or metadata file" src="<@base />/static/images/cert.png">
</div>
<div style="float: left; width: 250px;">
<input class="form-control" id="certMetaFile" type="file" name="certMetaFile" />
<b class="orange">*</b><label for="certMetaFile"></label>
</div>
</td>
</tr>
......
......@@ -134,7 +134,7 @@ $(function(){
</td>
<th><@locale code="apps.saml.certMetaFile" /></th>
<td>
<img id="certMetaFileImg" height="32" alt="upload certificate or metadata file" src="<s:Base/>/images/cert.png">
<img id="certMetaFileImg" height="40" width="80" alt="upload certificate or metadata file" src="<@base />/static/images/cert.png">
<b class="orange">*</b><label for="certMetaFile"></label>
</td>
</tr>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册