Skip to content
Snippets Groups Projects
Commit 85890f12 authored by JotaJota96's avatar JotaJota96
Browse files

Consultar video esta hecho a medias, le falta los comentarios

parent ce98f985
No related branches found
No related tags found
No related merge requests found
......@@ -9,12 +9,9 @@ import Logica.DataType.DtCanal;
import Logica.DataType.DtListaDeReproduccion;
import Logica.DataType.DtUsuario;
import Logica.DataType.DtVideo;
import Logica.Enumerados.Privacidad;
import Logica.Enumerados.TipoListaDeReproduccion;
import Logica.Fabrica;
import Logica.Interfaces.IUsuario;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.uytube;
import Logica.DataType.DtCanal;
import Logica.DataType.DtComentario;
import Logica.DataType.DtUsuario;
import Logica.DataType.DtVideo;
import Logica.Fabrica;
import Logica.Interfaces.IUsuario;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author administrador
*/
public class ConsultaVideo extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ConsultaVideo</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet ConsultaVideo at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
......@@ -56,23 +29,43 @@ public class ConsultaVideo extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
try {
IUsuario sys = Fabrica.getInstancia().getIUsuario();
String strIDVideo = request.getParameter("id");
int idVideo = Integer.valueOf(strIDVideo);
DtUsuario usuario = sys.obtenerPropietarioDeVideo(idVideo);
sys.seleccionarUsuario(usuario.getNickname());
DtCanal canal = sys.obtenerCanalDeUsuario();
DtVideo video = sys.seleccionarVideo(idVideo);
ArrayList<DtComentario> comentarios = sys.listarComentariosDeVideo();
boolean sesionIniciada = sys.sesionIniciada();
boolean propietarioDelVideo = false;
if (sesionIniciada){
propietarioDelVideo = usuario.getNickname().equals(sys.obtenerUsuarioActual().getNickname());
}
request.setAttribute("usuario", usuario);
request.setAttribute("canal", canal);
request.setAttribute("video", video);
request.setAttribute("comentarios", comentarios);
request.setAttribute("sesionIniciada", sesionIniciada);
request.setAttribute("propietarioDelVideo", propietarioDelVideo);
RequestDispatcher rd; //objeto para despachar
rd = request.getRequestDispatcher("/ConsultaVideo.jsp");
rd.forward(request, response);
} catch (Exception e) {
System.out.println(e.getMessage());
RequestDispatcher rd; //objeto para despachar
rd = request.getRequestDispatcher("/");
rd.forward(request, response);
}
}
/**
* Returns a short description of the servlet.
*
......
......@@ -4,6 +4,9 @@
Author : administrador
--%>
<%@page import="java.util.TreeMap"%>
<%@page import="javax.swing.text.Document"%>
<%@page import="Logica.DataType.DtComentario"%>
<%@page import="Logica.DataType.DtUsuario"%>
<%@page import="Logica.Fabrica"%>
<%@page import="Logica.DataType.DtVideo"%>
......@@ -14,6 +17,15 @@
<!DOCTYPE html>
<html lang="es">
<%
boolean sesionIniciada = (boolean) request.getAttribute("sesionIniciada");
//sesionIniciada = true;
boolean propietarioDelVideo = (boolean) request.getAttribute("propietarioDelVideo");
DtUsuario usuario = (DtUsuario) request.getAttribute("usuario");
DtCanal canal = (DtCanal) request.getAttribute("canal");
DtVideo video = (DtVideo) request.getAttribute("video");
ArrayList<DtComentario> comentarios = (ArrayList) request.getAttribute("comentarios");
%>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
......@@ -27,7 +39,7 @@
<link rel="stylesheet" type="text/css" href="css/contenido-buscar.css">
<link rel="stylesheet" type="text/css" href="iconos/style.css">
<link rel="icon" type="image/png" href="imagenes/icono.png" />
<title>UyTube</title>
<title>UyTube - <%= video.getNombre() %></title>
</head>
<body>
<div class="container-fluid">
......@@ -35,7 +47,7 @@
<div class="col-12">
<!-- Inclusion de la barra superior -->
<%
if (false) {
if (sesionIniciada) {
%>
<%@ include file='include/header-usuario.html' %>
<%
......@@ -59,8 +71,18 @@
<div class="container-fluid">
<div class="row">
<div class="col-12">
<section class="principal">
<section class="principal">
<%
if (sesionIniciada) {
%>
<%@ include file='include/menu-usuario.html' %>
<%
} else {
%>
<%@ include file='include/menu-visitante.html' %>
<%
}
%>
<div class="contenido">
<section class="contenido-flexible">
......@@ -69,41 +91,62 @@
<!--INICIO DEL VIDEO-->
<div>
<br><h3>
NOMBRE_DEL_CANAL
<small class="text-muted">(PÚBLICO)</small>
<br>
<h3>
<%= video.getNombre() %>
</h3>
</div>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/fepmsnGBwJo" allowfullscreen></iframe>
<%
String videoEmbebido = Funciones.Funciones.obtenerEnlaceEmbebido(
Funciones.Funciones.extraerIDYoutube(video.getUrlVideoOriginal())
);
%>
<iframe class="embed-responsive-item" src="<%= videoEmbebido %>" allowfullscreen></iframe>
</div>
<div>
<br><h3>DESCRIPCION DEL VIDEO</h3>
</div>
<%
if (sesionIniciada) {
%>
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="p-2 btn-group mr-5" role="group" aria-label="Third group">
<button type="button" class="btn btn-info">+ LISTA DE REPRODUCCIÓN</button>
</div>
<div class="p-2 btn-group mr-2" role="group" aria-label="Third group">
<button type="button" class="btn btn-success">
ME GUSTÓ <span class="badge badge-light">300</span>
ME GUSTÓ <span class="badge badge-light"><%= video.getCantLikes() %></span>
</button>
<button type="button" class="btn btn-danger">
NO ME GUSTÓ <span class="badge badge-light">2</span>
NO ME GUSTÓ <span class="badge badge-light"><%= video.getCantDisLikes() %></span>
</button>
</div>
</div>
<%
}
%>
<br><hr class="mb-2"><br>
<div class="row">
<%
String textoAlternativo;
String rutaDeImagenDePerfil;
if (usuario.getImagen() == null || usuario.getImagen().equals("")) {
rutaDeImagenDePerfil = "imagenes/ukp.png";
textoAlternativo = "Imagen de perfil por defecto";
} else {
rutaDeImagenDePerfil = usuario.getImagen();
textoAlternativo = "Imagen de perfil de " + usuario.getNickname();
}
%>
<div class="bd-highlight">
<img class="align-self-center mr-3" src="imagenes/ukp.png" width="70" height="70">
<img class="align-self-center mr-3" src="<%= rutaDeImagenDePerfil %>" width="70" height="70" alt="<%= textoAlternativo %>">
</div>
<div class="bd-highlight" >
<h5>NOMBRE DEL CANAL</h5>
<a href="usuario-consultar?id=<%= usuario.getNickname() %>">
<h5><%= canal.getNombre() %></h5>
</a>
</div>
</div>
<br>
......@@ -112,13 +155,16 @@
<h3><small class="text-muted">DESCRIPCIÓN</small></h3>
</div>
<div class="bd-highlight" >
<h5>Esta es una tremanda descripcion del video y eso y ta, Lorem ipsum. Lorem ipsum is derived from the </h5>
<h5><%= video.getDescripcion() %></h5>
</div>
<!--FIN DEL VIDEO-->
<br><hr class="mb-2"><br>
<!--INGRESO DE COMENTARIOS-->
<%
if (sesionIniciada) {
%>
<div class="bd-highlight" >
<div class="bd-light" >
<h5>COMENTARIOS</h5>
......@@ -137,6 +183,9 @@
</div>
</div>
</div>
<%
}
%>+
<!--FIN DE INGRESO DE COMENTARIOS-->
......@@ -145,6 +194,36 @@
<!--COMENTARIOS EN SI-->
<!--A CONTINUACION UN EJEMPLO DE COMO PODRIAN SER LOS COMENTARIOS (NO DEFINITIVO)-->
<!--
TreeMap<Integer, Boolean> historial = new TreeMap();
int proximoNivel = -1;
DtComentario c;
for (int i = 0; i < comentarios.size(); i++){
c = comentarios.get(i);
if (historial.)
if (i+1 == comentarios.size()){
proximoNivel = -1;
}else{
proximoNivel = comentarios.get(+1).getNivelSubComentario();
}
// mostrar primera parte
if (proximoNivel == c.getNivelSubComentario()){
}else if (proximoNivel == c.getNivelSubComentario()){
}else{
}
}
-->
<div class="media">
<img class="mr-3" src="imagenes/ukp.png" width="50" height="50">
<div class="media-body">
......@@ -158,11 +237,19 @@
<div class="media-body">
<h5 class="mt-0">Media heading</h5>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
<div class="media mt-3">
<a class="mr-3" href="#">
<img class="mr-3" src="imagenes/ukp.png" width="50" height="50">
</a>
<div class="media-body">
<h5 class="mt-0">Media heading</h5>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
</div>
</div>
</div>
</div>
</div>
</div>
<div class="media">
<img class="mr-3" src="imagenes/ukp.png" width="50" height="50">
<div class="media-body">
......@@ -180,7 +267,7 @@
</div>
</div>
</div>
<!--FIN de COMENTARIOS-->
</div>
......
UyTube_web/web/imagenes/perfiles/JotaJota96.JPG

165 KiB | W: | H:

UyTube_web/web/imagenes/perfiles/JotaJota96.JPG

98.7 KiB | W: | H:

UyTube_web/web/imagenes/perfiles/JotaJota96.JPG
UyTube_web/web/imagenes/perfiles/JotaJota96.JPG
UyTube_web/web/imagenes/perfiles/JotaJota96.JPG
UyTube_web/web/imagenes/perfiles/JotaJota96.JPG
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment