Ocultar los últimos autores
| author | version | line-number | content |
|---|---|---|---|
![]() |
39.2 | 1 | Colección ordenada alfabéticamente tanto de juegos físicos como digitales de todos los sistemas. |
| 2 | |||
| 3 | |||
![]() |
27.1 | 4 | {{groovy}} |
![]() |
30.1 | 5 | // Conectar a la base de datos |
![]() |
32.2 | 6 | def db = groovy.sql.Sql.newInstance('jdbc:mysql://10.100.200.31:8285/games', 'root', 'xwiki', 'com.mysql.jdbc.Driver') |
![]() |
29.1 | 7 | |
![]() |
30.1 | 8 | // Iniciar tabla HTML |
| 9 | def table = """ | ||
![]() |
32.1 | 10 | {{html}} |
![]() |
30.1 | 11 | <style> |
| 12 | table { | ||
| 13 | border-collapse: collapse; | ||
| 14 | width: 100%; | ||
| 15 | font-family: Arial, sans-serif; | ||
| 16 | } | ||
| 17 | th, td { | ||
| 18 | border: 1px solid #ddd; | ||
| 19 | padding: 8px; | ||
| 20 | } | ||
| 21 | th { | ||
| 22 | background-color: #f2f2f2; | ||
| 23 | font-weight: bold; | ||
| 24 | text-align: center; | ||
| 25 | } | ||
| 26 | tr:nth-child(even) { | ||
| 27 | background-color: #f9f9f9; | ||
| 28 | } | ||
| 29 | tr:hover { | ||
| 30 | background-color: #f1f1f1; | ||
| 31 | } | ||
![]() |
35.2 | 32 | img { |
![]() |
39.2 | 33 | width: 111px; /* Ajusta el ancho de la imagen */ |
| 34 | height: 151px; /* Ajusta la altura de la imagen */ | ||
| 35 | object-fit: cover; /* Mantiene la relación de aspecto y recorta si es necesario */ | ||
![]() |
35.2 | 36 | } |
![]() |
30.1 | 37 | </style> |
| 38 | <table> | ||
| 39 | <thead> | ||
| 40 | <tr> | ||
![]() |
32.1 | 41 | <th>TITULO</th> |
| 42 | <th>SISTEMA</th> | ||
![]() |
32.3 | 43 | <th>COMPLETADO</th> |
| 44 | <th>CARATULA</th> | ||
![]() |
30.1 | 45 | </tr> |
| 46 | </thead> | ||
| 47 | <tbody> | ||
![]() |
29.1 | 48 | """ |
| 49 | |||
![]() |
30.1 | 50 | // Recorrer las filas de la tabla de la base de datos y añadirlas a la tabla HTML |
![]() |
38.1 | 51 | db.eachRow('SELECT * FROM games_list order by titulo asc;') { row -> |
![]() |
30.1 | 52 | table += """ |
| 53 | <tr> | ||
![]() |
32.2 | 54 | <td>${row.titulo}</td> |
![]() |
32.3 | 55 | <td>${row.sistema}</td> |
| 56 | <td>${row.estado}</td> | ||
![]() |
39.2 | 57 | <td><img src='/images_wiki/${row.caratula}' style='width: 112px; height: 154px;'/></td> |
![]() |
30.1 | 58 | </tr> |
| 59 | """ | ||
![]() |
29.1 | 60 | } |
| 61 | |||
![]() |
30.1 | 62 | // Cerrar la tabla HTML |
| 63 | table += """ | ||
| 64 | </tbody> | ||
| 65 | </table> | ||
![]() |
32.1 | 66 | {{/html}} |
![]() |
29.1 | 67 | """ |
| 68 | |||
![]() |
31.1 | 69 | // Usar out.print para renderizar la tabla como HTML |
| 70 | out.print(table) | ||
![]() |
29.1 | 71 | |
| 72 | {{/groovy}} |
