ASP + xbScript

Post Reply
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

ASP + xbScript

Post by Rimantas »

Hi !

I'm looking for samples , how to work with that . Also I have a question - will xbScript work well in ASP.NET ?

If you can , please , provide some source code for sample ...

Many thanks in advance ! With best regards ! Rimantas
Rimantas U.
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

Rimantas,

What you need about ASP? explain me more.
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Post by Rimantas »

Rochinha wrote:Rimantas,

What you need about ASP? explain me more.

It's requirement to do some things in the Web with dbf's and with ASP . I found some needful information in xHarbour.com pages .
Rimantas U.
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

Rimantas

Fisrt try to use WinASP( http://htcsoft.no-ip.com:82/ )

This WebServer allow run xbase style scripts with .DBFs and .CDX indexes.

You can develop in a little time one web application.
User avatar
quique
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am
Contact:

Post by quique »

Saludos
Quique
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Post by Rimantas »

Rochinha wrote:Rimantas

Fisrt try to use WinASP( http://htcsoft.no-ip.com:82/ )

This WebServer allow run xbase style scripts with .DBFs and .CDX indexes.

You can develop in a little time one web application.

At this time exist so many websers for free ... And the scripting language isn't a problem - I can write script in VBScript , Python and , at last , xbScript . So why to pay moneys for WinASP , when it's possible to do that without moneys ? ... :-)) Also , in earliers versions , WinASP wasn't translated to english ...
Rimantas U.
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

Rimantas

Try this my utilities:

How to use:

MakeHTM <dbf_file> example: MakeHTM clients

MakeHTM.PRG code:

Code: Select all

PARA cFile,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10

    p1  := iif(p1=NIL,"",p1)
    p2  := iif(p2=NIL,"",p2)
    p3  := iif(p3=NIL,"",p3)
    p4  := iif(p4=NIL,"",p4)
    p5  := iif(p5=NIL,"",p5)
    p6  := iif(p6=NIL,"",p6)
    p7  := iif(p7=NIL,"",p7)
    p8  := iif(p8=NIL,"",p8)
    p9  := iif(p9=NIL,"",p9)
    p10 := iif(p10=NIL,"",p10)
    ? 'MAKEhtm 1.0 Direiros Reservados 1999-2000 Soft Clever Informatica ME.'
    if cFile = NIL
       //   ? 'Uso    :  MAKEhtm <NomeDohtm> [op‡”es] '
       //   ? ' '
       //   ? 'Exemplo:  MAKEhtm <NomeDohtm> /m/n'
       //   QUIT
       ? ' '
       numprg={}
       numprg=Adir("*.dbf")
       numopt=p1+p2+p3+p4+p5+p6+p7+p8+p9+p10
       declare prg_files[numprg]
       Adir("*.dbf",prg_files)
       Asort(prg_files)
    endif
    //
    // -> Arquivo temporario
