Inheritance: IComparable
Ejemplo n.º 1
0
        public string doDocumentSubmit(string accion, string parametro, string grupo, string email, string modeloID, int width, HttpRequest req)
        {
            string           ret = "";
            Grupo            g   = app.getGrupo(grupo);
            ModeloEvaluacion m   = g.organizacion.getModeloEvaluacion(modeloID);
            Usuario          u   = g.getUsuarioHabilitado(email);

            lock (g)
            {
                Propuesta prop = prepararDocumento(g, email, modeloID, req);

                //proceso evento
                m.evaluacionSubmit(accion, parametro, prop, g, email); //las propuesta debe ir en orden de nivel

                //genro respuesta
                ret = m.toHTML(prop, g, email, width, ModeloEvaluacion.eModo.editar);

                //guarpo prevista para poder crearla luego
                Prevista prev = new Prevista();
                prev.titulo = m.titulo;
                prev.propuestas.Clear();
                prev.propuestas.Add(prop);
                u.prevista = prev;
            }
            return(ret);
        }
Ejemplo n.º 2
0
        string doVariante(int id, string modeloID, string grupo, string email, int width)
        {
            string           ret   = "";
            List <Propuesta> props = new List <Propuesta>();
            Grupo            g     = app.getGrupo(grupo);

            lock (g)
            {
                //preparo propuestas de nodos ancestros
                Arbol       a    = g.arbol;
                List <Nodo> path = a.getPath(id);
                Modelo      m    = g.organizacion.getModeloDocumento(modeloID);
                g.ts = DateTime.Now;
                foreach (Nodo n in path)
                {
                    Propuesta op = a.getPropuesta(n); //comparo textox con hermanos y resalto palarbas nuevas
                    if (n.nivel > 0 && op != null)
                    {
                        props.Add(op);
                    }
                }

                //marco la propuesta de id como prevista
                props[0]        = props[0].clone(); //nueva propuesta
                props[0].email  = email;
                props[0].nodoID = 0;                //nodoID=0 determina propuesta prevista, porque esta propuesta aun no tiene nodo

                //muestro documento
                ret = m.toHTML(props, g, email, width, Modelo.eModo.editar); //las propuesta debe ir en orden de nivel
            }
            return(ret);
        }
Ejemplo n.º 3
0
 private object getValue(string id, Propuesta prop)
 {
     if (prop == null)
     {
         return("");
     }
     else
     {
         if (prop.bag.ContainsKey(id))
         {
             //ejemplo "\"/Date(1445301615000-0700)/\"";
             if (prop.bag[id].GetType().Name == "DateTime")
             {
                 return(prop.bag[id]);
             }
             else
             {
                 string value = prop.bag[id].ToString();
                 if (value.StartsWith("/Date("))
                 {
                     return(Tools.getDateFromJSON(value));
                 }
                 else
                 {
                     return(prop.bag[id]);
                 }
             }
         }
         else
         {
             return("");
         }
     }
 }
Ejemplo n.º 4
0
        string doEvaluarTema(string idTema, string grupo, string email, int width)
        {
            string ret = "";
            Grupo  g   = app.getGrupo(grupo);

            lock (g)
            {
                g.ts = DateTime.Now;

                //busco el tema
                foreach (Tema t in g.queso.temas)
                {
                    if (t.id == idTema)
                    {
                        ModeloEvaluacion m    = g.organizacion.getModeloEvaluacion(t.modeloEvaluacionID);
                        Propuesta        prop = m.createProp(t);
                        ret = m.toHTML(prop, g, email, width, ModeloEvaluacion.eModo.editar); //las propuesta debe ir en orden de nivel

                        //guarpo prevista para poder crearla luego
                        Usuario  u    = g.getUsuarioHabilitado(email);
                        Prevista prev = new Prevista();
                        prev.titulo = m.titulo;
                        prev.propuestas.Clear();
                        prev.propuestas.Add(prop);
                        u.prevista = prev;
                    }
                }
            }
            return(ret);
        }
Ejemplo n.º 5
0
        private Propuesta prepararDocumento(Grupo g, string email, string modeloID, HttpRequest req)
        {
            //preparo propuestas de nodos ancestros
            Propuesta        prop;
            Arbol            a = g.arbol;
            ModeloEvaluacion m = g.organizacion.getModeloEvaluacion(modeloID);

            g.ts = DateTime.Now;

            Usuario u = g.getUsuarioHabilitado(email);

            if (u.prevista != null)
            {
                prop = u.prevista.propuestas[0];
            }
            else
            {
                prop = new Propuesta();
            }

            //agrego las propuestas de prevista
            foreach (string reqID in req.Form.AllKeys)
            {
                if (reqID != null && m.isVariable(reqID) && req[reqID] != "")
                {
                    //este valor me lo guardo en la prpuesta para ese nivel
                    Variable v = m.getVariable(reqID);
                    prop.bag[reqID] = m.parse(reqID, req[reqID]);
                }
            }

            return(prop);
        }
Ejemplo n.º 6
0
        private Documento crearDocumento(Nodo n, DateTime now, string fname, string docPath, string URL)
        {
            Modelo    m   = grupo.organizacion.getModeloDocumento(n.modeloID);
            Documento doc = new Documento();

            doc.fecha    = now;
            doc.nombre   = m.nombre;
            doc.fname    = fname;
            doc.modeloID = n.modeloID;
            doc.path     = grupo.path + "\\" + docPath + "\\" + fname + ".json";
            doc.URLPath  = URL;
            //obtengo el titulo
            //debo dibujar el documento
            //junto propuestas
            List <Propuesta> props = new List <Propuesta>();

            foreach (Nodo n1 in getPath(n.id))
            {
                Propuesta p = getPropuesta(n1);
                if (p != null) //la raiz
                {
                    props.Add(p);
                }
            }
            //armo HTML
            m.toHTML(props, this.grupo, "", 1024, Modelo.eModo.consenso);
            doc.titulo = m.titulo;

            //guardo propuestas
            doc.propuestas = props;

            return(doc);
        }
Ejemplo n.º 7
0
        public Propuesta getPropuesta(Nodo n)
        {
            //devuelvo la propuesta resultado de comparar el texto con sus hermanos
            Propuesta op = getPropuesta(n.id);

            return(op);
        }
