Commit f931954b f931954bf98e17330bdbecb0134c4638a961a0d3 by root

save

1 parent 9fa4f8b8
Showing 42 changed files with 438 additions and 0 deletions
6e748c16d9079ce336611a59b511a693
\ No newline at end of file
60f8b8f393c8e7473c414f67fd4c0b33006d0ea1
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.0</version>
</project>
d01ad073eb3c61bddaf90f21f8fb5e75
\ No newline at end of file
c66ba2702c2a8a69db61929a82cdf400183083df
\ No newline at end of file
ecba97cfde9cdb328b90997bc3506f82
\ No newline at end of file
aa443ffb1efe591c851713884f0c5e66cf09dc01
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.1</version>
</project>
349be90bd54764dcaff9132517c4394c
\ No newline at end of file
9781a7bcd3d9bea91d36c86db1e69f82f5565ec5
\ No newline at end of file
8f34d0021feb122ba45a98947498e41e
\ No newline at end of file
4e7c2284eee3ca7a23acb7af05b1e93fac8202d7
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.2</version>
</project>
00d5b514394541b928d99955c6abd262
\ No newline at end of file
06fac3ddaa808258e618750132127adf72225f91
\ No newline at end of file
e4581e795b0be4fe7d996dc4e4706b74
\ No newline at end of file
7b2d2f13d18e612abc690d13e7274bdb1d4468f9
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.3</version>
</project>
5d77f14f1fb8d29b1d39da5eb0a87ace
\ No newline at end of file
b7f6771336e7598032f3341463d4f1c8cc508946
\ No newline at end of file
2c45f14dab6c4d905d4fceb1484b1956
\ No newline at end of file
e644cf48f61d417c71f53dc3990c5c8086b80d42
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.4</version>
</project>
4651b3978331f8c656d429c9aa6a89d8
\ No newline at end of file
7751ffe63a1e1d7d9a7997111d449f2ff697b3fb
\ No newline at end of file
3b8ca22c5c933274bbeb897ee5e02306
\ No newline at end of file
ff438544989c58e28f02ee3b5b3ee2be81563321
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<version>1.5</version>
</project>
6b33a2fc800d3fc8a28a9565ba974db6
\ No newline at end of file
157f839ee31faa1ea298cfbeddc3c9957285bc01
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.emercit</groupId>
<artifactId>proxymanager</artifactId>
<versioning>
<release>1.5</release>
<versions>
<version>1.0</version>
<version>1.1</version>
<version>1.2</version>
<version>1.3</version>
<version>1.4</version>
<version>1.5</version>
</versions>
<lastUpdated>20150716092042</lastUpdated>
</versioning>
</metadata>
3310adccea01105b5f5ef7361679cf7d
\ No newline at end of file
375d779bcb432886a15cc7e0f4441f09ac7e8be4
\ No newline at end of file
package org.emercit.devtools.app;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.*;
import javax.servlet.ServletContext;
import java.io.*;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Vector;
import org.emercit.proxymanager.model.ProxyBean;
import org.emercit.devtools.service.DnsService;
import org.emercit.devtools.service.ProxyService;
import org.emercit.dnsmanager.model.DnsBean;
@Controller
@RequestMapping("api")
public class ProxyController {
@RequestMapping(value = "proxy/all", method = RequestMethod.GET)
public @ResponseBody Vector<ProxyBean> getAllProxy() {
try {
return ProxyService.INSTANCE.getAllProxyBean();
}
catch(Exception e)
{
return null;
}
}
@RequestMapping(value="proxy/update" , method = RequestMethod.POST)
public @ResponseBody boolean update(@RequestBody ProxyBean[] beans) {
Vector<ProxyBean> dbs=new Vector<ProxyBean>();
for (ProxyBean d:beans) {
ProxyBean db=new ProxyBean();
db.setId(d.getId());
db.setProtocol(d.getProtocol());
db.setHost(d.getHost());
db.setPort(d.getPort());
db.setLogin(d.getLogin());
db.setPass(d.getPass());
db.setEnabled(d.getEnabled());
db.setAuth(d.getAuth());
dbs.add(db);
}
return ProxyService.INSTANCE.Upd(dbs);
}
/*
export http_proxy='http://user:password@prox-server:3128'
export https_proxy='http://user:password@prox-server:3128'
export ftp_proxy='http://user:password@prox-server:3128'
*/
/*
*
*/
}
package org.emercit.devtools.service;
import org.emercit.model.IPAddressValidator;
import java.util.Vector;
import org.emercit.proxymanager.model.ProxyBean;
import org.emercit.proxymanager.service.ProxyLinux;
import org.emercit.proxymanager.service.ProxyDBImpl;
public enum ProxyService {
INSTANCE;
private ProxyLinux proxylinux=new ProxyLinux();
private ProxyDBImpl proxydb=new ProxyDBImpl();
private Vector<String> vStr;
private Vector<ProxyBean> vPb;
public Vector<ProxyBean> getAllProxyBean() {
return proxydb.selectDb();
}
public boolean Upd(Vector<ProxyBean> beans) {
return proxylinux.Config(beans);
}
}
\ No newline at end of file
function setModelToForm(proxy) {
var form=Ext.getCmp("formproxy");
var fsProxy = form.down('#fs'+proxy.protocol);
if (proxy.enabled) {
fsProxy.checkboxCmp.setValue(true);
fsProxy.down('#'+proxy.protocol+'Adress').setValue(proxy.host);
fsProxy.down('#'+proxy.protocol+'Port').setValue(proxy.port);
var fsAuth = fsProxy.down('#fs'+proxy.protocol+'Auth');
if (proxy.auth) {
fsAuth.checkboxCmp.setValue(true);
fsAuth.down('#'+proxy.protocol+'Login').setValue(proxy.login);
fsAuth.down('#'+proxy.protocol+'Password').setValue(proxy.pass);
}else {
fsAuth.checkboxCmp.setValue(false);
}
}else {
fsProxy.checkboxCmp.setValue(false);
}
}
Ext.define('App.controller.Proxy', {
extend : 'Ext.app.Controller',
init : function() {
this.control({
'toolbar button[action=saveProxy]' : {
click : this.saveProxy
},
'toolbar button[action=loadProxy]': {
click : this.loadProxy
},
'mvvm-ProxyView': {
// selectionchange: this.gridSelectionChange,
// viewready: this.onViewReady,
// select: this.onRowSelect
}
});
this.loadProxy();
},
saveProxy:function() {
var records = [];
records.push(this.getModelFromForm(0,"http"));
records.push(this.getModelFromForm(1,"https"));
records.push(this.getModelFromForm(2,"ftp"));
var data=Ext.util.JSON.encode(records);
Ext.Ajax.request({
method: "POST",
url: 'api/proxy/update',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
params: data,
success: function(response, opts) {
var Ok = Ext.JSON.decode(response.responseText);
if (Ok) {
Ext.Msg.alert('Success', 'Сохранение выполнено успешно');
}else {
Ext.Msg.alert('Failure', 'Ошибка сохранения');
}
}, failure: function(response, opts) {
Ext.Msg.alert('Failure', 'Ошибка сохранения');
}
});
},
getModelFromForm:function (id,protocol) {
var host;
var port;
var login;
var pass;
var enabled;
var auth;
var proxy;
var formproxy=Ext.getCmp("formproxy");
var fsHttps = formproxy.down('#fs'+protocol);
enabled=fsHttps.checkboxCmp.getValue();
host=fsHttps.down('#'+protocol+'Adress').getValue();
port=fsHttps.down('#'+protocol+'Port').getValue();
var fsHttpsAuth=fsHttps.down('#fs'+protocol+'Auth');
auth=fsHttpsAuth.checkboxCmp.getValue();
login=fsHttpsAuth.down('#'+protocol+'Login').getValue();
pass=fsHttpsAuth.down('#'+protocol+'Password').getValue();
proxy = {
id:id,
protocol:protocol,
host:host,
port:parseInt(port),
login:login,
pass:pass,
enabled:enabled,
auth:auth
};
return proxy;
},
loadProxy:function() {
Ext.Ajax.request({
method: "GET",
url: 'api/proxy/all',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
success: function(response, opts) {
var result = Ext.JSON.decode(response.responseText);
for(var i in result){
this.setModelToForm(result[i]);
}
}, failure: function(response, opts) {
}
});
}
});