Index: controlies/trunk/applications/controlies/models/db.py
===================================================================
--- controlies/trunk/applications/controlies/models/db.py	(revision 186)
+++ controlies/trunk/applications/controlies/models/db.py	(revision 187)
@@ -145,3 +145,17 @@
     l=LdapConnection.LdapConnection(session)
     l.process()
     return l
+
+def right_firefox_version(user_agent):
+    right=True
+    if "Mozilla" in user_agent:
+        k=user_agent.split("Firefox/")
+        if len(k)<2 : k=user_agent.split("Iceweasel/")
+        if len(k)>1:
+            version=k[1].split()[0]
+            if version <"4.0": right=False #firefox<4
+    return right
+
+            
+    
+    
Index: controlies/trunk/applications/controlies/controllers/gestion.py
===================================================================
--- controlies/trunk/applications/controlies/controllers/gestion.py	(revision 186)
+++ controlies/trunk/applications/controlies/controllers/gestion.py	(revision 187)
@@ -42,6 +42,9 @@
 @auth.requires_login()    
 def rayuela():
     import StringIO
+
+    right_version=right_firefox_version(request.env.http_user_agent)
+
     if not "archivos" in session.keys():
         session.archivos=[]    
     form=SQLFORM.factory(Field('principiocurso','boolean',default=False ),submit_button='Enviar')
@@ -92,7 +95,7 @@
         session.archivos=[]
   
     
-    return dict(form=form)
+    return dict(form=form,right_version=right_version)
 
 
 
@@ -104,9 +107,11 @@
 # Used for file upload (with multiple file up) + Need rework (too much queries
 #
 ###################################################
+
     if "archivos" not in session.keys():archivos=[]
+  
     for r in request.vars:
-        if r=="qqfile":
+        if r=="qqfile" or r=="userfile":
             try:
                 size = 0
                 #
@@ -122,7 +127,10 @@
                 
            
             parentpath="/tmp/"
-            file=request.vars.qqfile
+            if r=="qqfile":
+                file=request.vars.qqfile
+            else:
+                file=request.vars.userfile.filename
             logger.debug('New file uploading : ' + file)
             #
             # Re-arange file
@@ -130,7 +138,11 @@
             filename=file.replace(' ','_')
             filepath=parentpath+filename
             f = open(filepath, 'wb')
-            data=request.body.read()
+            if r=="qqfile":
+                data=request.body.read()
+            else:
+                data=request.vars.userfile.file.read()
+                
             f.write(data)
             f.close()
            