Ejemplo n.º 8
0
        public string HTMLFloat(string id, Propuesta prop, bool tieneFlores, string idioma, string format)
        {
            float  d     = getFloat(id, prop);
            string value = d.ToString(format);

            return(input(id, prop, 150, tieneFlores, "number", value, idioma));
        }
Ejemplo n.º 9
0
        string doComentar(int id, string grupo, string email, string comentario, bool objecion)
        {
            string ret = "";
            Grupo  g   = app.getGrupo(grupo);

            lock (g)
            {
                Arbol a = g.arbol;
                g.ts = DateTime.Now;
                Propuesta p = a.getPropuesta(id);
                if (comentario != "")
                {
                    Comentario c = new Comentario();
                    c.email    = email;
                    c.texto    = Server.HtmlEncode(comentario);
                    c.objecion = objecion;
                    p.comentarios.Add(c);

                    if (objecion)
                    {
                        Nodo n = a.getNodo(id);
                        n.objecion = true;
                    }
                }
                //retorno el nuevo html de todos los comentarios de ese nodo
                Modelo m = g.organizacion.getModeloDocumento(p.modeloID);
                ret = m.toHTMLComentarios(p.nivel, p, g, email, 330, true);
            }

            return(ret);
        }
Ejemplo n.º 10
0
        public string toHTML(Propuesta prop, Grupo g, string email, int width, eModo modo)
        {
            string ret = "";

            this.modo  = modo;
            this.grupo = g;

            if (prop != null && prop.nivel != 1)
            {
                ret += "<div class='titulo1'><nobr>" + nombre + "</nobr></div>";
            }

            //contenido
            ret += toHTMLContenido(prop.nivel, prop, g, email, width);

            //comentarios
            if (prop != null && modo != eModo.consenso)
            {
                ret += "<br>";
                ret += "<div style='vertical-align:top;' class='comentarios2'>";
                ret += toHTMLComentarios(prop.nivel, prop, g, email, width, false);
                ret += "</div>";
            }
            return(ret);
        }
Ejemplo n.º 11
0
        public string HTMLBarra(string id, Propuesta prop, string minText, string maxText)
        {
            Variable v   = getVariable(id);
            string   ret = "";

            if (prop == null)
            {
                //editar
                if (modo != eModo.prevista)
                {
                    ret += "<table style='border-spacing: 0;'><tr>";
                    string color = "";
                    for (int i = 1; i <= 10; i++)
                    {
                        color = "rgba(" + (100 - i * 10 - 10) + "%, " + (i * 10 - 10) + "%, 50%, 0.4)";
                        ret  += "<td style='cursor:pointer;border: 3px solid transparent;width:20px;background-color:" + color + "' ";
                        ret  += "onclick=\"evaluacionSubmit('" + id + "_set','" + i + "','" + GetType().FullName + "')\" ";
                        ret  += ">&nbsp;</td>";
                    }
                    ret += "</tr>";
                }
            }
            else if (prop != null && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revisar
                ret += "<table style='border-spacing: 0;'><tr>";
                string color  = "";
                string border = "";
                for (int i = 1; i <= 10; i++)
                {
                    color  = (float)getValue(id, prop) != i ? "rgba(" + (100 - i * 10 - 10) + "%, " + (i * 10 - 10) + "%, 50%, 0.4)" : "rgba(" + (100 - i * 10 - 10) + "%, " + (i * 10 - 10) + "%, 50%, 1)";
                    border = (float)getValue(id, prop) == i ? "border:3px solid blue;" : "border:3px solid transparent;";
                    ret   += "<td style='cursor:pointer;" + border + ";width:20px;background-color:" + color + "' ";
                    ret   += "onclick=\"evaluacionSubmit('" + id + "_set','" + i + "','" + GetType().FullName + "')\" ";
                    ret   += ">&nbsp;</td>";
                }
                ret += "</tr>";
            }
            else if (prop != null)
            {
                //ver
                ret += "<table style='border-spacing: 0;'><tr>";
                string color  = "";
                string border = "";
                for (int i = 1; i <= 10; i++)
                {
                    color  = "rgba(" + (100 - i * 10 - 10) + "%, " + (i * 10 - 10) + "%, 50%, 0.4)";
                    border = (float)getValue(id, prop) == i ? "border:3px solid blue;" : "border:3px solid transparent;";
                    ret   += "<td style='" + border + ";width:20px;background-color:" + color + "' ";
                    ret   += ">&nbsp;</td>";
                }
                ret += "</tr>";
            }
            ret += "<tr><td colspan=5 class='titulo3' style='text-align:left;'>" + minText + "</td><td colspan=5 class='titulo3' style='text-align:right;'>" + maxText + "</td></tr>";
            ret += "</table>";
            ret += "<input type='hidden' id='" + id + "' value='" + getValue(id, prop) + "'>";

            return(ret);
        }
Ejemplo n.º 12
0
        public string HTMLArea(string id, Propuesta prop, int width, int height, bool tieneFlores, string idioma)
        {
            Variable v   = getVariable(id);
            string   ret = "";

            if (prop == null && tieneFlores)
            {
                if (modo != eModo.prevista && !consensoAlcanzado)
                {
                    ret += "<textarea id='" + id + "' ";
                    ret += "class='editarrtf' ";
                    ret += "maxlength='" + v.len + "' ";
                    ret += "style='width:" + width + "px;height:" + height + "px;'>";
                    ret += "</textarea>";
                    ret += "<div style='text-align:right;width:100%;font-size:10px;'>(" + Tools.tr("max", idioma) + ": " + v.len + ")</div>";
                    ret += "<br>";
                }
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revisar
                string HTMLText = Tools.HTMLDecode(Tools.HTMLDecode(toHTMLText((string)getValue(id, prop))));
                ret += "<textarea id='" + id + "' ";
                ret += "class='editarrtf' ";
                ret += "maxlength='" + v.len + "' ";
                ret += "style='width:" + width + "px;height:" + height + "px;'>";
                ret += HTMLText;
                //ret += getValue(id, prop);
                ret += "</textarea>";
                ret += "<div style='text-align:right;width:100%;font-size:10px;'>(" + Tools.tr("max", idioma) + ": " + v.len + ")</div>";
                ret += "<br>";
            }
            else if (prop != null)
            {
                //ver
                string HTMLText = Tools.HTMLDecode(Tools.HTMLDecode(toHTMLText((string)getValue(id, prop))));
                ret += "<div ";
                ret += "class='" + v.className + "' ";
                ret += "style='width:" + width + "px;'>";
                if (prop.consensoAlcanzado)
                {
                    ret += HTMLText + "</div>";
                }
                //ret += toHTMLText((string)getValue(id, prop)) + "</div>";
                else
                {
                    ret += HTMLText + "</div>";
                }
                //ret += Tools.HTMLDecode(Tools.HTMLDecode(toHTMLText((string)getValueResaltado(id, prop)))) + "</div>";
                ret += "<br>";
            }
            else
            {
                ret += "<div style='color:gray;font-size:12px;'>" + Tools.tr("No tiene flores para crear una propuesta", idioma) + "</div>";
            }


            return(ret);
        }
