Permalink
Browse files

bigslides: listado de directorios. Imp no terminada

  • Loading branch information...
serman committed Mar 5, 2012
1 parent 84d1283 commit c51b7e1bb910537ed7d6c83d5ae5f7b82e0d8158
View
@@ -11,7 +11,8 @@
import cherrypy
import simplejson
import string
-
+import os
+import json;
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates'))
@@ -56,7 +57,10 @@ def getAction(self):
cherrypy.response.headers['Content-Type']= 'text/event-stream; charset=utf-8 \n\n'
tmp_order = self.order;
self.order = "none"
- return "data:"+ tmp_order +"\n\n"
+ if (tmp_order=="change"):
+ return self.returnFolder()
+ else:
+ return "data:"+ tmp_order +"\n\n"
#lo que recibe del control remoto
@@ -71,8 +75,40 @@ def setOrder(self, mAction = None):
return 'No1'
else:
return 'No2'
-
+ #control: List team foldersgetTeams
+ @cherrypy.expose
+ def getTeams(self):
+ dirs=[]
+ for dirname, dirnames, filenames in os.walk('./static/presentation/contenidos/'):
+ dirs.append(dirname)
+ return json.dumps(dirs)
+
+ #control: list folders for each time
+ @cherrypy.expose
+ def getFolder(self,team):
+ dirs=[]
+ for dirname, dirnames, filenames in os.walk('./static/presentation/contenidos/'+team):
+ dirs.append(dirname)
+ return json.dumps(dirs)
+
+ #control: set current folder on screen
+ @cherrypy.expose
+ def setFolder(self,path):
+ self.current_path=path
+ self.order="change"
+
+ def returnFolder(self):
+ print "returnFOLDER------------------"
+ n_slides=0
+ for dirname, dirnames, filenames in os.walk('./static/presentation/contenidos/'+self.current_path):
+ n_slides+=1
+ cherrypy.response.headers['Content-Type']= 'text/event-stream; charset=utf-8 \n\n'
+ msg="event: change\n"
+ msg+= 'data: {"path": "'+self.current_path+'", "slides":"'+str(n_slides) +'"} \n\n'
+ print msg
+
+ return msg
#codigo recibido de los clientes
@cherrypy.expose
@@ -0,0 +1,31 @@
+<html>
+<head>
+ <meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" />
+ <meta name="viewport" content="user-scalable=no, width=device-width" />
+ <link rel='stylesheet' href='http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css' />
+ <script type='text/javascript' src='http://code.jquery.com/jquery-1.5.min.js'></script>
+ <script type='text/javascript' src='http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js'></script>
+
+ <script type="text/javascript">
+ function order(mOrder){
+ $.getJSON('/setOrder?mAction=' + mOrder , function(data) {
+ console.log(data)
+ })
+ }
+
+
+ </script>
+</head>
+
+<body >
+ <div data-role='page'>
+ <div data-role='content' >
+ <div data-role="controlgroup" data-type="horizontal">
+ <!-- cuando se clica enviamos la orden al servidor -->
+ <a href="#" onclick="javascript:order('next')" data-role="button">next </a>
+ <a href="#" onclick="javascript:order('prev')" data-role="button">prev </a>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
@@ -0,0 +1,48 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" context="text/html; charset=UTF-8">
+<!-- <link href="js/jquery-ui-1.8.13.custom.css" rel="stylesheet" type="text/css"/> -->
+ <script type="text/javascript" src="./js/jquery-1.7.1.min.js"></script>
+ <script type="text/javascript" src="./js/jquery-ui-1.8.13.custom.min.js"></script>
+ <script src="./js/modoDemo.js" type="text/javascript"></script>
+
+ <link rel="stylesheet" href="./css/pantalla.css" type="text/css" media="screen" charset="utf-8">
+
+
+
+
+ </head>
+
+<html>
+<div id="screen">
+<div id="topbar" class="commonElement">
+BIG GAMES
+</div>
+<div id="middlebar" class="commonElement">
+<p style="margin-top:4px; color:pink; text-decoration: blink;">
+EXAMPLES
+</p>
+</div>
+<div id="contentbar" class="commonElement">
+
+</div>
+
+</div>
+<div id="content">
+<h2 id="status">
+ 0, 0
+</h2>
+<button onclick="javascript:goTo(1)"> start </button>
+<button onclick="javascript:goTo(2)"> b </button>
+<button onclick="javascript:goTo(3)"> c </button>
+</div>
+
+<div id="otherSlides">
+<div id="n_1" class="currentSlide">a </div>
+
+<div id="n_2" class="slide"> b</div>
+
+<div id="n_3" class="slide"> c</div>
+</div>
+
+</html>
@@ -0,0 +1,48 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" context="text/html; charset=UTF-8">
+<!-- <link href="js/jquery-ui-1.8.13.custom.css" rel="stylesheet" type="text/css"/> -->
+ <script type="text/javascript" src="./js/jquery-1.7.1.min.js"></script>
+ <script type="text/javascript" src="./js/jquery-ui-1.8.13.custom.min.js"></script>
+ <script src="./js/modoDemo.js" type="text/javascript"></script>
+
+ <link rel="stylesheet" href="./css/pantalla.css" type="text/css" media="screen" charset="utf-8">
+
+
+
+
+ </head>
+
+<html>
+<div id="screen">
+<div id="topbar" class="commonElement">
+BIG GAMES
+</div>
+<div id="middlebar" class="commonElement">
+<p style="margin-top:4px; color:pink; text-decoration: blink;">
+EXAMPLES
+</p>
+</div>
+<div id="contentbar" class="commonElement">
+
+</div>
+
+</div>
+<div id="content">
+<h2 id="status">
+ 0, 0
+</h2>
+<button onclick="javascript:goTo(1)"> start </button>
+<button onclick="javascript:goTo(2)"> b </button>
+<button onclick="javascript:goTo(3)"> c </button>
+</div>
+
+<div id="otherSlides">
+<div id="n_1" class="currentSlide">a </div>
+
+<div id="n_2" class="slide"> b</div>
+
+<div id="n_3" class="slide"> c</div>
+</div>
+
+</html>
@@ -0,0 +1,76 @@
+
+MAX_SLIDE=3
+jQuery(document).ready(function(){
+ $('#screen').mousemove(function(e){
+ $('#status').html( e.pageX +', '+ e.pageY);
+ })
+
+ arrange_slides();
+ stListener();
+ goTo(1)
+ MAX_SLIDE=3
+});
+
+function pullNewSlides(){
+
+total_slides
+
+}
+
+function arrange_slides() {
+ //console.log('arrangeslide')
+ $('.slide').each(function(index) {
+ $(this).css('top',196+10+index*166 + 'px');
+ }
+)}
+
+function goTo(n_slide){
+ $('#otherSlides').append($('.currentSlide'))
+ $('.currentSlide').switchClass('currentSlide','slide',0)
+/* $('#contentbar').empty() */
+
+ //slide should be on and curentSlide off now
+ arrange_slides();
+ $('#n_'+n_slide).switchClass('slide','currentSlide',0);
+ $('.currentSlide').hide();
+
+ $('#contentbar').append($('.currentSlide'));
+ $('.currentSlide').show('clip',1000);
+ current_slide = n_slide;
+}
+
+function stListener(){
+ source = new EventSource('../../getAction')
+ source.onmessage = function (event) {
+ //setTimeout(this.send, 825);
+ if(event.data=='next'){
+ next();
+ console.log(event.data);
+ } else if(event.data=='prev') {
+ prev();
+ console.log(event.data);
+ }
+ console.log(event);
+
+ };
+
+ source.addEventListener("change", function( e ) {
+ console.log(e.data);
+ console.log(JSON.parse(e.data) );
+
+ }, false);
+}
+
+function next() {
+ if(current_slide==MAX_SLIDE)
+ return
+ else
+ goTo(current_slide+1)
+}
+
+function prev() {
+ if(current_slide==1)
+ return
+ else
+ goTo(current_slide-1)
+}
@@ -62,5 +62,5 @@ function prev() {
if(current_slide==1)
return
else
- goTo(current_slide+1)
+ goTo(current_slide-1)
}

0 comments on commit c51b7e1

Please sign in to comment.