Index: controlies/trunk/applications/controlies/static/js/AjaxUpload.2.0.min.js
===================================================================
--- controlies/trunk/applications/controlies/static/js/AjaxUpload.2.0.min.js	(nonexistent)
+++ controlies/trunk/applications/controlies/static/js/AjaxUpload.2.0.min.js	(revision 187)
@@ -0,0 +1 @@
+(function(){var G=document,K=window;function D(O){if(typeof O=="string"){O=G.getElementById(O)}return O}function C(Q,P,O){if(K.addEventListener){Q.addEventListener(P,O,false)}else{if(K.attachEvent){var R=function(){O.call(Q,K.event)};Q.attachEvent("on"+P,R)}}}var B=function(){var O=G.createElement("div");return function(P){O.innerHTML=P;var Q=O.childNodes[0];O.removeChild(Q);return Q}}();function E(P,O){return P.className.match(new RegExp("(\\s|^)"+O+"(\\s|$)"))}function F(P,O){if(!E(P,O)){P.className+=" "+O}}function L(Q,O){var P=new RegExp("(\\s|^)"+O+"(\\s|$)");Q.className=Q.className.replace(P," ")}function M(O){if(K.jQuery){return jQuery(O).offset()}var Q=0,P=0;do{Q+=O.offsetTop||0;P+=O.offsetLeft||0}while(O=O.offsetParent);return{left:P,top:Q}}function A(Q){var S,P,R,O;var T=M(Q);S=T.left;R=T.top;P=S+Q.offsetWidth;O=R+Q.offsetHeight;return{left:S,right:P,top:R,bottom:O}}function I(O){if(!O.pageX&&O.clientX){return{x:O.clientX+G.body.scrollLeft+G.documentElement.scrollLeft,y:O.clientY+G.body.scrollTop+G.documentElement.scrollTop}}return{x:O.pageX,y:O.pageY}}var H=function(){var O=0;return function(){return"ValumsAjaxUpload"+O++}}();function N(O){return O.replace(/.*(\/|\\)/,"")}function J(O){return(/[.]/.exec(O))?/[^.]+$/.exec(O.toLowerCase()):""}(function(){var O=null;Ajax_upload=AjaxUpload=function(R,P){if(R.jquery){R=R[0]}else{if(typeof R=="string"&&/^#.*/.test(R)){R=R.slice(1)}}R=D(R);this._input=null;this._button=R;this._disabled=false;this._submitting=false;this._settings={action:"upload.php",name:"userfile",data:{},autoSubmit:true,onChange:function(S,T){},onSubmit:function(S,T){},onComplete:function(T,S){}};for(var Q in P){this._settings[Q]=P[Q]}this._createInput();this._rerouteClicks();if(!O){this._createIframe()}};AjaxUpload.prototype={setData:function(P){this._settings.data=P},disable:function(){this._disabled=true},enable:function(){this._disabled=false},set_data:function(P){this.setData(P)},_createInput:function(){var Q=this;var P=G.createElement("input");P.setAttribute("type","file");P.setAttribute("name",this._settings.name);var S={position:"absolute",margin:"-5px 0 0 -175px",padding:0,width:"220px",height:"10px",opacity:0,cursor:"pointer",display:"none"};for(var R in S){P.style[R]=S[R]}if(!(P.style.opacity==="0")){P.style.filter="alpha(opacity=0)"}G.body.appendChild(P);C(P,"change",function(){var T=N(this.value);if(Q._settings.onChange.call(Q,T,J(T))==false){return }if(Q._settings.autoSubmit){Q.submit()}});this._input=P},_rerouteClicks:function(){var P=this;var Q,R=false;C(P._button,"mouseover",function(S){if(!P._input||R){return }R=true;Q=A(P._button)});C(document,"mousemove",function(T){var S=P._input;if(!S||!R){return }if(P._disabled){L(P._button,"hover");S.style.display="none";return }var U=I(T);if((U.x>=Q.left)&&(U.x<=Q.right)&&(U.y>=Q.top)&&(U.y<=Q.bottom)){S.style.top=U.y+"px";S.style.left=U.x+"px";S.style.display="block";F(P._button,"hover")}else{R=false;S.style.display="none";L(P._button,"hover")}})},_createIframe:function(){var P=H();_iframe=B('<iframe name="'+P+'" />');_iframe.id=P;_iframe.style.display="none";G.body.appendChild(_iframe)},submit:function(){var P=this,S=this._settings;if(this._input.value===""){return }var Q=N(this._input.value);if(!(S.onSubmit.call(this,Q,J(Q))==false)){var T=this._createForm();T.appendChild(this._input);T.submit();G.body.removeChild(T);T=null;this._input=null;this._createInput();var R=_iframe;C(R,"load",function(){var V=false;if(R.src=="about:blank"){if(V){R.remove()}return }var W=R.contentDocument?R.contentDocument:frames[R.id].document;var U=W.body.innerHTML;S.onComplete.call(P,Q,U);R.src="about:blank";V=true});this._createIframe()}else{this._input.value=""}},_createForm:function(){var Q=this._settings;var R=B('<form method="post" enctype="multipart/form-data"></form>');R.style.display="none";R.action=Q.action;R.target=_iframe.name;G.body.appendChild(R);for(var S in Q.data){var P=G.createElement("input");P.type="hidden";P.name=S;P.value=Q.data[S];R.appendChild(P)}return R}}})()})();
\ No newline at end of file
Index: controlies/trunk/applications/controlies/static/images/boton.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: controlies/trunk/applications/controlies/static/images/boton.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: controlies/trunk/applications/controlies/static/css/AjaxUpload.css
===================================================================
--- controlies/trunk/applications/controlies/static/css/AjaxUpload.css	(nonexistent)
+++ controlies/trunk/applications/controlies/static/css/AjaxUpload.css	(revision 187)
@@ -0,0 +1,20 @@
+/* CSS Document */
+body {
+	font-family:Verdana, Arial, Helvetica, sans-serif;
+	font-size:12px;
+	color:#333333;
+}
+#upload_button {
+	width:120px;
+	height:35px;
+	text-align:center;
+	background-image:url(images/boton.png);
+	color:#CCCCCC;
+	font-weight:bold;
+	padding-top:15px;
+	margin:auto;
+	cursor:pointer;
+}
+#upload_button:hover{
+	color:#FFFFFF;
+}
Index: controlies/trunk/applications/controlies/views/gestion/rayuela.html
===================================================================
--- controlies/trunk/applications/controlies/views/gestion/rayuela.html	(revision 186)
+++ controlies/trunk/applications/controlies/views/gestion/rayuela.html	(revision 187)
@@ -1,5 +1,11 @@
-{{response.files.append(URL('static','js/fileuploader.css'))}}
-{{response.files.append(URL('static','js/fileuploader.js'))}}
+{{if right_version:}}
+    
+    {{response.files.append(URL('static','js/fileuploader.js'))}}
+{{else:}}
+    {{response.files.append(URL('static','css/AjaxUpload.css'))}}
+    {{response.files.append(URL('static','js/AjaxUpload.2.0.min.js'))}}
+{{pass}}
+
 {{extend 'layout.html'}}
    
 <p><h1>Importación de datos de alumnos y profesores desde Rayuela</h1><p>
@@ -38,15 +44,19 @@
 <center>
 <br/>
 
+{{if right_version:}}
+    <div id="file-upload">
+      <noscript>
+        <p>Please enable JavaScript to use file uploader.</p>
+      </noscript>
+      
+    </div>
+{{else:}}
+    <div id="upload_button">Subir un fichero</div>
+    <ul id="lista">
+    </ul>
+{{pass}}
 
-<div id="file-upload">
-  <noscript>
-    <p>Please enable JavaScript to use file uploader.</p>
-  </noscript>
-  
-</div>
-
-
 <h3>Pulse Enviar después de que el archivo o archivos hayan terminado de subir al servidor</h3>
 
 {{=form.custom.begin}}
@@ -104,8 +114,8 @@
 generar inmediatamente las carpetas, basta con ejecutar el script <i>crearCarpetas</i>
 en el servidor de NFS.
 
+{{if right_version:}}
 
-
 <script type="text/javascript">
   function createUploader(){            
      var uploader = new qq.FileUploader({
@@ -131,3 +141,36 @@
   }
   window.onload = createUploader;     
 </script>
+
+
+{{else:}}
+<script language="javascript">
+$(document).ready(function(){
+    var button = $('#upload_button'), interval;
+    new AjaxUpload('#upload_button', {
+        action:  '{{=URL("subida_rayuela")}}',
+        onSubmit : function(file , ext){
+        if (! (ext && /^(zip|xml)$/.test(ext))){
+            // extensiones permitidas
+            alert('Error: Tiene una extensión incorrecta. Sólo se permiten estas extensiones: xml, zip');
+            // cancela upload
+            return false;
+        } else {
+                       //Cambio el texto del boton y lo deshabilito
+            button.text('Subiendo fichero');
+            this.disable();
+        }
+        },
+        onComplete: function(file, response){
+            button.text('Subir un fichero');
+            // habilito upload button                       
+            this.enable();          
+            // Agrega archivo a la lista
+            //$('#lista').appendTo('.files').text(file);
+             $( "<li ></li>" ).text( file ).appendTo( $('#lista'));
+        }   
+    });
+});
+</script>
+
+{{pass}}
