Login   Register  
PHP Classes
elePHPant
Icontem

File: Datalus/XSL/edit_ajax.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/edit_ajax.xsl  >  Download  
File: Datalus/XSL/edit_ajax.xsl
Role: Auxiliary data
Content type: text/plain
Description: edit transformation (AJAX login)
Class: Datalus
Build Web applications from XML definitions
Author: By
Last change:
Date: 7 years ago
Size: 36,416 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">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
            <head>
                <title><xsl:value-of select="@title" /></title>
                <script type="text/javascript" src="Datalus/Javascript/ImageInput/ImageInput.js" >
                    dummy();
                </script>
                <script language="javascript" type="text/javascript" src="Datalus/Javascript/tiny_mce/tiny_mce.js" >
                    dummy();
                </script>
                <script language="javascript" type="text/javascript" src="Datalus/Javascript/Debugger/Debugger.js" >
                    dummy();
                </script>
                <script type="text/javascript" src="Datalus/Javascript/TableSort/Event.js">
                    dummy();
                </script>
                <script type="text/javascript" src="Datalus/Javascript/ibox/ibox.js">
                    dummy();
                </script>
                <script type="text/javascript" src="Datalus/Javascript/TableSort/SortedTable.js">
                            dummy();
                        </script>
                <script type="text/javascript">
                    var sourceTable, destTable;
                    onload = function() {
                        sourceTable = new SortedTable('s');
                        destTable = new SortedTable('d');
                        mySorted = new SortedTable();
                    }
                    function moveRows(s,d) {
                        var a = new Array();
                        for (var o in s.selectedElements) {
                            a.push(s.selectedElements[o]);
                        }
                        for (var o in a) {
                            var elm = a[o];
                            var tds = elm.getElementsByTagName('td');
                            for (var i in tds) {
                                if (tds[i].headers) tds[i].headers = d.table.id+''+tds[i].headers.substr(d.table.id.length);
                            }
                            d.body.appendChild(a[o]);
                            d.deselect(a[o]);
                            d.init(d.table);
                            d.sort();
                            s.deselect(a[o]);
                            s.init(s.table);
                        }
                    }
                </script>
                <script language="javascript" type="text/javascript">
                    var READY_STATE_UNINITIALIZED=0;
                    var READY_STATE_LOADING=1;
                    var READY_STATE_LOADED=2;
                    var READY_STATE_INTERACTIVE=3;
                    var READY_STATE_COMPLETE=4;
                    var req;

                    function getXMLHTTPRequest(){
                        var xRequest=null;
                        if (window.XMLHttpRequest){
                            xRequest = new XMLHttpRequest();
                        }else if (typeof ActiveXObject != "undefined"){
                            XRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        return xRequest;
                    }

                    function sendRequest(url, params, callback, method){
                        if(!method){
                            method = "GET";
                        }
                        req = getXMLHTTPRequest();
                        if(req){
                            req.onreadystatechange=callback;
                            req.open(method,url,true);
                            req.setRequestHeader("Content-Type", 
                                "application/x-www-form-urlencoded");
                            req.send(params);
                        }
                    }

                    function login(){
                        sendRequest("ajax_server.php", 
                            "loginname="+document.account.loginname.value+
                                "<xsl:text disable-output-escaping="yes">&#38;</xsl:text>loginpassword="+
                                document.account.loginpassword.value, 
                            onLogin, "POST");
                    }

                    function onLogin(){
                        var ready = req.readyState;
                        var data = null;
                        if (ready == READY_STATE_COMPLETE){
                            data = req.responseText;
                            document.getElementById("accountpane").innerHTML=data;
                            updateMenus();
                        }
                    }

                    function logout(){
                        sendRequest("ajax_server.php", 
                            "loginname="+document.account.loginname.value,
                            onLogout, "POST");
                    }

                    function onLogout(){
                        var ready = req.readyState;
                        var data = null;
                        if (ready == READY_STATE_COMPLETE){
                            data = req.responseText;
                            document.getElementById("accountpane").innerHTML=data;
                            updateMenus();
                        }
                    }

                    function updateMenus(){
                        sendRequest("ajax_server.php", 
                            "updatemenus=true", 
                            onUpdateMenus, "POST");
                    }
                        
                    function onUpdateMenus(){
                        var ready = req.readyState;
                        var data = null;
                        if (ready == READY_STATE_COMPLETE){
                            data = req.responseText;
                            document.getElementById("topmenu").innerHTML=data;
                        }
                    }

                    function onReadyStateChange(){
                        var ready = req.readyState;
                        var data = null;
                        if (ready == READY_STATE_COMPLETE){
                            data = req.responseText;
                            alert(data);
                        }else{
                            data = "loading...["+ready+"]";
                        }
                        //... do something with the data...
                    }
                </script>
                <script language="javascript" type="text/javascript">
                    tinyMCE.init({
                        mode : "textareas",
                        safari_warning : "false",
                        encoding: "xml",
                        entity_encoding : "named"
                    });
                
                    function fileBrowserCallBack(field_name, url, type, win) {
                        // This is where you insert your custom filebrowser logic
                        alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type);
                
                        // Insert new URL, this would normaly be done in a popup
                        win.document.forms[0].elements[field_name].value = "someurl.htm";
                    }
                </script>
                <!--
                <script type="text/javascript" src="Datalus/Javascript/DateTimeInput/DateTimeInput.js" >
                    dummy();
                </script>
                -->
                <script type="text/javascript" src="Datalus/Javascript/DateTimeInput/calendarDateInput.js" >
                    dummy();
                </script>
                <script type="text/javascript" src="Datalus/Javascript/LocationInput/locationInput.js" >
                    dummy();
                </script>
                <!--
                <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAEFe1FuUCfjkzjXLE9fmzrBTzuve9KbFvn86cdc7W7sQljw9c9hS8YUpUpkBggYcUeb0U52T35M5UWw"
      type="text/javascript">
                    dummy();
                </script>
                <script type="text/javascript" src="Datalus/Javascript/LocationInput/gmapInput.js" >
                    dummy();
                </script>
                -->
                <xsl:apply-templates select="verifiers"/>
                <link rel="stylesheet" type="text/css" href="{@style}" />
                <link rel="stylesheet" href="Datalus/Javascript/ibox/ibox.css" type="text/css" media="screen"/>
                <link media="all" type="text/css" href="Datalus/Javascript/TextEditor/rte.css" rel="stylesheet" />
            </head>
            <body>
            <div id="titlebar"><img src="Graphics/logo.png" /></div>
            <xsl:apply-templates select="account"/>
            <xsl:apply-templates select="menu"/>
            <div id="container">
            <xsl:copy-of select="div|p|img|br|ol|ul|li|i|b|a"/>
            <xsl:apply-templates select="chat"/>
            <xsl:apply-templates select="object"/>
            <xsl:apply-templates select="object/list"/>
            <xsl:apply-templates select="object/object"/>
            <xsl:apply-templates select="list"/>
            <xsl:apply-templates select="pages"/>
            <xsl:apply-templates select="footnote"/>
            </div>
            <div id="fixed_container">
            <xsl:apply-templates select="fixed"/>
            </div>
            <div id="badges">
                    <xsl:apply-templates select="badge"/>
                </div>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="badge">
        <img src="{@image}"/>
    </xsl:template>
    
    <xsl:template match="account[@loggedin='true']">
        <div id="accountpane"><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></div>
    </xsl:template>
    
    <xsl:template match="account">
        <div id="accountpane"><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></div>
    </xsl:template>
    
    <xsl:template match="chat">
        <div class="object" id="chat">
        <div id="object_header"><xsl:value-of select="object/@name" />Chat</div>
        <center><applet codebase="chat" archive="chat.jar" code="Chat" width="85%" height="500px"> 
            <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>
    
    <xsl:template match="pages">
        <div class="object">
            <xsl:value-of select="text()" />
        </div>
    </xsl:template>
    
    <!--match all menus with submenu attr & menu children-->
    <xsl:template match="menu">
        <div id="topmenu">
        <div id="{@type}bar">
            <div id="object_header"><xsl:value-of select="@name" /></div>
            <xsl:apply-templates />
        </div>
        </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">
            <div id="object_header"><xsl:value-of select="object/@name" /> list</div>
            <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">
            <div id="object_header"><xsl:value-of select="object/@name" /> list</div>
            <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">
            <div id="object_header"><xsl:value-of select="@name" /> list</div>
            <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">
                <div id="object_header"><xsl:value-of select="@name" /></div>
                <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) and @editable='true']">
        <form name="{@name}" enctype="multipart/form-data" method="post" onsubmit="tinyMCE.triggerSave(); return allowSubmit();">
            <div class="object">
                <div id="object_header"><xsl:value-of select="@lprepend" /><xsl:value-of select="@name" /><xsl:value-of select="@lappend" /></div>
                <div id="padded">
                <xsl:copy-of select="p|img|br|h4|ol|ul|li|i|b|a|text()"/>
                <input type="hidden" value="{@name}" name="type"/>
                <table id="{@name}">
                    <xsl:apply-templates select="./*[@name]"/>
                    <tr>
                        <td>
                            <input name="clear" type="reset" value="Clear" />
                        </td>
                        <td>
                            <input type="submit" value="Submit" name="submit" />
                        </td>
                    </tr>
                </table>
                EDIT ME!!!!
                </div>
            </div>
        </form>
        <xsl:apply-templates select="comments"/>
    </xsl:template>
    
    <xsl:template match="object[not(ancestor::list) and not(@editable='true')]"> 
        <form name="{@name}" enctype="multipart/form-data" method="post" onsubmit="tinyMCE.triggerSave(); return allowSubmit();">
            <xsl:if test="descendant::file">
                <script type="text/javascript" language="javascript">
                    document.<xsl:value-of select="@name"/>.target = 'UploadTarget';
                    //addEvent(document.<xsl:value-of select="@name"/>, "submit", function(){tinyMCE.triggerSave(); document.getElementById('upload_status').innerHTML='Uploading files...<br/><img src="img/progress_bar.gif"/>'; return allowSubmit();});
                    addEvent(document.<xsl:value-of select="@name"/>, "submit", submitWithFile);

                    function submitWithFile(){
                        params = parseQuery("width=400;height=128");
                        url = "#upload_status";
                        title = "Uploading files...";
                        showBG();
                        showIbox(url,title,params);
                        window.onscroll = maintPos;
                        window.onresize = maintPos;
                        return true;
                    }

                    var firstLoad = true;
                    function loadIframe(){
                        if(firstLoad){
                            firstLoad = false;
                        }else{
                            document.location.href=document.location.href.replace(/<xsl:text disable-output-escaping="yes">&#38;</xsl:text>?edit=true/, '');
                        }
                    }
                </script>
                <iframe src="" name="UploadTarget" id="UploadTarget" style="width:0;height:0;border:0" onload="loadIframe()">dummy</iframe>
                <div id="upload_status" style="display:none;background:#000;"><div style="background:#fff;width=300px;height=128px;vertical-align:center;text-align:center;"><img src="Datalus/Javascript/ibox/images/indicator.gif" /></div></div>
            </xsl:if>
            <div class="object">
                <div id="object_header"><xsl:value-of select="@lprepend" /><xsl:value-of select="@name" /><xsl:value-of select="@lappend" /></div>
                <div id="padded">
                <xsl:copy-of select="div|p|img|br|h4|ol|ul|li|i|b|a"/>
                <input type="hidden" value="{@name}" name="type"/>
                <table id="{@name}">
                    <xsl:apply-templates select="./*[@name]"/>
                    <tr>
                        <td>
                            <input name="clear" type="reset" value="Clear" />
                        </td>
                        <td>
                            <input type="submit" value="Submit" name="submit" />
                        </td>
                    </tr>
                </table>
                </div>
            </div>
        </form>
        <xsl:apply-templates select="comments"/>
    </xsl:template>
    
    <xsl:template match="string[not(ancestor::list) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" type="text" name="{@name}" value="{text()}" />
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" type="text" name="{@name}" value="{text()}" />
                </xsl:if>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="integer[not(ancestor::list) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" type="text" name="{@name}" value="{text()}" />
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" type="text" name="{@name}" value="{text()}" />
                </xsl:if>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="string[@obscure='true' and not(ancestor::list) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" type="password" name="{@name}" value="{text()}" />
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" type="password" name="{@name}" value="{text()}" />
                </xsl:if>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="user[not(ancestor::list) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" type="text" name="{@name}" value="{text()}" />
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" type="text" name="{@name}" value="{text()}" />
                </xsl:if>
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="invisible">
        <input type="hidden" name="{@name}" value="{@value}" />
    </xsl:template>
    
    <xsl:template match="hidden[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <input type="hidden" name="{@name}" value="{text()}" />
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="*[not(ancestor::list) and @obsfuscate='true']">
        <tr>
            <td>
            </td>
            <td>
                <input type="hidden" name="{@name}" value="{text()}" />
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="*[not(ancestor::list) and @display='true']">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:value-of select="text()" /><input type="hidden" name="{@name}" value="{text()}" />
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="image[not(ancestor::list) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" name="{@name}" type="file" onchange="showLocalImage(this.value)" value="{text()}" />
                    <div id="imagepreview"><img src="Images/{text()}" /></div>
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" name="{@name}" type="file" onchange="showLocalImage(this.value)" value="{text()}" />
                    <div id="imagepreview"><img src="Images/{text()}" /></div>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="file[not(ancestor::list) and not(@obsfuscate)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" name="{@name}" type="file" value="{text()}" />
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" name="{@name}" type="file" value="{text()}" />
                </xsl:if>
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="password[not(ancestor::list) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <input class="error {@verifier} {@required}" type="password" name="{@name}" value="{text()}" />
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <input class="{@verifier} {@required}" type="password" name="{@name}" value="{text()}" />
                </xsl:if>
            </td>
        </tr>
    </xsl:template>
    
    <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) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <script type="text/javascript">DateInput('<xsl:value-of select="@name" />', true, 'YYYY-MM-DD HH:NN:SS', '<xsl:value-of select="text()" />');</script>
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <script type="text/javascript">DateInput('<xsl:value-of select="@name" />', true, 'YYYY-MM-DD HH:NN:SS', '<xsl:value-of select="text()" />');</script>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>
    
    <xsl:template match="block[not(ancestor::list) and not(@obsfuscate) and not(@display)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <textarea class="error {@verifier} {@required}" id="elm1" name="{@name}" rows="15" cols="80" style="width: 100%"><xsl:value-of disable-output-escaping="no" select="text()" /><xsl:text> </xsl:text></textarea>
                    <div class="error">
                        <xsl:value-of select="@error" />
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <textarea class="{@verifier} {@required}" id="elm1" name="{@name}" rows="15" cols="80" style="width: 100%"><xsl:value-of disable-output-escaping="no" select="text()" /><xsl:text> </xsl:text></textarea>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="location[not(ancestor::list)]">
        <tr>
            <td>
                <xsl:value-of select="@name" />
            </td>
            <td>
                <xsl:if test="@error">
                    <div class="error">
                        <xsl:value-of select="@error" />
                        <script type="text/javascript">LocationInput('<xsl:value-of select="@name"/>', '<xsl:value-of select="text()"/>');</script>
                    </div>
                </xsl:if>
                <xsl:if test="not(@error)">
                    <script type="text/javascript">LocationInput('<xsl:value-of select="@name"/>', '<xsl:value-of select="text()"/>');</script>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="verifiers">
        <script type="text/javascript" language="javascript" src="Datalus/Javascript/Verifiers/verifierCommon.js">
            dummy();
        </script>
        <xsl:for-each select="verifier">
            <script type="text/javascript" language="javascript" src="Datalus/Javascript/Verifiers/{@file}">
                dummy();
            </script>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="comments">
        <div class="object">
            <div id="object_header">Comments</div>
            <div id="padded"> 
                <xsl:for-each select="comment">
                    <div class="comment">
                        <table>
                            <tr>
                                <td>
                                    <div class="subject">
                                        <xsl:value-of select="@subject"/>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><xsl:value-of disable-output-escaping="yes" select="text()"/></td>
                            </tr>
                            <tr>
                                <td>
                                    <div class="tagline">
                                        Posted by: <xsl:value-of select="@handle"/>
                                        at <xsl:value-of select="@creationdate"/>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </xsl:for-each>
                <h3>Add a comment</h3>
                <table>
                    <form method="post" action="addComment.php" name="comments" onsubmit="return allowSubmit();">
                        <tr>
                            <td>
                                <label for="openidhandle">OpenID Handle</label>
                            </td>
                            <td>
                                <input class="required" type="text" name="openidhandle" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="subject">Subject</label>
                            </td>
                            <td>
                                <input class="required" type="text" name="subject" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="body">Body</label>
                            </td>
                            <td>
                                <textarea name="body" rows="15" cols="80" style="width: 100%">blah</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input name="type" type="hidden" value="{@type}" />
                                <input name="id" type="hidden" value="{@id}" />
                                <input name="clear" type="reset" value="Clear" />
                            </td>
                            <td>
                                <input type="submit" value="Submit" name="submit" />
                            </td>
                        </tr>
                    </form>
                </table>
            </div>
        </div>
    </xsl:template>

</xsl:stylesheet>