diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-01-31 10:43:35 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-01-31 10:43:35 +0000 |
| commit | fa96bd3f54454a541668d187d5c028a2a93febbe (patch) | |
| tree | a1e9bceb903b07caa66756bddda89f52c5c45b35 /frontends/php | |
| parent | 1befd8a039fbf1004abad8f12da0e9b83a71356f (diff) | |
- added IPv6 support to js lib (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5295 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/js/sbinit.js | 4 | ||||
| -rw-r--r-- | frontends/php/js/url.js | 37 |
2 files changed, 30 insertions, 11 deletions
diff --git a/frontends/php/js/sbinit.js b/frontends/php/js/sbinit.js index 52248ca5..9e7f4218 100644 --- a/frontends/php/js/sbinit.js +++ b/frontends/php/js/sbinit.js @@ -73,11 +73,13 @@ function graphsubmit(){ var scrl = $('scroll'); scrl.style.display = 'none'; + var uri = new url(location.href); uri.setArgument('stime', SCROLL_BAR.getsTime()); uri.setArgument('period', SCROLL_BAR.getPeriod()); location.href = uri.getUrl(); + } function gmenuload(){ @@ -157,7 +159,7 @@ function sboxload(){ uri.setArgument('stime', stime); uri.setArgument('period', this.period); - + location.href = uri.getUrl(); } diff --git a/frontends/php/js/url.js b/frontends/php/js/url.js index 07ef5bf7..b2d5c7e8 100644 --- a/frontends/php/js/url.js +++ b/frontends/php/js/url.js @@ -37,10 +37,26 @@ initialize: function(url){ } this.host=this.host.substring(atIndex+1); } - var portColonIndex=this.host.indexOf(':'); - if(portColonIndex>=0){ - this.port=this.host.substring(portColonIndex); - this.host=this.host.substring(0,portColonIndex); + + var host_ipv6 = this.host.indexOf(']'); + if(host_ipv6>=0){ + if(host_ipv6 < (this.host.length-1)){ + host_ipv6++; + var host_less = this.host.substring(host_ipv6); + + var portColonIndex=host_less.indexOf(':'); + if(portColonIndex>=0){ + this.port=host_less.substring(portColonIndex); + this.host=this.host.substring(0,host_ipv6); + } + } + } + else{ + var portColonIndex=this.host.indexOf(':'); + if(portColonIndex>=0){ + this.port=this.host.substring(portColonIndex); + this.host=this.host.substring(0,portColonIndex); + } } this.file=this.url.substring(protocolSepIndex+3); this.file=this.file.substring(this.file.indexOf('/')); @@ -95,13 +111,14 @@ return a; getUrl: function(){ var uri = (this.protocol.length > 0)?(this.protocol+'://'):''; - uri += (this.username.length > 0)?(this.username):''; - uri += (this.password.length > 0)?(':'+this.password):''; + uri += encodeURI((this.username.length > 0)?(this.username):''); + uri += encodeURI((this.password.length > 0)?(':'+this.password):''); uri += (this.host.length > 0)?(this.host):''; - uri += (this.path.length > 0)?(this.path):''; - uri += (this.query.length > 0)?('?'+this.query):''; - uri += (this.reference.length > 0)?('#'+this.reference):''; -return encodeURI(uri); + uri += encodeURI((this.path.length > 0)?(this.path):''); + uri += encodeURI((this.query.length > 0)?('?'+this.query):''); + uri += encodeURI((this.reference.length > 0)?('#'+this.reference):''); +// alert(uri.getProtocol()+' : '+uri.getHost()+' : '+uri.getPort()+' : '+uri.getPath()+' : '+uri.getQuery()); +return uri; }, setArgument: function(key,value){ |
