xml-axkit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject cvs commit: xml-axkit/demo/xsp cookie.xsp core.xsp esql.xsp exception.xsp ifparam.xsp param.xsp perform.xsp sendmail.xsp session.xsp showsource.xsp util.xsp webutils.xsp .htaccess index.xml
Date Thu, 14 Mar 2002 22:29:59 GMT
matts       02/03/14 14:29:59

  Modified:    demo/xsp .htaccess index.xml
  Added:       demo/xsp cookie.xsp core.xsp esql.xsp exception.xsp
                        ifparam.xsp param.xsp perform.xsp sendmail.xsp
                        session.xsp showsource.xsp util.xsp webutils.xsp
  Log:
  Initial XSP example codes
  
  Revision  Changes    Path
  1.3       +4 -0      xml-axkit/demo/xsp/.htaccess
  
  Index: .htaccess
  ===================================================================
  RCS file: /home/cvs/xml-axkit/demo/xsp/.htaccess,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- .htaccess	9 Mar 2002 16:26:42 -0000	1.2
  +++ .htaccess	14 Mar 2002 22:29:58 -0000	1.3
  @@ -6,4 +6,8 @@
   ErrorDocument 500 /axkit/xsp/error.html
   
   AxAddRootProcessor application/x-xsp NULL {http://www.apache.org/1999/XSP/Core}page
  +AxAddRootProcessor application/x-xsp NULL {http://apache.org/xsp/core/v1}page
   
  +<Files esql.xsp>
  +AxAddXSPTaglib AxKit::XSP::ESQL
  +</Files>
  
  
  
  1.2       +143 -8    xml-axkit/demo/xsp/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/xml-axkit/demo/xsp/index.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- index.xml	9 Mar 2002 16:26:42 -0000	1.1
  +++ index.xml	14 Mar 2002 22:29:58 -0000	1.2
  @@ -1,10 +1,10 @@
   <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core">
   
  -<html>
  -    <xsp:logic>
  -    $r->no_cache(1);
  -    </xsp:logic>
  +<xsp:logic>
  +my @errors;
  +</xsp:logic>
   
  +<html>
       <head>
           <title>XSP Examples</title>
           <link rel="stylesheet" href="/axkit/stylesheets/style.css"/>
  @@ -16,19 +16,137 @@
           and lists the example pages that will work on your installation.
           </p>
           <p>
  +        Please note that all of these examples purely use only XSP, whereas normally
  +        you would use XSP in conjunction with some stylesheet language such as XSLT,
  +        in order to maintain a separation of content from presentation. Therefore
  +        these examples should be used as a technology demonstration, not a guideline.
  +        </p>
  +        <p>
               <ul>
  -                <li><a href="core.xsp">Core XSP only Example</a></li>
                   
               <xsp:logic>
  +            @errors = ();
  +            
               eval {
                   require AxKit::XSP::ESQL;
  +                require DBD::SQLite;
               };
               if (!$@) {
                   <li><a href="esql.xsp">ESQL Example</a></li>
               }
               else {
                   AxKit::Debug(1, "ESQL failed to load: $@");
  -                <li>ESQL Example unavailable (see error log for details)</li>
  +                push @errors, $@;
  +                <li>ESQL Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::Cookie;
  +            };
  +            if (!$@) {
  +                <li><a href="cookie.xsp">Cookie Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "Cookie Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>Cookie Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::Exception;
  +            };
  +            if (!$@) {
  +                <li><a href="exception.xsp">Exceptions Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "Exceptions Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>Exceptions Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::IfParam;
  +            };
  +            if (!$@) {
  +                <li><a href="ifparam.xsp">IfParam Taglib Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "IfParam Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>IfParam Taglib Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::Param;
  +            };
  +            if (!$@) {
  +                <li><a href="param.xsp">Param Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "Param Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>Param Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::PerForm;
  +                require XML::LibXSLT;
  +            };
  +            if (!$@) {
  +                <li><a href="perform.xsp">PerForm Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "PerForm Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>PerForm Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::Sendmail;
  +            };
  +            if (!$@) {
  +                <li><a href="sendmail.xsp">Sending Email Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "Sendmail Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>Sending Email Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::Util;
  +            };
  +            if (!$@) {
  +                <li><a href="util.xsp">Util Taglib Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "Util Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>Util Taglib Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::WebUtils;
  +            };
  +            if (!$@) {
  +                <li><a href="webutils.xsp">WebUtils Taglib Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "WebUtils Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>WebUtils Taglib Example unavailable (see below for details)</li>
  +            }
  +            
  +            eval {
  +                require AxKit::XSP::Session;
  +            };
  +            if (!$@) {
  +                <li><a href="session.xsp">Session Taglib Example</a></li>
  +            }
  +            else {
  +                AxKit::Debug(1, "Session Taglib failed to load: $@");
  +                push @errors, $@;
  +                <li>Session Taglib Example unavailable (see below for details)</li>
               }
               
               </xsp:logic>
  @@ -38,10 +156,27 @@
           If no examples appear other than the core XSP example, then you may
           need to install some of the XSP taglibs from CPAN. To find those, either
           load up the CPAN shell and type: <tt>i /XSP/</tt> to see all the taglibs
  -        available, or go to <a 
  -        href="http://search.cpan.org/search?mode=module;query=XSP">this link</a>
  +        available, or go to 
  +        <a href="http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?search=AxKit%3A%3AXSP"
  +        >this link</a>
           to find all the XSP taglibs on CPAN.
           </p>
  +        <p>
  +        Please also note that this file itself is an example of XSP without using
  +        any tag libraries. You can see it by clicking on <a href="showsource.xsp?index.xml">View
Source</a>
  +        </p>
  +        <!--
  +        <p>
  +        The errors that occured checking if the above demos would work are, in order:
  +        <ul>
  +        <xsp:logic>
  +            foreach my $err (@errors) {
  +                <li><tt><xsp:expr>$err</xsp:expr></tt></li>
  +            }
  +        </xsp:logic>
  +        </ul>
  +        </p>
  +        -->
       </body>
   </html>
   </xsp:page>
  
  
  
  1.1                  xml-axkit/demo/xsp/cookie.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/core.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/esql.xsp
  
  Index: esql.xsp
  ===================================================================
  <xsp:page 
      xmlns:xsp="http://apache.org/xsp/core/v1"
      xmlns:esql="http://apache.org/xsp/SQL/v2"
  >
  
  <xsp:import>File::Spec</xsp:import>
  
  <xsp:logic>my $dbname = File::Spec->catdir(File::Spec->tmpdir, "esqldemo.db");</xsp:logic>
  
  <html>
      <head>
          <title>ESQL Example</title>
          <link rel="stylesheet" url="/axkit/stylesheets/style.css"/>
      </head>
      
      <body>
      <h1>ESQL Example (<xsp:expr>$dbname</xsp:expr>)</h1>
      
      <!-- remove/recreate the db on every hit -->
      <xsp:logic>
        <esql:connection>
          <esql:driver transactions="yes">SQLite</esql:driver>
          <esql:dburl>dbname=<xsp:expr>$dbname</xsp:expr></esql:dburl>
          
          <xsp:logic>
          
          if ($cgi->param('reset')) {
            eval {
              <esql:execute-query>
                  <esql:query>drop table example</esql:query>
                  <esql:update-results/>
              </esql:execute-query>
            };
          }
  
          <!-- Create Tables -->
          eval {
              <esql:execute-query>
                  <esql:query>create table example ( id integer primary key, firstname,
lastname, email )</esql:query>
                  <esql:update-results>
                      <p>Table (re)created successfully.</p>
                  </esql:update-results>
              </esql:execute-query>
          };
          
          if ($cgi->param('type') eq 'query') {
              <!-- Query Database -->
              <esql:execute-query>
                  <esql:query>
                      select * from example
                      where firstname = <esql:parameter><xsp:expr>$cgi->param('firstname')</xsp:expr></esql:parameter>
                      and lastname = <esql:parameter><xsp:expr>$cgi->param('lastname')</xsp:expr></esql:parameter>
                      and email = <esql:parameter><xsp:expr>$cgi->param('email')</xsp:expr></esql:parameter>
                  </esql:query>
                  <esql:results>
                      <p>Results:
                      <table border="1">
                          <tr>
                              <th>First Name</th><th>Last Name</th><th>Email</th>
                          </tr>
                          <esql:row-results>
                          <tr>
                              <td><esql:get-column column="firstname"/></td>
                              <td><esql:get-column column="lastname"/></td>
                              <td><esql:get-column column="email"/></td>
                          </tr>
                          </esql:row-results>
                      </table>
                      </p>
                  </esql:results>
                  <esql:no-results>
                      <p>No results found for your query.</p>
                  </esql:no-results>
              </esql:execute-query>
          }
          elsif ($cgi->param('type') eq 'show all') {
              <esql:execute-query>
                  <esql:query>
                      select * from example
                  </esql:query>
                  <esql:results>
                      <p>Results:
                      <table border="1">
                          <tr>
                              <th>id</th><th>First Name</th><th>Last
Name</th><th>Email</th>
                          </tr>
                          <esql:row-results>
                          <tr>
                              <td><esql:get-column column="id"/></td>
                              <td><esql:get-column column="firstname"/></td>
                              <td><esql:get-column column="lastname"/></td>
                              <td><esql:get-column column="email"/></td>
                          </tr>
                          </esql:row-results>
                      </table>
                      </p>
                  </esql:results>
                  <esql:no-results>
                      <p>No results found for your query.</p>
                  </esql:no-results>
              </esql:execute-query>
          }
          elsif ($cgi->param('type') eq 'insert') {
              <!-- Insert new row -->
              <esql:execute-query>
                  <esql:query>
                      insert into example (firstname, lastname, email) values (
                          <esql:parameter><xsp:expr>$cgi->param('firstname')</xsp:expr></esql:parameter>,
                          <esql:parameter><xsp:expr>$cgi->param('lastname')</xsp:expr></esql:parameter>,
                          <esql:parameter><xsp:expr>$cgi->param('email')</xsp:expr></esql:parameter>
                          )
                  </esql:query>
                  <esql:update-results>
                      <p>Row inserted successfully.</p>
                  </esql:update-results>
              </esql:execute-query>
          }
              
          <p>
          <!-- Show Form -->
          <form method="GET">
              <table>
              <tr>
                  <td>First name:</td>
                  <td><input type="text" name="firstname">
                      <xsp:attribute name="VALUE">
                          <xsp:expr>$cgi->param('firstname')</xsp:expr>
                      </xsp:attribute>
                      </input>
                  </td>
              </tr>
              <tr>
                  <td>Last name:</td>
                  <td><input type="text" name="lastname">
                      <xsp:attribute name="value">
                          <xsp:expr>$cgi->param('lastname')</xsp:expr>
                      </xsp:attribute>
                      </input>
                  </td>
              </tr>
              <tr>
                  <td>Email:</td>
                  <td><input type="text" name="email">
                      <xsp:attribute name="value">
                          <xsp:expr>$cgi->param('email')</xsp:expr>
                      </xsp:attribute>
                      </input>
                  </td>
              </tr>
              <tr>
                  <td></td>
                  <td>
                      <input type="submit" name="type" value="query"/>
                      <input type="submit" name="type" value="insert"/>
                      <input type="submit" name="type" value="show all"/>
                  </td>
              </tr>
          </table>
          </form>
          </p>
          
          </xsp:logic>
      
        </esql:connection>
      </xsp:logic>
      
      <p><a href="esql.xsp?reset=1">Reset Database</a></p>
      
      <p><a href="showsource.xsp?esql.xsp">View Source</a></p>
      
      </body>
  </html>
  
  </xsp:page>
  
  
  
  1.1                  xml-axkit/demo/xsp/exception.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/ifparam.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/param.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/perform.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/sendmail.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/session.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/showsource.xsp
  
  Index: showsource.xsp
  ===================================================================
  <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core">
  
  <xsp:import>Apache::File</xsp:import>
  
  <html>
      <head>
          <title>Source for <xsp:expr>$r->args</xsp:expr></title>
          <link rel="stylesheet" url="/axkit/stylesheets/style.css"/>
      </head>
      
      <body>
      <h1>Source for <xsp:expr>$r->args</xsp:expr></h1>
      <xsp:logic>
      my $filename = $r->lookup_uri($r->args)->filename;
      my $file = Apache::File->new($filename);
      <pre>
      <xsp:expr><![CDATA[
          join('', <$file>);
      ]]></xsp:expr>
      </pre>
      </xsp:logic>
      <p>
      <a href="showsource.xsp?showsource.xsp">View Source</a>
      </p>
      </body>
  </html>
  
  </xsp:page>
  
  
  1.1                  xml-axkit/demo/xsp/util.xsp
  
  	<<Binary file>>
  
  
  1.1                  xml-axkit/demo/xsp/webutils.xsp
  
  	<<Binary file>>
  
  

Mime
View raw message