Ejemplo n.º 13
0
        string doCrearEvaluacionUsuario(string modeloID, string grupo, string email, int width)
        {
            //el usuario quiere crer una evaluacion
            Grupo      g   = app.getGrupo(grupo);
            Usuario    u   = null;
            Evaluacion ev  = null;
            string     ret = "";

            lock (g)
            {
                ModeloEvaluacion m;
                m = g.organizacion.getModeloEvaluacion(modeloID);

                //genero evlacuacion HTML y guardo
                u = g.getUsuario(email);
                string html = m.toHTML(u.prevista.propuestas[0], g, email, width, ModeloEvaluacion.eModo.finalizado);

                //escribo
                int    docID   = g.queso.lastEvalID++;
                string fname   = m.nombre + "_" + docID.ToString("0000");
                string docPath = "evaluaciones\\" + m.carpeta() + "\\" + docID.ToString("0000");
                string URL     = g.URL + "/grupos/" + g.nombre + "/" + docPath.Replace('\\', '/') + "/" + fname + ".html";

                //creo carpeta se salida
                if (!System.IO.Directory.Exists(g.path + "\\" + docPath))
                {
                    System.IO.Directory.CreateDirectory(g.path + "\\" + docPath);
                    System.IO.Directory.CreateDirectory(g.path + "\\" + docPath + "\\res\\documentos");
                    System.IO.File.Copy(g.path + "\\..\\..\\styles.css", g.path + "\\" + docPath + "\\styles.css");
                    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(g.path + "\\..\\..\\res\\documentos");
                    foreach (System.IO.FileInfo fi in di.GetFiles())
                    {
                        System.IO.File.Copy(fi.FullName, g.path + "\\" + docPath + "\\res\\documentos\\" + fi.Name);
                    }
                }
                System.IO.File.WriteAllText(g.path + "\\" + docPath + "\\" + fname + ".html", html, System.Text.Encoding.UTF8);

                //crea evalaucion
                Propuesta prop = u.prevista.propuestas[0];
                ev           = new Evaluacion();
                ev.email     = email;
                ev.id        = g.queso.lastEvalID++;
                ev.preguntas = m.getPreguntas(prop);

                string msg = doCrearEvaluacion(m, g, email, ev);

                //devuelvo el queso Personal
                ret = Tools.toJson(g.queso.getQuesoPersonal(email, msg));
            }

            //guardo
            //app.saveGrupos();

            return(ret);
        }
