Formatting columns

politev's Avatar

politev

23 Feb, 2013 12:07 AM

I've started off in a new adventure in Cascade Server land. I'm creating a page for our Public Safety Department to upload Crime Alerts to our site and have them visible. Much like this page: http://police.ucsf.edu/index.php?/Hidden-Menu/crime-alerts.html. So far, I have achieved this: http://testsite.uchastings.edu/about/admin-offices/public-safety/cr.... I would like to create the heading as in the first website, "Alert Number", "Date", and "Description". These heading will be permanent; while the alerts will kept being added to. I guess my question comes down to adding HTML and CSS formatting? Should a pair a XHTML block with the XSLT; which I am not totally sure how to do? Thanks

  1. 1 Posted by Bryce Roberts on 23 Feb, 2013 05:49 PM

    Bryce Roberts's Avatar

    Hello,

    The layout you are describing sounds like a very regular set of data. This seems like it would be perfect for couple of solutions. One solution could be to create a data definition on the page with a repeatable group that contains the Alert Number, Date, and Description as fields. This could then be formatted with either Velocity or XSLT format to create your output. Another solution could be to store all the values as meta attached to the pdf files of the reports (if you store them in Cascade). Then you could create an index that has the meta data for the files and generate your output with either Velocity or XSLT.

    Hope this helps and gives you come ideas,
    Bryce

  2. 2 Posted by Ryan Griffith on 25 Feb, 2013 01:50 PM

    Ryan Griffith's Avatar

    Hi,

    Just wanted to add in that you could also use Structured Data Blocks that have a Data Definition containing the fields for the alert information (eg number, date, description) as well as a file chooser for the PDF. This solution would also require using an Index Block to generate your listing.

    IMO, I think Bryce's second solution, adding metadata and dynamic metadata fields to the Files, might be the simplest, and perhaps best solution. This would make updating and maintenance for end users much simpler, because they would only have to create one Asset vs. multiple (ie a Block/Page and a File). You could even go one step further with this and use Database Publishing to publish the File and Metadata to a Database, allowing you to re-use the content elsewhere (or maybe even create a simple search engine).

  3. 3 Posted by politev on 25 Feb, 2013 05:04 PM

    politev's Avatar

    -----Original Message-----
    From: Bryce Roberts [mailto:[email blocked]]
    Sent: Saturday, February 23, 2013 9:49 AM
    To: Polite, Vincent
    Subject: Re: Formatting columns [General #12225]

    Thanks Bryce,
    I already have the Data Definition setup so the user can upload the pdfs and input the other data. I'm unsure about the creating the headings for what is inputted. I'm sure I don't have the correct vocabulary for this. It is the static part that is my concern.

    Thanks,
    Vince

    // Add your reply above here
    ==================================================
    From: Bryce Roberts
    Subject: Formatting columns

    Hello,

    The layout you are describing sounds like a very regular set of data. This seems like it would be perfect for couple of solutions. One solution could be to create a data definition on the page with a repeatable group that contains the Alert Number, Date, and Description as fields. This could then be formatted with either Velocity or XSLT format to create your output. Another solution could be to store all the values as meta attached to the pdf files of the reports (if you store them in Cascade). Then you could create an index that has the meta data for the files and generate your output with either Velocity or XSLT.

    Hope this helps and gives you come ideas, Bryce

    View this Discussion online: http://help.hannonhill.com/discussions/general/12225-formatting-columns

    --

    To unsubscribe and stop receiving emails from http://help.hannonhill.com, visit
    http://help.hannonhill.com/unsubscribe/bbd12f8174eee7a9c578a5e9e1423ec1620f1d54

  4. 4 Posted by politev on 25 Feb, 2013 05:26 PM

    politev's Avatar

    Hi Ryan,
    Forgive me, I know I don't have the correct vocabulary. I have the dynamic part of this working. I have the Data Definition set up for what the user inputs. It is the static part I'm not sure about. It is easier for me to think in terms of an HTML; where I have more experience. If you have a table <table>, I'm looking to create the table headings <th>. Should I use the WYSIWYG editor in the Data Definition Builder for the headings? How do I alter the XSLT?

    Current Data Definition:

    <system-data-structure>
      <text type="datetime" identifier="date" label="Date"/>
      <text identifier="title" label="Alert Number"/>
      <asset type="file" identifier="file" label="Description" multiple="true"/>
    </system-data-structure>

    And the XSLT:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:include href="/__development/formats - XSLT/included helpers/date format"/>
        <xsl:template match="system-index-block">
            <xsl:apply-templates select="system-block">
                <xsl:sort data-type="number" lang="en" order="descending" select="system-data-structure/date"/>
            </xsl:apply-templates>
        </xsl:template>
        <xsl:template match="system-block">
            <h2><xsl:value-of select="system-data-structure/title"/></h2>
            <xsl:call-template name="format-date">
                <xsl:with-param name="date" select="system-data-structure/date"/>
                <xsl:with-param name="mask">mmmm dd, yyyy</xsl:with-param>
            </xsl:call-template>
            <xsl:if test="count(system-data-structure/file) &gt; 0">
            <ul>
            <xsl:for-each select="system-data-structure/file">
                <li>
                    <a class="pdf" href="{path}">
                        <xsl:choose>
                            <xsl:when test="title"><xsl:value-of select="title"/></xsl:when>
                            <xsl:when test="display-name"><xsl:value-of select="display-name"/></xsl:when>
                            <xsl:otherwise><xsl:value-of select="name"/></xsl:otherwise>
                        </xsl:choose>
                    </a>
                </li>
            </xsl:for-each>
            </ul>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>

    Thanks,
    Vince

  5. 5 Posted by Ryan Griffith on 25 Feb, 2013 08:38 PM

    Ryan Griffith's Avatar

    Hi Vince,

    If you're looking to convert the XSLT above into a table, I would do something like the following:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 
        <xsl:include href="/__development/formats - XSLT/included helpers/date format"/> 
        <xsl:template match="system-index-block"> 
            <table>
                <thead>
                    <tr>
                        <th>Alert #</th>
                        <th>Date</th>
                        <th>Description</th>
                    </tr>
                </thead>
                <tbody>
                <xsl:apply-templates select="system-block"> 
                    <xsl:sort data-type="number" lang="en" order="descending" select="system-data-structure/date"/> 
                </xsl:apply-templates> 
                </tbody>
            </table>
        </xsl:template> 
        <xsl:template match="system-block"> 
            <tr>
                <td><xsl:value-of select="system-data-structure/title"/></td> 
                <td>
                <xsl:call-template name="format-date"> 
                    <xsl:with-param name="date" select="system-data-structure/date"/> 
                    <xsl:with-param name="mask">mmmm dd, yyyy</xsl:with-param> 
                </xsl:call-template> 
                </td>
                <td>
                    <xsl:if test="count(system-data-structure/file) &gt; 0"> 
                    <ul>
                    <xsl:for-each select="system-data-structure/file"> 
                        <li> 
                            <a class="pdf" href="{path}"> 
                                <xsl:choose> 
                                    <xsl:when test="title"><xsl:value-of select="title"/></xsl:when> 
                                    <xsl:when test="display-name"><xsl:value-of select="display-name"/></xsl:when> 
                                    <xsl:otherwise><xsl:value-of select="name"/></xsl:otherwise> 
                                </xsl:choose> 
                            </a> 
                        </li> 
                    </xsl:for-each> 
                    </ul> 
                    </xsl:if> 
                </td>
            </tr>
        </xsl:template> 
    </xsl:stylesheet>
    
  6. 6 Posted by politev on 25 Feb, 2013 08:46 PM

    politev's Avatar

    Thanks a lot Ryan. I was just about to use an XHTML block to create the headings...Finally figured that part out. But using the table, we could probably use it in different ways, substituting the heading.

    Thanks,
    Vince

  7. 7 Posted by Ryan Griffith on 25 Feb, 2013 09:01 PM

    Ryan Griffith's Avatar

    Thank you for the follow up, Vince. Glad to hear that did the trick.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Thanks

  8. Ryan Griffith closed this discussion on 25 Feb, 2013 09:01 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac