# HG changeset patch # User wycc # Date 1291060634 -28800 # Node ID eb371902086699406b8f3a8fb06c7ef02419a9e4 # Parent 16c69756ef5d09f65a9dd53d1d6597d40cf3865a Add support for the second level page. diff -r 16c69756ef5d -r eb3719020866 nodejs/examples/mce/epg.js --- a/nodejs/examples/mce/epg.js Tue Nov 30 03:52:43 2010 +0800 +++ b/nodejs/examples/mce/epg.js Tue Nov 30 03:57:14 2010 +0800 @@ -146,13 +146,42 @@ EPG.prototype.onLoad = function(res) { cats = res['ProgramCat']; this.pend = cats.length; + this.maincat = cats; for (i in cats) { c = cats[i]; httpGetFile(c['ProgramPIC'],'cat'+i+'.png',this); } } +EPG.prototype.getList=function(item,func) { + var epgsrv = http.createClient(8080, '211.23.50.144'); + var cmd = '{"Protocol":"EPG-CSP","Command":"SearchRequest","ProgramSub":"'+item.Category+'"}'; + var headers={ + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Host':'211.23.50.144:8080', + 'User-Agent':'MadButterfly', + 'Content-Type':'application/x-www-form-urlencoded' + }; + headers['Content-Length'] = cmd.length; + var request = epgsrv.request('POST', '/IPTV_EPG/EPGService.do?timestamp='+new Date().getTime(),headers); + var self = this; + sys.puts("aaaa"); + var js = ''; + request.write(cmd); + request.end(); + request.on('response', function(res) { + sys.puts("connected"); + res.on('data',function (data) { + js = js + data; + }); + res.on('end', function () { + res = JSON.parse(js); + sys.puts("parsed"); + func(); + }); + }); +} EPG.prototype.onInitDone=function() { if (this.loadCallback) this.loadCallback(); diff -r 16c69756ef5d -r eb3719020866 nodejs/examples/mce/main.svg --- a/nodejs/examples/mce/main.svg Tue Nov 30 03:52:43 2010 +0800 +++ b/nodejs/examples/mce/main.svg Tue Nov 30 03:57:14 2010 +0800 @@ -56,10 +56,10 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" - inkscape:cx="574.12471" + inkscape:cx="206.98185" inkscape:cy="483.73232" inkscape:document-units="px" - inkscape:current-layer="Layer 1s1841" + inkscape:current-layer="Layer 1s235" showgrid="false" inkscape:window-width="1680" inkscape:window-height="976" @@ -109,7 +109,7 @@ + style="display:none"> diff -r 16c69756ef5d -r eb3719020866 nodejs/examples/mce/mainmenu.js --- a/nodejs/examples/mce/mainmenu.js Tue Nov 30 03:52:43 2010 +0800 +++ b/nodejs/examples/mce/mainmenu.js Tue Nov 30 03:57:14 2010 +0800 @@ -16,6 +16,7 @@ var self = this; var epg = new EPG.EPG(); epg.registerInitDone(function() { self.init();}); + app.epg = epg; //self.init(); } MainMenu.prototype.init=function() @@ -127,12 +128,15 @@ MainMenu.prototype.key_enter=function() { + var self = this; var target = this.items[this.item]; - var sx = 500 - target.center.x; - var sy = 220 - target.center.y; - var an = new animate.shift(this.app,target,sx,sy); - var self = this; - animate.run([an],0,2.5,function() {self.changePage();}); + var an = new animate.scale(this.app, target, 1/1.1, 1/1.5); + animate.run([an], 0, 0.3,function() { + var sx = 259 - target.center.x; + var sy = 355 - target.center.y; + var an1 = new animate.shift(self.app,target,sx,sy); + animate.run([an1],0,1,function() {self.changePage(self.item);}); + }); for(i=0;i this.item) { @@ -149,8 +153,11 @@ } } -MainMenu.prototype.changePage=function() { +MainMenu.prototype.onNextPage=function() { this.app.changeScene(2); } +MainMenu.prototype.changePage=function(item) { + this.epg.getList(item,self.onNextPage()); +} exports.MainMenu=MainMenu;