Login   Register  
PHP Classes
elePHPant
Icontem

File: Datalus/XSL/ajax_server.xsl

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Abbey Sparrow  >  Datalus  >  Datalus/XSL/ajax_server.xsl  >  Download  
File: Datalus/XSL/ajax_server.xsl
Role: Auxiliary data
Content type: text/plain
Description: AJAX login transformation
Class: Datalus
Build Web applications from XML definitions
Author: By
Last change:
Date: 2006-11-07 17:58
Size: 11,993 bytes
 

Contents

Class file image Download
<?xml version="1.0" encoding="iso-8859-1" ?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

    <xsl:template match="container">
    </xsl:template>
    
    <xsl:template match="account[@loggedin='true']">
        <form name="account" method="post" onsubmit="logout(); return false;">
            <input type="hidden" name="loginname" value="logout" />
            <xsl:value-of select="@name" />
            <input type="submit" value="Logout" class="loginbtn" />
        </form>
    </xsl:template>
    
    <xsl:template match="account">
        <form name="account" method="post" onsubmit="login(); return false;">
            <input type="text" name="loginname" size="15" />
            <input type="password" name="loginpassword" size="15" />
            <input type="submit" value="Login" />
        </form>
    </xsl:template>
    
    <xsl:template match="chat">
        <div class="object">
        <h4><xsl:value-of select="object/@name" />Chat</h4>
        <center><applet codebase="chat" archive="chat.jar" code="Chat" width="85%" height="80%"> 
            <param name="config" value="config.txt" />
            <param name="smiles" value="on" />
            <param name="multi-rooms" value="on" />
            <param name="fgColor" value="#{@fgcolor}" />
            <param name="bgColor" value="#{@bgcolor}" />
            <param name="auto-login" value="{@user}" />
            Your browser is NOT Java enabled 
        </applet></center>
        </div>
    </xsl:template>
    
    <!--match all menus with submenu attr & menu children-->
    <xsl:template match="menu">
        <div id="{@type}bar">
            <div id="object_header"><xsl:value-of select="@name" /></div>
            <xsl:apply-templates />
        </div>
    </xsl:template>
    
    <!--match all menus with a ancestor menu and a child menu-->
    <xsl:template match="submenu">
        <div id="{@type}item"><a href="{@location}"><xsl:value-of select="@name" /></a>
            <div id="{@type}submenu"><xsl:apply-templates /></div>
        </div>
    </xsl:template>
    
    <!--match all menus without children-->
    <xsl:template match="menuitem"><div id="{@type}item"><a href="{@location}"><xsl:value-of select="@name" /></a></div></xsl:template>
    
    <xsl:template match="list[@expand='true']">
        <form action="view.php"  onsubmit="return submitForm();">
            <div class="object">
            <h4><xsl:value-of select="object/@name" /> list</h4>
            <table class="sorted" cellspacing="0" cellpadding="0">
            <thead>
            <xsl:apply-templates select="tabhead" />
            </thead>
            <tbody>
            <xsl:apply-templates select="object" />
            </tbody>
            </table>
            <table cellspacing="0" cellpadding="0">
            <tr>
            <td><form name="addGroup" method="get">
                <input type="hidden" name="type" value="{object/@name}" />
                <input type="hidden" name="groupid" value="{@id}" />
                <input type="hidden" name="groupname" value="{@groupname}" />
                <input type="submit" value="Insert  {object/@name}" name="addgroup" />
            </form></td>
            <td><form name="newObject" method="get">
                <input type="hidden" name="type" value="{object/@name}" />
                <input type="hidden" name="id" value="{@id}" />
                <input type="hidden" name="groupname" value="{@groupname}" />
                <input type="submit" value="New {object/@name}" name="addgroup" />
            </form></td>
            </tr>
            </table>
            </div>
        </form>
    </xsl:template>
    
    <xsl:template match="list">
        <form action="view.php"  onsubmit="return submitForm();">
            <div class="object">
            <h4><xsl:value-of select="object/@name" /> list</h4>
            <table class="sorted" cellspacing="0" cellpadding="0">
            <thead>
            <xsl:apply-templates select="tabhead" />
            </thead>
            <tbody>
            <xsl:apply-templates select="object" />
            </tbody>
            </table>
            </div>
        </form>
    </xsl:template>
    
    <xsl:template match="list[@expand='matrix']">
        <form action="{@target}"  onsubmit="return submitForm();">
            <div class="object">
            <h4><xsl:value-of select="@name" /> list</h4>
            <table class="sorted" cellspacing="0" cellpadding="0">
            <thead>
            <xsl:apply-templates select="tabhead" />
            </thead>
            <tbody>
            <xsl:apply-templates select="row" />
            <xsl:apply-templates select="object" />
            </tbody>
            </table>
            <form name="addrow" method="get">
                <input type="hidden" name="groupid" value="{@id}" />
                <input type="submit" value="new" name="mode" />
            </form>
            </div>
        </form>
    </xsl:template>
    
    <xsl:template match="list[@expand='matrix']//row">
        <tr>
            <xsl:apply-templates />
            <td><form action="{@target}"><input type="hidden" name="id" value="{@id}" /><input type="submit" value="edit..." name="edit" /></form></td>
        </tr>
    </xsl:template>
    
    <xsl:template match="list[@expand='true']//tabhead">
        <tr>
            <xsl:apply-templates />
            <th></th>
        </tr>
    </xsl:template>
    
    <xsl:template match="list[not(@expand='true')]//tabhead">
        <tr>
            <xsl:apply-templates />
        </tr>
    </xsl:template>
    
    <xsl:template match="list//colhead">
        <th id="{@name}"><span>
            <xsl:value-of select="text()" />
        </span></th>
    </xsl:template>
    
    <xsl:template match="list[@expand='true']//object">
        <tr>
            <xsl:apply-templates />
            <td><form action="view.php"><input type="hidden" name="type" value="{@name}" /><input type="hidden" name="id" value="{*[@name='id']/text()}" /><input type="submit" value="edit..." name="edit" /></form></td>
        </tr>
    </xsl:template>
    
    <xsl:template match="list[not(@expand='true')]//object">
        <tr>
            <xsl:apply-templates />
        </tr>
    </xsl:template>
    
    <xsl:template match="list//string">
        <td axis="string" headers="{@name}">
            <xsl:value-of select="text()" />
        </td>
    </xsl:template>
    
    <xsl:template match="list//userlink">
        <td axis="string" headers="{@name}">
            <form action="users.php" mode="get"><input type="hidden" name="mode" value="edit" /><input type="hidden" name="id" value="{@id}" /><input type="submit" value="edit..." name="edit" /></form>
        </td>
    </xsl:template>
    
    <xsl:template match="list//image">
        <td>
            <xsl:value-of select="text()" />
        </td>
    </xsl:template>
    
    <xsl:template match="list//instant">
        <td axis="date" headers="{@name}">
            <xsl:value-of select="text()" />
        </td>
    </xsl:template>
    
    <xsl:template match="list//hidden">
    </xsl:template>
    
    <xsl:template match="list//password">
        <td>
            *
        </td>
    </xsl:template>
    
    <xsl:template match="list//string[@obscure='true']">
        <td>
            *
        </td>
    </xsl:template>
    
    <xsl:template match="list//instance">
        <td><xsl:value-of select="text()" /></td>
    </xsl:template>
    
    <xsl:template match="footnote">
            <div id="footnote">
                <p><xsl:copy-of select="br|h4|ol|ul|li|i|b|a|text()"/></p>
            </div>
    </xsl:template>
    
    <xsl:template match="fixed">
            <div class="fixed">
                <h4><xsl:value-of select="@name" /></h4>
                <div id="padded">
                <xsl:copy-of select="text()|p|img|br|h4|ol|ul|li|i|b|a"/>
                </div>
            </div>
    </xsl:template>
    
    <xsl:template match="object[not(ancestor::list)]">
        <div class="object">
            <h4><xsl:value-of select="@lprepend" /><xsl:value-of select="@name" /><xsl:value-of select="@lappend" /></h4>
            <div id="padded">
            <xsl:copy-of select="p|img|br|h4|ol|ul|li|i|b|a|text()"/>
            <table id="{@name}">
                <xsl:apply-templates select="./*[@name]"/>
            </table>
            </div>
        </div>
    </xsl:template>
    
    <xsl:template match="string[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:value-of select="text()" />
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="string[@obscure='true' and not(ancestor::list)]">
    </xsl:template>

    <xsl:template match="invisible">
    </xsl:template>
    
    <!-- TODO: this probably shouldn't be shown at all like invisible -->
    <xsl:template match="hidden[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:value-of select="text()" />
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="image[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <img src="Images/{text()}"/>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="password[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                ************
            </td>
        </tr>
    </xsl:template>
   
    <!-- figure out what should be displayed for the following things -->
    <xsl:template match="discriminator[not(ancestor::list)]">
        <table border="0">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:apply-templates select="enumerator[@position='opOne']" />
            </td>
            <td>
                <xsl:apply-templates select="enumerator[@position='op']" />
            </td>
            <td>
                 <xsl:apply-templates select="nakedstring" />
            </td>
        </tr>
        </table>
    </xsl:template>
    
    <xsl:template match="action">
        <input type="submit" value="{@value}" name="{@name}" />
    </xsl:template>
    
    <xsl:template match="nakedstring">
        <input type="text" name="{@name}" value="{text()}" />
    </xsl:template>
    
    <xsl:template match="enumerator[not(ancestor::list)]">
        <select name="{@name}" size="1">
            <xsl:apply-templates select="option" />
        </select>
    </xsl:template>
    
    <xsl:template match="enumeration[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <select name="{@name}" size="1">
                    <xsl:apply-templates select="option" />
                </select>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="option[not(ancestor::list)]">
        <option  value="{@value}"><xsl:value-of select="text()" /></option>
    </xsl:template>
    
    <xsl:template match="instant[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:value-of select="text()" />
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="block[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:value-of disable-output-escaping="yes" select="text()" />
            </td>
        </tr>
    </xsl:template>
    
</xsl:stylesheet>