Changeset 5378 for lliurex-jclic-shared
- Timestamp:
- Jun 28, 2017, 1:55:49 PM (4 years ago)
- Location:
- lliurex-jclic-shared/trunk/fuentes/lliurex-jclic-shared.install-files/net/server-sync/share/jclic-aula
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-jclic-shared/trunk/fuentes/lliurex-jclic-shared.install-files/net/server-sync/share/jclic-aula/helper.py
r4455 r5378 11 11 12 12 name_zip=str(sys.argv[1]) 13 #name_zip="/home/lliurex/ mat_alh.jclic.zip"13 #name_zip="/home/lliurex/essent.jclic.zip" 14 14 extract_dir="/net/server-sync/share/jclic-aula/jclic_uploads" 15 15 dir_jclic_orig="/net/server-sync/share/jclic-aula/jclic_uploads/0rig_jclic" … … 17 17 index="index.html" 18 18 jclic_js="http://server/jclic-aula/jclic.min.js" 19 jclic_plugin="http://server/jclic-aula/jclicplugin.js" 20 jar_path_lib="http://server/jclic-aula/jars" 19 21 sufix=".lock" 20 22 … … 125 127 126 128 127 def index_write(extract_dira,indexa,title_in,jclic_js_path,name_jclic_used): 128 index_path=os.path.join(extract_dira, indexa) 129 130 html_str=""" 131 <!DOCTYPE html> 132 <html> 133 <head> 134 <meta charset="UTF-8"> 135 <title>%s</title> 136 <meta name="apple-mobile-web-app-capable" content="yes"> 137 <meta name="mobile-web-app-capable" content="yes"> 138 <meta name="application-name" content="%s"> 139 <link rel="shortcut icon" href="favicon.ico"> 140 <link rel="icon" sizes="16x16" href="favicon.ico"> 141 <link rel="icon" sizes="72x72" href="icon-72.png"> 142 <link rel="icon" sizes="192x192" href="icon-192.png"> 143 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 144 <script type="text/javascript" src="%s"></script> 145 </head> 146 <body style="margin:0"> 147 <div class ="JClic" data-project="%s"></div> 148 </body> 149 </html> 150 """%(title_in,title_in,jclic_js_path,name_jclic_used) 151 152 html_index=open(index_path, "w") 153 html_index.write(html_str) 154 html_index.close() 155 print "Created index.html in: %s"%index_path 129 def index_write(extract_dira,indexa,title_in,jclic_plugin_path,jar_path,name_jclic_used): 130 try: 131 index_path=os.path.join(extract_dira, indexa) 132 print index_path 133 print "dentro con %s %s %s %s"%(title_in,jclic_plugin_path,jar_path,name_jclic_used) 134 135 html_str=""" 136 <!DOCTYPE HTML PUBLIC> 137 <html> 138 <head> 139 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 140 <title>%s</title> 141 <script language="JavaScript" SRC="%s" type="text/javascript"></script> 142 </head> 143 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="window.focus();"> 144 <script language="JavaScript"> 145 <!-- 146 setJarBase('%s'); 147 setLanguage('null'); 148 writePlugin('%s', '100%%', '100%%'); 149 --> 150 </script> 151 </body> 152 </html> 153 """%(title_in,jclic_plugin_path,jar_path,name_jclic_used) 154 155 print "fin" 156 print "abriendo index path para escribir fichero en %s"%index_path 157 158 html_index=open(index_path, "w") 159 html_index.write(html_str) 160 html_index.close() 161 print "Created index.html in: %s"%index_path 162 163 except Exception as e: 164 print e 165 return [False,str(e)] 156 166 157 167 # def index_write … … 257 267 258 268 if dir_name.endswith(".jclic"): 259 dir_name=os.path.splitext(dir_name)[0] 269 dir_name=os.path.splitext(dir_name)[0] 260 270 extract_dir=os.path.join(extract_dir, dir_name) 261 271 262 272 263 273 print "-----------------------------------" 264 print " %s to HTML5"%name_zip274 print "Generating index.html for %s"%name_zip 265 275 print "-----------------------------------" 266 276 … … 268 278 if not os.path.exists (extract_dir): 269 279 os.makedirs(extract_dir) 280 281 os.system("setfacl -m group:www-data:rwx %s"%extract_dir) 282 os.system("setfacl -m default:group:www-data:rwx %s"%extract_dir) 270 283 271 284 if not os.path.exists (dir_jclic_orig): 272 285 os.makedirs(dir_jclic_orig) 273 274 # Extraccion de los ficheros del jclic286 287 #Busco el ficero jclic para saber el nombre real 275 288 with zipfile.ZipFile(name_zip,"r") as zip_file: 276 289 for member in zip_file.namelist(): 277 290 filename=os.path.basename(member) 278 291 #Me aseguro que no es una linea en blanco 279 if isNotEmpty(filename): 280 #transformamos mayusculas y espacios en minusculas y raya baja 281 filename=filename.replace(" ", "_").lower() 282 if filename == "index.html": 283 html5=True 284 filename=remove_utf8(filename) 285 source=zip_file.open(member) 286 target=file(os.path.join(extract_dir,filename), "wb") 287 shutil.copyfileobj(source, target) 288 289 290 #Averiguamos el fichero del jclic 291 for file in os.listdir(extract_dir): 292 if file.endswith(".jclic"): 293 name_jclic=file 294 print "name_jclic: %s"%name_jclic 295 296 extend_jclic=os.path.join(extract_dir, name_jclic) 297 292 if filename.endswith(".jclic"): 293 #print "tengo el fichero jclic: %s"%filename 294 tilte="Untiled" 295 with zip_file.open(filename) as f: 296 for line in f: 297 #obtengo el titulo del index 298 if "<title>" in line or "<Title>" in line: 299 title=title_file(line)[1] 300 301 302 303 304 if (title.lower()).strip() in ["","sin nombre", "sense nom"]: 305 title=dir_name 306 print "Titulo sin nombre" 307 308 print "Jclic Titulo: %s"%title 298 309 299 310 #Creacion del index.html 300 if not html5: 301 index_write(extract_dir,index,index_create(extend_jclic)[1],jclic_js,name_jclic) 302 303 304 305 #Modificando el fichero jclic con nuevas rutas 306 jclic_review (extend_jclic) 307 os.chmod(extend_jclic,0775) 308 #textito=os.path.dirname(name_zip) 309 #with open("/tmp/kkita.txt", "w") as text_file: 310 # text_file.write("Path name_zip: %s" % textito) 311 #Movemos el fichero del jclic original 312 if "jclic_uploads" in os.path.dirname(name_zip): 313 print "Lo muevo" 314 new_name=dir_jclic_orig+"/"+orig_name_file 315 shutil.move(name_zip,new_name) 311 jclic_filename=os.path.basename(name_zip) 312 print "genero el index con extract_dir: %s -index: %s - title: %s - jclic_js: %s - jar_path_lib: %s - name_zip: %s "%(extract_dir,index,title,jclic_plugin,jar_path_lib,jclic_filename) 313 index_write(extract_dir,index,title,jclic_plugin,jar_path_lib,jclic_filename) 314 315 new_name=os.path.join(extract_dir, jclic_filename) 316 shutil.move(name_zip,new_name) 316 317 317 318 … … 322 323 323 324 except Exception as e: 324 print Exception325 print e 325 326 sys.exit() 326 327 -
lliurex-jclic-shared/trunk/fuentes/lliurex-jclic-shared.install-files/net/server-sync/share/jclic-aula/index.php
r4485 r5378 6 6 <link rel="stylesheet" type="text/css" href="css/lliurex.css" media="screen" /> 7 7 <title>Servidor LliureX</title> 8 <!-- i si llevem a ço per el local?-->8 <!-- i si llevem aço per el local?--> 9 9 <!--script language="JavaScript" src="http://clic.xtec.cat/dist/jclic/jclicplugin.js" type="text/javascript"></script--> 10 10 <script language="JavaScript" src="./jclic/jclicplugin.js" type="text/javascript"></script> … … 45 45 function execute(jclicpath, alert_lang, ident) 46 46 { 47 //console.log(jclicpath);47 console.log(jclicpath); 48 48 var datos = {"argumento":jclicpath}; 49 49 document.body.style.cursor = "progress"; … … 52 52 var path1 ="document.location="; 53 53 var path_base=jclicpath.match(/(.*)[\/\\]/)[1]||''; 54 //console.log(path_base);54 console.log(path_base); 55 55 var filename=jclicpath.replace(/^.*(\\|\/|\:)/, ''); 56 56 path_lock="jclic_uploads/0rig_jclic/"; 57 57 path_base=path_server.concat(path_base); 58 //console.log(path_base);58 console.log(path_base); 59 59 path_lock=path_server.concat(path_lock); 60 60 path_lock=path_lock.concat(filename); 61 61 path_lock=path_lock.concat(".lock"); 62 //console.log(path_lock);62 console.log(path_lock); 63 63 var result=doesFileExist(path_lock); 64 //console.log(result);64 console.log(result); 65 65 if (result == true){ 66 66 alert(alert_lang); … … 294 294 function replaceAccents($str) { 295 295 296 $search = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,ø,Ø,Å,Á,À,Â,Ä,È,É,Ê,Ë,Í,Î,Ï,Ì,Ò,Ó,Ô,Ö,Ú,Ù,Û,Ü,Ÿ,Ç,Æ,Œ"); 296 $search = explode(",","ç,æ,Å,á,é,Ã,ó,ú,à ,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,Ã¥,ø,Ã,à 297 ,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ã,Ÿ,Ã,Ã,Å"); 297 298 298 299 $replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,o,O,A,A,A,A,A,E,E,E,E,I,I,I,I,O,O,O,O,U,U,U,U,Y,C,AE,OE"); … … 310 311 $temp_array+=array($library=>array($file_name=>array('id'=>$id, 'title'=> $title))); 311 312 } 312 //echo "se a ñadieron cosas";313 //echo "se añadieron cosas"; 313 314 return $temp_array; 314 315 } … … 390 391 } else{ 391 392 //echo "JCLIC"; 392 //Debemos transformarlo en HTML5 con el python crado cuando se haga click sobre él393 //Debemos transformarlo en HTML5 con el python crado cuando se haga click sobre él 393 394 /*if ( strcasecmp( $resource, 'menu' ) == 0){ 394 395 $resource="menu_llx"; … … 451 452 452 453 $rscfound=0; // Resources found 453 454 //var_dump($jclicdirectory); 454 455 $jclicconten = opendir($jclicdirectory); 455 456 //print_r ($activities_orig); … … 474 475 // Search .html 475 476 $resource=""; 476 foreach($lista as $item) 477 // echo "$item\n";477 foreach($lista as $item){ 478 //var_dump($item); 478 479 if(($item=="index.html") && (strstr($jclicdirectory,'jclic_upload'))){ 479 480 $resource=$item; 481 //echo "2222222222222"; 480 482 break; } 481 483 } 484 485 //var_dump($resource); 482 486 if (($resource!="") && (strstr($jclicdirectory,'jclic_upload'))){ // Found .html 483 487 // Button for resource … … 494 498 495 499 if($resource!=""){ // Found jclic.jclic 496 //Button for jclic.jclic 500 //Button for jclic.jclic; 497 501 list ($title2, $temp_array)=CreateButton($jclicdirectory, $resource, "jclic",$locale ,$activities_orig, $library, $temp_array); 498 502 $activities[] = trim($title2); … … 513 517 514 518 foreach($lista as $item){ 519 //var_dump($item); 515 520 if(strpos($item, '.jclic')){ 516 521 //echo "FOUND JCLIC LISTS!!!!!"; 517 //echo " AQUIIIIIIIIIIIIIIIIIIIIIII";522 //echo "$resource"; 518 523 //$resource=substr($item, 0, -4); 519 524 if ($item!=""){ … … 522 527 $activities[] = trim($title2); 523 528 //echo "$title2"; 529 //echo "1111111111111111"; 524 530 // Increasing number of elements 525 531 $rscfound++; … … 531 537 if(is_dir($itemdir) && (strstr($jclicdirectory,'jclic_upload'))){ 532 538 $index_file="$jclicdirectory/$item/index.html"; 533 if(is_file($index_file)){ 534 if ($item!=""){ 535 // Button for .jclic.zip 536 list ($title2, $temp_array)=CreateButton($jclicdirectory, $item, "html",$locale, $activities_orig, $library, $temp_array); 537 $activities[] = trim($title2); 538 // Increasing number of elements 539 $rscfound++; 539 if (!strstr($itemdir,'0rig')){ 540 if(is_file($index_file)){ 541 if ($item!=""){ 542 // Button for .jclic.zip 543 list ($title2, $temp_array)=CreateButton($jclicdirectory, $item, "html",$locale, $activities_orig, $library, $temp_array); 544 $activities[] = trim($title2); 545 //echo "$title2"; 546 //echo "222222222222222"; 547 // Increasing number of elements 548 $rscfound++; 549 } 550 } else { 551 //lista directorio que no posee Index.html y lo creará 552 //echo "Crear INDEX excepto 0rig"; 553 $item_extended="$item/$item.jclic.zip"; 554 //var_dump($item_extended); 555 list ($title2, $temp_array)=CreateButton($jclicdirectory, $item_extended, "jclic",$locale ,$activities_orig, $library, $temp_array); 556 $activities[] = trim($title2); 557 $rscfound++; 540 558 } 559 //break; 541 560 } 542 //break;543 561 } 544 562 } … … 589 607 } // While 590 608 if($numrsc==0){ 591 if ($locale=="valencia") echo "<div class='rscinfo'>No hi ha recursos disponibles en esta secci ó</div>";592 else echo "<div class='rscinfo'>No hay recursos disponibles en esta secci ón</div>";609 if ($locale=="valencia") echo "<div class='rscinfo'>No hi ha recursos disponibles en esta secció</div>"; 610 else echo "<div class='rscinfo'>No hay recursos disponibles en esta sección</div>"; 593 611 } 594 612 … … 612 630 $testfile=$title . "." . $locale ; 613 631 if ( ! is_file( $testfile ) ) $txt = file_get_contents($title); 614 // en caso contrario, se muestra s ólo si tiene extension para el "locale" actual632 // en caso contrario, se muestra sólo si tiene extension para el "locale" actual 615 633 } elseif ( ereg("\.title." . $locale, $title) ) 616 634 { … … 737 755 738 756 if($numrsc==0){ 739 if ($locale=="valencia") echo "<div class='rscinfo' id='rscpersonal'>No hi ha recursos disponibles en esta secci ó</div>";740 else echo "<div class='rscinfo' id='rscpersonal'>No hay recursos disponibles en esta secci ón</div>";757 if ($locale=="valencia") echo "<div class='rscinfo' id='rscpersonal'>No hi ha recursos disponibles en esta secció</div>"; 758 else echo "<div class='rscinfo' id='rscpersonal'>No hay recursos disponibles en esta sección</div>"; 741 759 } 742 760 … … 756 774 <?php 757 775 if ($locale=="valencia") echo "Arrossega nous recursos fins aci"; 758 else echo "Arrastra nuevos recursos hasta aqu í";776 else echo "Arrastra nuevos recursos hasta aquÃ"; 759 777 ?> 760 778 </div> … … 787 805 </div> 788 806 <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div> 789 <div class="dz-success-mark"><span> ✔</span></div>790 <div class="dz-error-mark"><span> ✘</span></div>807 <div class="dz-success-mark"><span>â</span></div> 808 <div class="dz-error-mark"><span>â</span></div> 791 809 <div class="dz-error-message"><span data-dz-errormessage></span></div> 792 810 </div>
Note: See TracChangeset
for help on using the changeset viewer.