-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuevoforo.asp
350 lines (290 loc) · 9.25 KB
/
nuevoforo.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<%@ Language=VBScript %>
<%
dim usuario
usuario = ""
usuario = session("id")
if isempty(usuario) then
Response.Redirect("login.asp")
end if
%>
<html>
<head>
<link href="./theme/Master.css" rel="stylesheet" type="text/css">
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</head>
<script language="JavaScript">
function Previsualizar(forma) {
desc = forma.descripcion.value
ancho = 700
if (screen) {
leftPos = (screen.width / 2) - (ancho/2)
}
//PreviewWindow = window.open('previewforo.asp?Noticia='+Noticia,'Preview','toolbar=no,menubar=no,location=no,scrollbars=yes,width='+ancho+'+,height=350,left='+leftPos+'+,top=20')
PreviewWindow = window.open('previewforo.asp?desc='+desc,'Preview','toolbar=no,menubar=no,location=no,scrollbars=yes,width='+ancho+'+,height=350,left='+leftPos+'+,top=20')
}
function Validar(forma) {
if (forma.titulo.value.length > 50) {
alert("Excedio el tamaño del titulo")
forma.titulo.focus
return false
}
if (forma.titulo.value.length < 1) {
alert("No ingreso el titulo")
forma.titulo.focus
return false
}
if (forma.descripcion.value.length > 500) {
alert("Excedio el tamaño de la descripcion.")
forma.descripcion.focus
return false
}
if (forma.descripcion.value.length < 1) {
alert ("No ingreso descripcion del foro")
forma.descripcion.focus
return false
}
if (forma.Categoria.value == "0" ) {
alert ("No ha seleccionado una categoria para el foro")
form.Categoria.select
forma.Categoria.focus
return false
}
}
function Search(str1,str2)
{
var s = str2.indexOf(str1);
return(s);
}
function ReplaceDemo(s)
{
var r, re;
re = /\r\n/i;
r = s.replace(re, "<br>");
return(r);
}
function Verificar(forma) {
var re;
if (forma.descripcion.value.length > 400) {
alert("Excedio el tamaño del campo")
forma.descripcion.focus
forma.descripcion.disabled
}
re = "\r\n";
if (Search (re,forma.descripcion.value)!= "-1" )
{
forma.descripcion.value = ReplaceDemo(forma.descripcion.value)
}
return false
}
function Edicion(forma,valor) {
texto = forma.descripcion.value
if (valor == "1" ) { //Negrilla
forma.descripcion.value = forma.descripcion.value + "<b></b>"
}
if (valor == "2") { //SubRayar
forma.descripcion.value = forma.descripcion.value + "<u></u>"
}
if (valor == "3") { //Italica
forma.descripcion.value = forma.descripcion.value + "<em></em>"
}
if (valor == "4") { //Italica
forma.descripcion.value = forma.descripcion.value + "<hr>"
}
if (valor == "5") { //Izquierda
forma.descripcion.value = forma.descripcion.value + "<div align=left></div>"
}
if (valor == "6") { //Centro
forma.descripcion.value = forma.descripcion.value + "<div align=center></div>"
}
if (valor == "7") { //Italica
forma.descripcion.value = forma.descripcion.value + "<div align=derecha></div>"
}
if (valor == "8") { //Correo
Enlace=prompt("Ingrese el texto que se mostrara como enlace para el correo.\nDeje en blanco si desea que el correo aparezca como enlace.","");
if (Enlace!=null) {
WebSite = prompt("Ingrese su direccion de correo.","mailto:");
if (WebSite!=null) {
if (Enlace=="") {
Texto='<a href="'+WebSite+'" target="Nueva">'+WebSite+'</a>'
} else {
Texto='<a href="'+WebSite+'" target="Nueva">'+Enlace+'</a>'
}
forma.descripcion.value = forma.descripcion.value + Texto
}
}
}
if (valor == "9") { //Web site
Enlace=prompt("Ingrese el texto que se mostrara como enlace.\nDeje en blanco si desea que la pagina aparezca com enlace.","");
if (Enlace!=null) {
WebSite = prompt("Ingrese la direccion URL.","http://");
if (WebSite!=null) {
if (Enlace=="") {
Texto='<a href="'+WebSite+'" target="Nueva">'+WebSite+'</a>'
} else {
Texto='<a href="'+WebSite+'" target="Nueva">'+Enlace+'</a>'
}
forma.descripcion.value = forma.descripcion.value + Texto
}
}
}
forma.descripcion.focus = true
forma.descripcion.select
return true
}
</script>
<%
dim db
dim rs
set db = server.CreateObject ("SQLComandos.Comandos")
dim foro
dim descripcion
dim titulo
dim categoria
dim accion
foro = ""
accion = ""
descripcion = ""
titulo = ""
categoria= ""
foro = Request.querystring("foro")
accion = request.querystring("accion")
dim rs2
dim rs3
%>
<BODY onload="javascript:{if(parent.frames[0]&&parent.frames['opciones'].Go)parent.frames['opciones'].Go()}" >
<form name="form" target="_self" action="<%
if isempty(accion) then
response.write "ingreso_foro.asp"
else
response.write "actualizar_foro.asp"
end if
%>" method="post" onsubmit="return Validar(this)">
<%
if isempty(foro) then
else
sql = "select id,titulo,autor,descripcion,fecha_creacion,categoria from foro where id = "& foro &" and autor = " & usuario
set rs = db.SQLSelect("DBBAECYS",sql)
if not rs.EOF then
categoria = rs("categoria")
end if
set rs = nothing
end if
if isempty(foro) then
else
sql = "select id,titulo,autor,descripcion,fecha_creacion,categoria from foro where id = "& foro &" and autor = " & usuario
set rs = db.SQLSelect("DBBAECYS",sql)
if not rs.EOF then
titulo = rs("titulo")
descripcion = rs("descripcion")
end if
set rs = nothing
end if
%>
<div align="center">
<table width="75" border="0" cellpadding="2" cellspacing="2">
<tr>
<td>Categoria
<select name="Categoria" size="1" >
<option value="0" selected>-----Sin Clasificar-----</option>
<%
sql = "select id,descripcion from categoria where padre is null"
set rs = db.SQLSelect("DBBAECYS",sql)
if not rs.EOF then
%>
<%while rs.eof <> true %>
<option value="<%=rs("id")%>" <%if rs("id") = categoria then Response.Write "selected" end if%>>-<%=rs("descripcion")%>-</option>
<%
sql2 = "select id,descripcion from categoria where padre = " & rs("id")
set rs2 = db.SQLSelect("DBBAECYS",sql2)
if not rs2.EOF then
%>
<%
while rs2.EOF <> true
%>
<option value="<%=rs2("id")%>" <%if rs2("id") = categoria then Response.Write "selected" end if%> >--<%=rs2("descripcion")%>--</option>
<%
rs2.MoveNext
wend
%>
<%
end if
set rs2 = nothing
%>
<%
rs.MoveNext
wend
%>
<%
end if
set rs = nothing
%>
</select>
</td>
</tr>
<tr>
<td>
<table width="420" height="14" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="35" height="15">Titulo</td>
<td width="369">
<input name="titulo" size="50" type="text" maxlength="50" value ="<%=titulo%>">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> <img src="imagenes/icon_editor_bold.gif" alt="Negrilla" onclick="return Edicion(form,'1')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_underline.gif" alt="Subrayar" onclick="return Edicion(form,'2')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_italicize.gif" alt="Italica" onclick="return Edicion(form,'3')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_hr.gif" alt="Linea" onclick="return Edicion(form,'4')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_left.gif" alt="Izquierda" onclick="return Edicion(form,'5')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_center.gif" alt="Centrar" onclick="return Edicion(form,'6')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_right.gif" alt="Derecha" onclick="return Edicion(form,'7')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_email.gif" alt="Correo" onclick="return Edicion(form,'8')" WIDTH="23" HEIGHT="22">
<img src="imagenes/icon_editor_url.gif" alt="WebSite" onclick="return Edicion(form,'9')" WIDTH="23" HEIGHT="22">
</tr>
<tr>
<td>
<table width="281">
<tr>
<td>
<textarea name="descripcion" onkeypress ="Verificar(form)" cols="40" rows="10" wrap="virtual"><%=descripcion%></textarea>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<script language="javascript">
function VerForos(opcion) {
if (opcion == '1') {
pagina = "reporte_foros.asp"
}
if (opcion == '2') {
pagina = "foro.asp"
}
document.location = pagina
}
function Cambiar() {
window.location = 'opciones_datos.asp'
}
</script>
<table width="75" border="0">
<tr>
<!-- <td><input name="Foros" type="button" class="celdaBgBlue05" onclick="javascript:VerForos('1')" value="Ver Foros"></td>-->
<!-- <td><input name="Foros" type="button" class="celdaBgBlue05" onclick="javascript:VerForos('2')" value="Foros Publicados"></td> -->
<td><input name="Aceptar" type="submit" class="celdaBgBlue05" value="Aceptar"></td>
<td><input name="Cancelar" type="button" class="celdaBgBlue05" onclick="javascript:Cambiar()" value="Cancelar"></td>
<td><input name="Previ" type="button" class="celdaBgBlue05" onclick="javascript:Previsualizar(form)" value="Pre-visualizar"></td>
</tr>
</table>
</div>
<input name="foro" type="hidden" value = "<%=foro%>">
</form>
</body>
</html>
<%
set db = nothing
%>