iprg_files = 1 
do while .t.

    if cFile = NIL
       prg_name := alltrim(substr(prg_files[iprg_files],1,at(".",prg_files[iprg_files])-1))
    else
       prg_name := cFile
    endif
    ? 'Criando... '+prg_name
    use (prg_name)
    copy structure extend to temp
    use
    use temp
    go top

    cFile := alltrim(prg_name) + ".HTM"
    ret_line := "chr(13)+chr(10)"

    errhandle = fcreate(cFile)
    fwrite(errhandle,[<html>]+&ret_line.)
    fwrite(errhandle,[<body bgcolor="#FFFFFF">]+&ret_line.)
    fwrite(errhandle,[<table border=0 cellpadding=0 cellspacing=0 valign="top"  align="center" width="70%">]+&ret_line.)
    fwrite(errhandle,[       <table width="100%" border="0" cellspacing="0" cellpadding="0">]+&ret_line.)
    fwrite(errhandle,[              <tr>]+&ret_line.) 
    fwrite(errhandle,[                 <td colspan="2" bgcolor="#FFFFFF" valign="center" align="center">]+&ret_line.) 
    fwrite(errhandle,[                     <!-- START FORM HERE -->]+&ret_line.)
    fwrite(errhandle,[                     <form  action="]+prg_name+[.asp" method="POST" onSubmit="">]+&ret_line.)
    //fwrite(errhandle,[                     <form  action="]+prg_name+[.asp" method="POST" onSubmit="">]+&ret_line.)
    fwrite(errhandle,[                            <input type="hidden" name="acao"   value="inclusao">]+&ret_line.)
    fwrite(errhandle,[                            <input type="hidden" name="origem" value="IP">]+&ret_line.)
    fwrite(errhandle,[                            <!-- BR -->]+&ret_line.)
    fwrite(errhandle,[                            <!-- p align="center" -->]+&ret_line.) 
    fwrite(errhandle,[                            <table border="0" cellpadding="2" cellspacing="1" width="600" bgcolor="#FFFFFF">]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#330066" align="center">]+&ret_line.) 
    fwrite(errhandle,[                                       <td colspan="2">]+&ret_line.)
    fwrite(errhandle,[                                           <b>]+&ret_line.)
    fwrite(errhandle,[                                           <font color="#FFFFFF" size="4" face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                                 <strong>Atenção:</strong>]+&ret_line.)
    fwrite(errhandle,[                                           </font>]+&ret_line.)
    fwrite(errhandle,[                                           <font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Contamos com sua atenção no preenchimento do formulário abaixo.</font>&nbsp;]+&ret_line.)
    fwrite(errhandle,[                                           </b>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <tbody> ]+&ret_line.)
    fwrite(errhandle,[                            </table>]+&ret_line.)
    fwrite(errhandle,[                            <!-- ------------- INICIO DO BLOCO DE CAMPOS ------------ -->]+&ret_line.)
    fwrite(errhandle,[                            <table border="0" cellpadding="2" cellspacing="1" width="600" bgcolor="#FFFFFF">]+&ret_line.)
    do while .not. eof()
       if   field_type = 'L' .or. (field_type = 'C' .and. field_len = 1)
            // Cria controle checkbox
            fwrite(errhandle,[                            <tr bgcolor="#CCCCFF">]+&ret_line.)
            fwrite(errhandle,[                                <td width="135" align="right" bgcolor="#9999CC">]+&ret_line.)
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">]+NewCapfirst(alltrim(field_name))+[</font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                                <td width="452">]+&ret_line.)
            fwrite(errhandle,[                                    <input align=left maxlength="135" type="checkbox" name="]+alltrim(field_name)+[" size="1" tabindex="]+str(recno(),2)+[">]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                            </tr>]+&ret_line.)
            skip
            loop
       endif
       if   field_type = 'C' .or. field_type = 'N'
            // Cria controle text
            fwrite(errhandle,[                            <tr bgcolor="#CCCCFF">]+&ret_line.)
            fwrite(errhandle,[                                <td width="135" align="right" bgcolor="#9999CC">]+&ret_line.)
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">]+NewCapfirst(alltrim(field_name))+[</font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            if field_len > 45
               // Cria controle textarea
               fwrite(errhandle,[                            <td width="452"> ]+&ret_line.)
               fwrite(errhandle,[                                <textarea align=left rows="3" cols="50" maxlength="300" type="text" name="]+alltrim(field_name)+[" size="50" tabindex="]+str(recno(),2)+["></textarea>]+&ret_line.)
               fwrite(errhandle,[                            </td>]+&ret_line.)
            else
               fwrite(errhandle,[                            <td width="452"> ]+&ret_line.)
               fwrite(errhandle,[                                <input align=left maxlength="135" type="text" name="]+alltrim(field_name)+[" size="]+str(field_len,2)+[" tabindex="]+str(recno(),2)+[">]+&ret_line.)
               fwrite(errhandle,[                            </td>]+&ret_line.)
            endif
            fwrite(errhandle,[                            </tr>]+&ret_line.)
       endif
       if   field_type = 'M' 
            // Cria controle textarea
            fwrite(errhandle,[                            <tr bgcolor="#CCCCFF">]+&ret_line.)
            fwrite(errhandle,[                                <td width="135" align="right" bgcolor="#9999CC">]+&ret_line.)
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">Nome</font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                                <td width="452"> ]+&ret_line.)
            fwrite(errhandle,[                                    <textarea align=left rows="3" cols="50" maxlength="300" type="text" name="]+alltrim(field_name)+[" size="50" tabindex="]+str(recno(),2)+["></textarea>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                            </tr>]+&ret_line.)
       endif
       skip
    enddo
    fwrite(errhandle,[                            </table>]+&ret_line.)
    fwrite(errhandle,[                            <!-- ---------- INICIO DE PAGINA COMPLEMENTAR -------- -->]+&ret_line.)
    fwrite(errhandle,[                            <table border="0" cellpadding="2" cellspacing="1" width="600" bgcolor="#FFFFFF">]+&ret_line.)
    /*
    fwrite(errhandle,[                                   <tr bgcolor="#330066" align="center">]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"><font face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                           <b><font color="#FFFFFF">Marque os tipos de informativos gostaria de receber em sua caixa de mensagem!</font></b></font>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#CCCCFF">]+&ret_line.)
    fwrite(errhandle,[                                       <td width="200"> <input type="checkbox" name="ezines" value="SB" > <font size="2" face="Arial, Helvetica, sans-serif">Produtos</font></td>]+&ret_line.)
    fwrite(errhandle,[                                       <td width="200"> <input type="checkbox" name="ezines" value="WP" > <font size="2" face="Arial, Helvetica, sans-serif">Servicos</font></td>]+&ret_line.)
    fwrite(errhandle,[                                       <td width="200"> <input type="checkbox" name="ezines" value="TR" > <font size="2" face="Arial, Helvetica, sans-serif">Internet</font></td></tr><tr bgcolor="#9999CC"> <td align="right" bgcolor="#330066" colspan="3"><img src="../imagens/spacer.gif" width="3" height="3"></td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <!-- ---------- INICIO DE BLOCO INFORMATIVO -------- -->]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#9999CC">]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"> ]+&ret_line.)
    fwrite(errhandle,[                                           <input type="checkbox" name="is_HTML_reader" value="Y" >]+&ret_line.)
    fwrite(errhandle,[                                           <font size="2" face="Arial, Helvetica, sans-serif">Gostaria de receber minhas mensagem atraves de minha area privativa no site.<br>]+&ret_line.)
    fwrite(errhandle,[                                           <font face="arial, helvetica" size="2" color="#660066">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Obs: Somente para clientes cadastrados via site.</font></font>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    */
    fwrite(errhandle,[                                   <tr bgcolor="#9999CC"> ]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"> ]+&ret_line.)
    fwrite(errhandle,[                                           <input type="checkbox" name="is_HTML_reader" value="Y" checked>]+&ret_line.)
    fwrite(errhandle,[                                           <font size="2" face="Arial, Helvetica, sans-serif">Pelo envio deste formulario quero garantir a atualizacao de meus dados _ SoftClever.</font>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#330066">]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"> ]+&ret_line.)
    fwrite(errhandle,[                                       <div align="center"><b>]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif" color="#FFFFFF"><br>]+&ret_line.)
    fwrite(errhandle,[                                            Clicando em '<b>Enviar formulario</b>!' seus dados serao armazenados em _ on-line e uma saudacao lhe sera enviado o mais breve possivel.]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif"><br>]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            <font size="2" face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            <font size="2" face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            <p>]+&ret_line.)
    fwrite(errhandle,[                                            <input type="submit" value=" Enviar formulario! " name="submit">]+&ret_line.)
    fwrite(errhandle,[                                            <input type="reset"  value=" Cancelar envio " name="reset">]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            </b>]+&ret_line.)
    fwrite(errhandle,[                                       </div>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                            </table>]+&ret_line.)
    fwrite(errhandle,[                     </form>]+&ret_line.)
    fwrite(errhandle,[                     <!-- END FORM HERE -->]+&ret_line.)
    fwrite(errhandle,[                 </td> ]+&ret_line.)
    fwrite(errhandle,[              </tr> ]+&ret_line.)
    fwrite(errhandle,[       </table>]+&ret_line.)
    fwrite(errhandle,[</table>]+&ret_line.)
    fwrite(errhandle,[</html>]+&ret_line.)
    fclose(errhandle)
    use
    if cFile = NIL
       iprg_files = iprg_files + 1 
       ? iprg_files
    else
       exit
    endif
enddo
RETURN

FUNCTION NewCapFirst
parameter string
declare excesao[7]
excesao[1] = " Do "
excesao[2] = " Dos "
excesao[3] = " Da "
excesao[4] = " Das "
excesao[5] = " De "
excesao[6] = " E "
excesao[7] = " Del "
novotexto = space(1)+lower(string)
fim = len(string)
for i = 1 to fim
   if substr(novotexto,i,1) = " "
      novotexto = stuff(novotexto,i+1,1,upper(substr(novotexto,i+1,1)))
   endif
next
tamanho = len(excesao)
for i = 1 to tamanho
   if excesao[i]$novotexto   && tamanho
      novotexto = stuff(novotexto,AT(excesao[i],novotexto),;
      len(excesao[i]),lower(excesao[i]))
   endif
next
RETURN(ltrim(novotexto))
MakeASP <dbf_file> example: MakeASP clients

MakeASP.PRG code:

Code: Select all

PARA cFile,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10

    p1  := iif(p1=NIL,"",p1)
    p2  := iif(p2=NIL,"",p2)
    p3  := iif(p3=NIL,"",p3)
    p4  := iif(p4=NIL,"",p4)
    p5  := iif(p5=NIL,"",p5)
    p6  := iif(p6=NIL,"",p6)
    p7  := iif(p7=NIL,"",p7)
    p8  := iif(p8=NIL,"",p8)
    p9  := iif(p9=NIL,"",p9)
    p10 := iif(p10=NIL,"",p10)
    ? 'MAKEasp 1.0 Direiros Reservados 1999-2000 Soft Clever Informatica ME.'
    if cFile = NIL
       ? 'Uso    :  MAKEasp <dbf_file> '
       ? ' '
       ? 'Exemplo:  MAKEasp <dbf_file>'
       QUIT
    endif
    ? ' '
    //numprg={}
    //numprg=Adir("*.dbf")
    numopt=p1+p2+p3+p4+p5+p6+p7+p8+p9+p10
    //declare prg_files[numprg]
    //Adir("*.dbf",prg_files)
    //Asort(prg_files)
    //
    // -> Arquivo temporario
iprg_files = 1 
//do while .t.

    prg_name := cFile
    //prg_name := alltrim(substr(prg_files[iprg_files],1,at(".",prg_files[iprg_files])-1))
    ? 'Criando... '+prg_name
    use (prg_name)
    copy structure extend to temp
    use
    use temp
    go top

    cFile := alltrim(prg_name) + ".HTM"
    ret_line := "chr(13)+chr(10)"

    errhandle = fcreate(cFile)
    fwrite(errhandle,[<html>]+&ret_line.)
    fwrite(errhandle,[<body bgcolor="#FFFFFF">]+&ret_line.)
    fwrite(errhandle,[<table border=0 cellpadding=0 cellspacing=0 valign="top"  align="center" width="70%">]+&ret_line.)
    fwrite(errhandle,[       <table width="100%" border="0" cellspacing="0" cellpadding="0">]+&ret_line.)
    fwrite(errhandle,[              <tr>]+&ret_line.) 
    fwrite(errhandle,[                 <td colspan="2" bgcolor="#FFFFFF" valign="center" align="center">]+&ret_line.) 
    fwrite(errhandle,[                     <!-- START FORM HERE -->]+&ret_line.)
    fwrite(errhandle,[                     <form name="frm]+NewCapFirst(prg_name)+[" action="]+prg_name+[.asp" method="POST" onSubmit="">]+&ret_line.)
    fwrite(errhandle,[                            <input type="hidden" name="acao"   value="inclusao">]+&ret_line.)
    fwrite(errhandle,[                            <!-- BLOCO DE MANUTENCAO -->]+&ret_line.)
    fwrite(errhandle,[                            <input type="hidden" name="origem" value="IP">]+&ret_line.)
    fwrite(errhandle,[                            <!-- BR -->]+&ret_line.)
    fwrite(errhandle,[                            <!-- p align="center" -->]+&ret_line.) 
    fwrite(errhandle,[                            <table border="0" cellpadding="2" cellspacing="1" width="600" bgcolor="#FFFFFF">]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#386898" align="center">]+&ret_line.) 
    fwrite(errhandle,[                                       <td colspan="2">]+&ret_line.)
    fwrite(errhandle,[                                           <b>]+&ret_line.)
    fwrite(errhandle,[                                           <font color="#FFFFFF" size="4" face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                                 <strong>Atenção:</strong>]+&ret_line.)
    fwrite(errhandle,[                                           </font>]+&ret_line.)
    fwrite(errhandle,[                                           <font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Contamos com sua atenção no preenchimento do formulário abaixo.</font>&nbsp;]+&ret_line.)
    fwrite(errhandle,[                                           </b>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <tbody> ]+&ret_line.)
    fwrite(errhandle,[                            </table>]+&ret_line.)
    fwrite(errhandle,[                            <!-- ------------- INICIO DO BLOCO DE CAMPOS ------------ -->]+&ret_line.)
    fwrite(errhandle,[                            <table border="0" cellpadding="2" cellspacing="1" width="600" bgcolor="#FFFFFF">]+&ret_line.)
    do while .not. eof()
       if   field_type = 'L' .or. (field_type = 'C' .and. field_len = 1)
            // Cria controle checkbox
            fwrite(errhandle,[                            <tr bgcolor="#E8F0FF">]+&ret_line.)
            fwrite(errhandle,[                                <td width="135" align="right" bgcolor="#A8C8E8">]+&ret_line.)
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">]+NewCapfirst(alltrim(field_name))+[</font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                                <td width="452">]+&ret_line.)
            fwrite(errhandle,[                                    <input align=left maxlength="135" type="checkbox" name="]+alltrim(field_name)+[" size="1" tabindex="]+str(recno(),2)+[">]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                            </tr>]+&ret_line.)
            skip
            loop
       endif
       /*
       if   field_type = 'D'
            // Cria controle data
            fwrite(errhandle,[                            <tr bgcolor="#E8F0FF">]+&ret_line.)
            fwrite(errhandle,[                                <td align="right" width="135" bgcolor="#A8C8E8">]+&ret_line.)
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">]+alltrim(NewCapFirst(field_name))+[ <small>(dd/mm/yy)</small></font>]+&ret_line.)
            fwrite(errhandle,[                                    <font size="1"><small><br></small></font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                                <td width="452"> ]+&ret_line.)
            fwrite(errhandle,[                                    <select name="DIA_]+alltrim(field_name)+[" size="1" tabindex="]+str(recno(),2)+[">]+&ret_line.)
            fwrite(errhandle,[                                            <option selected value=""></option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="01">01</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="02">02</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="03">03</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="04">04</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="05">05</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="06">06</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="07">07</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="08">08</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="09">09</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="10">10</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="11">11</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="12">12</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="13">13</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="14">14</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="15">15</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="16">16</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="17">17</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="18">18</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="19">19</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="20">20</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="21">21</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="22">22</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="23">23</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="24">24</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="25">25</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="26">26</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="27">27</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="28">28</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="29">29</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="30">30</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="31">31</option>]+&ret_line.)
            fwrite(errhandle,[                                    </select>&nbsp;]+&ret_line.)
            fwrite(errhandle,[                                    <select name="MES_]+alltrim(field_name)+[" size="1" tabindex="]+str(recno(),2)+[">]+&ret_line.)
            fwrite(errhandle,[                                            <option selected value=""></option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="01">Janeiro</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="02">Fevereiro</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="03">Marco</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="04">Abril</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="05">Maio</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="06">Junho</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="07">Julho</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="08">Agosto</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="09">Setembro</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="10">Outubro</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="11">Novembro</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="12">Dezembro</option>]+&ret_line.)
            fwrite(errhandle,[                                    </select>&nbsp;]+&ret_line.)
            fwrite(errhandle,[                                    <select name="ANO_]+alltrim(field_name)+[" size="1" tabindex="]+str(recno(),2)+[">]+&ret_line.)
            fwrite(errhandle,[                                            <option selected value=""></option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="2000">2000</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="2001">2001</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="2002">2002</option>]+&ret_line.)
            fwrite(errhandle,[                                            <option value="2003">2003</option>]+&ret_line.)
            fwrite(errhandle,[                                    </select>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                            </tr>]+&ret_line.)
       endif
       */
       if   field_type = 'C' .or. field_type = 'N' .or. field_type = 'D'
            // Cria controle text
            fwrite(errhandle,[                            <tr bgcolor="#E8F0FF">]+&ret_line.)
            fwrite(errhandle,[                                <td width="135" align="right" bgcolor="#A8C8E8">]+&ret_line.)
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">]+NewCapfirst(alltrim(field_name))+[</font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            if field_len > 45
               // Cria controle textarea
               fwrite(errhandle,[                            <td width="452"> ]+&ret_line.)
               fwrite(errhandle,[                                <textarea align=left rows="3" cols="50" maxlength="300" size="50" tabindex="]+str(recno(),2)+[" type="text" name="]+alltrim(field_name)+["></textarea>]+&ret_line.)
               fwrite(errhandle,[                            </td>]+&ret_line.)
            else
               fwrite(errhandle,[                            <td width="452"> ]+&ret_line.)
               fwrite(errhandle,[                                <input align=left maxlength="135" type="text" name="]+alltrim(field_name)+[" size="]+str(field_len,2)+[" tabindex="]+str(recno(),2)+[">]+&ret_line.)
               fwrite(errhandle,[                            </td>]+&ret_line.)
            endif
            fwrite(errhandle,[                            </tr>]+&ret_line.)
       endif
       if   field_type = 'M' 
            // Cria controle textarea
            fwrite(errhandle,[                            <tr bgcolor="#E8F0FF">]+&ret_line.)
            fwrite(errhandle,[                                <td width="135" valign="top" align="right" bgcolor="#A8C8E8">]+&ret_line.) 
            fwrite(errhandle,[                                    <font size="2" face="Arial, Helvetica, sans-serif">]+NewCapfirst(alltrim(field_name))+[</font>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                                <td width="452"> ]+&ret_line.)
            fwrite(errhandle,[                                    <textarea align=left rows="3" cols="50" maxlength="300" size="50" tabindex="]+str(recno(),2)+[" type="text" name="]+alltrim(field_name)+["></textarea>]+&ret_line.)
            fwrite(errhandle,[                                </td>]+&ret_line.)
            fwrite(errhandle,[                            </tr>]+&ret_line.)
       endif
       skip
    enddo
    fwrite(errhandle,[                            </table>]+&ret_line.)
    fwrite(errhandle,[                            <!-- ---------- INICIO DE PAGINA COMPLEMENTAR -------- -->]+&ret_line.)
    fwrite(errhandle,[                            <table border="0" cellpadding="2" cellspacing="1" width="600" bgcolor="#FFFFFF">]+&ret_line.)
    /*
    fwrite(errhandle,[                                   <tr bgcolor="#330066" align="center">]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"><font face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                           <b><font color="#FFFFFF">Marque os tipos de informativos gostaria de receber em sua caixa de mensagem!</font></b></font>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#CCCCFF">]+&ret_line.)
    fwrite(errhandle,[                                       <td width="200"> <input type="checkbox" name="ezines" value="SB" > <font size="2" face="Arial, Helvetica, sans-serif">Produtos</font></td>]+&ret_line.)
    fwrite(errhandle,[                                       <td width="200"> <input type="checkbox" name="ezines" value="WP" > <font size="2" face="Arial, Helvetica, sans-serif">Servicos</font></td>]+&ret_line.)
    fwrite(errhandle,[                                       <td width="200"> <input type="checkbox" name="ezines" value="TR" > <font size="2" face="Arial, Helvetica, sans-serif">Internet</font></td></tr><tr bgcolor="#9999CC"> <td align="right" bgcolor="#330066" colspan="3"><img src="../imagens/spacer.gif" width="3" height="3"></td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <!-- ---------- INICIO DE BLOCO INFORMATIVO -------- -->]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#9999CC">]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"> ]+&ret_line.)
    fwrite(errhandle,[                                           <input type="checkbox" name="is_HTML_reader" value="Y" >]+&ret_line.)
    fwrite(errhandle,[                                           <font size="2" face="Arial, Helvetica, sans-serif">Gostaria de receber minhas mensagem atraves de minha area privativa no site.<br>]+&ret_line.)
    fwrite(errhandle,[                                           <font face="arial, helvetica" size="2" color="#660066">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Obs: Somente para clientes cadastrados via site.</font></font>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    */
    fwrite(errhandle,[                                   <tr bgcolor="#A8C8E8"> ]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"> ]+&ret_line.)
    fwrite(errhandle,[                                           <input type="checkbox" name="is_HTML_reader" value="Y" checked>]+&ret_line.)
    fwrite(errhandle,[                                           <font size="2" face="Arial, Helvetica, sans-serif">Pelo envio deste formulario quero garantir a atualizacao de meus dados _ SoftClever.</font>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                                   <tr bgcolor="#386898">]+&ret_line.)
    fwrite(errhandle,[                                       <td colspan="3"> ]+&ret_line.)
    fwrite(errhandle,[                                       <div align="center"><b>]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif" color="#FFFFFF"><br>]+&ret_line.)
    fwrite(errhandle,[                                            Clicando em '<b>Enviar formulario</b>!' seus dados serao armazenados em _ on-line e uma saudacao lhe sera enviado o mais breve possivel.]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif"><br>]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            <font size="2" face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            <font size="2" face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            <p>]+&ret_line.)
    fwrite(errhandle,[                                            <input type="submit" value=" Enviar formulario! " name="submit" style="color: #ffffff background-color: #3399ff" onClick="javascript:Cadastrar]+alltrim(NewCapFirst(prg_name))+[()">]+&ret_line.)
    fwrite(errhandle,[                                            <input type="reset"  value=" Cancelar envio "     name="reset"  style="color: #ffffff background-color: #3399ff">]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            <font face="Arial, Helvetica, sans-serif">]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            </font>]+&ret_line.)
    fwrite(errhandle,[                                            </b>]+&ret_line.)
    fwrite(errhandle,[                                       </div>]+&ret_line.)
    fwrite(errhandle,[                                       </td>]+&ret_line.)
    fwrite(errhandle,[                                   </tr>]+&ret_line.)
    fwrite(errhandle,[                            </table>]+&ret_line.)
    fwrite(errhandle,[                            <script language="javascript">]+&ret_line.)
    fwrite(errhandle,[                            function Cadastrar]+alltrim(NewCapFirst(prg_name))+[()]+&ret_line.)
    fwrite(errhandle,[                                     {]+&ret_line.)
    go top
    do while .not. eof()
       if field_type = 'N'
          fwrite(errhandle,[                                      if (isNaN(document.frm]+alltrim(NewCapFirst(prg_name))+[.]+alltrim(field_name)+[.value))]+&ret_line.)
          fwrite(errhandle,[                                         {]+&ret_line.)
          fwrite(errhandle,[                                            alert("O campo (]+alltrim(field_name)+[) deve ser numérico.")]+&ret_line.)
          fwrite(errhandle,[                                            document.frm]+alltrim(NewCapFirst(prg_name))+[.]+alltrim(field_name)+[.focus()]+&ret_line.)
          fwrite(errhandle,[                                            return]+&ret_line.)
          fwrite(errhandle,[                                         }]+&ret_line.)
       endif
       if field_type = 'C' .or. field_type = 'M'
          fwrite(errhandle,[                                      if (document.frm]+alltrim(NewCapFirst(prg_name))+[.]+alltrim(field_name)+[.value == "")]+&ret_line.)
          fwrite(errhandle,[                                         {]+&ret_line.)
          fwrite(errhandle,[                                            alert("Favor informar o conteudo do campo (]+alltrim(field_name)+[).")]+&ret_line.)
          fwrite(errhandle,[                                            document.frm]+alltrim(NewCapFirst(prg_name))+[.]+alltrim(field_name)+[.focus()]+&ret_line.)
          fwrite(errhandle,[                                            return]+&ret_line.)
          fwrite(errhandle,[                                         }]+&ret_line.)
       endif
       skip
    enddo
    fwrite(errhandle,[                                     document.frm]+alltrim(NewCapFirst(prg_name))+[.submit();]+&ret_line.)
    fwrite(errhandle,[                                     }]+&ret_line.)
    fwrite(errhandle,[                            </script>]+&ret_line.)
    fwrite(errhandle,[                     </form>]+&ret_line.)
    fwrite(errhandle,[                     <!-- END FORM HERE -->]+&ret_line.)
    fwrite(errhandle,[                 </td> ]+&ret_line.)
    fwrite(errhandle,[              </tr> ]+&ret_line.)
    fwrite(errhandle,[       </table>]+&ret_line.)
    fwrite(errhandle,[</table>]+&ret_line.)
    fwrite(errhandle,[</html>]+&ret_line.)
    fclose(errhandle)


    cFile := alltrim(prg_name) + ".ASP"
    ret_line := "chr(13)+chr(10)"

    errhandle = fcreate(cFile)

    fwrite(errhandle,[<table border=0  width=100%>]+&ret_line.)
    fwrite(errhandle,[<tr width=100%><td width=100% valign=top><h2>Cadastro de Cliente</h2></td></tr>]+&ret_line.)
    fwrite(errhandle,[<% DIM acao,usuario_id, ])
    go top
    do while .not. eof()
        fwrite( errhandle,lower(alltrim(field_name)) )
        skip
        if eof()
           fwrite(errhandle,&ret_line.)
        else
           fwrite(errhandle,[,])
        endif
    enddo
    fwrite(errhandle,['acao = Request.QueryString("acao")]+&ret_line.)
    fwrite(errhandle,[acao = Request.Form("acao")]+&ret_line.)
    fwrite(errhandle,['Checa o preenchimento do formulário]+&ret_line.)
    fwrite(errhandle,[If acao="inclusao" OR acao="atualizar" Then]+&ret_line.)
    //fwrite(errhandle,[        If acao="incluir" Then]+&ret_line.)
    //fwrite(errhandle,[                If (Request.Form("usuario") = "") Then erro = "XX" End If]+&ret_line.)
    //fwrite(errhandle,[                usuario = Request.Form("usuario")]+&ret_line.)
    //fwrite(errhandle,[        End If]+&ret_line.)
    go top
    do while .not. eof()
       fwrite(errhandle,[   If (Request.Form("]+upper(alltrim(field_name))+[") = "") Then erro = "XX" End If]+&ret_line.)
       skip
    enddo
    go top
    do while .not. eof()
       fwrite(errhandle,[   ]+lower(field_name)+[ = Request.Form("]+upper(alltrim(field_name))+[")]+&ret_line.)
       skip
    enddo
    go top
    fwrite(errhandle,[End If]+&ret_line.)
    fwrite(errhandle,[If erro = "XX" Then ]+&ret_line.)
    fwrite(errhandle,[   response.write ("<script>")]+&ret_line.)
    fwrite(errhandle,[   response.write ("      alert('Por favor, preencha todas informações.')")]+&ret_line.)
    fwrite(errhandle,[   response.write ("</script>")]+&ret_line.)
    fwrite(errhandle,[End If]+&ret_line.)
    fwrite(errhandle,[   ]+&ret_line.)
    fwrite(errhandle,['Se há algum erro no formulário volta para edição]+&ret_line.)
    fwrite(errhandle,[If erro = "XX" Then]+&ret_line.)
    fwrite(errhandle,[   Select Case acao]+&ret_line.)
    fwrite(errhandle,[               Case "atualizar"]+&ret_line.)
    fwrite(errhandle,[                    acao = "editar"]+&ret_line.)
    fwrite(errhandle,[               Case "incluir"]+&ret_line.)
    fwrite(errhandle,[                    acao = ""]+&ret_line.)
    fwrite(errhandle,[   End Select]+&ret_line.)
    fwrite(errhandle,[End If]+&ret_line.)
    fwrite(errhandle,[   ]+&ret_line.)
    fwrite(errhandle,['Inclui cliente]+&ret_line.)
    fwrite(errhandle,[If acao = "inclusao" AND erro = "" Then]+&ret_line.)
    fwrite(errhandle,[   pos    = instrrev(lcase(request.servervariables("path_translated")),lcase(scriptrelativefolder) & "\" & lcase(formaction))]+&ret_line.)
    fwrite(errhandle,[   db_dir = left(request.servervariables("path_translated"), pos-1 )]+&ret_line.)
    fwrite(errhandle,[   db     = db_dir & "\"]+&ret_line.)
    fwrite(errhandle,[   set cnn= server.createobject("adodb.connection")]+&ret_line.)
    fwrite(errhandle,[   cnn.open "Driver={Microsoft dBase Driver (*.dbf)};;DBQ=" & db & ";"]+&ret_line.)
    fwrite(errhandle,[   cnn.execute("INSERT INTO ]+alltrim(prg_name)+[(])
    go top
    do while .not. eof()
       fwrite(errhandle,lower(alltrim(field_name)))
       skip
       if eof()
          fwrite(errhandle,[)" &_]+&ret_line.)
       else
          fwrite(errhandle,[,])
       endif
    enddo
    fwrite(errhandle,[               "VALUES ('"&_]+&ret_line.)
    go top
    do while .not. eof()
       fwrite(errhandle,[                        ]+upper(alltrim(field_name)))
       skip
       if eof()
          fwrite(errhandle,[&"')" )]+&ret_line.)
       else
          fwrite(errhandle,[&"','"&_]+&ret_line.)
       endif
    enddo
    fwrite(errhandle,[   set cnn= nothing]+&ret_line.)
    fwrite(errhandle,[   response.write ("<script>")]+&ret_line.)
    fwrite(errhandle,[   response.write ("      alert('Operacao efetuada com sucesso!')")]+&ret_line.)
    fwrite(errhandle,[   response.write ("</script>")]+&ret_line.)
    fwrite(errhandle,[End If]+&ret_line.)

    fwrite(errhandle,['Atualiza informações]+&ret_line.)
    fwrite(errhandle,[If acao = "atualizar" Then]+&ret_line.)
    fwrite(errhandle,[   pos    = instrrev(lcase(request.servervariables("path_translated")),lcase(scriptrelativefolder) & "\" & lcase(formaction))]+&ret_line.)
    fwrite(errhandle,[   db_dir = left(request.servervariables("path_translated"), pos-1 )]+&ret_line.)
    fwrite(errhandle,[   db     = db_dir & "\"]+&ret_line.)
    fwrite(errhandle,[   set cnn= server.createobject("adodb.connection")]+&ret_line.)
    fwrite(errhandle,[   cnn.open "Driver={Microsoft dBase Driver (*.dbf)};;DBQ=" & db & ";"]+&ret_line.)
    fwrite(errhandle,[   cnn.execute("UPDATE ]+alltrim(prg_name)+[ set " &_]+&ret_line.)
    go top
    do while .not. eof()
       fwrite(errhandle,[                    "]+lower(alltrim(field_name))+[=']+lower(alltrim(field_name))+['])
       skip
       if eof()
          fwrite(errhandle,[ WHERE id=" & Session("usuario_id"))]+&ret_line.)
          //fwrite(errhandle,[ WHERE id=" & Session("usuario_id"))]+&ret_line.)
       else
          fwrite(errhandle,[" &_]+&ret_line.)
       endif
    enddo
    fwrite(errhandle,[   set cnn= nothing]+&ret_line.)
    fwrite(errhandle,[   response.write ("<script>")]+&ret_line.)
    fwrite(errhandle,[   response.write ("      alert('Atualizacao efetuada com sucesso!')")]+&ret_line.)
    fwrite(errhandle,[   response.write ("</script>")]+&ret_line.)
    fwrite(errhandle,[End If]+&ret_line.)
    fwrite(errhandle,[%>]+&ret_line.)
    fclose(errhandle)
    use
RETURN
Put the .HTM and .ASP in your server and test.

This is the begining.

Download all files in http://www.5volution.com/downloads/makehtm.zip
Post Reply