|
From: | Jonathon Sim <address@hidden> |
Subject: | [Phpgroupware-cvs] CVS: filemanager/templates/default edit.xsl,NONE,1.1 index.xsl,NONE,1.1 widgets.xsl,NONE,1.1 |
Date: | Mon, 03 Mar 2003 19:33:09 -0500 |
Update of /cvsroot/phpgroupware/filemanager/templates/default In directory subversions:/tmp/cvs-serv709 Added Files: edit.xsl index.xsl widgets.xsl Log Message: XSLT templates to go with new PHPGroupware code. Note that these templates are much more involved than the XSLT used in some other apps (there is a great deal of "code" in them) - hopefully this gives more flexibility in the appearence of filemanager than a simple "replacing variables" stucture might. --- NEW FILE --- <xsl:template name="app_data"> <form method="post"> <xsl:attribute name="action"><xsl:value-of select="form_action"/></xsl:attribute> <xsl:apply-templates select="filemanager_nav" /> <xsl:apply-templates select="preview" /> <xsl:apply-templates select="filemanager_edit" /> </form> </xsl:template> <xsl:template match="filemanager_nav"> <table class="app_header" width="100%"> <tr> <td class="tr_text" align="left" width="33%" > <xsl:apply-templates select="img_up/widget" /> <xsl:apply-templates select="img_home/widget" /> </td> <td class="app_header" align="center" width="33%"> <h3>Editing file: <xsl:value-of select="/*/*/*/filename"/> </h3> </td> <td align="right" > <table> <tr> <xsl:for-each select="/*/*/nav_data/*"> <td> <xsl:for-each select="./*"> <xsl:apply-templates select="." /> <br /> </xsl:for-each> </td> </xsl:for-each> </tr> </table> </td> </tr> </table> <hr /> </xsl:template> <xsl:template match="filemanager_edit"> <xsl:value-of select="output"/> <xsl:value-of select="preview"/> <br /> <xsl:apply-templates select="form_data/*" /> <xsl:apply-templates select="file_content" /> </xsl:template> <xsl:template match="preview"> <xsl:copy-of select="."/> </xsl:template> <xsl:template match="file_content"> <textarea name="edit_file_content" rows="50" cols="80" class="fileeditor"><xsl:value-of select="."/></textarea> </xsl:template> --- NEW FILE --- <xsl:template name="app_data"> <center> <form enctype="multipart/form-data"> <xsl:attribute name="action"> <xsl:value-of select="index/form_action"/> </xsl:attribute> <xsl:attribute name="method">post</xsl:attribute> <xsl:apply-templates select="index" /> <xsl:apply-templates select="files" /> <xsl:apply-templates select="body_data" /> <xsl:apply-templates select="buttons" /> <hr /> <xsl:apply-templates select="uploads" /> </form> </center> </xsl:template> <xsl:template match="index"> <table class="app_header" width="100%"> <tr> <td class="tr_text" align="left" width="33%" > <xsl:apply-templates select="img_up/widget" /> <xsl:value-of select="help_up"/> <xsl:apply-templates select="img_home/widget" /> <xsl:value-of select="help_home"/> </td> <td class="app_header" align="center" width="33%"> <h3> <xsl:apply-templates select="img_dir/widget" /> <xsl:value-of select="dir"/> </h3> </td> <td align="right" > <xsl:choose> <xsl:when test="img_ok"> <xsl:apply-templates select="img_cancel" /> <xsl:apply-templates select="button_cancel" /> <xsl:apply-templates select="img_ok" /> <xsl:apply-templates select="button_ok" /> <xsl:apply-templates select="action" /> <xsl:apply-templates select="fileman" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="/*/*/summary/file_count" /> files <br /> <xsl:value-of select="/*/*/summary/usage" /> bytes </xsl:otherwise> </xsl:choose> </td> </tr> </table> <p><xsl:value-of select="errors" /></p> <hr /> </xsl:template> <!--These templates print out the file list--> <xsl:template match="files"> <table class="table"> <tr class="th"> <xsl:for-each select="/*/*/file_attributes/*"> <td class="th_text"> <xsl:choose> <xsl:when test='name(./*)="widget"'> <xsl:apply-templates select="." /> </xsl:when> <xsl:otherwise> <xsl:value-of select="." /> </xsl:otherwise> </xsl:choose> </td> </xsl:for-each> </tr> <xsl:apply-templates select="file" /> </table> </xsl:template> <xsl:template match="file"> <tr> <xsl:choose> <xsl:when test="position() mod 2 = 0"> <xsl:attribute name="class">row_on</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="class">row_off</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:for-each select="*"> <td> <xsl:choose> <xsl:when test='name(./*)="widget" or name(./*/*)="widget"'> <xsl:apply-templates select="." /> </xsl:when> <xsl:otherwise> <xsl:value-of select="." /> </xsl:otherwise> </xsl:choose> </td> </xsl:for-each> </tr> </xsl:template> <!--Prints out the buttons--> <xsl:template match="buttons"> <xsl:for-each select="button"> <xsl:apply-templates select="widget" /> </xsl:for-each> </xsl:template> <!--The widgets that handle uploads--> <xsl:template match="uploads" > <xsl:apply-templates/> </xsl:template> --- NEW FILE --- <!--A widget is something like an input box, image etc, or a composite/virtual widget like a "seperator" or a "label". These are used throughout the filemanager as a cunning way of avoiding putting any HTML in the app NB:This means that someone clever could write an XSLT that converted to, say, Mozilla XUL, or QT's XML-UI, or a GTK glade interface etc (I dare you!) --> <xsl:template match="widget"> <xsl:variable name="type"><xsl:value-of select="type"/></xsl:variable> <xsl:choose> <xsl:when test='$type="select"'> <select> <xsl:attribute name="name"> <xsl:value-of select="name"/> </xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="value"/> </xsl:attribute> <xsl:value-of select="caption"/> <xsl:for-each select="options/option" > <option> <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute> <xsl:value-of select="caption"/> </option> </xsl:for-each> </select> </xsl:when> <xsl:when test='$type="seperator"'> <br /> </xsl:when> <xsl:when test='$type="img"'> <xsl:variable name="link"><xsl:value-of select="link"/></xsl:variable> <xsl:choose> <xsl:when test="link"> <a class="none"> <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute> <xsl:call-template name="img" /> </a> </xsl:when> <xsl:otherwise> <xsl:call-template name="img" /> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test='$type="label"'> <xsl:value-of select="caption" /> </xsl:when> <xsl:when test='$type="link"'> <a> <xsl:attribute name="href"><xsl:value-of select="href"/></xsl:attribute> <xsl:value-of select="caption"/> </a> </xsl:when> <xsl:otherwise> <input> <xsl:attribute name="type"><xsl:value-of select="type"/></xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="name"/></xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="value"/> </xsl:attribute> <xsl:value-of select="caption"/> </input> </xsl:otherwise> </xsl:choose> <xsl:apply-templates select="widget" /> </xsl:template> <xsl:template name="img"> <xsl:element name="img"> <xsl:attribute name="border">0</xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="src"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="alt"/></xsl:attribute> <xsl:attribute name="valign">center</xsl:attribute> <xsl:value-of select="caption" /> </xsl:element> </xsl:template> <xsl:template match="form"> <form> <xsl:attribute name="action"> <xsl:value-of select="action"/> </xsl:attribute> <xsl:attribute name="method"> <xsl:value-of select="method"/></xsl:attribute> <xsl:attribute name="enctype"> <xsl:value-of select="enctype"/></xsl:attribute> <table> <tr> <xsl:for-each select="members"> <xsl:apply-templates /> </xsl:for-each> </tr> </table> </form> </xsl:template> <xsl:template match="table"> <table> <xsl:attribute name="class"><xsl:value-of select="class"/></xsl:attribute> <xsl:apply-templates select="table_head"/> <xsl:for-each select="table_row"> <xsl:choose> <xsl:when test="position() mod 2 = 0"> <xsl:call-template name="table_row"> <xsl:with-param name="class">row_on</xsl:with-param> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="table_row"> <xsl:with-param name="class">row_off</xsl:with-param> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:for-each> </table> </xsl:template> <xsl:template match="table_head"> <tr class="th"> <xsl:apply-templates select="table_col"/> </tr> </xsl:template> <xsl:template name="table_row"> <xsl:param name="class">tr</xsl:param> <tr class="{$class}"> <xsl:apply-templates select="table_col" /> </tr> </xsl:template> <xsl:template match="table_col"> <td> <xsl:apply-templates /> </td> </xsl:template>
[Prev in Thread] | Current Thread | [Next in Thread] |