Ejemplo n.º 14
0
 public float getFloat(string id, Propuesta prop)
 {
     try
     {
         return((float)getValue(id, prop));
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 15
0
 public DateTime getDate(string id, Propuesta prop)
 {
     try
     {
         return((DateTime)getValue(id, prop));
     }
     catch (Exception)
     {
         return(Tools.minValue);
     }
 }
Ejemplo n.º 16
0
        private List <Propuesta> prepararDocumento(Grupo g, string email, string modeloID, int id, HttpRequest req)
        {
            //preparo propuestas de nodos ancestros
            List <Propuesta> props = new List <Propuesta>();
            Arbol            a     = g.arbol;
            List <Nodo>      path  = a.getPath(id);
            Modelo           m     = g.organizacion.getModeloDocumento(modeloID);

            g.ts = DateTime.Now;
            foreach (Nodo n in path)
            {
                Propuesta op = a.getPropuesta(n); //comparo textox con hermanos y resalto palarbas nuevas
                if (n.nivel > 0 && op != null)
                {
                    props.Add(op);
                }
            }

            //agrego las propuestas de prevista
            List <Propuesta> previstaProps = new List <Propuesta>();

            foreach (string reqID in req.Form.AllKeys)
            {
                if (reqID != null && m.isVariable(reqID) && req[reqID] != "")
                {
                    //este valor me lo guardo en la prpuesta para ese nivel
                    Variable v     = m.getVariable(reqID);
                    bool     found = false;
                    foreach (Propuesta p in previstaProps)
                    {
                        if (v.nivel == p.nivel)
                        {
                            p.bag.Add(reqID, m.parse(reqID, req[reqID]));
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        Propuesta p = new Propuesta();
                        p.email    = email;
                        p.modeloID = m.id;
                        p.nivel    = v.nivel;
                        //p.niveles = m.niveles; los niveles se completan luego desde el modelo de documeto por si cambia con alguna condicion propia
                        //p.nodoID = id; nodoID=0 determina propuesta prevista, porque esta propuesta aun no tiene nodo
                        p.bag.Add(reqID, m.parse(reqID, Server.HtmlEncode(req[reqID])));

                        previstaProps.Add(p);
                        props.Add(p);
                    }
                }
            }

            return(props);
        }
Ejemplo n.º 17
0
        public string HTMLArea(string id, Propuesta prop, int width, int height, string idioma)
        {
            //es reconocimiento de voz no funcion desde el servidor por motivos de seguridad. Solo funciona con HTTPS
            Variable v   = getVariable(id);
            string   ret = "";

            if (prop == null)
            {
                if (modo != eModo.prevista)
                {
                    //ret += "<table style='width:" + width + "'>";
                    //ret += "<tr><td>";
                    ret += "<textarea id='" + id + "' ";
                    ret += "class='editarrtf' ";
                    ret += "maxlength='" + v.len + "' ";
                    ret += "style='width:" + width + "px;height:" + height + "px;'>";
                    ret += "</textarea>";
                    //ret += "</td><td style='width:25px;vertical-align:top;'>";
                    //ret += "<img src='res/mic.png' style='cursor:pointer;' onclick='startRecognition(\"" + id + "\");'>";
                    //ret += "</td></tr></table>";
                    ret += "<div style='text-align:right;width:100%;font-size:10px;'>(" + Tools.tr("max", idioma) + ": " + v.len + ")</div>";
                    ret += "<br>";
                }
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revisar
                //ret += "<table style='width:" + width + "'>";
                //ret += "<tr><td>";
                ret += "<textarea id='" + id + "' ";
                ret += "class='editarrtf' ";
                ret += "maxlength='" + v.len + "' ";
                ret += "style='width:" + width + "px;height:" + height + "px;'>";
                ret += getValue(id, prop);
                ret += "</textarea>";
                //ret += "</td><td style='width:25px;vertical-align:top;'>";
                //ret += "<img src='res/mic.png' style='cursor:pointer;' onclick='startRecognition(\"" + id + "\");'>";
                //ret += "</td></tr></table>";
                ret += "<div style='text-align:right;width:100%;font-size:10px;'>(" + Tools.tr("max", idioma) + ": " + v.len + ")</div>";
                ret += "<br>";
            }
            else if (prop != null)
            {
                //ver
                string HTMLText = Tools.HTMLDecode(Tools.HTMLDecode(toHTMLText((string)getValue(id, prop))));
                ret += "<div ";
                ret += "class='" + v.className + "' ";
                ret += "style='width:100%;'>";
                ret += HTMLText + "</div>";
                ret += "<br>";
            }

            return(ret);
        }
Ejemplo n.º 18
0
        public string toHTML(Propuesta prop, Grupo g, string email, int width, eModo modo)
        {
            string ret = "";

            this.modo  = modo;
            this.grupo = g;

            //reinicio el modelo
            //errores.Clear();

            //if (modo == eModo.consenso)
            //{
            //    //header HTML
            //    ret += "<html>";
            //    ret += "<head>";
            //    ret += "<title></title>";
            //    ret += "<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />";
            //    ret += "<link rel='stylesheet' type='text/css' href='styles.css'>";
            //    ret += "</head>";
            //    ret += "<body>";
            //}

            //contenido
            ret += toHTMLContenido(prop, g, email, width);

            //botones de poantalla o firma de consenso
            ret += "<br>";
            if (modo == eModo.editar)
            {
                //modo muestra
                ret += "<input type='button' class='btn' style='clear:left;float:left;' value='" + Tools.tr("Cerrar", g.idioma) + "' onclick='doCerrarDocumento();' />";
                ret += "<input type='button' class='btn' style='float:left;' value='" + Tools.tr("Prevista de evaluacion", g.idioma) + "' title='" + Tools.tr("Enseña vista previa antes de proponer", g.idioma) + "' onclick='doPrevistaEvaluacion(\"" + id + "\");' />";
            }
            else if (modo == eModo.prevista)
            {
                ret += "<input type='button' class='btn' style='clear:left;float:left;' value='" + Tools.tr("Cancelar", g.idioma) + "' onclick='doCerrarDocumento();' />";
                ret += "<input type='button' class='btn' style='float:left;' value='" + Tools.tr("Revisar evaluacion", g.idioma) + "' title='" + Tools.tr("Permite corregir errores", g.idioma) + "' onclick='doRevisarEvaluacion(\"" + id + "\");' />";
                if (!hayError())
                {
                    ret += "<input type='button' class='btn' style='float:left;' value='" + Tools.tr("Crear evaluacion", g.idioma) + "' title='" + Tools.tr("Crea la propuesta", g.idioma) + "' onclick='doCrearEvaluacion(\"" + id + "\");' />";
                }
            }
            else if (modo == eModo.revisar)
            {
                //permito prevista
                ret += "<input type='button' class='btn' style='clear:left;float:left;' value='" + Tools.tr("Cancelar", g.idioma) + "' onclick='doCerrarDocumento();' />";
                ret += "<input type='button' class='btn' style='float:left;' value='" + Tools.tr("Prevista de evaluacion", g.idioma) + "' title='" + Tools.tr("Enseña vista previa antes de proponer", g.idioma) + "' onclick='doPrevistaEvaluacion(\"" + id + "\");' />";
            }

            //ret += "<a id='btnDownload' href='' target='_blank'><font size='1'>Descargar esta versi&oacute;n</font></a>";
            return(ret);
        }
Ejemplo n.º 19
0
Archivo: Arbol.cs Proyecto: sabtvg/nabu
        public Nodo addNodo(Nodo padre, Propuesta prop)
        {
            //verifico que el usuario tiene al menos una flor disponible
            Usuario u = grupo.getUsuario(prop.email);
            if (nombre == null)
                throw new appException("Nombre de nodo no puede ser vacio");
            else if (u == null)
                throw new appException("El usuario no existe");
            else if (padre == null)
                throw new appException("El nodo no existe");
            else
            {
                //agrego nuevo nodo
                Nodo nuevo = new Nodo();
                nuevo.nombre = prop.etiqueta;
                nuevo.id = lastNodoID++;
                nuevo.modeloID = prop.modeloID;
                nuevo.email = prop.email;

                try
                {
                    //agrego al arbol
                    if (leftRight)
                        padre.children.Add(nuevo);
                    else
                        padre.children.Insert(0, nuevo);

                    //seguridad
                    if (prop.nivel != getPath(nuevo.id).Count - 1)  //quito la raiz
                        throw new Exception("El nivel de la propuesta no coincide con el del arbol");

                    //fijo nivel
                    nuevo.nivel = prop.nivel;

                    leftRight = !leftRight;

                    //agrego la propuesta
                    prop.nodoID = nuevo.id;  //ahora si tiene nodo
                    propuestas.Add(prop);

                    //consumo una flor
                    asignarflor(u, nuevo);
                }
                catch (Exception ex)
                {
                    //no se pudo agregar, quito nodo nuevo
                    padre.children.Remove(nuevo);
                    throw ex;
                }
                return nuevo;
            }
        }
Ejemplo n.º 20
0
        private List <string> getTextosHermanos(Nodo padre, Nodo n, string id)
        {
            //preparao lista de textos de los hermanos
            List <string> ret = new List <string>();

            foreach (Nodo hno in padre.children)
            {
                if (hno != n)
                {
                    Propuesta op = grupo.arbol.getPropuesta(hno.id);
                    ret.Add((string)getValue(id, op));
                }
            }
            return(ret);
        }
Ejemplo n.º 21
0
        public string HTMLRadio(string id, int index, Propuesta prop, bool tieneFlores, string value, string idioma)
        {
            Variable v   = getVariable(id);
            string   ret = "";

            if (prop == null && tieneFlores && !consensoAlcanzado)
            {
                if (modo != eModo.prevista)
                {
                    //editar en blanco
                    ret += "<input id='" + id + index + "' name='" + id + "' type='radio' ";
                    ret += "class='" + v.editClassName + "' ";
                    ret += "value='" + value + "' ";
                    ret += "onclick=\"documentSubmit('" + id + "_click','" + value + "')\" style='cursor:pointer;width:2em;height:2em;'>";
                }
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revision
                ret += "<input id='" + id + index + "' name='" + id + "' type='radio' ";
                ret += "class='" + v.editClassName + "' ";
                ret += "value='" + value + "' ";
                if (getText(id, prop) == value)
                {
                    ret += "checked ";
                }
                ret += "onclick=\"documentSubmit('" + id + "_click','" + value + "')\" style='cursor:pointer;width:2em;height:2em;'>";
            }
            else if (prop != null)
            {
                //ver
                ret += "<input type='radio' ";
                ret += "class='" + v.editClassName + "' ";
                if (value == getText(id, prop))
                {
                    ret += "checked ";
                }
                ret += "value='" + value + "' disabled='true' style='width:2em;height:2em;'>";
            }
            else
            {
                //sin flores
                ret += "<div style='color:gray;font-size:12px;'>" + Tools.tr("No tiene flores para crear una propuesta", idioma) + "</div>";
            }

            return(ret);
        }
Ejemplo n.º 22
0
        public string toHTMLComentarios(int nivel, Propuesta prop, Grupo g, string email, int width, bool agregar)
        {
            string ret = "";

            if (prop != null)
            {
                //titulo si hay contenido
                if (prop.comentarios.Count > 0 || (agregar && !prop.esPrevista()))
                {
                    ret += "<div class='titulo4' style='padding-left:3px'>" + Tools.tr("Comentarios", g.idioma) + ":</div>";
                }

                foreach (Comentario c in prop.comentarios)
                {
                    if (c.objecion)
                    {
                        ret += "<div class='comentario' style='background-color:#FFD2E3'>";
                    }
                    else
                    {
                        ret += "<div class='comentario' style='background-color:#D6F5DB'>";
                    }
                    ret += toHTMLText(c.texto);

                    //fecha
                    ret += "<div style='text-align:right;color:gray;font-size:10px;'>";
                    ret += c.fecha.ToString("dd/MM/yy");
                    ret += "</div>";

                    ret += "</div>";
                    //objecion
                }

                //agregar
                if (agregar && !prop.esPrevista())
                {
                    ret += "<textarea id='comentario" + prop.nodoID + "' maxlength='300' class='editarComentario' style='height: 50px;width:-webkit-fill-available'>";
                    ret += "</textarea><br>";
                    ret += "<input type='button' class='btn2' value='" + Tools.tr("Enviar", g.idioma) + "' onclick='doComentar(" + prop.nodoID + ");'>";
                    ret += "&nbsp;<font size='1'>(max: 300)</font>";
                    ret += "&nbsp;<input type='checkbox' id='objecion" + prop.nodoID + "'><span style='font-size:10px'>" + Tools.tr("Objecion", g.idioma) + "</span>";
                }
            }

            return(ret);
        }
Ejemplo n.º 23
0
        public Propuesta clone()
        {
            Propuesta ret = new Propuesta();
            ret.titulo = titulo;
            ret.etiqueta = etiqueta;
            ret.nodoID = nodoID;
            ret.nivel = nivel;
            ret.email = email;
            ret.modeloID = modeloID;

            foreach (KeyValuePair<string, object> var in bag)
                ret.bag.Add(var.Key, var.Value);

            //no clono comentarios

            return ret;
        }
Ejemplo n.º 24
0
        private string input(string id, Propuesta prop, int width, bool tieneFlores, string tipo, string value, string idioma)
        {
            Variable v   = getVariable(id);
            string   ret = "";

            if (prop == null && tieneFlores && !consensoAlcanzado)
            {
                if (modo != eModo.prevista)
                {
                    //editar en blanco
                    ret += "<input id='" + id + "' type='" + tipo + "' ";
                    ret += "class='" + v.editClassName + "' ";
                    ret += "maxlength='" + v.len + "' ";
                    ret += "style='width:" + width + "px;'>";
                }
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revision
                ret += "<input id='" + id + "' type='" + tipo + "' ";
                ret += "class='" + v.editClassName + "' ";
                ret += "maxlength='" + v.len + "' ";
                ret += "style='width:" + width + "px;' ";
                if (tipo == "number")
                {
                    value = value.Replace(",", ".");
                }
                ret += "value='" + value + "'>";
            }
            else if (prop != null)
            {
                //ver
                ret += "<input type='text' readonly ";
                ret += "class='" + v.className + "' ";
                ret += "style='width:" + width + "px;' ";
                ret += "value='" + value + "'>";
            }
            else
            {
                //sin flores
                ret += "<div style='color:gray;font-size:12px;'>" + Tools.tr("No tiene flores para crear una propuesta", idioma) + "</div>";
            }

            return(ret);
        }
Ejemplo n.º 25
0
        string HTMLPropuesta(int id, string grupo, string email, int width)
        {
            string           ret = "";
            List <Propuesta> l   = new List <Propuesta>();
            Grupo            g   = app.getGrupo(grupo);

            lock (g)
            {
                Arbol a = g.arbol;
                g.ts = DateTime.Now;
                Propuesta p = a.getPropuesta(id);
                if (p != null)
                {
                    Modelo m = g.organizacion.getModeloDocumento(p.modeloID);
                    ret = m.toHTML(p, g, email, width, Modelo.eModo.ver);
                }
            }
            return(ret);
        }
Ejemplo n.º 26
0
        public Propuesta clone()
        {
            Propuesta ret = new Propuesta();

            ret.titulo   = titulo;
            ret.etiqueta = etiqueta;
            ret.nodoID   = nodoID;
            ret.nivel    = nivel;
            ret.email    = email;
            ret.modeloID = modeloID;
            ret.niveles  = niveles;

            foreach (KeyValuePair <string, object> var in bag)
            {
                ret.bag.Add(var.Key, var.Value);
            }

            //no clono comentarios

            return(ret);
        }
Ejemplo n.º 27
0
        string HTMLEvaluacion(Propuesta prop, string modeloID, string grupo, string email, int width)
        {
            string ret = "";
            Grupo  g   = app.getGrupo(grupo);

            lock (g)
            {
                Arbol a = g.arbol;
                g.ts = DateTime.Now;
                ModeloEvaluacion m = g.organizacion.getModeloEvaluacion(modeloID);

                //limpio valores antiguos
                Usuario u = g.getUsuarioHabilitado(email);
                if (u.prevista != null)
                {
                    u.prevista = null;
                }

                ret = m.toHTML(prop, g, email, width, ModeloEvaluacion.eModo.editar); //las propuesta debe ir en orden de nivel
            }
            return(ret);
        }
Ejemplo n.º 28
0
 public string getValueResaltado(string id, Propuesta prop)
 {
     //devuelvo la propuesta resultado de comparar el texto con sus hermanos
     if (id.StartsWith("s."))
     {
         if (prop != null)
         {
             if (prop.nodoID != 0)
             {
                 //creo propuesta de retorno con textos comparados
                 List <Nodo> pathn = grupo.arbol.getPath(prop.nodoID);
                 if (pathn.Count > 2) //tiene padre no raiz
                 {
                     Nodo nodo  = pathn[0];
                     Nodo padre = pathn[1];
                     return(Comparador.comparar((string)getValue(id, prop), getTextosHermanos(padre, nodo, id)));
                 }
                 else
                 {
                     //esta propuesta es de nivel 1 (no se compara con sus hermanos)
                     return((string)getValue(id, prop));
                 }
             }
             else
             {
                 return((string)getValue(id, prop));
             }
         }
         else
         {
             return("");
         }
     }
     else
     {
         throw new Exception("getValueResaltado(): Solo para strings: " + id);
     }
 }
Ejemplo n.º 29
0
        string doPrevista(string modeloID, string grupo, string email, int width, HttpRequest req)
        {
            string           ret = "";
            Grupo            g   = app.getGrupo(grupo);
            ModeloEvaluacion m   = g.organizacion.getModeloEvaluacion(modeloID);

            lock (g)
            {
                Propuesta prop = prepararDocumento(g, email, modeloID, req);

                //genro prevista para segurarme que defina etiqueta y titulo
                ret = m.toHTML(prop, g, email, width, ModeloEvaluacion.eModo.prevista);

                //guarpo prevista para poder crearla luego
                Usuario  u    = g.getUsuarioHabilitado(email);
                Prevista prev = new Prevista();
                prev.titulo = m.titulo;
                prev.propuestas.Clear();
                prev.propuestas.Add(prop);
                u.prevista = prev;
            }
            return(ret);
        }
Ejemplo n.º 30
0
        public string HTMLDate(string id, Propuesta prop, bool tieneFlores, string idioma)
        {
            DateTime d     = getDate(id, prop);
            string   value = "";

            if (d == Tools.minValue)
            {
                //valor nulo
                value = "";
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revision
                value = d.Year.ToString("0000") + "-" + d.Month.ToString("00") + "-" + d.Day.ToString("00");
            }
            else
            {
                //ver
                value = d.Day.ToString("00") + "/" + d.Month.ToString("00") + "/" + d.Year.ToString("0000");
            }

            return(input(id, prop, 150, tieneFlores, "date", value, idioma));
        }
Ejemplo n.º 31
0
        string HTMLDocumento(int id, string modeloID, string grupo, string email, int width)
        {
            string           ret = "";
            List <Propuesta> l   = new List <Propuesta>();
            Grupo            g   = app.getGrupo(grupo);

            lock (g)
            {
                Arbol a = g.arbol;
                g.ts = DateTime.Now;
                foreach (Nodo n in a.getPath(id))
                {
                    Propuesta op = a.getPropuesta(n); //comparo textox con hermanos y resalto palarbas nuevas
                    if (op != null)
                    {
                        l.Add(op);
                    }
                }
                Modelo m = g.organizacion.getModeloDocumento(modeloID);
                ret = m.toHTML(l, g, email, width, Modelo.eModo.editar); //las propuesta debe ir en orden de nivel
            }
            return(ret);
        }
Ejemplo n.º 32
0
        private string input(string id, Propuesta prop, int width, string tipo, string value, string idioma)
        {
            Variable v   = getVariable(id);
            string   ret = "";

            if (prop == null)
            {
                if (modo != eModo.prevista)
                {
                    //editar en blanco
                    ret += "<input id='" + id + "' type='" + tipo + "' ";
                    ret += "class='" + v.editClassName + "' ";
                    ret += "maxlength='" + v.len + "' ";
                    ret += "style='width:" + width + "px;'>";
                }
            }
            else if (prop != null && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revision
                ret += "<input id='" + id + "' type='" + tipo + "' ";
                ret += "class='" + v.editClassName + "' ";
                ret += "maxlength='" + v.len + "' ";
                ret += "style='width:" + width + "px;' ";
                ret += "value='" + value + "'>";
            }
            else if (prop != null)
            {
                //ver
                ret += "<input type='text' readonly ";
                ret += "class='" + v.className + "' ";
                ret += "style='width:" + width + "px;' ";
                ret += "value='" + value + "'>";
            }


            return(ret);
        }
Ejemplo n.º 33
0
 protected abstract string toHTMLContenido(int nivel, Propuesta prop, Grupo g, string email, int width);
Ejemplo n.º 34
0
        public string area(string id, Propuesta prop, int width, int height, bool tieneFlores)
        {
            Variable v = getVariable(id);
            string ret = "";
            if (prop == null && tieneFlores)
            {
                if (modo != eModo.prevista && !consensoAlcanzado)
                {
                    ret += "<textarea id='" + id + "' ";
                    ret += "class='editar' ";
                    ret += "maxlength='" + v.len + "' ";
                    ret += "style='width:" + width + "px;height:" + height + "px;'>";
                    ret += "</textarea>";
                    ret += "<div style='text-align:right;width:" + (width + 14) + "px;font-size:10px;'>(" + tr("max") + ": " + v.len + ")</div>";
                    ret += "<br>";
                }
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revisar
                ret += "<textarea id='" + id + "' ";
                ret += "class='editar' ";
                ret += "maxlength='" + v.len + "' ";
                ret += "style='width:" + width + "px;height:" + height + "px;'>";
                ret += getValue(id, prop);
                ret += "</textarea>";
                ret += "<div style='text-align:right;width:" + (width + 14) + "px;font-size:10px;'>(" + tr("max") + ": " + v.len + ")</div>";
                ret += "<br>";
            }
            else if (prop != null)
            {
                //ver
                ret += "<div ";
                ret += "class='" + v.className + "' ";
                ret += "style='width:" + width + "px;'>";
                ret += toHTML((string)getValueResaltado(id, prop)) + "</div>";
                ret += "<br>";
            }
            else
            {
                ret += "<span style='color:gray;font-size:12px;padding:5px;'>" + tr("[No tiene flores para crear una propuesta]") + "</span>";
                ret += "<br>";
            }

            return ret;
        }
Ejemplo n.º 35
0
        public string txt(string id, Propuesta prop, int width, bool tieneFlores)
        {
            Variable v = getVariable(id);
            string ret = "";
            if (prop == null && tieneFlores && !consensoAlcanzado)
            {
                if (modo != eModo.prevista)
                {
                    //editar en blanco
                    ret += "<input id='" + id + "' type='text' ";
                    ret += "class='editar' ";
                    ret += "maxlength='" + v.len + "' ";
                    ret += "style='width:" + width + "px;'>";
                }
            }
            else if (prop != null && prop.esPrevista() && (modo == eModo.revisar || modo == eModo.editar))
            {
                //revision
                ret += "<input id='" + id + "' type='text' ";
                ret += "class='editar' ";
                ret += "maxlength='" + v.len + "' ";
                ret += "style='width:" + width + "px;' ";
                ret += "value='" + getValue(id, prop) + "'>";
            }
            else if (prop != null)
            {
                //ver
                ret += "<span type='text' readonly ";
                ret += "class='" + v.className + "' ";
                ret += "style='width:" + width + "px;'>";
                ret += getValue(id, prop) + "</span>";
            }
            else
                //sin flores
                ret += "<span style='color:gray;font-size:12px;'>" + tr("[No tiene flores para crear una propuesta]") + "</span>";

            return ret;
        }
Ejemplo n.º 36
0
        string doPrevista(int id, string modeloID, string grupo, string email, int width, HttpRequest req)
        {
            string ret = "";
            List<Propuesta> props = new List<Propuesta>();
            Modelo m = Modelo.getModelo(modeloID);
            Grupo g = app.getGrupo(grupo);
            lock (g)
            {
                //preparo propuestas de nodos ancestros
                Arbol a = g.arbol;
                List<Nodo> path = a.getPath(id);
                g.ts = DateTime.Now;
                foreach (Nodo n in path)
                {
                    Propuesta op = a.getPropuesta(n); //comparo textox con hermanos y resalto palarbas nuevas
                    if (n.nivel > 0 && op != null)
                    {
                        props.Add(op);
                    }
                }

                //agrego las propuestas de prevista
                List<Propuesta> previstaProps = new List<Propuesta>();
                foreach (string reqID in req.Form.AllKeys)
                {
                    if (reqID != null && m.isVariable(reqID) && req[reqID] != "")
                    {
                        //este valor me lo guardo en la prpuesta para ese nivel
                        Variable v = m.getVariable(reqID);
                        bool found = false;
                        foreach (Propuesta p in previstaProps)
                        {
                            if (v.nivel == p.nivel)
                            {
                                p.bag.Add(reqID, m.parse(reqID, req[reqID]));
                                found = true;
                            }
                        }
                        if (!found)
                        {
                            Propuesta p = new Propuesta();
                            p.email = email;
                            p.modeloID = m.id;
                            p.nivel = v.nivel;
                            //p.nodoID = id; nodoID=0 determina propuesta prevista, porque esta propuesta aun no tiene nodo
                            p.bag.Add(reqID, m.parse(reqID, Server.HtmlEncode(req[reqID])));

                            previstaProps.Add(p);
                            props.Add(p);
                        }
                    }
                }

                //genro prevista
                ret = m.toHTML(props, g, email, width, Modelo.eModo.prevista ); //las propuesta debe ir en orden de nivel

                //guarpo prevista para poder crearla luego
                if (props.Count > 0)
                {
                    Usuario u = g.getUsuario(email);
                    Prevista prev = new Prevista();
                    prev.etiqueta = m.etiqueta;
                    prev.titulo = m.titulo;
                    prev.propuestas = previstaProps;
                    u.prevista = prev;
                } //else no ha escrito nada nuevo
            }
            return ret;
        }
Ejemplo n.º 37
0
 public object getValue(string id, Propuesta prop)
 {
     if (prop == null)
         return "";
     else
     {
         if (prop.bag.ContainsKey(id))
             return prop.bag[id];
         else
             return "";
     }
 }
Ejemplo n.º 38
0
 public string getValueResaltado(string id, Propuesta prop)
 {
     //devuelvo la propuesta resultado de comparar el texto con sus hermanos
     if (id.StartsWith("s."))
     {
         if (prop != null)
         {
             if (prop.nodoID != 0)
             {
                 //creo propuesta de retorno con textos comparados
                 List<Nodo> pathn = grupo.arbol.getPath(prop.nodoID);
                 if (pathn.Count > 2) //tiene padre no raiz
                 {
                     Nodo nodo = pathn[0];
                     Nodo padre = pathn[1];
                     return Comparador.comparar((string)getValue(id, prop), getTextosHermanos(padre, nodo, id));
                 }
                 else
                     //esta propuesta es de nivel 1 (no se compara con sus hermanos)
                     return (string)getValue(id, prop);
             }
             else
                 return (string)getValue(id, prop);
         }
         else
             return "";
     }
     else
         throw new Exception("getValueResaltado(): Solo para strings: " + id);
 }
Ejemplo n.º 39
0
 public string toHTML(Propuesta prop, Grupo g, string email, int width, eModo modo)
 {
     string ret = "";
     this.modo = modo;
     this.grupo = g;
     ret += toHTMLContenido(prop.nivel, prop, g, email, width);
     ret += "<br>Comentarios:";
     ret += toHTMLComentarios(prop.nivel, prop, g, email, width - 30, false);
     return ret;
 }
Ejemplo n.º 40
0
        public int saveTime = 10; //guardar arboles cada x minutos

        #endregion Fields

        #region Methods

        //public string download(int id, string arbol)
        //{
        //    string ret = "";
        //    Grupo grupo = app.getGrupo(arbol);
        //    Arbol a = grupo.arbol;
        //    lock (a)
        //    {
        //        grupo.ts = DateTime.Now;
        //        List<Nodo> pathn = a.getPath(id);
        //        for(int i = pathn.Count - 1; i >=0 ; i--)
        //        {
        //            Nodo n = pathn[i];
        //            Propuesta op = a.getPropuesta(n.id);
        //            if (op != null)
        //            {
        //                if (ret == "")
        //                {
        //                    ModeloDocumento m = a.getModelo(op.modeloID);
        //                    ret += "Fecha: " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\r\n";
        //                    ret += "Arbol: " + a.nombre + "\r\n";
        //                    ret += "Creado: " + a.born.ToShortDateString() + " " + a.born.ToShortTimeString() + "\r\n";
        //                    ret += "Objetivo: " + a.objetivo + "\r\n";
        //                    ret += "Consensos alcanzados: " + a.logDocumentos.Count + "\r\n";
        //                    ret += "Usuarios: " + a.usuarios.Count + "\r\n";
        //                    ret += "Admin: " + a.getAdmin().nombre + " (" + a.getAdmin().email + ")\r\n\r\n";
        //                    ret += "Modelo documento: " + m.nombre + "\r\n";
        //                    ret += "Titulo: " + op.titulo + "\r\n\r\n";
        //                }
        //                ret += "--------------------------------------------------------------- Nivel del arbol " + (pathn.Count - i - 1) + "\r\n";
        //                ret += "Fecha: " + op.ts.ToShortDateString() + " " + op.ts.ToShortTimeString() + "\r\n";
        //                foreach (TextoTema tt in op.textos)
        //                {
        //                    ret += "Titulo: " + tt.titulo + "\r\n";
        //                    ret += tt.texto.Replace("\n", "\r\n").Replace("&quot;", "\"") + "\r\n\r\n";
        //                }
        //                ret += "\r\n";
        //                ret += "\r\n";
        //            }
        //        }
        //   }
        //    return ret;
        //}
        public bool doSimulacionLive(Grupo g, float coopProb)
        {
            bool ret = false;
            lock (g)
            {
                Arbol a = g.arbol;
                float action = coopProb + (float)a.rnd.NextDouble() - 0.5f;

                if (action > 3f/4f) {
                    //cooperacion, muevo un voto del menor al mayor
                    Nodo mayor = a.getMayorAgregar(0);
                    Nodo menor = a.getMenorQuitar(mayor.id);

                    if (mayor != menor && menor.flores > 0 && !mayor.consensoAlcanzado)
                    {
                        Usuario u = a.quitarFlor(menor);
                        try { a.asignarflor(u, mayor); } catch {}
                        if (mayor.consensoAlcanzado) ret = true;
                    }
                }
                else if (action > 2f/4f) {
                    //voto a minorias, muevo un voto del mayor al menor
                    var mayor = a.getMayorQuitar(0);
                    var menor = a.getMenorAgregar(mayor.id);

                    if (mayor != menor && mayor.flores > 0 && !menor.consensoAlcanzado)
                    {
                        Usuario u = a.quitarFlor(mayor);
                        try { a.asignarflor(u, menor); } catch {}
                        if (menor.consensoAlcanzado) ret = true;
                    }
                }
                else if (action > 1f / 4f)
                {
                    //quito alguna flor
                    var mayor = a.getMayorQuitar(0);
                    if (mayor.flores > 0)
                    {
                        a.quitarFlor(mayor);
                    }
                }
                else
                {
                    //creo una rama nueva
                    //seleccion nodo al azar
                    List<Nodo> nodes = a.toList();
                    Nodo selected = a.rndElement(nodes);

                    //agrego nuevo nodo
                    if (!selected.consensoAlcanzado && selected.nivel < 5)
                    {
                        //agrego nodo
                        //creo texto segun nivel y modelo de documento
                        Modelo m = Modelo.getModelo("nabu.modelos.Accion");  //modelo de simulacion (Accion)
                        Propuesta prop = new Propuesta();
                        prop.email = g.usuarios[0].email;
                        prop.modeloID = m.id;
                        prop.nivel = selected.nivel + 1;  //esta propuesta es para el hijo que voy a crear
                        prop.nodoID = selected.id;
                        prop.titulo = "Documento simulado";

                        //lleno datos de prueba
                        foreach (Variable v in m.getVariables())
                        {
                            if (v.id == "s.etiqueta")
                                prop.bag.Add("s.etiqueta", "Sim");
                            else if (v.id == "s.titulo")
                                prop.bag.Add("s.titulo", "Documento simulado");
                            else
                                prop.bag.Add(v.id, "Simulacion!!!");
                        }

                        //me aseguro que el usuario tenga flores o agrego otro
                        if (a.lastSimUsuario.flores.Count < 5)
                            a.lastSimUsuario.flores.Add(new Flor());
                        else
                        {
                            //busco un usuario con flores
                            a.lastSimUsuario = a.getUsuarioConFloresDisponibles();
                        }
                        if (a.lastSimUsuario == null)
                        {
                            Usuario u = new Usuario();
                            u.nombre = "Sim" + g.usuarios.Count + 1;
                            u.email = "Sim" + g.usuarios.Count + 1;
                            u.flores.Add(new Flor());
                            g.usuarios.Add(u);
                            a.lastSimUsuario = u;
                        }

                        prop.email = a.lastSimUsuario.email;
                        Nodo nuevo = a.addNodo(selected, prop);

                        if (selected.nivel == 1)
                        {
                            selected.nombre = "Sim" + selected.id;
                        }
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 41
0
        public string toHTMLComentarios(int nivel, Propuesta prop, Grupo g, string email, int width, bool agregar)
        {
            string ret = "";
            if (prop != null)
            {
                foreach (Comentario c in prop.comentarios)
                {
                    ret += "<div class='comentario' style='overflow: auto;width:" + (width - 15) + "px'>";
                    ret += toHTML(c.texto);
                    ret += "</div>";
                    //fecha
                    ret += "<div style='text-align:right;color:gray;font-size:10px;width:" + (width - 10) + "px'>";
                    ret += c.fecha.ToShortDateString();
                    ret += "</div>";
                }

                //agregar
                if (agregar && !prop.esPrevista())
                {
                    ret += "<textarea id='comentario" + prop.nodoID + "' maxlength='200' class='editar' style='width: " + (width - 15) + "px; height: 70px;'>";
                    ret += "</textarea><br>";
                    ret += "<input type='button' class='btn2' value='" + tr("Enviar") + "' onclick='doComentar(" + prop.nodoID + ");'>";
                    ret += "&nbsp;<font size='1'>(max: 200)</font>";
                }
            }

            return ret;
        }